Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
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:
L1NativeTokenPredicate
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 9999 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "../../../libs/Create2.sol"; import "./IL1Predicate.sol"; import "../../common/IBridgeRegistry.sol"; // LightLink 2023 contract L1NativeTokenPredicate is Initializable, // UUPSUpgradeable, ReentrancyGuardUpgradeable, IL1Predicate { using ECDSA for bytes32; // variables bool public isPaused; address public bridgeRegistry; address public l2Predicate; bytes32 public l2TokenBytecodeHash; mapping(address => address) public l1ToL2Gateway; mapping(address => uint256) public counter; mapping(address => mapping(uint256 => bool)) public orderExecuted; mapping(address => mapping(uint256 => mapping(address => bool))) public isConfirmed; event TokenMapped(bytes message); event DepositToken(bytes message); event WithdrawToken(bytes32 messageHash); modifier requireMultisig() { require(msg.sender == IBridgeRegistry(bridgeRegistry).getMultisig(), "Multisig required"); _; } modifier notPaused() { require(!isPaused, "Paused"); _; } receive() external payable { _initiateDeposit(address(0), msg.sender, msg.sender, msg.value); } function recovery(address _to) external requireMultisig { uint256 _amount = address(this).balance; (bool success, ) = _to.call{ value: _amount }(""); require(success, "ETH transfer failed"); } // verified function deposit(address _l1Token) external payable { _initiateDeposit(_l1Token, msg.sender, msg.sender, msg.value); } // verified function depositTo(address _l1Token, address _to) external payable { _initiateDeposit(_l1Token, msg.sender, _to, msg.value); } function syncWithdraw( address[] memory _currentValidators, bytes[] memory _signatures, // transaction data bytes memory _data ) external nonReentrant notPaused { (address from, uint256 orderId, address l1Token, address l2Token, address to, uint256 amount) = abi.decode(_data, (address, uint256, address, address, address, uint256)); require(l2Predicate != address(0), "Not implemented"); require(amount > 0, "Not enough amount"); require(to != address(0), "Invalid address"); require(!orderExecuted[from][orderId], "Order already executed"); require(_currentValidators.length == _signatures.length, "Input mismatch"); require(l1ToL2Gateway[l1Token] == l2Token, "Invalid token gateway"); bytes32 messageHash = keccak256(abi.encodePacked(block.chainid, _data)); _checkValidatorSignatures( from, orderId, _currentValidators, _signatures, // Get hash of the transaction batch and checkpoint messageHash, IBridgeRegistry(bridgeRegistry).consensusPowerThreshold() ); orderExecuted[from][orderId] = true; (bool success, ) = to.call{ value: amount }(""); require(success, "ETH transfer failed"); emit WithdrawToken(messageHash); } function initialize(address _registry, address _l2Predicate) public initializer { __ReentrancyGuard_init(); __L1NativeTokenPredicate_init(_registry, _l2Predicate); } function modifyL2TokenBytecodeHash(bytes32 _l2TokenBytecodeHash) public requireMultisig { l2TokenBytecodeHash = _l2TokenBytecodeHash; } function toggleIsPaused(bool _status) public requireMultisig { isPaused = _status; } function modifyL2Predicate(address _l2Predicate) public requireMultisig { l2Predicate = _l2Predicate; } function mapToken(address _l1Token) public requireMultisig { // check if token is already mapped require(l2Predicate != address(0x0), "Invalid L2 pair"); require(l1ToL2Gateway[_l1Token] == address(0x0), "Already mapped"); // compute child token address before deployment using create2 bytes32 salt = keccak256(abi.encodePacked(_l1Token)); address l2Token = Create2.computeAddress(salt, l2TokenBytecodeHash, l2Predicate); // add into mapped tokens l1ToL2Gateway[_l1Token] = l2Token; emit TokenMapped(abi.encode(msg.sender, counter[msg.sender], _l1Token)); counter[msg.sender]++; } function __L1NativeTokenPredicate_init(address _registry, address _l2Predicate) internal { bridgeRegistry = _registry; l2Predicate = _l2Predicate; l2TokenBytecodeHash = 0xb9ae7ba14d826de669be54f7c79008181b430f21bd3ff90dac8cce1e60ae88a9; } function _authorizeUpgrade(address) internal override requireMultisig {} function _initiateDeposit(address _l1Token, address _from, address _to, uint256 _amount) internal notPaused { require(l2Predicate != address(0), "Not supported"); require(_amount > 0, "Not enough amount"); require(_to != address(0), "Invalid address"); require(l1ToL2Gateway[_l1Token] != address(0), "Not supported"); uint256 counter_ = counter[_from]; emit DepositToken(abi.encode(_from, counter_, _l1Token, l1ToL2Gateway[_l1Token], _to, _amount)); counter[_from]++; } function _checkValidatorSignatures( address _from, // uint256 _orderId, address[] memory _currentValidators, bytes[] memory _signatures, bytes32 _messageHash, uint256 _powerThreshold ) private { uint256 cumulativePower = 0; // check no dupicate validator for (uint256 i = 0; i < _currentValidators.length; i++) { address signer = _messageHash.toEthSignedMessageHash().recover(_signatures[i]); require(signer == _currentValidators[i], "Validator signature does not match."); require(IBridgeRegistry(bridgeRegistry).validValidator(signer), "Invalid validator"); require(!isConfirmed[_from][_orderId][signer], "No duplicate validator"); // prevent double-signing attacks isConfirmed[_from][_orderId][signer] = true; // Sum up cumulative power cumulativePower += IBridgeRegistry(bridgeRegistry).getPower(signer); // Break early to avoid wasting gas if (cumulativePower > _powerThreshold) { break; } } // Check that there was enough power require(cumulativePower >= _powerThreshold, "Submitted validator set signatures do not have enough power."); // Success } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @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 IERC1822ProxiableUpgradeable { /** * @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 v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967UpgradeUpgradeable is Initializable { function __ERC1967Upgrade_init() internal onlyInitializing { } function __ERC1967Upgrade_init_unchained() internal onlyInitializing { } // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {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 bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) { require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed"); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./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. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @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() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @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() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @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 override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @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: * ``` * 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(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 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 } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { 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), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @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) { 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] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; import "../../libs/ValidatorSet.sol"; // LightLink 2023 interface IBridgeRegistry { event ConsensusPowerThresholdModified(uint256 _amount); event ValidatorsModifed(address[] _accounts, uint256[] _powers); event ValidatorsRemoved(address[] _accounts); event MutisigModified(address _multisig); event SystemVerifierModified(address _systemVerifier); /* Views */ function consensusPowerThreshold() external view returns (uint256); function validValidator(address) external view returns (bool); function getPower(address) external view returns (uint256); function getValidators() external view returns (ValidatorSet.Validator[] memory); function getMultisig() external view returns (address); function getSystemVerifier() external view returns (address); /* Actions */ function modifyConsensusPowerThreshold(uint256 _amount) external; function modifyValidators(address[] memory _accounts, uint256[] memory _powers) external; function removeValidators(address[] memory _accounts) external; function modifySystemVerifier(address _systemVerifier) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; // LightLink 2023 interface IL1Predicate { /* Events */ function l2TokenBytecodeHash() external view returns (bytes32); function mapToken(address _l1Token) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Create2.sol) pragma solidity 0.8.19; // LightLink 2023 /** * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer. * `CREATE2` can be used to compute in advance the address where a smart * contract will be deployed, which allows for interesting new mechanisms known * as 'counterfactual interactions'. * * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more * information. */ library Create2 { function createClone(bytes32 _salt, address _target) internal returns (address _result) { bytes20 _targetBytes = bytes20(_target); assembly { let clone := mload(0x40) mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(clone, 0x14), _targetBytes) mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) _result := create2(0, clone, 0x37, _salt) } require(_result != address(0), "Create2: Failed on minimal deploy"); } function createClone2(bytes32 _salt, bytes memory _bytecode) internal returns (address _result) { assembly { _result := create2(0, add(_bytecode, 0x20), mload(_bytecode), _salt) if iszero(extcodesize(_result)) { revert(0, 0) } } require(_result != address(0), "Create2: Failed on deploy"); } /** * @dev Deploys a contract using `CREATE2`. The address where the contract * will be deployed can be known in advance via {computeAddress}. * * The bytecode for a contract can be obtained from Solidity with * `type(contractName).creationCode`. * * Requirements: * * - `bytecode` must not be empty. * - `salt` must have not been used for `bytecode` already. * - the factory must have a balance of at least `amount`. * - if `amount` is non-zero, `bytecode` must have a `payable` constructor. */ function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) { require(address(this).balance >= amount, "Create2: insufficient balance"); require(bytecode.length != 0, "Create2: bytecode length is zero"); /// @solidity memory-safe-assembly assembly { addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt) } require(addr != address(0), "Create2: Failed on deploy"); } /** * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the * `bytecodeHash` or `salt` will result in a new destination address. */ function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) { return computeAddress(salt, bytecodeHash, address(this)); } /** * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}. */ function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) // Get free memory pointer // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... | // |-------------------|---------------------------------------------------------------------------| // | bytecodeHash | CCCCCCCCCCCCC...CC | // | salt | BBBBBBBBBBBBB...BB | // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA | // | 0xFF | FF | // |-------------------|---------------------------------------------------------------------------| // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC | // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | mstore(add(ptr, 0x40), bytecodeHash) mstore(add(ptr, 0x20), salt) mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff mstore8(start, 0xff) addr := keccak256(start, 85) } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; // LightLink 2023 library ValidatorSet { struct Validator { address addr; uint256 power; } struct Record { Validator[] values; mapping(address => uint256) indexes; // value to index } function add(Record storage _record, address _value, uint256 _power) internal { if (contains(_record, _value)) return; // exist _record.values.push(Validator(_value, _power)); _record.indexes[_value] = _record.values.length; } function modify(Record storage _record, address _value, uint256 _power) internal { if (!contains(_record, _value)) { add(_record, _value, _power); return; } uint256 valueIndex = _record.indexes[_value]; _record.values[valueIndex - 1].power = _power; } function remove(Record storage _record, address _value) internal { uint256 valueIndex = _record.indexes[_value]; if (valueIndex == 0) return; // removed non-exist value uint256 toDeleteIndex = valueIndex - 1; // dealing with out of bounds uint256 lastIndex = _record.values.length - 1; if (lastIndex != toDeleteIndex) { Validator memory lastvalue = _record.values[lastIndex]; _record.values[toDeleteIndex] = lastvalue; _record.indexes[lastvalue.addr] = valueIndex; // Replace lastvalue's index to valueIndex } _record.values.pop(); _record.indexes[_value] = 0; // set to 0 } function contains(Record storage _record, address _value) internal view returns (bool) { return _record.indexes[_value] != 0; } function size(Record storage _record) internal view returns (uint256) { return _record.values.length; } function at(Record storage _record, uint256 _index) internal view returns (Validator memory) { return _record.values[_index]; } function indexOf(Record storage _record, address _value) internal view returns (bool, uint256) { if (!contains(_record, _value)) return (false, 0); return (true, _record.indexes[_value] - 1); } function getPower(Record storage _record, address _value) internal view returns (uint256) { if (!contains(_record, _value)) return 0; return _record.values[_record.indexes[_value] - 1].power; } }
{ "optimizer": { "enabled": true, "runs": 9999 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"}],"name":"DepositToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"}],"name":"TokenMapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"messageHash","type":"bytes32"}],"name":"WithdrawToken","type":"event"},{"inputs":[],"name":"bridgeRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"counter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_l1Token","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_l1Token","type":"address"},{"internalType":"address","name":"_to","type":"address"}],"name":"depositTo","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_registry","type":"address"},{"internalType":"address","name":"_l2Predicate","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"isConfirmed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"l1ToL2Gateway","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l2Predicate","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l2TokenBytecodeHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_l1Token","type":"address"}],"name":"mapToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_l2Predicate","type":"address"}],"name":"modifyL2Predicate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_l2TokenBytecodeHash","type":"bytes32"}],"name":"modifyL2TokenBytecodeHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"orderExecuted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"recovery","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_currentValidators","type":"address[]"},{"internalType":"bytes[]","name":"_signatures","type":"bytes[]"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"syncWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_status","type":"bool"}],"name":"toggleIsPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","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"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60a06040523060805234801561001457600080fd5b50608051612c8d61004c60003960008181610c7101528181610d07015281816111950152818161122b01526113220152612c8d6000f3fe6080604052600436106101625760003560e01c806352d1902d116100c0578063bb6f2e0611610074578063c6c8788c11610059578063c6c8788c146103ea578063f340fa0114610425578063f4a120f71461043857600080fd5b8063bb6f2e061461039d578063c12327b8146103bd57600080fd5b8063b187bd26116100a5578063b187bd261461034d578063b6e2713614610367578063b78103e91461038757600080fd5b806352d1902d146102f4578063a0d99b1c1461031757600080fd5b806339cc123011610117578063485cc955116100fc578063485cc955146102a15780634922d481146102c15780634f1ef286146102e157600080fd5b806339cc123014610230578063401e68d41461025057600080fd5b80631b0c926f116101485780631b0c926f146101ae578063316be171146101ce5780633659cfe61461021057600080fd5b80625bc12e1461017b578063051d92bb1461018e57600080fd5b36610176576101746000333334610458565b005b600080fd5b61017461018936600461262b565b6106e6565b34801561019a57600080fd5b506101746101a93660046127e8565b6106f6565b3480156101ba57600080fd5b506101746101c93660046128ce565b610b8b565b3480156101da57600080fd5b506097546101f39061010090046001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561021c57600080fd5b5061017461022b3660046128e7565b610c67565b34801561023c57600080fd5b506098546101f3906001600160a01b031681565b34801561025c57600080fd5b5061029161026b366004612904565b609d60209081526000938452604080852082529284528284209052825290205460ff1681565b6040519015158152602001610207565b3480156102ad57600080fd5b506101746102bc36600461262b565b610e04565b3480156102cd57600080fd5b506101746102dc3660046128e7565b611011565b6101746102ef366004612946565b61118b565b34801561030057600080fd5b50610309611315565b604051908152602001610207565b34801561032357600080fd5b506101f36103323660046128e7565b609a602052600090815260409020546001600160a01b031681565b34801561035957600080fd5b506097546102919060ff1681565b34801561037357600080fd5b506101746103823660046129a4565b6113da565b34801561039357600080fd5b5061030960995481565b3480156103a957600080fd5b506101746103b83660046128e7565b6114e2565b3480156103c957600080fd5b506103096103d83660046128e7565b609b6020526000908152604090205481565b3480156103f657600080fd5b506102916104053660046129c1565b609c60209081526000928352604080842090915290825290205460ff1681565b6101746104333660046128e7565b6115f3565b34801561044457600080fd5b506101746104533660046128e7565b6115ff565b60975460ff16156104b05760405162461bcd60e51b815260206004820152600660248201527f506175736564000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b6098546001600160a01b03166105085760405162461bcd60e51b815260206004820152600d60248201527f4e6f7420737570706f727465640000000000000000000000000000000000000060448201526064016104a7565b600081116105585760405162461bcd60e51b815260206004820152601160248201527f4e6f7420656e6f75676820616d6f756e7400000000000000000000000000000060448201526064016104a7565b6001600160a01b0382166105ae5760405162461bcd60e51b815260206004820152600f60248201527f496e76616c69642061646472657373000000000000000000000000000000000060448201526064016104a7565b6001600160a01b038481166000908152609a6020526040902054166106155760405162461bcd60e51b815260206004820152600d60248201527f4e6f7420737570706f727465640000000000000000000000000000000000000060448201526064016104a7565b6001600160a01b038381166000818152609b6020908152604080832054898616808552609a845293829020548251938401959095529082018190526060820192909252918316608083015291841660a082015260c081018390527f435881434a980001db54827793d55b4f3b751d216ed457d0f2a143220ae06d259060e00160408051601f19818403018152908290526106ae91612a3d565b60405180910390a16001600160a01b0384166000908152609b602052604081208054916106da83612a7f565b91905055505050505050565b6106f282338334610458565b5050565b6106fe6118db565b60975460ff16156107515760405162461bcd60e51b815260206004820152600660248201527f506175736564000000000000000000000000000000000000000000000000000060448201526064016104a7565b6000806000806000808680602001905181019061076e9190612ab7565b609854959b509399509197509550935091506001600160a01b03166107d55760405162461bcd60e51b815260206004820152600f60248201527f4e6f7420696d706c656d656e746564000000000000000000000000000000000060448201526064016104a7565b600081116108255760405162461bcd60e51b815260206004820152601160248201527f4e6f7420656e6f75676820616d6f756e7400000000000000000000000000000060448201526064016104a7565b6001600160a01b03821661087b5760405162461bcd60e51b815260206004820152600f60248201527f496e76616c69642061646472657373000000000000000000000000000000000060448201526064016104a7565b6001600160a01b0386166000908152609c6020908152604080832088845290915290205460ff16156108ef5760405162461bcd60e51b815260206004820152601660248201527f4f7264657220616c72656164792065786563757465640000000000000000000060448201526064016104a7565b87518951146109405760405162461bcd60e51b815260206004820152600e60248201527f496e707574206d69736d6174636800000000000000000000000000000000000060448201526064016104a7565b6001600160a01b038481166000908152609a60205260409020548116908416146109ac5760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420746f6b656e2067617465776179000000000000000000000060448201526064016104a7565b600046886040516020016109c1929190612b2a565b604051602081830303815290604052805190602001209050610a5d87878c8c85609760019054906101000a90046001600160a01b03166001600160a01b03166365ee35576040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a589190612b50565b611934565b6001600160a01b038781166000908152609c602090815260408083208a845290915280822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905551909185169084908381818185875af1925050503d8060008114610aeb576040519150601f19603f3d011682016040523d82523d6000602084013e610af0565b606091505b5050905080610b415760405162461bcd60e51b815260206004820152601360248201527f455448207472616e73666572206661696c65640000000000000000000000000060448201526064016104a7565b6040518281527fdb8766dc7a4cbe0b9d514534307d6ed0bc09c930e535e9c61badb099479e13b69060200160405180910390a15050505050505050610b866001606555565b505050565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c029190612b69565b6001600160a01b0316336001600160a01b031614610c625760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016104a7565b609955565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610d055760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084016104a7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610d607f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b031614610ddc5760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f7879000000000000000000000000000000000000000060648201526084016104a7565b610de581611d47565b60408051600080825260208201909252610e0191839190611e1e565b50565b600054610100900460ff1615808015610e245750600054600160ff909116105b80610e3e5750303b158015610e3e575060005460ff166001145b610eb05760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016104a7565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610f0e57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b610f16611fbe565b610faa8383609780546001600160a01b03938416610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff90911617905560988054919092167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790557fb9ae7ba14d826de669be54f7c79008181b430f21bd3ff90dac8cce1e60ae88a9609955565b8015610b8657600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa158015611064573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110889190612b69565b6001600160a01b0316336001600160a01b0316146110e85760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016104a7565b60405147906000906001600160a01b0384169083908381818185875af1925050503d8060008114611135576040519150601f19603f3d011682016040523d82523d6000602084013e61113a565b606091505b5050905080610b865760405162461bcd60e51b815260206004820152601360248201527f455448207472616e73666572206661696c65640000000000000000000000000060448201526064016104a7565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036112295760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084016104a7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166112847f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146113005760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f7879000000000000000000000000000000000000000060648201526084016104a7565b61130982611d47565b6106f282826001611e1e565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146113b55760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016104a7565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa15801561142d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114519190612b69565b6001600160a01b0316336001600160a01b0316146114b15760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016104a7565b609780547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa158015611535573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115599190612b69565b6001600160a01b0316336001600160a01b0316146115b95760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016104a7565b609880547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b610e0181333334610458565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa158015611652573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116769190612b69565b6001600160a01b0316336001600160a01b0316146116d65760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016104a7565b6098546001600160a01b031661172e5760405162461bcd60e51b815260206004820152600f60248201527f496e76616c6964204c322070616972000000000000000000000000000000000060448201526064016104a7565b6001600160a01b038181166000908152609a602052604090205416156117965760405162461bcd60e51b815260206004820152600e60248201527f416c7265616479206d617070656400000000000000000000000000000000000060448201526064016104a7565b6040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606083901b16602082015260009060340160408051601f1981840301815291905280516020909101206099546098549192506000916118039184916001600160a01b0316612045565b6001600160a01b038481166000818152609a6020908152604080832080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169587169590951790945533808352609b825291849020548451918201929092529283015260608201529091507f1f6a77d013b627d23667409a96b7a68bff41621fe44b53ffc26b3b8da24fdb2f9060800160408051601f19818403018152908290526118ae91612a3d565b60405180910390a1336000908152609b602052604081208054916118d183612a7f565b9190505550505050565b60026065540361192d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104a7565b6002606555565b6000805b8551811015611cc05760006119bd86838151811061195857611958612b86565b60200260200101516119b7876040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b9061206f565b90508682815181106119d1576119d1612b86565b60200260200101516001600160a01b0316816001600160a01b031614611a5f5760405162461bcd60e51b815260206004820152602360248201527f56616c696461746f72207369676e617475726520646f6573206e6f74206d617460448201527f63682e000000000000000000000000000000000000000000000000000000000060648201526084016104a7565b6097546040517f2a2e5e420000000000000000000000000000000000000000000000000000000081526001600160a01b03838116600483015261010090920490911690632a2e5e4290602401602060405180830381865afa158015611ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aec9190612bb5565b611b385760405162461bcd60e51b815260206004820152601160248201527f496e76616c69642076616c696461746f7200000000000000000000000000000060448201526064016104a7565b6001600160a01b03808a166000908152609d602090815260408083208c845282528083209385168352929052205460ff1615611bb65760405162461bcd60e51b815260206004820152601660248201527f4e6f206475706c69636174652076616c696461746f720000000000000000000060448201526064016104a7565b6001600160a01b038981166000908152609d602090815260408083208c8452825280832085851680855292529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560975491517f5dd9147c000000000000000000000000000000000000000000000000000000008152600481019190915261010090910490911690635dd9147c90602401602060405180830381865afa158015611c6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c939190612b50565b611c9d9084612bd2565b925083831115611cad5750611cc0565b5080611cb881612a7f565b915050611938565b5081811015611d375760405162461bcd60e51b815260206004820152603c60248201527f5375626d69747465642076616c696461746f7220736574207369676e6174757260448201527f657320646f206e6f74206861766520656e6f75676820706f7765722e0000000060648201526084016104a7565b50505050505050565b6001606555565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dbe9190612b69565b6001600160a01b0316336001600160a01b031614610e015760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016104a7565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611e5157610b8683612095565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611eab575060408051601f3d908101601f19168201909252611ea891810190612b50565b60015b611f1d5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f74205555505300000000000000000000000000000000000060648201526084016104a7565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8114611fb25760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c6555554944000000000000000000000000000000000000000000000060648201526084016104a7565b50610b8683838361216b565b600054610100900460ff1661203b5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016104a7565b612043612196565b565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b600080600061207e8585612213565b9150915061208b81612258565b5090505b92915050565b6001600160a01b0381163b6121125760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016104a7565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b612174836123bd565b6000825111806121815750805b15610b865761219083836123fd565b50505050565b600054610100900460ff16611d405760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016104a7565b60008082516041036122495760208301516040840151606085015160001a61223d87828585612508565b94509450505050612251565b506000905060025b9250929050565b600081600481111561226c5761226c612be5565b036122745750565b600181600481111561228857612288612be5565b036122d55760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016104a7565b60028160048111156122e9576122e9612be5565b036123365760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016104a7565b600381600481111561234a5761234a612be5565b03610e015760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016104a7565b6123c681612095565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b61247c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e7472616374000000000000000000000000000000000000000000000000000060648201526084016104a7565b600080846001600160a01b0316846040516124979190612c14565b600060405180830381855af49150503d80600081146124d2576040519150601f19603f3d011682016040523d82523d6000602084013e6124d7565b606091505b50915091506124ff8282604051806060016040528060278152602001612c31602791396125cc565b95945050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561253f57506000905060036125c3565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612593573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166125bc576000600192509250506125c3565b9150600090505b94509492505050565b606083156125db5750816125e5565b6125e583836125ec565b9392505050565b8151156125fc5781518083602001fd5b8060405162461bcd60e51b81526004016104a79190612a3d565b6001600160a01b0381168114610e0157600080fd5b6000806040838503121561263e57600080fd5b823561264981612616565b9150602083013561265981612616565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156126bc576126bc612664565b604052919050565b600067ffffffffffffffff8211156126de576126de612664565b5060051b60200190565b600082601f8301126126f957600080fd5b813567ffffffffffffffff81111561271357612713612664565b6127266020601f19601f84011601612693565b81815284602083860101111561273b57600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f83011261276957600080fd5b8135602061277e612779836126c4565b612693565b82815260059290921b8401810191818101908684111561279d57600080fd5b8286015b848110156127dd57803567ffffffffffffffff8111156127c15760008081fd5b6127cf8986838b01016126e8565b8452509183019183016127a1565b509695505050505050565b6000806000606084860312156127fd57600080fd5b833567ffffffffffffffff8082111561281557600080fd5b818601915086601f83011261282957600080fd5b81356020612839612779836126c4565b82815260059290921b8401810191818101908a84111561285857600080fd5b948201945b8386101561287f57853561287081612616565b8252948201949082019061285d565b9750508701359250508082111561289557600080fd5b6128a187838801612758565b935060408601359150808211156128b757600080fd5b506128c4868287016126e8565b9150509250925092565b6000602082840312156128e057600080fd5b5035919050565b6000602082840312156128f957600080fd5b81356125e581612616565b60008060006060848603121561291957600080fd5b833561292481612616565b925060208401359150604084013561293b81612616565b809150509250925092565b6000806040838503121561295957600080fd5b823561296481612616565b9150602083013567ffffffffffffffff81111561298057600080fd5b61298c858286016126e8565b9150509250929050565b8015158114610e0157600080fd5b6000602082840312156129b657600080fd5b81356125e581612996565b600080604083850312156129d457600080fd5b82356129df81612616565b946020939093013593505050565b60005b83811015612a085781810151838201526020016129f0565b50506000910152565b60008151808452612a298160208601602086016129ed565b601f01601f19169290920160200192915050565b6020815260006125e56020830184612a11565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612ab057612ab0612a50565b5060010190565b60008060008060008060c08789031215612ad057600080fd5b8651612adb81612616565b602088015160408901519197509550612af381612616565b6060880151909450612b0481612616565b6080880151909350612b1581612616565b8092505060a087015190509295509295509295565b82815260008251612b428160208501602087016129ed565b919091016020019392505050565b600060208284031215612b6257600080fd5b5051919050565b600060208284031215612b7b57600080fd5b81516125e581612616565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215612bc757600080fd5b81516125e581612996565b8082018082111561208f5761208f612a50565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60008251612c268184602087016129ed565b919091019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a7704a2c285819af2681499792ffb9cce0d97ac099a9c815559b1d7ddb9dc6b364736f6c63430008130033
Deployed Bytecode
0x6080604052600436106101625760003560e01c806352d1902d116100c0578063bb6f2e0611610074578063c6c8788c11610059578063c6c8788c146103ea578063f340fa0114610425578063f4a120f71461043857600080fd5b8063bb6f2e061461039d578063c12327b8146103bd57600080fd5b8063b187bd26116100a5578063b187bd261461034d578063b6e2713614610367578063b78103e91461038757600080fd5b806352d1902d146102f4578063a0d99b1c1461031757600080fd5b806339cc123011610117578063485cc955116100fc578063485cc955146102a15780634922d481146102c15780634f1ef286146102e157600080fd5b806339cc123014610230578063401e68d41461025057600080fd5b80631b0c926f116101485780631b0c926f146101ae578063316be171146101ce5780633659cfe61461021057600080fd5b80625bc12e1461017b578063051d92bb1461018e57600080fd5b36610176576101746000333334610458565b005b600080fd5b61017461018936600461262b565b6106e6565b34801561019a57600080fd5b506101746101a93660046127e8565b6106f6565b3480156101ba57600080fd5b506101746101c93660046128ce565b610b8b565b3480156101da57600080fd5b506097546101f39061010090046001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561021c57600080fd5b5061017461022b3660046128e7565b610c67565b34801561023c57600080fd5b506098546101f3906001600160a01b031681565b34801561025c57600080fd5b5061029161026b366004612904565b609d60209081526000938452604080852082529284528284209052825290205460ff1681565b6040519015158152602001610207565b3480156102ad57600080fd5b506101746102bc36600461262b565b610e04565b3480156102cd57600080fd5b506101746102dc3660046128e7565b611011565b6101746102ef366004612946565b61118b565b34801561030057600080fd5b50610309611315565b604051908152602001610207565b34801561032357600080fd5b506101f36103323660046128e7565b609a602052600090815260409020546001600160a01b031681565b34801561035957600080fd5b506097546102919060ff1681565b34801561037357600080fd5b506101746103823660046129a4565b6113da565b34801561039357600080fd5b5061030960995481565b3480156103a957600080fd5b506101746103b83660046128e7565b6114e2565b3480156103c957600080fd5b506103096103d83660046128e7565b609b6020526000908152604090205481565b3480156103f657600080fd5b506102916104053660046129c1565b609c60209081526000928352604080842090915290825290205460ff1681565b6101746104333660046128e7565b6115f3565b34801561044457600080fd5b506101746104533660046128e7565b6115ff565b60975460ff16156104b05760405162461bcd60e51b815260206004820152600660248201527f506175736564000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b6098546001600160a01b03166105085760405162461bcd60e51b815260206004820152600d60248201527f4e6f7420737570706f727465640000000000000000000000000000000000000060448201526064016104a7565b600081116105585760405162461bcd60e51b815260206004820152601160248201527f4e6f7420656e6f75676820616d6f756e7400000000000000000000000000000060448201526064016104a7565b6001600160a01b0382166105ae5760405162461bcd60e51b815260206004820152600f60248201527f496e76616c69642061646472657373000000000000000000000000000000000060448201526064016104a7565b6001600160a01b038481166000908152609a6020526040902054166106155760405162461bcd60e51b815260206004820152600d60248201527f4e6f7420737570706f727465640000000000000000000000000000000000000060448201526064016104a7565b6001600160a01b038381166000818152609b6020908152604080832054898616808552609a845293829020548251938401959095529082018190526060820192909252918316608083015291841660a082015260c081018390527f435881434a980001db54827793d55b4f3b751d216ed457d0f2a143220ae06d259060e00160408051601f19818403018152908290526106ae91612a3d565b60405180910390a16001600160a01b0384166000908152609b602052604081208054916106da83612a7f565b91905055505050505050565b6106f282338334610458565b5050565b6106fe6118db565b60975460ff16156107515760405162461bcd60e51b815260206004820152600660248201527f506175736564000000000000000000000000000000000000000000000000000060448201526064016104a7565b6000806000806000808680602001905181019061076e9190612ab7565b609854959b509399509197509550935091506001600160a01b03166107d55760405162461bcd60e51b815260206004820152600f60248201527f4e6f7420696d706c656d656e746564000000000000000000000000000000000060448201526064016104a7565b600081116108255760405162461bcd60e51b815260206004820152601160248201527f4e6f7420656e6f75676820616d6f756e7400000000000000000000000000000060448201526064016104a7565b6001600160a01b03821661087b5760405162461bcd60e51b815260206004820152600f60248201527f496e76616c69642061646472657373000000000000000000000000000000000060448201526064016104a7565b6001600160a01b0386166000908152609c6020908152604080832088845290915290205460ff16156108ef5760405162461bcd60e51b815260206004820152601660248201527f4f7264657220616c72656164792065786563757465640000000000000000000060448201526064016104a7565b87518951146109405760405162461bcd60e51b815260206004820152600e60248201527f496e707574206d69736d6174636800000000000000000000000000000000000060448201526064016104a7565b6001600160a01b038481166000908152609a60205260409020548116908416146109ac5760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420746f6b656e2067617465776179000000000000000000000060448201526064016104a7565b600046886040516020016109c1929190612b2a565b604051602081830303815290604052805190602001209050610a5d87878c8c85609760019054906101000a90046001600160a01b03166001600160a01b03166365ee35576040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a589190612b50565b611934565b6001600160a01b038781166000908152609c602090815260408083208a845290915280822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905551909185169084908381818185875af1925050503d8060008114610aeb576040519150601f19603f3d011682016040523d82523d6000602084013e610af0565b606091505b5050905080610b415760405162461bcd60e51b815260206004820152601360248201527f455448207472616e73666572206661696c65640000000000000000000000000060448201526064016104a7565b6040518281527fdb8766dc7a4cbe0b9d514534307d6ed0bc09c930e535e9c61badb099479e13b69060200160405180910390a15050505050505050610b866001606555565b505050565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c029190612b69565b6001600160a01b0316336001600160a01b031614610c625760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016104a7565b609955565b6001600160a01b037f000000000000000000000000468b89d930ca7974196d7195033600b658011756163003610d055760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084016104a7565b7f000000000000000000000000468b89d930ca7974196d7195033600b6580117566001600160a01b0316610d607f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b031614610ddc5760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f7879000000000000000000000000000000000000000060648201526084016104a7565b610de581611d47565b60408051600080825260208201909252610e0191839190611e1e565b50565b600054610100900460ff1615808015610e245750600054600160ff909116105b80610e3e5750303b158015610e3e575060005460ff166001145b610eb05760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016104a7565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610f0e57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b610f16611fbe565b610faa8383609780546001600160a01b03938416610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff90911617905560988054919092167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790557fb9ae7ba14d826de669be54f7c79008181b430f21bd3ff90dac8cce1e60ae88a9609955565b8015610b8657600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa158015611064573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110889190612b69565b6001600160a01b0316336001600160a01b0316146110e85760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016104a7565b60405147906000906001600160a01b0384169083908381818185875af1925050503d8060008114611135576040519150601f19603f3d011682016040523d82523d6000602084013e61113a565b606091505b5050905080610b865760405162461bcd60e51b815260206004820152601360248201527f455448207472616e73666572206661696c65640000000000000000000000000060448201526064016104a7565b6001600160a01b037f000000000000000000000000468b89d930ca7974196d7195033600b6580117561630036112295760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084016104a7565b7f000000000000000000000000468b89d930ca7974196d7195033600b6580117566001600160a01b03166112847f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146113005760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f7879000000000000000000000000000000000000000060648201526084016104a7565b61130982611d47565b6106f282826001611e1e565b6000306001600160a01b037f000000000000000000000000468b89d930ca7974196d7195033600b65801175616146113b55760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016104a7565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa15801561142d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114519190612b69565b6001600160a01b0316336001600160a01b0316146114b15760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016104a7565b609780547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa158015611535573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115599190612b69565b6001600160a01b0316336001600160a01b0316146115b95760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016104a7565b609880547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b610e0181333334610458565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa158015611652573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116769190612b69565b6001600160a01b0316336001600160a01b0316146116d65760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016104a7565b6098546001600160a01b031661172e5760405162461bcd60e51b815260206004820152600f60248201527f496e76616c6964204c322070616972000000000000000000000000000000000060448201526064016104a7565b6001600160a01b038181166000908152609a602052604090205416156117965760405162461bcd60e51b815260206004820152600e60248201527f416c7265616479206d617070656400000000000000000000000000000000000060448201526064016104a7565b6040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606083901b16602082015260009060340160408051601f1981840301815291905280516020909101206099546098549192506000916118039184916001600160a01b0316612045565b6001600160a01b038481166000818152609a6020908152604080832080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169587169590951790945533808352609b825291849020548451918201929092529283015260608201529091507f1f6a77d013b627d23667409a96b7a68bff41621fe44b53ffc26b3b8da24fdb2f9060800160408051601f19818403018152908290526118ae91612a3d565b60405180910390a1336000908152609b602052604081208054916118d183612a7f565b9190505550505050565b60026065540361192d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104a7565b6002606555565b6000805b8551811015611cc05760006119bd86838151811061195857611958612b86565b60200260200101516119b7876040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b9061206f565b90508682815181106119d1576119d1612b86565b60200260200101516001600160a01b0316816001600160a01b031614611a5f5760405162461bcd60e51b815260206004820152602360248201527f56616c696461746f72207369676e617475726520646f6573206e6f74206d617460448201527f63682e000000000000000000000000000000000000000000000000000000000060648201526084016104a7565b6097546040517f2a2e5e420000000000000000000000000000000000000000000000000000000081526001600160a01b03838116600483015261010090920490911690632a2e5e4290602401602060405180830381865afa158015611ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aec9190612bb5565b611b385760405162461bcd60e51b815260206004820152601160248201527f496e76616c69642076616c696461746f7200000000000000000000000000000060448201526064016104a7565b6001600160a01b03808a166000908152609d602090815260408083208c845282528083209385168352929052205460ff1615611bb65760405162461bcd60e51b815260206004820152601660248201527f4e6f206475706c69636174652076616c696461746f720000000000000000000060448201526064016104a7565b6001600160a01b038981166000908152609d602090815260408083208c8452825280832085851680855292529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560975491517f5dd9147c000000000000000000000000000000000000000000000000000000008152600481019190915261010090910490911690635dd9147c90602401602060405180830381865afa158015611c6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c939190612b50565b611c9d9084612bd2565b925083831115611cad5750611cc0565b5080611cb881612a7f565b915050611938565b5081811015611d375760405162461bcd60e51b815260206004820152603c60248201527f5375626d69747465642076616c696461746f7220736574207369676e6174757260448201527f657320646f206e6f74206861766520656e6f75676820706f7765722e0000000060648201526084016104a7565b50505050505050565b6001606555565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dbe9190612b69565b6001600160a01b0316336001600160a01b031614610e015760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016104a7565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611e5157610b8683612095565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611eab575060408051601f3d908101601f19168201909252611ea891810190612b50565b60015b611f1d5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f74205555505300000000000000000000000000000000000060648201526084016104a7565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8114611fb25760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c6555554944000000000000000000000000000000000000000000000060648201526084016104a7565b50610b8683838361216b565b600054610100900460ff1661203b5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016104a7565b612043612196565b565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b600080600061207e8585612213565b9150915061208b81612258565b5090505b92915050565b6001600160a01b0381163b6121125760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016104a7565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b612174836123bd565b6000825111806121815750805b15610b865761219083836123fd565b50505050565b600054610100900460ff16611d405760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016104a7565b60008082516041036122495760208301516040840151606085015160001a61223d87828585612508565b94509450505050612251565b506000905060025b9250929050565b600081600481111561226c5761226c612be5565b036122745750565b600181600481111561228857612288612be5565b036122d55760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016104a7565b60028160048111156122e9576122e9612be5565b036123365760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016104a7565b600381600481111561234a5761234a612be5565b03610e015760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016104a7565b6123c681612095565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b61247c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e7472616374000000000000000000000000000000000000000000000000000060648201526084016104a7565b600080846001600160a01b0316846040516124979190612c14565b600060405180830381855af49150503d80600081146124d2576040519150601f19603f3d011682016040523d82523d6000602084013e6124d7565b606091505b50915091506124ff8282604051806060016040528060278152602001612c31602791396125cc565b95945050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561253f57506000905060036125c3565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612593573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166125bc576000600192509250506125c3565b9150600090505b94509492505050565b606083156125db5750816125e5565b6125e583836125ec565b9392505050565b8151156125fc5781518083602001fd5b8060405162461bcd60e51b81526004016104a79190612a3d565b6001600160a01b0381168114610e0157600080fd5b6000806040838503121561263e57600080fd5b823561264981612616565b9150602083013561265981612616565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156126bc576126bc612664565b604052919050565b600067ffffffffffffffff8211156126de576126de612664565b5060051b60200190565b600082601f8301126126f957600080fd5b813567ffffffffffffffff81111561271357612713612664565b6127266020601f19601f84011601612693565b81815284602083860101111561273b57600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f83011261276957600080fd5b8135602061277e612779836126c4565b612693565b82815260059290921b8401810191818101908684111561279d57600080fd5b8286015b848110156127dd57803567ffffffffffffffff8111156127c15760008081fd5b6127cf8986838b01016126e8565b8452509183019183016127a1565b509695505050505050565b6000806000606084860312156127fd57600080fd5b833567ffffffffffffffff8082111561281557600080fd5b818601915086601f83011261282957600080fd5b81356020612839612779836126c4565b82815260059290921b8401810191818101908a84111561285857600080fd5b948201945b8386101561287f57853561287081612616565b8252948201949082019061285d565b9750508701359250508082111561289557600080fd5b6128a187838801612758565b935060408601359150808211156128b757600080fd5b506128c4868287016126e8565b9150509250925092565b6000602082840312156128e057600080fd5b5035919050565b6000602082840312156128f957600080fd5b81356125e581612616565b60008060006060848603121561291957600080fd5b833561292481612616565b925060208401359150604084013561293b81612616565b809150509250925092565b6000806040838503121561295957600080fd5b823561296481612616565b9150602083013567ffffffffffffffff81111561298057600080fd5b61298c858286016126e8565b9150509250929050565b8015158114610e0157600080fd5b6000602082840312156129b657600080fd5b81356125e581612996565b600080604083850312156129d457600080fd5b82356129df81612616565b946020939093013593505050565b60005b83811015612a085781810151838201526020016129f0565b50506000910152565b60008151808452612a298160208601602086016129ed565b601f01601f19169290920160200192915050565b6020815260006125e56020830184612a11565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612ab057612ab0612a50565b5060010190565b60008060008060008060c08789031215612ad057600080fd5b8651612adb81612616565b602088015160408901519197509550612af381612616565b6060880151909450612b0481612616565b6080880151909350612b1581612616565b8092505060a087015190509295509295509295565b82815260008251612b428160208501602087016129ed565b919091016020019392505050565b600060208284031215612b6257600080fd5b5051919050565b600060208284031215612b7b57600080fd5b81516125e581612616565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215612bc757600080fd5b81516125e581612996565b8082018082111561208f5761208f612a50565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60008251612c268184602087016129ed565b919091019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a7704a2c285819af2681499792ffb9cce0d97ac099a9c815559b1d7ddb9dc6b364736f6c63430008130033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.