Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 14366889 | 934 days ago | IN | 0 ETH | 0.15068351 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
SingleAssetStaking
Compiler Version
v0.8.7+commit.e28d00a7
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: agpl-3.0 pragma solidity ^0.8.0; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { Initializable } from "../utils/Initializable.sol"; import { Governable } from "../governance/Governable.sol"; import { StableMath } from "../utils/StableMath.sol"; contract SingleAssetStaking is Initializable, Governable { using SafeMath for uint256; using StableMath for uint256; using SafeERC20 for IERC20; /* ========== STATE VARIABLES ========== */ IERC20 public stakingToken; // this is both the staking and rewards struct Stake { uint256 amount; // amount to stake uint256 end; // when does the staking period end uint256 duration; // the duration of the stake uint240 rate; // rate to charge use 248 to reserve 8 bits for the bool bool paid; uint8 stakeType; } struct DropRoot { bytes32 hash; uint256 depth; } uint256[] public durations; // allowed durations uint256[] public rates; // rates that correspond with the allowed durations uint256 public totalOutstanding; bool public paused; mapping(address => Stake[]) public userStakes; mapping(uint8 => DropRoot) public dropRoots; // type 0 is reserved for stakes done by the user, all other types will be drop/preApproved stakes uint8 constant USER_STAKE_TYPE = 0; uint256 constant MAX_STAKES = 256; address public transferAgent; /* ========== Initialize ========== */ /** * @dev Initialize the contracts, sets up durations, rates, and preApprover * for preApproved contracts can only be called once * @param _stakingToken Address of the token that we are staking * @param _durations Array of allowed durations in seconds * @param _rates Array of rates(0.3 is 30%) that correspond to the allowed * durations in 1e18 precision */ function initialize( address _stakingToken, uint256[] calldata _durations, uint256[] calldata _rates ) external onlyGovernor initializer { stakingToken = IERC20(_stakingToken); _setDurationRates(_durations, _rates); } /* ========= Internal helper functions ======== */ /** * @dev Validate and set the duration and corresponding rates, will emit * events NewRate and NewDurations */ function _setDurationRates( uint256[] memory _durations, uint256[] memory _rates ) internal { require( _rates.length == _durations.length, "Mismatch durations and rates" ); for (uint256 i = 0; i < _rates.length; i++) { require(_rates[i] < type(uint240).max, "Max rate exceeded"); } rates = _rates; durations = _durations; emit NewRates(msg.sender, rates); emit NewDurations(msg.sender, durations); } function _totalExpectedRewards(Stake[] storage stakes) internal view returns (uint256 total) { for (uint256 i = 0; i < stakes.length; i++) { Stake storage stake = stakes[i]; if (!stake.paid) { total = total.add(stake.amount.mulTruncate(stake.rate)); } } } function _totalExpected(Stake storage _stake) internal view returns (uint256) { return _stake.amount.add(_stake.amount.mulTruncate(_stake.rate)); } function _airDroppedStakeClaimed(address account, uint8 stakeType) internal view returns (bool) { Stake[] storage stakes = userStakes[account]; for (uint256 i = 0; i < stakes.length; i++) { if (stakes[i].stakeType == stakeType) { return true; } } return false; } function _findDurationRate(uint256 duration) internal view returns (uint240) { for (uint256 i = 0; i < durations.length; i++) { if (duration == durations[i]) { return uint240(rates[i]); } } return 0; } /** * @dev Internal staking function * will insert the stake into the stakes array and verify we have * enough to pay off stake + reward * @param staker Address of the staker * @param stakeType Number that represent the type of the stake, 0 is user * initiated all else is currently preApproved * @param duration Number of seconds this stake will be held for * @param rate Rate(0.3 is 30%) of reward for this stake in 1e18, uint240 = * to fit the bool and type in struct Stake * @param amount Number of tokens to stake in 1e18 */ function _stake( address staker, uint8 stakeType, uint256 duration, uint240 rate, uint256 amount ) internal { require(!paused, "Staking paused"); Stake[] storage stakes = userStakes[staker]; uint256 end = block.timestamp.add(duration); uint256 i = stakes.length; // start at the end of the current array require(i < MAX_STAKES, "Max stakes"); stakes.push(); // grow the array // find the spot where we can insert the current stake // this should make an increasing list sorted by end while (i != 0 && stakes[i - 1].end > end) { // shift it back one stakes[i] = stakes[i - 1]; i -= 1; } // insert the stake Stake storage newStake = stakes[i]; newStake.rate = rate; newStake.stakeType = stakeType; newStake.end = end; newStake.duration = duration; newStake.amount = amount; totalOutstanding = totalOutstanding.add(_totalExpected(newStake)); emit Staked(staker, amount, duration, rate); } function _stakeWithChecks( address staker, uint256 amount, uint256 duration ) internal { require(amount > 0, "Cannot stake 0"); uint240 rewardRate = _findDurationRate(duration); require(rewardRate > 0, "Invalid duration"); // we couldn't find the rate that correspond to the passed duration _stake(staker, USER_STAKE_TYPE, duration, rewardRate, amount); // transfer in the token so that we can stake the correct amount stakingToken.safeTransferFrom(staker, address(this), amount); } modifier requireLiquidity() { // we need to have enough balance to cover the rewards after the operation is complete _; require( stakingToken.balanceOf(address(this)) >= totalOutstanding, "Insufficient rewards" ); } /* ========== VIEWS ========== */ function getAllDurations() external view returns (uint256[] memory) { return durations; } function getAllRates() external view returns (uint256[] memory) { return rates; } /** * @dev Return all the stakes paid and unpaid for a given user * @param account Address of the account that we want to look up */ function getAllStakes(address account) external view returns (Stake[] memory) { return userStakes[account]; } /** * @dev Find the rate that corresponds to a given duration * @param _duration Number of seconds */ function durationRewardRate(uint256 _duration) external view returns (uint256) { return _findDurationRate(_duration); } /** * @dev Has the airdropped stake already been claimed */ function airDroppedStakeClaimed(address account, uint8 stakeType) external view returns (bool) { return _airDroppedStakeClaimed(account, stakeType); } /** * @dev Calculate all the staked value a user has put into the contract, * rewards not included * @param account Address of the account that we want to look up */ function totalStaked(address account) external view returns (uint256 total) { Stake[] storage stakes = userStakes[account]; for (uint256 i = 0; i < stakes.length; i++) { if (!stakes[i].paid) { total = total.add(stakes[i].amount); } } } /** * @dev Calculate all the rewards a user can expect to receive. * @param account Address of the account that we want to look up */ function totalExpectedRewards(address account) external view returns (uint256) { return _totalExpectedRewards(userStakes[account]); } /** * @dev Calculate all current holdings of a user: staked value + prorated rewards * @param account Address of the account that we want to look up */ function totalCurrentHoldings(address account) external view returns (uint256 total) { Stake[] storage stakes = userStakes[account]; for (uint256 i = 0; i < stakes.length; i++) { Stake storage stake = stakes[i]; if (stake.paid) { continue; } else if (stake.end < block.timestamp) { total = total.add(_totalExpected(stake)); } else { //calcualte the precentage accrued in term of rewards total = total.add( stake.amount.add( stake.amount.mulTruncate(stake.rate).mulTruncate( stake .duration .sub(stake.end.sub(block.timestamp)) .divPrecisely(stake.duration) ) ) ); } } } /* ========== MUTATIVE FUNCTIONS ========== */ /** * @dev Make a preapproved stake for the user, this is a presigned voucher that the user can redeem either from * an airdrop or a compensation program. * Only 1 of each type is allowed per user. The proof must match the root hash * @param index Number that is zero base index of the stake in the payout entry * @param stakeType Number that represent the type of the stake, must not be 0 which is user stake * @param duration Number of seconds this stake will be held for * @param rate Rate(0.3 is 30%) of reward for this stake in 1e18, uint240 to fit the bool and type in struct Stake * @param amount Number of tokens to stake in 1e18 * @param merkleProof Array of proofs for that amount */ function airDroppedStake( uint256 index, uint8 stakeType, uint256 duration, uint256 rate, uint256 amount, bytes32[] calldata merkleProof ) external requireLiquidity { require(stakeType != USER_STAKE_TYPE, "Cannot be normal staking"); require(rate < type(uint240).max, "Max rate exceeded"); require(index < 2**merkleProof.length, "Invalid index"); DropRoot storage dropRoot = dropRoots[stakeType]; require(merkleProof.length == dropRoot.depth, "Invalid proof"); // Compute the merkle root bytes32 node = keccak256( abi.encodePacked( index, stakeType, address(this), msg.sender, duration, rate, amount ) ); uint256 path = index; for (uint16 i = 0; i < merkleProof.length; i++) { if ((path & 0x01) == 1) { node = keccak256(abi.encodePacked(merkleProof[i], node)); } else { node = keccak256(abi.encodePacked(node, merkleProof[i])); } path /= 2; } // Check the merkle proof require(node == dropRoot.hash, "Stake not approved"); // verify that we haven't already staked require( !_airDroppedStakeClaimed(msg.sender, stakeType), "Already staked" ); _stake(msg.sender, stakeType, duration, uint240(rate), amount); } /** * @dev Stake an approved amount of staking token into the contract. * User must have already approved the contract for specified amount. * @param amount Number of tokens to stake in 1e18 * @param duration Number of seconds this stake will be held for */ function stake(uint256 amount, uint256 duration) external requireLiquidity { // no checks are performed in this function since those are already present in _stakeWithChecks _stakeWithChecks(msg.sender, amount, duration); } /** * @dev Stake an approved amount of staking token into the contract. This function * can only be called by OGN token contract. * @param staker Address of the account that is creating the stake * @param amount Number of tokens to stake in 1e18 * @param duration Number of seconds this stake will be held for */ function stakeWithSender( address staker, uint256 amount, uint256 duration ) external requireLiquidity returns (bool) { require( msg.sender == address(stakingToken), "Only token contract can make this call" ); _stakeWithChecks(staker, amount, duration); return true; } /** * @dev Exit out of all possible stakes */ function exit() external requireLiquidity { Stake[] storage stakes = userStakes[msg.sender]; require(stakes.length > 0, "Nothing staked"); uint256 totalWithdraw = 0; uint256 stakedAmount = 0; uint256 l = stakes.length; do { Stake storage exitStake = stakes[l - 1]; // stop on the first ended stake that's already been paid if (exitStake.end < block.timestamp && exitStake.paid) { break; } //might not be ended if (exitStake.end < block.timestamp) { //we are paying out the stake exitStake.paid = true; totalWithdraw = totalWithdraw.add(_totalExpected(exitStake)); stakedAmount = stakedAmount.add(exitStake.amount); } l--; } while (l > 0); require(totalWithdraw > 0, "All stakes in lock-up"); totalOutstanding = totalOutstanding.sub(totalWithdraw); emit Withdrawn(msg.sender, totalWithdraw, stakedAmount); stakingToken.safeTransfer(msg.sender, totalWithdraw); } /** * @dev Use to transfer all the stakes of an account in the case that the account is compromised * Requires access to both the account itself and the transfer agent * @param _frmAccount the address to transfer from * @param _dstAccount the address to transfer to(must be a clean address with no stakes) * @param r r portion of the signature by the transfer agent * @param s s portion of the signature * @param v v portion of the signature */ function transferStakes( address _frmAccount, address _dstAccount, bytes32 r, bytes32 s, uint8 v ) external { require(transferAgent == msg.sender, "must be transfer agent"); Stake[] storage dstStakes = userStakes[_dstAccount]; require(dstStakes.length == 0, "Dest stakes must be empty"); require(_frmAccount != address(0), "from account not set"); Stake[] storage stakes = userStakes[_frmAccount]; require(stakes.length > 0, "Nothing to transfer"); // matches ethers.signMsg(ethers.utils.solidityPack([string(4), address, adddress, address])) bytes32 hash = keccak256( abi.encodePacked( "\x19Ethereum Signed Message:\n64", abi.encodePacked( "tran", address(this), _frmAccount, _dstAccount ) ) ); require(ecrecover(hash, v, r, s) == _frmAccount, "Transfer not authed"); // copy the stakes into the dstAccount array and delete the old one userStakes[_dstAccount] = stakes; delete userStakes[_frmAccount]; emit StakesTransfered(_frmAccount, _dstAccount, stakes.length); } /* ========== MODIFIERS ========== */ function setPaused(bool _paused) external onlyGovernor { paused = _paused; emit Paused(msg.sender, paused); } /** * @dev Set new durations and rates will not effect existing stakes * @param _durations Array of durations in seconds * @param _rates Array of rates that corresponds to the durations (0.01 is 1%) in 1e18 */ function setDurationRates( uint256[] calldata _durations, uint256[] calldata _rates ) external onlyGovernor { _setDurationRates(_durations, _rates); } /** * @dev Set the agent that will authorize transfers * @param _agent Address of agent */ function setTransferAgent(address _agent) external onlyGovernor { transferAgent = _agent; } /** * @dev Set air drop root for a specific stake type * @param _stakeType Type of staking must be greater than 0 * @param _rootHash Root hash of the Merkle Tree * @param _proofDepth Depth of the Merklke Tree */ function setAirDropRoot( uint8 _stakeType, bytes32 _rootHash, uint256 _proofDepth ) external onlyGovernor { require(_stakeType != USER_STAKE_TYPE, "Cannot be normal staking"); dropRoots[_stakeType].hash = _rootHash; dropRoots[_stakeType].depth = _proofDepth; emit NewAirDropRootHash(_stakeType, _rootHash, _proofDepth); } /* ========== EVENTS ========== */ event Staked( address indexed user, uint256 amount, uint256 duration, uint256 rate ); event Withdrawn(address indexed user, uint256 amount, uint256 stakedAmount); event Paused(address indexed user, bool yes); event NewDurations(address indexed user, uint256[] durations); event NewRates(address indexed user, uint256[] rates); event NewAirDropRootHash( uint8 stakeType, bytes32 rootHash, uint256 proofDepth ); event StakesTransfered( address indexed fromUser, address toUser, uint256 numStakes ); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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 // OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.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 SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 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( IERC20 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' 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( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _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(IERC20 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 require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: agpl-3.0 pragma solidity ^0.8.0; abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require( initializing || !initialized, "Initializable: contract is already initialized" ); bool isTopLevelCall = !initializing; if (isTopLevelCall) { initializing = true; initialized = true; } _; if (isTopLevelCall) { initializing = false; } } uint256[50] private ______gap; }
// SPDX-License-Identifier: agpl-3.0 pragma solidity ^0.8.0; /** * @title OUSD Governable Contract * @dev Copy of the openzeppelin Ownable.sol contract with nomenclature change * from owner to governor and renounce methods removed. Does not use * Context.sol like Ownable.sol does for simplification. * @author Origin Protocol Inc */ contract Governable { // Storage position of the owner and pendingOwner of the contract // keccak256("OUSD.governor"); bytes32 private constant governorPosition = 0x7bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4a; // keccak256("OUSD.pending.governor"); bytes32 private constant pendingGovernorPosition = 0x44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db; // keccak256("OUSD.reentry.status"); bytes32 private constant reentryStatusPosition = 0x53bf423e48ed90e97d02ab0ebab13b2a235a6bfbe9c321847d5c175333ac4535; // See OpenZeppelin ReentrancyGuard implementation uint256 constant _NOT_ENTERED = 1; uint256 constant _ENTERED = 2; event PendingGovernorshipTransfer( address indexed previousGovernor, address indexed newGovernor ); event GovernorshipTransferred( address indexed previousGovernor, address indexed newGovernor ); /** * @dev Initializes the contract setting the deployer as the initial Governor. */ constructor() { _setGovernor(msg.sender); emit GovernorshipTransferred(address(0), _governor()); } /** * @dev Returns the address of the current Governor. */ function governor() public view returns (address) { return _governor(); } /** * @dev Returns the address of the current Governor. */ function _governor() internal view returns (address governorOut) { bytes32 position = governorPosition; assembly { governorOut := sload(position) } } /** * @dev Returns the address of the pending Governor. */ function _pendingGovernor() internal view returns (address pendingGovernor) { bytes32 position = pendingGovernorPosition; assembly { pendingGovernor := sload(position) } } /** * @dev Throws if called by any account other than the Governor. */ modifier onlyGovernor() { require(isGovernor(), "Caller is not the Governor"); _; } /** * @dev Returns true if the caller is the current Governor. */ function isGovernor() public view returns (bool) { return msg.sender == _governor(); } function _setGovernor(address newGovernor) internal { bytes32 position = governorPosition; assembly { sstore(position, newGovernor) } } /** * @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() { bytes32 position = reentryStatusPosition; uint256 _reentry_status; assembly { _reentry_status := sload(position) } // On the first call to nonReentrant, _notEntered will be true require(_reentry_status != _ENTERED, "Reentrant call"); // Any calls to nonReentrant after this point will fail assembly { sstore(position, _ENTERED) } _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) assembly { sstore(position, _NOT_ENTERED) } } function _setPendingGovernor(address newGovernor) internal { bytes32 position = pendingGovernorPosition; assembly { sstore(position, newGovernor) } } /** * @dev Transfers Governance of the contract to a new account (`newGovernor`). * Can only be called by the current Governor. Must be claimed for this to complete * @param _newGovernor Address of the new Governor */ function transferGovernance(address _newGovernor) external onlyGovernor { _setPendingGovernor(_newGovernor); emit PendingGovernorshipTransfer(_governor(), _newGovernor); } /** * @dev Claim Governance of the contract to a new account (`newGovernor`). * Can only be called by the new Governor. */ function claimGovernance() external { require( msg.sender == _pendingGovernor(), "Only the pending Governor can complete the claim" ); _changeGovernor(msg.sender); } /** * @dev Change Governance of the contract to a new account (`newGovernor`). * @param _newGovernor Address of the new Governor */ function _changeGovernor(address _newGovernor) internal { require(_newGovernor != address(0), "New Governor is address(0)"); emit GovernorshipTransferred(_governor(), _newGovernor); _setGovernor(_newGovernor); } }
// SPDX-License-Identifier: agpl-3.0 pragma solidity ^0.8.0; import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol"; // Based on StableMath from Stability Labs Pty. Ltd. // https://github.com/mstable/mStable-contracts/blob/master/contracts/shared/StableMath.sol library StableMath { using SafeMath for uint256; /** * @dev Scaling unit for use in specific calculations, * where 1 * 10**18, or 1e18 represents a unit '1' */ uint256 private constant FULL_SCALE = 1e18; /*************************************** Helpers ****************************************/ /** * @dev Adjust the scale of an integer * @param to Decimals to scale to * @param from Decimals to scale from */ function scaleBy( uint256 x, uint256 to, uint256 from ) internal pure returns (uint256) { if (to > from) { x = x.mul(10**(to - from)); } else if (to < from) { x = x.div(10**(from - to)); } return x; } /*************************************** Precise Arithmetic ****************************************/ /** * @dev Multiplies two precise units, and then truncates by the full scale * @param x Left hand input to multiplication * @param y Right hand input to multiplication * @return Result after multiplying the two inputs and then dividing by the shared * scale unit */ function mulTruncate(uint256 x, uint256 y) internal pure returns (uint256) { return mulTruncateScale(x, y, FULL_SCALE); } /** * @dev Multiplies two precise units, and then truncates by the given scale. For example, * when calculating 90% of 10e18, (10e18 * 9e17) / 1e18 = (9e36) / 1e18 = 9e18 * @param x Left hand input to multiplication * @param y Right hand input to multiplication * @param scale Scale unit * @return Result after multiplying the two inputs and then dividing by the shared * scale unit */ function mulTruncateScale( uint256 x, uint256 y, uint256 scale ) internal pure returns (uint256) { // e.g. assume scale = fullScale // z = 10e18 * 9e17 = 9e36 uint256 z = x.mul(y); // return 9e36 / 1e18 = 9e18 return z.div(scale); } /** * @dev Multiplies two precise units, and then truncates by the full scale, rounding up the result * @param x Left hand input to multiplication * @param y Right hand input to multiplication * @return Result after multiplying the two inputs and then dividing by the shared * scale unit, rounded up to the closest base unit. */ function mulTruncateCeil(uint256 x, uint256 y) internal pure returns (uint256) { // e.g. 8e17 * 17268172638 = 138145381104e17 uint256 scaled = x.mul(y); // e.g. 138145381104e17 + 9.99...e17 = 138145381113.99...e17 uint256 ceil = scaled.add(FULL_SCALE.sub(1)); // e.g. 13814538111.399...e18 / 1e18 = 13814538111 return ceil.div(FULL_SCALE); } /** * @dev Precisely divides two units, by first scaling the left hand operand. Useful * for finding percentage weightings, i.e. 8e18/10e18 = 80% (or 8e17) * @param x Left hand input to division * @param y Right hand input to division * @return Result after multiplying the left operand by the scale, and * executing the division on the right hand input. */ function divPrecisely(uint256 x, uint256 y) internal pure returns (uint256) { // e.g. 8e18 * 1e18 = 8e36 uint256 z = x.mul(FULL_SCALE); // e.g. 8e36 / 10e18 = 8e17 return z.div(y); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^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; 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"); (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"); (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"); (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"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
{ "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":true,"internalType":"address","name":"previousGovernor","type":"address"},{"indexed":true,"internalType":"address","name":"newGovernor","type":"address"}],"name":"GovernorshipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"stakeType","type":"uint8"},{"indexed":false,"internalType":"bytes32","name":"rootHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"proofDepth","type":"uint256"}],"name":"NewAirDropRootHash","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"durations","type":"uint256[]"}],"name":"NewDurations","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"rates","type":"uint256[]"}],"name":"NewRates","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"bool","name":"yes","type":"bool"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousGovernor","type":"address"},{"indexed":true,"internalType":"address","name":"newGovernor","type":"address"}],"name":"PendingGovernorshipTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"fromUser","type":"address"},{"indexed":false,"internalType":"address","name":"toUser","type":"address"},{"indexed":false,"internalType":"uint256","name":"numStakes","type":"uint256"}],"name":"StakesTransfered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stakedAmount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint8","name":"stakeType","type":"uint8"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"airDroppedStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint8","name":"stakeType","type":"uint8"}],"name":"airDroppedStakeClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"}],"name":"dropRoots","outputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"uint256","name":"depth","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"durationRewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"durations","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"exit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAllDurations","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllRates","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAllStakes","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint240","name":"rate","type":"uint240"},{"internalType":"bool","name":"paid","type":"bool"},{"internalType":"uint8","name":"stakeType","type":"uint8"}],"internalType":"struct SingleAssetStaking.Stake[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_stakingToken","type":"address"},{"internalType":"uint256[]","name":"_durations","type":"uint256[]"},{"internalType":"uint256[]","name":"_rates","type":"uint256[]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isGovernor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rates","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"_stakeType","type":"uint8"},{"internalType":"bytes32","name":"_rootHash","type":"bytes32"},{"internalType":"uint256","name":"_proofDepth","type":"uint256"}],"name":"setAirDropRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_durations","type":"uint256[]"},{"internalType":"uint256[]","name":"_rates","type":"uint256[]"}],"name":"setDurationRates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_agent","type":"address"}],"name":"setTransferAgent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"stakeWithSender","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"totalCurrentHoldings","outputs":[{"internalType":"uint256","name":"total","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"totalExpectedRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalOutstanding","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"totalStaked","outputs":[{"internalType":"uint256","name":"total","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transferAgent","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newGovernor","type":"address"}],"name":"transferGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_frmAccount","type":"address"},{"internalType":"address","name":"_dstAccount","type":"address"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"}],"name":"transferStakes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userStakes","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint240","name":"rate","type":"uint240"},{"internalType":"bool","name":"paid","type":"bool"},{"internalType":"uint8","name":"stakeType","type":"uint8"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b506100283360008051602062002d1d83398151915255565b60008051602062002d1d833981519152546040516001600160a01b03909116906000907fc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a908290a3612c9d80620000806000396000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c806382d7811111610104578063c7af3352116100a2578063e9e518a011610071578063e9e518a014610450578063e9fad8ee14610463578063ea1d81cb1461046b578063ff5a20bf1461047e57600080fd5b8063c7af3352146103e6578063d38bfff4146103ee578063dd418ae214610401578063df962bd61461041457600080fd5b8063a5149d54116100de578063a5149d541461035d578063b5d5b5fa14610370578063bc20a7af146103be578063bc2ee5a6146103d157600080fd5b806382d78111146103245780638c6a244c146103375780639bfd8d611461034a57600080fd5b80635c975abb1161017c57806372f702f31161014b57806372f702f3146102d8578063760cd8e1146102eb5780637b0472f0146102fe578063825e0e801461031157600080fd5b80635c975abb1461028d5780635d36b190146102aa5780635e99cbe9146102b25780636f1eb944146102c557600080fd5b806316c38b3c116101b857806316c38b3c1461023f578063334e7ed214610254578063389b21ce146102675780634f2b529d1461027a57600080fd5b806304238994146101df5780630c340a241461020857806316078d0414610228575b600080fd5b6101f26101ed366004612503565b610486565b6040516101ff9190612895565b60405180910390f35b610210610547565b6040516001600160a01b0390911681526020016101ff565b61023160365481565b6040519081526020016101ff565b61025261024d3660046126f2565b610564565b005b610252610262366004612686565b6105e0565b610252610275366004612816565b610677565b610252610288366004612780565b610746565b60375461029a9060ff1681565b60405190151581526020016101ff565b610252610b0d565b61029a6102c0366004612620565b610bb3565b6102526102d336600461251e565b610cd0565b603354610210906001600160a01b031681565b603a54610210906001600160a01b031681565b61025261030c36600461275e565b610ff8565b61023161031f36600461272c565b6110a3565b610231610332366004612503565b6110bd565b610252610345366004612503565b6111c8565b610231610358366004612503565b61120e565b61029a61036b366004612653565b6112a8565b61038361037e3660046125f6565b6112bd565b604080519687526020870195909552938501929092526001600160f01b031660608401521515608083015260ff1660a082015260c0016101ff565b6102316103cc36600461272c565b611322565b6103d9611343565b6040516101ff919061291b565b61029a61139b565b6102526103fc366004612503565b6113cc565b61023161040f36600461272c565b611470565b61043b6104223660046127fb565b6039602052600090815260409020805460019091015482565b604080519283526020830191909152016101ff565b61025261045e366004612575565b611480565b6102526115e1565b610231610479366004612503565b61182f565b6103d9611850565b6001600160a01b0381166000908152603860209081526040808320805482518185028101850190935280835260609492939192909184015b8282101561053c5760008481526020908190206040805160c081018252600486029092018054835260018082015484860152600282015492840192909252600301546001600160f01b038116606084015260ff600160f01b8204811615156080850152600160f81b9091041660a083015290835290920191016104be565b505050509050919050565b600061055f600080516020612c488339815191525490565b905090565b61056c61139b565b6105915760405162461bcd60e51b8152600401610588906129cd565b60405180910390fd5b6037805460ff191682151590811790915560405160ff9091161515815233907fe8699cf681560fd07de85543bd994263f4557bdc5179dd702f256d15fd083e1d9060200160405180910390a250565b6105e861139b565b6106045760405162461bcd60e51b8152600401610588906129cd565b610671848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506040805160208088028281018201909352878252909350879250869182918501908490808284376000920191909152506118a692505050565b50505050565b61067f61139b565b61069b5760405162461bcd60e51b8152600401610588906129cd565b60ff83166106e65760405162461bcd60e51b815260206004820152601860248201527743616e6e6f74206265206e6f726d616c207374616b696e6760401b6044820152606401610588565b60ff83166000818152603960209081526040918290208581556001018490558151928352820184905281018290527f1ac9c006454d2d601a481473a37c95bf489c5923bd7c2a701757d4016a0f022d9060600160405180910390a1505050565b60ff86166107915760405162461bcd60e51b815260206004820152601860248201527743616e6e6f74206265206e6f726d616c207374616b696e6760401b6044820152606401610588565b6001600160f01b0384106107db5760405162461bcd60e51b815260206004820152601160248201527013585e081c985d1948195e18d959591959607a1b6044820152606401610588565b6107e6816002612aaf565b87106108245760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b6044820152606401610588565b60ff86166000908152603960205260409020600181015482146108795760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b210383937b7b360991b6044820152606401610588565b6040805160208082018b90526001600160f81b031960f88b901b16828401526bffffffffffffffffffffffff1930606090811b8216604185015233901b166055830152606982018990526089820188905260a98083018890528351808403909101815260c990920190925280519101208860005b61ffff81168511156109ca57816001166001141561095a5785858261ffff1681811061091b5761091b612c23565b905060200201358360405160200161093d929190918252602082015260400190565b6040516020818303038152906040528051906020012092506109ab565b8286868361ffff1681811061097157610971612c23565b90506020020135604051602001610992929190918252602082015260400190565b6040516020818303038152906040528051906020012092505b6109b6600283612a4a565b9150806109c281612bd0565b9150506108ed565b5082548214610a105760405162461bcd60e51b815260206004820152601260248201527114dd185ad9481b9bdd08185c1c1c9bdd995960721b6044820152606401610588565b610a1a338a611a2b565b15610a585760405162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481cdd185ad95960921b6044820152606401610588565b610a65338a8a8a8a611ab0565b50506036546033546040516370a0823160e01b81523060048201529192506001600160a01b0316906370a082319060240160206040518083038186803b158015610aae57600080fd5b505afa158015610ac2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae69190612745565b1015610b045760405162461bcd60e51b815260040161058890612a04565b50505050505050565b7f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db546001600160a01b0316336001600160a01b031614610ba85760405162461bcd60e51b815260206004820152603060248201527f4f6e6c79207468652070656e64696e6720476f7665726e6f722063616e20636f60448201526f6d706c6574652074686520636c61696d60801b6064820152608401610588565b610bb133611d60565b565b6033546000906001600160a01b03163314610c1f5760405162461bcd60e51b815260206004820152602660248201527f4f6e6c7920746f6b656e20636f6e74726163742063616e206d616b65207468696044820152651cc818d85b1b60d21b6064820152608401610588565b610c2a848484611e24565b506036546033546040516370a0823160e01b8152306004820152600192916001600160a01b0316906370a082319060240160206040518083038186803b158015610c7357600080fd5b505afa158015610c87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cab9190612745565b1015610cc95760405162461bcd60e51b815260040161058890612a04565b9392505050565b603a546001600160a01b03163314610d235760405162461bcd60e51b81526020600482015260166024820152751b5d5cdd081899481d1c985b9cd9995c881859d95b9d60521b6044820152606401610588565b6001600160a01b0384166000908152603860205260409020805415610d8a5760405162461bcd60e51b815260206004820152601960248201527f44657374207374616b6573206d75737420626520656d707479000000000000006044820152606401610588565b6001600160a01b038616610dd75760405162461bcd60e51b8152602060048201526014602482015273199c9bdb481858d8dbdd5b9d081b9bdd081cd95d60621b6044820152606401610588565b6001600160a01b03861660009081526038602052604090208054610e335760405162461bcd60e51b81526020600482015260136024820152722737ba3434b733903a37903a3930b739b332b960691b6044820152606401610588565b604051633a3930b760e11b602082015230606090811b6bffffffffffffffffffffffff19908116602484015289821b8116603884015288821b16604c8301526000910160408051601f1981840301815290829052610e9391602001612850565b60408051601f1981840301815282825280516020918201206000845290830180835281905260ff871691830191909152606082018890526080820187905291506001600160a01b0389169060019060a0016020604051602081039080840390855afa158015610f06573d6000803e3d6000fd5b505050602060405103516001600160a01b031614610f5c5760405162461bcd60e51b8152602060048201526013602482015272151c985b9cd9995c881b9bdd08185d5d1a1959606a1b6044820152606401610588565b6001600160a01b03871660009081526038602052604090208254610f829190849061230d565b506001600160a01b0388166000908152603860205260408120610fa4916123e4565b8154604080516001600160a01b038a811682526020820193909352918a16917fd0ceb9c39a11711e51ee4b32b97b05d660d6229ecd8be94ce934fa9e77910263910160405180910390a25050505050505050565b611003338383611e24565b6036546033546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561104957600080fd5b505afa15801561105d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110819190612745565b101561109f5760405162461bcd60e51b815260040161058890612a04565b5050565b60006110ae82611ee4565b6001600160f01b031692915050565b6001600160a01b0381166000908152603860205260408120815b81548110156111c15760008282815481106110f4576110f4612c23565b9060005260206000209060040201905080600301601e9054906101000a900460ff161561112157506111af565b42816001015410156111475761114061113982611f58565b8590611f78565b93506111ad565b6111aa6111396111a2611183846002015461117d611172428860010154611f8490919063ffffffff16565b600288015490611f84565b90611f90565b6003850154855461119c916001600160f01b0316611fb9565b90611fb9565b835490611f78565b93505b505b806111b981612bf2565b9150506110d7565b5050919050565b6111d061139b565b6111ec5760405162461bcd60e51b8152600401610588906129cd565b603a80546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0381166000908152603860205260408120815b81548110156111c15781818154811061124357611243612c23565b9060005260206000209060040201600301601e9054906101000a900460ff166112965761129382828154811061127b5761127b612c23565b60009182526020909120600490910201548490611f78565b92505b806112a081612bf2565b915050611228565b60006112b48383611a2b565b90505b92915050565b603860205281600052604060002081815481106112d957600080fd5b6000918252602090912060049091020180546001820154600283015460039093015491945092506001600160f01b0381169060ff600160f01b8204811691600160f81b90041686565b6034818154811061133257600080fd5b600091825260209091200154905081565b6060603480548060200260200160405190810160405280929190818152602001828054801561139157602002820191906000526020600020905b81548152602001906001019080831161137d575b5050505050905090565b60006113b3600080516020612c488339815191525490565b6001600160a01b0316336001600160a01b031614905090565b6113d461139b565b6113f05760405162461bcd60e51b8152600401610588906129cd565b611418817f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db55565b806001600160a01b0316611438600080516020612c488339815191525490565b6001600160a01b03167fa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d60405160405180910390a350565b6035818154811061133257600080fd5b61148861139b565b6114a45760405162461bcd60e51b8152600401610588906129cd565b600054610100900460ff16806114bd575060005460ff16155b6115205760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b600054610100900460ff16158015611542576000805461ffff19166101011790555b603380546001600160a01b0319166001600160a01b03881617905560408051602086810280830182019093528682526115c792889188918291850190849080828437600092019190915250506040805160208089028281018201909352888252909350889250879182918501908490808284376000920191909152506118a692505050565b80156115d9576000805461ff00191690555b505050505050565b336000908152603860205260409020805461162f5760405162461bcd60e51b815260206004820152600e60248201526d139bdd1a1a5b99c81cdd185ad95960921b6044820152606401610588565b805460009081905b600084611645600184612b76565b8154811061165557611655612c23565b9060005260206000209060040201905042816001015410801561168357506003810154600160f01b900460ff165b1561168e57506116e5565b42816001015410156116ce5760038101805460ff60f01b1916600160f01b1790556116bb61113982611f58565b81549094506116cb908490611f78565b92505b816116d881612bb9565b9250505060008111611637575b6000831161172d5760405162461bcd60e51b81526020600482015260156024820152740416c6c207374616b657320696e206c6f636b2d757605c1b6044820152606401610588565b60365461173a9084611f84565b603655604080518481526020810184905233917f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc6910160405180910390a260335461178f906001600160a01b03163385611fce565b50506036546033546040516370a0823160e01b81523060048201529193506001600160a01b031691506370a082319060240160206040518083038186803b1580156117d957600080fd5b505afa1580156117ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118119190612745565b1015610bb15760405162461bcd60e51b815260040161058890612a04565b6001600160a01b03811660009081526038602052604081206112b790612036565b60606035805480602002602001604051908101604052809291908181526020018280548015611391576020028201919060005260206000209081548152602001906001019080831161137d575050505050905090565b81518151146118f75760405162461bcd60e51b815260206004820152601c60248201527f4d69736d61746368206475726174696f6e7320616e64207261746573000000006044820152606401610588565b60005b815181101561197a576001600160f01b03801682828151811061191f5761191f612c23565b6020026020010151106119685760405162461bcd60e51b815260206004820152601160248201527013585e081c985d1948195e18d959591959607a1b6044820152606401610588565b8061197281612bf2565b9150506118fa565b50805161198e906035906020840190612405565b5081516119a2906034906020850190612405565b50336001600160a01b03167fa804368c7f1a6216d92d17d9753b923dfc3da14ae33d231e8d79e39202e249c360356040516119dd919061295f565b60405180910390a2336001600160a01b03167f180120279c2eb356244609197b5b64c0fbabd60f8d073b75aba771a296bb63d46034604051611a1f919061295f565b60405180910390a25050565b6001600160a01b0382166000908152603860205260408120815b8154811015611aa5578360ff16828281548110611a6457611a64612c23565b6000918252602090912060049091020160030154600160f81b900460ff161415611a93576001925050506112b7565b80611a9d81612bf2565b915050611a45565b506000949350505050565b60375460ff1615611af45760405162461bcd60e51b815260206004820152600e60248201526d14dd185ada5b99c81c185d5cd95960921b6044820152606401610588565b6001600160a01b038516600090815260386020526040812090611b174286611f78565b82549091506101008110611b5a5760405162461bcd60e51b815260206004820152600a6024820152694d6178207374616b657360b01b6044820152606401610588565b8254600101835560008390525b8015801590611ba257508183611b7e600184612b76565b81548110611b8e57611b8e612c23565b906000526020600020906004020160010154115b15611c8c5782611bb3600183612b76565b81548110611bc357611bc3612c23565b9060005260206000209060040201838281548110611be357611be3612c23565b6000918252602090912082546004909202019081556001808301548183015560028084015490830155600392830180549390920180546001600160f01b039094166001600160f01b031985168117825583546001600160f81b031990951617600160f01b9485900460ff90811615159095021780825592546001600160f81b03909316600160f81b93849004909416909202929092179055611c859082612b76565b9050611b67565b6000838281548110611ca057611ca0612c23565b600091825260209091206004909102016003810180546001600160f01b03891660ff60f01b90911617600160f81b60ff8c160217905560018101849055600281018890558581559050611cfe611cf582611f58565b60365490611f78565b60365560408051868152602081018990526001600160f01b0388168183015290516001600160a01b038b16917fb4caaf29adda3eefee3ad552a8e85058589bf834c7466cae4ee58787f70589ed919081900360600190a2505050505050505050565b6001600160a01b038116611db65760405162461bcd60e51b815260206004820152601a60248201527f4e657720476f7665726e6f7220697320616464726573732830290000000000006044820152606401610588565b806001600160a01b0316611dd6600080516020612c488339815191525490565b6001600160a01b03167fc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a60405160405180910390a3611e2181600080516020612c4883398151915255565b50565b60008211611e655760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b6044820152606401610588565b6000611e7082611ee4565b90506000816001600160f01b031611611ebe5760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b210323ab930ba34b7b760811b6044820152606401610588565b611ecc846000848487611ab0565b603354610671906001600160a01b03168530866120be565b6000805b603454811015611f4f5760348181548110611f0557611f05612c23565b9060005260206000200154831415611f3d5760358181548110611f2a57611f2a612c23565b9060005260206000200154915050919050565b80611f4781612bf2565b915050611ee8565b50600092915050565b600381015481546000916112b7916111a2916001600160f01b0316611fb9565b60006112b48284612a32565b60006112b48284612b76565b600080611fa584670de0b6b3a76400006120f6565b9050611fb18184612102565b949350505050565b60006112b48383670de0b6b3a764000061210e565b6040516001600160a01b03831660248201526044810182905261203190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612130565b505050565b6000805b82548110156120b857600083828154811061205757612057612c23565b9060005260206000209060040201905080600301601e9054906101000a900460ff166120a557600381015481546120a29161209b91906001600160f01b0316611fb9565b8490611f78565b92505b50806120b081612bf2565b91505061203a565b50919050565b6040516001600160a01b03808516602483015283166044820152606481018290526106719085906323b872dd60e01b90608401611ffa565b60006112b48284612b57565b60006112b48284612a4a565b60008061211b85856120f6565b90506121278184612102565b95945050505050565b6000612185826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122029092919063ffffffff16565b80519091501561203157808060200190518101906121a3919061270f565b6120315760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611fb1848460008585843b61225b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b600080866001600160a01b031685876040516122779190612834565b60006040518083038185875af1925050503d80600081146122b4576040519150601f19603f3d011682016040523d82523d6000602084013e6122b9565b606091505b50915091506122c98282866122d4565b979650505050505050565b606083156122e3575081610cc9565b8251156122f35782518084602001fd5b8160405162461bcd60e51b8152600401610588919061299a565b8280548282559060005260206000209060040281019282156123d45760005260206000209160040282015b828111156123d4578254825560018084015490830155600280840154908301556003808401805491840180546001600160f01b031981166001600160f01b039094169384178255825460ff600160f01b91829004811615159091026001600160f81b0319909216909417178082559154600160f81b908190049093169092026001600160f81b0390911617905560049283019290910190612338565b506123e092915061244c565b5090565b5080546000825560040290600052602060002090810190611e21919061244c565b828054828255906000526020600020908101928215612440579160200282015b82811115612440578251825591602001919060010190612425565b506123e0929150612475565b5b808211156123e05760008082556001820181905560028201819055600382015560040161244d565b5b808211156123e05760008155600101612476565b80356001600160a01b03811681146124a157600080fd5b919050565b60008083601f8401126124b857600080fd5b50813567ffffffffffffffff8111156124d057600080fd5b6020830191508360208260051b85010111156124eb57600080fd5b9250929050565b803560ff811681146124a157600080fd5b60006020828403121561251557600080fd5b6112b48261248a565b600080600080600060a0868803121561253657600080fd5b61253f8661248a565b945061254d6020870161248a565b93506040860135925060608601359150612569608087016124f2565b90509295509295909350565b60008060008060006060868803121561258d57600080fd5b6125968661248a565b9450602086013567ffffffffffffffff808211156125b357600080fd5b6125bf89838a016124a6565b909650945060408801359150808211156125d857600080fd5b506125e5888289016124a6565b969995985093965092949392505050565b6000806040838503121561260957600080fd5b6126128361248a565b946020939093013593505050565b60008060006060848603121561263557600080fd5b61263e8461248a565b95602085013595506040909401359392505050565b6000806040838503121561266657600080fd5b61266f8361248a565b915061267d602084016124f2565b90509250929050565b6000806000806040858703121561269c57600080fd5b843567ffffffffffffffff808211156126b457600080fd5b6126c0888389016124a6565b909650945060208701359150808211156126d957600080fd5b506126e6878288016124a6565b95989497509550505050565b60006020828403121561270457600080fd5b8135610cc981612c39565b60006020828403121561272157600080fd5b8151610cc981612c39565b60006020828403121561273e57600080fd5b5035919050565b60006020828403121561275757600080fd5b5051919050565b6000806040838503121561277157600080fd5b50508035926020909101359150565b600080600080600080600060c0888a03121561279b57600080fd5b873596506127ab602089016124f2565b955060408801359450606088013593506080880135925060a088013567ffffffffffffffff8111156127dc57600080fd5b6127e88a828b016124a6565b989b979a50959850939692959293505050565b60006020828403121561280d57600080fd5b6112b4826124f2565b60008060006060848603121561282b57600080fd5b61263e846124f2565b60008251612846818460208701612b8d565b9190910192915050565b7f19457468657265756d205369676e6564204d6573736167653a0a36340000000081526000825161288881601c850160208701612b8d565b91909101601c0192915050565b602080825282518282018190526000919060409081850190868401855b8281101561290e57815180518552868101518786015285810151868601526060808201516001600160f01b03169086015260808082015115159086015260a09081015160ff169085015260c090930192908501906001016128b2565b5091979650505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561295357835183529284019291840191600101612937565b50909695505050505050565b6020808252825482820181905260008481528281209092916040850190845b818110156129535783548352600193840193928501920161297e565b60208152600082518060208401526129b9816040850160208701612b8d565b601f01601f19169190910160400192915050565b6020808252601a908201527f43616c6c6572206973206e6f742074686520476f7665726e6f72000000000000604082015260600190565b602080825260149082015273496e73756666696369656e74207265776172647360601b604082015260600190565b60008219821115612a4557612a45612c0d565b500190565b600082612a6757634e487b7160e01b600052601260045260246000fd5b500490565b600181815b80851115612aa7578160001904821115612a8d57612a8d612c0d565b80851615612a9a57918102915b93841c9390800290612a71565b509250929050565b60006112b48383600082612ac5575060016112b7565b81612ad2575060006112b7565b8160018114612ae85760028114612af257612b0e565b60019150506112b7565b60ff841115612b0357612b03612c0d565b50506001821b6112b7565b5060208310610133831016604e8410600b8410161715612b31575081810a6112b7565b612b3b8383612a6c565b8060001904821115612b4f57612b4f612c0d565b029392505050565b6000816000190483118215151615612b7157612b71612c0d565b500290565b600082821015612b8857612b88612c0d565b500390565b60005b83811015612ba8578181015183820152602001612b90565b838111156106715750506000910152565b600081612bc857612bc8612c0d565b506000190190565b600061ffff80831681811415612be857612be8612c0d565b6001019392505050565b6000600019821415612c0657612c06612c0d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8015158114611e2157600080fdfe7bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4aa2646970667358221220f973be04e42ea488a9a1e252daf2648d45621b093e7eaf926e97112406534eae64736f6c634300080700337bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4a
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101da5760003560e01c806382d7811111610104578063c7af3352116100a2578063e9e518a011610071578063e9e518a014610450578063e9fad8ee14610463578063ea1d81cb1461046b578063ff5a20bf1461047e57600080fd5b8063c7af3352146103e6578063d38bfff4146103ee578063dd418ae214610401578063df962bd61461041457600080fd5b8063a5149d54116100de578063a5149d541461035d578063b5d5b5fa14610370578063bc20a7af146103be578063bc2ee5a6146103d157600080fd5b806382d78111146103245780638c6a244c146103375780639bfd8d611461034a57600080fd5b80635c975abb1161017c57806372f702f31161014b57806372f702f3146102d8578063760cd8e1146102eb5780637b0472f0146102fe578063825e0e801461031157600080fd5b80635c975abb1461028d5780635d36b190146102aa5780635e99cbe9146102b25780636f1eb944146102c557600080fd5b806316c38b3c116101b857806316c38b3c1461023f578063334e7ed214610254578063389b21ce146102675780634f2b529d1461027a57600080fd5b806304238994146101df5780630c340a241461020857806316078d0414610228575b600080fd5b6101f26101ed366004612503565b610486565b6040516101ff9190612895565b60405180910390f35b610210610547565b6040516001600160a01b0390911681526020016101ff565b61023160365481565b6040519081526020016101ff565b61025261024d3660046126f2565b610564565b005b610252610262366004612686565b6105e0565b610252610275366004612816565b610677565b610252610288366004612780565b610746565b60375461029a9060ff1681565b60405190151581526020016101ff565b610252610b0d565b61029a6102c0366004612620565b610bb3565b6102526102d336600461251e565b610cd0565b603354610210906001600160a01b031681565b603a54610210906001600160a01b031681565b61025261030c36600461275e565b610ff8565b61023161031f36600461272c565b6110a3565b610231610332366004612503565b6110bd565b610252610345366004612503565b6111c8565b610231610358366004612503565b61120e565b61029a61036b366004612653565b6112a8565b61038361037e3660046125f6565b6112bd565b604080519687526020870195909552938501929092526001600160f01b031660608401521515608083015260ff1660a082015260c0016101ff565b6102316103cc36600461272c565b611322565b6103d9611343565b6040516101ff919061291b565b61029a61139b565b6102526103fc366004612503565b6113cc565b61023161040f36600461272c565b611470565b61043b6104223660046127fb565b6039602052600090815260409020805460019091015482565b604080519283526020830191909152016101ff565b61025261045e366004612575565b611480565b6102526115e1565b610231610479366004612503565b61182f565b6103d9611850565b6001600160a01b0381166000908152603860209081526040808320805482518185028101850190935280835260609492939192909184015b8282101561053c5760008481526020908190206040805160c081018252600486029092018054835260018082015484860152600282015492840192909252600301546001600160f01b038116606084015260ff600160f01b8204811615156080850152600160f81b9091041660a083015290835290920191016104be565b505050509050919050565b600061055f600080516020612c488339815191525490565b905090565b61056c61139b565b6105915760405162461bcd60e51b8152600401610588906129cd565b60405180910390fd5b6037805460ff191682151590811790915560405160ff9091161515815233907fe8699cf681560fd07de85543bd994263f4557bdc5179dd702f256d15fd083e1d9060200160405180910390a250565b6105e861139b565b6106045760405162461bcd60e51b8152600401610588906129cd565b610671848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506040805160208088028281018201909352878252909350879250869182918501908490808284376000920191909152506118a692505050565b50505050565b61067f61139b565b61069b5760405162461bcd60e51b8152600401610588906129cd565b60ff83166106e65760405162461bcd60e51b815260206004820152601860248201527743616e6e6f74206265206e6f726d616c207374616b696e6760401b6044820152606401610588565b60ff83166000818152603960209081526040918290208581556001018490558151928352820184905281018290527f1ac9c006454d2d601a481473a37c95bf489c5923bd7c2a701757d4016a0f022d9060600160405180910390a1505050565b60ff86166107915760405162461bcd60e51b815260206004820152601860248201527743616e6e6f74206265206e6f726d616c207374616b696e6760401b6044820152606401610588565b6001600160f01b0384106107db5760405162461bcd60e51b815260206004820152601160248201527013585e081c985d1948195e18d959591959607a1b6044820152606401610588565b6107e6816002612aaf565b87106108245760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b6044820152606401610588565b60ff86166000908152603960205260409020600181015482146108795760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b210383937b7b360991b6044820152606401610588565b6040805160208082018b90526001600160f81b031960f88b901b16828401526bffffffffffffffffffffffff1930606090811b8216604185015233901b166055830152606982018990526089820188905260a98083018890528351808403909101815260c990920190925280519101208860005b61ffff81168511156109ca57816001166001141561095a5785858261ffff1681811061091b5761091b612c23565b905060200201358360405160200161093d929190918252602082015260400190565b6040516020818303038152906040528051906020012092506109ab565b8286868361ffff1681811061097157610971612c23565b90506020020135604051602001610992929190918252602082015260400190565b6040516020818303038152906040528051906020012092505b6109b6600283612a4a565b9150806109c281612bd0565b9150506108ed565b5082548214610a105760405162461bcd60e51b815260206004820152601260248201527114dd185ad9481b9bdd08185c1c1c9bdd995960721b6044820152606401610588565b610a1a338a611a2b565b15610a585760405162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481cdd185ad95960921b6044820152606401610588565b610a65338a8a8a8a611ab0565b50506036546033546040516370a0823160e01b81523060048201529192506001600160a01b0316906370a082319060240160206040518083038186803b158015610aae57600080fd5b505afa158015610ac2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae69190612745565b1015610b045760405162461bcd60e51b815260040161058890612a04565b50505050505050565b7f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db546001600160a01b0316336001600160a01b031614610ba85760405162461bcd60e51b815260206004820152603060248201527f4f6e6c79207468652070656e64696e6720476f7665726e6f722063616e20636f60448201526f6d706c6574652074686520636c61696d60801b6064820152608401610588565b610bb133611d60565b565b6033546000906001600160a01b03163314610c1f5760405162461bcd60e51b815260206004820152602660248201527f4f6e6c7920746f6b656e20636f6e74726163742063616e206d616b65207468696044820152651cc818d85b1b60d21b6064820152608401610588565b610c2a848484611e24565b506036546033546040516370a0823160e01b8152306004820152600192916001600160a01b0316906370a082319060240160206040518083038186803b158015610c7357600080fd5b505afa158015610c87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cab9190612745565b1015610cc95760405162461bcd60e51b815260040161058890612a04565b9392505050565b603a546001600160a01b03163314610d235760405162461bcd60e51b81526020600482015260166024820152751b5d5cdd081899481d1c985b9cd9995c881859d95b9d60521b6044820152606401610588565b6001600160a01b0384166000908152603860205260409020805415610d8a5760405162461bcd60e51b815260206004820152601960248201527f44657374207374616b6573206d75737420626520656d707479000000000000006044820152606401610588565b6001600160a01b038616610dd75760405162461bcd60e51b8152602060048201526014602482015273199c9bdb481858d8dbdd5b9d081b9bdd081cd95d60621b6044820152606401610588565b6001600160a01b03861660009081526038602052604090208054610e335760405162461bcd60e51b81526020600482015260136024820152722737ba3434b733903a37903a3930b739b332b960691b6044820152606401610588565b604051633a3930b760e11b602082015230606090811b6bffffffffffffffffffffffff19908116602484015289821b8116603884015288821b16604c8301526000910160408051601f1981840301815290829052610e9391602001612850565b60408051601f1981840301815282825280516020918201206000845290830180835281905260ff871691830191909152606082018890526080820187905291506001600160a01b0389169060019060a0016020604051602081039080840390855afa158015610f06573d6000803e3d6000fd5b505050602060405103516001600160a01b031614610f5c5760405162461bcd60e51b8152602060048201526013602482015272151c985b9cd9995c881b9bdd08185d5d1a1959606a1b6044820152606401610588565b6001600160a01b03871660009081526038602052604090208254610f829190849061230d565b506001600160a01b0388166000908152603860205260408120610fa4916123e4565b8154604080516001600160a01b038a811682526020820193909352918a16917fd0ceb9c39a11711e51ee4b32b97b05d660d6229ecd8be94ce934fa9e77910263910160405180910390a25050505050505050565b611003338383611e24565b6036546033546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561104957600080fd5b505afa15801561105d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110819190612745565b101561109f5760405162461bcd60e51b815260040161058890612a04565b5050565b60006110ae82611ee4565b6001600160f01b031692915050565b6001600160a01b0381166000908152603860205260408120815b81548110156111c15760008282815481106110f4576110f4612c23565b9060005260206000209060040201905080600301601e9054906101000a900460ff161561112157506111af565b42816001015410156111475761114061113982611f58565b8590611f78565b93506111ad565b6111aa6111396111a2611183846002015461117d611172428860010154611f8490919063ffffffff16565b600288015490611f84565b90611f90565b6003850154855461119c916001600160f01b0316611fb9565b90611fb9565b835490611f78565b93505b505b806111b981612bf2565b9150506110d7565b5050919050565b6111d061139b565b6111ec5760405162461bcd60e51b8152600401610588906129cd565b603a80546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0381166000908152603860205260408120815b81548110156111c15781818154811061124357611243612c23565b9060005260206000209060040201600301601e9054906101000a900460ff166112965761129382828154811061127b5761127b612c23565b60009182526020909120600490910201548490611f78565b92505b806112a081612bf2565b915050611228565b60006112b48383611a2b565b90505b92915050565b603860205281600052604060002081815481106112d957600080fd5b6000918252602090912060049091020180546001820154600283015460039093015491945092506001600160f01b0381169060ff600160f01b8204811691600160f81b90041686565b6034818154811061133257600080fd5b600091825260209091200154905081565b6060603480548060200260200160405190810160405280929190818152602001828054801561139157602002820191906000526020600020905b81548152602001906001019080831161137d575b5050505050905090565b60006113b3600080516020612c488339815191525490565b6001600160a01b0316336001600160a01b031614905090565b6113d461139b565b6113f05760405162461bcd60e51b8152600401610588906129cd565b611418817f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db55565b806001600160a01b0316611438600080516020612c488339815191525490565b6001600160a01b03167fa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d60405160405180910390a350565b6035818154811061133257600080fd5b61148861139b565b6114a45760405162461bcd60e51b8152600401610588906129cd565b600054610100900460ff16806114bd575060005460ff16155b6115205760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b600054610100900460ff16158015611542576000805461ffff19166101011790555b603380546001600160a01b0319166001600160a01b03881617905560408051602086810280830182019093528682526115c792889188918291850190849080828437600092019190915250506040805160208089028281018201909352888252909350889250879182918501908490808284376000920191909152506118a692505050565b80156115d9576000805461ff00191690555b505050505050565b336000908152603860205260409020805461162f5760405162461bcd60e51b815260206004820152600e60248201526d139bdd1a1a5b99c81cdd185ad95960921b6044820152606401610588565b805460009081905b600084611645600184612b76565b8154811061165557611655612c23565b9060005260206000209060040201905042816001015410801561168357506003810154600160f01b900460ff165b1561168e57506116e5565b42816001015410156116ce5760038101805460ff60f01b1916600160f01b1790556116bb61113982611f58565b81549094506116cb908490611f78565b92505b816116d881612bb9565b9250505060008111611637575b6000831161172d5760405162461bcd60e51b81526020600482015260156024820152740416c6c207374616b657320696e206c6f636b2d757605c1b6044820152606401610588565b60365461173a9084611f84565b603655604080518481526020810184905233917f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc6910160405180910390a260335461178f906001600160a01b03163385611fce565b50506036546033546040516370a0823160e01b81523060048201529193506001600160a01b031691506370a082319060240160206040518083038186803b1580156117d957600080fd5b505afa1580156117ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118119190612745565b1015610bb15760405162461bcd60e51b815260040161058890612a04565b6001600160a01b03811660009081526038602052604081206112b790612036565b60606035805480602002602001604051908101604052809291908181526020018280548015611391576020028201919060005260206000209081548152602001906001019080831161137d575050505050905090565b81518151146118f75760405162461bcd60e51b815260206004820152601c60248201527f4d69736d61746368206475726174696f6e7320616e64207261746573000000006044820152606401610588565b60005b815181101561197a576001600160f01b03801682828151811061191f5761191f612c23565b6020026020010151106119685760405162461bcd60e51b815260206004820152601160248201527013585e081c985d1948195e18d959591959607a1b6044820152606401610588565b8061197281612bf2565b9150506118fa565b50805161198e906035906020840190612405565b5081516119a2906034906020850190612405565b50336001600160a01b03167fa804368c7f1a6216d92d17d9753b923dfc3da14ae33d231e8d79e39202e249c360356040516119dd919061295f565b60405180910390a2336001600160a01b03167f180120279c2eb356244609197b5b64c0fbabd60f8d073b75aba771a296bb63d46034604051611a1f919061295f565b60405180910390a25050565b6001600160a01b0382166000908152603860205260408120815b8154811015611aa5578360ff16828281548110611a6457611a64612c23565b6000918252602090912060049091020160030154600160f81b900460ff161415611a93576001925050506112b7565b80611a9d81612bf2565b915050611a45565b506000949350505050565b60375460ff1615611af45760405162461bcd60e51b815260206004820152600e60248201526d14dd185ada5b99c81c185d5cd95960921b6044820152606401610588565b6001600160a01b038516600090815260386020526040812090611b174286611f78565b82549091506101008110611b5a5760405162461bcd60e51b815260206004820152600a6024820152694d6178207374616b657360b01b6044820152606401610588565b8254600101835560008390525b8015801590611ba257508183611b7e600184612b76565b81548110611b8e57611b8e612c23565b906000526020600020906004020160010154115b15611c8c5782611bb3600183612b76565b81548110611bc357611bc3612c23565b9060005260206000209060040201838281548110611be357611be3612c23565b6000918252602090912082546004909202019081556001808301548183015560028084015490830155600392830180549390920180546001600160f01b039094166001600160f01b031985168117825583546001600160f81b031990951617600160f01b9485900460ff90811615159095021780825592546001600160f81b03909316600160f81b93849004909416909202929092179055611c859082612b76565b9050611b67565b6000838281548110611ca057611ca0612c23565b600091825260209091206004909102016003810180546001600160f01b03891660ff60f01b90911617600160f81b60ff8c160217905560018101849055600281018890558581559050611cfe611cf582611f58565b60365490611f78565b60365560408051868152602081018990526001600160f01b0388168183015290516001600160a01b038b16917fb4caaf29adda3eefee3ad552a8e85058589bf834c7466cae4ee58787f70589ed919081900360600190a2505050505050505050565b6001600160a01b038116611db65760405162461bcd60e51b815260206004820152601a60248201527f4e657720476f7665726e6f7220697320616464726573732830290000000000006044820152606401610588565b806001600160a01b0316611dd6600080516020612c488339815191525490565b6001600160a01b03167fc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a60405160405180910390a3611e2181600080516020612c4883398151915255565b50565b60008211611e655760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b6044820152606401610588565b6000611e7082611ee4565b90506000816001600160f01b031611611ebe5760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b210323ab930ba34b7b760811b6044820152606401610588565b611ecc846000848487611ab0565b603354610671906001600160a01b03168530866120be565b6000805b603454811015611f4f5760348181548110611f0557611f05612c23565b9060005260206000200154831415611f3d5760358181548110611f2a57611f2a612c23565b9060005260206000200154915050919050565b80611f4781612bf2565b915050611ee8565b50600092915050565b600381015481546000916112b7916111a2916001600160f01b0316611fb9565b60006112b48284612a32565b60006112b48284612b76565b600080611fa584670de0b6b3a76400006120f6565b9050611fb18184612102565b949350505050565b60006112b48383670de0b6b3a764000061210e565b6040516001600160a01b03831660248201526044810182905261203190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612130565b505050565b6000805b82548110156120b857600083828154811061205757612057612c23565b9060005260206000209060040201905080600301601e9054906101000a900460ff166120a557600381015481546120a29161209b91906001600160f01b0316611fb9565b8490611f78565b92505b50806120b081612bf2565b91505061203a565b50919050565b6040516001600160a01b03808516602483015283166044820152606481018290526106719085906323b872dd60e01b90608401611ffa565b60006112b48284612b57565b60006112b48284612a4a565b60008061211b85856120f6565b90506121278184612102565b95945050505050565b6000612185826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122029092919063ffffffff16565b80519091501561203157808060200190518101906121a3919061270f565b6120315760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611fb1848460008585843b61225b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b600080866001600160a01b031685876040516122779190612834565b60006040518083038185875af1925050503d80600081146122b4576040519150601f19603f3d011682016040523d82523d6000602084013e6122b9565b606091505b50915091506122c98282866122d4565b979650505050505050565b606083156122e3575081610cc9565b8251156122f35782518084602001fd5b8160405162461bcd60e51b8152600401610588919061299a565b8280548282559060005260206000209060040281019282156123d45760005260206000209160040282015b828111156123d4578254825560018084015490830155600280840154908301556003808401805491840180546001600160f01b031981166001600160f01b039094169384178255825460ff600160f01b91829004811615159091026001600160f81b0319909216909417178082559154600160f81b908190049093169092026001600160f81b0390911617905560049283019290910190612338565b506123e092915061244c565b5090565b5080546000825560040290600052602060002090810190611e21919061244c565b828054828255906000526020600020908101928215612440579160200282015b82811115612440578251825591602001919060010190612425565b506123e0929150612475565b5b808211156123e05760008082556001820181905560028201819055600382015560040161244d565b5b808211156123e05760008155600101612476565b80356001600160a01b03811681146124a157600080fd5b919050565b60008083601f8401126124b857600080fd5b50813567ffffffffffffffff8111156124d057600080fd5b6020830191508360208260051b85010111156124eb57600080fd5b9250929050565b803560ff811681146124a157600080fd5b60006020828403121561251557600080fd5b6112b48261248a565b600080600080600060a0868803121561253657600080fd5b61253f8661248a565b945061254d6020870161248a565b93506040860135925060608601359150612569608087016124f2565b90509295509295909350565b60008060008060006060868803121561258d57600080fd5b6125968661248a565b9450602086013567ffffffffffffffff808211156125b357600080fd5b6125bf89838a016124a6565b909650945060408801359150808211156125d857600080fd5b506125e5888289016124a6565b969995985093965092949392505050565b6000806040838503121561260957600080fd5b6126128361248a565b946020939093013593505050565b60008060006060848603121561263557600080fd5b61263e8461248a565b95602085013595506040909401359392505050565b6000806040838503121561266657600080fd5b61266f8361248a565b915061267d602084016124f2565b90509250929050565b6000806000806040858703121561269c57600080fd5b843567ffffffffffffffff808211156126b457600080fd5b6126c0888389016124a6565b909650945060208701359150808211156126d957600080fd5b506126e6878288016124a6565b95989497509550505050565b60006020828403121561270457600080fd5b8135610cc981612c39565b60006020828403121561272157600080fd5b8151610cc981612c39565b60006020828403121561273e57600080fd5b5035919050565b60006020828403121561275757600080fd5b5051919050565b6000806040838503121561277157600080fd5b50508035926020909101359150565b600080600080600080600060c0888a03121561279b57600080fd5b873596506127ab602089016124f2565b955060408801359450606088013593506080880135925060a088013567ffffffffffffffff8111156127dc57600080fd5b6127e88a828b016124a6565b989b979a50959850939692959293505050565b60006020828403121561280d57600080fd5b6112b4826124f2565b60008060006060848603121561282b57600080fd5b61263e846124f2565b60008251612846818460208701612b8d565b9190910192915050565b7f19457468657265756d205369676e6564204d6573736167653a0a36340000000081526000825161288881601c850160208701612b8d565b91909101601c0192915050565b602080825282518282018190526000919060409081850190868401855b8281101561290e57815180518552868101518786015285810151868601526060808201516001600160f01b03169086015260808082015115159086015260a09081015160ff169085015260c090930192908501906001016128b2565b5091979650505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561295357835183529284019291840191600101612937565b50909695505050505050565b6020808252825482820181905260008481528281209092916040850190845b818110156129535783548352600193840193928501920161297e565b60208152600082518060208401526129b9816040850160208701612b8d565b601f01601f19169190910160400192915050565b6020808252601a908201527f43616c6c6572206973206e6f742074686520476f7665726e6f72000000000000604082015260600190565b602080825260149082015273496e73756666696369656e74207265776172647360601b604082015260600190565b60008219821115612a4557612a45612c0d565b500190565b600082612a6757634e487b7160e01b600052601260045260246000fd5b500490565b600181815b80851115612aa7578160001904821115612a8d57612a8d612c0d565b80851615612a9a57918102915b93841c9390800290612a71565b509250929050565b60006112b48383600082612ac5575060016112b7565b81612ad2575060006112b7565b8160018114612ae85760028114612af257612b0e565b60019150506112b7565b60ff841115612b0357612b03612c0d565b50506001821b6112b7565b5060208310610133831016604e8410600b8410161715612b31575081810a6112b7565b612b3b8383612a6c565b8060001904821115612b4f57612b4f612c0d565b029392505050565b6000816000190483118215151615612b7157612b71612c0d565b500290565b600082821015612b8857612b88612c0d565b500390565b60005b83811015612ba8578181015183820152602001612b90565b838111156106715750506000910152565b600081612bc857612bc8612c0d565b506000190190565b600061ffff80831681811415612be857612be8612c0d565b6001019392505050565b6000600019821415612c0657612c06612c0d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8015158114611e2157600080fdfe7bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4aa2646970667358221220f973be04e42ea488a9a1e252daf2648d45621b093e7eaf926e97112406534eae64736f6c63430008070033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 27 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
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.