Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 20239329 | 127 days ago | IN | 0 ETH | 0.02963471 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
Strategy
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
No with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; import {IStrategy} from "./IStrategy.sol"; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; import {IMToken} from "./IMToken.sol"; /** * @title A general re-staking strategy for MIND remote staking * @author Zy */ contract Strategy is IStrategy, OwnableUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable { using Math for uint256; IERC20 public assetToken; IMToken public shareToken; uint8 internal decimalsOffset; uint256 private depositAmountMax; uint256 private redeemAmountMax; uint256 private lockPeriod; mapping(address => uint256) private pendingRedeemRequest; mapping(address => uint256) private claimableRedeemRequest; mapping(address => uint256) private pendingRedeemRequestDeadline; uint256 public totalAssetsCap; // storage gap for upgrade uint256[40] private __gap; function initialize( address _owner, IERC20 _assetToken, IMToken _shareToken, uint8 _decimalsOffset ) public initializer { __Ownable_init(_owner); __Pausable_init(); __ReentrancyGuard_init(); assetToken = _assetToken; shareToken = _shareToken; decimalsOffset = _decimalsOffset; depositAmountMax = type(uint256).max; redeemAmountMax = type(uint256).max; totalAssetsCap = type(uint256).max; } /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } function setup( uint256 _lockPeriod, uint256 _depositAmountMax, uint256 _redeemAmountMax, uint256 _totalAssetsCap ) external onlyOwner { lockPeriod = _lockPeriod; depositAmountMax = _depositAmountMax; redeemAmountMax = _redeemAmountMax; totalAssetsCap = _totalAssetsCap; emit Setup(_lockPeriod, _depositAmountMax, _redeemAmountMax, _totalAssetsCap); } function pause() external onlyOwner { _pause(); } function unpause() external onlyOwner { _unpause(); } /** * @notice In case of any airdrop for asset token holders, owner can withdraw and redistribute. */ function withdrawAirdropToken(IERC20 token) external onlyOwner { if (token == assetToken || token == shareToken) { revert OwnerCannotWithdrawAssetToken(); } SafeERC20.safeTransfer(token, _msgSender(), token.balanceOf(address(this))); } /** * @notice Deposit asset token into the strategy. */ function deposit(uint256 assetAmount) public virtual whenNotPaused nonReentrant { if (assetAmount > depositAmountMax) { revert ExceededMax(); } if (totalAssets() + assetAmount > totalAssetsCap) { revert ExceededTotalAssetsCap(); } _depositFor(_msgSender(), assetAmount, _msgSender()); } /** * @dev Allows for deposit on behalf of receiver. Asset token is stored in this contract before remote staking is ready. */ function _depositFor(address user, uint256 assetAmount, address receiver) private { if (assetAmount == 0) { revert ZeroValueCheck(); } uint256 shareAmount = _convertToShares(assetAmount, Math.Rounding.Floor); SafeERC20.safeTransferFrom(assetToken, user, address(this), assetAmount); shareToken.mint(receiver, shareAmount); emit Deposit(user, receiver, assetAmount, shareAmount); } /** * @notice When there is no locking period, users can withdraw directly. */ function quickWithdraw(uint256 assetAmount) public virtual whenNotPaused nonReentrant { if (lockPeriod != 0) { revert QuickWithdrawalDisabled(); } uint256 shareAmount = _convertToShares(assetAmount, Math.Rounding.Ceil); if (shareAmount > redeemAmountMax) { revert ExceededMax(); } if (shareAmount == 0) { revert ZeroValueCheck(); } shareToken.burnFrom(_msgSender(), shareAmount); SafeERC20.safeTransfer(assetToken, _msgSender(), assetAmount); emit QuickWithdraw(_msgSender(), assetAmount, shareAmount); } /** * @notice Submit a request for withdrawal when there is a locking period. */ function requestWithdraw(uint256 assetAmount) external { uint256 shareAmount = _convertToShares(assetAmount, Math.Rounding.Ceil); requestRedeem(shareAmount); } /** * @notice Submit a request for redemption when there is a locking period. */ function requestRedeem(uint256 shareAmount) public virtual whenNotPaused nonReentrant { if (shareAmount > redeemAmountMax) { revert ExceededMax(); } _requestRedeemFor(_msgSender(), shareAmount, _msgSender()); } /** * @dev Allows for request for redemption on behalf of receiver. */ function _requestRedeemFor(address user, uint256 shareAmount, address receiver) private { if (shareAmount == 0) { revert ZeroValueCheck(); } SafeERC20.safeTransferFrom(shareToken, user, address(this), shareAmount); _updateRedeemLockPeriod(receiver, shareAmount); emit RedeemRequest(user, receiver, shareAmount); } /** * @notice Completes redemption for receiver when locking period is over. */ function redeemFor(address receiver) external virtual whenNotPaused nonReentrant { _updateRedeemLockPeriod(receiver, 0); uint256 shareAmount = claimableRedeemRequest[receiver]; if (shareAmount == 0) { revert ZeroValueCheck(); } claimableRedeemRequest[receiver] = 0; uint256 assetAmount = _convertToAssets(shareAmount, Math.Rounding.Floor); shareToken.burn(shareAmount); SafeERC20.safeTransfer(assetToken, receiver, assetAmount); emit Redeem(receiver, shareAmount, assetAmount); } /** * @notice Get latest information for a user wallet. */ function getInfo(address user) external returns (uint256, uint256, uint256, uint256, uint256) { _updateRedeemLockPeriod(user, 0); uint256 shareAmount = shareToken.balanceOf(user); uint256 assetAmount = _convertToAssets(shareAmount, Math.Rounding.Floor); uint256 pendingAssetAmount = _convertToAssets(pendingRedeemRequest[user], Math.Rounding.Floor); uint256 timeTowithdraw = Math.max(pendingRedeemRequestDeadline[user], block.number) - block.number; uint256 claimableAssetAmount = _convertToAssets(claimableRedeemRequest[user], Math.Rounding.Floor); return (shareAmount, assetAmount, pendingAssetAmount, timeTowithdraw, claimableAssetAmount); } /** * @dev Lock period is currently calculated as weighted average. Lock period will be handled by remote staking contract when remote staking is ready. */ function _updateRedeemLockPeriod(address user, uint256 newRequestAmount) private { if (pendingRedeemRequest[user] == 0 && newRequestAmount == 0) { return; } else if (pendingRedeemRequest[user] == 0) { pendingRedeemRequest[user] = newRequestAmount; pendingRedeemRequestDeadline[user] = block.number + lockPeriod; } else if (pendingRedeemRequestDeadline[user] <= block.number) { claimableRedeemRequest[user] += pendingRedeemRequest[user]; pendingRedeemRequest[user] = newRequestAmount; pendingRedeemRequestDeadline[user] = block.number + lockPeriod; } else { uint256 newLockPeriod = (newRequestAmount * lockPeriod + pendingRedeemRequest[user] * (pendingRedeemRequestDeadline[user] - block.number)).ceilDiv( newRequestAmount + pendingRedeemRequest[user] ); pendingRedeemRequest[user] += newRequestAmount; pendingRedeemRequestDeadline[user] = block.number + newLockPeriod; } } /** * @dev Same as @openzeppelin ERC4626 implementation */ function _convertToShares(uint256 assets, Math.Rounding rounding) internal view virtual returns (uint256) { return assets.mulDiv(shareToken.totalSupply() + 10 ** decimalsOffset, totalAssets() + 1, rounding); } /** * @dev Same as @openzeppelin ERC4626 implementation */ function _convertToAssets(uint256 shares, Math.Rounding rounding) internal view virtual returns (uint256) { return shares.mulDiv(totalAssets() + 1, shareToken.totalSupply() + 10 ** decimalsOffset, rounding); } function totalAssets() public view virtual returns (uint256) { return assetToken.balanceOf(address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Ownable struct OwnableStorage { address _owner; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300; function _getOwnableStorage() private pure returns (OwnableStorage storage $) { assembly { $.slot := OwnableStorageLocation } } /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ function __Ownable_init(address initialOwner) internal onlyInitializing { __Ownable_init_unchained(initialOwner); } function __Ownable_init_unchained(address initialOwner) internal onlyInitializing { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { OwnableStorage storage $ = _getOwnableStorage(); return $._owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { OwnableStorage storage $ = _getOwnableStorage(); address oldOwner = $._owner; $._owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @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] * ```solidity * 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 Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 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. * * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._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. * * 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. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * 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. * * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._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() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @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. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Pausable struct PausableStorage { bool _paused; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300; function _getPausableStorage() private pure returns (PausableStorage storage $) { assembly { $.slot := PausableStorageLocation } } /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); /** * @dev The operation failed because the contract is paused. */ error EnforcedPause(); /** * @dev The operation failed because the contract is not paused. */ error ExpectedPause(); /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { PausableStorage storage $ = _getPausableStorage(); $._paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { PausableStorage storage $ = _getPausableStorage(); return $._paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { if (paused()) { revert EnforcedPause(); } } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { if (!paused()) { revert ExpectedPause(); } } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { PausableStorage storage $ = _getPausableStorage(); $._paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { PausableStorage storage $ = _getPausableStorage(); $._paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard struct ReentrancyGuardStorage { uint256 _status; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00; function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) { assembly { $.slot := ReentrancyGuardStorageLocation } } /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); $._status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // On the first call to nonReentrant, _status will be NOT_ENTERED if ($._status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail $._status = ENTERED; } function _nonReentrantAfter() private { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) $._status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); return $._status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @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. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ 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]. * * CAUTION: See Security Considerations above. */ 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 v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @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 value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` 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 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../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; /** * @dev An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @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); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @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). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // 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 cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @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 or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * 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. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @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`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // 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 FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the 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 towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (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 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 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. uint256 twos = denominator & (0 - denominator); 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 (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * 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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 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) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IMToken is IERC20 { function burn(uint256 value) external; function burnFrom(address account, uint256 value) external; function mint(address to, uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; interface IStrategy { error OwnerCannotWithdrawAssetToken(); error ZeroValueCheck(); error ExceededMax(); error ExceededTotalAssetsCap(); error QuickWithdrawalDisabled(); event Deposit(address indexed user, address indexed receiver, uint256 assetAmount, uint256 shareAmount); event RedeemRequest(address indexed user, address indexed receiver, uint256 shareAmount); event Redeem(address indexed receiver, uint256 shareAmount, uint256 assetAmount); event QuickWithdraw(address indexed user, uint256 assetAmount, uint256 shareAmount); event Setup(uint256 lockPeriod, uint256 depositAmountMax, uint256 redeemAmountMax, uint256 totalAssetsCap); function deposit(uint256 assetAmount) external; function requestWithdraw(uint256 assetAmount) external; function requestRedeem(uint256 shareAmount) external; function redeemFor(address receiver) external; function quickWithdraw(uint256 assetAmount) external; function getInfo(address user) external returns (uint256, uint256, uint256, uint256, uint256); }
{ "evmVersion": "paris", "optimizer": { "enabled": false, "runs": 200 }, "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"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExceededMax","type":"error"},{"inputs":[],"name":"ExceededTotalAssetsCap","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"MathOverflowedMulDiv","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"OwnerCannotWithdrawAssetToken","type":"error"},{"inputs":[],"name":"QuickWithdrawalDisabled","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"ZeroValueCheck","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"assetAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shareAmount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"assetAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shareAmount","type":"uint256"}],"name":"QuickWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"shareAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"assetAmount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"shareAmount","type":"uint256"}],"name":"RedeemRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockPeriod","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"depositAmountMax","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"redeemAmountMax","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalAssetsCap","type":"uint256"}],"name":"Setup","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"assetToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assetAmount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"contract IERC20","name":"_assetToken","type":"address"},{"internalType":"contract IMToken","name":"_shareToken","type":"address"},{"internalType":"uint8","name":"_decimalsOffset","type":"uint8"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assetAmount","type":"uint256"}],"name":"quickWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"redeemFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareAmount","type":"uint256"}],"name":"requestRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assetAmount","type":"uint256"}],"name":"requestWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockPeriod","type":"uint256"},{"internalType":"uint256","name":"_depositAmountMax","type":"uint256"},{"internalType":"uint256","name":"_redeemAmountMax","type":"uint256"},{"internalType":"uint256","name":"_totalAssetsCap","type":"uint256"}],"name":"setup","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shareToken","outputs":[{"internalType":"contract IMToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssetsCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"withdrawAirdropToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50620000226200002860201b60201c565b6200019c565b60006200003a6200013260201b60201c565b90508060000160089054906101000a900460ff161562000086576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b67ffffffffffffffff80168160000160009054906101000a900467ffffffffffffffff1667ffffffffffffffff16146200012f5767ffffffffffffffff8160000160006101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055507fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d267ffffffffffffffff6040516200012691906200017f565b60405180910390a15b50565b60007ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00905090565b600067ffffffffffffffff82169050919050565b62000179816200015a565b82525050565b60006020820190506200019660008301846200016e565b92915050565b612ddb80620001ac6000396000f3fe608060405234801561001057600080fd5b50600436106101215760003560e01c8063715018a6116100ad578063aa2f892d11610071578063aa2f892d14610284578063b6b55f25146102a0578063dfb2fa4c146102bc578063f2fde38b146102d8578063ffdd5cf1146102f457610121565b8063715018a61461021a578063745400c9146102245780638456cb59146102405780638da5cb5b1461024a578063a9bbf7f11461026857610121565b80633f4ba83a116100f45780633f4ba83a1461019a57806345f663dd146101a45780635c975abb146101c257806361f0ff25146101e05780636c9fa59e146101fc57610121565b806301e1d114146101265780631083f761146101445780633073cecf146101625780633ad05f641461017e575b600080fd5b61012e610328565b60405161013b9190612416565b60405180910390f35b61014c6103ca565b60405161015991906124b0565b60405180910390f35b61017c600480360381019061017791906125c3565b6103ee565b005b61019860048036038101906101939190612656565b6106a1565b005b6101a261089d565b005b6101ac6108af565b6040516101b99190612416565b60405180910390f35b6101ca6108b5565b6040516101d7919061269e565b60405180910390f35b6101fa60048036038101906101f591906126b9565b6108da565b005b610204610941565b6040516102119190612741565b60405180910390f35b610222610967565b005b61023e60048036038101906102399190612656565b61097b565b005b610248610997565b005b6102526109a9565b60405161025f919061276b565b60405180910390f35b610282600480360381019061027d9190612786565b6109e1565b005b61029e60048036038101906102999190612656565b610be3565b005b6102ba60048036038101906102b59190612656565b610c53565b005b6102d660048036038101906102d191906127b3565b610d11565b005b6102f260048036038101906102ed9190612786565b610e85565b005b61030e60048036038101906103099190612786565b610f0b565b60405161031f9594939291906127e0565b60405180910390f35b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610384919061276b565b602060405180830381865afa1580156103a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103c59190612848565b905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006103f86110de565b905060008160000160089054906101000a900460ff1615905060008260000160009054906101000a900467ffffffffffffffff1690506000808267ffffffffffffffff161480156104465750825b9050600060018367ffffffffffffffff1614801561047b575060003073ffffffffffffffffffffffffffffffffffffffff163b145b905081158015610489575080155b156104c0576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018560000160006101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555083156105105760018560000160086101000a81548160ff0219169083151502179055505b61051989611106565b61052161111a565b61052961112c565b876000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555086600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555085600160146101000a81548160ff021916908360ff1602179055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6002819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6003819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60088190555083156106965760008560000160086101000a81548160ff0219169083151502179055507fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2600160405161068d91906128c4565b60405180910390a15b505050505050505050565b6106a961113e565b6106b161117f565b6000600454146106ed576040517f5a959c4b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006106fa8260016111d6565b9050600354811115610738576040517fcb07b6e500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008103610772576040517fbabd61a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166379cc67906107b86112c0565b836040518363ffffffff1660e01b81526004016107d69291906128df565b600060405180830381600087803b1580156107f057600080fd5b505af1158015610804573d6000803e3d6000fd5b5050505061083a60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff166108346112c0565b846112c8565b6108426112c0565b73ffffffffffffffffffffffffffffffffffffffff167f096bc14efdac9718adad7e6769c3f7f185588bc811046b20f04d710f24a8765f8383604051610889929190612908565b60405180910390a25061089a611347565b50565b6108a5611360565b6108ad6113e7565b565b60085481565b6000806108c0611459565b90508060000160009054906101000a900460ff1691505090565b6108e2611360565b836004819055508260028190555081600381905550806008819055507fc2a630e83aefb8237888fea9526bfbc025f68fc23379ab3e23881db78771201c848484846040516109339493929190612931565b60405180910390a150505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61096f611360565b6109796000611481565b565b60006109888260016111d6565b905061099381610be3565b5050565b61099f611360565b6109a7611558565b565b6000806109b46115ca565b90508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691505090565b6109e961113e565b6109f161117f565b6109fc8160006115f2565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008103610a7a576040517fbabd61a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000610acc826000611a55565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342966c68836040518263ffffffff1660e01b8152600401610b299190612416565b600060405180830381600087803b158015610b4357600080fd5b505af1158015610b57573d6000803e3d6000fd5b50505050610b8660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684836112c8565b8273ffffffffffffffffffffffffffffffffffffffff167fe5b754fb1abb7f01b499791d0b820ae3b6af3424ac1c59768edb53f4ec31a9298383604051610bce929190612908565b60405180910390a25050610be0611347565b50565b610beb61113e565b610bf361117f565b600354811115610c2f576040517fcb07b6e500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610c48610c3a6112c0565b82610c436112c0565b611b3f565b610c50611347565b50565b610c5b61113e565b610c6361117f565b600254811115610c9f576040517fcb07b6e500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60085481610cab610328565b610cb591906129a5565b1115610ced576040517f9ccc165900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610d06610cf86112c0565b82610d016112c0565b611c1b565b610d0e611347565b50565b610d19611360565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161480610dc05750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b15610df7576040517f60a13de000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e8281610e036112c0565b8373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610e3c919061276b565b602060405180830381865afa158015610e59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7d9190612848565b6112c8565b50565b610e8d611360565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610eff5760006040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401610ef6919061276b565b60405180910390fd5b610f0881611481565b50565b6000806000806000610f1e8660006115f2565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231886040518263ffffffff1660e01b8152600401610f7b919061276b565b602060405180830381865afa158015610f98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbc9190612848565b90506000610fcb826000611a55565b90506000611019600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546000611a55565b9050600043611067600760008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205443611d8c565b61107191906129d9565b905060006110bf600660008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546000611a55565b9050848484848499509950995099509950505050505091939590929450565b60007ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00905090565b61110e611da5565b61111781611de5565b50565b611122611da5565b61112a611e6b565b565b611134611da5565b61113c611e9f565b565b6111466108b5565b1561117d576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b6000611189611ec0565b905060028160000154036111c9576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002816000018190555050565b60006112b8600160149054906101000a900460ff16600a6111f79190612b40565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611264573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112889190612848565b61129291906129a5565b600161129c610328565b6112a691906129a5565b8486611ee8909392919063ffffffff16565b905092915050565b600033905090565b611342838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040516024016112fb9291906128df565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611f3f565b505050565b6000611351611ec0565b90506001816000018190555050565b6113686112c0565b73ffffffffffffffffffffffffffffffffffffffff166113866109a9565b73ffffffffffffffffffffffffffffffffffffffff16146113e5576113a96112c0565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016113dc919061276b565b60405180910390fd5b565b6113ef611fd6565b60006113f9611459565b905060008160000160006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6114416112c0565b60405161144e919061276b565b60405180910390a150565b60007fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300905090565b600061148b6115ca565b905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050828260000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3505050565b61156061113e565b600061156a611459565b905060018160000160006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586115b26112c0565b6040516115bf919061276b565b60405180910390a150565b60007f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300905090565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541480156116415750600081145b611a51576000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054036117265780600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600454436116de91906129a5565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a50565b43600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541161189b57600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546117fa91906129a5565b9250508190555080600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506004544361185391906129a5565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a4f565b60006119a6600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836118eb91906129a5565b43600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193691906129d9565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119809190612b8b565b6004548561198e9190612b8b565b61199891906129a5565b61201690919063ffffffff16565b905081600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546119f791906129a5565b925050819055508043611a0a91906129a5565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b5b5b5050565b6000611b376001611a64610328565b611a6e91906129a5565b600160149054906101000a900460ff16600a611a8a9190612b40565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611af7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b1b9190612848565b611b2591906129a5565b8486611ee8909392919063ffffffff16565b905092915050565b60008203611b79576040517fbabd61a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611ba7600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684308561206f565b611bb181836115f2565b8073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fb2912d6f04e729e0cfc9bd0b54e7bf6bc91e38256057c444967ea263285e2c7984604051611c0e9190612416565b60405180910390a3505050565b60008203611c55576040517fbabd61a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611c628360006111d6565b9050611c9060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685308661206f565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1983836040518363ffffffff1660e01b8152600401611ced9291906128df565b600060405180830381600087803b158015611d0757600080fd5b505af1158015611d1b573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d78584604051611d7e929190612908565b60405180910390a350505050565b6000818311611d9b5781611d9d565b825b905092915050565b611dad6120f1565b611de3576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b611ded611da5565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611e5f5760006040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401611e56919061276b565b60405180910390fd5b611e6881611481565b50565b611e73611da5565b6000611e7d611459565b905060008160000160006101000a81548160ff02191690831515021790555050565b611ea7611da5565b6000611eb1611ec0565b90506001816000018190555050565b60007f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00905090565b600080611ef6868686612111565b9050611f0183612218565b8015611f1e575060008480611f1957611f18612bcd565b5b868809115b15611f3357600181611f3091906129a5565b90505b80915050949350505050565b6000611f6a828473ffffffffffffffffffffffffffffffffffffffff1661224690919063ffffffff16565b90506000815114158015611f8f575080806020019051810190611f8d9190612c28565b155b15611fd157826040517f5274afe7000000000000000000000000000000000000000000000000000000008152600401611fc8919061276b565b60405180910390fd5b505050565b611fde6108b5565b612014576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b600080820361203257818361202b9190612c55565b9050612069565b600083146120635760018260018561204a91906129d9565b6120549190612c55565b61205e91906129a5565b612066565b60005b90505b92915050565b6120eb848573ffffffffffffffffffffffffffffffffffffffff166323b872dd8686866040516024016120a493929190612c86565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611f3f565b50505050565b60006120fb6110de565b60000160089054906101000a900460ff16905090565b600080838502905060008019858709828110838203039150506000810361214c5783828161214257612141612bcd565b5b0492505050612211565b808411612185576040517f227bc15300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600084868809905082811182039150808303925060008560000386169050808604955080840493506001818260000304019050808302841793506000600287600302189050808702600203810290508087026002038102905080870260020381029050808702600203810290508087026002038102905080870260020381029050808502955050505050505b9392505050565b60006001600283600381111561223157612230612cbd565b5b61223b9190612cec565b60ff16149050919050565b60606122548383600061225c565b905092915050565b6060814710156122a357306040517fcd78605900000000000000000000000000000000000000000000000000000000815260040161229a919061276b565b60405180910390fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1684866040516122cc9190612d8e565b60006040518083038185875af1925050503d8060008114612309576040519150601f19603f3d011682016040523d82523d6000602084013e61230e565b606091505b509150915061231e868383612329565b925050509392505050565b60608261233e57612339826123b8565b6123b0565b60008251148015612366575060008473ffffffffffffffffffffffffffffffffffffffff163b145b156123a857836040517f9996b31500000000000000000000000000000000000000000000000000000000815260040161239f919061276b565b60405180910390fd5b8190506123b1565b5b9392505050565b6000815111156123cb5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000819050919050565b612410816123fd565b82525050565b600060208201905061242b6000830184612407565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061247661247161246c84612431565b612451565b612431565b9050919050565b60006124888261245b565b9050919050565b600061249a8261247d565b9050919050565b6124aa8161248f565b82525050565b60006020820190506124c560008301846124a1565b92915050565b600080fd5b60006124db82612431565b9050919050565b6124eb816124d0565b81146124f657600080fd5b50565b600081359050612508816124e2565b92915050565b6000612519826124d0565b9050919050565b6125298161250e565b811461253457600080fd5b50565b60008135905061254681612520565b92915050565b6000612557826124d0565b9050919050565b6125678161254c565b811461257257600080fd5b50565b6000813590506125848161255e565b92915050565b600060ff82169050919050565b6125a08161258a565b81146125ab57600080fd5b50565b6000813590506125bd81612597565b92915050565b600080600080608085870312156125dd576125dc6124cb565b5b60006125eb878288016124f9565b94505060206125fc87828801612537565b935050604061260d87828801612575565b925050606061261e878288016125ae565b91505092959194509250565b612633816123fd565b811461263e57600080fd5b50565b6000813590506126508161262a565b92915050565b60006020828403121561266c5761266b6124cb565b5b600061267a84828501612641565b91505092915050565b60008115159050919050565b61269881612683565b82525050565b60006020820190506126b3600083018461268f565b92915050565b600080600080608085870312156126d3576126d26124cb565b5b60006126e187828801612641565b94505060206126f287828801612641565b935050604061270387828801612641565b925050606061271487828801612641565b91505092959194509250565b600061272b8261247d565b9050919050565b61273b81612720565b82525050565b60006020820190506127566000830184612732565b92915050565b612765816124d0565b82525050565b6000602082019050612780600083018461275c565b92915050565b60006020828403121561279c5761279b6124cb565b5b60006127aa848285016124f9565b91505092915050565b6000602082840312156127c9576127c86124cb565b5b60006127d784828501612537565b91505092915050565b600060a0820190506127f56000830188612407565b6128026020830187612407565b61280f6040830186612407565b61281c6060830185612407565b6128296080830184612407565b9695505050505050565b6000815190506128428161262a565b92915050565b60006020828403121561285e5761285d6124cb565b5b600061286c84828501612833565b91505092915050565b6000819050919050565b600067ffffffffffffffff82169050919050565b60006128ae6128a96128a484612875565b612451565b61287f565b9050919050565b6128be81612893565b82525050565b60006020820190506128d960008301846128b5565b92915050565b60006040820190506128f4600083018561275c565b6129016020830184612407565b9392505050565b600060408201905061291d6000830185612407565b61292a6020830184612407565b9392505050565b60006080820190506129466000830187612407565b6129536020830186612407565b6129606040830185612407565b61296d6060830184612407565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006129b0826123fd565b91506129bb836123fd565b92508282019050808211156129d3576129d2612976565b5b92915050565b60006129e4826123fd565b91506129ef836123fd565b9250828203905081811115612a0757612a06612976565b5b92915050565b60008160011c9050919050565b6000808291508390505b6001851115612a6457808604811115612a4057612a3f612976565b5b6001851615612a4f5780820291505b8081029050612a5d85612a0d565b9450612a24565b94509492505050565b600082612a7d5760019050612b39565b81612a8b5760009050612b39565b8160018114612aa15760028114612aab57612ada565b6001915050612b39565b60ff841115612abd57612abc612976565b5b8360020a915084821115612ad457612ad3612976565b5b50612b39565b5060208310610133831016604e8410600b8410161715612b0f5782820a905083811115612b0a57612b09612976565b5b612b39565b612b1c8484846001612a1a565b92509050818404811115612b3357612b32612976565b5b81810290505b9392505050565b6000612b4b826123fd565b9150612b568361258a565b9250612b837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612a6d565b905092915050565b6000612b96826123fd565b9150612ba1836123fd565b9250828202612baf816123fd565b91508282048414831517612bc657612bc5612976565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b612c0581612683565b8114612c1057600080fd5b50565b600081519050612c2281612bfc565b92915050565b600060208284031215612c3e57612c3d6124cb565b5b6000612c4c84828501612c13565b91505092915050565b6000612c60826123fd565b9150612c6b836123fd565b925082612c7b57612c7a612bcd565b5b828204905092915050565b6000606082019050612c9b600083018661275c565b612ca8602083018561275c565b612cb56040830184612407565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000612cf78261258a565b9150612d028361258a565b925082612d1257612d11612bcd565b5b828206905092915050565b600081519050919050565b600081905092915050565b60005b83811015612d51578082015181840152602081019050612d36565b60008484015250505050565b6000612d6882612d1d565b612d728185612d28565b9350612d82818560208601612d33565b80840191505092915050565b6000612d9a8284612d5d565b91508190509291505056fea2646970667358221220faf637a8dc3373c0ab092700794c7911c20a6b6d9e94b32b2507422ce17e676764736f6c63430008180033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101215760003560e01c8063715018a6116100ad578063aa2f892d11610071578063aa2f892d14610284578063b6b55f25146102a0578063dfb2fa4c146102bc578063f2fde38b146102d8578063ffdd5cf1146102f457610121565b8063715018a61461021a578063745400c9146102245780638456cb59146102405780638da5cb5b1461024a578063a9bbf7f11461026857610121565b80633f4ba83a116100f45780633f4ba83a1461019a57806345f663dd146101a45780635c975abb146101c257806361f0ff25146101e05780636c9fa59e146101fc57610121565b806301e1d114146101265780631083f761146101445780633073cecf146101625780633ad05f641461017e575b600080fd5b61012e610328565b60405161013b9190612416565b60405180910390f35b61014c6103ca565b60405161015991906124b0565b60405180910390f35b61017c600480360381019061017791906125c3565b6103ee565b005b61019860048036038101906101939190612656565b6106a1565b005b6101a261089d565b005b6101ac6108af565b6040516101b99190612416565b60405180910390f35b6101ca6108b5565b6040516101d7919061269e565b60405180910390f35b6101fa60048036038101906101f591906126b9565b6108da565b005b610204610941565b6040516102119190612741565b60405180910390f35b610222610967565b005b61023e60048036038101906102399190612656565b61097b565b005b610248610997565b005b6102526109a9565b60405161025f919061276b565b60405180910390f35b610282600480360381019061027d9190612786565b6109e1565b005b61029e60048036038101906102999190612656565b610be3565b005b6102ba60048036038101906102b59190612656565b610c53565b005b6102d660048036038101906102d191906127b3565b610d11565b005b6102f260048036038101906102ed9190612786565b610e85565b005b61030e60048036038101906103099190612786565b610f0b565b60405161031f9594939291906127e0565b60405180910390f35b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610384919061276b565b602060405180830381865afa1580156103a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103c59190612848565b905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006103f86110de565b905060008160000160089054906101000a900460ff1615905060008260000160009054906101000a900467ffffffffffffffff1690506000808267ffffffffffffffff161480156104465750825b9050600060018367ffffffffffffffff1614801561047b575060003073ffffffffffffffffffffffffffffffffffffffff163b145b905081158015610489575080155b156104c0576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018560000160006101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555083156105105760018560000160086101000a81548160ff0219169083151502179055505b61051989611106565b61052161111a565b61052961112c565b876000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555086600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555085600160146101000a81548160ff021916908360ff1602179055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6002819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6003819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60088190555083156106965760008560000160086101000a81548160ff0219169083151502179055507fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2600160405161068d91906128c4565b60405180910390a15b505050505050505050565b6106a961113e565b6106b161117f565b6000600454146106ed576040517f5a959c4b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006106fa8260016111d6565b9050600354811115610738576040517fcb07b6e500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008103610772576040517fbabd61a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166379cc67906107b86112c0565b836040518363ffffffff1660e01b81526004016107d69291906128df565b600060405180830381600087803b1580156107f057600080fd5b505af1158015610804573d6000803e3d6000fd5b5050505061083a60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff166108346112c0565b846112c8565b6108426112c0565b73ffffffffffffffffffffffffffffffffffffffff167f096bc14efdac9718adad7e6769c3f7f185588bc811046b20f04d710f24a8765f8383604051610889929190612908565b60405180910390a25061089a611347565b50565b6108a5611360565b6108ad6113e7565b565b60085481565b6000806108c0611459565b90508060000160009054906101000a900460ff1691505090565b6108e2611360565b836004819055508260028190555081600381905550806008819055507fc2a630e83aefb8237888fea9526bfbc025f68fc23379ab3e23881db78771201c848484846040516109339493929190612931565b60405180910390a150505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61096f611360565b6109796000611481565b565b60006109888260016111d6565b905061099381610be3565b5050565b61099f611360565b6109a7611558565b565b6000806109b46115ca565b90508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691505090565b6109e961113e565b6109f161117f565b6109fc8160006115f2565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008103610a7a576040517fbabd61a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000610acc826000611a55565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342966c68836040518263ffffffff1660e01b8152600401610b299190612416565b600060405180830381600087803b158015610b4357600080fd5b505af1158015610b57573d6000803e3d6000fd5b50505050610b8660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684836112c8565b8273ffffffffffffffffffffffffffffffffffffffff167fe5b754fb1abb7f01b499791d0b820ae3b6af3424ac1c59768edb53f4ec31a9298383604051610bce929190612908565b60405180910390a25050610be0611347565b50565b610beb61113e565b610bf361117f565b600354811115610c2f576040517fcb07b6e500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610c48610c3a6112c0565b82610c436112c0565b611b3f565b610c50611347565b50565b610c5b61113e565b610c6361117f565b600254811115610c9f576040517fcb07b6e500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60085481610cab610328565b610cb591906129a5565b1115610ced576040517f9ccc165900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610d06610cf86112c0565b82610d016112c0565b611c1b565b610d0e611347565b50565b610d19611360565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161480610dc05750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b15610df7576040517f60a13de000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e8281610e036112c0565b8373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610e3c919061276b565b602060405180830381865afa158015610e59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7d9190612848565b6112c8565b50565b610e8d611360565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610eff5760006040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401610ef6919061276b565b60405180910390fd5b610f0881611481565b50565b6000806000806000610f1e8660006115f2565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231886040518263ffffffff1660e01b8152600401610f7b919061276b565b602060405180830381865afa158015610f98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbc9190612848565b90506000610fcb826000611a55565b90506000611019600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546000611a55565b9050600043611067600760008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205443611d8c565b61107191906129d9565b905060006110bf600660008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546000611a55565b9050848484848499509950995099509950505050505091939590929450565b60007ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00905090565b61110e611da5565b61111781611de5565b50565b611122611da5565b61112a611e6b565b565b611134611da5565b61113c611e9f565b565b6111466108b5565b1561117d576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b6000611189611ec0565b905060028160000154036111c9576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002816000018190555050565b60006112b8600160149054906101000a900460ff16600a6111f79190612b40565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611264573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112889190612848565b61129291906129a5565b600161129c610328565b6112a691906129a5565b8486611ee8909392919063ffffffff16565b905092915050565b600033905090565b611342838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040516024016112fb9291906128df565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611f3f565b505050565b6000611351611ec0565b90506001816000018190555050565b6113686112c0565b73ffffffffffffffffffffffffffffffffffffffff166113866109a9565b73ffffffffffffffffffffffffffffffffffffffff16146113e5576113a96112c0565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016113dc919061276b565b60405180910390fd5b565b6113ef611fd6565b60006113f9611459565b905060008160000160006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6114416112c0565b60405161144e919061276b565b60405180910390a150565b60007fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300905090565b600061148b6115ca565b905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050828260000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3505050565b61156061113e565b600061156a611459565b905060018160000160006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586115b26112c0565b6040516115bf919061276b565b60405180910390a150565b60007f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300905090565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541480156116415750600081145b611a51576000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054036117265780600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600454436116de91906129a5565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a50565b43600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541161189b57600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546117fa91906129a5565b9250508190555080600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506004544361185391906129a5565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a4f565b60006119a6600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836118eb91906129a5565b43600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193691906129d9565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119809190612b8b565b6004548561198e9190612b8b565b61199891906129a5565b61201690919063ffffffff16565b905081600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546119f791906129a5565b925050819055508043611a0a91906129a5565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b5b5b5050565b6000611b376001611a64610328565b611a6e91906129a5565b600160149054906101000a900460ff16600a611a8a9190612b40565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611af7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b1b9190612848565b611b2591906129a5565b8486611ee8909392919063ffffffff16565b905092915050565b60008203611b79576040517fbabd61a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611ba7600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684308561206f565b611bb181836115f2565b8073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fb2912d6f04e729e0cfc9bd0b54e7bf6bc91e38256057c444967ea263285e2c7984604051611c0e9190612416565b60405180910390a3505050565b60008203611c55576040517fbabd61a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611c628360006111d6565b9050611c9060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685308661206f565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1983836040518363ffffffff1660e01b8152600401611ced9291906128df565b600060405180830381600087803b158015611d0757600080fd5b505af1158015611d1b573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d78584604051611d7e929190612908565b60405180910390a350505050565b6000818311611d9b5781611d9d565b825b905092915050565b611dad6120f1565b611de3576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b611ded611da5565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611e5f5760006040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401611e56919061276b565b60405180910390fd5b611e6881611481565b50565b611e73611da5565b6000611e7d611459565b905060008160000160006101000a81548160ff02191690831515021790555050565b611ea7611da5565b6000611eb1611ec0565b90506001816000018190555050565b60007f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00905090565b600080611ef6868686612111565b9050611f0183612218565b8015611f1e575060008480611f1957611f18612bcd565b5b868809115b15611f3357600181611f3091906129a5565b90505b80915050949350505050565b6000611f6a828473ffffffffffffffffffffffffffffffffffffffff1661224690919063ffffffff16565b90506000815114158015611f8f575080806020019051810190611f8d9190612c28565b155b15611fd157826040517f5274afe7000000000000000000000000000000000000000000000000000000008152600401611fc8919061276b565b60405180910390fd5b505050565b611fde6108b5565b612014576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b600080820361203257818361202b9190612c55565b9050612069565b600083146120635760018260018561204a91906129d9565b6120549190612c55565b61205e91906129a5565b612066565b60005b90505b92915050565b6120eb848573ffffffffffffffffffffffffffffffffffffffff166323b872dd8686866040516024016120a493929190612c86565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611f3f565b50505050565b60006120fb6110de565b60000160089054906101000a900460ff16905090565b600080838502905060008019858709828110838203039150506000810361214c5783828161214257612141612bcd565b5b0492505050612211565b808411612185576040517f227bc15300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600084868809905082811182039150808303925060008560000386169050808604955080840493506001818260000304019050808302841793506000600287600302189050808702600203810290508087026002038102905080870260020381029050808702600203810290508087026002038102905080870260020381029050808502955050505050505b9392505050565b60006001600283600381111561223157612230612cbd565b5b61223b9190612cec565b60ff16149050919050565b60606122548383600061225c565b905092915050565b6060814710156122a357306040517fcd78605900000000000000000000000000000000000000000000000000000000815260040161229a919061276b565b60405180910390fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1684866040516122cc9190612d8e565b60006040518083038185875af1925050503d8060008114612309576040519150601f19603f3d011682016040523d82523d6000602084013e61230e565b606091505b509150915061231e868383612329565b925050509392505050565b60608261233e57612339826123b8565b6123b0565b60008251148015612366575060008473ffffffffffffffffffffffffffffffffffffffff163b145b156123a857836040517f9996b31500000000000000000000000000000000000000000000000000000000815260040161239f919061276b565b60405180910390fd5b8190506123b1565b5b9392505050565b6000815111156123cb5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000819050919050565b612410816123fd565b82525050565b600060208201905061242b6000830184612407565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061247661247161246c84612431565b612451565b612431565b9050919050565b60006124888261245b565b9050919050565b600061249a8261247d565b9050919050565b6124aa8161248f565b82525050565b60006020820190506124c560008301846124a1565b92915050565b600080fd5b60006124db82612431565b9050919050565b6124eb816124d0565b81146124f657600080fd5b50565b600081359050612508816124e2565b92915050565b6000612519826124d0565b9050919050565b6125298161250e565b811461253457600080fd5b50565b60008135905061254681612520565b92915050565b6000612557826124d0565b9050919050565b6125678161254c565b811461257257600080fd5b50565b6000813590506125848161255e565b92915050565b600060ff82169050919050565b6125a08161258a565b81146125ab57600080fd5b50565b6000813590506125bd81612597565b92915050565b600080600080608085870312156125dd576125dc6124cb565b5b60006125eb878288016124f9565b94505060206125fc87828801612537565b935050604061260d87828801612575565b925050606061261e878288016125ae565b91505092959194509250565b612633816123fd565b811461263e57600080fd5b50565b6000813590506126508161262a565b92915050565b60006020828403121561266c5761266b6124cb565b5b600061267a84828501612641565b91505092915050565b60008115159050919050565b61269881612683565b82525050565b60006020820190506126b3600083018461268f565b92915050565b600080600080608085870312156126d3576126d26124cb565b5b60006126e187828801612641565b94505060206126f287828801612641565b935050604061270387828801612641565b925050606061271487828801612641565b91505092959194509250565b600061272b8261247d565b9050919050565b61273b81612720565b82525050565b60006020820190506127566000830184612732565b92915050565b612765816124d0565b82525050565b6000602082019050612780600083018461275c565b92915050565b60006020828403121561279c5761279b6124cb565b5b60006127aa848285016124f9565b91505092915050565b6000602082840312156127c9576127c86124cb565b5b60006127d784828501612537565b91505092915050565b600060a0820190506127f56000830188612407565b6128026020830187612407565b61280f6040830186612407565b61281c6060830185612407565b6128296080830184612407565b9695505050505050565b6000815190506128428161262a565b92915050565b60006020828403121561285e5761285d6124cb565b5b600061286c84828501612833565b91505092915050565b6000819050919050565b600067ffffffffffffffff82169050919050565b60006128ae6128a96128a484612875565b612451565b61287f565b9050919050565b6128be81612893565b82525050565b60006020820190506128d960008301846128b5565b92915050565b60006040820190506128f4600083018561275c565b6129016020830184612407565b9392505050565b600060408201905061291d6000830185612407565b61292a6020830184612407565b9392505050565b60006080820190506129466000830187612407565b6129536020830186612407565b6129606040830185612407565b61296d6060830184612407565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006129b0826123fd565b91506129bb836123fd565b92508282019050808211156129d3576129d2612976565b5b92915050565b60006129e4826123fd565b91506129ef836123fd565b9250828203905081811115612a0757612a06612976565b5b92915050565b60008160011c9050919050565b6000808291508390505b6001851115612a6457808604811115612a4057612a3f612976565b5b6001851615612a4f5780820291505b8081029050612a5d85612a0d565b9450612a24565b94509492505050565b600082612a7d5760019050612b39565b81612a8b5760009050612b39565b8160018114612aa15760028114612aab57612ada565b6001915050612b39565b60ff841115612abd57612abc612976565b5b8360020a915084821115612ad457612ad3612976565b5b50612b39565b5060208310610133831016604e8410600b8410161715612b0f5782820a905083811115612b0a57612b09612976565b5b612b39565b612b1c8484846001612a1a565b92509050818404811115612b3357612b32612976565b5b81810290505b9392505050565b6000612b4b826123fd565b9150612b568361258a565b9250612b837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612a6d565b905092915050565b6000612b96826123fd565b9150612ba1836123fd565b9250828202612baf816123fd565b91508282048414831517612bc657612bc5612976565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b612c0581612683565b8114612c1057600080fd5b50565b600081519050612c2281612bfc565b92915050565b600060208284031215612c3e57612c3d6124cb565b5b6000612c4c84828501612c13565b91505092915050565b6000612c60826123fd565b9150612c6b836123fd565b925082612c7b57612c7a612bcd565b5b828204905092915050565b6000606082019050612c9b600083018661275c565b612ca8602083018561275c565b612cb56040830184612407565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000612cf78261258a565b9150612d028361258a565b925082612d1257612d11612bcd565b5b828206905092915050565b600081519050919050565b600081905092915050565b60005b83811015612d51578082015181840152602081019050612d36565b60008484015250505050565b6000612d6882612d1d565b612d728185612d28565b9350612d82818560208601612d33565b80840191505092915050565b6000612d9a8284612d5d565b91508190509291505056fea2646970667358221220faf637a8dc3373c0ab092700794c7911c20a6b6d9e94b32b2507422ce17e676764736f6c63430008180033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.