Vulnerability Category | Notes | Result |
---|---|---|
Arbitrary Storage Write | N/A | PASS |
Arbitrary Jump | N/A | PASS |
Delegate Call to Untrusted Contract | N/A | PASS |
Dependence on Predictable Variables | N/A | PASS |
Deprecated Opcodes | N/A | PASS |
Ether Thief | N/A | PASS |
Exceptions | N/A | PASS |
External Calls | N/A | PASS |
Integer Over/Underflow | N/A | PASS |
Multiple Sends | N/A | PASS |
Suicide | N/A | PASS |
State Change External Calls | N/A | PASS |
Unchecked Retval | N/A | PASS |
User Supplied Assertion | N/A | PASS |
Critical Solidity Compiler | N/A | PASS |
Overall Contract Safety | PASS |
SUN Token - Smart Contract Audit Report
Summary
Launched in September 2020, SUN token is a social experiment dedicated to the development of TRON's DeFi ecosystem. The Tron Foundation hopes to leverage SUN to promote the vigorous development of TRON's self-governing DeFi community.
SUN features zero VC investments, zero PE investments, no pre-mining or reserve for the team, and is fully operated by the community through its open-source smart contracts. SUN is a TRC20-based crypto asset with a total supply of 19900730.
Features of the contract:Audit Findings Summary
- The contract rewards users in SUN for staking TRX and other tokens either with sun.io or in liquidity pools on JustSwap.
- Utilization of SafeMath to prevent overflows.
- No issues were identified.
($) = payable function
# = non-constant function
Int = Internal
Ext = External
Pub = Public
+ SunStakerStorage
+ [Lib] SafeMath
- [Int] add
- [Int] sub
- [Int] sub
- [Int] mul
- [Int] div
- [Int] div
- [Int] mod
- [Int] mod
+ SunStakerInterface (SunStakerStorage)
- [Pub] deposit ($)
- [Pub] withdraw #
- [Pub] lastTimeRewardApplicable
- [Pub] rewardOneSun
- [Pub] earned
- [Pub] earned
- [Pub] totalSupply
- [Pub] balanceOf
+ SunStakerSimpleStandAlone (SunStakerInterface)
- [Pub] #
- [Ext] ($)
- [Pub] rewardOneSun
- [Pub] earned
- [Pub] earned
- [Pub] lastTimeRewardApplicable
- [Pub] deposit ($)
- modifiers: checkStart
- [Pub] withdraw #
- modifiers: checkEnd
- [Pub] totalSupply
- [Pub] balanceOf
- [Pub] getInfo
- [Pub] rescue #
- modifiers: checkEnd
- [Int] min
Click here to download the source code as a .sol file.
// The following code is from flattening this file: SunStakeSimpleStandAlone.sol
// The following code is from flattening this import statement in: SunStakeSimpleStandAlone.sol
// The following code is from flattening this file: /home/m/Desktop/solidity.finance-audits/SUN Token/SunStakerInterface.sol
pragma solidity ^0.5.8;
// The following code is from flattening this import statement in: /home/m/Desktop/solidity.finance-audits/SUN Token/SunStakerInterface.sol
// // The following code is from flattening this import statement in: /home/m/Desktop/solidity.finance-audits/SUN Token/SunStakerInterface.sol
// The following code is from flattening this file: /home/m/Desktop/solidity.finance-audits/SUN Token/SunStakerStorage.sol
pragma solidity ^0.5.8;
contract SunStakerStorage {
uint256 internal totalSupply_;
mapping(address => uint256) internal balanceOf_;
mapping(address => uint256) public rewards;
mapping(address => uint256) public userRewardOneSunPaid;
uint256 public starttime;
uint256 public periodFinish;
uint256 public rewardRate = 10**18;
uint256 public lastUpdateTime;
uint256 public rewardOneSunStored;
uint256 public rawAll = 0;
address public gov = msg.sender;
bool public withdrawOn;
}
// The following code is from flattening this file: /home/m/Desktop/solidity.finance-audits/SUN Token/SafeMath.sol
pragma solidity ^0.5.8;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract SunStakerInterface is SunStakerStorage {
function deposit() public payable ;
function withdraw(address token) public;
function lastTimeRewardApplicable() public view returns (uint256);
function rewardOneSun() public view returns (uint256);
function earned(address account) public view returns (uint256);
function earned(address account,address token) public view returns (uint256);
function totalSupply() public view returns (uint);
function balanceOf(address guy) public view returns (uint);
}
pragma solidity ^0.5.8;
contract SunStakerSimpleStandAlone is SunStakerInterface {
using SafeMath for uint256;
modifier checkStart() {
require(block.timestamp >= starttime , "not started");
require(block.timestamp < periodFinish, "already ended");
_;
}
modifier checkEnd() {
require(block.timestamp >= periodFinish, "not end");
_;
}
event Rescue(address indexed dst, uint sad);
event Deposit(address indexed dst, uint sad);
event Withdrawal(address indexed src, uint sad);
constructor(uint256 _starttime, uint256 _periodFinish) public{
starttime = _starttime;
periodFinish = _periodFinish;
}
function() external payable {
deposit();
}
function rewardOneSun() public view returns (uint256) {
return 0;
}
function earned(address account) public view returns (uint256) {
return 0;
}
function earned(address account, address token) public view returns (uint256) {
return 0;
}
function lastTimeRewardApplicable() public view returns (uint256) {
return 0;
}
function deposit() checkStart public payable {
require(msg.value > 0, "deposit must gt 0");
balanceOf_[msg.sender] = balanceOf_[msg.sender].add(msg.value);
totalSupply_ = totalSupply_.add(msg.value);
emit Deposit(msg.sender, msg.value);
}
function withdraw(address token) checkEnd public {
token;
uint256 sad = balanceOf_[msg.sender]; require(sad > 0, "balance must gt 0");
sad = min(sad, totalSupply_);
balanceOf_[msg.sender] = 0;
msg.sender.transfer(sad);
totalSupply_ = totalSupply_.sub(sad);
emit Withdrawal(msg.sender, sad);
}
function totalSupply() public view returns (uint) {
return totalSupply_;
}
function balanceOf(address guy) public view returns (uint){
return balanceOf_[guy];
}
function getInfo(address _user) public view returns(uint256 _balanceTRX, uint256 _balance, uint256 _totalSupply){
_balanceTRX = _user.balance;
_balance = balanceOf_[_user];
_totalSupply = totalSupply_;
}
/** * @dev rescue simple transfered TRX. */
function rescue(address payable to_, uint256 amount_) checkEnd public{
require(msg.sender == gov, "must gov");
require(to_ != address(0), "must not 0");
require(amount_ > 0, "must gt 0");
uint256 sad = min(address(this).balance.sub(totalSupply_), amount_);
to_.transfer(sad);
emit Rescue(to_, sad);
}
/** * @dev Returns the smallest of two numbers. */
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}