Address Details
contract
0x8f6FE34B495DD25400388740C0600001b241f990
- Contract Name
- StarNode
- Creator
- 0x7d6740–c9cfce at 0x5a9670–0f6dc8
- Balance
- 0 CELO ( )
- Locked CELO Balance
- 0.00 CELO
- Voting CELO Balance
- 0.00 CELO
- Pending Unlocked Gold
- 0.00 CELO
- Tokens
-
Fetching tokens...
- Transactions
- 0 Transactions
- Transfers
- 0 Transfers
- Gas Used
- Fetching gas used...
- Last Balance Update
- 8284398
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- StarNode
- Optimization enabled
- true
- Compiler version
- v0.8.9+commit.e5eed63a
- Optimization runs
- 200
- EVM Version
- london
- Verified at
- 2023-02-06T16:43:51.593551Z
contracts/StarNode.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol"; import "./IStarFarm.sol"; interface IERC20Burnable is IERC20Upgradeable { function burnFrom(address account, uint256 amount) external; } contract StarNode is ContextUpgradeable, OwnableUpgradeable { using CountersUpgradeable for CountersUpgradeable.Counter; CountersUpgradeable.Counter private _nodeIds; using SafeMathUpgradeable for uint256; uint256 selfGain; // self addtional gain 100 = 1% uint256 parentGain; // parent addtional gain 100 = 1% uint256 public unitPrice; uint256 public leastUnit; address public bonusAddr; struct Node { uint256 totalUnit; uint256 burn; uint256 award; uint256 withdraw; address owner; bytes4 code; } IERC20Burnable public starToken; IStarFarm public starFarm; Node[] public nodes; mapping(address => uint256) public nodeInfo; mapping(address => address) public userInviter; mapping(address => address[]) public nodeUsers; event SettleNode(address _user, uint256 _amount); function initialize(address _starToken, address _bonus, uint256 _selfGain, uint256 _parentGain, uint256 _unitPrice, uint256 _leastUnit) public initializer { __StarNode_init(_starToken, _bonus, _selfGain, _parentGain, _unitPrice, _leastUnit); } function __StarNode_init(address _starToken, address _bonus, uint256 _selfGain, uint256 _parentGain, uint256 _unitPrice, uint256 _leastUnit) internal initializer { __Context_init_unchained(); __Ownable_init_unchained(); __StarNode_init_unchained(_starToken, _bonus, _selfGain, _parentGain, _unitPrice, _leastUnit); } function __StarNode_init_unchained(address _starToken, address _bonus, uint256 _selfGain, uint256 _parentGain, uint256 _unitPrice, uint256 _leastUnit) public onlyOwner { starToken = IERC20Burnable(_starToken); bonusAddr = _bonus; _set(_selfGain, _parentGain, _unitPrice, _leastUnit); } function _set(uint256 _selfGain, uint256 _parentGain, uint256 _unitPrice, uint256 _leastUnit) internal { selfGain = _selfGain; parentGain = _parentGain; unitPrice = _unitPrice; leastUnit = _leastUnit; } function nodeGain() external view returns (uint256 _selfGain, uint256 _parentGain) { return (selfGain, parentGain); } function nodeLength() public view returns (uint256) { return nodes.length; } function nodeUserLength(address _user) public view returns (uint256) { return nodeUsers[_user].length; } function depositNode(uint256 _unit) external { address _user = _msgSender(); require(userInviter[_user] == address(0), "User must not node user"); require(_unit > 0, "Uint must greater than 0"); uint256 _amount = _unit.mul(unitPrice); // burn 90% starToken.burnFrom(_user, _amount.mul(90).div(100)); // bonus 10% starToken.transferFrom(_user, bonusAddr, _amount.mul(10).div(100)); if (nodes.length == 0 || nodes[nodeInfo[_user]].owner != _user) { // New node. require(_unit >= leastUnit, "Less than minimum limit"); nodes.push(Node(_unit, _amount, 0, 0, _user, getRndId(_user))); nodeInfo[_user] = nodes.length - 1; } else { Node storage node = nodes[nodeInfo[_user]]; node.totalUnit = node.totalUnit.add(_unit); node.burn = node.burn.add(_amount); } } function regFromNode(address _inviter, bytes32 _inviteCode) external { require(userInviter[_msgSender()] == address(0), "User already registered"); // require(_msgSender() != _inviter, "Cann't invite yourself"); require(nodeUserLength(_inviter) < nodes[nodeInfo[_inviter]].totalUnit, 'Parent node is full'); require(verifyInvitecode(_msgSender(), _inviter, _inviteCode), "Invalid invite code"); nodeUsers[_inviter].push(_msgSender()); userInviter[_msgSender()] = _inviter; starFarm.regNodeUser(_msgSender()); } function settleNode(address _user, uint256 _amount) external onlyStarFarm { address _inviter = userInviter[_user]; if (address(0) != _inviter) { nodes[nodeInfo[_inviter]].award = nodes[nodeInfo[_inviter]].award.add(_amount.mul(parentGain).div(100)); } emit SettleNode(_user, _amount); } function withdraw(uint256 _amount) external { // require(nodeInfo[_msgSender()] != 0); require(nodes[nodeInfo[_msgSender()]].owner == _msgSender(), "Invalid inviter"); Node storage node = nodes[nodeInfo[_msgSender()]]; require(node.award > node.withdraw && _amount <= node.award - node.withdraw, "Award amount not enough"); node.withdraw = node.withdraw.add(_amount); starToken.transfer(_msgSender(), _amount); } function getRndId(address _user) internal view returns (bytes4) { bytes4 _randId = bytes4(keccak256(abi.encodePacked(block.coinbase, block.timestamp, _user))); return _randId; } function verifyInvitecode(address _self, address _inviter, bytes32 _inviteCode) internal view returns (bool _verified) { require(nodes[nodeInfo[_inviter]].owner == _inviter, "Invalid inviter"); // require(nodeInfo[_inviter] != 0, "Invalid inviter"); if (_inviteCode == keccak256(abi.encodePacked(nodes[nodeInfo[_inviter]].code, _self))) return true; } function setStarFarm(address _starFarm) public onlyOwner { require(address(0) != _starFarm, "Farm contract address cannot be empty"); starFarm = IStarFarm(_starFarm); } function setParams(uint256 _selfGain, uint256 _parentGain, uint256 _unitPrice, uint256 _leastUnit) public onlyOwner { _set(_selfGain, _parentGain, _unitPrice, _leastUnit); } modifier onlyStarFarm() { require(_msgSender() == address(starFarm), "Only allowed from starfarm contract"); _; } }
/_openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal initializer { __Context_init_unchained(); __Ownable_init_unchained(); } function __Ownable_init_unchained() internal initializer { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } uint256[49] private __gap; }
/_openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } }
/_openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/_openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } uint256[50] private __gap; }
/_openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library CountersUpgradeable { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
/_openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMathUpgradeable { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
/contracts/IStarFarm.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IStarFarm { function regNodeUser(address _user) external; }
Contract ABI
[{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"SettleNode","inputs":[{"type":"address","name":"_user","internalType":"address","indexed":false},{"type":"uint256","name":"_amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"__StarNode_init_unchained","inputs":[{"type":"address","name":"_starToken","internalType":"address"},{"type":"address","name":"_bonus","internalType":"address"},{"type":"uint256","name":"_selfGain","internalType":"uint256"},{"type":"uint256","name":"_parentGain","internalType":"uint256"},{"type":"uint256","name":"_unitPrice","internalType":"uint256"},{"type":"uint256","name":"_leastUnit","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"bonusAddr","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"depositNode","inputs":[{"type":"uint256","name":"_unit","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_starToken","internalType":"address"},{"type":"address","name":"_bonus","internalType":"address"},{"type":"uint256","name":"_selfGain","internalType":"uint256"},{"type":"uint256","name":"_parentGain","internalType":"uint256"},{"type":"uint256","name":"_unitPrice","internalType":"uint256"},{"type":"uint256","name":"_leastUnit","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"leastUnit","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"_selfGain","internalType":"uint256"},{"type":"uint256","name":"_parentGain","internalType":"uint256"}],"name":"nodeGain","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"nodeInfo","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"nodeLength","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"nodeUserLength","inputs":[{"type":"address","name":"_user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"nodeUsers","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"totalUnit","internalType":"uint256"},{"type":"uint256","name":"burn","internalType":"uint256"},{"type":"uint256","name":"award","internalType":"uint256"},{"type":"uint256","name":"withdraw","internalType":"uint256"},{"type":"address","name":"owner","internalType":"address"},{"type":"bytes4","name":"code","internalType":"bytes4"}],"name":"nodes","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"regFromNode","inputs":[{"type":"address","name":"_inviter","internalType":"address"},{"type":"bytes32","name":"_inviteCode","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setParams","inputs":[{"type":"uint256","name":"_selfGain","internalType":"uint256"},{"type":"uint256","name":"_parentGain","internalType":"uint256"},{"type":"uint256","name":"_unitPrice","internalType":"uint256"},{"type":"uint256","name":"_leastUnit","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setStarFarm","inputs":[{"type":"address","name":"_starFarm","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"settleNode","inputs":[{"type":"address","name":"_user","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IStarFarm"}],"name":"starFarm","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20Burnable"}],"name":"starToken","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"unitPrice","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"userInviter","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b506115fa806100206000396000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c80638da5cb5b116100c3578063bc15c2871161007c578063bc15c28714610320578063cabf3e5114610329578063e73faa2d14610331578063f2fde38b1461033a578063fc1d7a651461034d578063fdaa621c1461037657600080fd5b80638da5cb5b1461029a578063911098d5146102ab57806391375f59146102d4578063986f33e0146102e7578063ae3c189d146102fa578063b7ca51e81461030d57600080fd5b80635915c05d116101155780635915c05d1461022b578063634f94191461023e578063715018a6146102515780637ece45e814610259578063858ce8f91461026c57806386489ba91461028757600080fd5b806313eaabb8146101525780631c53c2801461018257806323c2e2bc146101d557806327bd26b1146102035780632e1a7d4d14610218575b600080fd5b606a54610165906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b610195610190366004611382565b610389565b6040805196875260208701959095529385019290925260608401526001600160a01b031660808301526001600160e01b03191660a082015260c001610179565b6101f56101e33660046113b7565b606e6020526000908152604090205481565b604051908152602001610179565b6102166102113660046113d2565b6103df565b005b610216610226366004611382565b6105e9565b6101656102393660046113d2565b6107c0565b61021661024c366004611382565b6107f8565b610216610c57565b6102166102673660046113fc565b610c8d565b60665460675460408051928352602083019190915201610179565b61021661029536600461142e565b610ccb565b6033546001600160a01b0316610165565b6101656102b93660046113b7565b606f602052600090815260409020546001600160a01b031681565b6102166102e236600461142e565b610d4b565b6102166102f53660046113d2565b610dc0565b6102166103083660046113b7565b610f46565b606b54610165906001600160a01b031681565b6101f560695481565b606d546101f5565b6101f560685481565b6102166103483660046113b7565b610ff6565b6101f561035b3660046113b7565b6001600160a01b031660009081526070602052604090205490565b606c54610165906001600160a01b031681565b606d818154811061039957600080fd5b600091825260209091206005909102018054600182015460028301546003840154600490940154929450909290916001600160a01b03811690600160a01b900460e01b86565b336000908152606f60205260409020546001600160a01b03161561044a5760405162461bcd60e51b815260206004820152601760248201527f5573657220616c7265616479207265676973746572656400000000000000000060448201526064015b60405180910390fd5b6001600160a01b0382166000908152606e6020526040902054606d8054909190811061047857610478611483565b9060005260206000209060050201600001546104a9836001600160a01b031660009081526070602052604090205490565b106104ec5760405162461bcd60e51b815260206004820152601360248201527214185c995b9d081b9bd919481a5cc8199d5b1b606a1b6044820152606401610441565b6104f7338383611091565b6105395760405162461bcd60e51b8152602060048201526013602482015272496e76616c696420696e7669746520636f646560681b6044820152606401610441565b6001600160a01b0382811660008181526070602090815260408083208054600181018255908452828420018054336001600160a01b03199182168117909255818552606f9093528184208054909316909417909155606c548151632ad59ab760e11b8152600481019490945290519316926355ab356e92602480820193929182900301818387803b1580156105cd57600080fd5b505af11580156105e1573d6000803e3d6000fd5b505050505050565b336000818152606e6020526040902054606d8054909190811061060e5761060e611483565b60009182526020909120600460059092020101546001600160a01b03161461066a5760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b21034b73b34ba32b960891b6044820152606401610441565b336000908152606e6020526040812054606d8054909190811061068f5761068f611483565b90600052602060002090600502019050806003015481600201541180156106c95750806003015481600201546106c591906114af565b8211155b6107155760405162461bcd60e51b815260206004820152601760248201527f417761726420616d6f756e74206e6f7420656e6f7567680000000000000000006044820152606401610441565b600381015461072490836111cc565b6003820155606b546001600160a01b031663a9059cbb336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101859052604401602060405180830381600087803b15801561078357600080fd5b505af1158015610797573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bb91906114c6565b505050565b607060205281600052604060002081815481106107dc57600080fd5b6000918252602090912001546001600160a01b03169150829050565b336000818152606f60205260409020546001600160a01b03161561085e5760405162461bcd60e51b815260206004820152601760248201527f55736572206d757374206e6f74206e6f646520757365720000000000000000006044820152606401610441565b600082116108ae5760405162461bcd60e51b815260206004820152601860248201527f55696e74206d7573742067726561746572207468616e203000000000000000006044820152606401610441565b60006108c5606854846111d890919063ffffffff16565b606b549091506001600160a01b03166379cc6790836108f060646108ea86605a6111d8565b906111e4565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561093657600080fd5b505af115801561094a573d6000803e3d6000fd5b5050606b54606a546001600160a01b0391821693506323b872dd925085911661097960646108ea87600a6111d8565b6040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401602060405180830381600087803b1580156109c857600080fd5b505af11580156109dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0091906114c6565b50606d541580610a5957506001600160a01b0382166000818152606e6020526040902054606d80549091908110610a3957610a39611483565b60009182526020909120600460059092020101546001600160a01b031614155b15610be657606954831015610ab05760405162461bcd60e51b815260206004820152601760248201527f4c657373207468616e206d696e696d756d206c696d69740000000000000000006044820152606401610441565b606d6040518060c001604052808581526020018381526020016000815260200160008152602001846001600160a01b03168152602001610b38856040805141606090811b6bffffffffffffffffffffffff199081166020808501919091524260348501529490911b166054820152815160488183030181526068909101909152805191012090565b6001600160e01b0319169052815460018181018455600093845260209384902083516005909302019182559282015181840155604082015160028201556060820151600382015560808201516004909101805460a09093015160e01c600160a01b026001600160c01b03199093166001600160a01b0390921691909117919091179055606d54610bc891906114af565b6001600160a01b0383166000908152606e6020526040902055505050565b6001600160a01b0382166000908152606e6020526040812054606d80549091908110610c1457610c14611483565b90600052602060002090600502019050610c3b8482600001546111cc90919063ffffffff16565b81556001810154610c4c90836111cc565b600190910155505050565b6033546001600160a01b03163314610c815760405162461bcd60e51b8152600401610441906114e8565b610c8b60006111f0565b565b6033546001600160a01b03163314610cb75760405162461bcd60e51b8152600401610441906114e8565b606693909355606791909155606855606955565b600054610100900460ff1680610ce4575060005460ff16155b610d005760405162461bcd60e51b81526004016104419061151d565b600054610100900460ff16158015610d22576000805461ffff19166101011790555b610d30878787878787611242565b8015610d42576000805461ff00191690555b50505050505050565b6033546001600160a01b03163314610d755760405162461bcd60e51b8152600401610441906114e8565b606b80546001600160a01b038089166001600160a01b031992831617909255606a8054928816929091169190911790556105e184848484606693909355606791909155606855606955565b606c546001600160a01b0316336001600160a01b031614610e2f5760405162461bcd60e51b815260206004820152602360248201527f4f6e6c7920616c6c6f7765642066726f6d20737461726661726d20636f6e74726044820152621858dd60ea1b6064820152608401610441565b6001600160a01b038083166000908152606f6020526040902054168015610eff57610ebb610e6d60646108ea606754866111d890919063ffffffff16565b6001600160a01b0383166000908152606e6020526040902054606d80549091908110610e9b57610e9b611483565b9060005260206000209060050201600201546111cc90919063ffffffff16565b6001600160a01b0382166000908152606e6020526040902054606d80549091908110610ee957610ee9611483565b9060005260206000209060050201600201819055505b604080516001600160a01b0385168152602081018490527fd304fddcfb4c823513457b3a75ae8e137f506c2a81f5716fab3b268c7ed6c008910160405180910390a1505050565b6033546001600160a01b03163314610f705760405162461bcd60e51b8152600401610441906114e8565b6001600160a01b038116610fd45760405162461bcd60e51b815260206004820152602560248201527f4661726d20636f6e747261637420616464726573732063616e6e6f7420626520604482015264656d70747960d81b6064820152608401610441565b606c80546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b031633146110205760405162461bcd60e51b8152600401610441906114e8565b6001600160a01b0381166110855760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610441565b61108e816111f0565b50565b6001600160a01b0382166000818152606e6020526040812054606d805492939290919081106110c2576110c2611483565b60009182526020909120600460059092020101546001600160a01b03161461111e5760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b21034b73b34ba32b960891b6044820152606401610441565b6001600160a01b0383166000908152606e6020526040902054606d8054909190811061114c5761114c611483565b906000526020600020906005020160040160149054906101000a900460e01b846040516020016111a49291906001600160e01b031992909216825260601b6bffffffffffffffffffffffff1916600482015260180190565b604051602081830303815290604052805190602001208214156111c5575060015b9392505050565b60006111c5828461156b565b60006111c58284611583565b60006111c582846115a2565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff168061125b575060005460ff16155b6112775760405162461bcd60e51b81526004016104419061151d565b600054610100900460ff16158015611299576000805461ffff19166101011790555b6112a16112b7565b6112a9611322565b610d30878787878787610d4b565b600054610100900460ff16806112d0575060005460ff16155b6112ec5760405162461bcd60e51b81526004016104419061151d565b600054610100900460ff1615801561130e576000805461ffff19166101011790555b801561108e576000805461ff001916905550565b600054610100900460ff168061133b575060005460ff16155b6113575760405162461bcd60e51b81526004016104419061151d565b600054610100900460ff16158015611379576000805461ffff19166101011790555b61130e336111f0565b60006020828403121561139457600080fd5b5035919050565b80356001600160a01b03811681146113b257600080fd5b919050565b6000602082840312156113c957600080fd5b6111c58261139b565b600080604083850312156113e557600080fd5b6113ee8361139b565b946020939093013593505050565b6000806000806080858703121561141257600080fd5b5050823594602084013594506040840135936060013592509050565b60008060008060008060c0878903121561144757600080fd5b6114508761139b565b955061145e6020880161139b565b95989597505050506040840135936060810135936080820135935060a0909101359150565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000828210156114c1576114c1611499565b500390565b6000602082840312156114d857600080fd5b815180151581146111c557600080fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6000821982111561157e5761157e611499565b500190565b600081600019048311821515161561159d5761159d611499565b500290565b6000826115bf57634e487b7160e01b600052601260045260246000fd5b50049056fea264697066735822122065f116c8161320336948441cac6a3e787d3a2a906b032fcb95f95bd7b208850364736f6c63430008090033
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c80638da5cb5b116100c3578063bc15c2871161007c578063bc15c28714610320578063cabf3e5114610329578063e73faa2d14610331578063f2fde38b1461033a578063fc1d7a651461034d578063fdaa621c1461037657600080fd5b80638da5cb5b1461029a578063911098d5146102ab57806391375f59146102d4578063986f33e0146102e7578063ae3c189d146102fa578063b7ca51e81461030d57600080fd5b80635915c05d116101155780635915c05d1461022b578063634f94191461023e578063715018a6146102515780637ece45e814610259578063858ce8f91461026c57806386489ba91461028757600080fd5b806313eaabb8146101525780631c53c2801461018257806323c2e2bc146101d557806327bd26b1146102035780632e1a7d4d14610218575b600080fd5b606a54610165906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b610195610190366004611382565b610389565b6040805196875260208701959095529385019290925260608401526001600160a01b031660808301526001600160e01b03191660a082015260c001610179565b6101f56101e33660046113b7565b606e6020526000908152604090205481565b604051908152602001610179565b6102166102113660046113d2565b6103df565b005b610216610226366004611382565b6105e9565b6101656102393660046113d2565b6107c0565b61021661024c366004611382565b6107f8565b610216610c57565b6102166102673660046113fc565b610c8d565b60665460675460408051928352602083019190915201610179565b61021661029536600461142e565b610ccb565b6033546001600160a01b0316610165565b6101656102b93660046113b7565b606f602052600090815260409020546001600160a01b031681565b6102166102e236600461142e565b610d4b565b6102166102f53660046113d2565b610dc0565b6102166103083660046113b7565b610f46565b606b54610165906001600160a01b031681565b6101f560695481565b606d546101f5565b6101f560685481565b6102166103483660046113b7565b610ff6565b6101f561035b3660046113b7565b6001600160a01b031660009081526070602052604090205490565b606c54610165906001600160a01b031681565b606d818154811061039957600080fd5b600091825260209091206005909102018054600182015460028301546003840154600490940154929450909290916001600160a01b03811690600160a01b900460e01b86565b336000908152606f60205260409020546001600160a01b03161561044a5760405162461bcd60e51b815260206004820152601760248201527f5573657220616c7265616479207265676973746572656400000000000000000060448201526064015b60405180910390fd5b6001600160a01b0382166000908152606e6020526040902054606d8054909190811061047857610478611483565b9060005260206000209060050201600001546104a9836001600160a01b031660009081526070602052604090205490565b106104ec5760405162461bcd60e51b815260206004820152601360248201527214185c995b9d081b9bd919481a5cc8199d5b1b606a1b6044820152606401610441565b6104f7338383611091565b6105395760405162461bcd60e51b8152602060048201526013602482015272496e76616c696420696e7669746520636f646560681b6044820152606401610441565b6001600160a01b0382811660008181526070602090815260408083208054600181018255908452828420018054336001600160a01b03199182168117909255818552606f9093528184208054909316909417909155606c548151632ad59ab760e11b8152600481019490945290519316926355ab356e92602480820193929182900301818387803b1580156105cd57600080fd5b505af11580156105e1573d6000803e3d6000fd5b505050505050565b336000818152606e6020526040902054606d8054909190811061060e5761060e611483565b60009182526020909120600460059092020101546001600160a01b03161461066a5760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b21034b73b34ba32b960891b6044820152606401610441565b336000908152606e6020526040812054606d8054909190811061068f5761068f611483565b90600052602060002090600502019050806003015481600201541180156106c95750806003015481600201546106c591906114af565b8211155b6107155760405162461bcd60e51b815260206004820152601760248201527f417761726420616d6f756e74206e6f7420656e6f7567680000000000000000006044820152606401610441565b600381015461072490836111cc565b6003820155606b546001600160a01b031663a9059cbb336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101859052604401602060405180830381600087803b15801561078357600080fd5b505af1158015610797573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bb91906114c6565b505050565b607060205281600052604060002081815481106107dc57600080fd5b6000918252602090912001546001600160a01b03169150829050565b336000818152606f60205260409020546001600160a01b03161561085e5760405162461bcd60e51b815260206004820152601760248201527f55736572206d757374206e6f74206e6f646520757365720000000000000000006044820152606401610441565b600082116108ae5760405162461bcd60e51b815260206004820152601860248201527f55696e74206d7573742067726561746572207468616e203000000000000000006044820152606401610441565b60006108c5606854846111d890919063ffffffff16565b606b549091506001600160a01b03166379cc6790836108f060646108ea86605a6111d8565b906111e4565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561093657600080fd5b505af115801561094a573d6000803e3d6000fd5b5050606b54606a546001600160a01b0391821693506323b872dd925085911661097960646108ea87600a6111d8565b6040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401602060405180830381600087803b1580156109c857600080fd5b505af11580156109dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0091906114c6565b50606d541580610a5957506001600160a01b0382166000818152606e6020526040902054606d80549091908110610a3957610a39611483565b60009182526020909120600460059092020101546001600160a01b031614155b15610be657606954831015610ab05760405162461bcd60e51b815260206004820152601760248201527f4c657373207468616e206d696e696d756d206c696d69740000000000000000006044820152606401610441565b606d6040518060c001604052808581526020018381526020016000815260200160008152602001846001600160a01b03168152602001610b38856040805141606090811b6bffffffffffffffffffffffff199081166020808501919091524260348501529490911b166054820152815160488183030181526068909101909152805191012090565b6001600160e01b0319169052815460018181018455600093845260209384902083516005909302019182559282015181840155604082015160028201556060820151600382015560808201516004909101805460a09093015160e01c600160a01b026001600160c01b03199093166001600160a01b0390921691909117919091179055606d54610bc891906114af565b6001600160a01b0383166000908152606e6020526040902055505050565b6001600160a01b0382166000908152606e6020526040812054606d80549091908110610c1457610c14611483565b90600052602060002090600502019050610c3b8482600001546111cc90919063ffffffff16565b81556001810154610c4c90836111cc565b600190910155505050565b6033546001600160a01b03163314610c815760405162461bcd60e51b8152600401610441906114e8565b610c8b60006111f0565b565b6033546001600160a01b03163314610cb75760405162461bcd60e51b8152600401610441906114e8565b606693909355606791909155606855606955565b600054610100900460ff1680610ce4575060005460ff16155b610d005760405162461bcd60e51b81526004016104419061151d565b600054610100900460ff16158015610d22576000805461ffff19166101011790555b610d30878787878787611242565b8015610d42576000805461ff00191690555b50505050505050565b6033546001600160a01b03163314610d755760405162461bcd60e51b8152600401610441906114e8565b606b80546001600160a01b038089166001600160a01b031992831617909255606a8054928816929091169190911790556105e184848484606693909355606791909155606855606955565b606c546001600160a01b0316336001600160a01b031614610e2f5760405162461bcd60e51b815260206004820152602360248201527f4f6e6c7920616c6c6f7765642066726f6d20737461726661726d20636f6e74726044820152621858dd60ea1b6064820152608401610441565b6001600160a01b038083166000908152606f6020526040902054168015610eff57610ebb610e6d60646108ea606754866111d890919063ffffffff16565b6001600160a01b0383166000908152606e6020526040902054606d80549091908110610e9b57610e9b611483565b9060005260206000209060050201600201546111cc90919063ffffffff16565b6001600160a01b0382166000908152606e6020526040902054606d80549091908110610ee957610ee9611483565b9060005260206000209060050201600201819055505b604080516001600160a01b0385168152602081018490527fd304fddcfb4c823513457b3a75ae8e137f506c2a81f5716fab3b268c7ed6c008910160405180910390a1505050565b6033546001600160a01b03163314610f705760405162461bcd60e51b8152600401610441906114e8565b6001600160a01b038116610fd45760405162461bcd60e51b815260206004820152602560248201527f4661726d20636f6e747261637420616464726573732063616e6e6f7420626520604482015264656d70747960d81b6064820152608401610441565b606c80546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b031633146110205760405162461bcd60e51b8152600401610441906114e8565b6001600160a01b0381166110855760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610441565b61108e816111f0565b50565b6001600160a01b0382166000818152606e6020526040812054606d805492939290919081106110c2576110c2611483565b60009182526020909120600460059092020101546001600160a01b03161461111e5760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b21034b73b34ba32b960891b6044820152606401610441565b6001600160a01b0383166000908152606e6020526040902054606d8054909190811061114c5761114c611483565b906000526020600020906005020160040160149054906101000a900460e01b846040516020016111a49291906001600160e01b031992909216825260601b6bffffffffffffffffffffffff1916600482015260180190565b604051602081830303815290604052805190602001208214156111c5575060015b9392505050565b60006111c5828461156b565b60006111c58284611583565b60006111c582846115a2565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff168061125b575060005460ff16155b6112775760405162461bcd60e51b81526004016104419061151d565b600054610100900460ff16158015611299576000805461ffff19166101011790555b6112a16112b7565b6112a9611322565b610d30878787878787610d4b565b600054610100900460ff16806112d0575060005460ff16155b6112ec5760405162461bcd60e51b81526004016104419061151d565b600054610100900460ff1615801561130e576000805461ffff19166101011790555b801561108e576000805461ff001916905550565b600054610100900460ff168061133b575060005460ff16155b6113575760405162461bcd60e51b81526004016104419061151d565b600054610100900460ff16158015611379576000805461ffff19166101011790555b61130e336111f0565b60006020828403121561139457600080fd5b5035919050565b80356001600160a01b03811681146113b257600080fd5b919050565b6000602082840312156113c957600080fd5b6111c58261139b565b600080604083850312156113e557600080fd5b6113ee8361139b565b946020939093013593505050565b6000806000806080858703121561141257600080fd5b5050823594602084013594506040840135936060013592509050565b60008060008060008060c0878903121561144757600080fd5b6114508761139b565b955061145e6020880161139b565b95989597505050506040840135936060810135936080820135935060a0909101359150565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000828210156114c1576114c1611499565b500390565b6000602082840312156114d857600080fd5b815180151581146111c557600080fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6000821982111561157e5761157e611499565b500190565b600081600019048311821515161561159d5761159d611499565b500290565b6000826115bf57634e487b7160e01b600052601260045260246000fd5b50049056fea264697066735822122065f116c8161320336948441cac6a3e787d3a2a906b032fcb95f95bd7b208850364736f6c63430008090033