Overview
S Balance
S Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
BaseRewardPoolV2
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "./Dependencies/EqbConstants.sol"; import "./Interfaces/IBaseRewardPoolV2.sol"; import "./Interfaces/IPendleBooster.sol"; import "@shared/lib-contracts-v0.8/contracts/Dependencies/TransferHelper.sol"; contract BaseRewardPoolV2 is IBaseRewardPoolV2, AccessControlUpgradeable { using SafeERC20 for IERC20; using TransferHelper for address; address public booster; uint256 public pid; IERC20 public stakingToken; address[] public rewardTokens; uint256 public constant duration = 7 days; uint256 private _totalSupply; mapping(address => uint256) private _balances; struct Reward { uint256 periodFinish; uint256 rewardRate; uint256 lastUpdateTime; uint256 rewardPerTokenStored; uint256 queuedRewards; } struct UserReward { uint256 userRewardPerTokenPaid; uint256 rewards; } mapping(address => Reward) public rewards; mapping(address => bool) public isRewardToken; mapping(address => mapping(address => UserReward)) public userRewards; mapping(address => uint256) public userLastTime; mapping(address => uint256) public userAmountTime; /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } function initialize(address _owner, address _booster) public initializer { require(_booster != address(0), "invalid _booster!"); __AccessControl_init(); booster = _booster; _grantRole(DEFAULT_ADMIN_ROLE, _owner); _grantRole(EqbConstants.ADMIN_ROLE, _booster); emit BoosterUpdated(_booster); } function setParams( uint256 _pid, address _stakingToken, address _rewardToken ) public override { require( hasRole(DEFAULT_ADMIN_ROLE, msg.sender) || msg.sender == booster, "!auth" ); require( address(stakingToken) == address(0), "params have already been set" ); require(_stakingToken != address(0), "invalid _stakingToken!"); require(_rewardToken != address(0), "invalid _rewardToken!"); pid = _pid; stakingToken = IERC20(_stakingToken); addRewardToken(_rewardToken); } function setParams( uint256 _pid, address _stakingToken, address _rewardToken, address _eqbZap ) external override { require(_eqbZap != address(0), "invalid _eqbZap!"); setParams(_pid, _stakingToken, _rewardToken); _grantRole(EqbConstants.ZAP_ROLE, _eqbZap); } function addRewardToken(address _rewardToken) internal { require(_rewardToken != address(0), "invalid _rewardToken!"); if (isRewardToken[_rewardToken]) { return; } rewardTokens.push(_rewardToken); isRewardToken[_rewardToken] = true; emit RewardTokenAdded(_rewardToken); } function totalSupply() public view override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } modifier updateReward(address _account) { for (uint256 i = 0; i < rewardTokens.length; i++) { address rewardToken = rewardTokens[i]; Reward storage reward = rewards[rewardToken]; reward.rewardPerTokenStored = rewardPerToken(rewardToken); reward.lastUpdateTime = lastTimeRewardApplicable(rewardToken); UserReward storage userReward = userRewards[_account][rewardToken]; userReward.rewards = earned(_account, rewardToken); userReward.userRewardPerTokenPaid = rewards[rewardToken] .rewardPerTokenStored; } userAmountTime[_account] = getUserAmountTime(_account); userLastTime[_account] = block.timestamp; _; } function getRewardTokens() external view override returns (address[] memory) { return rewardTokens; } function getRewardTokensLength() external view override returns (uint256) { return rewardTokens.length; } function lastTimeRewardApplicable( address _rewardToken ) public view returns (uint256) { return Math.min(block.timestamp, rewards[_rewardToken].periodFinish); } function rewardPerToken( address _rewardToken ) public view returns (uint256) { Reward memory reward = rewards[_rewardToken]; if (totalSupply() == 0) { return reward.rewardPerTokenStored; } return reward.rewardPerTokenStored + (((lastTimeRewardApplicable(_rewardToken) - reward.lastUpdateTime) * reward.rewardRate * 1e18) / totalSupply()); } function earned( address _account, address _rewardToken ) public view override returns (uint256) { UserReward memory userReward = userRewards[_account][_rewardToken]; return ((balanceOf(_account) * (rewardPerToken(_rewardToken) - userReward.userRewardPerTokenPaid)) / 1e18) + userReward.rewards; } function getUserAmountTime( address _account ) public view override returns (uint256) { uint256 lastTime = userLastTime[_account]; if (lastTime == 0) { return 0; } uint256 userBalance = _balances[_account]; if (userBalance == 0) { return userAmountTime[_account]; } return userAmountTime[_account] + ((block.timestamp - lastTime) * userBalance); } function stake(uint256 _amount) public override updateReward(msg.sender) { require(_amount > 0, "RewardPool : Cannot stake 0"); _totalSupply = _totalSupply + _amount; _balances[msg.sender] = _balances[msg.sender] + _amount; stakingToken.safeTransferFrom(msg.sender, address(this), _amount); emit Staked(msg.sender, _amount); } function stakeAll() external override { uint256 balance = stakingToken.balanceOf(msg.sender); stake(balance); } function stakeFor( address _for, uint256 _amount ) external override updateReward(_for) { require(_for != address(0), "invalid _for!"); require(_amount > 0, "RewardPool : Cannot stake 0"); //give to _for _totalSupply = _totalSupply + _amount; _balances[_for] = _balances[_for] + _amount; //take away from sender stakingToken.safeTransferFrom(msg.sender, address(this), _amount); emit Staked(_for, _amount); } function withdraw(uint256 amount) external override { _withdraw(msg.sender, amount, true); } function withdrawAll() external override { _withdraw(msg.sender, _balances[msg.sender], true); } function withdrawFor( address _account, uint256 _amount ) external override onlyRole(EqbConstants.ZAP_ROLE) { _withdraw(_account, _amount, true); } // Withdraw without caring about rewards. EMERGENCY ONLY. function emergencyWithdraw() external { uint256 _amount = _balances[msg.sender]; _withdraw(msg.sender, _amount, false); emit EmergencyWithdrawn(msg.sender, _amount); } function _withdraw( address _account, uint256 _amount, bool _reward ) internal updateReward(_account) { require(_amount > 0, "RewardPool : Cannot withdraw 0"); _totalSupply = _totalSupply - _amount; _balances[_account] = _balances[_account] - _amount; stakingToken.safeTransfer(_account, _amount); emit Withdrawn(_account, _amount); if (_reward) { _getReward(_account); } } function getReward( address _account ) public override updateReward(_account) { _getReward(_account); } function _getReward(address _account) internal { for (uint256 i = 0; i < rewardTokens.length; i++) { address rewardToken = rewardTokens[i]; uint256 reward = userRewards[_account][rewardToken].rewards; if (reward > 0) { userRewards[_account][rewardToken].rewards = 0; rewardToken.safeTransferToken(_account, reward); IPendleBooster(booster).rewardClaimed( pid, _account, rewardToken, reward ); emit RewardPaid(_account, rewardToken, reward); } } } function donate( address _rewardToken, uint256 _amount ) external payable override { require(isRewardToken[_rewardToken], "invalid token"); if (AddressLib.isPlatformToken(_rewardToken)) { require(_amount == msg.value, "invalid amount"); } else { require(msg.value == 0, "invalid msg.value"); IERC20(_rewardToken).safeTransferFrom( msg.sender, address(this), _amount ); } rewards[_rewardToken].queuedRewards = rewards[_rewardToken].queuedRewards + _amount; } function queueNewRewards( address _rewardToken, uint256 _rewards ) external payable override onlyRole(EqbConstants.ADMIN_ROLE) { addRewardToken(_rewardToken); if (AddressLib.isPlatformToken(_rewardToken)) { require(_rewards == msg.value, "invalid amount"); } else { require(msg.value == 0, "invalid msg.value"); IERC20(_rewardToken).safeTransferFrom( msg.sender, address(this), _rewards ); } Reward storage rewardInfo = rewards[_rewardToken]; if (totalSupply() == 0) { rewardInfo.queuedRewards = rewardInfo.queuedRewards + _rewards; return; } rewardInfo.rewardPerTokenStored = rewardPerToken(_rewardToken); _rewards = _rewards + rewardInfo.queuedRewards; rewardInfo.queuedRewards = 0; if (block.timestamp >= rewardInfo.periodFinish) { rewardInfo.rewardRate = _rewards / duration; } else { uint256 remaining = rewardInfo.periodFinish - block.timestamp; uint256 leftover = remaining * rewardInfo.rewardRate; _rewards = _rewards + leftover; rewardInfo.rewardRate = _rewards / duration; } rewardInfo.lastUpdateTime = block.timestamp; rewardInfo.periodFinish = block.timestamp + duration; emit RewardAdded(_rewardToken, _rewards); } receive() external payable {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } /** * @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 v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// 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.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 v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @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 v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// 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 IERC20Permit { /** * @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.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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 (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit 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(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: 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 Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [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 Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @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 (last updated v4.7.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. It the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`. // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`. // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a // good first aproximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1; uint256 x = a; if (x >> 128 > 0) { x >>= 128; result <<= 64; } if (x >> 64 > 0) { x >>= 64; result <<= 32; } if (x >> 32 > 0) { x >>= 32; result <<= 16; } if (x >> 16 > 0) { x >>= 16; result <<= 8; } if (x >> 8 > 0) { x >>= 8; result <<= 4; } if (x >> 4 > 0) { x >>= 4; result <<= 2; } if (x >> 2 > 0) { result <<= 1; } // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { uint256 result = sqrt(a); if (rounding == Rounding.Up && result * result < a) { result += 1; } return result; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; library AddressLib { address public constant PLATFORM_TOKEN_ADDRESS = 0xeFEfeFEfeFeFEFEFEfefeFeFefEfEfEfeFEFEFEf; function isPlatformToken(address addr) internal pure returns (bool) { return addr == PLATFORM_TOKEN_ADDRESS; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./AddressLib.sol"; library TransferHelper { using AddressLib for address; function safeTransferToken( address token, address to, uint value ) internal { if (token.isPlatformToken()) { safeTransferETH(to, value); } else { safeTransfer(IERC20(token), to, value); } } function safeTransferETH( address to, uint value ) internal { (bool success, ) = address(to).call{value: value}(""); require(success, "TransferHelper: Sending ETH failed"); } function balanceOf(address token, address addr) internal view returns (uint) { if (token.isPlatformToken()) { return addr.balance; } else { return IERC20(token).balanceOf(addr); } } function safeTransfer( IERC20 token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))) -> 0xa9059cbb (bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeTransfer: transfer failed' ); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))) -> 0x23b872dd (bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeTransferFrom: transfer failed' ); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; library EqbConstants { // Roles bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); bytes32 public constant ZAP_ROLE = keccak256("ZAP_ROLE"); // contracts bytes32 public constant PENDLE_ROUTER_V3 = keccak256("PENDLE_ROUTER_V3"); bytes32 public constant DEPOSIT_TOKEN_V2_BEACON = keccak256("DEPOSIT_TOKEN_V2_BEACON"); bytes32 public constant BASE_REWARD_POOL_V2_BEACON = keccak256("BASE_REWARD_POOL_V2_BEACON"); bytes32 public constant EPENDLE_VAULT_SIDECHAIN = keccak256("EPENDLE_VAULT_SIDECHAIN"); bytes32 public constant SMART_CONVERTOR = keccak256("SMART_CONVERTOR"); bytes32 public constant EQB_ZAP = keccak256("EQB_ZAP"); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol"; import "./IRewards.sol"; interface IBaseRewardPool is IRewards, IAccessControlUpgradeable { function setParams( uint256 _pid, address _stakingToken, address _rewardToken ) external; function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function stake(uint256) external; function stakeAll() external; function stakeFor(address, uint256) external; function withdraw(uint256) external; function withdrawAll() external; function donate(address, uint256) external payable; function earned(address, address) external view returns (uint256); function getUserAmountTime(address) external view returns (uint256); function getRewardTokens() external view returns (address[] memory); function getRewardTokensLength() external view returns (uint256); function getReward(address) external; function withdrawFor(address _account, uint256 _amount) external; event BoosterUpdated(address _booster); event RewardTokenAdded(address indexed _rewardToken); event Staked(address indexed _user, uint256 _amount); event Withdrawn(address indexed _user, uint256 _amount); event EmergencyWithdrawn(address indexed _user, uint256 _amount); event RewardPaid( address indexed _user, address indexed _rewardToken, uint256 _reward ); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import "./IBaseRewardPool.sol"; interface IBaseRewardPoolV2 is IBaseRewardPool { function initialize(address _owner, address _booster) external; function setParams( uint256 _pid, address _stakingToken, address _rewardToken, address _eqbZap ) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; interface IPendleBooster { function poolLength() external view returns (uint256); function poolInfo( uint256 ) external view returns (address, address, address, bool); function deposit(uint256 _pid, uint256 _amount, bool _stake) external; function withdraw(uint256 _pid, uint256 _amount) external; function rewardClaimed(uint256, address, address, uint256) external; event PoolAdded( uint256 indexed _pid, address indexed _market, address _token, address _rewardPool ); event Deposited( address indexed _user, uint256 indexed _poolid, uint256 _amount ); event Withdrawn( address indexed _user, uint256 indexed _poolid, uint256 _amount ); event RewardClaimed( uint256 _pid, address indexed _rewardToken, uint256 _amount ); event EarmarkIncentiveSent( uint256 _pid, address indexed _caller, address indexed _token, uint256 _amount ); event TreasurySent(uint256 _pid, address indexed _token, uint256 _amount); event EqbRewardsSent( address indexed _to, uint256 _eqbAmount, uint256 _xEqbAmount ); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; interface IRewards { function queueNewRewards(address, uint256) external payable; event RewardAdded(address indexed _rewardToken, uint256 _reward); }
{ "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_booster","type":"address"}],"name":"BoosterUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"EmergencyWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_rewardToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"_reward","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":true,"internalType":"address","name":"_rewardToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"_reward","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_rewardToken","type":"address"}],"name":"RewardTokenAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"booster","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"donate","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"duration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"address","name":"_rewardToken","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getRewardTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardTokensLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"getUserAmountTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_booster","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isRewardToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardToken","type":"address"}],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_rewards","type":"uint256"}],"name":"queueNewRewards","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardToken","type":"address"}],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"periodFinish","type":"uint256"},{"internalType":"uint256","name":"rewardRate","type":"uint256"},{"internalType":"uint256","name":"lastUpdateTime","type":"uint256"},{"internalType":"uint256","name":"rewardPerTokenStored","type":"uint256"},{"internalType":"uint256","name":"queuedRewards","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_stakingToken","type":"address"},{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"address","name":"_eqbZap","type":"address"}],"name":"setParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_stakingToken","type":"address"},{"internalType":"address","name":"_rewardToken","type":"address"}],"name":"setParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakeAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_for","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"stakeFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userAmountTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userLastTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"userRewards","outputs":[{"internalType":"uint256","name":"userRewardPerTokenPaid","type":"uint256"},{"internalType":"uint256","name":"rewards","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60806040523480156200001157600080fd5b506200001c62000022565b620000e4565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e2576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b612d1780620000f46000396000f3fe6080604052600436106102895760003560e01c806386b8ea2011610153578063c4f59f9b116100cb578063db518db21161007f578063f106845411610064578063f1068454146107cb578063f1229777146107e1578063f376d7981461080157600080fd5b8063db518db214610798578063e69d849d146107b857600080fd5b8063d47c3bf8116100b0578063d47c3bf814610736578063d547741f14610763578063db2e21bc1461078357600080fd5b8063c4f59f9b146106f4578063c6def0761461071657600080fd5b8063a694fc3a11610122578063b5fd73f811610107578063b5fd73f814610677578063b65a7ea5146106a7578063c00007b0146106d457600080fd5b8063a694fc3a14610603578063a980356a1461062357600080fd5b806386b8ea20146105735780638dcb40611461059357806391d14854146105a8578063a217fddf146105ee57600080fd5b80632e1a7d4d11610201578063638634ee116101b557806372f702f31161019a57806372f702f3146105065780637bb7bed11461053e578063853828b61461055e57600080fd5b8063638634ee146104b057806370a08231146104d057600080fd5b80632f2ff15d116101e65780632f2ff15d1461045057806336568abe14610470578063485cc9551461049057600080fd5b80632e1a7d4d146104105780632ee409081461043057600080fd5b806318160ddd11610258578063248a9ca31161023d578063248a9ca3146103ab5780632521cdd8146103db5780632cf404dc146103f057600080fd5b806318160ddd14610376578063211dc32d1461038b57600080fd5b806301ffc9a71461029557806304d0c2c5146102ca5780630700037d146102df5780630fb5a6b41461035157600080fd5b3661029057005b600080fd5b3480156102a157600080fd5b506102b56102b0366004612911565b610821565b60405190151581526020015b60405180910390f35b6102dd6102d8366004612957565b61088a565b005b3480156102eb57600080fd5b506103296102fa366004612981565b609d60205260009081526040902080546001820154600283015460038401546004909401549293919290919085565b604080519586526020860194909452928401919091526060830152608082015260a0016102c1565b34801561035d57600080fd5b5061036862093a8081565b6040519081526020016102c1565b34801561038257600080fd5b50609b54610368565b34801561039757600080fd5b506103686103a636600461299c565b610ac4565b3480156103b757600080fd5b506103686103c63660046129cf565b60009081526065602052604090206001015490565b3480156103e757600080fd5b50609a54610368565b3480156103fc57600080fd5b506102dd61040b3660046129e8565b610b63565b34801561041c57600080fd5b506102dd61042b3660046129cf565b610bf4565b34801561043c57600080fd5b506102dd61044b366004612957565b610c03565b34801561045c57600080fd5b506102dd61046b366004612a35565b610e4d565b34801561047c57600080fd5b506102dd61048b366004612a35565b610e72565b34801561049c57600080fd5b506102dd6104ab36600461299c565b610efe565b3480156104bc57600080fd5b506103686104cb366004612981565b61110e565b3480156104dc57600080fd5b506103686104eb366004612981565b6001600160a01b03166000908152609c602052604090205490565b34801561051257600080fd5b50609954610526906001600160a01b031681565b6040516001600160a01b0390911681526020016102c1565b34801561054a57600080fd5b506105266105593660046129cf565b611132565b34801561056a57600080fd5b506102dd61115c565b34801561057f57600080fd5b5061036861058e366004612981565b61117a565b34801561059f57600080fd5b506102dd61121a565b3480156105b457600080fd5b506102b56105c3366004612a35565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156105fa57600080fd5b50610368600081565b34801561060f57600080fd5b506102dd61061e3660046129cf565b6112a7565b34801561062f57600080fd5b5061066261063e36600461299c565b609f6020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152016102c1565b34801561068357600080fd5b506102b5610692366004612981565b609e6020526000908152604090205460ff1681565b3480156106b357600080fd5b506103686106c2366004612981565b60a06020526000908152604090205481565b3480156106e057600080fd5b506102dd6106ef366004612981565b611484565b34801561070057600080fd5b5061070961158b565b6040516102c19190612a58565b34801561072257600080fd5b50609754610526906001600160a01b031681565b34801561074257600080fd5b50610368610751366004612981565b60a16020526000908152604090205481565b34801561076f57600080fd5b506102dd61077e366004612a35565b6115ed565b34801561078f57600080fd5b506102dd611612565b3480156107a457600080fd5b506102dd6107b3366004612957565b611666565b6102dd6107c6366004612957565b61169c565b3480156107d757600080fd5b5061036860985481565b3480156107ed57600080fd5b506103686107fc366004612981565b611829565b34801561080d57600080fd5b506102dd61081c366004612aa5565b6118eb565b60006001600160e01b031982167f7965db0b00000000000000000000000000000000000000000000000000000000148061088457507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756108b481611ab9565b6108bd83611ac3565b73efefefefefefefefefefefefefefefefefefefef6001600160a01b0384160361093a573482146109355760405162461bcd60e51b815260206004820152600e60248201527f696e76616c696420616d6f756e7400000000000000000000000000000000000060448201526064015b60405180910390fd5b61099d565b34156109885760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964206d73672e76616c7565000000000000000000000000000000604482015260640161092c565b61099d6001600160a01b038416333085611bd9565b6001600160a01b0383166000908152609d60205260409020609b546000036109da578281600401546109cf9190612af7565b600490910155505050565b6109e384611829565b600382015560048101546109f79084612af7565b6000600483015581549093504210610a2057610a1662093a8084612b0a565b6001820155610a67565b8054600090610a30904290612b2c565b90506000826001015482610a449190612b3f565b9050610a508186612af7565b9450610a5f62093a8086612b0a565b600184015550505b4260028201819055610a7d9062093a8090612af7565b81556040518381526001600160a01b038516907fac24935fd910bc682b5ccb1a07b718cadf8cf2f6d1404c4f3ddc3662dae40e299060200160405180910390a2505b505050565b6001600160a01b038083166000908152609f60209081526040808320938516835292815282822083518085019094528054808552600190910154918401829052919291670de0b6b3a764000090610b1a86611829565b610b249190612b2c565b6001600160a01b0387166000908152609c6020526040902054610b479190612b3f565b610b519190612b0a565b610b5b9190612af7565b949350505050565b6001600160a01b038116610bb95760405162461bcd60e51b815260206004820152601060248201527f696e76616c6964205f6571625a61702100000000000000000000000000000000604482015260640161092c565b610bc48484846118eb565b610bee7fda13a707f7a3840d073818a6eaebbe54a724320b9a9d77ff1a6dccba94a770b382611c72565b50505050565b610c0033826001611d14565b50565b8160005b609a54811015610cd0576000609a8281548110610c2657610c26612b56565b60009182526020808320909101546001600160a01b0316808352609d9091526040909120909150610c5682611829565b6003820155610c648261110e565b60028201556001600160a01b038085166000908152609f60209081526040808320938616835292905220610c988584610ac4565b60018201556001600160a01b039092166000908152609d60205260409020600301549091555080610cc881612b6c565b915050610c07565b50610cda8161117a565b6001600160a01b03808316600090815260a1602090815260408083209490945560a09052919091204290558316610d535760405162461bcd60e51b815260206004820152600d60248201527f696e76616c6964205f666f722100000000000000000000000000000000000000604482015260640161092c565b60008211610da35760405162461bcd60e51b815260206004820152601b60248201527f526577617264506f6f6c203a2043616e6e6f74207374616b6520300000000000604482015260640161092c565b81609b54610db19190612af7565b609b556001600160a01b0383166000908152609c6020526040902054610dd8908390612af7565b6001600160a01b038085166000908152609c6020526040902091909155609954610e059116333085611bd9565b826001600160a01b03167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d83604051610e4091815260200190565b60405180910390a2505050565b600082815260656020526040902060010154610e6881611ab9565b610abf8383611c72565b6001600160a01b0381163314610ef05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c660000000000000000000000000000000000606482015260840161092c565b610efa8282611f12565b5050565b600054610100900460ff1615808015610f1e5750600054600160ff909116105b80610f385750303b158015610f38575060005460ff166001145b610faa5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161092c565b6000805460ff191660011790558015610fcd576000805461ff0019166101001790555b6001600160a01b0382166110235760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964205f626f6f7374657221000000000000000000000000000000604482015260640161092c565b61102b611f95565b6097805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03841617905561105e600084611c72565b6110887fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177583611c72565b6040516001600160a01b03831681527f5407aa361e671ca7c620332ea4c073198f8bc6125f2aceb4766a160b5afec1619060200160405180910390a18015610abf576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b6001600160a01b0381166000908152609d6020526040812054610884904290612012565b609a818154811061114257600080fd5b6000918252602090912001546001600160a01b0316905081565b336000818152609c602052604090205461117891906001611d14565b565b6001600160a01b038116600090815260a060205260408120548082036111a35750600092915050565b6001600160a01b0383166000908152609c6020526040812054908190036111e2575050506001600160a01b0316600090815260a1602052604090205490565b806111ed8342612b2c565b6111f79190612b3f565b6001600160a01b038516600090815260a16020526040902054610b5b9190612af7565b6099546040517f70a082310000000000000000000000000000000000000000000000000000000081523360048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561127c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a09190612b85565b9050610c00815b3360005b609a54811015611374576000609a82815481106112ca576112ca612b56565b60009182526020808320909101546001600160a01b0316808352609d90915260409091209091506112fa82611829565b60038201556113088261110e565b60028201556001600160a01b038085166000908152609f6020908152604080832093861683529290522061133c8584610ac4565b60018201556001600160a01b039092166000908152609d6020526040902060030154909155508061136c81612b6c565b9150506112ab565b5061137e8161117a565b6001600160a01b038216600090815260a1602090815260408083209390935560a0905220429055816113f25760405162461bcd60e51b815260206004820152601b60248201527f526577617264506f6f6c203a2043616e6e6f74207374616b6520300000000000604482015260640161092c565b81609b546114009190612af7565b609b55336000908152609c602052604090205461141e908390612af7565b336000818152609c602052604090209190915560995461144b916001600160a01b03909116903085611bd9565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9060200160405180910390a25050565b8060005b609a54811015611551576000609a82815481106114a7576114a7612b56565b60009182526020808320909101546001600160a01b0316808352609d90915260409091209091506114d782611829565b60038201556114e58261110e565b60028201556001600160a01b038085166000908152609f602090815260408083209386168352929052206115198584610ac4565b60018201556001600160a01b039092166000908152609d6020526040902060030154909155508061154981612b6c565b915050611488565b5061155b8161117a565b6001600160a01b038216600090815260a1602090815260408083209390935560a0905220429055610efa82612028565b6060609a8054806020026020016040519081016040528092919081815260200182805480156115e357602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116115c5575b5050505050905090565b60008281526065602052604090206001015461160881611ab9565b610abf8383611f12565b336000818152609c60205260408120549161162e918390611d14565b60405181815233907f2e39961a70a10f4d46383948095ac2752b3ee642a7c76aa827410aaff08c2e519060200160405180910390a250565b7fda13a707f7a3840d073818a6eaebbe54a724320b9a9d77ff1a6dccba94a770b361169081611ab9565b610abf83836001611d14565b6001600160a01b0382166000908152609e602052604090205460ff166117045760405162461bcd60e51b815260206004820152600d60248201527f696e76616c696420746f6b656e00000000000000000000000000000000000000604482015260640161092c565b73efefefefefefefefefefefefefefefefefefefef6001600160a01b0383160361177c573481146117775760405162461bcd60e51b815260206004820152600e60248201527f696e76616c696420616d6f756e74000000000000000000000000000000000000604482015260640161092c565b6117df565b34156117ca5760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964206d73672e76616c7565000000000000000000000000000000604482015260640161092c565b6117df6001600160a01b038316333084611bd9565b6001600160a01b0382166000908152609d6020526040902060040154611806908290612af7565b6001600160a01b039092166000908152609d602052604090206004019190915550565b6001600160a01b0381166000908152609d60209081526040808320815160a0810183528154815260018201549381019390935260028101549183019190915260038101546060830152600401546080820152609b5460000361188f576060015192915050565b609b54816020015182604001516118a58661110e565b6118af9190612b2c565b6118b99190612b3f565b6118cb90670de0b6b3a7640000612b3f565b6118d59190612b0a565b81606001516118e49190612af7565b9392505050565b3360009081527fffdfc1249c027f9191656349feb0761381bb32c9f557e01f419fd08754bf5a1b602052604090205460ff168061193257506097546001600160a01b031633145b61197e5760405162461bcd60e51b815260206004820152600560248201527f2161757468000000000000000000000000000000000000000000000000000000604482015260640161092c565b6099546001600160a01b0316156119d75760405162461bcd60e51b815260206004820152601c60248201527f706172616d73206861766520616c7265616479206265656e2073657400000000604482015260640161092c565b6001600160a01b038216611a2d5760405162461bcd60e51b815260206004820152601660248201527f696e76616c6964205f7374616b696e67546f6b656e2100000000000000000000604482015260640161092c565b6001600160a01b038116611a835760405162461bcd60e51b815260206004820152601560248201527f696e76616c6964205f726577617264546f6b656e210000000000000000000000604482015260640161092c565b60988390556099805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038416179055610abf81611ac3565b610c0081336121b3565b6001600160a01b038116611b195760405162461bcd60e51b815260206004820152601560248201527f696e76616c6964205f726577617264546f6b656e210000000000000000000000604482015260640161092c565b6001600160a01b0381166000908152609e602052604090205460ff1615611b3d5750565b609a805460018082019092557f44da158ba27f9252712a74ff6a55c5d531f69609f1f6e7f17c4443a8e2089be401805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091556000818152609e6020526040808220805460ff1916909417909355915190917ff3e4c2c64e71e6ba2eaab9a599bced62f9eb91d2cda610bf41aa8c80ff2cf82691a250565b6040516001600160a01b0380851660248301528316604482015260648101829052610bee9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152612233565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610efa5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611cd03390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b8260005b609a54811015611de1576000609a8281548110611d3757611d37612b56565b60009182526020808320909101546001600160a01b0316808352609d9091526040909120909150611d6782611829565b6003820155611d758261110e565b60028201556001600160a01b038085166000908152609f60209081526040808320938616835292905220611da98584610ac4565b60018201556001600160a01b039092166000908152609d60205260409020600301549091555080611dd981612b6c565b915050611d18565b50611deb8161117a565b6001600160a01b038216600090815260a1602090815260408083209390935560a090522042905582611e5f5760405162461bcd60e51b815260206004820152601e60248201527f526577617264506f6f6c203a2043616e6e6f7420776974686472617720300000604482015260640161092c565b82609b54611e6d9190612b2c565b609b556001600160a01b0384166000908152609c6020526040902054611e94908490612b2c565b6001600160a01b038086166000908152609c6020526040902091909155609954611ec091168585612318565b836001600160a01b03167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d584604051611efb91815260200190565b60405180910390a28115610bee57610bee84612028565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff1615610efa5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600054610100900460ff166111785760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840161092c565b600081831061202157816118e4565b5090919050565b60005b609a54811015610efa576000609a828154811061204a5761204a612b56565b60009182526020808320909101546001600160a01b038681168452609f8352604080852091909216808552925290912060010154909150801561219e576001600160a01b038085166000908152609f60209081526040808320938616808452939091528120600101556120be908583612348565b6097546098546040517f2dd0568300000000000000000000000000000000000000000000000000000000815260048101919091526001600160a01b03868116602483015284811660448301526064820184905290911690632dd0568390608401600060405180830381600087803b15801561213857600080fd5b505af115801561214c573d6000803e3d6000fd5b50505050816001600160a01b0316846001600160a01b03167f540798df468d7b23d11f156fdb954cb19ad414d150722a7b6d55ba369dea792e8360405161219591815260200190565b60405180910390a35b505080806121ab90612b6c565b91505061202b565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610efa576121f1816001600160a01b03166014612381565b6121fc836020612381565b60405160200161220d929190612bc2565b60408051601f198184030181529082905262461bcd60e51b825261092c91600401612c43565b6000612288826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166125629092919063ffffffff16565b805190915015610abf57808060200190518101906122a69190612c76565b610abf5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161092c565b6040516001600160a01b038316602482015260448101829052610abf90849063a9059cbb60e01b90606401611c26565b73efefefefefefefefefefefefefefefefefefefef6001600160a01b0384160361237657610abf8282612571565b610abf83838361263a565b60606000612390836002612b3f565b61239b906002612af7565b67ffffffffffffffff8111156123b3576123b3612c98565b6040519080825280601f01601f1916602001820160405280156123dd576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061241457612414612b56565b60200101906001600160f81b031916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061245f5761245f612b56565b60200101906001600160f81b031916908160001a9053506000612483846002612b3f565b61248e906001612af7565b90505b6001811115612513577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106124cf576124cf612b56565b1a60f81b8282815181106124e5576124e5612b56565b60200101906001600160f81b031916908160001a90535060049490941c9361250c81612cae565b9050612491565b5083156118e45760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161092c565b6060610b5b8484600085612790565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146125be576040519150601f19603f3d011682016040523d82523d6000602084013e6125c3565b606091505b5050905080610abf5760405162461bcd60e51b815260206004820152602260248201527f5472616e7366657248656c7065723a2053656e64696e6720455448206661696c60448201527f6564000000000000000000000000000000000000000000000000000000000000606482015260840161092c565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b17905291516000928392908716916126ab9190612cc5565b6000604051808303816000865af19150503d80600081146126e8576040519150601f19603f3d011682016040523d82523d6000602084013e6126ed565b606091505b50915091508180156127175750805115806127175750808060200190518101906127179190612c76565b6127895760405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201527f616e73666572206661696c656400000000000000000000000000000000000000606482015260840161092c565b5050505050565b6060824710156128085760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161092c565b6001600160a01b0385163b61285f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161092c565b600080866001600160a01b0316858760405161287b9190612cc5565b60006040518083038185875af1925050503d80600081146128b8576040519150601f19603f3d011682016040523d82523d6000602084013e6128bd565b606091505b50915091506128cd8282866128d8565b979650505050505050565b606083156128e75750816118e4565b8251156128f75782518084602001fd5b8160405162461bcd60e51b815260040161092c9190612c43565b60006020828403121561292357600080fd5b81356001600160e01b0319811681146118e457600080fd5b80356001600160a01b038116811461295257600080fd5b919050565b6000806040838503121561296a57600080fd5b6129738361293b565b946020939093013593505050565b60006020828403121561299357600080fd5b6118e48261293b565b600080604083850312156129af57600080fd5b6129b88361293b565b91506129c66020840161293b565b90509250929050565b6000602082840312156129e157600080fd5b5035919050565b600080600080608085870312156129fe57600080fd5b84359350612a0e6020860161293b565b9250612a1c6040860161293b565b9150612a2a6060860161293b565b905092959194509250565b60008060408385031215612a4857600080fd5b823591506129c66020840161293b565b6020808252825182820181905260009190848201906040850190845b81811015612a995783516001600160a01b031683529284019291840191600101612a74565b50909695505050505050565b600080600060608486031215612aba57600080fd5b83359250612aca6020850161293b565b9150612ad86040850161293b565b90509250925092565b634e487b7160e01b600052601160045260246000fd5b8082018082111561088457610884612ae1565b600082612b2757634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561088457610884612ae1565b808202811582820484141761088457610884612ae1565b634e487b7160e01b600052603260045260246000fd5b600060018201612b7e57612b7e612ae1565b5060010190565b600060208284031215612b9757600080fd5b5051919050565b60005b83811015612bb9578181015183820152602001612ba1565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612bfa816017850160208801612b9e565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612c37816028840160208801612b9e565b01602801949350505050565b6020815260008251806020840152612c62816040850160208701612b9e565b601f01601f19169190910160400192915050565b600060208284031215612c8857600080fd5b815180151581146118e457600080fd5b634e487b7160e01b600052604160045260246000fd5b600081612cbd57612cbd612ae1565b506000190190565b60008251612cd7818460208701612b9e565b919091019291505056fea26469706673582212208f93f8e20e21e41c0d7124d4c34ef57f7c6b6b3cc48c88f5a6593a44842ceb0164736f6c63430008110033
Deployed Bytecode
0x6080604052600436106102895760003560e01c806386b8ea2011610153578063c4f59f9b116100cb578063db518db21161007f578063f106845411610064578063f1068454146107cb578063f1229777146107e1578063f376d7981461080157600080fd5b8063db518db214610798578063e69d849d146107b857600080fd5b8063d47c3bf8116100b0578063d47c3bf814610736578063d547741f14610763578063db2e21bc1461078357600080fd5b8063c4f59f9b146106f4578063c6def0761461071657600080fd5b8063a694fc3a11610122578063b5fd73f811610107578063b5fd73f814610677578063b65a7ea5146106a7578063c00007b0146106d457600080fd5b8063a694fc3a14610603578063a980356a1461062357600080fd5b806386b8ea20146105735780638dcb40611461059357806391d14854146105a8578063a217fddf146105ee57600080fd5b80632e1a7d4d11610201578063638634ee116101b557806372f702f31161019a57806372f702f3146105065780637bb7bed11461053e578063853828b61461055e57600080fd5b8063638634ee146104b057806370a08231146104d057600080fd5b80632f2ff15d116101e65780632f2ff15d1461045057806336568abe14610470578063485cc9551461049057600080fd5b80632e1a7d4d146104105780632ee409081461043057600080fd5b806318160ddd11610258578063248a9ca31161023d578063248a9ca3146103ab5780632521cdd8146103db5780632cf404dc146103f057600080fd5b806318160ddd14610376578063211dc32d1461038b57600080fd5b806301ffc9a71461029557806304d0c2c5146102ca5780630700037d146102df5780630fb5a6b41461035157600080fd5b3661029057005b600080fd5b3480156102a157600080fd5b506102b56102b0366004612911565b610821565b60405190151581526020015b60405180910390f35b6102dd6102d8366004612957565b61088a565b005b3480156102eb57600080fd5b506103296102fa366004612981565b609d60205260009081526040902080546001820154600283015460038401546004909401549293919290919085565b604080519586526020860194909452928401919091526060830152608082015260a0016102c1565b34801561035d57600080fd5b5061036862093a8081565b6040519081526020016102c1565b34801561038257600080fd5b50609b54610368565b34801561039757600080fd5b506103686103a636600461299c565b610ac4565b3480156103b757600080fd5b506103686103c63660046129cf565b60009081526065602052604090206001015490565b3480156103e757600080fd5b50609a54610368565b3480156103fc57600080fd5b506102dd61040b3660046129e8565b610b63565b34801561041c57600080fd5b506102dd61042b3660046129cf565b610bf4565b34801561043c57600080fd5b506102dd61044b366004612957565b610c03565b34801561045c57600080fd5b506102dd61046b366004612a35565b610e4d565b34801561047c57600080fd5b506102dd61048b366004612a35565b610e72565b34801561049c57600080fd5b506102dd6104ab36600461299c565b610efe565b3480156104bc57600080fd5b506103686104cb366004612981565b61110e565b3480156104dc57600080fd5b506103686104eb366004612981565b6001600160a01b03166000908152609c602052604090205490565b34801561051257600080fd5b50609954610526906001600160a01b031681565b6040516001600160a01b0390911681526020016102c1565b34801561054a57600080fd5b506105266105593660046129cf565b611132565b34801561056a57600080fd5b506102dd61115c565b34801561057f57600080fd5b5061036861058e366004612981565b61117a565b34801561059f57600080fd5b506102dd61121a565b3480156105b457600080fd5b506102b56105c3366004612a35565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156105fa57600080fd5b50610368600081565b34801561060f57600080fd5b506102dd61061e3660046129cf565b6112a7565b34801561062f57600080fd5b5061066261063e36600461299c565b609f6020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152016102c1565b34801561068357600080fd5b506102b5610692366004612981565b609e6020526000908152604090205460ff1681565b3480156106b357600080fd5b506103686106c2366004612981565b60a06020526000908152604090205481565b3480156106e057600080fd5b506102dd6106ef366004612981565b611484565b34801561070057600080fd5b5061070961158b565b6040516102c19190612a58565b34801561072257600080fd5b50609754610526906001600160a01b031681565b34801561074257600080fd5b50610368610751366004612981565b60a16020526000908152604090205481565b34801561076f57600080fd5b506102dd61077e366004612a35565b6115ed565b34801561078f57600080fd5b506102dd611612565b3480156107a457600080fd5b506102dd6107b3366004612957565b611666565b6102dd6107c6366004612957565b61169c565b3480156107d757600080fd5b5061036860985481565b3480156107ed57600080fd5b506103686107fc366004612981565b611829565b34801561080d57600080fd5b506102dd61081c366004612aa5565b6118eb565b60006001600160e01b031982167f7965db0b00000000000000000000000000000000000000000000000000000000148061088457507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756108b481611ab9565b6108bd83611ac3565b73efefefefefefefefefefefefefefefefefefefef6001600160a01b0384160361093a573482146109355760405162461bcd60e51b815260206004820152600e60248201527f696e76616c696420616d6f756e7400000000000000000000000000000000000060448201526064015b60405180910390fd5b61099d565b34156109885760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964206d73672e76616c7565000000000000000000000000000000604482015260640161092c565b61099d6001600160a01b038416333085611bd9565b6001600160a01b0383166000908152609d60205260409020609b546000036109da578281600401546109cf9190612af7565b600490910155505050565b6109e384611829565b600382015560048101546109f79084612af7565b6000600483015581549093504210610a2057610a1662093a8084612b0a565b6001820155610a67565b8054600090610a30904290612b2c565b90506000826001015482610a449190612b3f565b9050610a508186612af7565b9450610a5f62093a8086612b0a565b600184015550505b4260028201819055610a7d9062093a8090612af7565b81556040518381526001600160a01b038516907fac24935fd910bc682b5ccb1a07b718cadf8cf2f6d1404c4f3ddc3662dae40e299060200160405180910390a2505b505050565b6001600160a01b038083166000908152609f60209081526040808320938516835292815282822083518085019094528054808552600190910154918401829052919291670de0b6b3a764000090610b1a86611829565b610b249190612b2c565b6001600160a01b0387166000908152609c6020526040902054610b479190612b3f565b610b519190612b0a565b610b5b9190612af7565b949350505050565b6001600160a01b038116610bb95760405162461bcd60e51b815260206004820152601060248201527f696e76616c6964205f6571625a61702100000000000000000000000000000000604482015260640161092c565b610bc48484846118eb565b610bee7fda13a707f7a3840d073818a6eaebbe54a724320b9a9d77ff1a6dccba94a770b382611c72565b50505050565b610c0033826001611d14565b50565b8160005b609a54811015610cd0576000609a8281548110610c2657610c26612b56565b60009182526020808320909101546001600160a01b0316808352609d9091526040909120909150610c5682611829565b6003820155610c648261110e565b60028201556001600160a01b038085166000908152609f60209081526040808320938616835292905220610c988584610ac4565b60018201556001600160a01b039092166000908152609d60205260409020600301549091555080610cc881612b6c565b915050610c07565b50610cda8161117a565b6001600160a01b03808316600090815260a1602090815260408083209490945560a09052919091204290558316610d535760405162461bcd60e51b815260206004820152600d60248201527f696e76616c6964205f666f722100000000000000000000000000000000000000604482015260640161092c565b60008211610da35760405162461bcd60e51b815260206004820152601b60248201527f526577617264506f6f6c203a2043616e6e6f74207374616b6520300000000000604482015260640161092c565b81609b54610db19190612af7565b609b556001600160a01b0383166000908152609c6020526040902054610dd8908390612af7565b6001600160a01b038085166000908152609c6020526040902091909155609954610e059116333085611bd9565b826001600160a01b03167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d83604051610e4091815260200190565b60405180910390a2505050565b600082815260656020526040902060010154610e6881611ab9565b610abf8383611c72565b6001600160a01b0381163314610ef05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c660000000000000000000000000000000000606482015260840161092c565b610efa8282611f12565b5050565b600054610100900460ff1615808015610f1e5750600054600160ff909116105b80610f385750303b158015610f38575060005460ff166001145b610faa5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161092c565b6000805460ff191660011790558015610fcd576000805461ff0019166101001790555b6001600160a01b0382166110235760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964205f626f6f7374657221000000000000000000000000000000604482015260640161092c565b61102b611f95565b6097805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03841617905561105e600084611c72565b6110887fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177583611c72565b6040516001600160a01b03831681527f5407aa361e671ca7c620332ea4c073198f8bc6125f2aceb4766a160b5afec1619060200160405180910390a18015610abf576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b6001600160a01b0381166000908152609d6020526040812054610884904290612012565b609a818154811061114257600080fd5b6000918252602090912001546001600160a01b0316905081565b336000818152609c602052604090205461117891906001611d14565b565b6001600160a01b038116600090815260a060205260408120548082036111a35750600092915050565b6001600160a01b0383166000908152609c6020526040812054908190036111e2575050506001600160a01b0316600090815260a1602052604090205490565b806111ed8342612b2c565b6111f79190612b3f565b6001600160a01b038516600090815260a16020526040902054610b5b9190612af7565b6099546040517f70a082310000000000000000000000000000000000000000000000000000000081523360048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561127c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a09190612b85565b9050610c00815b3360005b609a54811015611374576000609a82815481106112ca576112ca612b56565b60009182526020808320909101546001600160a01b0316808352609d90915260409091209091506112fa82611829565b60038201556113088261110e565b60028201556001600160a01b038085166000908152609f6020908152604080832093861683529290522061133c8584610ac4565b60018201556001600160a01b039092166000908152609d6020526040902060030154909155508061136c81612b6c565b9150506112ab565b5061137e8161117a565b6001600160a01b038216600090815260a1602090815260408083209390935560a0905220429055816113f25760405162461bcd60e51b815260206004820152601b60248201527f526577617264506f6f6c203a2043616e6e6f74207374616b6520300000000000604482015260640161092c565b81609b546114009190612af7565b609b55336000908152609c602052604090205461141e908390612af7565b336000818152609c602052604090209190915560995461144b916001600160a01b03909116903085611bd9565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9060200160405180910390a25050565b8060005b609a54811015611551576000609a82815481106114a7576114a7612b56565b60009182526020808320909101546001600160a01b0316808352609d90915260409091209091506114d782611829565b60038201556114e58261110e565b60028201556001600160a01b038085166000908152609f602090815260408083209386168352929052206115198584610ac4565b60018201556001600160a01b039092166000908152609d6020526040902060030154909155508061154981612b6c565b915050611488565b5061155b8161117a565b6001600160a01b038216600090815260a1602090815260408083209390935560a0905220429055610efa82612028565b6060609a8054806020026020016040519081016040528092919081815260200182805480156115e357602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116115c5575b5050505050905090565b60008281526065602052604090206001015461160881611ab9565b610abf8383611f12565b336000818152609c60205260408120549161162e918390611d14565b60405181815233907f2e39961a70a10f4d46383948095ac2752b3ee642a7c76aa827410aaff08c2e519060200160405180910390a250565b7fda13a707f7a3840d073818a6eaebbe54a724320b9a9d77ff1a6dccba94a770b361169081611ab9565b610abf83836001611d14565b6001600160a01b0382166000908152609e602052604090205460ff166117045760405162461bcd60e51b815260206004820152600d60248201527f696e76616c696420746f6b656e00000000000000000000000000000000000000604482015260640161092c565b73efefefefefefefefefefefefefefefefefefefef6001600160a01b0383160361177c573481146117775760405162461bcd60e51b815260206004820152600e60248201527f696e76616c696420616d6f756e74000000000000000000000000000000000000604482015260640161092c565b6117df565b34156117ca5760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964206d73672e76616c7565000000000000000000000000000000604482015260640161092c565b6117df6001600160a01b038316333084611bd9565b6001600160a01b0382166000908152609d6020526040902060040154611806908290612af7565b6001600160a01b039092166000908152609d602052604090206004019190915550565b6001600160a01b0381166000908152609d60209081526040808320815160a0810183528154815260018201549381019390935260028101549183019190915260038101546060830152600401546080820152609b5460000361188f576060015192915050565b609b54816020015182604001516118a58661110e565b6118af9190612b2c565b6118b99190612b3f565b6118cb90670de0b6b3a7640000612b3f565b6118d59190612b0a565b81606001516118e49190612af7565b9392505050565b3360009081527fffdfc1249c027f9191656349feb0761381bb32c9f557e01f419fd08754bf5a1b602052604090205460ff168061193257506097546001600160a01b031633145b61197e5760405162461bcd60e51b815260206004820152600560248201527f2161757468000000000000000000000000000000000000000000000000000000604482015260640161092c565b6099546001600160a01b0316156119d75760405162461bcd60e51b815260206004820152601c60248201527f706172616d73206861766520616c7265616479206265656e2073657400000000604482015260640161092c565b6001600160a01b038216611a2d5760405162461bcd60e51b815260206004820152601660248201527f696e76616c6964205f7374616b696e67546f6b656e2100000000000000000000604482015260640161092c565b6001600160a01b038116611a835760405162461bcd60e51b815260206004820152601560248201527f696e76616c6964205f726577617264546f6b656e210000000000000000000000604482015260640161092c565b60988390556099805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038416179055610abf81611ac3565b610c0081336121b3565b6001600160a01b038116611b195760405162461bcd60e51b815260206004820152601560248201527f696e76616c6964205f726577617264546f6b656e210000000000000000000000604482015260640161092c565b6001600160a01b0381166000908152609e602052604090205460ff1615611b3d5750565b609a805460018082019092557f44da158ba27f9252712a74ff6a55c5d531f69609f1f6e7f17c4443a8e2089be401805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091556000818152609e6020526040808220805460ff1916909417909355915190917ff3e4c2c64e71e6ba2eaab9a599bced62f9eb91d2cda610bf41aa8c80ff2cf82691a250565b6040516001600160a01b0380851660248301528316604482015260648101829052610bee9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152612233565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610efa5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611cd03390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b8260005b609a54811015611de1576000609a8281548110611d3757611d37612b56565b60009182526020808320909101546001600160a01b0316808352609d9091526040909120909150611d6782611829565b6003820155611d758261110e565b60028201556001600160a01b038085166000908152609f60209081526040808320938616835292905220611da98584610ac4565b60018201556001600160a01b039092166000908152609d60205260409020600301549091555080611dd981612b6c565b915050611d18565b50611deb8161117a565b6001600160a01b038216600090815260a1602090815260408083209390935560a090522042905582611e5f5760405162461bcd60e51b815260206004820152601e60248201527f526577617264506f6f6c203a2043616e6e6f7420776974686472617720300000604482015260640161092c565b82609b54611e6d9190612b2c565b609b556001600160a01b0384166000908152609c6020526040902054611e94908490612b2c565b6001600160a01b038086166000908152609c6020526040902091909155609954611ec091168585612318565b836001600160a01b03167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d584604051611efb91815260200190565b60405180910390a28115610bee57610bee84612028565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff1615610efa5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600054610100900460ff166111785760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840161092c565b600081831061202157816118e4565b5090919050565b60005b609a54811015610efa576000609a828154811061204a5761204a612b56565b60009182526020808320909101546001600160a01b038681168452609f8352604080852091909216808552925290912060010154909150801561219e576001600160a01b038085166000908152609f60209081526040808320938616808452939091528120600101556120be908583612348565b6097546098546040517f2dd0568300000000000000000000000000000000000000000000000000000000815260048101919091526001600160a01b03868116602483015284811660448301526064820184905290911690632dd0568390608401600060405180830381600087803b15801561213857600080fd5b505af115801561214c573d6000803e3d6000fd5b50505050816001600160a01b0316846001600160a01b03167f540798df468d7b23d11f156fdb954cb19ad414d150722a7b6d55ba369dea792e8360405161219591815260200190565b60405180910390a35b505080806121ab90612b6c565b91505061202b565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610efa576121f1816001600160a01b03166014612381565b6121fc836020612381565b60405160200161220d929190612bc2565b60408051601f198184030181529082905262461bcd60e51b825261092c91600401612c43565b6000612288826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166125629092919063ffffffff16565b805190915015610abf57808060200190518101906122a69190612c76565b610abf5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161092c565b6040516001600160a01b038316602482015260448101829052610abf90849063a9059cbb60e01b90606401611c26565b73efefefefefefefefefefefefefefefefefefefef6001600160a01b0384160361237657610abf8282612571565b610abf83838361263a565b60606000612390836002612b3f565b61239b906002612af7565b67ffffffffffffffff8111156123b3576123b3612c98565b6040519080825280601f01601f1916602001820160405280156123dd576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061241457612414612b56565b60200101906001600160f81b031916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061245f5761245f612b56565b60200101906001600160f81b031916908160001a9053506000612483846002612b3f565b61248e906001612af7565b90505b6001811115612513577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106124cf576124cf612b56565b1a60f81b8282815181106124e5576124e5612b56565b60200101906001600160f81b031916908160001a90535060049490941c9361250c81612cae565b9050612491565b5083156118e45760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161092c565b6060610b5b8484600085612790565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146125be576040519150601f19603f3d011682016040523d82523d6000602084013e6125c3565b606091505b5050905080610abf5760405162461bcd60e51b815260206004820152602260248201527f5472616e7366657248656c7065723a2053656e64696e6720455448206661696c60448201527f6564000000000000000000000000000000000000000000000000000000000000606482015260840161092c565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b17905291516000928392908716916126ab9190612cc5565b6000604051808303816000865af19150503d80600081146126e8576040519150601f19603f3d011682016040523d82523d6000602084013e6126ed565b606091505b50915091508180156127175750805115806127175750808060200190518101906127179190612c76565b6127895760405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201527f616e73666572206661696c656400000000000000000000000000000000000000606482015260840161092c565b5050505050565b6060824710156128085760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161092c565b6001600160a01b0385163b61285f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161092c565b600080866001600160a01b0316858760405161287b9190612cc5565b60006040518083038185875af1925050503d80600081146128b8576040519150601f19603f3d011682016040523d82523d6000602084013e6128bd565b606091505b50915091506128cd8282866128d8565b979650505050505050565b606083156128e75750816118e4565b8251156128f75782518084602001fd5b8160405162461bcd60e51b815260040161092c9190612c43565b60006020828403121561292357600080fd5b81356001600160e01b0319811681146118e457600080fd5b80356001600160a01b038116811461295257600080fd5b919050565b6000806040838503121561296a57600080fd5b6129738361293b565b946020939093013593505050565b60006020828403121561299357600080fd5b6118e48261293b565b600080604083850312156129af57600080fd5b6129b88361293b565b91506129c66020840161293b565b90509250929050565b6000602082840312156129e157600080fd5b5035919050565b600080600080608085870312156129fe57600080fd5b84359350612a0e6020860161293b565b9250612a1c6040860161293b565b9150612a2a6060860161293b565b905092959194509250565b60008060408385031215612a4857600080fd5b823591506129c66020840161293b565b6020808252825182820181905260009190848201906040850190845b81811015612a995783516001600160a01b031683529284019291840191600101612a74565b50909695505050505050565b600080600060608486031215612aba57600080fd5b83359250612aca6020850161293b565b9150612ad86040850161293b565b90509250925092565b634e487b7160e01b600052601160045260246000fd5b8082018082111561088457610884612ae1565b600082612b2757634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561088457610884612ae1565b808202811582820484141761088457610884612ae1565b634e487b7160e01b600052603260045260246000fd5b600060018201612b7e57612b7e612ae1565b5060010190565b600060208284031215612b9757600080fd5b5051919050565b60005b83811015612bb9578181015183820152602001612ba1565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612bfa816017850160208801612b9e565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612c37816028840160208801612b9e565b01602801949350505050565b6020815260008251806020840152612c62816040850160208701612b9e565b601f01601f19169190910160400192915050565b600060208284031215612c8857600080fd5b815180151581146118e457600080fd5b634e487b7160e01b600052604160045260246000fd5b600081612cbd57612cbd612ae1565b506000190190565b60008251612cd7818460208701612b9e565b919091019291505056fea26469706673582212208f93f8e20e21e41c0d7124d4c34ef57f7c6b6b3cc48c88f5a6593a44842ceb0164736f6c63430008110033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.