Use libraries syntax sugar for revoking grants logic
This commit is contained in:
@ -15,7 +15,7 @@ contract BasicToken is ERC20Basic {
|
|||||||
mapping(address => uint) balances;
|
mapping(address => uint) balances;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fix for the ERC20 short address attack
|
* Fix for the ERC20 short address attack
|
||||||
*/
|
*/
|
||||||
modifier onlyPayloadSize(uint size) {
|
modifier onlyPayloadSize(uint size) {
|
||||||
if(msg.data.length < size + 4) {
|
if(msg.data.length < size + 4) {
|
||||||
@ -33,5 +33,5 @@ contract BasicToken is ERC20Basic {
|
|||||||
function balanceOf(address _owner) constant returns (uint balance) {
|
function balanceOf(address _owner) constant returns (uint balance) {
|
||||||
return balances[_owner];
|
return balances[_owner];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import "./StandardToken.sol";
|
|||||||
import "./LimitedTransferToken.sol";
|
import "./LimitedTransferToken.sol";
|
||||||
|
|
||||||
contract VestedToken is StandardToken, LimitedTransferToken {
|
contract VestedToken is StandardToken, LimitedTransferToken {
|
||||||
|
|
||||||
struct TokenGrant {
|
struct TokenGrant {
|
||||||
address granter; // 20 bytes
|
address granter; // 20 bytes
|
||||||
uint256 value; // 32 bytes
|
uint256 value; // 32 bytes
|
||||||
@ -68,11 +67,11 @@ contract VestedToken is StandardToken, LimitedTransferToken {
|
|||||||
|
|
||||||
// remove grant from array
|
// remove grant from array
|
||||||
delete grants[_holder][_grantId];
|
delete grants[_holder][_grantId];
|
||||||
grants[_holder][_grantId] = grants[_holder][grants[_holder].length - 1];
|
grants[_holder][_grantId] = grants[_holder][grants[_holder].length.sub(1)];
|
||||||
grants[_holder].length -= 1;
|
grants[_holder].length -= 1;
|
||||||
|
|
||||||
balances[receiver] = SafeMath.add(balances[receiver], nonVested);
|
balances[receiver] = balances[receiver].add(nonVested);
|
||||||
balances[_holder] = SafeMath.sub(balances[_holder], nonVested);
|
balances[_holder] = balances[_holder].sub(nonVested);
|
||||||
Transfer(_holder, receiver, nonVested);
|
Transfer(_holder, receiver, nonVested);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user