Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
ZoneStakingUpgradeable
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.7.6; import "@openzeppelin/contracts/proxy/TransparentUpgradeableProxy.sol"; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; import "../lib/access/OwnableUpgradeable.sol"; contract ZoneStakingUpgradeable is OwnableUpgradeable, ReentrancyGuardUpgradeable { using SafeERC20Upgradeable for IERC20Upgradeable; using SafeMathUpgradeable for uint256; struct Type { bool enabled; uint16 lockDay; uint256 rewardRate; uint256 stakedAmount; } struct Stake { bool exist; uint8 typeIndex; uint256 stakedTs; // timestamp when staked uint256 unstakedTs; // timestamp when unstaked uint256 stakedAmount; // token amount user staked uint256 rewardAmount; // reward amount when user unstaked } uint256 private constant DENOMINATOR = 10000; Type[] public types; mapping(address => Stake) public stakes; uint256 public totalStakedAmount; uint256 public totalUnstakedAmount; uint256 public stakeLimit; uint256 public minStakeAmount; bool public earlyUnstakeAllowed; IERC20Upgradeable public zoneToken; address public governorTimelock; uint256 public totalUnstakedAmountWithReward; address private constant user1 = 0x83b4271b054818a93325c7299f006AEc2E90ef96; uint256 public user1LastUnlockTs; uint256 public user1ZonePerSec; event AddType(bool enable, uint16 lockDay, uint256 rewardRate); event ChangeType(uint8 typeIndex, bool enable, uint16 lockDay, uint256 rewardRate); event SetStakeLimit(uint256 newStakeLimit); event SetMinStakeAmount(uint256 newMinStakeAmount); event SetEarlyUnstakeAllowed(bool newAllowed); event SetVault(address indexed newVault); event Staked(address indexed staker, uint256 amount, uint8 typeIndex); event Unstaked(address indexed staker, uint256 stakedAmount, uint256 reward); modifier onlyOwnerOrCommunity() { address sender = _msgSender(); require((owner() == sender) || (governorTimelock == sender), "The caller should be owner or governor"); _; } /** * @notice Initializes the contract. * @param _ownerAddress Address of owner * @param _zoneToken ZONE token address * @param _governorTimelock Governor TimeLock address * @param _typeEnables enable status of types * @param _lockDays lock days * @param _rewardRates rewards per day */ function initialize( address _ownerAddress, address _zoneToken, address _governorTimelock, bool[] memory _typeEnables, uint16[] memory _lockDays, uint256[] memory _rewardRates ) public initializer { require(_ownerAddress != address(0), "Owner address is invalid"); stakeLimit = 2500000e18; // 2.5M ZONE minStakeAmount = 1e18; // 1 ZONE earlyUnstakeAllowed = true; __Ownable_init(_ownerAddress); __ReentrancyGuard_init(); zoneToken = IERC20Upgradeable(_zoneToken); governorTimelock = _governorTimelock; _addTypes(_typeEnables, _lockDays, _rewardRates); } function setGovernorTimelock(address _governorTimelock) external onlyOwner() { governorTimelock = _governorTimelock; } function getAllTypes() public view returns(bool[] memory enables, uint16[] memory lockDays, uint256[] memory rewardRates) { enables = new bool[](types.length); lockDays = new uint16[](types.length); rewardRates = new uint256[](types.length); for (uint i = 0; i < types.length; i ++) { enables[i] = types[i].enabled; lockDays[i] = types[i].lockDay; rewardRates[i] = types[i].rewardRate; } } function addTypes( bool[] memory _enables, uint16[] memory _lockDays, uint256[] memory _rewardRates ) external onlyOwner() { _addTypes(_enables, _lockDays, _rewardRates); } function _addTypes( bool[] memory _enables, uint16[] memory _lockDays, uint256[] memory _rewardRates ) internal { require( _lockDays.length == _rewardRates.length && _lockDays.length == _enables.length, "Mismatched data" ); require((types.length + _lockDays.length) <= type(uint8).max, "Too much"); for (uint256 i = 0; i < _lockDays.length; i ++) { require(_rewardRates[i] < DENOMINATOR/2, "Too large rewardRate"); Type memory _type = Type({ enabled: _enables[i], lockDay: _lockDays[i], rewardRate: _rewardRates[i], stakedAmount: 0 }); types.push(_type); emit AddType (_type.enabled, _type.lockDay, _type.rewardRate); } } function changeType( uint8 _typeIndex, bool _enable, uint16 _lockDay, uint256 _rewardRate ) external onlyOwnerOrCommunity() { require(_typeIndex < types.length, "Invalid typeIndex"); require(_rewardRate < DENOMINATOR/2, "Too large rewardRate"); Type storage _type = types[_typeIndex]; _type.enabled = _enable; _type.lockDay = _lockDay; _type.rewardRate = _rewardRate; emit ChangeType (_typeIndex, _type.enabled, _type.lockDay, _type.rewardRate); } function leftCapacity() public view returns(uint256) { uint256 spent = totalUnstakedAmountWithReward.add(totalStakedAmount).sub(totalUnstakedAmount); return stakeLimit.sub(spent); } function isStaked(address account) public view returns (bool) { return (stakes[account].exist && stakes[account].unstakedTs == 0) ? true : false; } function setStakeLimit(uint256 _stakeLimit) external onlyOwnerOrCommunity() { uint256 spent = totalUnstakedAmountWithReward.add(totalStakedAmount).sub(totalUnstakedAmount); require(spent <= _stakeLimit, "The limit is too small"); stakeLimit = _stakeLimit; emit SetStakeLimit(stakeLimit); } function setMinStakeAmount(uint256 _minStakeAmount) external onlyOwnerOrCommunity() { minStakeAmount = _minStakeAmount; emit SetMinStakeAmount(minStakeAmount); } function setEarlyUnstakeAllowed(bool allow) external onlyOwnerOrCommunity() { earlyUnstakeAllowed = allow; emit SetEarlyUnstakeAllowed(earlyUnstakeAllowed); } function startStake(uint256 amount, uint8 typeIndex) external nonReentrant() { address staker = _msgSender(); uint256 capacity = leftCapacity(); require(0 < capacity, "Already closed"); require(isStaked(staker) == false, "Already staked"); require(minStakeAmount <= amount, "The staking amount is too small"); require(amount <= capacity, "Exceed the staking limit"); require(typeIndex < types.length, "Invalid typeIndex"); require(types[typeIndex].enabled, "The type disabled"); zoneToken.safeTransferFrom(staker, address(this), amount); stakes[staker] = Stake({ exist: true, typeIndex: typeIndex, stakedTs: block.timestamp, unstakedTs: 0, stakedAmount: amount, rewardAmount: 0 }); totalStakedAmount = totalStakedAmount.add(amount); types[typeIndex].stakedAmount = types[typeIndex].stakedAmount.add(amount); emit Staked(staker, amount, typeIndex); } function endStake() external nonReentrant() { address staker = _msgSender(); require(isStaked(staker), "Not staked"); if (staker == user1) { endStakeForUser1(staker); } else { uint8 typeIndex = stakes[staker].typeIndex; uint256 stakedAmount = stakes[staker].stakedAmount; (uint256 claimIn, uint256 reward) = _calcReward(stakes[staker].stakedTs, stakedAmount, typeIndex); require(earlyUnstakeAllowed || claimIn == 0, "Locked still"); stakes[staker].unstakedTs = block.timestamp; stakes[staker].rewardAmount = (claimIn == 0) ? reward : 0; totalUnstakedAmount = totalUnstakedAmount.add(stakedAmount); if (0 < stakes[staker].rewardAmount) { totalUnstakedAmountWithReward = totalUnstakedAmountWithReward.add(stakedAmount); } types[typeIndex].stakedAmount = types[typeIndex].stakedAmount.sub(stakedAmount); zoneToken.safeTransfer(staker, stakedAmount.add(stakes[staker].rewardAmount)); emit Unstaked(staker, stakedAmount, stakes[staker].rewardAmount); } } function endStakeForUser1(address staker) private { require(0 < user1LastUnlockTs, "Blacklisted"); uint256 allowedAmount = user1ZonePerSec.mul(block.timestamp - user1LastUnlockTs); uint256 stakedAmount = stakes[staker].stakedAmount; if (allowedAmount < stakedAmount) { stakes[staker].stakedAmount = stakes[staker].stakedAmount - allowedAmount; } else { allowedAmount = stakedAmount; stakes[staker].unstakedTs = block.timestamp; } user1LastUnlockTs = block.timestamp; if (0 < allowedAmount) { zoneToken.safeTransfer(staker, allowedAmount); } } function _calcReward( uint256 stakedTs, uint256 stakedAmount, uint8 typeIndex ) internal view returns (uint256 claimIn, uint256 rewardAmount) { if (types[typeIndex].enabled == false) { return (0, 0); } uint256 unlockTs = stakedTs + (types[typeIndex].lockDay * 1 days); claimIn = (block.timestamp < unlockTs) ? unlockTs - block.timestamp : 0; rewardAmount = stakedAmount.mul(types[typeIndex].rewardRate).div(DENOMINATOR); return (claimIn, rewardAmount); } function getStakeInfo( address staker ) external view returns (uint256 stakedAmount, uint8 typeIndex, uint256 claimIn, uint256 rewardAmount, uint256 capacity) { Stake memory stake = stakes[staker]; if (isStaked(staker)) { stakedAmount = stake.stakedAmount; typeIndex = stake.typeIndex; (claimIn, rewardAmount) = _calcReward(stake.stakedTs, stake.stakedAmount, stake.typeIndex); return (stakedAmount, typeIndex, claimIn, rewardAmount, 0); } return (0, 0, 0, 0, leftCapacity()); } function fund(address _from, uint256 _amount) external { require(_from != address(0), '_from is invalid'); require(0 < _amount, '_amount is invalid'); require(_amount <= zoneToken.balanceOf(_from), 'Insufficient balance'); zoneToken.safeTransferFrom(_from, address(this), _amount); } function finish() external onlyOwner() { for (uint i = 0; i < types.length; i ++) { if (types[i].enabled) { types[i].enabled = false; } } uint256 amount = zoneToken.balanceOf(address(this)); amount = amount.add(totalUnstakedAmount).sub(totalStakedAmount); if (0 < amount) { zoneToken.safeTransfer(owner(), amount); } } function allowEndStakeForUser1() external onlyOwner() { user1LastUnlockTs = block.timestamp; user1ZonePerSec = 4606544 * 1e10; // 0.04606544 ZONE per second } function setUser1ZonePerSec(uint256 _user1ZonePerSec) external onlyOwner() { user1ZonePerSec = _user1ZonePerSec; } } contract ZoneStakingUpgradeableProxy is TransparentUpgradeableProxy { constructor(address logic, address admin, bytes memory data) TransparentUpgradeableProxy(logic, admin, data) public { } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./UpgradeableProxy.sol"; /** * @dev This contract implements a proxy that is upgradeable by an admin. * * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector * clashing], which can potentially be used in an attack, this contract uses the * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two * things that go hand in hand: * * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if * that call matches one of the admin functions exposed by the proxy itself. * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the * implementation. If the admin tries to call a function on the implementation it will fail with an error that says * "admin cannot fallback to proxy target". * * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due * to sudden errors when trying to call a function from the proxy implementation. * * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy. */ contract TransparentUpgradeableProxy is UpgradeableProxy { /** * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}. */ constructor(address _logic, address admin_, bytes memory _data) public payable UpgradeableProxy(_logic, _data) { assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1)); _setAdmin(admin_); } /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin. */ modifier ifAdmin() { if (msg.sender == _admin()) { _; } else { _fallback(); } } /** * @dev Returns the current admin. * * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function admin() external ifAdmin returns (address admin_) { admin_ = _admin(); } /** * @dev Returns the current implementation. * * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` */ function implementation() external ifAdmin returns (address implementation_) { implementation_ = _implementation(); } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. * * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}. */ function changeAdmin(address newAdmin) external virtual ifAdmin { require(newAdmin != address(0), "TransparentUpgradeableProxy: new admin is the zero address"); emit AdminChanged(_admin(), newAdmin); _setAdmin(newAdmin); } /** * @dev Upgrade the implementation of the proxy. * * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}. */ function upgradeTo(address newImplementation) external virtual ifAdmin { _upgradeTo(newImplementation); } /** * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the * proxied contract. * * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}. */ function upgradeToAndCall(address newImplementation, bytes calldata data) external payable virtual ifAdmin { _upgradeTo(newImplementation); Address.functionDelegateCall(newImplementation, data); } /** * @dev Returns the current admin. */ function _admin() internal view virtual returns (address adm) { bytes32 slot = _ADMIN_SLOT; // solhint-disable-next-line no-inline-assembly assembly { adm := sload(slot) } } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { bytes32 slot = _ADMIN_SLOT; // solhint-disable-next-line no-inline-assembly assembly { sstore(slot, newAdmin) } } /** * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}. */ function _beforeFallback() internal virtual override { require(msg.sender != _admin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target"); super._beforeFallback(); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ 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) { 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) { 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) { // 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) { 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) { 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) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); 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) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @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. 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) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); 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) { require(b > 0, "SafeMath: modulo by zero"); 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) { 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. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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) { 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) { require(b > 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <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); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC20Upgradeable.sol"; import "../../math/SafeMathUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20Upgradeable { using SafeMathUpgradeable for uint256; using AddressUpgradeable for address; function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../proxy/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal initializer { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal initializer { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.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; address private _pendingOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init(address _ownerAddress) internal initializer { __Context_init_unchained(); __Ownable_init_unchained(_ownerAddress); } function __Ownable_init_unchained(address _ownerAddress) internal initializer { _owner = _ownerAddress; emit OwnershipTransferred(address(0), _ownerAddress); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Returns the address of the pending owner. */ function pendingOwner() public view virtual returns (address) { return _pendingOwner; } /** * @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 { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function safeTransferOwnership(address newOwner, bool safely) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); if (safely) { _pendingOwner = newOwner; } else { emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; _pendingOwner = address(0); } } function safeAcceptOwnership() public virtual { require(_msgSender() == _pendingOwner, "acceptOwnership: Call must come from pendingOwner."); emit OwnershipTransferred(_owner, _pendingOwner); _owner = _pendingOwner; } uint256[48] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./Proxy.sol"; import "../utils/Address.sol"; /** * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an * implementation address that can be changed. This address is stored in storage in the location specified by * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the * implementation behind the proxy. * * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see * {TransparentUpgradeableProxy}. */ contract UpgradeableProxy is Proxy { /** * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`. * * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded * function call, and allows initializating the storage of the proxy like a Solidity constructor. */ constructor(address _logic, bytes memory _data) public payable { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); _setImplementation(_logic); if(_data.length > 0) { Address.functionDelegateCall(_logic, _data); } } /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation address. */ function _implementation() internal view virtual override returns (address impl) { bytes32 slot = _IMPLEMENTATION_SLOT; // solhint-disable-next-line no-inline-assembly assembly { impl := sload(slot) } } /** * @dev Upgrades the proxy to a new implementation. * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal virtual { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "UpgradeableProxy: new implementation is not a contract"); bytes32 slot = _IMPLEMENTATION_SLOT; // solhint-disable-next-line no-inline-assembly assembly { sstore(slot, newImplementation) } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { // solhint-disable-next-line no-inline-assembly assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback () external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive () external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overriden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual { } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity >=0.4.24 <0.8.0; import "../utils/AddressUpgradeable.sol"; /** * @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 {UpgradeableProxy-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 || _isConstructor() || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../proxy/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 GSN 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 payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } uint256[50] private __gap; }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"enable","type":"bool"},{"indexed":false,"internalType":"uint16","name":"lockDay","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"rewardRate","type":"uint256"}],"name":"AddType","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"typeIndex","type":"uint8"},{"indexed":false,"internalType":"bool","name":"enable","type":"bool"},{"indexed":false,"internalType":"uint16","name":"lockDay","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"rewardRate","type":"uint256"}],"name":"ChangeType","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"newAllowed","type":"bool"}],"name":"SetEarlyUnstakeAllowed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newMinStakeAmount","type":"uint256"}],"name":"SetMinStakeAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newStakeLimit","type":"uint256"}],"name":"SetStakeLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newVault","type":"address"}],"name":"SetVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"typeIndex","type":"uint8"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"stakedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"Unstaked","type":"event"},{"inputs":[{"internalType":"bool[]","name":"_enables","type":"bool[]"},{"internalType":"uint16[]","name":"_lockDays","type":"uint16[]"},{"internalType":"uint256[]","name":"_rewardRates","type":"uint256[]"}],"name":"addTypes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"allowEndStakeForUser1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_typeIndex","type":"uint8"},{"internalType":"bool","name":"_enable","type":"bool"},{"internalType":"uint16","name":"_lockDay","type":"uint16"},{"internalType":"uint256","name":"_rewardRate","type":"uint256"}],"name":"changeType","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"earlyUnstakeAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"finish","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"fund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAllTypes","outputs":[{"internalType":"bool[]","name":"enables","type":"bool[]"},{"internalType":"uint16[]","name":"lockDays","type":"uint16[]"},{"internalType":"uint256[]","name":"rewardRates","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"}],"name":"getStakeInfo","outputs":[{"internalType":"uint256","name":"stakedAmount","type":"uint256"},{"internalType":"uint8","name":"typeIndex","type":"uint8"},{"internalType":"uint256","name":"claimIn","type":"uint256"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"uint256","name":"capacity","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governorTimelock","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_ownerAddress","type":"address"},{"internalType":"address","name":"_zoneToken","type":"address"},{"internalType":"address","name":"_governorTimelock","type":"address"},{"internalType":"bool[]","name":"_typeEnables","type":"bool[]"},{"internalType":"uint16[]","name":"_lockDays","type":"uint16[]"},{"internalType":"uint256[]","name":"_rewardRates","type":"uint256[]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isStaked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"leftCapacity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minStakeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"safeAcceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"},{"internalType":"bool","name":"safely","type":"bool"}],"name":"safeTransferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"allow","type":"bool"}],"name":"setEarlyUnstakeAllowed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_governorTimelock","type":"address"}],"name":"setGovernorTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minStakeAmount","type":"uint256"}],"name":"setMinStakeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_stakeLimit","type":"uint256"}],"name":"setStakeLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_user1ZonePerSec","type":"uint256"}],"name":"setUser1ZonePerSec","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakeLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakes","outputs":[{"internalType":"bool","name":"exist","type":"bool"},{"internalType":"uint8","name":"typeIndex","type":"uint8"},{"internalType":"uint256","name":"stakedTs","type":"uint256"},{"internalType":"uint256","name":"unstakedTs","type":"uint256"},{"internalType":"uint256","name":"stakedAmount","type":"uint256"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint8","name":"typeIndex","type":"uint8"}],"name":"startStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalStakedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalUnstakedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalUnstakedAmountWithReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"types","outputs":[{"internalType":"bool","name":"enabled","type":"bool"},{"internalType":"uint16","name":"lockDay","type":"uint16"},{"internalType":"uint256","name":"rewardRate","type":"uint256"},{"internalType":"uint256","name":"stakedAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"user1LastUnlockTs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"user1ZonePerSec","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"zoneToken","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061303f806100206000396000f3fe608060405234801561001057600080fd5b50600436106102065760003560e01c80638ac1bd0a1161011a578063cefbfa36116100ad578063e30c39781161007c578063e30c397814610917578063eb4af0451461091f578063ef7066221461093c578063f188768414610974578063f339fc311461097c57610206565b8063cefbfa36146108b7578063d0de59ef146108ff578063d56b288914610907578063e1004c7e1461090f57610206565b8063af012c74116100e9578063af012c741461084c578063bcee761214610854578063c34531531461085c578063c43f6751146108af57610206565b80638ac1bd0a146108175780638da5cb5b1461081f5780639a438aca14610827578063a1c9b2131461082f57610206565b8063567e98f91161019d578063715018a61161016c578063715018a61461047057806377994b05146104785780637b1837de1461061d578063861321bb14610649578063877d68a21461080f57610206565b8063567e98f9146104005780635a7f7ff5146104085780636177fd18146104105780636fd0d8881461044a57610206565b80633ad0e5e2116101d95780633ad0e5e214610389578063440bde4f146103ad57806345ef79af146103ca57806353424674146103d257610206565b806309dddcf01461020b578063166ad6ca146102f157806316934fc41461030b57806331cfc3e114610368575b600080fd5b6102136109a2565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b8381101561025b578181015183820152602001610243565b50505050905001848103835286818151815260200191508051906020019060200280838360005b8381101561029a578181015183820152602001610282565b50505050905001848103825285818151815260200191508051906020019060200280838360005b838110156102d95781810151838201526020016102c1565b50505050905001965050505050505060405180910390f35b6102f9610b62565b60408051918252519081900360200190f35b6103316004803603602081101561032157600080fd5b50356001600160a01b0316610b68565b60408051961515875260ff9095166020870152858501939093526060850191909152608084015260a0830152519081900360c00190f35b6103876004803603602081101561037e57600080fd5b50351515610b9f565b005b610391610c67565b604080516001600160a01b039092168252519081900360200190f35b610387600480360360208110156103c357600080fd5b5035610c7b565b6102f9610ce2565b610387600480360360408110156103e857600080fd5b506001600160a01b0381351690602001351515610ce8565b6102f9610e09565b610387610e0f565b6104366004803603602081101561042657600080fd5b50356001600160a01b0316610eb9565b604080519115158252519081900360200190f35b6103876004803603602081101561046057600080fd5b50356001600160a01b0316610f0e565b610387610f92565b6103876004803603606081101561048e57600080fd5b810190602081018135600160201b8111156104a857600080fd5b8201836020820111156104ba57600080fd5b803590602001918460208302840111600160201b831117156104db57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561052a57600080fd5b82018360208201111561053c57600080fd5b803590602001918460208302840111600160201b8311171561055d57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156105ac57600080fd5b8201836020820111156105be57600080fd5b803590602001918460208302840111600160201b831117156105df57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061102c945050505050565b6103876004803603604081101561063357600080fd5b506001600160a01b03813516906020013561109e565b610387600480360360c081101561065f57600080fd5b6001600160a01b0382358116926020810135821692604082013590921691810190608081016060820135600160201b81111561069a57600080fd5b8201836020820111156106ac57600080fd5b803590602001918460208302840111600160201b831117156106cd57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561071c57600080fd5b82018360208201111561072e57600080fd5b803590602001918460208302840111600160201b8311171561074f57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561079e57600080fd5b8201836020820111156107b057600080fd5b803590602001918460208302840111600160201b831117156107d157600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061122c945050505050565b6102f96113b2565b6104366113b8565b6103916113c1565b6102f96113d0565b6103876004803603602081101561084557600080fd5b50356113d6565b6102f9611503565b610387611539565b6108826004803603602081101561087257600080fd5b50356001600160a01b031661184c565b6040805195865260ff90941660208601528484019290925260608401526080830152519081900360a00190f35b610387611919565b6108d4600480360360208110156108cd57600080fd5b503561198c565b60408051941515855261ffff9093166020850152838301919091526060830152519081900360800190f35b6102f96119ce565b6103876119d4565b610391611b63565b610391611b72565b6103876004803603602081101561093557600080fd5b5035611b81565b6103876004803603608081101561095257600080fd5b5060ff81351690602081013515159061ffff6040820135169060600135611c38565b6102f9611df8565b6103876004803603604081101561099257600080fd5b508035906020013560ff16611dfe565b606080606060978054905067ffffffffffffffff811180156109c357600080fd5b506040519080825280602002602001820160405280156109ed578160200160208202803683370190505b5060975490935067ffffffffffffffff81118015610a0a57600080fd5b50604051908082528060200260200182016040528015610a34578160200160208202803683370190505b5060975490925067ffffffffffffffff81118015610a5157600080fd5b50604051908082528060200260200182016040528015610a7b578160200160208202803683370190505b50905060005b609754811015610b5c5760978181548110610a9857fe5b6000918252602090912060039091020154845160ff90911690859083908110610abd57fe5b60200260200101901515908115158152505060978181548110610adc57fe5b906000526020600020906003020160000160019054906101000a900461ffff16838281518110610b0857fe5b602002602001019061ffff16908161ffff168152505060978181548110610b2b57fe5b906000526020600020906003020160010154828281518110610b4957fe5b6020908102919091010152600101610a81565b50909192565b609a5481565b6098602052600090815260409020805460018201546002830154600384015460049094015460ff8085169561010090950416939086565b6000610ba96121db565b9050806001600160a01b0316610bbd6113c1565b6001600160a01b03161480610bdf5750609e546001600160a01b038281169116145b610c1a5760405162461bcd60e51b8152600401808060200182810382526026815260200180612ef96026913960400191505060405180910390fd5b609d805460ff191683151517908190556040805160ff90921615158252517fa0de32eae3f0d0e64ac7dbaf4cb273b018d93f236e6f91d417dbeabb8acab3ab916020908290030190a15050565b609d5461010090046001600160a01b031681565b610c836121db565b6001600160a01b0316610c946113c1565b6001600160a01b031614610cdd576040805162461bcd60e51b81526020600482018190526024820152600080516020612fa0833981519152604482015290519081900360640190fd5b60a155565b609b5481565b610cf06121db565b6001600160a01b0316610d016113c1565b6001600160a01b031614610d4a576040805162461bcd60e51b81526020600482018190526024820152600080516020612fa0833981519152604482015290519081900360640190fd5b6001600160a01b038216610d8f5760405162461bcd60e51b8152600401808060200182810382526026815260200180612ead6026913960400191505060405180910390fd5b8015610db557603480546001600160a01b0319166001600160a01b038416179055610e05565b6033546040516001600160a01b03808516921690600080516020612fc083398151915290600090a3603380546001600160a01b0384166001600160a01b0319918216179091556034805490911690555b5050565b60995481565b6034546001600160a01b0316610e236121db565b6001600160a01b031614610e685760405162461bcd60e51b8152600401808060200182810382526032815260200180612f1f6032913960400191505060405180910390fd5b6034546033546040516001600160a01b039283169290911690600080516020612fc083398151915290600090a3603454603380546001600160a01b0319166001600160a01b03909216919091179055565b6001600160a01b03811660009081526098602052604081205460ff168015610efa57506001600160a01b038216600090815260986020526040902060020154155b610f05576000610f08565b60015b92915050565b610f166121db565b6001600160a01b0316610f276113c1565b6001600160a01b031614610f70576040805162461bcd60e51b81526020600482018190526024820152600080516020612fa0833981519152604482015290519081900360640190fd5b609e80546001600160a01b0319166001600160a01b0392909216919091179055565b610f9a6121db565b6001600160a01b0316610fab6113c1565b6001600160a01b031614610ff4576040805162461bcd60e51b81526020600482018190526024820152600080516020612fa0833981519152604482015290519081900360640190fd5b6033546040516000916001600160a01b031690600080516020612fc0833981519152908390a3603380546001600160a01b0319169055565b6110346121db565b6001600160a01b03166110456113c1565b6001600160a01b03161461108e576040805162461bcd60e51b81526020600482018190526024820152600080516020612fa0833981519152604482015290519081900360640190fd5b6110998383836121df565b505050565b6001600160a01b0382166110ec576040805162461bcd60e51b815260206004820152601060248201526f17d99c9bdb481a5cc81a5b9d985b1a5960821b604482015290519081900360640190fd5b80600010611136576040805162461bcd60e51b815260206004820152601260248201527117d85b5bdd5b9d081a5cc81a5b9d985b1a5960721b604482015290519081900360640190fd5b609d60019054906101000a90046001600160a01b03166001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561119857600080fd5b505afa1580156111ac573d6000803e3d6000fd5b505050506040513d60208110156111c257600080fd5b505181111561120f576040805162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b604482015290519081900360640190fd5b609d54610e059061010090046001600160a01b031683308461245c565b600054610100900460ff168061124557506112456124b6565b80611253575060005460ff16155b61128e5760405162461bcd60e51b815260040180806020018281038252602e815260200180612f51602e913960400191505060405180910390fd5b600054610100900460ff161580156112b9576000805460ff1961ff0019909116610100171660011790555b6001600160a01b038716611314576040805162461bcd60e51b815260206004820152601860248201527f4f776e6572206164647265737320697320696e76616c69640000000000000000604482015290519081900360640190fd5b6a0211654585005212800000609b55670de0b6b3a7640000609c55609d805460ff19166001179055611345876124c7565b61134d61257a565b609d8054610100600160a81b0319166101006001600160a01b038981169190910291909117909155609e80546001600160a01b0319169187169190911790556113978484846121df565b80156113a9576000805461ff00191690555b50505050505050565b609f5481565b609d5460ff1681565b6033546001600160a01b031690565b60a05481565b60006113e06121db565b9050806001600160a01b03166113f46113c1565b6001600160a01b031614806114165750609e546001600160a01b038281169116145b6114515760405162461bcd60e51b8152600401808060200182810382526026815260200180612ef96026913960400191505060405180910390fd5b6000611476609a54611470609954609f5461262390919063ffffffff16565b90612684565b9050828111156114c6576040805162461bcd60e51b8152602060048201526016602482015275151a19481b1a5b5a5d081a5cc81d1bdbc81cdb585b1b60521b604482015290519081900360640190fd5b609b8390556040805184815290517fd9a9a09fc16faafb71aa791b06aaf1f32e3ae9078035dc57c6cac185142685cd9181900360200190a1505050565b600080611523609a54611470609954609f5461262390919063ffffffff16565b609b549091506115339082612684565b91505090565b60026065541415611591576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260655560006115a06121db565b90506115ab81610eb9565b6115e9576040805162461bcd60e51b815260206004820152600a602482015269139bdd081cdd185ad95960b21b604482015290519081900360640190fd5b6001600160a01b0381167383b4271b054818a93325c7299f006aec2e90ef96141561161c57611617816126e1565b611844565b6001600160a01b03811660009081526098602052604081208054600382015460019092015461010090910460ff16929081906116599084866127d8565b609d54919350915060ff168061166d575081155b6116ad576040805162461bcd60e51b815260206004820152600c60248201526b131bd8dad959081cdd1a5b1b60a21b604482015290519081900360640190fd5b6001600160a01b03851660009081526098602052604090204260029091015581156116d95760006116db565b805b6001600160a01b038616600090815260986020526040902060040155609a546117049084612623565b609a556001600160a01b0385166000908152609860205260409020600401541561173957609f546117359084612623565b609f555b61176d8360978660ff168154811061174d57fe5b90600052602060002090600302016002015461268490919063ffffffff16565b60978560ff168154811061177d57fe5b9060005260206000209060030201600201819055506117e9856117d160986000896001600160a01b03166001600160a01b03168152602001908152602001600020600401548661262390919063ffffffff16565b609d5461010090046001600160a01b031691906128b2565b6001600160a01b0385166000818152609860209081526040918290206004015482518781529182015281517f7fc4727e062e336010f2c282598ef5f14facb3de68cf8195c2f23e1454b2b74e929181900390910190a2505050505b506001606555565b6001600160a01b0381166000908152609860209081526040808320815160c081018352815460ff80821615158352610100909104169381019390935260018101549183019190915260028101546060830152600381015460808301526004015460a082015281908190819081906118c287610eb9565b156118f65760808101516020820151604083015191975095506118e69087876127d8565b9094509250600091506119109050565b600080600080611904611503565b95509550955095509550505b91939590929450565b6119216121db565b6001600160a01b03166119326113c1565b6001600160a01b03161461197b576040805162461bcd60e51b81526020600482018190526024820152600080516020612fa0833981519152604482015290519081900360640190fd5b4260a05566a3a8460b9f400060a155565b6097818154811061199c57600080fd5b600091825260209091206003909102018054600182015460029092015460ff8216935061010090910461ffff16919084565b60a15481565b6119dc6121db565b6001600160a01b03166119ed6113c1565b6001600160a01b031614611a36576040805162461bcd60e51b81526020600482018190526024820152600080516020612fa0833981519152604482015290519081900360640190fd5b60005b609754811015611aa05760978181548110611a5057fe5b600091825260209091206003909102015460ff1615611a9857600060978281548110611a7857fe5b60009182526020909120600390910201805460ff19169115159190911790555b600101611a39565b50609d54604080516370a0823160e01b8152306004820152905160009261010090046001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611af157600080fd5b505afa158015611b05573d6000803e3d6000fd5b505050506040513d6020811015611b1b57600080fd5b5051609954609a54919250611b3591611470908490612623565b90508015611b6057611b60611b486113c1565b609d5461010090046001600160a01b031690836128b2565b50565b609e546001600160a01b031681565b6034546001600160a01b031690565b6000611b8b6121db565b9050806001600160a01b0316611b9f6113c1565b6001600160a01b03161480611bc15750609e546001600160a01b038281169116145b611bfc5760405162461bcd60e51b8152600401808060200182810382526026815260200180612ef96026913960400191505060405180910390fd5b609c8290556040805183815290517f6e4bcc82cb4b918df6b911c8092c49f027b7d409733e2c97bb0a4b5a367e19db9181900360200190a15050565b6000611c426121db565b9050806001600160a01b0316611c566113c1565b6001600160a01b03161480611c785750609e546001600160a01b038281169116145b611cb35760405162461bcd60e51b8152600401808060200182810382526026815260200180612ef96026913960400191505060405180910390fd5b60975460ff861610611d00576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e8f2e0ca92dcc8caf607b1b604482015290519081900360640190fd5b6113888210611d4d576040805162461bcd60e51b8152602060048201526014602482015273546f6f206c61726765207265776172645261746560601b604482015290519081900360640190fd5b600060978660ff1681548110611d5f57fe5b600091825260209182902060039190910201805460ff19168715151762ffff00191661010061ffff888116820292909217808455600184018890556040805160ff8d8116825283161515968101969096529190049091168382015260608301869052519092507f72a38eea1f38f2d28e765e3ec3da350219bbac1187a20efd23795391d910bfdf916080908290030190a1505050505050565b609c5481565b60026065541415611e56576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026065556000611e656121db565b90506000611e71611503565b905080600010611eb9576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e4818db1bdcd95960921b604482015290519081900360640190fd5b611ec282610eb9565b15611f05576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481cdd185ad95960921b604482015290519081900360640190fd5b83609c541115611f5c576040805162461bcd60e51b815260206004820152601f60248201527f546865207374616b696e6720616d6f756e7420697320746f6f20736d616c6c00604482015290519081900360640190fd5b80841115611fb1576040805162461bcd60e51b815260206004820152601860248201527f45786365656420746865207374616b696e67206c696d69740000000000000000604482015290519081900360640190fd5b60975460ff841610611ffe576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e8f2e0ca92dcc8caf607b1b604482015290519081900360640190fd5b60978360ff168154811061200e57fe5b600091825260209091206003909102015460ff16612067576040805162461bcd60e51b8152602060048201526011602482015270151a19481d1e5c1948191a5cd8589b1959607a1b604482015290519081900360640190fd5b609d546120849061010090046001600160a01b031683308761245c565b6040805160c081018252600180825260ff868116602080850191825242858701908152600060608701818152608088018d815260a089018381526001600160a01b038d16845260989095529890912096518754945160ff199095169015151761ff0019166101009490951693909302939093178555915192840192909255905160028301559151600382015590516004909101556099546121259085612623565b60998190555061215f8460978560ff168154811061213f57fe5b90600052602060002090600302016002015461262390919063ffffffff16565b60978460ff168154811061216f57fe5b906000526020600020906003020160020181905550816001600160a01b03167f8acf475137e0cd74ca7f611d16b1e6383ec9a9c71a8e5b85967781b9c7214d118585604051808381526020018260ff1681526020019250505060405180910390a2505060016065555050565b3390565b805182511480156121f1575082518251145b612234576040805162461bcd60e51b815260206004820152600f60248201526e4d69736d617463686564206461746160881b604482015290519081900360640190fd5b815160975460ff9101111561227b576040805162461bcd60e51b81526020600482015260086024820152670a8dede40daeac6d60c31b604482015290519081900360640190fd5b60005b82518110156124565760026127100482828151811061229957fe5b6020026020010151106122ea576040805162461bcd60e51b8152602060048201526014602482015273546f6f206c61726765207265776172645261746560601b604482015290519081900360640190fd5b6000604051806080016040528086848151811061230357fe5b60200260200101511515815260200185848151811061231e57fe5b602002602001015161ffff16815260200184848151811061233b57fe5b6020908102919091018101518252600091810182905260978054600181018255925282517f354a83ed9988f79f6038d4c7a7dadbad8af32f4ad6df893e0e5807a1b1944ff9600390930292830180548584015160ff1990911692151592831762ffff00191661010061ffff909216918202179091556040808601517f354a83ed9988f79f6038d4c7a7dadbad8af32f4ad6df893e0e5807a1b1944ffa86018190556060808801517f354a83ed9988f79f6038d4c7a7dadbad8af32f4ad6df893e0e5807a1b1944ffb909701969096558151938452938301919091528181019290925290519293507f78d782a4d9e33a46c20a0def9e9253843ce1b0434604e52b451eaa17245c3685929081900390910190a15060010161227e565b50505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612456908590612900565b60006124c1306129b1565b15905090565b600054610100900460ff16806124e057506124e06124b6565b806124ee575060005460ff16155b6125295760405162461bcd60e51b815260040180806020018281038252602e815260200180612f51602e913960400191505060405180910390fd5b600054610100900460ff16158015612554576000805460ff1961ff0019909116610100171660011790555b61255c6129b7565b61256582612a57565b8015610e05576000805461ff00191690555050565b600054610100900460ff168061259357506125936124b6565b806125a1575060005460ff16155b6125dc5760405162461bcd60e51b815260040180806020018281038252602e815260200180612f51602e913960400191505060405180910390fd5b600054610100900460ff16158015612607576000805460ff1961ff0019909116610100171660011790555b61260f612b30565b8015611b60576000805461ff001916905550565b60008282018381101561267d576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6000828211156126db576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60a054600010612726576040805162461bcd60e51b815260206004820152600b60248201526a109b1858dadb1a5cdd195960aa1b604482015290519081900360640190fd5b600061274160a054420360a154612bd690919063ffffffff16565b6001600160a01b0383166000908152609860205260409020600301549091508082101561278f576001600160a01b0383166000908152609860205260409020600301805483900390556127b2565b6001600160a01b0383166000908152609860205260409020426002909101559050805b4260a055811561109957609d546110999061010090046001600160a01b031684846128b2565b60008060978360ff16815481106127eb57fe5b600091825260209091206003909102015460ff1661280e575060009050806128aa565b600060978460ff168154811061282057fe5b906000526020600020906003020160000160019054906101000a900461ffff1661ffff16620151800262ffffff1686019050804210612860576000612864565b4281035b92506128a66127106128a060978760ff168154811061287f57fe5b90600052602060002090600302016001015488612bd690919063ffffffff16565b90612c2f565b9150505b935093915050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526110999084905b6000612955826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612c969092919063ffffffff16565b8051909150156110995780806020019051602081101561297457600080fd5b50516110995760405162461bcd60e51b815260040180806020018281038252602a815260200180612fe0602a913960400191505060405180910390fd5b3b151590565b600054610100900460ff16806129d057506129d06124b6565b806129de575060005460ff16155b612a195760405162461bcd60e51b815260040180806020018281038252602e815260200180612f51602e913960400191505060405180910390fd5b600054610100900460ff1615801561260f576000805460ff1961ff0019909116610100171660011790558015611b60576000805461ff001916905550565b600054610100900460ff1680612a705750612a706124b6565b80612a7e575060005460ff16155b612ab95760405162461bcd60e51b815260040180806020018281038252602e815260200180612f51602e913960400191505060405180910390fd5b600054610100900460ff16158015612ae4576000805460ff1961ff0019909116610100171660011790555b603380546001600160a01b0319166001600160a01b038416908117909155604051600090600080516020612fc0833981519152908290a38015610e05576000805461ff00191690555050565b600054610100900460ff1680612b495750612b496124b6565b80612b57575060005460ff16155b612b925760405162461bcd60e51b815260040180806020018281038252602e815260200180612f51602e913960400191505060405180910390fd5b600054610100900460ff16158015612bbd576000805460ff1961ff0019909116610100171660011790555b60016065558015611b60576000805461ff001916905550565b600082612be557506000610f08565b82820282848281612bf257fe5b041461267d5760405162461bcd60e51b8152600401808060200182810382526021815260200180612f7f6021913960400191505060405180910390fd5b6000808211612c85576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381612c8e57fe5b049392505050565b6060612ca58484600085612cad565b949350505050565b606082471015612cee5760405162461bcd60e51b8152600401808060200182810382526026815260200180612ed36026913960400191505060405180910390fd5b612cf7856129b1565b612d48576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310612d865780518252601f199092019160209182019101612d67565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612de8576040519150601f19603f3d011682016040523d82523d6000602084013e612ded565b606091505b5091509150612dfd828286612e08565b979650505050505050565b60608315612e1757508161267d565b825115612e275782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612e71578181015183820152602001612e59565b50505050905090810190601f168015612e9e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5468652063616c6c65722073686f756c64206265206f776e6572206f7220676f7665726e6f726163636570744f776e6572736869703a2043616c6c206d75737420636f6d652066726f6d2070656e64696e674f776e65722e496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220a4f8c66c38a4ac533bd3b68c73d1811bf7079bf9ae053745cde6c90bec0bf52e64736f6c63430007060033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102065760003560e01c80638ac1bd0a1161011a578063cefbfa36116100ad578063e30c39781161007c578063e30c397814610917578063eb4af0451461091f578063ef7066221461093c578063f188768414610974578063f339fc311461097c57610206565b8063cefbfa36146108b7578063d0de59ef146108ff578063d56b288914610907578063e1004c7e1461090f57610206565b8063af012c74116100e9578063af012c741461084c578063bcee761214610854578063c34531531461085c578063c43f6751146108af57610206565b80638ac1bd0a146108175780638da5cb5b1461081f5780639a438aca14610827578063a1c9b2131461082f57610206565b8063567e98f91161019d578063715018a61161016c578063715018a61461047057806377994b05146104785780637b1837de1461061d578063861321bb14610649578063877d68a21461080f57610206565b8063567e98f9146104005780635a7f7ff5146104085780636177fd18146104105780636fd0d8881461044a57610206565b80633ad0e5e2116101d95780633ad0e5e214610389578063440bde4f146103ad57806345ef79af146103ca57806353424674146103d257610206565b806309dddcf01461020b578063166ad6ca146102f157806316934fc41461030b57806331cfc3e114610368575b600080fd5b6102136109a2565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b8381101561025b578181015183820152602001610243565b50505050905001848103835286818151815260200191508051906020019060200280838360005b8381101561029a578181015183820152602001610282565b50505050905001848103825285818151815260200191508051906020019060200280838360005b838110156102d95781810151838201526020016102c1565b50505050905001965050505050505060405180910390f35b6102f9610b62565b60408051918252519081900360200190f35b6103316004803603602081101561032157600080fd5b50356001600160a01b0316610b68565b60408051961515875260ff9095166020870152858501939093526060850191909152608084015260a0830152519081900360c00190f35b6103876004803603602081101561037e57600080fd5b50351515610b9f565b005b610391610c67565b604080516001600160a01b039092168252519081900360200190f35b610387600480360360208110156103c357600080fd5b5035610c7b565b6102f9610ce2565b610387600480360360408110156103e857600080fd5b506001600160a01b0381351690602001351515610ce8565b6102f9610e09565b610387610e0f565b6104366004803603602081101561042657600080fd5b50356001600160a01b0316610eb9565b604080519115158252519081900360200190f35b6103876004803603602081101561046057600080fd5b50356001600160a01b0316610f0e565b610387610f92565b6103876004803603606081101561048e57600080fd5b810190602081018135600160201b8111156104a857600080fd5b8201836020820111156104ba57600080fd5b803590602001918460208302840111600160201b831117156104db57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561052a57600080fd5b82018360208201111561053c57600080fd5b803590602001918460208302840111600160201b8311171561055d57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156105ac57600080fd5b8201836020820111156105be57600080fd5b803590602001918460208302840111600160201b831117156105df57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061102c945050505050565b6103876004803603604081101561063357600080fd5b506001600160a01b03813516906020013561109e565b610387600480360360c081101561065f57600080fd5b6001600160a01b0382358116926020810135821692604082013590921691810190608081016060820135600160201b81111561069a57600080fd5b8201836020820111156106ac57600080fd5b803590602001918460208302840111600160201b831117156106cd57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561071c57600080fd5b82018360208201111561072e57600080fd5b803590602001918460208302840111600160201b8311171561074f57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561079e57600080fd5b8201836020820111156107b057600080fd5b803590602001918460208302840111600160201b831117156107d157600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061122c945050505050565b6102f96113b2565b6104366113b8565b6103916113c1565b6102f96113d0565b6103876004803603602081101561084557600080fd5b50356113d6565b6102f9611503565b610387611539565b6108826004803603602081101561087257600080fd5b50356001600160a01b031661184c565b6040805195865260ff90941660208601528484019290925260608401526080830152519081900360a00190f35b610387611919565b6108d4600480360360208110156108cd57600080fd5b503561198c565b60408051941515855261ffff9093166020850152838301919091526060830152519081900360800190f35b6102f96119ce565b6103876119d4565b610391611b63565b610391611b72565b6103876004803603602081101561093557600080fd5b5035611b81565b6103876004803603608081101561095257600080fd5b5060ff81351690602081013515159061ffff6040820135169060600135611c38565b6102f9611df8565b6103876004803603604081101561099257600080fd5b508035906020013560ff16611dfe565b606080606060978054905067ffffffffffffffff811180156109c357600080fd5b506040519080825280602002602001820160405280156109ed578160200160208202803683370190505b5060975490935067ffffffffffffffff81118015610a0a57600080fd5b50604051908082528060200260200182016040528015610a34578160200160208202803683370190505b5060975490925067ffffffffffffffff81118015610a5157600080fd5b50604051908082528060200260200182016040528015610a7b578160200160208202803683370190505b50905060005b609754811015610b5c5760978181548110610a9857fe5b6000918252602090912060039091020154845160ff90911690859083908110610abd57fe5b60200260200101901515908115158152505060978181548110610adc57fe5b906000526020600020906003020160000160019054906101000a900461ffff16838281518110610b0857fe5b602002602001019061ffff16908161ffff168152505060978181548110610b2b57fe5b906000526020600020906003020160010154828281518110610b4957fe5b6020908102919091010152600101610a81565b50909192565b609a5481565b6098602052600090815260409020805460018201546002830154600384015460049094015460ff8085169561010090950416939086565b6000610ba96121db565b9050806001600160a01b0316610bbd6113c1565b6001600160a01b03161480610bdf5750609e546001600160a01b038281169116145b610c1a5760405162461bcd60e51b8152600401808060200182810382526026815260200180612ef96026913960400191505060405180910390fd5b609d805460ff191683151517908190556040805160ff90921615158252517fa0de32eae3f0d0e64ac7dbaf4cb273b018d93f236e6f91d417dbeabb8acab3ab916020908290030190a15050565b609d5461010090046001600160a01b031681565b610c836121db565b6001600160a01b0316610c946113c1565b6001600160a01b031614610cdd576040805162461bcd60e51b81526020600482018190526024820152600080516020612fa0833981519152604482015290519081900360640190fd5b60a155565b609b5481565b610cf06121db565b6001600160a01b0316610d016113c1565b6001600160a01b031614610d4a576040805162461bcd60e51b81526020600482018190526024820152600080516020612fa0833981519152604482015290519081900360640190fd5b6001600160a01b038216610d8f5760405162461bcd60e51b8152600401808060200182810382526026815260200180612ead6026913960400191505060405180910390fd5b8015610db557603480546001600160a01b0319166001600160a01b038416179055610e05565b6033546040516001600160a01b03808516921690600080516020612fc083398151915290600090a3603380546001600160a01b0384166001600160a01b0319918216179091556034805490911690555b5050565b60995481565b6034546001600160a01b0316610e236121db565b6001600160a01b031614610e685760405162461bcd60e51b8152600401808060200182810382526032815260200180612f1f6032913960400191505060405180910390fd5b6034546033546040516001600160a01b039283169290911690600080516020612fc083398151915290600090a3603454603380546001600160a01b0319166001600160a01b03909216919091179055565b6001600160a01b03811660009081526098602052604081205460ff168015610efa57506001600160a01b038216600090815260986020526040902060020154155b610f05576000610f08565b60015b92915050565b610f166121db565b6001600160a01b0316610f276113c1565b6001600160a01b031614610f70576040805162461bcd60e51b81526020600482018190526024820152600080516020612fa0833981519152604482015290519081900360640190fd5b609e80546001600160a01b0319166001600160a01b0392909216919091179055565b610f9a6121db565b6001600160a01b0316610fab6113c1565b6001600160a01b031614610ff4576040805162461bcd60e51b81526020600482018190526024820152600080516020612fa0833981519152604482015290519081900360640190fd5b6033546040516000916001600160a01b031690600080516020612fc0833981519152908390a3603380546001600160a01b0319169055565b6110346121db565b6001600160a01b03166110456113c1565b6001600160a01b03161461108e576040805162461bcd60e51b81526020600482018190526024820152600080516020612fa0833981519152604482015290519081900360640190fd5b6110998383836121df565b505050565b6001600160a01b0382166110ec576040805162461bcd60e51b815260206004820152601060248201526f17d99c9bdb481a5cc81a5b9d985b1a5960821b604482015290519081900360640190fd5b80600010611136576040805162461bcd60e51b815260206004820152601260248201527117d85b5bdd5b9d081a5cc81a5b9d985b1a5960721b604482015290519081900360640190fd5b609d60019054906101000a90046001600160a01b03166001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561119857600080fd5b505afa1580156111ac573d6000803e3d6000fd5b505050506040513d60208110156111c257600080fd5b505181111561120f576040805162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b604482015290519081900360640190fd5b609d54610e059061010090046001600160a01b031683308461245c565b600054610100900460ff168061124557506112456124b6565b80611253575060005460ff16155b61128e5760405162461bcd60e51b815260040180806020018281038252602e815260200180612f51602e913960400191505060405180910390fd5b600054610100900460ff161580156112b9576000805460ff1961ff0019909116610100171660011790555b6001600160a01b038716611314576040805162461bcd60e51b815260206004820152601860248201527f4f776e6572206164647265737320697320696e76616c69640000000000000000604482015290519081900360640190fd5b6a0211654585005212800000609b55670de0b6b3a7640000609c55609d805460ff19166001179055611345876124c7565b61134d61257a565b609d8054610100600160a81b0319166101006001600160a01b038981169190910291909117909155609e80546001600160a01b0319169187169190911790556113978484846121df565b80156113a9576000805461ff00191690555b50505050505050565b609f5481565b609d5460ff1681565b6033546001600160a01b031690565b60a05481565b60006113e06121db565b9050806001600160a01b03166113f46113c1565b6001600160a01b031614806114165750609e546001600160a01b038281169116145b6114515760405162461bcd60e51b8152600401808060200182810382526026815260200180612ef96026913960400191505060405180910390fd5b6000611476609a54611470609954609f5461262390919063ffffffff16565b90612684565b9050828111156114c6576040805162461bcd60e51b8152602060048201526016602482015275151a19481b1a5b5a5d081a5cc81d1bdbc81cdb585b1b60521b604482015290519081900360640190fd5b609b8390556040805184815290517fd9a9a09fc16faafb71aa791b06aaf1f32e3ae9078035dc57c6cac185142685cd9181900360200190a1505050565b600080611523609a54611470609954609f5461262390919063ffffffff16565b609b549091506115339082612684565b91505090565b60026065541415611591576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260655560006115a06121db565b90506115ab81610eb9565b6115e9576040805162461bcd60e51b815260206004820152600a602482015269139bdd081cdd185ad95960b21b604482015290519081900360640190fd5b6001600160a01b0381167383b4271b054818a93325c7299f006aec2e90ef96141561161c57611617816126e1565b611844565b6001600160a01b03811660009081526098602052604081208054600382015460019092015461010090910460ff16929081906116599084866127d8565b609d54919350915060ff168061166d575081155b6116ad576040805162461bcd60e51b815260206004820152600c60248201526b131bd8dad959081cdd1a5b1b60a21b604482015290519081900360640190fd5b6001600160a01b03851660009081526098602052604090204260029091015581156116d95760006116db565b805b6001600160a01b038616600090815260986020526040902060040155609a546117049084612623565b609a556001600160a01b0385166000908152609860205260409020600401541561173957609f546117359084612623565b609f555b61176d8360978660ff168154811061174d57fe5b90600052602060002090600302016002015461268490919063ffffffff16565b60978560ff168154811061177d57fe5b9060005260206000209060030201600201819055506117e9856117d160986000896001600160a01b03166001600160a01b03168152602001908152602001600020600401548661262390919063ffffffff16565b609d5461010090046001600160a01b031691906128b2565b6001600160a01b0385166000818152609860209081526040918290206004015482518781529182015281517f7fc4727e062e336010f2c282598ef5f14facb3de68cf8195c2f23e1454b2b74e929181900390910190a2505050505b506001606555565b6001600160a01b0381166000908152609860209081526040808320815160c081018352815460ff80821615158352610100909104169381019390935260018101549183019190915260028101546060830152600381015460808301526004015460a082015281908190819081906118c287610eb9565b156118f65760808101516020820151604083015191975095506118e69087876127d8565b9094509250600091506119109050565b600080600080611904611503565b95509550955095509550505b91939590929450565b6119216121db565b6001600160a01b03166119326113c1565b6001600160a01b03161461197b576040805162461bcd60e51b81526020600482018190526024820152600080516020612fa0833981519152604482015290519081900360640190fd5b4260a05566a3a8460b9f400060a155565b6097818154811061199c57600080fd5b600091825260209091206003909102018054600182015460029092015460ff8216935061010090910461ffff16919084565b60a15481565b6119dc6121db565b6001600160a01b03166119ed6113c1565b6001600160a01b031614611a36576040805162461bcd60e51b81526020600482018190526024820152600080516020612fa0833981519152604482015290519081900360640190fd5b60005b609754811015611aa05760978181548110611a5057fe5b600091825260209091206003909102015460ff1615611a9857600060978281548110611a7857fe5b60009182526020909120600390910201805460ff19169115159190911790555b600101611a39565b50609d54604080516370a0823160e01b8152306004820152905160009261010090046001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611af157600080fd5b505afa158015611b05573d6000803e3d6000fd5b505050506040513d6020811015611b1b57600080fd5b5051609954609a54919250611b3591611470908490612623565b90508015611b6057611b60611b486113c1565b609d5461010090046001600160a01b031690836128b2565b50565b609e546001600160a01b031681565b6034546001600160a01b031690565b6000611b8b6121db565b9050806001600160a01b0316611b9f6113c1565b6001600160a01b03161480611bc15750609e546001600160a01b038281169116145b611bfc5760405162461bcd60e51b8152600401808060200182810382526026815260200180612ef96026913960400191505060405180910390fd5b609c8290556040805183815290517f6e4bcc82cb4b918df6b911c8092c49f027b7d409733e2c97bb0a4b5a367e19db9181900360200190a15050565b6000611c426121db565b9050806001600160a01b0316611c566113c1565b6001600160a01b03161480611c785750609e546001600160a01b038281169116145b611cb35760405162461bcd60e51b8152600401808060200182810382526026815260200180612ef96026913960400191505060405180910390fd5b60975460ff861610611d00576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e8f2e0ca92dcc8caf607b1b604482015290519081900360640190fd5b6113888210611d4d576040805162461bcd60e51b8152602060048201526014602482015273546f6f206c61726765207265776172645261746560601b604482015290519081900360640190fd5b600060978660ff1681548110611d5f57fe5b600091825260209182902060039190910201805460ff19168715151762ffff00191661010061ffff888116820292909217808455600184018890556040805160ff8d8116825283161515968101969096529190049091168382015260608301869052519092507f72a38eea1f38f2d28e765e3ec3da350219bbac1187a20efd23795391d910bfdf916080908290030190a1505050505050565b609c5481565b60026065541415611e56576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026065556000611e656121db565b90506000611e71611503565b905080600010611eb9576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e4818db1bdcd95960921b604482015290519081900360640190fd5b611ec282610eb9565b15611f05576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481cdd185ad95960921b604482015290519081900360640190fd5b83609c541115611f5c576040805162461bcd60e51b815260206004820152601f60248201527f546865207374616b696e6720616d6f756e7420697320746f6f20736d616c6c00604482015290519081900360640190fd5b80841115611fb1576040805162461bcd60e51b815260206004820152601860248201527f45786365656420746865207374616b696e67206c696d69740000000000000000604482015290519081900360640190fd5b60975460ff841610611ffe576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e8f2e0ca92dcc8caf607b1b604482015290519081900360640190fd5b60978360ff168154811061200e57fe5b600091825260209091206003909102015460ff16612067576040805162461bcd60e51b8152602060048201526011602482015270151a19481d1e5c1948191a5cd8589b1959607a1b604482015290519081900360640190fd5b609d546120849061010090046001600160a01b031683308761245c565b6040805160c081018252600180825260ff868116602080850191825242858701908152600060608701818152608088018d815260a089018381526001600160a01b038d16845260989095529890912096518754945160ff199095169015151761ff0019166101009490951693909302939093178555915192840192909255905160028301559151600382015590516004909101556099546121259085612623565b60998190555061215f8460978560ff168154811061213f57fe5b90600052602060002090600302016002015461262390919063ffffffff16565b60978460ff168154811061216f57fe5b906000526020600020906003020160020181905550816001600160a01b03167f8acf475137e0cd74ca7f611d16b1e6383ec9a9c71a8e5b85967781b9c7214d118585604051808381526020018260ff1681526020019250505060405180910390a2505060016065555050565b3390565b805182511480156121f1575082518251145b612234576040805162461bcd60e51b815260206004820152600f60248201526e4d69736d617463686564206461746160881b604482015290519081900360640190fd5b815160975460ff9101111561227b576040805162461bcd60e51b81526020600482015260086024820152670a8dede40daeac6d60c31b604482015290519081900360640190fd5b60005b82518110156124565760026127100482828151811061229957fe5b6020026020010151106122ea576040805162461bcd60e51b8152602060048201526014602482015273546f6f206c61726765207265776172645261746560601b604482015290519081900360640190fd5b6000604051806080016040528086848151811061230357fe5b60200260200101511515815260200185848151811061231e57fe5b602002602001015161ffff16815260200184848151811061233b57fe5b6020908102919091018101518252600091810182905260978054600181018255925282517f354a83ed9988f79f6038d4c7a7dadbad8af32f4ad6df893e0e5807a1b1944ff9600390930292830180548584015160ff1990911692151592831762ffff00191661010061ffff909216918202179091556040808601517f354a83ed9988f79f6038d4c7a7dadbad8af32f4ad6df893e0e5807a1b1944ffa86018190556060808801517f354a83ed9988f79f6038d4c7a7dadbad8af32f4ad6df893e0e5807a1b1944ffb909701969096558151938452938301919091528181019290925290519293507f78d782a4d9e33a46c20a0def9e9253843ce1b0434604e52b451eaa17245c3685929081900390910190a15060010161227e565b50505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612456908590612900565b60006124c1306129b1565b15905090565b600054610100900460ff16806124e057506124e06124b6565b806124ee575060005460ff16155b6125295760405162461bcd60e51b815260040180806020018281038252602e815260200180612f51602e913960400191505060405180910390fd5b600054610100900460ff16158015612554576000805460ff1961ff0019909116610100171660011790555b61255c6129b7565b61256582612a57565b8015610e05576000805461ff00191690555050565b600054610100900460ff168061259357506125936124b6565b806125a1575060005460ff16155b6125dc5760405162461bcd60e51b815260040180806020018281038252602e815260200180612f51602e913960400191505060405180910390fd5b600054610100900460ff16158015612607576000805460ff1961ff0019909116610100171660011790555b61260f612b30565b8015611b60576000805461ff001916905550565b60008282018381101561267d576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6000828211156126db576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60a054600010612726576040805162461bcd60e51b815260206004820152600b60248201526a109b1858dadb1a5cdd195960aa1b604482015290519081900360640190fd5b600061274160a054420360a154612bd690919063ffffffff16565b6001600160a01b0383166000908152609860205260409020600301549091508082101561278f576001600160a01b0383166000908152609860205260409020600301805483900390556127b2565b6001600160a01b0383166000908152609860205260409020426002909101559050805b4260a055811561109957609d546110999061010090046001600160a01b031684846128b2565b60008060978360ff16815481106127eb57fe5b600091825260209091206003909102015460ff1661280e575060009050806128aa565b600060978460ff168154811061282057fe5b906000526020600020906003020160000160019054906101000a900461ffff1661ffff16620151800262ffffff1686019050804210612860576000612864565b4281035b92506128a66127106128a060978760ff168154811061287f57fe5b90600052602060002090600302016001015488612bd690919063ffffffff16565b90612c2f565b9150505b935093915050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526110999084905b6000612955826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612c969092919063ffffffff16565b8051909150156110995780806020019051602081101561297457600080fd5b50516110995760405162461bcd60e51b815260040180806020018281038252602a815260200180612fe0602a913960400191505060405180910390fd5b3b151590565b600054610100900460ff16806129d057506129d06124b6565b806129de575060005460ff16155b612a195760405162461bcd60e51b815260040180806020018281038252602e815260200180612f51602e913960400191505060405180910390fd5b600054610100900460ff1615801561260f576000805460ff1961ff0019909116610100171660011790558015611b60576000805461ff001916905550565b600054610100900460ff1680612a705750612a706124b6565b80612a7e575060005460ff16155b612ab95760405162461bcd60e51b815260040180806020018281038252602e815260200180612f51602e913960400191505060405180910390fd5b600054610100900460ff16158015612ae4576000805460ff1961ff0019909116610100171660011790555b603380546001600160a01b0319166001600160a01b038416908117909155604051600090600080516020612fc0833981519152908290a38015610e05576000805461ff00191690555050565b600054610100900460ff1680612b495750612b496124b6565b80612b57575060005460ff16155b612b925760405162461bcd60e51b815260040180806020018281038252602e815260200180612f51602e913960400191505060405180910390fd5b600054610100900460ff16158015612bbd576000805460ff1961ff0019909116610100171660011790555b60016065558015611b60576000805461ff001916905550565b600082612be557506000610f08565b82820282848281612bf257fe5b041461267d5760405162461bcd60e51b8152600401808060200182810382526021815260200180612f7f6021913960400191505060405180910390fd5b6000808211612c85576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381612c8e57fe5b049392505050565b6060612ca58484600085612cad565b949350505050565b606082471015612cee5760405162461bcd60e51b8152600401808060200182810382526026815260200180612ed36026913960400191505060405180910390fd5b612cf7856129b1565b612d48576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310612d865780518252601f199092019160209182019101612d67565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612de8576040519150601f19603f3d011682016040523d82523d6000602084013e612ded565b606091505b5091509150612dfd828286612e08565b979650505050505050565b60608315612e1757508161267d565b825115612e275782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612e71578181015183820152602001612e59565b50505050905090810190601f168015612e9e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5468652063616c6c65722073686f756c64206265206f776e6572206f7220676f7665726e6f726163636570744f776e6572736869703a2043616c6c206d75737420636f6d652066726f6d2070656e64696e674f776e65722e496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220a4f8c66c38a4ac533bd3b68c73d1811bf7079bf9ae053745cde6c90bec0bf52e64736f6c63430007060033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.