update Deposit Utils tests according to new Token calling semantics
@@ -11,7 +11,7 @@ const DepositRedemption = artifacts.require('DepositRedemption')
const DepositLiquidation = artifacts.require('DepositLiquidation')
const KeepStub = artifacts.require('KeepStub')
-const TBTCTokenStub = artifacts.require('TBTCTokenStub')
+const TBTCToken = artifacts.require('TBTCToken')
const TBTCSystemStub = artifacts.require('TBTCSystemStub')
const TestTBTCConstants = artifacts.require('TestTBTCConstants')
@@ -38,7 +38,6 @@ const TEST_DEPOSIT_UTILS_DEPLOY = [
{ name: 'DepositLiquidation', contract: DepositLiquidation },
{ name: 'TestDepositUtils', contract: TestDepositUtils },
{ name: 'KeepStub', contract: KeepStub },
- { name: 'TBTCTokenStub', contract: TBTCTokenStub },
{ name: 'TBTCSystemStub', contract: TBTCSystemStub }]
// real tx from mainnet bitcoin, interpreted as funding tx
@@ -66,8 +65,12 @@ contract('DepositUtils', (accounts) => {
let deployed
let testUtilsInstance
let beneficiary
+ let token
+
before(async () => {
deployed = await utils.deploySystem(TEST_DEPOSIT_UTILS_DEPLOY)
+ token = await TBTCToken.new(deployed.TBTCSystemStub.address)
+ await deployed.TBTCSystemStub.setExternalAddresses(token.address)
testUtilsInstance = deployed.TestDepositUtils
beneficiary = accounts[2]
deployed.TBTCSystemStub.mint(beneficiary, web3.utils.toBN(testUtilsInstance.address))
@@ -75,7 +78,7 @@ contract('DepositUtils', (accounts) => {
await testUtilsInstance.createNewDeposit(
deployed.TBTCSystemStub.address,
- deployed.TBTCTokenStub.address,
+ token.address,
deployed.KeepStub.address,
1, // m
1) // n
@@ -501,13 +504,13 @@ contract('DepositUtils', (accounts) => {
it('checks that beneficiary is rewarded', async () => {
// min an arbitrary reward value to the funding contract
const reward = 100000000
- await deployed.TBTCTokenStub.mint(testUtilsInstance.address, reward)
+ await deployed.TBTCSystemStub.systemMint(testUtilsInstance.address, reward)
- const initialTokenBalance = await deployed.TBTCTokenStub.balanceOf(beneficiary)
+ const initialTokenBalance = await token.balanceOf(beneficiary)
await testUtilsInstance.distributeBeneficiaryReward()
- const finalTokenBalance = await deployed.TBTCTokenStub.balanceOf(beneficiary)
+ const finalTokenBalance = await token.balanceOf(beneficiary)
const tokenCheck = new BN(initialTokenBalance).add(new BN(reward))
expect(finalTokenBalance, 'tokens not rewarded to beneficiary correctly').to.eq.BN(tokenCheck)
})
