Commit 696615d3 by Martín Triay

[TokenVesting] Add linear release test

parent 645edfc9
...@@ -48,7 +48,20 @@ contract('TokenVesting', function ([_, owner, beneficiary]) { ...@@ -48,7 +48,20 @@ contract('TokenVesting', function ([_, owner, beneficiary]) {
balance.should.bignumber.equal(amount.mul(releaseTime - this.start).div(this.end - this.start).floor()); balance.should.bignumber.equal(amount.mul(releaseTime - this.start).div(this.end - this.start).floor());
}); });
it('should linearly release tokens during vesting period'); it('should linearly release tokens during vesting period', async function () {
const duration = this.end - this.cliff;
const checkpoints = 4;
for (let i = 1; i <= checkpoints; i++) {
const now = this.cliff + i * (duration / checkpoints);
await increaseTimeTo(now);
const vested = await this.vesting.vestedAmount(this.token.address);
const expectedVesting = amount.mul(now - this.start).div(this.end - this.start).floor();
vested.should.bignumber.equal(expectedVesting);
}
});
it('should have released all after end', async function () { it('should have released all after end', async function () {
await increaseTimeTo(this.end); await increaseTimeTo(this.end);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment