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
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60808060 | 19918935 | 67 days ago | IN | 0 ETH | 0.06557108 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
xGFETHMigrator
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 20000 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol"; import {MerkleProofUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/MerkleProofUpgradeable.sol"; import {BitMapsUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/structs/BitMapsUpgradeable.sol"; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {MathUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol"; import {IUniswapV2Pair} from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import {IUniswapV2Factory} from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol"; import {IUniswapV2Router02} from "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; import {IStakedZentryMinimal} from "../interfaces/IStakedZentryMinimal.sol"; import {IGFMigrator} from "../interfaces/IGFMigrator.sol"; import {IxGF} from "../interfaces/IxGF.sol"; import {IRewardManager} from "../interfaces/IRewardManager.sol"; import {LpMigrator} from "./LpMigrator.sol"; import {IGFMigrator} from "../interfaces/IGFMigrator.sol"; /** * @title xGFETHMigrator * @dev contract for migrating token from xGF and RewardManager to StakedZentryLP */ contract xGFETHMigrator is Initializable, OwnableUpgradeable { using MathUpgradeable for uint256; bytes32 public merkleRoot; IStakedZentryMinimal public stakedZentry; LpMigrator public lpMigrator; IGFMigrator public gfMigrator; IxGF public xGF; IRewardManager public rewardManager; IUniswapV2Pair public gfPair; IUniswapV2Pair public zentryPair; IERC20 public gfToken; IERC20 public zentryToken; IERC20 public weth; bool public migrationEnabled; /// @notice The amount of GF LP token migrated to this contract uint256 public totalShares; /// @notice The amount of Zentry LP token after migration uint256 public underlyingLiquidity; /// @notice The amount of Zentry Token that is a left over from LP migration uint256 public leftoverZentry; /// @notice The amount of WETH that is a left over from LP migration uint256 public leftoverWeth; /// @notice List of migrated index BitMapsUpgradeable.BitMap _migratedList; address public emergencyReturn; event Migrated(address _to, address _receiver, uint256 _amount); error MigrationAlreadyEnabled(); error MigrationDisabled(); error TokenNotMigrated(); error InsufficientGFBalance(); error AlreadyMigrated(uint256 index); error InvalidProof(); /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } modifier onlyMigrationEnabled() { if (!migrationEnabled) { revert MigrationDisabled(); } _; } modifier onlyMigrationDisabled() { if (migrationEnabled) { revert MigrationAlreadyEnabled(); } _; } function initialize( bytes32 _merkleRoot, IGFMigrator _gfMigrator, LpMigrator _lpMigrator, IxGF _xGF, IRewardManager _rewardManager, address _owner, address _emergencyReturn, address _zentryPair ) external initializer { OwnableUpgradeable.__Ownable_init(); merkleRoot = _merkleRoot; lpMigrator = _lpMigrator; gfMigrator = _gfMigrator; xGF = _xGF; rewardManager = _rewardManager; gfToken = IERC20(_gfMigrator.gfToken()); zentryToken = IERC20(_gfMigrator.zentryToken()); gfPair = _lpMigrator.gfPair(); zentryPair = IUniswapV2Pair(_zentryPair); weth = IERC20(_lpMigrator.weth()); emergencyReturn = _emergencyReturn; require(xGF.token() == address(gfPair), "Invalid xGF token"); require(rewardManager.rewardToken() == gfMigrator.gfToken(), "Invalid reward token"); _transferOwnership(_owner); } function setStakedZentry(IStakedZentryMinimal _stakedZentry) external onlyOwner { stakedZentry = _stakedZentry; } /** * @notice migrate xGF position to stakedZentry and stakedZentryLP */ function migrateLP(uint256 _index, uint256 _lockAmount, uint256 _rewardAmount, bytes32[] calldata _proof) external onlyMigrationEnabled { _migrateLP(_index, msg.sender, _lockAmount, _rewardAmount, _proof); } /** * @notice migrate xGF position to stakedZentry and stakedZentryLP on behalf of user */ function migrateLPFor( uint256 _index, address _for, uint256 _lockAmount, uint256 _rewardAmount, bytes32[] calldata _proof ) external onlyOwner onlyMigrationEnabled { _migrateLP(_index, _for, _lockAmount, _rewardAmount, _proof); } function _migrateLP( uint256 _index, address _receiver, uint256 _lockAmount, uint256 _reward, bytes32[] calldata _proof ) private { _validateMigrate(_index, _receiver, _lockAmount, _reward, _proof); BitMapsUpgradeable.set(_migratedList, _index); // Migrate reward if (_reward > 0) { uint256 amountZent_ = _reward * gfMigrator.MIGRATE_RATE(); IStakedZentryMinimal stakedZentry_ = stakedZentry; // gas saving zentryToken.approve(address(stakedZentry_), amountZent_); stakedZentry_.deposit(amountZent_, _receiver); emit Migrated(address(stakedZentry_), _receiver, amountZent_); } } function _validateMigrate( uint256 _index, address _receiver, uint256 _lockAmount, uint256 _reward, bytes32[] calldata _proof ) private view { if (BitMapsUpgradeable.get(_migratedList, _index)) { revert AlreadyMigrated(_index); } bytes32 leaf = keccak256(bytes.concat(keccak256(abi.encode(_index, _receiver, _lockAmount, _reward)))); if (!MerkleProofUpgradeable.verify(_proof, merkleRoot, leaf)) { revert InvalidProof(); } } /** * @notice conversion function from xGF lock balance to zentry LP * @param shares The amount of LP token locked in xGFETH contract * @return liquidity The amount of Zentry LP token that user will get */ function _convertToAssets(uint256 shares) private view returns (uint256 liquidity) { uint256 totalShares_ = totalShares; liquidity = shares.mulDiv(underlyingLiquidity, totalShares_); } function enableMigration() external onlyOwner onlyMigrationDisabled { migrationEnabled = true; } /** * @notice transfer token from xGF and RewardManager to this contract */ function transferIn() external onlyOwner onlyMigrationDisabled { uint256 gfLpBalBefore = gfPair.balanceOf(address(this)); xGF.transferToMigrator(); totalShares += gfPair.balanceOf(address(this)) - gfLpBalBefore; rewardManager.transferToMigrator(); } /** * @notice Migrate gf-eth LP to zentry-eth LP and migrate gf token to zentry token * @return amountZentIn amount of zentry sent to the pool * @return amountEthIn amount of weth sent to the pool * @return liquidity zentry LP token minted */ function migrateToZent(uint256 _amountZentMin, uint256 _amountETHMin, uint256 _deadline) external onlyOwner onlyMigrationDisabled returns (uint256 amountZentIn, uint256 amountEthIn, uint256 liquidity) { uint256 liquidityToMigrate_ = gfPair.balanceOf(address(this)); (amountZentIn, amountEthIn, liquidity) = _migrateToZent(liquidityToMigrate_, _amountZentMin, _amountETHMin, _deadline); gfToken.approve(address(gfMigrator), gfToken.balanceOf(address(this))); gfMigrator.migrate(); } /** * @notice migrate gf LP to zentry LP */ function _migrateToZent(uint256 liquidityToMigrate, uint256 amountZentMin, uint256 amountETHMin, uint256 deadline) private returns (uint256 amountZentIn, uint256 amountEthIn, uint256 liquidity) { uint256 zentBefore = zentryToken.balanceOf(address(this)); uint256 wethBefore = weth.balanceOf(address(this)); uint256 zentLpBefore = zentryPair.balanceOf(address(this)); gfPair.approve(address(lpMigrator), liquidityToMigrate); (amountZentIn, amountEthIn,) = lpMigrator.migrate(liquidityToMigrate, amountZentMin, amountETHMin, address(this), deadline); liquidity = zentryPair.balanceOf(address(this)) - zentLpBefore; underlyingLiquidity += liquidity; leftoverZentry += zentryToken.balanceOf(address(this)) - zentBefore; leftoverWeth += weth.balanceOf(address(this)) - wethBefore; } function transferInUnderlyingLiquidity(uint256 _amount) external onlyOwner { zentryPair.transferFrom(msg.sender, address(this), _amount); underlyingLiquidity += _amount; } function withdrawLeftover(address _to) external onlyOwner { if (leftoverZentry > 0) { zentryToken.transfer(_to, leftoverZentry); } if (leftoverWeth > 0) { weth.transfer(_to, leftoverWeth); } } function emergencyWithdrawLP() external onlyOwner { zentryPair.transfer(emergencyReturn, zentryPair.balanceOf(address(this))); } function emergencyWithdrawReward() external onlyOwner { zentryToken.transfer(emergencyReturn, zentryToken.balanceOf(address(this)) - leftoverZentry); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. 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 { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```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 Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * 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 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized != type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.2) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates merkle trees that are safe * against this attack out of the box. */ library MerkleProofUpgradeable { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} * * _Available since v4.7._ */ function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} * * _Available since v4.7._ */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { require(proofPos == proofLen, "MerkleProof: invalid multiproof"); unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { require(proofPos == proofLen, "MerkleProof: invalid multiproof"); unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library MathUpgradeable { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // 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. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/BitMaps.sol) pragma solidity ^0.8.0; /** * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential. * Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor]. */ library BitMapsUpgradeable { struct BitMap { mapping(uint256 => uint256) _data; } /** * @dev Returns whether the bit at `index` is set. */ function get(BitMap storage bitmap, uint256 index) internal view returns (bool) { uint256 bucket = index >> 8; uint256 mask = 1 << (index & 0xff); return bitmap._data[bucket] & mask != 0; } /** * @dev Sets the bit at `index` to the boolean `value`. */ function setTo(BitMap storage bitmap, uint256 index, bool value) internal { if (value) { set(bitmap, index); } else { unset(bitmap, index); } } /** * @dev Sets the bit at `index`. */ function set(BitMap storage bitmap, uint256 index) internal { uint256 bucket = index >> 8; uint256 mask = 1 << (index & 0xff); bitmap._data[bucket] |= mask; } /** * @dev Unsets the bit at `index`. */ function unset(BitMap storage bitmap, uint256 index) internal { uint256 bucket = index >> 8; uint256 mask = 1 << (index & 0xff); bitmap._data[bucket] &= ~mask; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol) pragma solidity ^0.8.0; import "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @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.encodeWithSelector(token.transfer.selector, 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.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @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); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to * 0 before setting it to a non-zero value. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * 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.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage); } } }
pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; }
pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; }
pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); }
pragma solidity >=0.6.2; import './IUniswapV2Router01.sol'; interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; interface IGFMigrator { function gfToken() external view returns (address); function zentryToken() external view returns (address); function migrate() external; function MIGRATE_RATE() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; interface IRewardManager { function rewardToken() external view returns (address); function transferToMigrator() external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; interface IStakedZentryMinimal { function asset() external view returns (address); function deposit(uint256 _assets, address _receiver) external returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; interface IxGF { /// token that is locked in the staking contract function token() external view returns (address); /// transfer token to migrator function transferToMigrator() external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {IUniswapV2Pair} from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import {IUniswapV2Factory} from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol"; import {IUniswapV2Router02} from "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; import {IGFMigrator} from "../interfaces/IGFMigrator.sol"; contract LpMigrator { using SafeERC20 for IERC20; IUniswapV2Router02 public immutable router; IERC20 public immutable gfToken; IERC20 public immutable zentryToken; IERC20 public immutable weth; IGFMigrator public immutable gfMigrator; IUniswapV2Pair public immutable gfPair; error ZentryPoolNotInitialized(); /** * Note that we approve the gfMigrator to spend gfToken and the router to spend zentryToken, weth and gfPair * since this contract is not intended to hold any token except during migration */ constructor(address _router, address _gfToken, address _zentryToken, address _gfMigrator) { router = IUniswapV2Router02(_router); gfToken = IERC20(_gfToken); zentryToken = IERC20(_zentryToken); weth = IERC20(router.WETH()); gfMigrator = IGFMigrator(_gfMigrator); address factory_ = IUniswapV2Router02(_router).factory(); gfPair = IUniswapV2Pair(IUniswapV2Factory(factory_).getPair(address(gfToken), address(weth))); if (IUniswapV2Factory(factory_).getPair(address(zentryToken), address(weth)) == address(0)) { revert ZentryPoolNotInitialized(); } gfToken.approve(address(gfMigrator), type(uint256).max); zentryToken.approve(address(router), type(uint256).max); weth.approve(address(router), type(uint256).max); gfPair.approve(address(router), type(uint256).max); } /** * migrate liquidity from gf-eth LP to zentry-eth LP * @return amountZent The amount of Zentry sent to zentry-eth pool * @return amountETH The amount of ETH sent to zentry-eth pool * @return liquidity The amount of zentry-eth liquidity minted */ function migrate( uint256 liquidityToMigrate, uint256 amountZentMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountZent, uint256 amountETH, uint256 liquidity) { gfPair.transferFrom(msg.sender, address(this), liquidityToMigrate); (, uint256 amountETHDesired) = router.removeLiquidity(address(gfToken), address(weth), liquidityToMigrate, 1, 1, address(this), deadline); uint256 zentryBalBefore = zentryToken.balanceOf(address(this)); gfMigrator.migrate(); uint256 amountZentDesired = zentryToken.balanceOf(address(this)) - zentryBalBefore; (amountZent, amountETH, liquidity) = router.addLiquidity( address(zentryToken), address(weth), amountZentDesired, amountETHDesired, amountZentMin, amountETHMin, to, deadline ); if (amountZentDesired > amountZent) { zentryToken.safeTransfer(msg.sender, amountZentDesired - amountZent); } else if (amountETHDesired > amountETH) { weth.safeTransfer(msg.sender, amountETHDesired - amountETH); } } }
{ "evmVersion": "shanghai", "viaIR": true, "optimizer": { "enabled": true, "runs": 20000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"AlreadyMigrated","type":"error"},{"inputs":[],"name":"InsufficientGFBalance","type":"error"},{"inputs":[],"name":"InvalidProof","type":"error"},{"inputs":[],"name":"MigrationAlreadyEnabled","type":"error"},{"inputs":[],"name":"MigrationDisabled","type":"error"},{"inputs":[],"name":"TokenNotMigrated","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"address","name":"_receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Migrated","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"},{"inputs":[],"name":"emergencyReturn","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyWithdrawLP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyWithdrawReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enableMigration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"gfMigrator","outputs":[{"internalType":"contract IGFMigrator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gfPair","outputs":[{"internalType":"contract IUniswapV2Pair","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gfToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"},{"internalType":"contract IGFMigrator","name":"_gfMigrator","type":"address"},{"internalType":"contract LpMigrator","name":"_lpMigrator","type":"address"},{"internalType":"contract IxGF","name":"_xGF","type":"address"},{"internalType":"contract IRewardManager","name":"_rewardManager","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_emergencyReturn","type":"address"},{"internalType":"address","name":"_zentryPair","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"leftoverWeth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"leftoverZentry","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lpMigrator","outputs":[{"internalType":"contract LpMigrator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"},{"internalType":"uint256","name":"_lockAmount","type":"uint256"},{"internalType":"uint256","name":"_rewardAmount","type":"uint256"},{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"}],"name":"migrateLP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"},{"internalType":"address","name":"_for","type":"address"},{"internalType":"uint256","name":"_lockAmount","type":"uint256"},{"internalType":"uint256","name":"_rewardAmount","type":"uint256"},{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"}],"name":"migrateLPFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountZentMin","type":"uint256"},{"internalType":"uint256","name":"_amountETHMin","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"migrateToZent","outputs":[{"internalType":"uint256","name":"amountZentIn","type":"uint256"},{"internalType":"uint256","name":"amountEthIn","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"migrationEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardManager","outputs":[{"internalType":"contract IRewardManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IStakedZentryMinimal","name":"_stakedZentry","type":"address"}],"name":"setStakedZentry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakedZentry","outputs":[{"internalType":"contract IStakedZentryMinimal","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transferIn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferInUnderlyingLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlyingLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"withdrawLeftover","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"xGF","outputs":[{"internalType":"contract IxGF","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"zentryPair","outputs":[{"internalType":"contract IUniswapV2Pair","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"zentryToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608080604052346100bf575f549060ff8260081c1661006d575060ff80821603610033575b60405161253e90816100c48239f35b60ff90811916175f557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160ff8152a15f610024565b62461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b6064820152608490fd5b5f80fdfe60806040526004361015610011575f80fd5b5f803560e01c806303472fa414611c615780630ad9048d14611c2d5780630cadd7a614611adc5780630f4ef8a614611aa85780631495ccb0146114db57806317d4178a1461141f5780631a7146f61461138f5780631d07d557146113715780631d735c541461133d5780632eb4a7ab1461131f57806335b944bf146112f95780633a98ef39146112db5780633fc8cef3146112a75780635a4519ea146112735780635a4b8c1d1461123f5780635dc502e9146111c25780635ee32aa6146111a4578063715018a6146111245780637841739814611016578063797cf5f3146105f45780637b0df651146105c05780637bb5de02146105435780638493aab1146104d85780638da5cb5b146104a45780638f69c00e14610470578063a9b637681461043c578063ac3d6ef414610408578063b46bae4214610291578063c225a79714610273578063f2fde38b146101a55763f5fdaba21461016f575f80fd5b346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff60695416604051908152f35b80fd5b50346101a25760206003193601126101a2576101bf611e2f565b6101c7611e83565b73ffffffffffffffffffffffffffffffffffffffff8116156101ef576101ec90611f02565b80f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b50346101a257806003193601126101a2576020607354604051908152f35b50346101a257806003193601126101a2576102aa611e83565b73ffffffffffffffffffffffffffffffffffffffff80606e54169060755416906040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526020928382602481865afa80156103fd57849286916103c6575b509261032261037c94607254906124ee565b91866040518096819582947fa9059cbb000000000000000000000000000000000000000000000000000000008452600484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b03925af180156103bb5761038e578280f35b816103ad92903d106103b4575b6103a58183611faf565b8101906120a7565b505f808280f35b503d61039b565b6040513d85823e3d90fd5b83819492503d83116103f6575b6103dd8183611faf565b810103126103f2579051839190610322610310565b5f80fd5b503d6103d3565b6040513d87823e3d90fd5b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff606c5416604051908152f35b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff606b5416604051908152f35b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff60685416604051908152f35b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff60335416604051908152f35b50346101a25760206003193601126101a25760043573ffffffffffffffffffffffffffffffffffffffff811680910361053f57610513611e83565b7fffffffffffffffffffffffff0000000000000000000000000000000000000000606654161760665580f35b5080fd5b50346101a25760806003193601126101a25760643567ffffffffffffffff811161053f57610575903690600401611e52565b60ff606f5460a01c1615610596576101ec91604435602435336004356120bf565b60046040517f1e6a33fb000000000000000000000000000000000000000000000000000000008152fd5b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff60665416604051908152f35b50346101a2576101006003193601126101a25760243573ffffffffffffffffffffffffffffffffffffffff8116810361053f576044359073ffffffffffffffffffffffffffffffffffffffff82168203611012576064359073ffffffffffffffffffffffffffffffffffffffff8216820361100e576084359073ffffffffffffffffffffffffffffffffffffffff8216820361100a5773ffffffffffffffffffffffffffffffffffffffff60a4351660a435036103f25760c4359373ffffffffffffffffffffffffffffffffffffffff851685036103f25760e4359073ffffffffffffffffffffffffffffffffffffffff821682036103f25786549560ff8760081c161596878098610ffd575b8015610fe6575b15610f62578760017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008316178a55610f34575b5061075560ff895460081c166107508161201c565b61201c565b61075e33611f02565b60043560655573ffffffffffffffffffffffffffffffffffffffff82167fffffffffffffffffffffffff00000000000000000000000000000000000000006067541617606755876068549373ffffffffffffffffffffffffffffffffffffffff86167fffffffffffffffffffffffff00000000000000000000000000000000000000008616176068556069549773ffffffffffffffffffffffffffffffffffffffff81167fffffffffffffffffffffffff00000000000000000000000000000000000000008a1617606955606a549873ffffffffffffffffffffffffffffffffffffffff89167fffffffffffffffffffffffff00000000000000000000000000000000000000008b1617606a556040517f0ad9048d00000000000000000000000000000000000000000000000000000000815260208160048173ffffffffffffffffffffffffffffffffffffffff8d165afa80156103fd5773ffffffffffffffffffffffffffffffffffffffff918691610f15575b50167fffffffffffffffffffffffff0000000000000000000000000000000000000000606d541617606d556040517f1d735c5400000000000000000000000000000000000000000000000000000000815260208160048173ffffffffffffffffffffffffffffffffffffffff8d165afa80156103fd5773ffffffffffffffffffffffffffffffffffffffff918691610ef6575b50167fffffffffffffffffffffffff0000000000000000000000000000000000000000606e541617606e55604051947fa9b6376800000000000000000000000000000000000000000000000000000000865260208660048173ffffffffffffffffffffffffffffffffffffffff8b165afa9586156103fd578596610e9e575b50602073ffffffffffffffffffffffffffffffffffffffff9495969785606b5497818b167fffffffffffffffffffffffff00000000000000000000000000000000000000008a1617606b55167fffffffffffffffffffffffff0000000000000000000000000000000000000000606c541617606c556004604051809781937f3fc8cef3000000000000000000000000000000000000000000000000000000008352165afa8015610e935786948591610e23575b509273ffffffffffffffffffffffffffffffffffffffff928360049381602097167fffffffffffffffffffffffff0000000000000000000000000000000000000000606f541617606f55167fffffffffffffffffffffffff0000000000000000000000000000000000000000607554161760755560405197889485937ffc0c546a000000000000000000000000000000000000000000000000000000008552169116175afa928315610e16578193610ddf575b501673ffffffffffffffffffffffffffffffffffffffff92831617911603610d8157602073ffffffffffffffffffffffffffffffffffffffff6004889695879660405198899485937ff7c618c1000000000000000000000000000000000000000000000000000000008552169116175afa9384156103bb578394610d44575b50600460209273ffffffffffffffffffffffffffffffffffffffff9260405195869485937f0ad9048d000000000000000000000000000000000000000000000000000000008552169116175afa908115610d395773ffffffffffffffffffffffffffffffffffffffff9182918691610d0a575b5016911603610cac57610c5160a435611f02565b610c585780f35b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff81541681557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a180f35b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e76616c69642072657761726420746f6b656e0000000000000000000000006044820152fd5b610d2c915060203d602011610d32575b610d248183611faf565b810190611ff0565b5f610c3d565b503d610d1a565b6040513d86823e3d90fd5b73ffffffffffffffffffffffffffffffffffffffff919450602092610d77600492853d8711610d3257610d248183611faf565b9592509250610bca565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f496e76616c69642078474620746f6b656e0000000000000000000000000000006044820152fd5b73ffffffffffffffffffffffffffffffffffffffff9350610e0f849160203d602011610d3257610d248183611faf565b9350610b4b565b50604051903d90823e3d90fd5b9192939450506020813d602011610e8b575b81610e4260209383611faf565b81010312610e8757519073ffffffffffffffffffffffffffffffffffffffff82168203610e87578593929173ffffffffffffffffffffffffffffffffffffffff610a98565b8580fd5b3d9150610e35565b6040513d88823e3d90fd5b90939495506020813d602011610eee575b81610ebc60209383611faf565b81010312610e8757519273ffffffffffffffffffffffffffffffffffffffff84168403610e87579294939260206109e5565b3d9150610eaf565b610f0f915060203d602011610d3257610d248183611faf565b5f610966565b610f2e915060203d602011610d3257610d248183611faf565b5f6108d3565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011788555f61073b565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b50303b1580156107085750600160ff821614610708565b50600160ff821610610701565b8480fd5b8380fd5b8280fd5b50346101a257806003193601126101a25761102f611e83565b73ffffffffffffffffffffffffffffffffffffffff80606c54169060755416906040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526020928382602481865afa9081156103fd57849286926110f1575b506040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116600482015260248101919091529182908186816044810161037c565b8381949293503d831161111d575b6111098183611faf565b810103126103f2579051839161037c611096565b503d6110ff565b50346101a257806003193601126101a25761113d611e83565b5f73ffffffffffffffffffffffffffffffffffffffff6033547fffffffffffffffffffffffff00000000000000000000000000000000000000008116603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50346101a257806003193601126101a2576020607154604051908152f35b50346101a25760a06003193601126101a25760243573ffffffffffffffffffffffffffffffffffffffff811681036103f25760843567ffffffffffffffff811161101257611214903690600401611e52565b9061121d611e83565b60ff606f5460a01c1615610596576101ec9260643590604435906004356120bf565b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff60755416604051908152f35b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff60675416604051908152f35b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff606f5416604051908152f35b50346101a257806003193601126101a2576020607054604051908152f35b50346101a257806003193601126101a257602060ff606f5460a01c166040519015158152f35b50346101a257806003193601126101a2576020606554604051908152f35b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff606e5416604051908152f35b50346101a257806003193601126101a2576020607254604051908152f35b50346101a257806003193601126101a2576113a8611e83565b606f5460ff8160a01c166113f5577fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000017606f5580f35b60046040517f2711a076000000000000000000000000000000000000000000000000000000008152fd5b50346101a25760206003193601126101a25760043561143c611e83565b606c546040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101839052919060209083906064908290879073ffffffffffffffffffffffffffffffffffffffff165af19182156103bb576114b7926114bd575b506071546124fb565b60715580f35b6114d49060203d81116103b4576103a58183611faf565b505f6114ae565b50346101a25760608060031936011261053f576114f6611e83565b606f549160ff8360a01c166113f55773ffffffffffffffffffffffffffffffffffffffff9283606b5416604051947f70a08231000000000000000000000000000000000000000000000000000000009182875230600488015260209260249484898781865afa9081156118fd57879899879892611a76575b508585606e5416604051998a80928782523060048301525afa978815611a3a578998611a45575b50908585928860405180958193888352306004840152165afa918215611a3a5790879392918a92611a08575b508686606c5416604051998a80928782523060048301525afa9788156119fd578a986119ce575b506067546040517f095ea7b30000000000000000000000000000000000000000000000000000000080825291881673ffffffffffffffffffffffffffffffffffffffff16600482015260248101839052909588908290818e816044810103925af180156119c357918c918c9897969594936119a6575b5060a48760675416916040519d8e9384927fe23d54030000000000000000000000000000000000000000000000000000000084526004840152600435898401528835604484015230606484015260443560848401525af1978815610e9357869a8799611971575b5083908887606c5416604051938480928882523060048301525afa8015611937578890611942575b6116f792506124ee565b986117048a6071546124fb565b607155838887606e5416604051928380928882523060048301525afa908115611937578891611908575b506117449161173c916124ee565b6072546124fb565b607255828786606f5416604051928380928782523060048301525afa9081156118fd5787916118ce575b506117849161177c916124ee565b6073546124fb565b60735583606d54169086856068541691604051948591825230600483015281855afa928315610e93579086889493928194611895575b5060405195865273ffffffffffffffffffffffffffffffffffffffff909116600486015260248501929092528391829081604481015b03925af180156103bb57611878575b5060685416803b1561053f578180916004604051809481937f8fd3ab800000000000000000000000000000000000000000000000000000000083525af1801561186d57611859575b50506040519384528301526040820152f35b6118638291611f6e565b6101a25780611847565b6040513d84823e3d90fd5b61188e90843d86116103b4576103a58183611faf565b505f6117ff565b9480929694508591503d83116118c7575b6118b08183611faf565b810103126103f2576117f0938688945193956117ba565b503d6118a6565b90508781813d83116118f6575b6118e58183611faf565b810103126103f2575161178461176e565b503d6118db565b6040513d89823e3d90fd5b90508881813d8311611930575b61191f8183611faf565b810103126103f2575161174461172e565b503d611915565b6040513d8a823e3d90fd5b508882813d831161196a575b6119588183611faf565b810103126103f2576116f791516116ed565b503d61194e565b9a5097508a8a813d811161199f575b61198a8183611faf565b81010312610e875789519987015197836116c5565b503d611980565b6119bc908a3d8c116103b4576103a58183611faf565b505f61165e565b6040513d8d823e3d90fd5b9097508681813d83116119f6575b6119e68183611faf565b810103126103f25751965f6115e8565b503d6119dc565b6040513d8c823e3d90fd5b935090508583813d8111611a33575b611a218183611faf565b810103126103f257869251905f6115c1565b503d611a17565b6040513d8b823e3d90fd5b919097508582813d8311611a6f575b611a5e8183611faf565b810103126103f25790519685611595565b503d611a54565b965090508486813d8111611aa1575b611a8f8183611faf565b810103126103f257869551905f61156e565b503d611a85565b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff606a5416604051908152f35b50346101a25760208060031936011261053f57611af7611e2f565b611aff611e83565b828260725480611ba3575b5050506073549081611b1a578380f35b606f546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff928316600482015260248101939093528391839160449183918891165af180156103bb57611b8557808380f35b81611b9b92903d106103b4576103a58183611faf565b505f80808380f35b606e546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301526024820193909352938492604492849291165af18015610d3957611c10575b828491611b0a565b611c2690833d85116103b4576103a58183611faf565b505f611c08565b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff606d5416604051908152f35b50346101a257806003193601126101a257611c7a611e83565b60ff606f5460a01c166113f55773ffffffffffffffffffffffffffffffffffffffff9081606b54169160405190817f70a08231000000000000000000000000000000000000000000000000000000009485825230600483015281602460209586935afa908115610d39578491611e02575b50816069541692833b1561100a57604051958587600481837fc53f849000000000000000000000000000000000000000000000000000000000998a83525af18015610e9357611dee575b8596508184606b54169160246040518094819382523060048301525afa918215610e93578692611db9575b5050611d7791611d6f916124ee565b6070546124fb565b607055606a541690813b15611db557829160048392604051948593849283525af1801561186d57611da55750f35b611dae90611f6e565b6101a25780f35b5050fd5b8196508092503d8311611de7575b611dd18183611faf565b810103126103f257925184939081611d6f611d60565b503d611dc7565b949095611dfa90611f6e565b938590611d35565b90508281813d8311611e28575b611e198183611faf565b8101031261100e57515f611ceb565b503d611e0f565b6004359073ffffffffffffffffffffffffffffffffffffffff821682036103f257565b9181601f840112156103f25782359167ffffffffffffffff83116103f2576020808501948460051b0101116103f257565b73ffffffffffffffffffffffffffffffffffffffff603354163303611ea457565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6033549073ffffffffffffffffffffffffffffffffffffffff80911691827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3565b67ffffffffffffffff8111611f8257604052565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117611f8257604052565b908160209103126103f2575173ffffffffffffffffffffffffffffffffffffffff811681036103f25790565b1561202357565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b908160209103126103f2575180151581036103f25790565b94959291958560081c5f526074602052600160ff87161b60405f2054166124bd5760405194602086019787895273ffffffffffffffffffffffffffffffffffffffff8416604088015260608701528360808701526080865260a0860167ffffffffffffffff988782108a831117611f825781604052875190209060c08801918252602081528060e08901108a60e08a011117611f825760e0880160405251902091606554988111611f82578060051b9061217f6020830160e08a01611faf565b60e088015261010087019036818401116103f25782915b81840183106124ad5750505050945f955b60e086015187101561223f576101008760051b87010151908181105f14612230575f5260205260405f205b957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461220357600101956121a7565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b905f5260205260405f206121d2565b919450929591945003612483578060081c5f526074602052600160ff60405f2092161b81541790558115801561227457505050565b6004602073ffffffffffffffffffffffffffffffffffffffff60685416604051928380927fa7392d830000000000000000000000000000000000000000000000000000000082525afa908115612427575f91612451575b5080840293840414171561220357606654606e546040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820181905260248201869052929091602091839160449183915f91165af1801561242757612432575b506040517f6e553f6500000000000000000000000000000000000000000000000000000000815283600482015273ffffffffffffffffffffffffffffffffffffffff831660248201526020816044815f865af18015612427576123fc575b506040805173ffffffffffffffffffffffffffffffffffffffff92831681529290911660208301528101919091527f928fd5531324ee87d76cc5307dc37580174da76b85cd546da631b2670bc266b590606090a1565b602090813d8311612420575b6124128183611faf565b810103126103f2575f6123a6565b503d612408565b6040513d5f823e3d90fd5b61244a9060203d6020116103b4576103a58183611faf565b505f612348565b90506020813d60201161247b575b8161246c60209383611faf565b810103126103f257515f6122cb565b3d915061245f565b60046040517f09bde339000000000000000000000000000000000000000000000000000000008152fd5b8235815260209283019201612196565b602486604051907ff3103e150000000000000000000000000000000000000000000000000000000082526004820152fd5b9190820391821161220357565b919082018092116122035756fea26469706673582212201bde3ed5cf2f496423f930163012368997562c27d432144d684e75589400c0f864736f6c63430008140033
Deployed Bytecode
0x60806040526004361015610011575f80fd5b5f803560e01c806303472fa414611c615780630ad9048d14611c2d5780630cadd7a614611adc5780630f4ef8a614611aa85780631495ccb0146114db57806317d4178a1461141f5780631a7146f61461138f5780631d07d557146113715780631d735c541461133d5780632eb4a7ab1461131f57806335b944bf146112f95780633a98ef39146112db5780633fc8cef3146112a75780635a4519ea146112735780635a4b8c1d1461123f5780635dc502e9146111c25780635ee32aa6146111a4578063715018a6146111245780637841739814611016578063797cf5f3146105f45780637b0df651146105c05780637bb5de02146105435780638493aab1146104d85780638da5cb5b146104a45780638f69c00e14610470578063a9b637681461043c578063ac3d6ef414610408578063b46bae4214610291578063c225a79714610273578063f2fde38b146101a55763f5fdaba21461016f575f80fd5b346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff60695416604051908152f35b80fd5b50346101a25760206003193601126101a2576101bf611e2f565b6101c7611e83565b73ffffffffffffffffffffffffffffffffffffffff8116156101ef576101ec90611f02565b80f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b50346101a257806003193601126101a2576020607354604051908152f35b50346101a257806003193601126101a2576102aa611e83565b73ffffffffffffffffffffffffffffffffffffffff80606e54169060755416906040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526020928382602481865afa80156103fd57849286916103c6575b509261032261037c94607254906124ee565b91866040518096819582947fa9059cbb000000000000000000000000000000000000000000000000000000008452600484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b03925af180156103bb5761038e578280f35b816103ad92903d106103b4575b6103a58183611faf565b8101906120a7565b505f808280f35b503d61039b565b6040513d85823e3d90fd5b83819492503d83116103f6575b6103dd8183611faf565b810103126103f2579051839190610322610310565b5f80fd5b503d6103d3565b6040513d87823e3d90fd5b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff606c5416604051908152f35b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff606b5416604051908152f35b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff60685416604051908152f35b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff60335416604051908152f35b50346101a25760206003193601126101a25760043573ffffffffffffffffffffffffffffffffffffffff811680910361053f57610513611e83565b7fffffffffffffffffffffffff0000000000000000000000000000000000000000606654161760665580f35b5080fd5b50346101a25760806003193601126101a25760643567ffffffffffffffff811161053f57610575903690600401611e52565b60ff606f5460a01c1615610596576101ec91604435602435336004356120bf565b60046040517f1e6a33fb000000000000000000000000000000000000000000000000000000008152fd5b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff60665416604051908152f35b50346101a2576101006003193601126101a25760243573ffffffffffffffffffffffffffffffffffffffff8116810361053f576044359073ffffffffffffffffffffffffffffffffffffffff82168203611012576064359073ffffffffffffffffffffffffffffffffffffffff8216820361100e576084359073ffffffffffffffffffffffffffffffffffffffff8216820361100a5773ffffffffffffffffffffffffffffffffffffffff60a4351660a435036103f25760c4359373ffffffffffffffffffffffffffffffffffffffff851685036103f25760e4359073ffffffffffffffffffffffffffffffffffffffff821682036103f25786549560ff8760081c161596878098610ffd575b8015610fe6575b15610f62578760017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008316178a55610f34575b5061075560ff895460081c166107508161201c565b61201c565b61075e33611f02565b60043560655573ffffffffffffffffffffffffffffffffffffffff82167fffffffffffffffffffffffff00000000000000000000000000000000000000006067541617606755876068549373ffffffffffffffffffffffffffffffffffffffff86167fffffffffffffffffffffffff00000000000000000000000000000000000000008616176068556069549773ffffffffffffffffffffffffffffffffffffffff81167fffffffffffffffffffffffff00000000000000000000000000000000000000008a1617606955606a549873ffffffffffffffffffffffffffffffffffffffff89167fffffffffffffffffffffffff00000000000000000000000000000000000000008b1617606a556040517f0ad9048d00000000000000000000000000000000000000000000000000000000815260208160048173ffffffffffffffffffffffffffffffffffffffff8d165afa80156103fd5773ffffffffffffffffffffffffffffffffffffffff918691610f15575b50167fffffffffffffffffffffffff0000000000000000000000000000000000000000606d541617606d556040517f1d735c5400000000000000000000000000000000000000000000000000000000815260208160048173ffffffffffffffffffffffffffffffffffffffff8d165afa80156103fd5773ffffffffffffffffffffffffffffffffffffffff918691610ef6575b50167fffffffffffffffffffffffff0000000000000000000000000000000000000000606e541617606e55604051947fa9b6376800000000000000000000000000000000000000000000000000000000865260208660048173ffffffffffffffffffffffffffffffffffffffff8b165afa9586156103fd578596610e9e575b50602073ffffffffffffffffffffffffffffffffffffffff9495969785606b5497818b167fffffffffffffffffffffffff00000000000000000000000000000000000000008a1617606b55167fffffffffffffffffffffffff0000000000000000000000000000000000000000606c541617606c556004604051809781937f3fc8cef3000000000000000000000000000000000000000000000000000000008352165afa8015610e935786948591610e23575b509273ffffffffffffffffffffffffffffffffffffffff928360049381602097167fffffffffffffffffffffffff0000000000000000000000000000000000000000606f541617606f55167fffffffffffffffffffffffff0000000000000000000000000000000000000000607554161760755560405197889485937ffc0c546a000000000000000000000000000000000000000000000000000000008552169116175afa928315610e16578193610ddf575b501673ffffffffffffffffffffffffffffffffffffffff92831617911603610d8157602073ffffffffffffffffffffffffffffffffffffffff6004889695879660405198899485937ff7c618c1000000000000000000000000000000000000000000000000000000008552169116175afa9384156103bb578394610d44575b50600460209273ffffffffffffffffffffffffffffffffffffffff9260405195869485937f0ad9048d000000000000000000000000000000000000000000000000000000008552169116175afa908115610d395773ffffffffffffffffffffffffffffffffffffffff9182918691610d0a575b5016911603610cac57610c5160a435611f02565b610c585780f35b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff81541681557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a180f35b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e76616c69642072657761726420746f6b656e0000000000000000000000006044820152fd5b610d2c915060203d602011610d32575b610d248183611faf565b810190611ff0565b5f610c3d565b503d610d1a565b6040513d86823e3d90fd5b73ffffffffffffffffffffffffffffffffffffffff919450602092610d77600492853d8711610d3257610d248183611faf565b9592509250610bca565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f496e76616c69642078474620746f6b656e0000000000000000000000000000006044820152fd5b73ffffffffffffffffffffffffffffffffffffffff9350610e0f849160203d602011610d3257610d248183611faf565b9350610b4b565b50604051903d90823e3d90fd5b9192939450506020813d602011610e8b575b81610e4260209383611faf565b81010312610e8757519073ffffffffffffffffffffffffffffffffffffffff82168203610e87578593929173ffffffffffffffffffffffffffffffffffffffff610a98565b8580fd5b3d9150610e35565b6040513d88823e3d90fd5b90939495506020813d602011610eee575b81610ebc60209383611faf565b81010312610e8757519273ffffffffffffffffffffffffffffffffffffffff84168403610e87579294939260206109e5565b3d9150610eaf565b610f0f915060203d602011610d3257610d248183611faf565b5f610966565b610f2e915060203d602011610d3257610d248183611faf565b5f6108d3565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011788555f61073b565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b50303b1580156107085750600160ff821614610708565b50600160ff821610610701565b8480fd5b8380fd5b8280fd5b50346101a257806003193601126101a25761102f611e83565b73ffffffffffffffffffffffffffffffffffffffff80606c54169060755416906040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526020928382602481865afa9081156103fd57849286926110f1575b506040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116600482015260248101919091529182908186816044810161037c565b8381949293503d831161111d575b6111098183611faf565b810103126103f2579051839161037c611096565b503d6110ff565b50346101a257806003193601126101a25761113d611e83565b5f73ffffffffffffffffffffffffffffffffffffffff6033547fffffffffffffffffffffffff00000000000000000000000000000000000000008116603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50346101a257806003193601126101a2576020607154604051908152f35b50346101a25760a06003193601126101a25760243573ffffffffffffffffffffffffffffffffffffffff811681036103f25760843567ffffffffffffffff811161101257611214903690600401611e52565b9061121d611e83565b60ff606f5460a01c1615610596576101ec9260643590604435906004356120bf565b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff60755416604051908152f35b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff60675416604051908152f35b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff606f5416604051908152f35b50346101a257806003193601126101a2576020607054604051908152f35b50346101a257806003193601126101a257602060ff606f5460a01c166040519015158152f35b50346101a257806003193601126101a2576020606554604051908152f35b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff606e5416604051908152f35b50346101a257806003193601126101a2576020607254604051908152f35b50346101a257806003193601126101a2576113a8611e83565b606f5460ff8160a01c166113f5577fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000017606f5580f35b60046040517f2711a076000000000000000000000000000000000000000000000000000000008152fd5b50346101a25760206003193601126101a25760043561143c611e83565b606c546040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101839052919060209083906064908290879073ffffffffffffffffffffffffffffffffffffffff165af19182156103bb576114b7926114bd575b506071546124fb565b60715580f35b6114d49060203d81116103b4576103a58183611faf565b505f6114ae565b50346101a25760608060031936011261053f576114f6611e83565b606f549160ff8360a01c166113f55773ffffffffffffffffffffffffffffffffffffffff9283606b5416604051947f70a08231000000000000000000000000000000000000000000000000000000009182875230600488015260209260249484898781865afa9081156118fd57879899879892611a76575b508585606e5416604051998a80928782523060048301525afa978815611a3a578998611a45575b50908585928860405180958193888352306004840152165afa918215611a3a5790879392918a92611a08575b508686606c5416604051998a80928782523060048301525afa9788156119fd578a986119ce575b506067546040517f095ea7b30000000000000000000000000000000000000000000000000000000080825291881673ffffffffffffffffffffffffffffffffffffffff16600482015260248101839052909588908290818e816044810103925af180156119c357918c918c9897969594936119a6575b5060a48760675416916040519d8e9384927fe23d54030000000000000000000000000000000000000000000000000000000084526004840152600435898401528835604484015230606484015260443560848401525af1978815610e9357869a8799611971575b5083908887606c5416604051938480928882523060048301525afa8015611937578890611942575b6116f792506124ee565b986117048a6071546124fb565b607155838887606e5416604051928380928882523060048301525afa908115611937578891611908575b506117449161173c916124ee565b6072546124fb565b607255828786606f5416604051928380928782523060048301525afa9081156118fd5787916118ce575b506117849161177c916124ee565b6073546124fb565b60735583606d54169086856068541691604051948591825230600483015281855afa928315610e93579086889493928194611895575b5060405195865273ffffffffffffffffffffffffffffffffffffffff909116600486015260248501929092528391829081604481015b03925af180156103bb57611878575b5060685416803b1561053f578180916004604051809481937f8fd3ab800000000000000000000000000000000000000000000000000000000083525af1801561186d57611859575b50506040519384528301526040820152f35b6118638291611f6e565b6101a25780611847565b6040513d84823e3d90fd5b61188e90843d86116103b4576103a58183611faf565b505f6117ff565b9480929694508591503d83116118c7575b6118b08183611faf565b810103126103f2576117f0938688945193956117ba565b503d6118a6565b90508781813d83116118f6575b6118e58183611faf565b810103126103f2575161178461176e565b503d6118db565b6040513d89823e3d90fd5b90508881813d8311611930575b61191f8183611faf565b810103126103f2575161174461172e565b503d611915565b6040513d8a823e3d90fd5b508882813d831161196a575b6119588183611faf565b810103126103f2576116f791516116ed565b503d61194e565b9a5097508a8a813d811161199f575b61198a8183611faf565b81010312610e875789519987015197836116c5565b503d611980565b6119bc908a3d8c116103b4576103a58183611faf565b505f61165e565b6040513d8d823e3d90fd5b9097508681813d83116119f6575b6119e68183611faf565b810103126103f25751965f6115e8565b503d6119dc565b6040513d8c823e3d90fd5b935090508583813d8111611a33575b611a218183611faf565b810103126103f257869251905f6115c1565b503d611a17565b6040513d8b823e3d90fd5b919097508582813d8311611a6f575b611a5e8183611faf565b810103126103f25790519685611595565b503d611a54565b965090508486813d8111611aa1575b611a8f8183611faf565b810103126103f257869551905f61156e565b503d611a85565b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff606a5416604051908152f35b50346101a25760208060031936011261053f57611af7611e2f565b611aff611e83565b828260725480611ba3575b5050506073549081611b1a578380f35b606f546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff928316600482015260248101939093528391839160449183918891165af180156103bb57611b8557808380f35b81611b9b92903d106103b4576103a58183611faf565b505f80808380f35b606e546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301526024820193909352938492604492849291165af18015610d3957611c10575b828491611b0a565b611c2690833d85116103b4576103a58183611faf565b505f611c08565b50346101a257806003193601126101a257602073ffffffffffffffffffffffffffffffffffffffff606d5416604051908152f35b50346101a257806003193601126101a257611c7a611e83565b60ff606f5460a01c166113f55773ffffffffffffffffffffffffffffffffffffffff9081606b54169160405190817f70a08231000000000000000000000000000000000000000000000000000000009485825230600483015281602460209586935afa908115610d39578491611e02575b50816069541692833b1561100a57604051958587600481837fc53f849000000000000000000000000000000000000000000000000000000000998a83525af18015610e9357611dee575b8596508184606b54169160246040518094819382523060048301525afa918215610e93578692611db9575b5050611d7791611d6f916124ee565b6070546124fb565b607055606a541690813b15611db557829160048392604051948593849283525af1801561186d57611da55750f35b611dae90611f6e565b6101a25780f35b5050fd5b8196508092503d8311611de7575b611dd18183611faf565b810103126103f257925184939081611d6f611d60565b503d611dc7565b949095611dfa90611f6e565b938590611d35565b90508281813d8311611e28575b611e198183611faf565b8101031261100e57515f611ceb565b503d611e0f565b6004359073ffffffffffffffffffffffffffffffffffffffff821682036103f257565b9181601f840112156103f25782359167ffffffffffffffff83116103f2576020808501948460051b0101116103f257565b73ffffffffffffffffffffffffffffffffffffffff603354163303611ea457565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6033549073ffffffffffffffffffffffffffffffffffffffff80911691827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3565b67ffffffffffffffff8111611f8257604052565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117611f8257604052565b908160209103126103f2575173ffffffffffffffffffffffffffffffffffffffff811681036103f25790565b1561202357565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b908160209103126103f2575180151581036103f25790565b94959291958560081c5f526074602052600160ff87161b60405f2054166124bd5760405194602086019787895273ffffffffffffffffffffffffffffffffffffffff8416604088015260608701528360808701526080865260a0860167ffffffffffffffff988782108a831117611f825781604052875190209060c08801918252602081528060e08901108a60e08a011117611f825760e0880160405251902091606554988111611f82578060051b9061217f6020830160e08a01611faf565b60e088015261010087019036818401116103f25782915b81840183106124ad5750505050945f955b60e086015187101561223f576101008760051b87010151908181105f14612230575f5260205260405f205b957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461220357600101956121a7565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b905f5260205260405f206121d2565b919450929591945003612483578060081c5f526074602052600160ff60405f2092161b81541790558115801561227457505050565b6004602073ffffffffffffffffffffffffffffffffffffffff60685416604051928380927fa7392d830000000000000000000000000000000000000000000000000000000082525afa908115612427575f91612451575b5080840293840414171561220357606654606e546040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820181905260248201869052929091602091839160449183915f91165af1801561242757612432575b506040517f6e553f6500000000000000000000000000000000000000000000000000000000815283600482015273ffffffffffffffffffffffffffffffffffffffff831660248201526020816044815f865af18015612427576123fc575b506040805173ffffffffffffffffffffffffffffffffffffffff92831681529290911660208301528101919091527f928fd5531324ee87d76cc5307dc37580174da76b85cd546da631b2670bc266b590606090a1565b602090813d8311612420575b6124128183611faf565b810103126103f2575f6123a6565b503d612408565b6040513d5f823e3d90fd5b61244a9060203d6020116103b4576103a58183611faf565b505f612348565b90506020813d60201161247b575b8161246c60209383611faf565b810103126103f257515f6122cb565b3d915061245f565b60046040517f09bde339000000000000000000000000000000000000000000000000000000008152fd5b8235815260209283019201612196565b602486604051907ff3103e150000000000000000000000000000000000000000000000000000000082526004820152fd5b9190820391821161220357565b919082018092116122035756fea26469706673582212201bde3ed5cf2f496423f930163012368997562c27d432144d684e75589400c0f864736f6c63430008140033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.