Overview
MNT Balance
0 MNT
MNT Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Loading...
Loading
Contract Name:
BaseRewardPool
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 "./Interfaces/IBaseRewardPool.sol"; import "./Interfaces/IPendleBooster.sol"; import "@shared/lib-contracts-v0.8/contracts/Dependencies/TransferHelper.sol"; contract BaseRewardPool is IBaseRewardPool, 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; bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); bytes32 public constant ZAP_ROLE = keccak256("ZAP_ROLE"); /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } function initialize(address _booster) public initializer { require(_booster != address(0), "invalid _booster!"); __AccessControl_init(); booster = _booster; _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(ADMIN_ROLE, _booster); emit BoosterUpdated(_booster); } function setParams( uint256 _pid, address _stakingToken, address _rewardToken ) external 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 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(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(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; 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; 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
[{"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":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ZAP_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":"_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"}],"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
60806040523480156200001157600080fd5b506200001c62000022565b620000e4565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e2576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b612ca180620000f46000396000f3fe6080604052600436106102a45760003560e01c806386b8ea201161016e578063c4f59f9b116100cb578063db518db21161007f578063f106845411610064578063f10684541461082e578063f122977714610844578063f376d7981461086457600080fd5b8063db518db2146107fb578063e69d849d1461081b57600080fd5b8063d47c3bf8116100b0578063d47c3bf814610799578063d547741f146107c6578063db2e21bc146107e657600080fd5b8063c4f59f9b14610757578063c6def0761461077957600080fd5b8063a980356a11610122578063b65a7ea511610107578063b65a7ea5146106ea578063c00007b014610717578063c4d66de81461073757600080fd5b8063a980356a14610666578063b5fd73f8146106ba57600080fd5b806391d148541161015357806391d14854146105eb578063a217fddf14610631578063a694fc3a1461064657600080fd5b806386b8ea20146105b65780638dcb4061146105d657600080fd5b80632ee409081161021c57806370a08231116101d057806375b238fc116101b557806375b238fc1461054d5780637bb7bed114610581578063853828b6146105a157600080fd5b806370a08231146104df57806372f702f31461051557600080fd5b806336568abe1161020157806336568abe1461046b5780636343ef051461048b578063638634ee146104bf57600080fd5b80632ee409081461042b5780632f2ff15d1461044b57600080fd5b806318160ddd11610273578063248a9ca311610258578063248a9ca3146103c65780632521cdd8146103f65780632e1a7d4d1461040b57600080fd5b806318160ddd14610391578063211dc32d146103a657600080fd5b806301ffc9a7146102b057806304d0c2c5146102e55780630700037d146102fa5780630fb5a6b41461036c57600080fd5b366102ab57005b600080fd5b3480156102bc57600080fd5b506102d06102cb3660046128e8565b610884565b60405190151581526020015b60405180910390f35b6102f86102f336600461292e565b6108ed565b005b34801561030657600080fd5b50610344610315366004612958565b609d60205260009081526040902080546001820154600283015460038401546004909401549293919290919085565b604080519586526020860194909452928401919091526060830152608082015260a0016102dc565b34801561037857600080fd5b5061038362093a8081565b6040519081526020016102dc565b34801561039d57600080fd5b50609b54610383565b3480156103b257600080fd5b506103836103c1366004612973565b610b27565b3480156103d257600080fd5b506103836103e13660046129a6565b60009081526065602052604090206001015490565b34801561040257600080fd5b50609a54610383565b34801561041757600080fd5b506102f86104263660046129a6565b610bc6565b34801561043757600080fd5b506102f861044636600461292e565b610bd5565b34801561045757600080fd5b506102f86104663660046129bf565b610e1f565b34801561047757600080fd5b506102f86104863660046129bf565b610e44565b34801561049757600080fd5b506103837fda13a707f7a3840d073818a6eaebbe54a724320b9a9d77ff1a6dccba94a770b381565b3480156104cb57600080fd5b506103836104da366004612958565b610ed0565b3480156104eb57600080fd5b506103836104fa366004612958565b6001600160a01b03166000908152609c602052604090205490565b34801561052157600080fd5b50609954610535906001600160a01b031681565b6040516001600160a01b0390911681526020016102dc565b34801561055957600080fd5b506103837fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b34801561058d57600080fd5b5061053561059c3660046129a6565b610ef4565b3480156105ad57600080fd5b506102f8610f1e565b3480156105c257600080fd5b506103836105d1366004612958565b610f3c565b3480156105e257600080fd5b506102f8610fdc565b3480156105f757600080fd5b506102d06106063660046129bf565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561063d57600080fd5b50610383600081565b34801561065257600080fd5b506102f86106613660046129a6565b611069565b34801561067257600080fd5b506106a5610681366004612973565b609f6020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152016102dc565b3480156106c657600080fd5b506102d06106d5366004612958565b609e6020526000908152604090205460ff1681565b3480156106f657600080fd5b50610383610705366004612958565b60a06020526000908152604090205481565b34801561072357600080fd5b506102f8610732366004612958565b611246565b34801561074357600080fd5b506102f8610752366004612958565b61134d565b34801561076357600080fd5b5061076c61155c565b6040516102dc91906129e2565b34801561078557600080fd5b50609754610535906001600160a01b031681565b3480156107a557600080fd5b506103836107b4366004612958565b60a16020526000908152604090205481565b3480156107d257600080fd5b506102f86107e13660046129bf565b6115be565b3480156107f257600080fd5b506102f86115e3565b34801561080757600080fd5b506102f861081636600461292e565b611637565b6102f861082936600461292e565b61166d565b34801561083a57600080fd5b5061038360985481565b34801561085057600080fd5b5061038361085f366004612958565b6117fa565b34801561087057600080fd5b506102f861087f366004612a2f565b6118bc565b60006001600160e01b031982167f7965db0b0000000000000000000000000000000000000000000000000000000014806108e757507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177561091781611a8a565b61092083611a94565b73efefefefefefefefefefefefefefefefefefefef6001600160a01b0384160361099d573482146109985760405162461bcd60e51b815260206004820152600e60248201527f696e76616c696420616d6f756e7400000000000000000000000000000000000060448201526064015b60405180910390fd5b610a00565b34156109eb5760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964206d73672e76616c7565000000000000000000000000000000604482015260640161098f565b610a006001600160a01b038416333085611baa565b6001600160a01b0383166000908152609d60205260409020609b54600003610a3d57828160040154610a329190612a81565b600490910155505050565b610a46846117fa565b60038201556004810154610a5a9084612a81565b6000600483015581549093504210610a8357610a7962093a8084612a94565b6001820155610aca565b8054600090610a93904290612ab6565b90506000826001015482610aa79190612ac9565b9050610ab38186612a81565b9450610ac262093a8086612a94565b600184015550505b4260028201819055610ae09062093a8090612a81565b81556040518381526001600160a01b038516907fac24935fd910bc682b5ccb1a07b718cadf8cf2f6d1404c4f3ddc3662dae40e299060200160405180910390a2505b505050565b6001600160a01b038083166000908152609f60209081526040808320938516835292815282822083518085019094528054808552600190910154918401829052919291670de0b6b3a764000090610b7d866117fa565b610b879190612ab6565b6001600160a01b0387166000908152609c6020526040902054610baa9190612ac9565b610bb49190612a94565b610bbe9190612a81565b949350505050565b610bd233826001611c49565b50565b8160005b609a54811015610ca2576000609a8281548110610bf857610bf8612ae0565b60009182526020808320909101546001600160a01b0316808352609d9091526040909120909150610c28826117fa565b6003820155610c3682610ed0565b60028201556001600160a01b038085166000908152609f60209081526040808320938616835292905220610c6a8584610b27565b60018201556001600160a01b039092166000908152609d60205260409020600301549091555080610c9a81612af6565b915050610bd9565b50610cac81610f3c565b6001600160a01b03808316600090815260a1602090815260408083209490945560a09052919091204290558316610d255760405162461bcd60e51b815260206004820152600d60248201527f696e76616c6964205f666f722100000000000000000000000000000000000000604482015260640161098f565b60008211610d755760405162461bcd60e51b815260206004820152601b60248201527f526577617264506f6f6c203a2043616e6e6f74207374616b6520300000000000604482015260640161098f565b81609b54610d839190612a81565b609b556001600160a01b0383166000908152609c6020526040902054610daa908390612a81565b6001600160a01b038085166000908152609c6020526040902091909155609954610dd79116333085611baa565b826001600160a01b03167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d83604051610e1291815260200190565b60405180910390a2505050565b600082815260656020526040902060010154610e3a81611a8a565b610b228383611e47565b6001600160a01b0381163314610ec25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c660000000000000000000000000000000000606482015260840161098f565b610ecc8282611ee9565b5050565b6001600160a01b0381166000908152609d60205260408120546108e7904290611f6c565b609a8181548110610f0457600080fd5b6000918252602090912001546001600160a01b0316905081565b336000818152609c6020526040902054610f3a91906001611c49565b565b6001600160a01b038116600090815260a06020526040812054808203610f655750600092915050565b6001600160a01b0383166000908152609c602052604081205490819003610fa4575050506001600160a01b0316600090815260a1602052604090205490565b80610faf8342612ab6565b610fb99190612ac9565b6001600160a01b038516600090815260a16020526040902054610bbe9190612a81565b6099546040517f70a082310000000000000000000000000000000000000000000000000000000081523360048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561103e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110629190612b0f565b9050610bd2815b3360005b609a54811015611136576000609a828154811061108c5761108c612ae0565b60009182526020808320909101546001600160a01b0316808352609d90915260409091209091506110bc826117fa565b60038201556110ca82610ed0565b60028201556001600160a01b038085166000908152609f602090815260408083209386168352929052206110fe8584610b27565b60018201556001600160a01b039092166000908152609d6020526040902060030154909155508061112e81612af6565b91505061106d565b5061114081610f3c565b6001600160a01b038216600090815260a1602090815260408083209390935560a0905220429055816111b45760405162461bcd60e51b815260206004820152601b60248201527f526577617264506f6f6c203a2043616e6e6f74207374616b6520300000000000604482015260640161098f565b81609b546111c29190612a81565b609b55336000908152609c60205260409020546111e0908390612a81565b336000818152609c602052604090209190915560995461120d916001600160a01b03909116903085611baa565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9060200160405180910390a25050565b8060005b609a54811015611313576000609a828154811061126957611269612ae0565b60009182526020808320909101546001600160a01b0316808352609d9091526040909120909150611299826117fa565b60038201556112a782610ed0565b60028201556001600160a01b038085166000908152609f602090815260408083209386168352929052206112db8584610b27565b60018201556001600160a01b039092166000908152609d6020526040902060030154909155508061130b81612af6565b91505061124a565b5061131d81610f3c565b6001600160a01b038216600090815260a1602090815260408083209390935560a0905220429055610ecc82611f82565b600054610100900460ff161580801561136d5750600054600160ff909116105b806113875750303b158015611387575060005460ff166001145b6113f95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161098f565b6000805460ff19166001179055801561141c576000805461ff0019166101001790555b6001600160a01b0382166114725760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964205f626f6f7374657221000000000000000000000000000000604482015260640161098f565b61147a61210d565b6097805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384161790556114ad600033611e47565b6114d77fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177583611e47565b6040516001600160a01b03831681527f5407aa361e671ca7c620332ea4c073198f8bc6125f2aceb4766a160b5afec1619060200160405180910390a18015610ecc576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6060609a8054806020026020016040519081016040528092919081815260200182805480156115b457602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611596575b5050505050905090565b6000828152606560205260409020600101546115d981611a8a565b610b228383611ee9565b336000818152609c6020526040812054916115ff918390611c49565b60405181815233907f2e39961a70a10f4d46383948095ac2752b3ee642a7c76aa827410aaff08c2e519060200160405180910390a250565b7fda13a707f7a3840d073818a6eaebbe54a724320b9a9d77ff1a6dccba94a770b361166181611a8a565b610b2283836001611c49565b6001600160a01b0382166000908152609e602052604090205460ff166116d55760405162461bcd60e51b815260206004820152600d60248201527f696e76616c696420746f6b656e00000000000000000000000000000000000000604482015260640161098f565b73efefefefefefefefefefefefefefefefefefefef6001600160a01b0383160361174d573481146117485760405162461bcd60e51b815260206004820152600e60248201527f696e76616c696420616d6f756e74000000000000000000000000000000000000604482015260640161098f565b6117b0565b341561179b5760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964206d73672e76616c7565000000000000000000000000000000604482015260640161098f565b6117b06001600160a01b038316333084611baa565b6001600160a01b0382166000908152609d60205260409020600401546117d7908290612a81565b6001600160a01b039092166000908152609d602052604090206004019190915550565b6001600160a01b0381166000908152609d60209081526040808320815160a0810183528154815260018201549381019390935260028101549183019190915260038101546060830152600401546080820152609b54600003611860576060015192915050565b609b548160200151826040015161187686610ed0565b6118809190612ab6565b61188a9190612ac9565b61189c90670de0b6b3a7640000612ac9565b6118a69190612a94565b81606001516118b59190612a81565b9392505050565b3360009081527fffdfc1249c027f9191656349feb0761381bb32c9f557e01f419fd08754bf5a1b602052604090205460ff168061190357506097546001600160a01b031633145b61194f5760405162461bcd60e51b815260206004820152600560248201527f2161757468000000000000000000000000000000000000000000000000000000604482015260640161098f565b6099546001600160a01b0316156119a85760405162461bcd60e51b815260206004820152601c60248201527f706172616d73206861766520616c7265616479206265656e2073657400000000604482015260640161098f565b6001600160a01b0382166119fe5760405162461bcd60e51b815260206004820152601660248201527f696e76616c6964205f7374616b696e67546f6b656e2100000000000000000000604482015260640161098f565b6001600160a01b038116611a545760405162461bcd60e51b815260206004820152601560248201527f696e76616c6964205f726577617264546f6b656e210000000000000000000000604482015260640161098f565b60988390556099805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038416179055610b2281611a94565b610bd2813361218a565b6001600160a01b038116611aea5760405162461bcd60e51b815260206004820152601560248201527f696e76616c6964205f726577617264546f6b656e210000000000000000000000604482015260640161098f565b6001600160a01b0381166000908152609e602052604090205460ff1615611b0e5750565b609a805460018082019092557f44da158ba27f9252712a74ff6a55c5d531f69609f1f6e7f17c4443a8e2089be401805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091556000818152609e6020526040808220805460ff1916909417909355915190917ff3e4c2c64e71e6ba2eaab9a599bced62f9eb91d2cda610bf41aa8c80ff2cf82691a250565b6040516001600160a01b0380851660248301528316604482015260648101829052611c439085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b03199093169290921790915261220a565b50505050565b8260005b609a54811015611d16576000609a8281548110611c6c57611c6c612ae0565b60009182526020808320909101546001600160a01b0316808352609d9091526040909120909150611c9c826117fa565b6003820155611caa82610ed0565b60028201556001600160a01b038085166000908152609f60209081526040808320938616835292905220611cde8584610b27565b60018201556001600160a01b039092166000908152609d60205260409020600301549091555080611d0e81612af6565b915050611c4d565b50611d2081610f3c565b6001600160a01b038216600090815260a1602090815260408083209390935560a090522042905582611d945760405162461bcd60e51b815260206004820152601e60248201527f526577617264506f6f6c203a2043616e6e6f7420776974686472617720300000604482015260640161098f565b82609b54611da29190612ab6565b609b556001600160a01b0384166000908152609c6020526040902054611dc9908490612ab6565b6001600160a01b038086166000908152609c6020526040902091909155609954611df5911685856122ef565b836001600160a01b03167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d584604051611e3091815260200190565b60405180910390a28115611c4357611c4384611f82565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610ecc5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611ea53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff1615610ecc5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000818310611f7b57816118b5565b5090919050565b60005b609a54811015610ecc576000609a8281548110611fa457611fa4612ae0565b60009182526020808320909101546001600160a01b038681168452609f835260408085209190921680855292529091206001015490915080156120f8576001600160a01b038085166000908152609f602090815260408083209386168084529390915281206001015561201890858361231f565b6097546098546040517f2dd0568300000000000000000000000000000000000000000000000000000000815260048101919091526001600160a01b03868116602483015284811660448301526064820184905290911690632dd0568390608401600060405180830381600087803b15801561209257600080fd5b505af11580156120a6573d6000803e3d6000fd5b50505050816001600160a01b0316846001600160a01b03167f540798df468d7b23d11f156fdb954cb19ad414d150722a7b6d55ba369dea792e836040516120ef91815260200190565b60405180910390a35b5050808061210590612af6565b915050611f85565b600054610100900460ff16610f3a5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840161098f565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610ecc576121c8816001600160a01b03166014612358565b6121d3836020612358565b6040516020016121e4929190612b4c565b60408051601f198184030181529082905262461bcd60e51b825261098f91600401612bcd565b600061225f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166125399092919063ffffffff16565b805190915015610b22578080602001905181019061227d9190612c00565b610b225760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161098f565b6040516001600160a01b038316602482015260448101829052610b2290849063a9059cbb60e01b90606401611bf7565b73efefefefefefefefefefefefefefefefefefefef6001600160a01b0384160361234d57610b228282612548565b610b22838383612611565b60606000612367836002612ac9565b612372906002612a81565b67ffffffffffffffff81111561238a5761238a612c22565b6040519080825280601f01601f1916602001820160405280156123b4576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106123eb576123eb612ae0565b60200101906001600160f81b031916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061243657612436612ae0565b60200101906001600160f81b031916908160001a905350600061245a846002612ac9565b612465906001612a81565b90505b60018111156124ea577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106124a6576124a6612ae0565b1a60f81b8282815181106124bc576124bc612ae0565b60200101906001600160f81b031916908160001a90535060049490941c936124e381612c38565b9050612468565b5083156118b55760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161098f565b6060610bbe8484600085612767565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612595576040519150601f19603f3d011682016040523d82523d6000602084013e61259a565b606091505b5050905080610b225760405162461bcd60e51b815260206004820152602260248201527f5472616e7366657248656c7065723a2053656e64696e6720455448206661696c60448201527f6564000000000000000000000000000000000000000000000000000000000000606482015260840161098f565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b17905291516000928392908716916126829190612c4f565b6000604051808303816000865af19150503d80600081146126bf576040519150601f19603f3d011682016040523d82523d6000602084013e6126c4565b606091505b50915091508180156126ee5750805115806126ee5750808060200190518101906126ee9190612c00565b6127605760405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201527f616e73666572206661696c656400000000000000000000000000000000000000606482015260840161098f565b5050505050565b6060824710156127df5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161098f565b6001600160a01b0385163b6128365760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161098f565b600080866001600160a01b031685876040516128529190612c4f565b60006040518083038185875af1925050503d806000811461288f576040519150601f19603f3d011682016040523d82523d6000602084013e612894565b606091505b50915091506128a48282866128af565b979650505050505050565b606083156128be5750816118b5565b8251156128ce5782518084602001fd5b8160405162461bcd60e51b815260040161098f9190612bcd565b6000602082840312156128fa57600080fd5b81356001600160e01b0319811681146118b557600080fd5b80356001600160a01b038116811461292957600080fd5b919050565b6000806040838503121561294157600080fd5b61294a83612912565b946020939093013593505050565b60006020828403121561296a57600080fd5b6118b582612912565b6000806040838503121561298657600080fd5b61298f83612912565b915061299d60208401612912565b90509250929050565b6000602082840312156129b857600080fd5b5035919050565b600080604083850312156129d257600080fd5b8235915061299d60208401612912565b6020808252825182820181905260009190848201906040850190845b81811015612a235783516001600160a01b0316835292840192918401916001016129fe565b50909695505050505050565b600080600060608486031215612a4457600080fd5b83359250612a5460208501612912565b9150612a6260408501612912565b90509250925092565b634e487b7160e01b600052601160045260246000fd5b808201808211156108e7576108e7612a6b565b600082612ab157634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156108e7576108e7612a6b565b80820281158282048414176108e7576108e7612a6b565b634e487b7160e01b600052603260045260246000fd5b600060018201612b0857612b08612a6b565b5060010190565b600060208284031215612b2157600080fd5b5051919050565b60005b83811015612b43578181015183820152602001612b2b565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612b84816017850160208801612b28565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612bc1816028840160208801612b28565b01602801949350505050565b6020815260008251806020840152612bec816040850160208701612b28565b601f01601f19169190910160400192915050565b600060208284031215612c1257600080fd5b815180151581146118b557600080fd5b634e487b7160e01b600052604160045260246000fd5b600081612c4757612c47612a6b565b506000190190565b60008251612c61818460208701612b28565b919091019291505056fea26469706673582212209c0258e25bd1939c477dae69a3b710e80fa401a8b5f6c777fa3a8607cb3ac3db64736f6c63430008110033
Deployed Bytecode
0x6080604052600436106102a45760003560e01c806386b8ea201161016e578063c4f59f9b116100cb578063db518db21161007f578063f106845411610064578063f10684541461082e578063f122977714610844578063f376d7981461086457600080fd5b8063db518db2146107fb578063e69d849d1461081b57600080fd5b8063d47c3bf8116100b0578063d47c3bf814610799578063d547741f146107c6578063db2e21bc146107e657600080fd5b8063c4f59f9b14610757578063c6def0761461077957600080fd5b8063a980356a11610122578063b65a7ea511610107578063b65a7ea5146106ea578063c00007b014610717578063c4d66de81461073757600080fd5b8063a980356a14610666578063b5fd73f8146106ba57600080fd5b806391d148541161015357806391d14854146105eb578063a217fddf14610631578063a694fc3a1461064657600080fd5b806386b8ea20146105b65780638dcb4061146105d657600080fd5b80632ee409081161021c57806370a08231116101d057806375b238fc116101b557806375b238fc1461054d5780637bb7bed114610581578063853828b6146105a157600080fd5b806370a08231146104df57806372f702f31461051557600080fd5b806336568abe1161020157806336568abe1461046b5780636343ef051461048b578063638634ee146104bf57600080fd5b80632ee409081461042b5780632f2ff15d1461044b57600080fd5b806318160ddd11610273578063248a9ca311610258578063248a9ca3146103c65780632521cdd8146103f65780632e1a7d4d1461040b57600080fd5b806318160ddd14610391578063211dc32d146103a657600080fd5b806301ffc9a7146102b057806304d0c2c5146102e55780630700037d146102fa5780630fb5a6b41461036c57600080fd5b366102ab57005b600080fd5b3480156102bc57600080fd5b506102d06102cb3660046128e8565b610884565b60405190151581526020015b60405180910390f35b6102f86102f336600461292e565b6108ed565b005b34801561030657600080fd5b50610344610315366004612958565b609d60205260009081526040902080546001820154600283015460038401546004909401549293919290919085565b604080519586526020860194909452928401919091526060830152608082015260a0016102dc565b34801561037857600080fd5b5061038362093a8081565b6040519081526020016102dc565b34801561039d57600080fd5b50609b54610383565b3480156103b257600080fd5b506103836103c1366004612973565b610b27565b3480156103d257600080fd5b506103836103e13660046129a6565b60009081526065602052604090206001015490565b34801561040257600080fd5b50609a54610383565b34801561041757600080fd5b506102f86104263660046129a6565b610bc6565b34801561043757600080fd5b506102f861044636600461292e565b610bd5565b34801561045757600080fd5b506102f86104663660046129bf565b610e1f565b34801561047757600080fd5b506102f86104863660046129bf565b610e44565b34801561049757600080fd5b506103837fda13a707f7a3840d073818a6eaebbe54a724320b9a9d77ff1a6dccba94a770b381565b3480156104cb57600080fd5b506103836104da366004612958565b610ed0565b3480156104eb57600080fd5b506103836104fa366004612958565b6001600160a01b03166000908152609c602052604090205490565b34801561052157600080fd5b50609954610535906001600160a01b031681565b6040516001600160a01b0390911681526020016102dc565b34801561055957600080fd5b506103837fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b34801561058d57600080fd5b5061053561059c3660046129a6565b610ef4565b3480156105ad57600080fd5b506102f8610f1e565b3480156105c257600080fd5b506103836105d1366004612958565b610f3c565b3480156105e257600080fd5b506102f8610fdc565b3480156105f757600080fd5b506102d06106063660046129bf565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561063d57600080fd5b50610383600081565b34801561065257600080fd5b506102f86106613660046129a6565b611069565b34801561067257600080fd5b506106a5610681366004612973565b609f6020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152016102dc565b3480156106c657600080fd5b506102d06106d5366004612958565b609e6020526000908152604090205460ff1681565b3480156106f657600080fd5b50610383610705366004612958565b60a06020526000908152604090205481565b34801561072357600080fd5b506102f8610732366004612958565b611246565b34801561074357600080fd5b506102f8610752366004612958565b61134d565b34801561076357600080fd5b5061076c61155c565b6040516102dc91906129e2565b34801561078557600080fd5b50609754610535906001600160a01b031681565b3480156107a557600080fd5b506103836107b4366004612958565b60a16020526000908152604090205481565b3480156107d257600080fd5b506102f86107e13660046129bf565b6115be565b3480156107f257600080fd5b506102f86115e3565b34801561080757600080fd5b506102f861081636600461292e565b611637565b6102f861082936600461292e565b61166d565b34801561083a57600080fd5b5061038360985481565b34801561085057600080fd5b5061038361085f366004612958565b6117fa565b34801561087057600080fd5b506102f861087f366004612a2f565b6118bc565b60006001600160e01b031982167f7965db0b0000000000000000000000000000000000000000000000000000000014806108e757507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177561091781611a8a565b61092083611a94565b73efefefefefefefefefefefefefefefefefefefef6001600160a01b0384160361099d573482146109985760405162461bcd60e51b815260206004820152600e60248201527f696e76616c696420616d6f756e7400000000000000000000000000000000000060448201526064015b60405180910390fd5b610a00565b34156109eb5760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964206d73672e76616c7565000000000000000000000000000000604482015260640161098f565b610a006001600160a01b038416333085611baa565b6001600160a01b0383166000908152609d60205260409020609b54600003610a3d57828160040154610a329190612a81565b600490910155505050565b610a46846117fa565b60038201556004810154610a5a9084612a81565b6000600483015581549093504210610a8357610a7962093a8084612a94565b6001820155610aca565b8054600090610a93904290612ab6565b90506000826001015482610aa79190612ac9565b9050610ab38186612a81565b9450610ac262093a8086612a94565b600184015550505b4260028201819055610ae09062093a8090612a81565b81556040518381526001600160a01b038516907fac24935fd910bc682b5ccb1a07b718cadf8cf2f6d1404c4f3ddc3662dae40e299060200160405180910390a2505b505050565b6001600160a01b038083166000908152609f60209081526040808320938516835292815282822083518085019094528054808552600190910154918401829052919291670de0b6b3a764000090610b7d866117fa565b610b879190612ab6565b6001600160a01b0387166000908152609c6020526040902054610baa9190612ac9565b610bb49190612a94565b610bbe9190612a81565b949350505050565b610bd233826001611c49565b50565b8160005b609a54811015610ca2576000609a8281548110610bf857610bf8612ae0565b60009182526020808320909101546001600160a01b0316808352609d9091526040909120909150610c28826117fa565b6003820155610c3682610ed0565b60028201556001600160a01b038085166000908152609f60209081526040808320938616835292905220610c6a8584610b27565b60018201556001600160a01b039092166000908152609d60205260409020600301549091555080610c9a81612af6565b915050610bd9565b50610cac81610f3c565b6001600160a01b03808316600090815260a1602090815260408083209490945560a09052919091204290558316610d255760405162461bcd60e51b815260206004820152600d60248201527f696e76616c6964205f666f722100000000000000000000000000000000000000604482015260640161098f565b60008211610d755760405162461bcd60e51b815260206004820152601b60248201527f526577617264506f6f6c203a2043616e6e6f74207374616b6520300000000000604482015260640161098f565b81609b54610d839190612a81565b609b556001600160a01b0383166000908152609c6020526040902054610daa908390612a81565b6001600160a01b038085166000908152609c6020526040902091909155609954610dd79116333085611baa565b826001600160a01b03167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d83604051610e1291815260200190565b60405180910390a2505050565b600082815260656020526040902060010154610e3a81611a8a565b610b228383611e47565b6001600160a01b0381163314610ec25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c660000000000000000000000000000000000606482015260840161098f565b610ecc8282611ee9565b5050565b6001600160a01b0381166000908152609d60205260408120546108e7904290611f6c565b609a8181548110610f0457600080fd5b6000918252602090912001546001600160a01b0316905081565b336000818152609c6020526040902054610f3a91906001611c49565b565b6001600160a01b038116600090815260a06020526040812054808203610f655750600092915050565b6001600160a01b0383166000908152609c602052604081205490819003610fa4575050506001600160a01b0316600090815260a1602052604090205490565b80610faf8342612ab6565b610fb99190612ac9565b6001600160a01b038516600090815260a16020526040902054610bbe9190612a81565b6099546040517f70a082310000000000000000000000000000000000000000000000000000000081523360048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561103e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110629190612b0f565b9050610bd2815b3360005b609a54811015611136576000609a828154811061108c5761108c612ae0565b60009182526020808320909101546001600160a01b0316808352609d90915260409091209091506110bc826117fa565b60038201556110ca82610ed0565b60028201556001600160a01b038085166000908152609f602090815260408083209386168352929052206110fe8584610b27565b60018201556001600160a01b039092166000908152609d6020526040902060030154909155508061112e81612af6565b91505061106d565b5061114081610f3c565b6001600160a01b038216600090815260a1602090815260408083209390935560a0905220429055816111b45760405162461bcd60e51b815260206004820152601b60248201527f526577617264506f6f6c203a2043616e6e6f74207374616b6520300000000000604482015260640161098f565b81609b546111c29190612a81565b609b55336000908152609c60205260409020546111e0908390612a81565b336000818152609c602052604090209190915560995461120d916001600160a01b03909116903085611baa565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9060200160405180910390a25050565b8060005b609a54811015611313576000609a828154811061126957611269612ae0565b60009182526020808320909101546001600160a01b0316808352609d9091526040909120909150611299826117fa565b60038201556112a782610ed0565b60028201556001600160a01b038085166000908152609f602090815260408083209386168352929052206112db8584610b27565b60018201556001600160a01b039092166000908152609d6020526040902060030154909155508061130b81612af6565b91505061124a565b5061131d81610f3c565b6001600160a01b038216600090815260a1602090815260408083209390935560a0905220429055610ecc82611f82565b600054610100900460ff161580801561136d5750600054600160ff909116105b806113875750303b158015611387575060005460ff166001145b6113f95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161098f565b6000805460ff19166001179055801561141c576000805461ff0019166101001790555b6001600160a01b0382166114725760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964205f626f6f7374657221000000000000000000000000000000604482015260640161098f565b61147a61210d565b6097805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384161790556114ad600033611e47565b6114d77fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177583611e47565b6040516001600160a01b03831681527f5407aa361e671ca7c620332ea4c073198f8bc6125f2aceb4766a160b5afec1619060200160405180910390a18015610ecc576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6060609a8054806020026020016040519081016040528092919081815260200182805480156115b457602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611596575b5050505050905090565b6000828152606560205260409020600101546115d981611a8a565b610b228383611ee9565b336000818152609c6020526040812054916115ff918390611c49565b60405181815233907f2e39961a70a10f4d46383948095ac2752b3ee642a7c76aa827410aaff08c2e519060200160405180910390a250565b7fda13a707f7a3840d073818a6eaebbe54a724320b9a9d77ff1a6dccba94a770b361166181611a8a565b610b2283836001611c49565b6001600160a01b0382166000908152609e602052604090205460ff166116d55760405162461bcd60e51b815260206004820152600d60248201527f696e76616c696420746f6b656e00000000000000000000000000000000000000604482015260640161098f565b73efefefefefefefefefefefefefefefefefefefef6001600160a01b0383160361174d573481146117485760405162461bcd60e51b815260206004820152600e60248201527f696e76616c696420616d6f756e74000000000000000000000000000000000000604482015260640161098f565b6117b0565b341561179b5760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964206d73672e76616c7565000000000000000000000000000000604482015260640161098f565b6117b06001600160a01b038316333084611baa565b6001600160a01b0382166000908152609d60205260409020600401546117d7908290612a81565b6001600160a01b039092166000908152609d602052604090206004019190915550565b6001600160a01b0381166000908152609d60209081526040808320815160a0810183528154815260018201549381019390935260028101549183019190915260038101546060830152600401546080820152609b54600003611860576060015192915050565b609b548160200151826040015161187686610ed0565b6118809190612ab6565b61188a9190612ac9565b61189c90670de0b6b3a7640000612ac9565b6118a69190612a94565b81606001516118b59190612a81565b9392505050565b3360009081527fffdfc1249c027f9191656349feb0761381bb32c9f557e01f419fd08754bf5a1b602052604090205460ff168061190357506097546001600160a01b031633145b61194f5760405162461bcd60e51b815260206004820152600560248201527f2161757468000000000000000000000000000000000000000000000000000000604482015260640161098f565b6099546001600160a01b0316156119a85760405162461bcd60e51b815260206004820152601c60248201527f706172616d73206861766520616c7265616479206265656e2073657400000000604482015260640161098f565b6001600160a01b0382166119fe5760405162461bcd60e51b815260206004820152601660248201527f696e76616c6964205f7374616b696e67546f6b656e2100000000000000000000604482015260640161098f565b6001600160a01b038116611a545760405162461bcd60e51b815260206004820152601560248201527f696e76616c6964205f726577617264546f6b656e210000000000000000000000604482015260640161098f565b60988390556099805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038416179055610b2281611a94565b610bd2813361218a565b6001600160a01b038116611aea5760405162461bcd60e51b815260206004820152601560248201527f696e76616c6964205f726577617264546f6b656e210000000000000000000000604482015260640161098f565b6001600160a01b0381166000908152609e602052604090205460ff1615611b0e5750565b609a805460018082019092557f44da158ba27f9252712a74ff6a55c5d531f69609f1f6e7f17c4443a8e2089be401805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091556000818152609e6020526040808220805460ff1916909417909355915190917ff3e4c2c64e71e6ba2eaab9a599bced62f9eb91d2cda610bf41aa8c80ff2cf82691a250565b6040516001600160a01b0380851660248301528316604482015260648101829052611c439085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b03199093169290921790915261220a565b50505050565b8260005b609a54811015611d16576000609a8281548110611c6c57611c6c612ae0565b60009182526020808320909101546001600160a01b0316808352609d9091526040909120909150611c9c826117fa565b6003820155611caa82610ed0565b60028201556001600160a01b038085166000908152609f60209081526040808320938616835292905220611cde8584610b27565b60018201556001600160a01b039092166000908152609d60205260409020600301549091555080611d0e81612af6565b915050611c4d565b50611d2081610f3c565b6001600160a01b038216600090815260a1602090815260408083209390935560a090522042905582611d945760405162461bcd60e51b815260206004820152601e60248201527f526577617264506f6f6c203a2043616e6e6f7420776974686472617720300000604482015260640161098f565b82609b54611da29190612ab6565b609b556001600160a01b0384166000908152609c6020526040902054611dc9908490612ab6565b6001600160a01b038086166000908152609c6020526040902091909155609954611df5911685856122ef565b836001600160a01b03167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d584604051611e3091815260200190565b60405180910390a28115611c4357611c4384611f82565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610ecc5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611ea53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff1615610ecc5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000818310611f7b57816118b5565b5090919050565b60005b609a54811015610ecc576000609a8281548110611fa457611fa4612ae0565b60009182526020808320909101546001600160a01b038681168452609f835260408085209190921680855292529091206001015490915080156120f8576001600160a01b038085166000908152609f602090815260408083209386168084529390915281206001015561201890858361231f565b6097546098546040517f2dd0568300000000000000000000000000000000000000000000000000000000815260048101919091526001600160a01b03868116602483015284811660448301526064820184905290911690632dd0568390608401600060405180830381600087803b15801561209257600080fd5b505af11580156120a6573d6000803e3d6000fd5b50505050816001600160a01b0316846001600160a01b03167f540798df468d7b23d11f156fdb954cb19ad414d150722a7b6d55ba369dea792e836040516120ef91815260200190565b60405180910390a35b5050808061210590612af6565b915050611f85565b600054610100900460ff16610f3a5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840161098f565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610ecc576121c8816001600160a01b03166014612358565b6121d3836020612358565b6040516020016121e4929190612b4c565b60408051601f198184030181529082905262461bcd60e51b825261098f91600401612bcd565b600061225f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166125399092919063ffffffff16565b805190915015610b22578080602001905181019061227d9190612c00565b610b225760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161098f565b6040516001600160a01b038316602482015260448101829052610b2290849063a9059cbb60e01b90606401611bf7565b73efefefefefefefefefefefefefefefefefefefef6001600160a01b0384160361234d57610b228282612548565b610b22838383612611565b60606000612367836002612ac9565b612372906002612a81565b67ffffffffffffffff81111561238a5761238a612c22565b6040519080825280601f01601f1916602001820160405280156123b4576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106123eb576123eb612ae0565b60200101906001600160f81b031916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061243657612436612ae0565b60200101906001600160f81b031916908160001a905350600061245a846002612ac9565b612465906001612a81565b90505b60018111156124ea577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106124a6576124a6612ae0565b1a60f81b8282815181106124bc576124bc612ae0565b60200101906001600160f81b031916908160001a90535060049490941c936124e381612c38565b9050612468565b5083156118b55760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161098f565b6060610bbe8484600085612767565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612595576040519150601f19603f3d011682016040523d82523d6000602084013e61259a565b606091505b5050905080610b225760405162461bcd60e51b815260206004820152602260248201527f5472616e7366657248656c7065723a2053656e64696e6720455448206661696c60448201527f6564000000000000000000000000000000000000000000000000000000000000606482015260840161098f565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b17905291516000928392908716916126829190612c4f565b6000604051808303816000865af19150503d80600081146126bf576040519150601f19603f3d011682016040523d82523d6000602084013e6126c4565b606091505b50915091508180156126ee5750805115806126ee5750808060200190518101906126ee9190612c00565b6127605760405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201527f616e73666572206661696c656400000000000000000000000000000000000000606482015260840161098f565b5050505050565b6060824710156127df5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161098f565b6001600160a01b0385163b6128365760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161098f565b600080866001600160a01b031685876040516128529190612c4f565b60006040518083038185875af1925050503d806000811461288f576040519150601f19603f3d011682016040523d82523d6000602084013e612894565b606091505b50915091506128a48282866128af565b979650505050505050565b606083156128be5750816118b5565b8251156128ce5782518084602001fd5b8160405162461bcd60e51b815260040161098f9190612bcd565b6000602082840312156128fa57600080fd5b81356001600160e01b0319811681146118b557600080fd5b80356001600160a01b038116811461292957600080fd5b919050565b6000806040838503121561294157600080fd5b61294a83612912565b946020939093013593505050565b60006020828403121561296a57600080fd5b6118b582612912565b6000806040838503121561298657600080fd5b61298f83612912565b915061299d60208401612912565b90509250929050565b6000602082840312156129b857600080fd5b5035919050565b600080604083850312156129d257600080fd5b8235915061299d60208401612912565b6020808252825182820181905260009190848201906040850190845b81811015612a235783516001600160a01b0316835292840192918401916001016129fe565b50909695505050505050565b600080600060608486031215612a4457600080fd5b83359250612a5460208501612912565b9150612a6260408501612912565b90509250925092565b634e487b7160e01b600052601160045260246000fd5b808201808211156108e7576108e7612a6b565b600082612ab157634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156108e7576108e7612a6b565b80820281158282048414176108e7576108e7612a6b565b634e487b7160e01b600052603260045260246000fd5b600060018201612b0857612b08612a6b565b5060010190565b600060208284031215612b2157600080fd5b5051919050565b60005b83811015612b43578181015183820152602001612b2b565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612b84816017850160208801612b28565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612bc1816028840160208801612b28565b01602801949350505050565b6020815260008251806020840152612bec816040850160208701612b28565b601f01601f19169190910160400192915050565b600060208284031215612c1257600080fd5b815180151581146118b557600080fd5b634e487b7160e01b600052604160045260246000fd5b600081612c4757612c47612a6b565b506000190190565b60008251612c61818460208701612b28565b919091019291505056fea26469706673582212209c0258e25bd1939c477dae69a3b710e80fa401a8b5f6c777fa3a8607cb3ac3db64736f6c63430008110033
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.