Feature Tip: Add private address tag to any address under My Name Tag !
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 | 15631361 | 705 days ago | IN | 0 ETH | 0.02473976 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
Staking
Compiler Version
v0.8.15+commit.e14f2714
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.15; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; import "./libraries/Errors.sol"; /* This contract is used for distributing staking rewards for staking to various nodes. At each rewards distribution for given node, they are distributed proportionate to "stake powers". Stake power for a given stake is a value calculated following way: 1. At first distribution (after staking) it is share of stake amount equal to share of time passed between stake and this distribution to time passed between previous distribution and this distribution. This is named partial power. 2. At subsequent distributions stake power is equal to staked amount. This is named full power. Therefore, reward calculations are split into 2 parts: for full stakes and for partial stakes. Calculations for full stakes is node through increasing node's "rewardPerPower" value (that equals to total accrued reward per 1 unit of power, then magnified by MAGNITUDE to calculate small values correct) Therefore for a stake reward for periods where it was full is it's amount multiplied by difference of node's current rewardPerPower and value of rewardPerPower at distribution where stake happened (first distribution) To calculate partial stake reward (happenes only 1 for each stake) other mechanism is used. At first distribution share of reward for given stake among all rewards for partial stakes in that distribution is equal to share of product of stake amount and time passed between stake and distribution to sum of such products for all partial stakes. These products are named "powerXTime" in the codebase; For correct calculation of sum of powerXTimes we calculate it as difference of maxTotalPowerXTime (sum of powerXTimes if all partial stakes were immediately after previous distribution) and sum of powerXTime deltas (differences between maximal possible powerXTime and real powerXTime for each stake). Such way allows to calculate all values using O(1) of operations in one transaction */ contract Staking is OwnableUpgradeable { using SafeERC20Upgradeable for IERC20Upgradeable; using SafeCastUpgradeable for uint256; /// @notice Magnitude by which values are multiplied in reward calculations uint256 private constant MAGNITUDE = 2**128; /// @notice Denominator used for decimal calculations uint256 public constant DENOMINATOR = 10**18; /// @notice One year duration, used for APR calculations uint256 public constant YEAR = 365 days; /// @notice Token user in staking IERC20Upgradeable public token; /// @notice Minimal stake required for validator uint96 public validatorMinimalStake; /// @notice Structure describing one staking node struct NodeInfo { address validator; uint96 totalStaked; uint256 rewardPerPower; uint256 fee; uint256 nextFee; uint32 feeUpdateDistributionId; uint96 collectedFee; uint32 lastDistributionId; uint96 stakedByValidator; } /// @notice Mapping of node ID's to their info mapping(uint32 => NodeInfo) public nodeInfo; /// @notice Last node ID uint32 public lastNodeId; /// @notice Structure describing one reward distribution for node struct DistributionInfo { uint256 rewardPerPower; uint96 rewardForPartialPower; uint64 timestamp; uint96 reward; uint160 powerXTimeDelta; uint96 stakedIn; } /// @notice Mapping of node ID's to mappings of distribution ID's to their information mapping(uint32 => mapping(uint32 => DistributionInfo)) public distributions; /// @notice Structure describing stake information struct StakeInfo { address owner; uint96 amount; uint96 withdrawnReward; uint32 nodeId; uint64 timestamp; uint32 firstDistributionId; } /// @notice Mapping of stake ID's to their information mapping(uint256 => StakeInfo) public stakeInfo; /// @notice Last stake ID uint256 public lastStakeId; // EVENTS /// @notice Event emitted when new staking node is created event NodeCreated(uint32 indexed nodeId, address indexed validator); /// @notice Event emitted when new stake is created event Staked( uint256 indexed stakeId, address indexed staker, uint32 indexed nodeId, uint256 amount ); /// @notice Event emitted when reward is wihdrawn for some stake event RewardWithdrawn(uint256 indexed stakeId, uint256 reward); /// @notice Event emitted when some stake is withdrawn event Unstaked( uint256 indexed stakeId, address indexed staker, uint32 indexed nodeId, uint256 amount ); /// @notice Event emitted when reward is distributed for some node event RewardDistributed(uint32 indexed nodeId, uint256 reward, uint256 fee); /// @notice Event emitted when fee is collected for some node event FeeCollected(uint32 indexed nodeId, address collector, uint256 fee); /// @notice Event emitted when fee is updated for some node event FeeUpdated(uint32 indexed nodeId, uint256 fee); /// @notice Event emitted when value of validator minimal stake is updated event ValidatorMinimalStakeUpdated(uint96 validatorMinimalStake_); // INITIALIZER /// @notice Contract's initializer /// @param token_ Contract of token used in staking /// @param validatorMinimalStake_ Minimal size of stake required for validator function initialize(IERC20Upgradeable token_, uint96 validatorMinimalStake_) external initializer { __Ownable_init(); token = token_; validatorMinimalStake = validatorMinimalStake_; } // RESTRICTED FUNCTIONS /// @notice Owner's function that is used to create new node /// @param validator Address of the node's validator /// @param fee NUmberator of the fee value /// @return nodeId ID of new node function createNode(address validator, uint256 fee) external onlyOwner returns (uint32 nodeId) { require(validator != address(0), Errors.ZERO_VALIDATOR); nodeId = ++lastNodeId; nodeInfo[nodeId].validator = validator; nodeInfo[nodeId].fee = fee; distributions[nodeId][0].timestamp = block.timestamp.toUint64(); emit NodeCreated(nodeId, validator); } /// @notice Owner's function that is used to distribute rewards to a set of nodes /// @param nodeIds List of node ID's /// @param rewards List of respective rewards to those nodes /// @dev Function transfers distributed reward to contract, approval is required in prior function distributeReward( uint32[] calldata nodeIds, uint256[] calldata rewards ) external onlyOwner { require(nodeIds.length == rewards.length, Errors.LENGHTS_MISMATCH); uint256 totalReward; for (uint256 i = 0; i < rewards.length; i++) { totalReward += rewards[i]; uint256 feeAmount = (rewards[i] * getFee(nodeIds[i])) / DENOMINATOR; nodeInfo[nodeIds[i]].collectedFee += feeAmount.toUint96(); _distributeReward(nodeIds[i], rewards[i] - feeAmount); emit RewardDistributed( nodeIds[i], rewards[i] - feeAmount, feeAmount ); } token.safeTransferFrom(msg.sender, address(this), totalReward); } /// @notice Updates fee for some node (effective only after next distribution) /// @param nodeId ID of the node to update fee for /// @param fee New fee value function setFee(uint32 nodeId, uint256 fee) external { require( msg.sender == owner() || msg.sender == nodeInfo[nodeId].validator, Errors.NOT_OWNER_OR_VALIDATOR ); require(fee < DENOMINATOR, Errors.FEE_OVERFLOW); uint32 lastDistributionId = nodeInfo[nodeId].lastDistributionId; uint32 updateDistributionId = nodeInfo[nodeId].feeUpdateDistributionId; if ( updateDistributionId != 0 && updateDistributionId <= lastDistributionId ) { nodeInfo[nodeId].fee = nodeInfo[nodeId].nextFee; } nodeInfo[nodeId].nextFee = fee; nodeInfo[nodeId].feeUpdateDistributionId = lastDistributionId + 1; emit FeeUpdated(nodeId, fee); } /// @notice Updates value of validator minimal stake /// @param validatorMinimalStake_ New value function setValidatorMinimalStake(uint96 validatorMinimalStake_) external onlyOwner { validatorMinimalStake = validatorMinimalStake_; emit ValidatorMinimalStakeUpdated(validatorMinimalStake_); } // PUBLIC FUNCTIONS /// @notice Creates new stake /// @param nodeId ID of the node to stake for /// @param amount Amount to stake /// @dev Transfers `amount` of `token` to the contract, approval is required in prior /// @return stakeId ID of the created stake function stakeFor(uint32 nodeId, uint96 amount) external returns (uint256 stakeId) { address validator = nodeInfo[nodeId].validator; require(validator != address(0), Errors.INVALID_NODE); if (msg.sender != validator) { require( nodeInfo[nodeId].stakedByValidator >= validatorMinimalStake, Errors.NODE_NOT_ACTIVE ); } else { nodeInfo[nodeId].stakedByValidator += amount; } // This stake's first distribution will be next distribution uint32 distributionId = nodeInfo[nodeId].lastDistributionId + 1; stakeId = ++lastStakeId; stakeInfo[stakeId] = StakeInfo({ owner: msg.sender, nodeId: nodeId, amount: amount, timestamp: block.timestamp.toUint64(), firstDistributionId: distributionId, withdrawnReward: 0 }); nodeInfo[nodeId].totalStaked += amount; // Amount staked in current distribution is stored to calculate total reward for partial power in future distributions[nodeId][distributionId].stakedIn += amount; // Sum of powerXTimeDeltas is increased uint256 timeDelta = block.timestamp - distributions[nodeId][distributionId - 1].timestamp; distributions[nodeId][distributionId].powerXTimeDelta += (timeDelta * amount).toUint160(); token.safeTransferFrom(msg.sender, address(this), amount); emit Staked(stakeId, msg.sender, nodeId, amount); } /// @notice Withdraws accumulated reward for given stake /// @param stakeId ID of the stake to collect reward for function withdrawReward(uint256 stakeId) public { require(stakeInfo[stakeId].owner == msg.sender, Errors.NOT_STAKE_OWNER); uint96 reward = rewardOf(stakeId); stakeInfo[stakeId].withdrawnReward += reward; token.safeTransfer(msg.sender, reward); emit RewardWithdrawn(stakeId, reward); } /// @notice Unstakes given stake (and collects reward in process) /// @param stakeId ID of the stake to withdraw function unstake(uint256 stakeId) external { withdrawReward(stakeId); uint32 nodeId = stakeInfo[stakeId].nodeId; uint32 distributionId = nodeInfo[nodeId].lastDistributionId + 1; uint96 amount = stakeInfo[stakeId].amount; nodeInfo[nodeId].totalStaked -= amount; if (msg.sender == nodeInfo[nodeId].validator) { nodeInfo[nodeId].stakedByValidator -= amount; } if (stakeInfo[stakeId].firstDistributionId == distributionId) { distributions[nodeId][distributionId].stakedIn -= amount; uint160 timeDelta = stakeInfo[stakeId].timestamp - distributions[nodeId][distributionId - 1].timestamp; distributions[nodeId][distributionId].powerXTimeDelta -= timeDelta * amount; } token.safeTransfer(msg.sender, amount); delete stakeInfo[stakeId]; emit Unstaked(stakeId, msg.sender, nodeId, amount); } /// @notice Collects fee for a given node (can only be called by validator) /// @param nodeId ID of the node to collect fee for function withdrawFee(uint32 nodeId) external { require( msg.sender == nodeInfo[nodeId].validator, Errors.NOT_NODE_VALIDATOR ); uint256 fee = nodeInfo[nodeId].collectedFee; if (fee > 0) { nodeInfo[nodeId].collectedFee = 0; token.safeTransfer(msg.sender, fee); emit FeeCollected(nodeId, msg.sender, fee); } } // PUBLIC VIEW FUNCTIONS /// @notice Returns current reward of given stake /// @param stakeId ID of the stake to get reward for /// @return Current reward function rewardOf(uint256 stakeId) public view returns (uint96) { return _accumulatedRewardOf(stakeId) - stakeInfo[stakeId].withdrawnReward; } /// @notice Estimated reward APR for given node /// @param nodeId ID of the node /// @return _ Estimated APR (as 18-digit decimal) function getEstimatedAPR(uint32 nodeId) external view returns (uint256) { NodeInfo memory node = nodeInfo[nodeId]; // If there were no distributions, there is not way to estimare APR if (node.lastDistributionId == 0) { return 0; } // Extrapolate reward rate in last period to estimate yearly reward DistributionInfo memory distribution = distributions[nodeId][ node.lastDistributionId ]; uint256 lastDistributionTs = distributions[nodeId][ node.lastDistributionId - 1 ].timestamp; uint256 estimatedYearlyReward = (distribution.reward * YEAR) / (distribution.timestamp - lastDistributionTs); // Based on yearly reward, calculate estimated APR return (DENOMINATOR * estimatedYearlyReward) / node.totalStaked; } /// @notice Gets current fee for a node /// @param nodeId ID of the node /// @return Current fee function getFee(uint32 nodeId) public view returns (uint256) { uint32 updateDistributionId = nodeInfo[nodeId].feeUpdateDistributionId; if ( updateDistributionId != 0 && updateDistributionId <= nodeInfo[nodeId].lastDistributionId ) { return nodeInfo[nodeId].nextFee; } else { return nodeInfo[nodeId].fee; } } /// @notice Returns if node is active (validator has made minimal stake) /// @param nodeId ID of the node /// @return True if node is active, false otherwise function isActive(uint32 nodeId) external view returns (bool) { return nodeInfo[nodeId].stakedByValidator >= validatorMinimalStake; } // PRIVATE FUNCTIONS /// @notice Internal function that processes reward distribution for one node /// @param nodeId ID of the node /// @param reward Distributed reward function _distributeReward(uint32 nodeId, uint256 reward) private { require(nodeInfo[nodeId].validator != address(0), Errors.INVALID_NODE); require( nodeInfo[nodeId].stakedByValidator >= validatorMinimalStake, Errors.NODE_NOT_ACTIVE ); uint32 distributionId = ++nodeInfo[nodeId].lastDistributionId; DistributionInfo storage distribution = distributions[nodeId][ distributionId ]; uint256 stakedIn = distribution.stakedIn; // Total full power is simply sum of all stakes before this distribution uint256 fullPower = nodeInfo[nodeId].totalStaked - stakedIn; uint256 partialPower; if (stakedIn > 0) { // Maximal possible (not actual) sum of powerXTimes in this distribution uint256 maxTotalPowerXTime = stakedIn * (block.timestamp - distributions[nodeId][distributionId - 1].timestamp); // Total partial power is share of staked amount equal to share of real totalPowerXTime to maximal partialPower = (stakedIn * (maxTotalPowerXTime - distribution.powerXTimeDelta)) / maxTotalPowerXTime; } // Reward for full powers is calculated proporionate to total full and partial powers uint256 rewardForFullPower = (reward * fullPower) / (fullPower + partialPower); // If full powers actually exist in this distribution we calculate (magnified) rewardPerPower delta uint256 rewardPerPowerDelta; if (fullPower > 0) { rewardPerPowerDelta = (MAGNITUDE * rewardForFullPower) / fullPower; } nodeInfo[nodeId].rewardPerPower += rewardPerPowerDelta; distribution.timestamp = block.timestamp.toUint64(); distribution.reward = reward.toUint96(); distribution.rewardPerPower = nodeInfo[nodeId].rewardPerPower; // We store only total reward for partial powers distribution.rewardForPartialPower = (reward - rewardForFullPower) .toUint96(); } // PRIVATE VIEW FUNCTION /// @notice Internal function that calculates total accumulated reward for stake (without withdrawals) /// @param stakeId ID of the stake /// @return Total reward function _accumulatedRewardOf(uint256 stakeId) private view returns (uint96) { StakeInfo memory stake = stakeInfo[stakeId]; DistributionInfo memory firstDistribution = distributions[stake.nodeId][ stake.firstDistributionId ]; if (firstDistribution.timestamp == 0) { return 0; } // Reward for periods when stake was full, calculated straightforward uint256 fullReward = (stake.amount * (nodeInfo[stake.nodeId].rewardPerPower - firstDistribution.rewardPerPower)) / MAGNITUDE; // Timestamp of previous distribution uint256 previousTimestamp = distributions[stake.nodeId][ stake.firstDistributionId - 1 ].timestamp; // Maximal possible (not actual) sum of powerXTimes in first distribution for stake uint256 maxTotalPowerXTime = uint256(firstDistribution.stakedIn) * (firstDistribution.timestamp - previousTimestamp); // Real sum of powerXTimes in first distribution for stake uint256 realTotalPowerXTime = maxTotalPowerXTime - firstDistribution.powerXTimeDelta; // PowerXTime of this stake in first distribution uint256 stakePowerXTime = uint256(stake.amount) * (firstDistribution.timestamp - stake.timestamp); // Reward when stake was partial as propotionate share of total reward for partial stakes in distribution uint256 partialReward; if (realTotalPowerXTime > 0) { partialReward = (uint256(firstDistribution.rewardForPartialPower) * stakePowerXTime) / realTotalPowerXTime; } return (fullReward + partialReward).toUint96(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original * initialization step. This is essential to configure modules that are added through upgrades and that require * initialization. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @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); /** * @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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20PermitUpgradeable { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; import "../extensions/draft-IERC20PermitUpgradeable.sol"; import "../../../utils/AddressUpgradeable.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20Upgradeable { using AddressUpgradeable for address; function safeTransfer( IERC20Upgradeable token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20Upgradeable token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20Upgradeable token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20Upgradeable 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)); } } function safePermit( IERC20PermitUpgradeable token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 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 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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/math/SafeCast.sol) pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCastUpgradeable { /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toUint248(uint256 value) internal pure returns (uint248) { require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits"); return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toUint240(uint256 value) internal pure returns (uint240) { require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits"); return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toUint232(uint256 value) internal pure returns (uint232) { require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits"); return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.2._ */ function toUint224(uint256 value) internal pure returns (uint224) { require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toUint216(uint256 value) internal pure returns (uint216) { require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits"); return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toUint208(uint256 value) internal pure returns (uint208) { require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits"); return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toUint192(uint256 value) internal pure returns (uint192) { require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits"); return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toUint184(uint256 value) internal pure returns (uint184) { require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits"); return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toUint176(uint256 value) internal pure returns (uint176) { require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits"); return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toUint168(uint256 value) internal pure returns (uint168) { require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits"); return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toUint160(uint256 value) internal pure returns (uint160) { require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits"); return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toUint152(uint256 value) internal pure returns (uint152) { require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits"); return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toUint144(uint256 value) internal pure returns (uint144) { require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits"); return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toUint136(uint256 value) internal pure returns (uint136) { require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits"); return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v2.5._ */ function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toUint120(uint256 value) internal pure returns (uint120) { require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits"); return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toUint112(uint256 value) internal pure returns (uint112) { require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits"); return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toUint104(uint256 value) internal pure returns (uint104) { require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits"); return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.2._ */ function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toUint88(uint256 value) internal pure returns (uint88) { require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits"); return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toUint80(uint256 value) internal pure returns (uint80) { require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits"); return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toUint72(uint256 value) internal pure returns (uint72) { require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits"); return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v2.5._ */ function toUint64(uint256 value) internal pure returns (uint64) { require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toUint56(uint256 value) internal pure returns (uint56) { require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits"); return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toUint48(uint256 value) internal pure returns (uint48) { require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits"); return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toUint40(uint256 value) internal pure returns (uint40) { require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits"); return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v2.5._ */ function toUint32(uint256 value) internal pure returns (uint32) { require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toUint24(uint256 value) internal pure returns (uint24) { require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits"); return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v2.5._ */ function toUint16(uint256 value) internal pure returns (uint16) { require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v2.5._ */ function toUint8(uint256 value) internal pure returns (uint8) { require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. * * _Available since v3.0._ */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toInt248(int256 value) internal pure returns (int248) { require(value >= type(int248).min && value <= type(int248).max, "SafeCast: value doesn't fit in 248 bits"); return int248(value); } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toInt240(int256 value) internal pure returns (int240) { require(value >= type(int240).min && value <= type(int240).max, "SafeCast: value doesn't fit in 240 bits"); return int240(value); } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toInt232(int256 value) internal pure returns (int232) { require(value >= type(int232).min && value <= type(int232).max, "SafeCast: value doesn't fit in 232 bits"); return int232(value); } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.7._ */ function toInt224(int256 value) internal pure returns (int224) { require(value >= type(int224).min && value <= type(int224).max, "SafeCast: value doesn't fit in 224 bits"); return int224(value); } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toInt216(int256 value) internal pure returns (int216) { require(value >= type(int216).min && value <= type(int216).max, "SafeCast: value doesn't fit in 216 bits"); return int216(value); } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toInt208(int256 value) internal pure returns (int208) { require(value >= type(int208).min && value <= type(int208).max, "SafeCast: value doesn't fit in 208 bits"); return int208(value); } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toInt200(int256 value) internal pure returns (int200) { require(value >= type(int200).min && value <= type(int200).max, "SafeCast: value doesn't fit in 200 bits"); return int200(value); } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toInt192(int256 value) internal pure returns (int192) { require(value >= type(int192).min && value <= type(int192).max, "SafeCast: value doesn't fit in 192 bits"); return int192(value); } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toInt184(int256 value) internal pure returns (int184) { require(value >= type(int184).min && value <= type(int184).max, "SafeCast: value doesn't fit in 184 bits"); return int184(value); } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toInt176(int256 value) internal pure returns (int176) { require(value >= type(int176).min && value <= type(int176).max, "SafeCast: value doesn't fit in 176 bits"); return int176(value); } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toInt168(int256 value) internal pure returns (int168) { require(value >= type(int168).min && value <= type(int168).max, "SafeCast: value doesn't fit in 168 bits"); return int168(value); } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toInt160(int256 value) internal pure returns (int160) { require(value >= type(int160).min && value <= type(int160).max, "SafeCast: value doesn't fit in 160 bits"); return int160(value); } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toInt152(int256 value) internal pure returns (int152) { require(value >= type(int152).min && value <= type(int152).max, "SafeCast: value doesn't fit in 152 bits"); return int152(value); } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toInt144(int256 value) internal pure returns (int144) { require(value >= type(int144).min && value <= type(int144).max, "SafeCast: value doesn't fit in 144 bits"); return int144(value); } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toInt136(int256 value) internal pure returns (int136) { require(value >= type(int136).min && value <= type(int136).max, "SafeCast: value doesn't fit in 136 bits"); return int136(value); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128) { require(value >= type(int128).min && value <= type(int128).max, "SafeCast: value doesn't fit in 128 bits"); return int128(value); } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toInt120(int256 value) internal pure returns (int120) { require(value >= type(int120).min && value <= type(int120).max, "SafeCast: value doesn't fit in 120 bits"); return int120(value); } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toInt112(int256 value) internal pure returns (int112) { require(value >= type(int112).min && value <= type(int112).max, "SafeCast: value doesn't fit in 112 bits"); return int112(value); } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toInt104(int256 value) internal pure returns (int104) { require(value >= type(int104).min && value <= type(int104).max, "SafeCast: value doesn't fit in 104 bits"); return int104(value); } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.7._ */ function toInt96(int256 value) internal pure returns (int96) { require(value >= type(int96).min && value <= type(int96).max, "SafeCast: value doesn't fit in 96 bits"); return int96(value); } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toInt88(int256 value) internal pure returns (int88) { require(value >= type(int88).min && value <= type(int88).max, "SafeCast: value doesn't fit in 88 bits"); return int88(value); } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toInt80(int256 value) internal pure returns (int80) { require(value >= type(int80).min && value <= type(int80).max, "SafeCast: value doesn't fit in 80 bits"); return int80(value); } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toInt72(int256 value) internal pure returns (int72) { require(value >= type(int72).min && value <= type(int72).max, "SafeCast: value doesn't fit in 72 bits"); return int72(value); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64) { require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits"); return int64(value); } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toInt56(int256 value) internal pure returns (int56) { require(value >= type(int56).min && value <= type(int56).max, "SafeCast: value doesn't fit in 56 bits"); return int56(value); } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toInt48(int256 value) internal pure returns (int48) { require(value >= type(int48).min && value <= type(int48).max, "SafeCast: value doesn't fit in 48 bits"); return int48(value); } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toInt40(int256 value) internal pure returns (int40) { require(value >= type(int40).min && value <= type(int40).max, "SafeCast: value doesn't fit in 40 bits"); return int40(value); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32) { require(value >= type(int32).min && value <= type(int32).max, "SafeCast: value doesn't fit in 32 bits"); return int32(value); } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toInt24(int256 value) internal pure returns (int24) { require(value >= type(int24).min && value <= type(int24).max, "SafeCast: value doesn't fit in 24 bits"); return int24(value); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16) { require(value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits"); return int16(value); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8) { require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits"); return int8(value); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. * * _Available since v3.0._ */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.15; library Errors { string internal constant ZERO_VALIDATOR = "ZV"; string internal constant LENGHTS_MISMATCH = "LM"; string internal constant INVALID_NODE = "IN"; string internal constant NOT_STAKE_OWNER = "NSO"; string internal constant NOT_NODE_VALIDATOR = "NND"; string internal constant NOT_OWNER_OR_VALIDATOR = "NOV"; string internal constant NODE_NOT_ACTIVE = "NNA"; string internal constant FEE_OVERFLOW = "FOF"; }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"nodeId","type":"uint32"},{"indexed":false,"internalType":"address","name":"collector","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"FeeCollected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"nodeId","type":"uint32"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"FeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"nodeId","type":"uint32"},{"indexed":true,"internalType":"address","name":"validator","type":"address"}],"name":"NodeCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"nodeId","type":"uint32"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"RewardDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"stakeId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"stakeId","type":"uint256"},{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":true,"internalType":"uint32","name":"nodeId","type":"uint32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"stakeId","type":"uint256"},{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":true,"internalType":"uint32","name":"nodeId","type":"uint32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Unstaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint96","name":"validatorMinimalStake_","type":"uint96"}],"name":"ValidatorMinimalStakeUpdated","type":"event"},{"inputs":[],"name":"DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"YEAR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"validator","type":"address"},{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"createNode","outputs":[{"internalType":"uint32","name":"nodeId","type":"uint32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"nodeIds","type":"uint32[]"},{"internalType":"uint256[]","name":"rewards","type":"uint256[]"}],"name":"distributeReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"uint32","name":"","type":"uint32"}],"name":"distributions","outputs":[{"internalType":"uint256","name":"rewardPerPower","type":"uint256"},{"internalType":"uint96","name":"rewardForPartialPower","type":"uint96"},{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"uint96","name":"reward","type":"uint96"},{"internalType":"uint160","name":"powerXTimeDelta","type":"uint160"},{"internalType":"uint96","name":"stakedIn","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"nodeId","type":"uint32"}],"name":"getEstimatedAPR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"nodeId","type":"uint32"}],"name":"getFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"token_","type":"address"},{"internalType":"uint96","name":"validatorMinimalStake_","type":"uint96"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"nodeId","type":"uint32"}],"name":"isActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastNodeId","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastStakeId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"}],"name":"nodeInfo","outputs":[{"internalType":"address","name":"validator","type":"address"},{"internalType":"uint96","name":"totalStaked","type":"uint96"},{"internalType":"uint256","name":"rewardPerPower","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"nextFee","type":"uint256"},{"internalType":"uint32","name":"feeUpdateDistributionId","type":"uint32"},{"internalType":"uint96","name":"collectedFee","type":"uint96"},{"internalType":"uint32","name":"lastDistributionId","type":"uint32"},{"internalType":"uint96","name":"stakedByValidator","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"stakeId","type":"uint256"}],"name":"rewardOf","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"nodeId","type":"uint32"},{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint96","name":"validatorMinimalStake_","type":"uint96"}],"name":"setValidatorMinimalStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"nodeId","type":"uint32"},{"internalType":"uint96","name":"amount","type":"uint96"}],"name":"stakeFor","outputs":[{"internalType":"uint256","name":"stakeId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakeInfo","outputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint96","name":"amount","type":"uint96"},{"internalType":"uint96","name":"withdrawnReward","type":"uint96"},{"internalType":"uint32","name":"nodeId","type":"uint32"},{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"uint32","name":"firstDistributionId","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"stakeId","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"validatorMinimalStake","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"nodeId","type":"uint32"}],"name":"withdrawFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"stakeId","type":"uint256"}],"name":"withdrawReward","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50612c7c806100206000396000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c80637b4fdb46116100de578063a4fc465d11610097578063daa3770c11610071578063daa3770c146105ac578063f2a41374146105bf578063f2fde38b146105d2578063fc0c546a146105e557600080fd5b8063a4fc465d14610573578063a541b37d14610586578063bcda2a761461059957600080fd5b80637b4fdb4614610415578063839145401461042857806384167583146104335780638da5cb5b1461050d5780638ff2e6f114610532578063918f86741461056457600080fd5b806353c3bf2f1161013057806353c3bf2f14610369578063545e96ed1461037c578063584789c81461038f5780635e19b305146103a25780636710837b146103fa578063715018a61461040d57600080fd5b8063042da7751461017857806324a4afd5146101a25780632e17de78146101b957806341cbf23b146101ce5780634e5335721461028d578063523a3f0814610356575b600080fd5b6067546101889063ffffffff1681565b60405163ffffffff90911681526020015b60405180910390f35b6101ab606a5481565b604051908152602001610199565b6101cc6101c736600461273c565b6105f8565b005b6102406101dc36600461276e565b606860209081526000928352604080842090915290825290208054600182015460029092015490916001600160601b03808216926001600160401b03600160601b84041692600160a01b908190048316926001600160a01b03831692919091041686565b604080519687526001600160601b0395861660208801526001600160401b039094169386019390935290831660608501526001600160a01b031660808401521660a082015260c001610199565b6102ff61029b36600461273c565b606960205260009081526040902080546001909101546001600160a01b038216916001600160601b03600160a01b9091048116919081169063ffffffff600160601b82048116916001600160401b03600160801b82041691600160c01b9091041686565b604080516001600160a01b0390971687526001600160601b039586166020880152949093169385019390935263ffffffff90811660608501526001600160401b0390921660808401521660a082015260c001610199565b6101cc61036436600461273c565b61095f565b6101cc6103773660046127ec565b610a76565b6101ab61038a366004612857565b610cf3565b6101cc61039d366004612857565b610f0a565b6103ea6103b0366004612857565b60655463ffffffff9091166000908152606660205260409020600401546001600160601b03600160a01b9283900481169290910416101590565b6040519015158152602001610199565b610188610408366004612887565b611026565b6101cc611164565b6101ab6104233660046128ca565b611178565b6101ab6301e1338081565b6104ab610441366004612857565b606660205260009081526040902080546001820154600283015460038401546004909401546001600160a01b038416946001600160601b03600160a01b95869004811695919263ffffffff808216936401000000008304841693600160801b840490921692041689565b604080516001600160a01b03909a168a526001600160601b0398891660208b01528901969096526060880194909452608087019290925263ffffffff90811660a087015290841660c08601521660e08401521661010082015261012001610199565b6033546001600160a01b03165b6040516001600160a01b039091168152602001610199565b60655461054c90600160a01b90046001600160601b031681565b6040516001600160601b039091168152602001610199565b6101ab670de0b6b3a764000081565b6101cc6105813660046128f4565b61160f565b6101cc61059436600461290f565b611673565b6101ab6105a7366004612857565b61181c565b61054c6105ba36600461273c565b6118ab565b6101cc6105cd36600461292b565b6118df565b6101cc6105e0366004612949565b611a10565b60655461051a906001600160a01b031681565b6106018161095f565b600081815260696020908152604080832060019081015463ffffffff600160601b909104811680865260669094529184206004015492939261064c92600160801b909104169061297c565b60008481526069602090815260408083205463ffffffff87168452606690925290912080549293506001600160601b03600160a01b92839004811693849360149261069b9286929004166129a4565b82546001600160601b039182166101009390930a92830291909202199091161790555063ffffffff83166000908152606660205260409020546001600160a01b031633036107435763ffffffff83166000908152606660205260409020600401805482919060149061071e908490600160a01b90046001600160601b03166129a4565b92506101000a8154816001600160601b0302191690836001600160601b031602179055505b60008481526069602052604090206001015463ffffffff808416600160c01b90920416036108cd5763ffffffff838116600090815260686020908152604080832093861683529290522060020180548291906014906107b3908490600160a01b90046001600160601b03166129a4565b82546001600160601b039182166101009390930a92830291909202199091161790555063ffffffff83166000908152606860205260408120816107f76001866129cc565b63ffffffff1681526020808201929092526040908101600090812060019081015489835260699094529190200154610849916001600160401b03600160601b909104811691600160801b9004166129e9565b6001600160401b031690506108676001600160601b03831682612a09565b63ffffffff8086166000908152606860209081526040808320938816835292905290812060020180549091906108a79084906001600160a01b0316612a38565b92506101000a8154816001600160a01b0302191690836001600160a01b03160217905550505b6065546108ed906001600160a01b0316336001600160601b038416611a89565b6000848152606960209081526040808320928355600190920180546001600160e01b031916905590516001600160601b038316815263ffffffff851691339187917ff3fe1feacccfc7a630bb5d3f131bd1ef28cb8f2bb8f169c310e3d5be737038fe910160405180910390a450505050565b60008181526069602090815260409182902054825180840190935260038352624e534f60e81b918301919091526001600160a01b031633146109bd5760405162461bcd60e51b81526004016109b49190612a84565b60405180910390fd5b5060006109c9826118ab565b6000838152606960205260408120600101805492935083929091906109f89084906001600160601b0316612ab7565b82546101009290920a6001600160601b03818102199093169183160217909155606554610a3392506001600160a01b03169033908416611a89565b6040516001600160601b038216815282907f636f874559828b1629d63384be62be9977582d7eebf0539f2a88d87c5602cd02906020015b60405180910390a25050565b610a7e611aec565b6040805180820190915260028152614c4d60f01b6020820152838214610ab75760405162461bcd60e51b81526004016109b49190612a84565b506000805b82811015610cd357838382818110610ad657610ad6612ad9565b9050602002013582610ae89190612aef565b91506000670de0b6b3a7640000610b1f888885818110610b0a57610b0a612ad9565b90506020020160208101906105a79190612857565b868685818110610b3157610b31612ad9565b90506020020135610b429190612b07565b610b4c9190612b26565b9050610b5781611b46565b60666000898986818110610b6d57610b6d612ad9565b9050602002016020810190610b829190612857565b63ffffffff1663ffffffff16815260200190815260200160002060040160048282829054906101000a90046001600160601b0316610bc09190612ab7565b92506101000a8154816001600160601b0302191690836001600160601b03160217905550610c37878784818110610bf957610bf9612ad9565b9050602002016020810190610c0e9190612857565b82878786818110610c2157610c21612ad9565b90506020020135610c329190612b48565b611bb2565b868683818110610c4957610c49612ad9565b9050602002016020810190610c5e9190612857565b63ffffffff167f6d05663a75f490934241f160309f6bdd87ac6cbd365fa6ab79055bd22951d03d82878786818110610c9857610c98612ad9565b90506020020135610ca99190612b48565b60408051918252602082018590520160405180910390a25080610ccb81612b5f565b915050610abc565b50606554610cec906001600160a01b0316333084611f00565b5050505050565b63ffffffff808216600090815260666020908152604080832081516101208101835281546001600160a01b03811682526001600160601b03600160a01b91829004811695830195909552600183015493820193909352600282015460608201526003820154608082015260049091015480861660a08301526401000000008104841660c0830152600160801b810490951660e08201819052919094049091166101008401529091908203610daa5750600092915050565b63ffffffff808416600081815260686020818152604080842060e0880180519097168552808352818520825160c081018452815481526001808301546001600160601b03808216848901526001600160401b03600160601b83041696840196909652600160a01b90819004861660608401526002909301546001600160a01b03811660808401529290920490931660a0840152958552929091529351919290918391610e55916129cc565b63ffffffff1663ffffffff168152602001908152602001600020600101600c9054906101000a90046001600160401b03166001600160401b0316905060008183604001516001600160401b0316610eac9190612b48565b6301e1338084606001516001600160601b0316610ec99190612b07565b610ed39190612b26565b60208501519091506001600160601b0316610ef682670de0b6b3a7640000612b07565b610f009190612b26565b9695505050505050565b63ffffffff8116600090815260666020908152604091829020548251808401909352600383526213939160ea1b918301919091526001600160a01b03163314610f665760405162461bcd60e51b81526004016109b49190612a84565b5063ffffffff811660009081526066602052604090206004015464010000000090046001600160601b031680156110225763ffffffff808316600090815260666020526040902060040180546fffffffffffffffffffffffff0000000019169055606554610fe4916001600160a01b039091169033908490611a8916565b604080513381526020810183905263ffffffff8416917f491391bd5a8c6fc3a176f271f7be1ed91be09b67ee8ebd520fdf9dfe6141e90b9101610a6a565b5050565b6000611030611aec565b6040805180820190915260028152612d2b60f11b60208201526001600160a01b0384166110705760405162461bcd60e51b81526004016109b49190612a84565b50606780546000906110879063ffffffff16612b78565b825463ffffffff8083166101009490940a84810291021990911617909255600090815260666020526040902080546001600160a01b0386166001600160a01b031990911617815560020183905590506110df42611f3e565b63ffffffff8216600081815260686020908152604080832083805290915280822060010180546001600160401b0395909516600160601b0267ffffffffffffffff60601b199095169490941790935591516001600160a01b038616927f6bcfac7e27cccd10b517293666ea2a5be4a90423e07620af36a5a461c24f168d91a392915050565b61116c611aec565b6111766000611fa6565b565b63ffffffff82166000908152606660209081526040808320548151808301909252600282526124a760f11b928201929092526001600160a01b0390911690816111d45760405162461bcd60e51b81526004016109b49190612a84565b50336001600160a01b038216146112605760655463ffffffff851660009081526066602090815260409182902060040154825180840190935260038352624e4e4160e81b9183019190915290916001600160601b03600160a01b91829004811691909204909116101561125a5760405162461bcd60e51b81526004016109b49190612a84565b506112c0565b63ffffffff84166000908152606660205260409020600401805484919060149061129b908490600160a01b90046001600160601b0316612ab7565b92506101000a8154816001600160601b0302191690836001600160601b031602179055505b63ffffffff80851660009081526066602052604081206004015490916112ef91600160801b900416600161297c565b9050606a6000815461130090612b5f565b91905081905592506040518060c00160405280336001600160a01b03168152602001856001600160601b0316815260200160006001600160601b031681526020018663ffffffff16815260200161135642611f3e565b6001600160401b03908116825263ffffffff80851660209384015260008781526069845260408082208651878701516001600160601b03908116600160a01b9081026001600160a01b03909316929092178355888401516001909301805460608b015160808c015160a0909c01518916600160c01b0263ffffffff60c01b199c909a16600160801b029b909b166bffffffffffffffffffffffff60801b199b8916600160601b026fffffffffffffffffffffffffffffffff199092169584169590951717999099169290921795909517909655918a168152606690935290912080548793919260149261144d928692900416612ab7565b82546101009290920a6001600160601b0381810219909316918316021790915563ffffffff8781166000908152606860209081526040808320938716835292905220600201805487935090916014916114af918591600160a01b900416612ab7565b82546001600160601b039182166101009390930a92830291909202199091161790555063ffffffff85166000908152606860205260408120816114f36001856129cc565b63ffffffff16815260208101919091526040016000206001015461152790600160601b90046001600160401b031642612b48565b905061154461153f6001600160601b03871683612b07565b611ff8565b63ffffffff8088166000908152606860209081526040808320938716835292905290812060020180549091906115849084906001600160a01b0316612b9b565b82546101009290920a6001600160a01b038181021990931691831602179091556065546115be92501633306001600160601b038916611f00565b6040516001600160601b038616815263ffffffff871690339086907f2a2e3fb46e6b2fb7a7daac932d14bb5e5a8bfb8bc0eb59d850fcd5f1a080d0bd9060200160405180910390a450505092915050565b611617611aec565b606580546001600160a01b0316600160a01b6001600160601b038416908102919091179091556040519081527fb939fad924524b3a2b317e3f258f815e2e7588ac8867c6ffe40aba3b5d39da079060200160405180910390a150565b6033546001600160a01b03163314806116a9575063ffffffff82166000908152606660205260409020546001600160a01b031633145b604051806040016040528060038152602001622727ab60e91b815250906116e35760405162461bcd60e51b81526004016109b49190612a84565b506040805180820190915260038152622327a360e91b6020820152670de0b6b3a764000082106117265760405162461bcd60e51b81526004016109b49190612a84565b5063ffffffff808316600090815260666020526040902060040154600160801b810482169116801580159061176757508163ffffffff168163ffffffff1611155b1561178d5763ffffffff8416600090815260666020526040902060038101546002909101555b63ffffffff841660009081526066602052604090206003018390556117b382600161297c565b63ffffffff858116600081815260666020908152604091829020600401805463ffffffff19169590941694909417909255905185815290917f480bd6807e15a5cbee3ebaef6b8263fdfa1c5886560d2aacda859d9c0e6985d8910160405180910390a250505050565b63ffffffff808216600090815260666020526040812060040154909116801580159061186c575063ffffffff808416600090815260666020526040902060040154600160801b9004811690821611155b1561188e57505063ffffffff1660009081526066602052604090206003015490565b505063ffffffff1660009081526066602052604090206002015490565b6000818152606960205260408120600101546001600160601b03166118cf83612061565b6118d991906129a4565b92915050565b600054610100900460ff16158080156118ff5750600054600160ff909116105b806119195750303b158015611919575060005460ff166001145b61197c5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016109b4565b6000805460ff19166001179055801561199f576000805461ff0019166101001790555b6119a7612488565b6001600160601b038216600160a01b026001600160a01b038416176065558015611a0b576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b611a18611aec565b6001600160a01b038116611a7d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109b4565b611a8681611fa6565b50565b6040516001600160a01b038316602482015260448101829052611a0b90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526124b7565b6033546001600160a01b031633146111765760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109b4565b60006001600160601b03821115611bae5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203960448201526536206269747360d01b60648201526084016109b4565b5090565b63ffffffff8216600090815260666020908152604091829020548251808401909352600283526124a760f11b918301919091526001600160a01b0316611c0b5760405162461bcd60e51b81526004016109b49190612a84565b5060655463ffffffff831660009081526066602090815260409182902060040154825180840190935260038352624e4e4160e81b9183019190915290916001600160601b03600160a01b918290048116919092049091161015611c815760405162461bcd60e51b81526004016109b49190612a84565b5063ffffffff8083166000908152606660205260408120600401805491929091601091611cb591600160801b900416612b78565b82546101009290920a63ffffffff818102199093168284169182021790935590851660008181526068602090815260408083209583529481528482206002810154938352606690915293812054929450600160a01b918290046001600160601b03908116939192611d2b92859291900416612b48565b905060008215611dc95763ffffffff8716600090815260686020526040812081611d566001896129cc565b63ffffffff168152602081019190915260400160002060010154611d8a90600160601b90046001600160401b031642612b48565b611d949085612b07565b60028601549091508190611db1906001600160a01b031682612b48565b611dbb9086612b07565b611dc59190612b26565b9150505b6000611dd58284612aef565b611ddf8489612b07565b611de99190612b26565b905060008315611e0f5783611e0283600160801b612b07565b611e0c9190612b26565b90505b63ffffffff891660009081526066602052604081206001018054839290611e37908490612aef565b90915550611e46905042611f3e565b86600101600c6101000a8154816001600160401b0302191690836001600160401b03160217905550611e7788611b46565b600180880180546001600160601b0393909316600160a01b026001600160a01b039093169290921790915563ffffffff8a16600090815260666020526040902001548655611ecd611ec8838a612b48565b611b46565b60019690960180546bffffffffffffffffffffffff19166001600160601b03909716969096179095555050505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611f389085906323b872dd60e01b90608401611ab5565b50505050565b60006001600160401b03821115611bae5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201526534206269747360d01b60648201526084016109b4565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006001600160a01b03821115611bae5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663630206269747360c81b60648201526084016109b4565b600080606960008481526020019081526020016000206040518060c00160405290816000820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b031681526020016000820160149054906101000a90046001600160601b03166001600160601b03166001600160601b031681526020016001820160009054906101000a90046001600160601b03166001600160601b03166001600160601b0316815260200160018201600c9054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016001820160109054906101000a90046001600160401b03166001600160401b03166001600160401b031681526020016001820160189054906101000a900463ffffffff1663ffffffff1663ffffffff16815250509050600060686000836060015163ffffffff1663ffffffff16815260200190815260200160002060008360a0015163ffffffff1663ffffffff1681526020019081526020016000206040518060c0016040529081600082015481526020016001820160009054906101000a90046001600160601b03166001600160601b03166001600160601b0316815260200160018201600c9054906101000a90046001600160401b03166001600160401b03166001600160401b031681526020016001820160149054906101000a90046001600160601b03166001600160601b03166001600160601b031681526020016002820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b031681526020016002820160149054906101000a90046001600160601b03166001600160601b03166001600160601b031681525050905080604001516001600160401b03166000036122f3575060009392505050565b8051606083015163ffffffff166000908152606660205260408120600101549091600160801b916123249190612b48565b84602001516001600160601b031661233c9190612b07565b6123469190612b26565b606084015163ffffffff16600090815260686020526040812060a086015192935090918290612377906001906129cc565b63ffffffff1663ffffffff168152602001908152602001600020600101600c9054906101000a90046001600160401b03166001600160401b0316905060008184604001516001600160401b03166123ce9190612b48565b8460a001516001600160601b03166123e69190612b07565b9050600084608001516001600160a01b0316826124039190612b48565b905060008660800151866040015161241b91906129e9565b6001600160401b031687602001516001600160601b031661243c9190612b07565b90506000821561246d57828288602001516001600160601b03166124609190612b07565b61246a9190612b26565b90505b61247a611ec88288612aef565b9a9950505050505050505050565b600054610100900460ff166124af5760405162461bcd60e51b81526004016109b490612bbd565b611176612589565b600061250c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166125b99092919063ffffffff16565b805190915015611a0b578080602001905181019061252a9190612c08565b611a0b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109b4565b600054610100900460ff166125b05760405162461bcd60e51b81526004016109b490612bbd565b61117633611fa6565b60606125c884846000856125d2565b90505b9392505050565b6060824710156126335760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109b4565b6001600160a01b0385163b61268a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109b4565b600080866001600160a01b031685876040516126a69190612c2a565b60006040518083038185875af1925050503d80600081146126e3576040519150601f19603f3d011682016040523d82523d6000602084013e6126e8565b606091505b50915091506126f8828286612703565b979650505050505050565b606083156127125750816125cb565b8251156127225782518084602001fd5b8160405162461bcd60e51b81526004016109b49190612a84565b60006020828403121561274e57600080fd5b5035919050565b803563ffffffff8116811461276957600080fd5b919050565b6000806040838503121561278157600080fd5b61278a83612755565b915061279860208401612755565b90509250929050565b60008083601f8401126127b357600080fd5b5081356001600160401b038111156127ca57600080fd5b6020830191508360208260051b85010111156127e557600080fd5b9250929050565b6000806000806040858703121561280257600080fd5b84356001600160401b038082111561281957600080fd5b612825888389016127a1565b9096509450602087013591508082111561283e57600080fd5b5061284b878288016127a1565b95989497509550505050565b60006020828403121561286957600080fd5b6125cb82612755565b6001600160a01b0381168114611a8657600080fd5b6000806040838503121561289a57600080fd5b82356128a581612872565b946020939093013593505050565b80356001600160601b038116811461276957600080fd5b600080604083850312156128dd57600080fd5b6128e683612755565b9150612798602084016128b3565b60006020828403121561290657600080fd5b6125cb826128b3565b6000806040838503121561292257600080fd5b6128a583612755565b6000806040838503121561293e57600080fd5b82356128e681612872565b60006020828403121561295b57600080fd5b81356125cb81612872565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff80831681851680830382111561299b5761299b612966565b01949350505050565b60006001600160601b03838116908316818110156129c4576129c4612966565b039392505050565b600063ffffffff838116908316818110156129c4576129c4612966565b60006001600160401b03838116908316818110156129c4576129c4612966565b60006001600160a01b0382811684821681151582840482111615612a2f57612a2f612966565b02949350505050565b60006001600160a01b03838116908316818110156129c4576129c4612966565b60005b83811015612a73578181015183820152602001612a5b565b83811115611f385750506000910152565b6020815260008251806020840152612aa3816040850160208701612a58565b601f01601f19169190910160400192915050565b60006001600160601b0380831681851680830382111561299b5761299b612966565b634e487b7160e01b600052603260045260246000fd5b60008219821115612b0257612b02612966565b500190565b6000816000190483118215151615612b2157612b21612966565b500290565b600082612b4357634e487b7160e01b600052601260045260246000fd5b500490565b600082821015612b5a57612b5a612966565b500390565b600060018201612b7157612b71612966565b5060010190565b600063ffffffff808316818103612b9157612b91612966565b6001019392505050565b60006001600160a01b0382811684821680830382111561299b5761299b612966565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600060208284031215612c1a57600080fd5b815180151581146125cb57600080fd5b60008251612c3c818460208701612a58565b919091019291505056fea264697066735822122066d65cd0f9a56f876b82857ed5e067fdb8b51c1589f7f48a569a1373a56ca26764736f6c634300080f0033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101735760003560e01c80637b4fdb46116100de578063a4fc465d11610097578063daa3770c11610071578063daa3770c146105ac578063f2a41374146105bf578063f2fde38b146105d2578063fc0c546a146105e557600080fd5b8063a4fc465d14610573578063a541b37d14610586578063bcda2a761461059957600080fd5b80637b4fdb4614610415578063839145401461042857806384167583146104335780638da5cb5b1461050d5780638ff2e6f114610532578063918f86741461056457600080fd5b806353c3bf2f1161013057806353c3bf2f14610369578063545e96ed1461037c578063584789c81461038f5780635e19b305146103a25780636710837b146103fa578063715018a61461040d57600080fd5b8063042da7751461017857806324a4afd5146101a25780632e17de78146101b957806341cbf23b146101ce5780634e5335721461028d578063523a3f0814610356575b600080fd5b6067546101889063ffffffff1681565b60405163ffffffff90911681526020015b60405180910390f35b6101ab606a5481565b604051908152602001610199565b6101cc6101c736600461273c565b6105f8565b005b6102406101dc36600461276e565b606860209081526000928352604080842090915290825290208054600182015460029092015490916001600160601b03808216926001600160401b03600160601b84041692600160a01b908190048316926001600160a01b03831692919091041686565b604080519687526001600160601b0395861660208801526001600160401b039094169386019390935290831660608501526001600160a01b031660808401521660a082015260c001610199565b6102ff61029b36600461273c565b606960205260009081526040902080546001909101546001600160a01b038216916001600160601b03600160a01b9091048116919081169063ffffffff600160601b82048116916001600160401b03600160801b82041691600160c01b9091041686565b604080516001600160a01b0390971687526001600160601b039586166020880152949093169385019390935263ffffffff90811660608501526001600160401b0390921660808401521660a082015260c001610199565b6101cc61036436600461273c565b61095f565b6101cc6103773660046127ec565b610a76565b6101ab61038a366004612857565b610cf3565b6101cc61039d366004612857565b610f0a565b6103ea6103b0366004612857565b60655463ffffffff9091166000908152606660205260409020600401546001600160601b03600160a01b9283900481169290910416101590565b6040519015158152602001610199565b610188610408366004612887565b611026565b6101cc611164565b6101ab6104233660046128ca565b611178565b6101ab6301e1338081565b6104ab610441366004612857565b606660205260009081526040902080546001820154600283015460038401546004909401546001600160a01b038416946001600160601b03600160a01b95869004811695919263ffffffff808216936401000000008304841693600160801b840490921692041689565b604080516001600160a01b03909a168a526001600160601b0398891660208b01528901969096526060880194909452608087019290925263ffffffff90811660a087015290841660c08601521660e08401521661010082015261012001610199565b6033546001600160a01b03165b6040516001600160a01b039091168152602001610199565b60655461054c90600160a01b90046001600160601b031681565b6040516001600160601b039091168152602001610199565b6101ab670de0b6b3a764000081565b6101cc6105813660046128f4565b61160f565b6101cc61059436600461290f565b611673565b6101ab6105a7366004612857565b61181c565b61054c6105ba36600461273c565b6118ab565b6101cc6105cd36600461292b565b6118df565b6101cc6105e0366004612949565b611a10565b60655461051a906001600160a01b031681565b6106018161095f565b600081815260696020908152604080832060019081015463ffffffff600160601b909104811680865260669094529184206004015492939261064c92600160801b909104169061297c565b60008481526069602090815260408083205463ffffffff87168452606690925290912080549293506001600160601b03600160a01b92839004811693849360149261069b9286929004166129a4565b82546001600160601b039182166101009390930a92830291909202199091161790555063ffffffff83166000908152606660205260409020546001600160a01b031633036107435763ffffffff83166000908152606660205260409020600401805482919060149061071e908490600160a01b90046001600160601b03166129a4565b92506101000a8154816001600160601b0302191690836001600160601b031602179055505b60008481526069602052604090206001015463ffffffff808416600160c01b90920416036108cd5763ffffffff838116600090815260686020908152604080832093861683529290522060020180548291906014906107b3908490600160a01b90046001600160601b03166129a4565b82546001600160601b039182166101009390930a92830291909202199091161790555063ffffffff83166000908152606860205260408120816107f76001866129cc565b63ffffffff1681526020808201929092526040908101600090812060019081015489835260699094529190200154610849916001600160401b03600160601b909104811691600160801b9004166129e9565b6001600160401b031690506108676001600160601b03831682612a09565b63ffffffff8086166000908152606860209081526040808320938816835292905290812060020180549091906108a79084906001600160a01b0316612a38565b92506101000a8154816001600160a01b0302191690836001600160a01b03160217905550505b6065546108ed906001600160a01b0316336001600160601b038416611a89565b6000848152606960209081526040808320928355600190920180546001600160e01b031916905590516001600160601b038316815263ffffffff851691339187917ff3fe1feacccfc7a630bb5d3f131bd1ef28cb8f2bb8f169c310e3d5be737038fe910160405180910390a450505050565b60008181526069602090815260409182902054825180840190935260038352624e534f60e81b918301919091526001600160a01b031633146109bd5760405162461bcd60e51b81526004016109b49190612a84565b60405180910390fd5b5060006109c9826118ab565b6000838152606960205260408120600101805492935083929091906109f89084906001600160601b0316612ab7565b82546101009290920a6001600160601b03818102199093169183160217909155606554610a3392506001600160a01b03169033908416611a89565b6040516001600160601b038216815282907f636f874559828b1629d63384be62be9977582d7eebf0539f2a88d87c5602cd02906020015b60405180910390a25050565b610a7e611aec565b6040805180820190915260028152614c4d60f01b6020820152838214610ab75760405162461bcd60e51b81526004016109b49190612a84565b506000805b82811015610cd357838382818110610ad657610ad6612ad9565b9050602002013582610ae89190612aef565b91506000670de0b6b3a7640000610b1f888885818110610b0a57610b0a612ad9565b90506020020160208101906105a79190612857565b868685818110610b3157610b31612ad9565b90506020020135610b429190612b07565b610b4c9190612b26565b9050610b5781611b46565b60666000898986818110610b6d57610b6d612ad9565b9050602002016020810190610b829190612857565b63ffffffff1663ffffffff16815260200190815260200160002060040160048282829054906101000a90046001600160601b0316610bc09190612ab7565b92506101000a8154816001600160601b0302191690836001600160601b03160217905550610c37878784818110610bf957610bf9612ad9565b9050602002016020810190610c0e9190612857565b82878786818110610c2157610c21612ad9565b90506020020135610c329190612b48565b611bb2565b868683818110610c4957610c49612ad9565b9050602002016020810190610c5e9190612857565b63ffffffff167f6d05663a75f490934241f160309f6bdd87ac6cbd365fa6ab79055bd22951d03d82878786818110610c9857610c98612ad9565b90506020020135610ca99190612b48565b60408051918252602082018590520160405180910390a25080610ccb81612b5f565b915050610abc565b50606554610cec906001600160a01b0316333084611f00565b5050505050565b63ffffffff808216600090815260666020908152604080832081516101208101835281546001600160a01b03811682526001600160601b03600160a01b91829004811695830195909552600183015493820193909352600282015460608201526003820154608082015260049091015480861660a08301526401000000008104841660c0830152600160801b810490951660e08201819052919094049091166101008401529091908203610daa5750600092915050565b63ffffffff808416600081815260686020818152604080842060e0880180519097168552808352818520825160c081018452815481526001808301546001600160601b03808216848901526001600160401b03600160601b83041696840196909652600160a01b90819004861660608401526002909301546001600160a01b03811660808401529290920490931660a0840152958552929091529351919290918391610e55916129cc565b63ffffffff1663ffffffff168152602001908152602001600020600101600c9054906101000a90046001600160401b03166001600160401b0316905060008183604001516001600160401b0316610eac9190612b48565b6301e1338084606001516001600160601b0316610ec99190612b07565b610ed39190612b26565b60208501519091506001600160601b0316610ef682670de0b6b3a7640000612b07565b610f009190612b26565b9695505050505050565b63ffffffff8116600090815260666020908152604091829020548251808401909352600383526213939160ea1b918301919091526001600160a01b03163314610f665760405162461bcd60e51b81526004016109b49190612a84565b5063ffffffff811660009081526066602052604090206004015464010000000090046001600160601b031680156110225763ffffffff808316600090815260666020526040902060040180546fffffffffffffffffffffffff0000000019169055606554610fe4916001600160a01b039091169033908490611a8916565b604080513381526020810183905263ffffffff8416917f491391bd5a8c6fc3a176f271f7be1ed91be09b67ee8ebd520fdf9dfe6141e90b9101610a6a565b5050565b6000611030611aec565b6040805180820190915260028152612d2b60f11b60208201526001600160a01b0384166110705760405162461bcd60e51b81526004016109b49190612a84565b50606780546000906110879063ffffffff16612b78565b825463ffffffff8083166101009490940a84810291021990911617909255600090815260666020526040902080546001600160a01b0386166001600160a01b031990911617815560020183905590506110df42611f3e565b63ffffffff8216600081815260686020908152604080832083805290915280822060010180546001600160401b0395909516600160601b0267ffffffffffffffff60601b199095169490941790935591516001600160a01b038616927f6bcfac7e27cccd10b517293666ea2a5be4a90423e07620af36a5a461c24f168d91a392915050565b61116c611aec565b6111766000611fa6565b565b63ffffffff82166000908152606660209081526040808320548151808301909252600282526124a760f11b928201929092526001600160a01b0390911690816111d45760405162461bcd60e51b81526004016109b49190612a84565b50336001600160a01b038216146112605760655463ffffffff851660009081526066602090815260409182902060040154825180840190935260038352624e4e4160e81b9183019190915290916001600160601b03600160a01b91829004811691909204909116101561125a5760405162461bcd60e51b81526004016109b49190612a84565b506112c0565b63ffffffff84166000908152606660205260409020600401805484919060149061129b908490600160a01b90046001600160601b0316612ab7565b92506101000a8154816001600160601b0302191690836001600160601b031602179055505b63ffffffff80851660009081526066602052604081206004015490916112ef91600160801b900416600161297c565b9050606a6000815461130090612b5f565b91905081905592506040518060c00160405280336001600160a01b03168152602001856001600160601b0316815260200160006001600160601b031681526020018663ffffffff16815260200161135642611f3e565b6001600160401b03908116825263ffffffff80851660209384015260008781526069845260408082208651878701516001600160601b03908116600160a01b9081026001600160a01b03909316929092178355888401516001909301805460608b015160808c015160a0909c01518916600160c01b0263ffffffff60c01b199c909a16600160801b029b909b166bffffffffffffffffffffffff60801b199b8916600160601b026fffffffffffffffffffffffffffffffff199092169584169590951717999099169290921795909517909655918a168152606690935290912080548793919260149261144d928692900416612ab7565b82546101009290920a6001600160601b0381810219909316918316021790915563ffffffff8781166000908152606860209081526040808320938716835292905220600201805487935090916014916114af918591600160a01b900416612ab7565b82546001600160601b039182166101009390930a92830291909202199091161790555063ffffffff85166000908152606860205260408120816114f36001856129cc565b63ffffffff16815260208101919091526040016000206001015461152790600160601b90046001600160401b031642612b48565b905061154461153f6001600160601b03871683612b07565b611ff8565b63ffffffff8088166000908152606860209081526040808320938716835292905290812060020180549091906115849084906001600160a01b0316612b9b565b82546101009290920a6001600160a01b038181021990931691831602179091556065546115be92501633306001600160601b038916611f00565b6040516001600160601b038616815263ffffffff871690339086907f2a2e3fb46e6b2fb7a7daac932d14bb5e5a8bfb8bc0eb59d850fcd5f1a080d0bd9060200160405180910390a450505092915050565b611617611aec565b606580546001600160a01b0316600160a01b6001600160601b038416908102919091179091556040519081527fb939fad924524b3a2b317e3f258f815e2e7588ac8867c6ffe40aba3b5d39da079060200160405180910390a150565b6033546001600160a01b03163314806116a9575063ffffffff82166000908152606660205260409020546001600160a01b031633145b604051806040016040528060038152602001622727ab60e91b815250906116e35760405162461bcd60e51b81526004016109b49190612a84565b506040805180820190915260038152622327a360e91b6020820152670de0b6b3a764000082106117265760405162461bcd60e51b81526004016109b49190612a84565b5063ffffffff808316600090815260666020526040902060040154600160801b810482169116801580159061176757508163ffffffff168163ffffffff1611155b1561178d5763ffffffff8416600090815260666020526040902060038101546002909101555b63ffffffff841660009081526066602052604090206003018390556117b382600161297c565b63ffffffff858116600081815260666020908152604091829020600401805463ffffffff19169590941694909417909255905185815290917f480bd6807e15a5cbee3ebaef6b8263fdfa1c5886560d2aacda859d9c0e6985d8910160405180910390a250505050565b63ffffffff808216600090815260666020526040812060040154909116801580159061186c575063ffffffff808416600090815260666020526040902060040154600160801b9004811690821611155b1561188e57505063ffffffff1660009081526066602052604090206003015490565b505063ffffffff1660009081526066602052604090206002015490565b6000818152606960205260408120600101546001600160601b03166118cf83612061565b6118d991906129a4565b92915050565b600054610100900460ff16158080156118ff5750600054600160ff909116105b806119195750303b158015611919575060005460ff166001145b61197c5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016109b4565b6000805460ff19166001179055801561199f576000805461ff0019166101001790555b6119a7612488565b6001600160601b038216600160a01b026001600160a01b038416176065558015611a0b576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b611a18611aec565b6001600160a01b038116611a7d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109b4565b611a8681611fa6565b50565b6040516001600160a01b038316602482015260448101829052611a0b90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526124b7565b6033546001600160a01b031633146111765760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109b4565b60006001600160601b03821115611bae5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203960448201526536206269747360d01b60648201526084016109b4565b5090565b63ffffffff8216600090815260666020908152604091829020548251808401909352600283526124a760f11b918301919091526001600160a01b0316611c0b5760405162461bcd60e51b81526004016109b49190612a84565b5060655463ffffffff831660009081526066602090815260409182902060040154825180840190935260038352624e4e4160e81b9183019190915290916001600160601b03600160a01b918290048116919092049091161015611c815760405162461bcd60e51b81526004016109b49190612a84565b5063ffffffff8083166000908152606660205260408120600401805491929091601091611cb591600160801b900416612b78565b82546101009290920a63ffffffff818102199093168284169182021790935590851660008181526068602090815260408083209583529481528482206002810154938352606690915293812054929450600160a01b918290046001600160601b03908116939192611d2b92859291900416612b48565b905060008215611dc95763ffffffff8716600090815260686020526040812081611d566001896129cc565b63ffffffff168152602081019190915260400160002060010154611d8a90600160601b90046001600160401b031642612b48565b611d949085612b07565b60028601549091508190611db1906001600160a01b031682612b48565b611dbb9086612b07565b611dc59190612b26565b9150505b6000611dd58284612aef565b611ddf8489612b07565b611de99190612b26565b905060008315611e0f5783611e0283600160801b612b07565b611e0c9190612b26565b90505b63ffffffff891660009081526066602052604081206001018054839290611e37908490612aef565b90915550611e46905042611f3e565b86600101600c6101000a8154816001600160401b0302191690836001600160401b03160217905550611e7788611b46565b600180880180546001600160601b0393909316600160a01b026001600160a01b039093169290921790915563ffffffff8a16600090815260666020526040902001548655611ecd611ec8838a612b48565b611b46565b60019690960180546bffffffffffffffffffffffff19166001600160601b03909716969096179095555050505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611f389085906323b872dd60e01b90608401611ab5565b50505050565b60006001600160401b03821115611bae5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201526534206269747360d01b60648201526084016109b4565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006001600160a01b03821115611bae5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663630206269747360c81b60648201526084016109b4565b600080606960008481526020019081526020016000206040518060c00160405290816000820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b031681526020016000820160149054906101000a90046001600160601b03166001600160601b03166001600160601b031681526020016001820160009054906101000a90046001600160601b03166001600160601b03166001600160601b0316815260200160018201600c9054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016001820160109054906101000a90046001600160401b03166001600160401b03166001600160401b031681526020016001820160189054906101000a900463ffffffff1663ffffffff1663ffffffff16815250509050600060686000836060015163ffffffff1663ffffffff16815260200190815260200160002060008360a0015163ffffffff1663ffffffff1681526020019081526020016000206040518060c0016040529081600082015481526020016001820160009054906101000a90046001600160601b03166001600160601b03166001600160601b0316815260200160018201600c9054906101000a90046001600160401b03166001600160401b03166001600160401b031681526020016001820160149054906101000a90046001600160601b03166001600160601b03166001600160601b031681526020016002820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b031681526020016002820160149054906101000a90046001600160601b03166001600160601b03166001600160601b031681525050905080604001516001600160401b03166000036122f3575060009392505050565b8051606083015163ffffffff166000908152606660205260408120600101549091600160801b916123249190612b48565b84602001516001600160601b031661233c9190612b07565b6123469190612b26565b606084015163ffffffff16600090815260686020526040812060a086015192935090918290612377906001906129cc565b63ffffffff1663ffffffff168152602001908152602001600020600101600c9054906101000a90046001600160401b03166001600160401b0316905060008184604001516001600160401b03166123ce9190612b48565b8460a001516001600160601b03166123e69190612b07565b9050600084608001516001600160a01b0316826124039190612b48565b905060008660800151866040015161241b91906129e9565b6001600160401b031687602001516001600160601b031661243c9190612b07565b90506000821561246d57828288602001516001600160601b03166124609190612b07565b61246a9190612b26565b90505b61247a611ec88288612aef565b9a9950505050505050505050565b600054610100900460ff166124af5760405162461bcd60e51b81526004016109b490612bbd565b611176612589565b600061250c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166125b99092919063ffffffff16565b805190915015611a0b578080602001905181019061252a9190612c08565b611a0b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109b4565b600054610100900460ff166125b05760405162461bcd60e51b81526004016109b490612bbd565b61117633611fa6565b60606125c884846000856125d2565b90505b9392505050565b6060824710156126335760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109b4565b6001600160a01b0385163b61268a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109b4565b600080866001600160a01b031685876040516126a69190612c2a565b60006040518083038185875af1925050503d80600081146126e3576040519150601f19603f3d011682016040523d82523d6000602084013e6126e8565b606091505b50915091506126f8828286612703565b979650505050505050565b606083156127125750816125cb565b8251156127225782518084602001fd5b8160405162461bcd60e51b81526004016109b49190612a84565b60006020828403121561274e57600080fd5b5035919050565b803563ffffffff8116811461276957600080fd5b919050565b6000806040838503121561278157600080fd5b61278a83612755565b915061279860208401612755565b90509250929050565b60008083601f8401126127b357600080fd5b5081356001600160401b038111156127ca57600080fd5b6020830191508360208260051b85010111156127e557600080fd5b9250929050565b6000806000806040858703121561280257600080fd5b84356001600160401b038082111561281957600080fd5b612825888389016127a1565b9096509450602087013591508082111561283e57600080fd5b5061284b878288016127a1565b95989497509550505050565b60006020828403121561286957600080fd5b6125cb82612755565b6001600160a01b0381168114611a8657600080fd5b6000806040838503121561289a57600080fd5b82356128a581612872565b946020939093013593505050565b80356001600160601b038116811461276957600080fd5b600080604083850312156128dd57600080fd5b6128e683612755565b9150612798602084016128b3565b60006020828403121561290657600080fd5b6125cb826128b3565b6000806040838503121561292257600080fd5b6128a583612755565b6000806040838503121561293e57600080fd5b82356128e681612872565b60006020828403121561295b57600080fd5b81356125cb81612872565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff80831681851680830382111561299b5761299b612966565b01949350505050565b60006001600160601b03838116908316818110156129c4576129c4612966565b039392505050565b600063ffffffff838116908316818110156129c4576129c4612966565b60006001600160401b03838116908316818110156129c4576129c4612966565b60006001600160a01b0382811684821681151582840482111615612a2f57612a2f612966565b02949350505050565b60006001600160a01b03838116908316818110156129c4576129c4612966565b60005b83811015612a73578181015183820152602001612a5b565b83811115611f385750506000910152565b6020815260008251806020840152612aa3816040850160208701612a58565b601f01601f19169190910160400192915050565b60006001600160601b0380831681851680830382111561299b5761299b612966565b634e487b7160e01b600052603260045260246000fd5b60008219821115612b0257612b02612966565b500190565b6000816000190483118215151615612b2157612b21612966565b500290565b600082612b4357634e487b7160e01b600052601260045260246000fd5b500490565b600082821015612b5a57612b5a612966565b500390565b600060018201612b7157612b71612966565b5060010190565b600063ffffffff808316818103612b9157612b91612966565b6001019392505050565b60006001600160a01b0382811684821680830382111561299b5761299b612966565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600060208284031215612c1a57600080fd5b815180151581146125cb57600080fd5b60008251612c3c818460208701612a58565b919091019291505056fea264697066735822122066d65cd0f9a56f876b82857ed5e067fdb8b51c1589f7f48a569a1373a56ca26764736f6c634300080f0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 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.