Reorg code

This commit is contained in:
Jorge Izquierdo
2017-05-21 12:10:04 +02:00
parent 5a6340395f
commit 929367f0ab
3 changed files with 75 additions and 26 deletions

View File

@ -95,6 +95,24 @@ contract('VestedToken', function(accounts) {
await token.transferFrom(receiver, accounts[7], tokenAmount, { from: accounts[7] })
assert.equal(await token.balanceOf(accounts[7]), tokenAmount);
})
it('can handle composed vesting schedules', async () => {
await timer(cliff);
await token.transfer(accounts[7], 12, { from: receiver })
assert.equal(await token.balanceOf(accounts[7]), 12);
let newNow = web3.eth.getBlock(web3.eth.blockNumber).timestamp
await token.grantVestedTokens(receiver, tokenAmount, newNow, newNow + cliff, newNow + vesting, false, false, { from: granter })
await token.transfer(accounts[7], 13, { from: receiver })
assert.equal(await token.balanceOf(accounts[7]), tokenAmount / 2);
assert.equal(await token.balanceOf(receiver), 3 * tokenAmount / 2)
assert.equal(await token.transferableTokens(receiver, newNow), 0)
await timer(vesting);
await token.transfer(accounts[7], 3 * tokenAmount / 2, { from: receiver })
assert.equal(await token.balanceOf(accounts[7]), tokenAmount * 2)
})
})
describe('getting a non-revokable token grant', async () => {