Update createNewDeposit tests
use emergencyPauseNewDeposits if a disabled state is required
import expectThrow from './helpers/expectThrow'
+import {
+ createSnapshot,
+ restoreSnapshot,
+} from './helpers/snapshot'
const BytesLib = artifacts.require('BytesLib')
const BTCUtils = artifacts.require('BTCUtils')
@@ -108,11 +112,16 @@ contract('DepositFunding', (accounts) => {
await tbtcDepositToken.forceMint(accounts[4], web3.utils.toBN(deployed.TestDeposit.address))
beneficiary = accounts[4]
+ await testInstance.reset()
+ await testInstance.setKeepAddress(deployed.ECDSAKeepStub.address)
})
beforeEach(async () => {
- await testInstance.reset()
- await testInstance.setKeepAddress(deployed.ECDSAKeepStub.address)
+ await createSnapshot()
+ })
+
+ afterEach(async () => {
+ await restoreSnapshot()
})
describe('createNewDeposit', async () => {
@@ -173,7 +182,7 @@ contract('DepositFunding', (accounts) => {
})
it('fails if new deposits are disabled', async () => {
- await tbtcSystemStub.setAllowNewDeposits(false)
+ await tbtcSystemStub.emergencyPauseNewDeposits()
await expectThrow(
testInstance.createNewDeposit.call(
@@ -188,8 +197,6 @@ contract('DepositFunding', (accounts) => {
),
'Opening new deposits is currently disabled.'
)
-
- await tbtcSystemStub.setAllowNewDeposits(true)
})
it.skip('stores payment value as funder\'s bond', async () => {
