Transferrable is now transferrable

pull/140/head
Jorge Izquierdo 8 years ago
parent 8d9e12eda3
commit 93e7984c61
  1. 4
      contracts/token/GrantableToken.sol
  2. 10
      test/GrantableToken.js

@ -83,7 +83,7 @@ contract GrantableToken is StandardToken {
}
}
function transferrableTokens(address holder, uint64 time) constant public returns (uint256 nonVested) {
function transferableTokens(address holder, uint64 time) constant public returns (uint256 nonVested) {
uint256 grantIndex = grants[holder].length;
for (uint256 i = 0; i < grantIndex; i++) {
@ -94,7 +94,7 @@ contract GrantableToken is StandardToken {
}
function transfer(address _to, uint _value) returns (bool success){
if (_value > transferrableTokens(msg.sender, uint64(now))) throw;
if (_value > transferableTokens(msg.sender, uint64(now))) throw;
return super.transfer(_to, _value);
}

@ -19,7 +19,7 @@ contract('GrantableToken', function(accounts) {
await token.grantTokens(receiver, tokenAmount, { from: granter })
assert.equal(await token.balanceOf(receiver), tokenAmount);
assert.equal(await token.transferrableTokens(receiver, +new Date()/1000), tokenAmount);
assert.equal(await token.transferableTokens(receiver, +new Date()/1000), tokenAmount);
})
describe('getting a token grant', async () => {
@ -34,12 +34,12 @@ contract('GrantableToken', function(accounts) {
assert.equal(await token.balanceOf(receiver), tokenAmount);
})
it('has 0 transferrable tokens before cliff', async () => {
assert.equal(await token.transferrableTokens(receiver, now), 0);
it('has 0 transferable tokens before cliff', async () => {
assert.equal(await token.transferableTokens(receiver, now), 0);
})
it('all tokens are transferrable after vesting', async () => {
assert.equal(await token.transferrableTokens(receiver, now + vesting + 1), tokenAmount);
it('all tokens are transferable after vesting', async () => {
assert.equal(await token.transferableTokens(receiver, now + vesting + 1), tokenAmount);
})
it('throws when trying to transfer non vested tokens', async () => {

Loading…
Cancel
Save