diff --git a/apps/token-manager/contracts/test/mocks/TokenManagerMock.sol b/apps/token-manager/contracts/test/mocks/TokenManagerMock.sol index c2e0c7a642..756f9a463d 100644 --- a/apps/token-manager/contracts/test/mocks/TokenManagerMock.sol +++ b/apps/token-manager/contracts/test/mocks/TokenManagerMock.sol @@ -1,11 +1,8 @@ pragma solidity 0.4.24; import "../../TokenManager.sol"; +import "@aragon/test-helpers/contracts/TimeHelpersMock.sol"; +contract TokenManagerMock is TokenManager, TimeHelpersMock { -contract TokenManagerMock is TokenManager { - uint256 mockTime; - - function mock_setTimestamp(uint256 i) public { mockTime = i; } - function getTimestamp() internal view returns (uint256) { return mockTime; } } diff --git a/apps/token-manager/test/tokenmanager.js b/apps/token-manager/test/tokenmanager.js index dcf9889539..60f604d81d 100644 --- a/apps/token-manager/test/tokenmanager.js +++ b/apps/token-manager/test/tokenmanager.js @@ -59,7 +59,7 @@ contract('Token Manager', accounts => { const receipt = await dao.newAppInstance('0x1234', tokenManagerBase.address, '0x', false, { from: root }) tokenManager = TokenManager.at(receipt.logs.filter(l => l.event == 'NewAppProxy')[0].args.proxy) - tokenManager.mock_setTimestamp(NOW_TIME) + tokenManager.mockSetTimestamp(NOW_TIME) await acl.createPermission(ANY_ADDR, tokenManager.address, MINT_ROLE, root, { from: root }) await acl.createPermission(ANY_ADDR, tokenManager.address, ISSUE_ROLE, root, { from: root }) @@ -376,7 +376,7 @@ contract('Token Manager', accounts => { }) it('can start transferring on cliff', async () => { - await tokenManager.mock_setTimestamp(cliffDate) + await tokenManager.mockSetTimestamp(cliffDate) await token.transfer(holder2, 10, { from: holder }) assert.equal(await token.balanceOf(holder2), 10, 'should have received tokens') @@ -384,14 +384,14 @@ contract('Token Manager', accounts => { }) it('can transfer all tokens after vesting', async () => { - await tokenManager.mock_setTimestamp(vestingDate) + await tokenManager.mockSetTimestamp(vestingDate) await token.transfer(holder2, totalTokens, { from: holder }) assert.equal(await token.balanceOf(holder2), totalTokens, 'should have received tokens') }) it('can transfer half mid vesting', async () => { - await tokenManager.mock_setTimestamp(startDate + (vestingDate - startDate) / 2) + await tokenManager.mockSetTimestamp(startDate + (vestingDate - startDate) / 2) await token.transfer(holder2, 20, { from: holder }) @@ -413,7 +413,7 @@ contract('Token Manager', accounts => { }) it('cannot transfer all tokens right before vesting', async () => { - await tokenManager.mock_setTimestamp(vestingDate - 10) + await tokenManager.mockSetTimestamp(vestingDate - 10) return assertRevert(async () => { await token.transfer(holder2, totalTokens, { from: holder }) @@ -421,7 +421,7 @@ contract('Token Manager', accounts => { }) it('can be revoked and not vested tokens are transfered to token manager', async () => { - await tokenManager.mock_setTimestamp(cliffDate) + await tokenManager.mockSetTimestamp(cliffDate) await tokenManager.revokeVesting(holder, 0) await token.transfer(holder2, 5, { from: holder }) @@ -459,7 +459,7 @@ contract('Token Manager', accounts => { }) // Can't create a new vesting even after other vestings have finished - await tokenManager.mock_setTimestamp(vestingDate) + await tokenManager.mockSetTimestamp(vestingDate) await assertRevert(async () => { await tokenManager.assignVested(holder, 1, startDate, cliffDate, vestingDate, false) })