This is the report from a security audit performed on GigziContracts by gorbunovperm.
The smart contract allows the Central Authority (CA) to issue tokens backed by precious metals. Tokens have a changeable tx fee. This tx fee is accumulated on CA account. All users who hold GZB tokens on their accounts will receive payments in GZG from the CA; a size of the payment will be proportional to the amount of GZB tokens on the account.
- FeeableToken.sol
- GigBlack.sol
- GigCrowdsale.sol
- GigGold.sol
- GigPlatinum.sol
- GigSilver.sol
- Migrations.sol
- MessageHelper.sol
- openzeppelin-solidity/contracts/math/SafeMath.sol
- openzeppelin-solidity/contracts/ownership/Ownable.sol
- openzeppelin-solidity/contracts/token/ERC827/ERC827Token.sol
- openzeppelin-solidity/contracts/token/ERC20/BurnableToken.sol
- openzeppelin-solidity/contracts/token/ERC20/MintableToken.sol
- openzeppelin-solidity/contracts/crowdsale/validation/CappedCrowdsale.sol
- openzeppelin-solidity/contracts/crowdsale/validation/TimedCrowdsale.sol
In total, 4 issues were reported including:
-
0 high severity issue.
-
0 medium severity issues.
-
2 low severity issues.
-
2 minor observations.
Issues for FeeableToken.sol
function isFeeShouldBePaid(address _from, address _to) internal returns (bool) {
// ...
return true;
}
This function is just reading data but not modify. For code understanding reason it should be marked as view
.
Just add view
modifier.
function setTxFeeCollector(address feeCollector) public onlyOwner returns (bool success) {
txFeeCollector = feeCollector;
return true;
}
After changing the txFeeCollector
address, it should be freed from fees on transactions. And the old txFeeCollector
should be removed from reserved accounts.
Change the implementation of setTxFeeCollector
method. Remove the old txFeeCollector
address from accountsReserved
array and add there new txFeeCollector
address.
Issues for GigBlack.sol
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
updateAccountReward (burner);
Burn (burner, _value);
}
It would be more logical to update a reward of account before burning tokens on this address to preserve the deserved reward.
Move the call to the updateAccountReward
method before subtraction of the balance at the address.
function getAccountReward(address addr) public view returns (uint, uint, uint)
{
if (!hasAccount(addr)) {
return (0,0,now);
}
// Some operations that can be performed in vain.
// ...
if (supplyTimeTotal == 0)
return (0,0,now);
return (rewardAccum, supplyTimeTotal, now);
}
In case if (supplyTimeTotal == 0)
condition is true it will be return the empty result and the code above executed in vain.
Condition if (supplyTimeTotal == 0)
should be moved to the top of the method.
This contracts has several minor issues. And in general, its security is at a good level.