Source Code
Overview
S Balance
0 S
More Info
ContractCreator
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
4564895 | 4 days ago | 0 S |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
VaultU
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT import "./IVault2.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; contract VaultU is IVault2, UUPSUpgradeable, OwnableUpgradeable { uint256 public constant ADMIN_ROLE = 0; uint256 public constant TRADER_ROLE = 1; uint256 public constant TREASURER_ROLE = 2; string constant STAKE_PREFIX = "s_"; string constant CONTRACT_SUFFIX = "_rbxv"; address public timelock; address public rabbitx; address public defaultToken; mapping(address => bool) public supportedTokens; mapping(address => uint256) public minStakes; bool public ownerIsSoleAdmin; mapping(address => mapping(uint256 => bool)) public signers; uint256 nextStakeNum; event AddRole( address indexed user, uint256 indexed role, address indexed caller ); event RemoveRole( address indexed user, uint256 indexed role, address indexed caller ); event Withdrawal(address indexed to, uint256 amount, address indexed token); event SetRabbitX(address indexed rabbitx); event SupportToken(address token, uint256 minStake); event UnsupportToken(address token); modifier onlyTimelock() { require(msg.sender == timelock, "ONLY_TIMELOCK"); _; } /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } function initialize( address _timelock, address _owner, address _rabbitx, address _defaultToken, uint256 _minStake, address[] memory _otherTokens, uint256[] memory _minStakes ) public initializer { __Ownable_init(_owner); __UUPSUpgradeable_init(); nextStakeNum = 1; timelock = _timelock; signers[_owner][ADMIN_ROLE] = true; signers[_owner][TREASURER_ROLE] = true; rabbitx = _rabbitx; defaultToken = _defaultToken; supportedTokens[_defaultToken] = true; minStakes[_defaultToken] = _minStake; for (uint256 i = 0; i < _otherTokens.length; i++) { address token = _otherTokens[i]; supportedTokens[token] = true; minStakes[token] = _minStakes[i]; } } modifier onlyAdmin() { if (ownerIsSoleAdmin) { address currentOwner = owner(); require(msg.sender == currentOwner, "NOT_OWNER"); } else { require(signers[msg.sender][ADMIN_ROLE], "NOT_AN_ADMIN"); } _; } function _authorizeUpgrade( address newImplementation ) internal override onlyTimelock {} function supportToken( address _token, uint256 _minStake ) external onlyOwner { supportedTokens[_token] = true; minStakes[_token] = _minStake; emit SupportToken(_token, _minStake); } function unsupportToken(address _token) external onlyOwner { supportedTokens[_token] = false; emit UnsupportToken(_token); } function allocateStakeId() private returns (string memory) { uint256 stakeNum = nextStakeNum; nextStakeNum++; return string( abi.encodePacked( STAKE_PREFIX, Strings.toString(stakeNum), CONTRACT_SUFFIX ) ); } function stake(uint256 amount) external { stakeToken(amount, defaultToken); } function stakeToken(uint256 amount, address token) public { require(supportedTokens[token], "UNSUPPORTED_TOKEN"); require(amount >= minStakes[token], "AMOUNT_TOO_SMALL"); string memory stakeId = allocateStakeId(); emit Stake(stakeId, msg.sender, amount, token); uint256 prevBalance = IERC20(token).balanceOf(rabbitx); require( makeTransferFrom(msg.sender, rabbitx, amount, token), "TRANSFER_FAILED" ); uint256 newBalance = IERC20(token).balanceOf(rabbitx); require(newBalance == amount + prevBalance, "NOT_ENOUGH_TRANSFERRED"); } /** * @notice does the user have the ADMIN_ROLE - which gives * the ability to add and remove roles for other users * * @param user the address to check * @return true if the user has the ADMIN_ROLE */ function isAdmin(address user) external view returns (bool) { if (ownerIsSoleAdmin) { address currentOwner = owner(); return user == currentOwner; } else { return signers[user][ADMIN_ROLE]; } } receive() external payable { handleReceivedNative(); } function stakeNative() external payable { handleReceivedNative(); } function handleReceivedNative() internal { address native = address(0); require(supportedTokens[native], "UNSUPPORTED_TOKEN"); uint256 minStake = minStakes[native]; require(msg.value >= minStake, "AMOUNT_TOO_SMALL"); string memory stakeId = allocateStakeId(); emit Stake(stakeId, msg.sender, msg.value, native); (bool success, ) = rabbitx.call{value: msg.value}(""); require(success, "TRANSFER_FAILED"); } /** * @notice give the user the ADMIN_ROLE - which gives * the ability to add and remove roles for other users * * @dev the caller must themselves have the ADMIN_ROLE * * @param user the address to give the ADMIN_ROLE to */ function addAdmin(address user) external { addRole(user, ADMIN_ROLE); } /** * @notice take away the ADMIN_ROLE - which removes * the ability to add and remove roles for other users * * @dev the caller must themselves have the ADMIN_ROLE * * @param user the address from which to remove the ADMIN_ROLE */ function removeAdmin(address user) external { removeRole(user, ADMIN_ROLE); } /** * @notice does the user have the TRADER_ROLE - which gives * the ability to trade on the rabbit exchange with the vault's funds * * @param user the address to check * @return true if the user has the TRADER_ROLE */ function isTrader(address user) external view returns (bool) { return signers[user][TRADER_ROLE]; } /** * @notice give the user the TRADER_ROLE - which gives * the ability to trade on the rabbit exchange with the vault's funds * * @dev the caller must have the ADMIN_ROLE * * @param user the address to give the TRADER_ROLE to */ function addTrader(address user) external { addRole(user, TRADER_ROLE); } /** * @notice take away the TRADER_ROLE - which removes * the ability to trade on the rabbit exchange with the vault's funds * * @dev the caller must have the ADMIN_ROLE * * @param user the address from which to remove the TRADER_ROLE */ function removeTrader(address user) external { removeRole(user, TRADER_ROLE); } /** * @notice does the user have the TREASURER_ROLE - which gives * the ability to deposit the vault's funds into the rabbit exchange * * @param user the address to check * @return true if the user has the TREASURER_ROLE */ function isTreasurer(address user) public view returns (bool) { return signers[user][TREASURER_ROLE]; } /** * @notice give the user the TREASURER_ROLE - which gives * the ability to deposit the vault's funds into the rabbit exchange * * @dev the caller must have the ADMIN_ROLE * * @param user the address to give the TREASURER_ROLE to */ function addTreasurer(address user) external { addRole(user, TREASURER_ROLE); } /** * @notice take away the TREASURER_ROLE - which removes * the ability to deposit the vault's funds into the rabbit exchange * * @dev the caller must have the ADMIN_ROLE * * @param user the address from which to remove the TREASURER_ROLE */ function removeTreasurer(address user) external { removeRole(user, TREASURER_ROLE); } /** * @notice does the user have the specified role * * @dev the roles recognised by the vault are * ADMIN_ROLE (0), TRADER_ROLE (1) and TREASURER_ROLE (2), other roles can * be given and removed, but they have no special meaning for the vault * * @param signer the address to check * @param role the role to check * @return true if the user has the specified role */ function isValidSigner( address signer, uint256 role ) external view returns (bool) { return signers[signer][role]; } /** * @notice give the user the specified role * * @dev the caller must have the ADMIN_ROLE * @dev the roles recognised by the vault are * ADMIN_ROLE (0), TRADER_ROLE (1) and TREASURER_ROLE (2), other roles can * be given and removed, but they have no special meaning for the vault * * @param signer the address to which to give the role * @param role the role to give */ function addRole(address signer, uint256 role) public onlyAdmin { signers[signer][role] = true; emit AddRole(signer, role, msg.sender); } /** * @notice take away the specified role from the user * * @dev the caller must have the ADMIN_ROLE * @dev the roles recognised by the vault are * ADMIN_ROLE (0), TRADER_ROLE (1) and TREASURER_ROLE (2), other roles can * be given and removed, but they have no special meaning for the vault * * @param signer the address from which to remove the role * @param role the role to remove */ function removeRole(address signer, uint256 role) public onlyAdmin { signers[signer][role] = false; emit RemoveRole(signer, role, msg.sender); } function makeOwnerAdmin() external onlyOwner { address currentOwner = owner(); signers[currentOwner][ADMIN_ROLE] = true; } function setOwnerIsSoleAdmin(bool value) external onlyOwner { ownerIsSoleAdmin = value; } function transferOwnership( address newOwner ) public virtual override onlyTimelock { require(newOwner != address(0), "ZERO_OWNER"); _transferOwnership(newOwner); } /** * @notice sets the address of the rabbit exchange contract * * @dev WARNING incorrect setting could lead to loss of funds when * calling makeDeposit, normally set during deployment * @dev only the vault owner can call this function * * @param _rabbitx the address of the rabbit exchange contract */ function setRabbit(address _rabbitx) external onlyOwner { rabbitx = _rabbitx; emit SetRabbitX(_rabbitx); } /** * @notice withdraws funds from the vault, not normally used * as no funds are held on the vault - staking sends them directly * to the rabbitx exchange * * @dev the vault must already have a sufficient token balance, * calling this function does not withdraw funds from the rabbit * exchange to the vault * @dev only the vault owner can call this function * * @param amount the amount of tokens to withdraw * @param to the address to which to send the tokens */ function withdrawTokensTo( address to, uint256 amount, address token ) external onlyOwner { require(amount > 0, "WRONG_AMOUNT"); require(to != address(0), "ZERO_TO_ADDRESS"); bool success = makeTransfer(to, amount, token); require(success, "TRANSFER_FAILED"); emit Withdrawal(to, amount, token); } function withdrawNativeTo(address to, uint256 amount) external onlyOwner { require(amount > 0, "WRONG_AMOUNT"); require(to != address(0), "ZERO_TO_ADDRESS"); (bool success, ) = to.call{value: amount}(""); require(success, "TRANSFER_FAILED"); emit Withdrawal(to, amount, address(0)); } function makeTransfer( address to, uint256 amount, address token ) private returns (bool success) { return tokenCall( token, abi.encodeWithSelector( IERC20(token).transfer.selector, to, amount ) ); } function makeTransferFrom( address from, address to, uint256 amount, address token ) private returns (bool success) { return tokenCall( token, abi.encodeWithSelector( IERC20(token).transferFrom.selector, from, to, amount ) ); } function tokenCall( address token, bytes memory data ) private returns (bool) { (bool success, bytes memory returndata) = token.call(data); if (success) { if (returndata.length > 0) { success = abi.decode(returndata, (bool)); } else { success = token.code.length > 0; } } return success; } function getVersion() public pure returns (uint256) { return 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Ownable struct OwnableStorage { address _owner; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300; function _getOwnableStorage() private pure returns (OwnableStorage storage $) { assembly { $.slot := OwnableStorageLocation } } /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ function __Ownable_init(address initialOwner) internal onlyInitializing { __Ownable_init_unchained(initialOwner); } function __Ownable_init_unchained(address initialOwner) internal onlyInitializing { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { OwnableStorage storage $ = _getOwnableStorage(); return $._owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { OwnableStorage storage $ = _getOwnableStorage(); address oldOwner = $._owner; $._owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._initialized = 1; if (isTopLevelCall) { $._initializing = true; } _; if (isTopLevelCall) { $._initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._initialized = version; $._initializing = true; _; $._initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.20; import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol"; import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol"; import {Initializable} from "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. */ abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable address private immutable __self = address(this); /** * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)` * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called, * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string. * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function * during an upgrade. */ string public constant UPGRADE_INTERFACE_VERSION = "5.0.0"; /** * @dev The call is from an unauthorized context. */ error UUPSUnauthorizedCallContext(); /** * @dev The storage `slot` is unsupported as a UUID. */ error UUPSUnsupportedProxiableUUID(bytes32 slot); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { _checkProxy(); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { _checkNotDelegated(); _; } function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual notDelegated returns (bytes32) { return ERC1967Utils.IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data); } /** * @dev Reverts if the execution is not performed via delegatecall or the execution * context is not of a proxy with an ERC1967-compliant implementation pointing to self. * See {_onlyProxy}. */ function _checkProxy() internal view virtual { if ( address(this) == __self || // Must be called through delegatecall ERC1967Utils.getImplementation() != __self // Must be called through an active proxy ) { revert UUPSUnauthorizedCallContext(); } } /** * @dev Reverts if the execution is performed via delegatecall. * See {notDelegated}. */ function _checkNotDelegated() internal view virtual { if (address(this) != __self) { // Must not be called through delegatecall revert UUPSUnauthorizedCallContext(); } } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call. * * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value * is expected to be the implementation slot in ERC1967. * * Emits an {IERC1967-Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) { revert UUPSUnsupportedProxiableUUID(slot); } ERC1967Utils.upgradeToAndCall(newImplementation, data); } catch { // The implementation is not UUPS revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.20; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.20; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {UpgradeableBeacon} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol) pragma solidity ^0.8.20; import {IBeacon} from "../beacon/IBeacon.sol"; import {Address} from "../../utils/Address.sol"; import {StorageSlot} from "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. */ library ERC1967Utils { // We re-declare ERC-1967 events here because they can't be used directly from IERC1967. // This will be fixed in Solidity 0.8.21. At that point we should remove these events. /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Emitted when the beacon is changed. */ event BeaconUpgraded(address indexed beacon); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev The `implementation` of the proxy is invalid. */ error ERC1967InvalidImplementation(address implementation); /** * @dev The `admin` of the proxy is invalid. */ error ERC1967InvalidAdmin(address admin); /** * @dev The `beacon` of the proxy is invalid. */ error ERC1967InvalidBeacon(address beacon); /** * @dev An upgrade function sees `msg.value > 0` that may be lost. */ error ERC1967NonPayable(); /** * @dev Returns the current implementation address. */ function getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { if (newImplementation.code.length == 0) { revert ERC1967InvalidImplementation(newImplementation); } StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Performs implementation upgrade with additional setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); if (data.length > 0) { Address.functionDelegateCall(newImplementation, data); } else { _checkNonPayable(); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { if (newAdmin == address(0)) { revert ERC1967InvalidAdmin(address(0)); } StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {IERC1967-AdminChanged} event. */ function changeAdmin(address newAdmin) internal { emit AdminChanged(getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { if (newBeacon.code.length == 0) { revert ERC1967InvalidBeacon(newBeacon); } StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon; address beaconImplementation = IBeacon(newBeacon).implementation(); if (beaconImplementation.code.length == 0) { revert ERC1967InvalidImplementation(beaconImplementation); } } /** * @dev Change the beacon and trigger a setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-BeaconUpgraded} event. * * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for * efficiency. */ function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } else { _checkNonPayable(); } } /** * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract * if an upgrade doesn't perform an initialization call. */ function _checkNonPayable() private { if (msg.value > 0) { revert ERC1967NonPayable(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT interface IVault2 { event Stake( string id, address indexed trader, uint256 amount, address indexed token ); function isValidSigner( address signer, uint256 role ) external view returns (bool); }
{ "viaIR": true, "optimizer": { "enabled": true, "runs": 200, "details": { "yulDetails": { "optimizerSteps": "u" } } }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"role","type":"uint256"},{"indexed":true,"internalType":"address","name":"caller","type":"address"}],"name":"AddRole","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"role","type":"uint256"},{"indexed":true,"internalType":"address","name":"caller","type":"address"}],"name":"RemoveRole","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"rabbitx","type":"address"}],"name":"SetRabbitX","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"id","type":"string"},{"indexed":true,"internalType":"address","name":"trader","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"Stake","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"minStake","type":"uint256"}],"name":"SupportToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"UnsupportToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"Withdrawal","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TRADER_ROLE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TREASURER_ROLE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"addAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"uint256","name":"role","type":"uint256"}],"name":"addRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"addTrader","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"addTreasurer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"defaultToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVersion","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_timelock","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_rabbitx","type":"address"},{"internalType":"address","name":"_defaultToken","type":"address"},{"internalType":"uint256","name":"_minStake","type":"uint256"},{"internalType":"address[]","name":"_otherTokens","type":"address[]"},{"internalType":"uint256[]","name":"_minStakes","type":"uint256[]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"isTrader","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"isTreasurer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"uint256","name":"role","type":"uint256"}],"name":"isValidSigner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"makeOwnerAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"minStakes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ownerIsSoleAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rabbitx","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"removeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"uint256","name":"role","type":"uint256"}],"name":"removeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"removeTrader","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"removeTreasurer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"value","type":"bool"}],"name":"setOwnerIsSoleAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rabbitx","type":"address"}],"name":"setRabbit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"signers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakeNative","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"token","type":"address"}],"name":"stakeToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_minStake","type":"uint256"}],"name":"supportToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"supportedTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timelock","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"unsupportToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawNativeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"token","type":"address"}],"name":"withdrawTokensTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60a0604052346200003657620000146200003b565b60405161266a620001e48239608051818181611bf50152611d7c015261266a90f35b600080fd5b6200004562000051565b6200004f6200012c565b565b6200004f6200004f6200009a565b620000759062000078906001600160a01b031682565b90565b6001600160a01b031690565b62000075906200005f565b620000759062000084565b620000a5306200008f565b608052565b620000759060401c60ff1690565b620000759054620000aa565b62000075905b6001600160401b031690565b620000759054620000c4565b6200007590620000ca906001600160401b031682565b906200010c620000756200012892620000e2565b82546001600160401b0319166001600160401b03919091161790565b9055565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a006200015881620000b8565b620001d1576200016881620000d6565b6001600160401b039190829081160362000180575050565b81620001b27fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d293620001cc93620000f8565b604051918291826001600160401b03909116815260200190565b0390a1565b60405163f92ee8a960e01b8152600490fdfe60806040526004361015610023575b361561001957600080fd5b610021610dea565b005b60003560e01c80630a1f194f146102a35780630d8e6e2c1461029e5780631785f53c1461029957806324d7806c146102945780634039ad0d1461028f57806346c2df8d1461028a5780634f1ef28614610285578063515fe3c41461028057806352d1902d1461027b57806353635d76146102765780635800902914610271578063590fcdda1461026c5780635d428e081461026757806368c4ac2614610262578063704802751461025d578063715018a61461025857806374c13fda1461025357806375b238fc1461024e57806379db5f67146102495780637c713fd4146102445780637fde1c8a1461023f578063883b53e81461023a5780638da5cb5b1461023557806396f0248a14610230578063999323f01461022b5780639ee3060014610226578063a694fc3a14610221578063ab56a29c1461021c578063ad3cb1cc14610217578063bd18a99b14610212578063c19ef54e1461020d578063cc0d50e614610208578063d33219b414610203578063d692f4c5146101fe578063df025ec6146101f9578063e1326b34146101f4578063ee3d6866146101ef578063f0a3a97c146101ea578063f0a56fc8146101e55763f2fde38b0361000e57610c5a565b610c3f565b610c12565b610be8565b610bcc565b610b90565b610b77565b610b5c565b610b36565b610b1e565b610b06565b610adf565b610a1a565b610a02565b6109d5565b61099e565b61097a565b61095f565b610940565b6107b2565b610799565b610750565b610735565b6106fb565b6106d7565b6106bf565b6106a4565b61065d565b61064a565b610615565b6105d5565b610584565b610569565b6104ec565b6103d6565b610392565b610365565b61034d565b610321565b6102f1565b6001600160a01b031690565b90565b6001600160a01b0381165b036102c957565b600080fd5b905035906102db826102b7565b565b906020828203126102c9576102b4916102ce565b346102c9576103096103043660046102dd565b610c72565b604051005b0390f35b60009103126102c957565b9052565b346102c957610331366004610312565b61030e61033c610c2d565b6040515b9182918290815260200190565b346102c9576103096103603660046102dd565b610c7e565b346102c95761030e61038061037b3660046102dd565b610c9d565b60405191829182901515815260200190565b346102c95761030e6103806103a83660046102dd565b610cef565b8015156102c2565b905035906102db826103ad565b906020828203126102c9576102b4916103b5565b346102c9576103096103e93660046103c2565b610d57565b634e487b7160e01b600052604160045260246000fd5b90601f01601f1916810190811067ffffffffffffffff82111761042657604052565b6103ee565b906102db61043860405190565b9283610404565b67ffffffffffffffff811161042657602090601f01601f19160190565b0190565b90826000939282370152565b9092919261048161047c8261043f565b61042b565b93818552818301116102c9576102db916020850190610460565b9080601f830112156102c9578160206102b49335910161046c565b9190916040818403126102c9576104cd83826102ce565b92602082013567ffffffffffffffff81116102c9576102b4920161049b565b6103096104fa3660046104b6565b90610d80565b6102b4906102a8906001600160a01b031682565b6102b490610500565b6102b490610514565b906105309061051d565b600052602052604060002090565b6102b4916008021c81565b906102b4915461053e565b60006105646102b4926004610526565b610549565b346102c95761030e61033c61057f3660046102dd565b610554565b346102c957610594366004610312565b61030e61033c610dcd565b806102c2565b905035906102db8261059f565b91906040838203126102c9576102b49060206105ce82866102ce565b94016105a5565b346102c95761030e6103806105eb3660046105b2565b90610dd7565b6102b4916008021c6102a8565b906102b491546105f1565b6102b4600060016105fe565b346102c957610625366004610312565b61030e610630610609565b604051918291826001600160a01b03909116815260200190565b610655366004610312565b610309610dea565b346102c9576103096106703660046102dd565b610df2565b6102b4916008021c5b60ff1690565b906102b49154610675565b600061069f6102b4926003610526565b610684565b346102c95761030e6103806106ba3660046102dd565b61068f565b346102c9576103096106d23660046102dd565b610dfe565b346102c9576106e7366004610312565b610309610e42565b6102b4600060026105fe565b346102c95761070b366004610312565b61030e6106306106ef565b6102b46102b46102b49290565b6102b46000610716565b6102b4610723565b346102c957610745366004610312565b61030e61033c61072d565b346102c9576103096107633660046105b2565b90610f6d565b90916060828403126102c9576102b461078284846102ce565b93604061079282602087016105a5565b94016102ce565b346102c9576103096107ac366004610769565b916110cc565b346102c9576103096107c53660046105b2565b90611161565b67ffffffffffffffff81116104265760208091020190565b909291926107f361047c826107cb565b93818552602080860192028301928184116102c957915b8383106108175750505050565b6020809161082584866102ce565b81520192019161080a565b9080601f830112156102c9578160206102b4933591016107e3565b9092919261085b61047c826107cb565b93818552602080860192028301928184116102c957915b83831061087f5750505050565b6020809161088d84866105a5565b815201920191610872565b9080601f830112156102c9578160206102b49335910161084b565b9060e0828203126102c9576108c881836102ce565b926108d682602085016102ce565b926108e483604083016102ce565b926108f281606084016102ce565b9261090082608085016105a5565b9260a081013567ffffffffffffffff81116102c95783610921918301610830565b9260c082013567ffffffffffffffff81116102c9576102b49201610898565b346102c9576103096109533660046108b3565b95949094939193611531565b346102c95761096f366004610312565b61030e610630611553565b346102c95761030961098d3660046102dd565b611580565b6102b460006005610684565b346102c9576109ae366004610312565b61030e610380610992565b91906040838203126102c9576102b490602061079282866105a5565b346102c9576103096109e83660046109b9565b906116d8565b906020828203126102c9576102b4916105a5565b346102c957610309610a153660046109ee565b6118a0565b346102c957610309610a2d3660046102dd565b6118ae565b90610a3f61047c8361043f565b918252565b610a4e6005610a32565b640352e302e360dc1b602082015290565b6102b4610a44565b6102b4610a5f565b6102b4610a67565b60005b838110610a8a5750506000910152565b8181015183820152602001610a7a565b610abb610ac460209361045c93610aaf815190565b80835293849260200190565b95869101610a77565b601f01601f191690565b60208082526102b492910190610a9a565b346102c957610aef366004610312565b61030e610afa610a6f565b60405191829182610ace565b346102c957610309610b193660046102dd565b611905565b346102c957610b2e366004610312565b61030961192c565b346102c95761030e610380610b4c3660046102dd565b611934565b6102b46000806105fe565b346102c957610b6c366004610312565b61030e610630610b51565b346102c957610309610b8a3660046105b2565b906119cc565b346102c957610309610ba33660046105b2565b90611a87565b9061053090610716565b61069f6102b492610bc76000936006610526565b610ba9565b346102c95761030e610380610be23660046105b2565b90610bb3565b346102c957610309610bfb3660046102dd565b611ad2565b6102b46002610716565b6102b4610c00565b346102c957610c22366004610312565b61030e61033c610c0a565b6102b46001610716565b6102b4610c2d565b346102c957610c4f366004610312565b61030e61033c610c37565b346102c957610309610c6d3660046102dd565b611b95565b6102db90610763610c2d565b6102db90610763610723565b6102b49061067e565b6102b49054610c8a565b610ca76005610c93565b15610ccb57610cc7610cba6102a8611553565b916001600160a01b031690565b1490565b610cea610cdc6102b4926006610526565b610ce4610723565b90610ba9565b610c93565b610cea610d096102b492610d01600090565b506006610526565b610ce4610c2d565b6102db90610d1d611b9e565b610d4c565b9060ff905b9181191691161790565b90610d416102b4610d4892151590565b8254610d22565b9055565b6102db906005610d31565b6102db90610d11565b906102db91610d6d611bea565b906102db91610d7b81611c7f565b611c88565b906102db91610d60565b6102b490610d96611d66565b610dc4565b6102b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610716565b506102b4610d9b565b6102b46000610d8a565b6102b491610bc7610cea92610d01600090565b6102db611da8565b6102db906107c5610c2d565b6102db906107c5610723565b610e12611b9e565b6102db610e30565b6102a86102b46102b49290565b6102b490610e1a565b6102db610e3d6000610e27565b611e50565b6102db610e0a565b15610e5157565b60405162461bcd60e51b815260206004820152600c60248201526b2727aa2fa0a72fa0a226a4a760a11b6044820152606490fd5b0390fd5b15610e9057565b60405162461bcd60e51b81526020600482015260096024820152682727aa2fa7aba722a960b91b6044820152606490fd5b906102db91610ed06005610c93565b15610eef57610eea610ee36102a8611553565b3314610e89565b610f08565b610f08610f03610cea610cdc336006610526565b610e4a565b610f2d610f3391610f286000610f2386610bc7856006610526565b610d31565b61051d565b91610716565b610f3c3361051d565b917fd196b73dcd1f2606bb9ecb4b9cee426a49a0d2cb8b95f3c2acf5c28db10e03ac610f6760405190565b600090a4565b906102db91610ec1565b906102db9291610f85611b9e565b611041565b15610f9157565b60405162461bcd60e51b815260206004820152600c60248201526b15d493d391d7d05353d5539560a21b6044820152606490fd5b15610fcc57565b60405162461bcd60e51b815260206004820152600f60248201526e5a45524f5f544f5f4144445245535360881b6044820152606490fd5b1561100a57565b60405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606490fd5b6110c76110bd6110b77e1a143d5b175701cb3246058ffac3d63945192075a926ff73a19930f09d587a9395949561108261107b6000610716565b8811610f8a565b6110a46110926102a86000610e27565b6001600160a01b0383165b1415610fc5565b610f286110b2878984611ee8565b611003565b9361051d565b9361034060405190565b0390a3565b906102db9291610f77565b906102db916110e66005610c93565b156110fe576110f9610ee36102a8611553565b611112565b611112610f03610cea610cdc336006610526565b610f2d61112d91610f286001610f2386610bc7856006610526565b6111363361051d565b917f779544d008db0ffbb5630e061673d07bb7a29b6ee170bdd8a758a26f0a565a5e610f6760405190565b906102db916110d7565b6102b49060401c61067e565b6102b4905461116b565b6102b4905b67ffffffffffffffff1690565b6102b49054611181565b6111866102b46102b49290565b9067ffffffffffffffff90610d27565b6111866102b46102b49267ffffffffffffffff1690565b906111e16102b4610d48926111ba565b82546111aa565b9068ff00000000000000009060401b610d27565b9061120c6102b4610d4892151590565b82546111e8565b61031d9061119d565b6020810192916102db9190611213565b91939590946112587ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0090565b96879461127461126e61126a88611177565b1590565b96611193565b966000986112818a61119d565b67ffffffffffffffff8a161480611385575b6001996112b06112a28c61119d565b9167ffffffffffffffff1690565b14908161135c575b155b9081611353575b50611341576112ea96886112e18c6112d88d61119d565b9e019d8e6111d1565b61133257611408565b6112f357505050565b61132161132d927fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2946111fc565b6040519182918261121c565b0390a1565b61133c8a8d6111fc565b611408565b60405163f92ee8a960e01b8152600490fd5b159050386112c1565b90506112ba8b61137c6113786113713061051d565b3b92610716565b9190565b149190506112b8565b5087611293565b9060001990610d27565b906113a66102b4610d4892610716565b825461138c565b906001600160a01b0390610d27565b906113cc6102b4610d489261051d565b82546113ad565b634e487b7160e01b600052603260045260246000fd5b906113f2825190565b811015611403576020809102010190565b6113d3565b611451926114726114789298959897939761142289611f4f565b61142a611f60565b610f2361146a60019a8b98899461144a61144387610716565b6007611396565b60006113bc565b61146384610f23610cdc846006610526565b6006610526565b610ce4610c00565b836113bc565b6114838660026113bc565b6114aa60039461149884610f238a6003610526565b6114a56004986004610526565b611396565b6114b46000610716565b915b6114c3575b505050505050565b6114ce6102b4825190565b82101561152c57611526826115206114f76114ea8996866113e9565b516001600160a01b031690565b61150586610f23838b610526565b6114a5611519611515858a6113e9565b5190565b918b610526565b60010190565b916114b6565b6114bb565b906102db96959493929161122c565b6102b4906102a8565b6102b49054611540565b6102b460007f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005b01611549565b6102db90610763610c00565b1561159357565b60405162461bcd60e51b81526020600482015260116024820152702aa729aaa82827a92a22a22faa27a5a2a760791b6044820152606490fd5b6102b49081565b6102b490546115cc565b156115e457565b60405162461bcd60e51b815260206004820152601060248201526f105353d5539517d513d3d7d4d350531360821b6044820152606490fd5b929160206116396102db9360408701908782036000890152610a9a565b940152565b905051906102db8261059f565b906020828203126102c9576102b49161163e565b6040513d6000823e3d90fd5b634e487b7160e01b600052601160045260246000fd5b9190820180921161168e57565b61166b565b1561169a57565b60405162461bcd60e51b81526020600482015260166024820152751393d517d15393d551d217d514905394d1915494915160521b6044820152606490fd5b6117ae916116f26116ed610cea836003610526565b61158c565b61171461170b6102b4611706846004610526565b6115d3565b835b10156115dd565b61171c612003565b6117253361051d565b7f233aca6f4c1f6dff7ddd8716ae971881929342833b11b0becedfb67cb55c6cd6846117508561051d565b9361176661175d60405190565b9283928361161c565b0390a3611775610f288261051d565b6370a0823160206117866001611549565b604051809781926117978660e01b90565b83526001600160a01b031660048301526024820190565b0381855afa9182156118735761180695600093611878575b506117e26110b260209495876117dc6001611549565b3361208c565b6117976117ef6001611549565b926117f960405190565b9788948593849360e01b90565b03915afa918215611873576102db93600093611834575b506102b461182e9261137892611681565b14611693565b61137891935061182e926118626102b49260203d60201161186c575b61185a8183610404565b81019061164b565b949250925061181d565b503d611850565b61165f565b602093506110b26118986117e292863d881161186c5761185a8183610404565b9450506117c6565b6102db906109e86002611549565b6102db906107c5610c00565b6102db906118c6611b9e565b6118d590610f288160016113bc565b7f42ba03bfc663750cc103cd04eeef050c29b8b8af37e95610f00a56fec2f43b216118ff60405190565b600090a2565b6102db906118ba565b611916611b9e565b6102db6102db6001610f23610cdc611463611553565b6102db61190e565b610cea61146a6102b492610d01600090565b906102db91611953611b9e565b611975565b6001600160a01b0390911681526040810192916102db9160200152565b907fbc6eef9909beaeecb6f80c6e956a0a2366750c352758aab878a55069b07e6b06916119a86001610f23836003610526565b6119b7826114a5836004610526565b61132d6119c360405190565b92839283611958565b906102db91611946565b906102db916119e3611b9e565b611a07565b3d15611a02576119f73d610a32565b903d6000602084013e565b606090565b7e1a143d5b175701cb3246058ffac3d63945192075a926ff73a19930f09d587a6110c76110bd6110b7600094611a3f61107b87610716565b610f28611a4b87610e27565b96611a686001600160a01b0389166001600160a01b03851661109d565b80611a7260405190565b6000908b865af1611a816119e8565b50611003565b906102db916119d6565b6102db90611a9d611b9e565b61132d7fcee27745f1ccce7fd3a1ee48ac4e872baa2cc359cf1ebb1b103bfb938a836521916106306000610f23836003610526565b6102db90611a91565b15611ae257565b60405162461bcd60e51b815260206004820152600d60248201526c4f4e4c595f54494d454c4f434b60981b6044820152606490fd5b6102db90611b32611b2b6102a86000611549565b3314611adb565b611b70565b15611b3e57565b60405162461bcd60e51b815260206004820152600a6024820152692d22a927afa7aba722a960b11b6044820152606490fd5b6102db90610e3d611b846102a86000610e27565b6001600160a01b0383161415611b37565b6102db90611b17565b611ba6611553565b3390611bb182610cba565b03611bb95750565b610e8590611bc660405190565b63118cdaa760e01b8152918291600483016001600160a01b03909116815260200190565b611bf33061051d565b7f000000000000000000000000000000000000000000000000000000000000000090611c276001600160a01b038316610cba565b14908115611c49575b50611c3757565b60405163703e46dd60e11b8152600490fd5b9050611c66610cba611c596120cb565b926001600160a01b031690565b141538611c30565b506102db611b2b6102a86000611549565b6102db90611c6e565b90611c95610f288361051d565b906020611ca160405190565b6352d1902d60e01b815292839060049082905afa60009281611d45575b50611cff5750506001611cce5750565b610e8590611cdb60405190565b634c9c8ce360e01b8152918291600483016001600160a01b03909116815260200190565b909291611d0d6102b4610d9b565b8403611d1e576102db9293506120db565b610e8584611d2b60405190565b632a87526960e21b81529182916004830190815260200190565b611d5f91935060203d60201161186c5761185a8183610404565b9138611cbe565b611d6f3061051d565b611da16001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016610cba565b03611c3757565b611db26000610e27565b611dc36116ed610cea836003610526565b611ddd611dd76102b4611706846004610526565b3461170d565b611de5612003565b907f233aca6f4c1f6dff7ddd8716ae971881929342833b11b0becedfb67cb55c6cd6611e2b611e166110b73361051d565b93611e2060405190565b91829134908361161c565b0390a36102db600080611e3e6001611549565b60405160009134905af1611a816119e8565b611e90611e8a7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300610f2884611e8483611549565b926113bc565b9161051d565b907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0611ebb60405190565b80806110c7565b611edb611ed56102b49263ffffffff1690565b60e01b90565b6001600160e01b03191690565b91611f356102b493611f26600494611efe600090565b50611f0c63a9059cbb611ec2565b92611f1660405190565b9687946020860190815201611958565b60208201810382520383610404565b612168565b6102db90611f466121de565b6102db9061226b565b6102db90611f3a565b6102db6121de565b6102db611f58565b600019811461168e5760010190565b611f816002610a32565b61735f60f01b602082015290565b6102b4611f77565b6102b4611f8f565b611fa96005610a32565b642fb9313c3b60d91b602082015290565b6102b4611f9f565b6102b4611fba565b61045c611fe292602092611fdc815190565b94859290565b93849101610a77565b91611ffd6102b49493611ffd93611fca565b90611fca565b6102b461201060076115d3565b61202561144361202060076115d3565b611f68565b6102b4612039612033611f97565b926122c1565b612041611fc2565b9261205c61204e60405190565b948593602085019384611feb565b90810382520382610404565b6001600160a01b039182168152911660208201526060810192916102db9160400152565b611f3590611f266004946102b496946120a3600090565b506120b16323b872dd611ec2565b936120bb60405190565b9788956020870190815201612068565b6102b4600061157a6102b4610d9b565b906120e582612354565b6120ee8261051d565b7fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b61211860405190565b600090a2805161212b6113786000610716565b111561213d5761213a916123a3565b50565b50506102db61237f565b905051906102db826103ad565b906020828203126102c9576102b491612147565b9060008091612175600090565b5060208151910182855af1906121896119e8565b8261219357505090565b90915061219e815190565b6121ab6113786000610716565b11156121cb576102b4915060206121c0825190565b818301019101612154565b503b6121da6113786000610716565b1190565b6121e961126a6123ca565b6121ef57565b604051631afcd79f60e31b8152600490fd5b6102db9061220d6121de565b6122176000610e27565b6001600160a01b0381166001600160a01b0383161461223a57506102db90611e50565b610e859061224760405190565b631e4fbdf760e01b8152918291600483016001600160a01b03909116815260200190565b6102db90612201565b369037565b906102db61228f61228984610a32565b9361043f565b601f190160208401612274565b634e487b7160e01b600052601260045260246000fd5b81156122bc570490565b61229c565b6122ca816123f3565b906122db60019261045c6001610716565b91806122e684612279565b936020018401905b6122f9575b50505090565b811561234f576123339060001901926f181899199a1a9b1b9c1cb0b131b232b360811b600a82061a845361232d600a610716565b906122b2565b90816123426113786000610716565b1461234f579091816122ee565b6122f3565b803b6123636113786000610716565b14611cce576102db9060006123796102b4610d9b565b016113bc565b6123896000610716565b341161239157565b60405163b398979f60e01b8152600490fd5b6000806102b4936123b2606090565b50602081519101845af46123c46119e8565b91612595565b6102b47ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00611177565b6123fd6000610716565b907a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000061242381610716565b821015612573575b506d04ee2d6d415b85acef810000000061244481610716565b821015612551575b50662386f26fc1000061245e81610716565b82101561252f575b506305f5e10061247581610716565b82101561250d575b5061271061248a81610716565b8210156124eb575b5061249d6064610716565b8110156124c9575b6124b2611378600a610716565b10156124bb5790565b6102b49061045c6001610716565b6124da6124e59161232d6064610716565b9161045c6002610716565b906124a5565b6125069161232d6124fb92610716565b9161045c6004610716565b9038612492565b6125289161232d61251d92610716565b9161045c6008610716565b903861247d565b61254a9161232d61253f92610716565b9161045c6010610716565b9038612466565b61256c9161232d61256192610716565b9161045c6020610716565b903861244c565b61258e9161232d61258392610716565b9161045c6040610716565b903861242b565b906125a05750612605565b81516125af6113786000610716565b14806125ef575b6125be575090565b610e85906125cb60405190565b639996b31560e01b8152918291600483016001600160a01b03909116815260200190565b50803b6125ff6113786000610716565b146125b6565b80516126146113786000610716565b111561262257805190602001fd5b604051630a12f52160e11b8152600490fdfea264697066735822122077411b6151a664a95a7f998252bf4cc1490c5ac9defe2e89c342f57d2aef0b6364736f6c63430008180033
Deployed Bytecode
0x60806040526004361015610023575b361561001957600080fd5b610021610dea565b005b60003560e01c80630a1f194f146102a35780630d8e6e2c1461029e5780631785f53c1461029957806324d7806c146102945780634039ad0d1461028f57806346c2df8d1461028a5780634f1ef28614610285578063515fe3c41461028057806352d1902d1461027b57806353635d76146102765780635800902914610271578063590fcdda1461026c5780635d428e081461026757806368c4ac2614610262578063704802751461025d578063715018a61461025857806374c13fda1461025357806375b238fc1461024e57806379db5f67146102495780637c713fd4146102445780637fde1c8a1461023f578063883b53e81461023a5780638da5cb5b1461023557806396f0248a14610230578063999323f01461022b5780639ee3060014610226578063a694fc3a14610221578063ab56a29c1461021c578063ad3cb1cc14610217578063bd18a99b14610212578063c19ef54e1461020d578063cc0d50e614610208578063d33219b414610203578063d692f4c5146101fe578063df025ec6146101f9578063e1326b34146101f4578063ee3d6866146101ef578063f0a3a97c146101ea578063f0a56fc8146101e55763f2fde38b0361000e57610c5a565b610c3f565b610c12565b610be8565b610bcc565b610b90565b610b77565b610b5c565b610b36565b610b1e565b610b06565b610adf565b610a1a565b610a02565b6109d5565b61099e565b61097a565b61095f565b610940565b6107b2565b610799565b610750565b610735565b6106fb565b6106d7565b6106bf565b6106a4565b61065d565b61064a565b610615565b6105d5565b610584565b610569565b6104ec565b6103d6565b610392565b610365565b61034d565b610321565b6102f1565b6001600160a01b031690565b90565b6001600160a01b0381165b036102c957565b600080fd5b905035906102db826102b7565b565b906020828203126102c9576102b4916102ce565b346102c9576103096103043660046102dd565b610c72565b604051005b0390f35b60009103126102c957565b9052565b346102c957610331366004610312565b61030e61033c610c2d565b6040515b9182918290815260200190565b346102c9576103096103603660046102dd565b610c7e565b346102c95761030e61038061037b3660046102dd565b610c9d565b60405191829182901515815260200190565b346102c95761030e6103806103a83660046102dd565b610cef565b8015156102c2565b905035906102db826103ad565b906020828203126102c9576102b4916103b5565b346102c9576103096103e93660046103c2565b610d57565b634e487b7160e01b600052604160045260246000fd5b90601f01601f1916810190811067ffffffffffffffff82111761042657604052565b6103ee565b906102db61043860405190565b9283610404565b67ffffffffffffffff811161042657602090601f01601f19160190565b0190565b90826000939282370152565b9092919261048161047c8261043f565b61042b565b93818552818301116102c9576102db916020850190610460565b9080601f830112156102c9578160206102b49335910161046c565b9190916040818403126102c9576104cd83826102ce565b92602082013567ffffffffffffffff81116102c9576102b4920161049b565b6103096104fa3660046104b6565b90610d80565b6102b4906102a8906001600160a01b031682565b6102b490610500565b6102b490610514565b906105309061051d565b600052602052604060002090565b6102b4916008021c81565b906102b4915461053e565b60006105646102b4926004610526565b610549565b346102c95761030e61033c61057f3660046102dd565b610554565b346102c957610594366004610312565b61030e61033c610dcd565b806102c2565b905035906102db8261059f565b91906040838203126102c9576102b49060206105ce82866102ce565b94016105a5565b346102c95761030e6103806105eb3660046105b2565b90610dd7565b6102b4916008021c6102a8565b906102b491546105f1565b6102b4600060016105fe565b346102c957610625366004610312565b61030e610630610609565b604051918291826001600160a01b03909116815260200190565b610655366004610312565b610309610dea565b346102c9576103096106703660046102dd565b610df2565b6102b4916008021c5b60ff1690565b906102b49154610675565b600061069f6102b4926003610526565b610684565b346102c95761030e6103806106ba3660046102dd565b61068f565b346102c9576103096106d23660046102dd565b610dfe565b346102c9576106e7366004610312565b610309610e42565b6102b4600060026105fe565b346102c95761070b366004610312565b61030e6106306106ef565b6102b46102b46102b49290565b6102b46000610716565b6102b4610723565b346102c957610745366004610312565b61030e61033c61072d565b346102c9576103096107633660046105b2565b90610f6d565b90916060828403126102c9576102b461078284846102ce565b93604061079282602087016105a5565b94016102ce565b346102c9576103096107ac366004610769565b916110cc565b346102c9576103096107c53660046105b2565b90611161565b67ffffffffffffffff81116104265760208091020190565b909291926107f361047c826107cb565b93818552602080860192028301928184116102c957915b8383106108175750505050565b6020809161082584866102ce565b81520192019161080a565b9080601f830112156102c9578160206102b4933591016107e3565b9092919261085b61047c826107cb565b93818552602080860192028301928184116102c957915b83831061087f5750505050565b6020809161088d84866105a5565b815201920191610872565b9080601f830112156102c9578160206102b49335910161084b565b9060e0828203126102c9576108c881836102ce565b926108d682602085016102ce565b926108e483604083016102ce565b926108f281606084016102ce565b9261090082608085016105a5565b9260a081013567ffffffffffffffff81116102c95783610921918301610830565b9260c082013567ffffffffffffffff81116102c9576102b49201610898565b346102c9576103096109533660046108b3565b95949094939193611531565b346102c95761096f366004610312565b61030e610630611553565b346102c95761030961098d3660046102dd565b611580565b6102b460006005610684565b346102c9576109ae366004610312565b61030e610380610992565b91906040838203126102c9576102b490602061079282866105a5565b346102c9576103096109e83660046109b9565b906116d8565b906020828203126102c9576102b4916105a5565b346102c957610309610a153660046109ee565b6118a0565b346102c957610309610a2d3660046102dd565b6118ae565b90610a3f61047c8361043f565b918252565b610a4e6005610a32565b640352e302e360dc1b602082015290565b6102b4610a44565b6102b4610a5f565b6102b4610a67565b60005b838110610a8a5750506000910152565b8181015183820152602001610a7a565b610abb610ac460209361045c93610aaf815190565b80835293849260200190565b95869101610a77565b601f01601f191690565b60208082526102b492910190610a9a565b346102c957610aef366004610312565b61030e610afa610a6f565b60405191829182610ace565b346102c957610309610b193660046102dd565b611905565b346102c957610b2e366004610312565b61030961192c565b346102c95761030e610380610b4c3660046102dd565b611934565b6102b46000806105fe565b346102c957610b6c366004610312565b61030e610630610b51565b346102c957610309610b8a3660046105b2565b906119cc565b346102c957610309610ba33660046105b2565b90611a87565b9061053090610716565b61069f6102b492610bc76000936006610526565b610ba9565b346102c95761030e610380610be23660046105b2565b90610bb3565b346102c957610309610bfb3660046102dd565b611ad2565b6102b46002610716565b6102b4610c00565b346102c957610c22366004610312565b61030e61033c610c0a565b6102b46001610716565b6102b4610c2d565b346102c957610c4f366004610312565b61030e61033c610c37565b346102c957610309610c6d3660046102dd565b611b95565b6102db90610763610c2d565b6102db90610763610723565b6102b49061067e565b6102b49054610c8a565b610ca76005610c93565b15610ccb57610cc7610cba6102a8611553565b916001600160a01b031690565b1490565b610cea610cdc6102b4926006610526565b610ce4610723565b90610ba9565b610c93565b610cea610d096102b492610d01600090565b506006610526565b610ce4610c2d565b6102db90610d1d611b9e565b610d4c565b9060ff905b9181191691161790565b90610d416102b4610d4892151590565b8254610d22565b9055565b6102db906005610d31565b6102db90610d11565b906102db91610d6d611bea565b906102db91610d7b81611c7f565b611c88565b906102db91610d60565b6102b490610d96611d66565b610dc4565b6102b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610716565b506102b4610d9b565b6102b46000610d8a565b6102b491610bc7610cea92610d01600090565b6102db611da8565b6102db906107c5610c2d565b6102db906107c5610723565b610e12611b9e565b6102db610e30565b6102a86102b46102b49290565b6102b490610e1a565b6102db610e3d6000610e27565b611e50565b6102db610e0a565b15610e5157565b60405162461bcd60e51b815260206004820152600c60248201526b2727aa2fa0a72fa0a226a4a760a11b6044820152606490fd5b0390fd5b15610e9057565b60405162461bcd60e51b81526020600482015260096024820152682727aa2fa7aba722a960b91b6044820152606490fd5b906102db91610ed06005610c93565b15610eef57610eea610ee36102a8611553565b3314610e89565b610f08565b610f08610f03610cea610cdc336006610526565b610e4a565b610f2d610f3391610f286000610f2386610bc7856006610526565b610d31565b61051d565b91610716565b610f3c3361051d565b917fd196b73dcd1f2606bb9ecb4b9cee426a49a0d2cb8b95f3c2acf5c28db10e03ac610f6760405190565b600090a4565b906102db91610ec1565b906102db9291610f85611b9e565b611041565b15610f9157565b60405162461bcd60e51b815260206004820152600c60248201526b15d493d391d7d05353d5539560a21b6044820152606490fd5b15610fcc57565b60405162461bcd60e51b815260206004820152600f60248201526e5a45524f5f544f5f4144445245535360881b6044820152606490fd5b1561100a57565b60405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606490fd5b6110c76110bd6110b77e1a143d5b175701cb3246058ffac3d63945192075a926ff73a19930f09d587a9395949561108261107b6000610716565b8811610f8a565b6110a46110926102a86000610e27565b6001600160a01b0383165b1415610fc5565b610f286110b2878984611ee8565b611003565b9361051d565b9361034060405190565b0390a3565b906102db9291610f77565b906102db916110e66005610c93565b156110fe576110f9610ee36102a8611553565b611112565b611112610f03610cea610cdc336006610526565b610f2d61112d91610f286001610f2386610bc7856006610526565b6111363361051d565b917f779544d008db0ffbb5630e061673d07bb7a29b6ee170bdd8a758a26f0a565a5e610f6760405190565b906102db916110d7565b6102b49060401c61067e565b6102b4905461116b565b6102b4905b67ffffffffffffffff1690565b6102b49054611181565b6111866102b46102b49290565b9067ffffffffffffffff90610d27565b6111866102b46102b49267ffffffffffffffff1690565b906111e16102b4610d48926111ba565b82546111aa565b9068ff00000000000000009060401b610d27565b9061120c6102b4610d4892151590565b82546111e8565b61031d9061119d565b6020810192916102db9190611213565b91939590946112587ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0090565b96879461127461126e61126a88611177565b1590565b96611193565b966000986112818a61119d565b67ffffffffffffffff8a161480611385575b6001996112b06112a28c61119d565b9167ffffffffffffffff1690565b14908161135c575b155b9081611353575b50611341576112ea96886112e18c6112d88d61119d565b9e019d8e6111d1565b61133257611408565b6112f357505050565b61132161132d927fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2946111fc565b6040519182918261121c565b0390a1565b61133c8a8d6111fc565b611408565b60405163f92ee8a960e01b8152600490fd5b159050386112c1565b90506112ba8b61137c6113786113713061051d565b3b92610716565b9190565b149190506112b8565b5087611293565b9060001990610d27565b906113a66102b4610d4892610716565b825461138c565b906001600160a01b0390610d27565b906113cc6102b4610d489261051d565b82546113ad565b634e487b7160e01b600052603260045260246000fd5b906113f2825190565b811015611403576020809102010190565b6113d3565b611451926114726114789298959897939761142289611f4f565b61142a611f60565b610f2361146a60019a8b98899461144a61144387610716565b6007611396565b60006113bc565b61146384610f23610cdc846006610526565b6006610526565b610ce4610c00565b836113bc565b6114838660026113bc565b6114aa60039461149884610f238a6003610526565b6114a56004986004610526565b611396565b6114b46000610716565b915b6114c3575b505050505050565b6114ce6102b4825190565b82101561152c57611526826115206114f76114ea8996866113e9565b516001600160a01b031690565b61150586610f23838b610526565b6114a5611519611515858a6113e9565b5190565b918b610526565b60010190565b916114b6565b6114bb565b906102db96959493929161122c565b6102b4906102a8565b6102b49054611540565b6102b460007f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005b01611549565b6102db90610763610c00565b1561159357565b60405162461bcd60e51b81526020600482015260116024820152702aa729aaa82827a92a22a22faa27a5a2a760791b6044820152606490fd5b6102b49081565b6102b490546115cc565b156115e457565b60405162461bcd60e51b815260206004820152601060248201526f105353d5539517d513d3d7d4d350531360821b6044820152606490fd5b929160206116396102db9360408701908782036000890152610a9a565b940152565b905051906102db8261059f565b906020828203126102c9576102b49161163e565b6040513d6000823e3d90fd5b634e487b7160e01b600052601160045260246000fd5b9190820180921161168e57565b61166b565b1561169a57565b60405162461bcd60e51b81526020600482015260166024820152751393d517d15393d551d217d514905394d1915494915160521b6044820152606490fd5b6117ae916116f26116ed610cea836003610526565b61158c565b61171461170b6102b4611706846004610526565b6115d3565b835b10156115dd565b61171c612003565b6117253361051d565b7f233aca6f4c1f6dff7ddd8716ae971881929342833b11b0becedfb67cb55c6cd6846117508561051d565b9361176661175d60405190565b9283928361161c565b0390a3611775610f288261051d565b6370a0823160206117866001611549565b604051809781926117978660e01b90565b83526001600160a01b031660048301526024820190565b0381855afa9182156118735761180695600093611878575b506117e26110b260209495876117dc6001611549565b3361208c565b6117976117ef6001611549565b926117f960405190565b9788948593849360e01b90565b03915afa918215611873576102db93600093611834575b506102b461182e9261137892611681565b14611693565b61137891935061182e926118626102b49260203d60201161186c575b61185a8183610404565b81019061164b565b949250925061181d565b503d611850565b61165f565b602093506110b26118986117e292863d881161186c5761185a8183610404565b9450506117c6565b6102db906109e86002611549565b6102db906107c5610c00565b6102db906118c6611b9e565b6118d590610f288160016113bc565b7f42ba03bfc663750cc103cd04eeef050c29b8b8af37e95610f00a56fec2f43b216118ff60405190565b600090a2565b6102db906118ba565b611916611b9e565b6102db6102db6001610f23610cdc611463611553565b6102db61190e565b610cea61146a6102b492610d01600090565b906102db91611953611b9e565b611975565b6001600160a01b0390911681526040810192916102db9160200152565b907fbc6eef9909beaeecb6f80c6e956a0a2366750c352758aab878a55069b07e6b06916119a86001610f23836003610526565b6119b7826114a5836004610526565b61132d6119c360405190565b92839283611958565b906102db91611946565b906102db916119e3611b9e565b611a07565b3d15611a02576119f73d610a32565b903d6000602084013e565b606090565b7e1a143d5b175701cb3246058ffac3d63945192075a926ff73a19930f09d587a6110c76110bd6110b7600094611a3f61107b87610716565b610f28611a4b87610e27565b96611a686001600160a01b0389166001600160a01b03851661109d565b80611a7260405190565b6000908b865af1611a816119e8565b50611003565b906102db916119d6565b6102db90611a9d611b9e565b61132d7fcee27745f1ccce7fd3a1ee48ac4e872baa2cc359cf1ebb1b103bfb938a836521916106306000610f23836003610526565b6102db90611a91565b15611ae257565b60405162461bcd60e51b815260206004820152600d60248201526c4f4e4c595f54494d454c4f434b60981b6044820152606490fd5b6102db90611b32611b2b6102a86000611549565b3314611adb565b611b70565b15611b3e57565b60405162461bcd60e51b815260206004820152600a6024820152692d22a927afa7aba722a960b11b6044820152606490fd5b6102db90610e3d611b846102a86000610e27565b6001600160a01b0383161415611b37565b6102db90611b17565b611ba6611553565b3390611bb182610cba565b03611bb95750565b610e8590611bc660405190565b63118cdaa760e01b8152918291600483016001600160a01b03909116815260200190565b611bf33061051d565b7f0000000000000000000000001d6513f43bd9e3353e131d35fb2f1ecfde04f34a90611c276001600160a01b038316610cba565b14908115611c49575b50611c3757565b60405163703e46dd60e11b8152600490fd5b9050611c66610cba611c596120cb565b926001600160a01b031690565b141538611c30565b506102db611b2b6102a86000611549565b6102db90611c6e565b90611c95610f288361051d565b906020611ca160405190565b6352d1902d60e01b815292839060049082905afa60009281611d45575b50611cff5750506001611cce5750565b610e8590611cdb60405190565b634c9c8ce360e01b8152918291600483016001600160a01b03909116815260200190565b909291611d0d6102b4610d9b565b8403611d1e576102db9293506120db565b610e8584611d2b60405190565b632a87526960e21b81529182916004830190815260200190565b611d5f91935060203d60201161186c5761185a8183610404565b9138611cbe565b611d6f3061051d565b611da16001600160a01b037f0000000000000000000000001d6513f43bd9e3353e131d35fb2f1ecfde04f34a16610cba565b03611c3757565b611db26000610e27565b611dc36116ed610cea836003610526565b611ddd611dd76102b4611706846004610526565b3461170d565b611de5612003565b907f233aca6f4c1f6dff7ddd8716ae971881929342833b11b0becedfb67cb55c6cd6611e2b611e166110b73361051d565b93611e2060405190565b91829134908361161c565b0390a36102db600080611e3e6001611549565b60405160009134905af1611a816119e8565b611e90611e8a7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300610f2884611e8483611549565b926113bc565b9161051d565b907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0611ebb60405190565b80806110c7565b611edb611ed56102b49263ffffffff1690565b60e01b90565b6001600160e01b03191690565b91611f356102b493611f26600494611efe600090565b50611f0c63a9059cbb611ec2565b92611f1660405190565b9687946020860190815201611958565b60208201810382520383610404565b612168565b6102db90611f466121de565b6102db9061226b565b6102db90611f3a565b6102db6121de565b6102db611f58565b600019811461168e5760010190565b611f816002610a32565b61735f60f01b602082015290565b6102b4611f77565b6102b4611f8f565b611fa96005610a32565b642fb9313c3b60d91b602082015290565b6102b4611f9f565b6102b4611fba565b61045c611fe292602092611fdc815190565b94859290565b93849101610a77565b91611ffd6102b49493611ffd93611fca565b90611fca565b6102b461201060076115d3565b61202561144361202060076115d3565b611f68565b6102b4612039612033611f97565b926122c1565b612041611fc2565b9261205c61204e60405190565b948593602085019384611feb565b90810382520382610404565b6001600160a01b039182168152911660208201526060810192916102db9160400152565b611f3590611f266004946102b496946120a3600090565b506120b16323b872dd611ec2565b936120bb60405190565b9788956020870190815201612068565b6102b4600061157a6102b4610d9b565b906120e582612354565b6120ee8261051d565b7fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b61211860405190565b600090a2805161212b6113786000610716565b111561213d5761213a916123a3565b50565b50506102db61237f565b905051906102db826103ad565b906020828203126102c9576102b491612147565b9060008091612175600090565b5060208151910182855af1906121896119e8565b8261219357505090565b90915061219e815190565b6121ab6113786000610716565b11156121cb576102b4915060206121c0825190565b818301019101612154565b503b6121da6113786000610716565b1190565b6121e961126a6123ca565b6121ef57565b604051631afcd79f60e31b8152600490fd5b6102db9061220d6121de565b6122176000610e27565b6001600160a01b0381166001600160a01b0383161461223a57506102db90611e50565b610e859061224760405190565b631e4fbdf760e01b8152918291600483016001600160a01b03909116815260200190565b6102db90612201565b369037565b906102db61228f61228984610a32565b9361043f565b601f190160208401612274565b634e487b7160e01b600052601260045260246000fd5b81156122bc570490565b61229c565b6122ca816123f3565b906122db60019261045c6001610716565b91806122e684612279565b936020018401905b6122f9575b50505090565b811561234f576123339060001901926f181899199a1a9b1b9c1cb0b131b232b360811b600a82061a845361232d600a610716565b906122b2565b90816123426113786000610716565b1461234f579091816122ee565b6122f3565b803b6123636113786000610716565b14611cce576102db9060006123796102b4610d9b565b016113bc565b6123896000610716565b341161239157565b60405163b398979f60e01b8152600490fd5b6000806102b4936123b2606090565b50602081519101845af46123c46119e8565b91612595565b6102b47ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00611177565b6123fd6000610716565b907a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000061242381610716565b821015612573575b506d04ee2d6d415b85acef810000000061244481610716565b821015612551575b50662386f26fc1000061245e81610716565b82101561252f575b506305f5e10061247581610716565b82101561250d575b5061271061248a81610716565b8210156124eb575b5061249d6064610716565b8110156124c9575b6124b2611378600a610716565b10156124bb5790565b6102b49061045c6001610716565b6124da6124e59161232d6064610716565b9161045c6002610716565b906124a5565b6125069161232d6124fb92610716565b9161045c6004610716565b9038612492565b6125289161232d61251d92610716565b9161045c6008610716565b903861247d565b61254a9161232d61253f92610716565b9161045c6010610716565b9038612466565b61256c9161232d61256192610716565b9161045c6020610716565b903861244c565b61258e9161232d61258392610716565b9161045c6040610716565b903861242b565b906125a05750612605565b81516125af6113786000610716565b14806125ef575b6125be575090565b610e85906125cb60405190565b639996b31560e01b8152918291600483016001600160a01b03909116815260200190565b50803b6125ff6113786000610716565b146125b6565b80516126146113786000610716565b111561262257805190602001fd5b604051630a12f52160e11b8152600490fdfea264697066735822122077411b6151a664a95a7f998252bf4cc1490c5ac9defe2e89c342f57d2aef0b6364736f6c63430008180033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.