Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Cross-Chain Transactions
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 Name:
L1ERC20Predicate
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 "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../../../libs/Create2.sol";
import "./IL1Predicate.sol";
import "../../common/IBridgeRegistry.sol";
// LightLink 2023
contract L1ERC20Predicate is
Initializable, //
UUPSUpgradeable,
ReentrancyGuardUpgradeable,
IL1Predicate
{
using ECDSA for bytes32;
using SafeERC20 for IERC20;
// 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 {
revert("Not supported");
}
function recovery(address[] memory _tokens, address _to) external requireMultisig {
for (uint256 i = 0; i < _tokens.length; i++) {
address token = _tokens[i];
uint256 _amount = IERC20(token).balanceOf(address(this));
if (_amount > 0) {
IERC20(token).safeTransfer(_to, _amount);
}
}
}
function deposit(address _l1Token, uint256 _amount) external virtual {
_initiateDeposit(_l1Token, msg.sender, msg.sender, _amount);
}
// verified
function depositTo(address _l1Token, address _to, uint256 _amount) external virtual {
_initiateDeposit(_l1Token, msg.sender, _to, _amount);
}
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;
IERC20(l1Token).safeTransfer(to, amount);
emit WithdrawToken(messageHash);
}
function initialize(address _registry, address _l2Predicate) public initializer {
__ReentrancyGuard_init();
__L1ERC20Predicate_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");
string memory name;
try ERC20(_l1Token).name() returns (string memory _name) {
name = _name;
} catch {}
string memory symbol;
try ERC20(_l1Token).symbol() returns (string memory _symbol) {
symbol = _symbol;
} catch {}
uint8 decimals = ERC20(_l1Token).decimals();
// 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, name, symbol, decimals));
counter[msg.sender]++;
}
function __L1ERC20Predicate_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 implemented");
require(_amount > 0, "Not enough amount");
require(_to != address(0), "Invalid address");
require(l1ToL2Gateway[_l1Token] != address(0), "Not supported");
IERC20(_l1Token).safeTransferFrom(_from, address(this), _amount);
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;
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) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_totalSupply -= amount;
}
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// 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
Contract ABI
API[{"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"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_l1Token","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositTo","outputs":[],"stateMutability":"nonpayable","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":"_tokens","type":"address[]"},{"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
60a06040523060805234801561001457600080fd5b506080516132b561004c600039600081816109a301528181610a3901528181610d5d01528181610df30152610eea01526132b56000f3fe6080604052600436106101635760003560e01c8063804efd2e116100c0578063bb6f2e0611610074578063c6c8788c11610059578063c6c8788c14610438578063f213159c14610473578063f4a120f71461049357600080fd5b8063bb6f2e06146103eb578063c12327b81461040b57600080fd5b8063b187bd26116100a5578063b187bd261461039b578063b6e27136146103b5578063b78103e9146103d557600080fd5b8063804efd2e14610345578063a0d99b1c1461036557600080fd5b8063401e68d411610117578063485cc955116100fc578063485cc955146102ef5780634f1ef2861461030f57806352d1902d1461032257600080fd5b8063401e68d41461027e57806347e7ef24146102cf57600080fd5b8063316be17111610148578063316be171146101fc5780633659cfe61461023e57806339cc12301461025e57600080fd5b8063051d92bb146101ba5780631b0c926f146101dc57600080fd5b366101b55760405162461bcd60e51b815260206004820152600d60248201527f4e6f7420737570706f727465640000000000000000000000000000000000000060448201526064015b60405180910390fd5b600080fd5b3480156101c657600080fd5b506101da6101d5366004612c52565b6104b3565b005b3480156101e857600080fd5b506101da6101f7366004612d49565b6108bd565b34801561020857600080fd5b506097546102219061010090046001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561024a57600080fd5b506101da610259366004612d62565b610999565b34801561026a57600080fd5b50609854610221906001600160a01b031681565b34801561028a57600080fd5b506102bf610299366004612d7f565b609d60209081526000938452604080852082529284528284209052825290205460ff1681565b6040519015158152602001610235565b3480156102db57600080fd5b506101da6102ea366004612dc1565b610b36565b3480156102fb57600080fd5b506101da61030a366004612ded565b610b46565b6101da61031d366004612e26565b610d53565b34801561032e57600080fd5b50610337610edd565b604051908152602001610235565b34801561035157600080fd5b506101da610360366004612e76565b610fa2565b34801561037157600080fd5b50610221610380366004612d62565b609a602052600090815260409020546001600160a01b031681565b3480156103a757600080fd5b506097546102bf9060ff1681565b3480156103c157600080fd5b506101da6103d0366004612ecb565b61115c565b3480156103e157600080fd5b5061033760995481565b3480156103f757600080fd5b506101da610406366004612d62565b611264565b34801561041757600080fd5b50610337610426366004612d62565b609b6020526000908152604090205481565b34801561044457600080fd5b506102bf610453366004612dc1565b609c60209081526000928352604080842090915290825290205460ff1681565b34801561047f57600080fd5b506101da61048e366004612ee8565b611375565b34801561049f57600080fd5b506101da6104ae366004612d62565b611381565b6104bb611799565b60975460ff161561050e5760405162461bcd60e51b815260206004820152600660248201527f506175736564000000000000000000000000000000000000000000000000000060448201526064016101ac565b6000806000806000808680602001905181019061052b9190612f29565b609854959b509399509197509550935091506001600160a01b03166105925760405162461bcd60e51b815260206004820152600f60248201527f4e6f7420696d706c656d656e746564000000000000000000000000000000000060448201526064016101ac565b600081116105e25760405162461bcd60e51b815260206004820152601160248201527f4e6f7420656e6f75676820616d6f756e7400000000000000000000000000000060448201526064016101ac565b6001600160a01b0382166106385760405162461bcd60e51b815260206004820152600f60248201527f496e76616c69642061646472657373000000000000000000000000000000000060448201526064016101ac565b6001600160a01b0386166000908152609c6020908152604080832088845290915290205460ff16156106ac5760405162461bcd60e51b815260206004820152601660248201527f4f7264657220616c72656164792065786563757465640000000000000000000060448201526064016101ac565b87518951146106fd5760405162461bcd60e51b815260206004820152600e60248201527f496e707574206d69736d6174636800000000000000000000000000000000000060448201526064016101ac565b6001600160a01b038481166000908152609a60205260409020548116908416146107695760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420746f6b656e2067617465776179000000000000000000000060448201526064016101ac565b6000468860405160200161077e929190612fc0565b60405160208183030381529060405280519060200120905061081a87878c8c85609760019054906101000a90046001600160a01b03166001600160a01b03166365ee35576040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108159190612fe6565b6117f2565b6001600160a01b038088166000908152609c602090815260408083208a8452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556108749086168484611bfe565b6040518181527fdb8766dc7a4cbe0b9d514534307d6ed0bc09c930e535e9c61badb099479e13b69060200160405180910390a1505050505050506108b86001606555565b505050565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa158015610910573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109349190612fff565b6001600160a01b0316336001600160a01b0316146109945760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016101ac565b609955565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610a375760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084016101ac565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610a927f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b031614610b0e5760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f7879000000000000000000000000000000000000000060648201526084016101ac565b610b1781611cae565b60408051600080825260208201909252610b3391839190611d85565b50565b610b4282333384611f25565b5050565b600054610100900460ff1615808015610b665750600054600160ff909116105b80610b805750303b158015610b80575060005460ff166001145b610bf25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016101ac565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610c5057600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b610c586121c3565b610cec8383609780546001600160a01b03938416610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff90911617905560988054919092167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790557fb9ae7ba14d826de669be54f7c79008181b430f21bd3ff90dac8cce1e60ae88a9609955565b80156108b857600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610df15760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084016101ac565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610e4c7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b031614610ec85760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f7879000000000000000000000000000000000000000060648201526084016101ac565b610ed182611cae565b610b4282826001611d85565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610f7d5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016101ac565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ff5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110199190612fff565b6001600160a01b0316336001600160a01b0316146110795760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016101ac565b60005b82518110156108b85760008382815181106110995761109961301c565b60209081029190910101516040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529091506000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611107573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112b9190612fe6565b90508015611147576111476001600160a01b0383168583611bfe565b505080806111549061307a565b91505061107c565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d39190612fff565b6001600160a01b0316336001600160a01b0316146112335760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016101ac565b609780547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112db9190612fff565b6001600160a01b0316336001600160a01b03161461133b5760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016101ac565b609880547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6108b883338484611f25565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f89190612fff565b6001600160a01b0316336001600160a01b0316146114585760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016101ac565b6098546001600160a01b03166114b05760405162461bcd60e51b815260206004820152600f60248201527f496e76616c6964204c322070616972000000000000000000000000000000000060448201526064016101ac565b6001600160a01b038181166000908152609a602052604090205416156115185760405162461bcd60e51b815260206004820152600e60248201527f416c7265616479206d617070656400000000000000000000000000000000000060448201526064016101ac565b6060816001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa92505050801561157957506040513d6000823e601f3d908101601f1916820160405261157691908101906130b2565b60015b156115815790505b6060826001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa9250505080156115e257506040513d6000823e601f3d908101601f191682016040526115df91908101906130b2565b60015b156115ea5790505b6000836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561162a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164e9190613120565b6040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606087901b16602082015290915060009060340160408051601f1981840301815291905280516020909101206099546098549192506000916116be9184916001600160a01b031661224a565b6001600160a01b038781166000908152609a6020908152604080832080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169486169490941790935533808352609b8252918390205492519394507f1f6a77d013b627d23667409a96b7a68bff41621fe44b53ffc26b3b8da24fdb2f9361174f93918b918b918b918b910161316f565b60408051601f1981840301815290829052611769916131ca565b60405180910390a1336000908152609b6020526040812080549161178c8361307a565b9190505550505050505050565b6002606554036117eb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ac565b6002606555565b6000805b8551811015611b7e57600061187b8683815181106118165761181661301c565b6020026020010151611875876040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b90612274565b905086828151811061188f5761188f61301c565b60200260200101516001600160a01b0316816001600160a01b03161461191d5760405162461bcd60e51b815260206004820152602360248201527f56616c696461746f72207369676e617475726520646f6573206e6f74206d617460448201527f63682e000000000000000000000000000000000000000000000000000000000060648201526084016101ac565b6097546040517f2a2e5e420000000000000000000000000000000000000000000000000000000081526001600160a01b03838116600483015261010090920490911690632a2e5e4290602401602060405180830381865afa158015611986573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119aa91906131dd565b6119f65760405162461bcd60e51b815260206004820152601160248201527f496e76616c69642076616c696461746f7200000000000000000000000000000060448201526064016101ac565b6001600160a01b03808a166000908152609d602090815260408083208c845282528083209385168352929052205460ff1615611a745760405162461bcd60e51b815260206004820152601660248201527f4e6f206475706c69636174652076616c696461746f720000000000000000000060448201526064016101ac565b6001600160a01b038981166000908152609d602090815260408083208c8452825280832085851680855292529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560975491517f5dd9147c000000000000000000000000000000000000000000000000000000008152600481019190915261010090910490911690635dd9147c90602401602060405180830381865afa158015611b2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b519190612fe6565b611b5b90846131fa565b925083831115611b6b5750611b7e565b5080611b768161307a565b9150506117f6565b5081811015611bf55760405162461bcd60e51b815260206004820152603c60248201527f5375626d69747465642076616c696461746f7220736574207369676e6174757260448201527f657320646f206e6f74206861766520656e6f75676820706f7765722e0000000060648201526084016101ac565b50505050505050565b6040516001600160a01b0383166024820152604481018290526108b89084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261229a565b6001606555565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d259190612fff565b6001600160a01b0316336001600160a01b031614610b335760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016101ac565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611db8576108b88361237f565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611e12575060408051601f3d908101601f19168201909252611e0f91810190612fe6565b60015b611e845760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f74205555505300000000000000000000000000000000000060648201526084016101ac565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8114611f195760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c6555554944000000000000000000000000000000000000000000000060648201526084016101ac565b506108b8838383612455565b60975460ff1615611f785760405162461bcd60e51b815260206004820152600660248201527f506175736564000000000000000000000000000000000000000000000000000060448201526064016101ac565b6098546001600160a01b0316611fd05760405162461bcd60e51b815260206004820152600f60248201527f4e6f7420696d706c656d656e746564000000000000000000000000000000000060448201526064016101ac565b600081116120205760405162461bcd60e51b815260206004820152601160248201527f4e6f7420656e6f75676820616d6f756e7400000000000000000000000000000060448201526064016101ac565b6001600160a01b0382166120765760405162461bcd60e51b815260206004820152600f60248201527f496e76616c69642061646472657373000000000000000000000000000000000060448201526064016101ac565b6001600160a01b038481166000908152609a6020526040902054166120dd5760405162461bcd60e51b815260206004820152600d60248201527f4e6f7420737570706f727465640000000000000000000000000000000000000060448201526064016101ac565b6120f26001600160a01b038516843084612480565b6001600160a01b038381166000818152609b6020908152604080832054898616808552609a845293829020548251938401959095529082018190526060820192909252918316608083015291841660a082015260c081018390527f435881434a980001db54827793d55b4f3b751d216ed457d0f2a143220ae06d259060e00160408051601f198184030181529082905261218b916131ca565b60405180910390a16001600160a01b0384166000908152609b602052604081208054916121b78361307a565b91905055505050505050565b600054610100900460ff166122405760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016101ac565b6122486124d1565b565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6000806000612283858561254e565b9150915061229081612593565b5090505b92915050565b60006122ef826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166126f89092919063ffffffff16565b8051909150156108b8578080602001905181019061230d91906131dd565b6108b85760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016101ac565b6001600160a01b0381163b6123fc5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016101ac565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b61245e83612711565b60008251118061246b5750805b156108b85761247a8383612751565b50505050565b6040516001600160a01b038085166024830152831660448201526064810182905261247a9085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611c43565b600054610100900460ff16611ca75760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016101ac565b60008082516041036125845760208301516040840151606085015160001a6125788782858561285c565b9450945050505061258c565b506000905060025b9250929050565b60008160048111156125a7576125a761320d565b036125af5750565b60018160048111156125c3576125c361320d565b036126105760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016101ac565b60028160048111156126245761262461320d565b036126715760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016101ac565b60038160048111156126855761268561320d565b03610b335760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016101ac565b60606127078484600085612920565b90505b9392505050565b61271a8161237f565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6127d05760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e7472616374000000000000000000000000000000000000000000000000000060648201526084016101ac565b600080846001600160a01b0316846040516127eb919061323c565b600060405180830381855af49150503d8060008114612826576040519150601f19603f3d011682016040523d82523d6000602084013e61282b565b606091505b5091509150612853828260405180606001604052806027815260200161325960279139612a14565b95945050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156128935750600090506003612917565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156128e7573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661291057600060019250925050612917565b9150600090505b94509492505050565b6060824710156129985760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016101ac565b600080866001600160a01b031685876040516129b4919061323c565b60006040518083038185875af1925050503d80600081146129f1576040519150601f19603f3d011682016040523d82523d6000602084013e6129f6565b606091505b5091509150612a0787838387612a2d565b925050505b949350505050565b60608315612a2357508161270a565b61270a8383612aa2565b60608315612a9c578251600003612a95576001600160a01b0385163b612a955760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ac565b5081612a0c565b612a0c83835b815115612ab25781518083602001fd5b8060405162461bcd60e51b81526004016101ac91906131ca565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612b2457612b24612acc565b604052919050565b600067ffffffffffffffff821115612b4657612b46612acc565b5060051b60200190565b6001600160a01b0381168114610b3357600080fd5b600082601f830112612b7657600080fd5b81356020612b8b612b8683612b2c565b612afb565b82815260059290921b84018101918181019086841115612baa57600080fd5b8286015b84811015612bce578035612bc181612b50565b8352918301918301612bae565b509695505050505050565b600067ffffffffffffffff821115612bf357612bf3612acc565b50601f01601f191660200190565b600082601f830112612c1257600080fd5b8135612c20612b8682612bd9565b818152846020838601011115612c3557600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060608486031215612c6757600080fd5b833567ffffffffffffffff80821115612c7f57600080fd5b612c8b87838801612b65565b9450602091508186013581811115612ca257600080fd5b8601601f81018813612cb357600080fd5b8035612cc1612b8682612b2c565b81815260059190911b8201840190848101908a831115612ce057600080fd5b8584015b83811015612d1857803586811115612cfc5760008081fd5b612d0a8d8983890101612c01565b845250918601918601612ce4565b5096505050506040860135915080821115612d3257600080fd5b50612d3f86828701612c01565b9150509250925092565b600060208284031215612d5b57600080fd5b5035919050565b600060208284031215612d7457600080fd5b813561270a81612b50565b600080600060608486031215612d9457600080fd5b8335612d9f81612b50565b9250602084013591506040840135612db681612b50565b809150509250925092565b60008060408385031215612dd457600080fd5b8235612ddf81612b50565b946020939093013593505050565b60008060408385031215612e0057600080fd5b8235612e0b81612b50565b91506020830135612e1b81612b50565b809150509250929050565b60008060408385031215612e3957600080fd5b8235612e4481612b50565b9150602083013567ffffffffffffffff811115612e6057600080fd5b612e6c85828601612c01565b9150509250929050565b60008060408385031215612e8957600080fd5b823567ffffffffffffffff811115612ea057600080fd5b612eac85828601612b65565b9250506020830135612e1b81612b50565b8015158114610b3357600080fd5b600060208284031215612edd57600080fd5b813561270a81612ebd565b600080600060608486031215612efd57600080fd5b8335612f0881612b50565b92506020840135612f1881612b50565b929592945050506040919091013590565b60008060008060008060c08789031215612f4257600080fd5b8651612f4d81612b50565b602088015160408901519197509550612f6581612b50565b6060880151909450612f7681612b50565b6080880151909350612f8781612b50565b8092505060a087015190509295509295509295565b60005b83811015612fb7578181015183820152602001612f9f565b50506000910152565b82815260008251612fd8816020850160208701612f9c565b919091016020019392505050565b600060208284031215612ff857600080fd5b5051919050565b60006020828403121561301157600080fd5b815161270a81612b50565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036130ab576130ab61304b565b5060010190565b6000602082840312156130c457600080fd5b815167ffffffffffffffff8111156130db57600080fd5b8201601f810184136130ec57600080fd5b80516130fa612b8682612bd9565b81815285602083850101111561310f57600080fd5b612853826020830160208601612f9c565b60006020828403121561313257600080fd5b815160ff8116811461270a57600080fd5b6000815180845261315b816020860160208601612f9c565b601f01601f19169290920160200192915050565b60006001600160a01b03808916835287602084015280871660408401525060c060608301526131a160c0830186613143565b82810360808401526131b38186613143565b91505060ff831660a0830152979650505050505050565b60208152600061270a6020830184613143565b6000602082840312156131ef57600080fd5b815161270a81612ebd565b808201808211156122945761229461304b565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000825161324e818460208701612f9c565b919091019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220464d6de02d41cabbbef75ebdd45197404d8512c5cce87d52e2a7b7f8237f42c364736f6c63430008130033
Deployed Bytecode
0x6080604052600436106101635760003560e01c8063804efd2e116100c0578063bb6f2e0611610074578063c6c8788c11610059578063c6c8788c14610438578063f213159c14610473578063f4a120f71461049357600080fd5b8063bb6f2e06146103eb578063c12327b81461040b57600080fd5b8063b187bd26116100a5578063b187bd261461039b578063b6e27136146103b5578063b78103e9146103d557600080fd5b8063804efd2e14610345578063a0d99b1c1461036557600080fd5b8063401e68d411610117578063485cc955116100fc578063485cc955146102ef5780634f1ef2861461030f57806352d1902d1461032257600080fd5b8063401e68d41461027e57806347e7ef24146102cf57600080fd5b8063316be17111610148578063316be171146101fc5780633659cfe61461023e57806339cc12301461025e57600080fd5b8063051d92bb146101ba5780631b0c926f146101dc57600080fd5b366101b55760405162461bcd60e51b815260206004820152600d60248201527f4e6f7420737570706f727465640000000000000000000000000000000000000060448201526064015b60405180910390fd5b600080fd5b3480156101c657600080fd5b506101da6101d5366004612c52565b6104b3565b005b3480156101e857600080fd5b506101da6101f7366004612d49565b6108bd565b34801561020857600080fd5b506097546102219061010090046001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561024a57600080fd5b506101da610259366004612d62565b610999565b34801561026a57600080fd5b50609854610221906001600160a01b031681565b34801561028a57600080fd5b506102bf610299366004612d7f565b609d60209081526000938452604080852082529284528284209052825290205460ff1681565b6040519015158152602001610235565b3480156102db57600080fd5b506101da6102ea366004612dc1565b610b36565b3480156102fb57600080fd5b506101da61030a366004612ded565b610b46565b6101da61031d366004612e26565b610d53565b34801561032e57600080fd5b50610337610edd565b604051908152602001610235565b34801561035157600080fd5b506101da610360366004612e76565b610fa2565b34801561037157600080fd5b50610221610380366004612d62565b609a602052600090815260409020546001600160a01b031681565b3480156103a757600080fd5b506097546102bf9060ff1681565b3480156103c157600080fd5b506101da6103d0366004612ecb565b61115c565b3480156103e157600080fd5b5061033760995481565b3480156103f757600080fd5b506101da610406366004612d62565b611264565b34801561041757600080fd5b50610337610426366004612d62565b609b6020526000908152604090205481565b34801561044457600080fd5b506102bf610453366004612dc1565b609c60209081526000928352604080842090915290825290205460ff1681565b34801561047f57600080fd5b506101da61048e366004612ee8565b611375565b34801561049f57600080fd5b506101da6104ae366004612d62565b611381565b6104bb611799565b60975460ff161561050e5760405162461bcd60e51b815260206004820152600660248201527f506175736564000000000000000000000000000000000000000000000000000060448201526064016101ac565b6000806000806000808680602001905181019061052b9190612f29565b609854959b509399509197509550935091506001600160a01b03166105925760405162461bcd60e51b815260206004820152600f60248201527f4e6f7420696d706c656d656e746564000000000000000000000000000000000060448201526064016101ac565b600081116105e25760405162461bcd60e51b815260206004820152601160248201527f4e6f7420656e6f75676820616d6f756e7400000000000000000000000000000060448201526064016101ac565b6001600160a01b0382166106385760405162461bcd60e51b815260206004820152600f60248201527f496e76616c69642061646472657373000000000000000000000000000000000060448201526064016101ac565b6001600160a01b0386166000908152609c6020908152604080832088845290915290205460ff16156106ac5760405162461bcd60e51b815260206004820152601660248201527f4f7264657220616c72656164792065786563757465640000000000000000000060448201526064016101ac565b87518951146106fd5760405162461bcd60e51b815260206004820152600e60248201527f496e707574206d69736d6174636800000000000000000000000000000000000060448201526064016101ac565b6001600160a01b038481166000908152609a60205260409020548116908416146107695760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420746f6b656e2067617465776179000000000000000000000060448201526064016101ac565b6000468860405160200161077e929190612fc0565b60405160208183030381529060405280519060200120905061081a87878c8c85609760019054906101000a90046001600160a01b03166001600160a01b03166365ee35576040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108159190612fe6565b6117f2565b6001600160a01b038088166000908152609c602090815260408083208a8452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556108749086168484611bfe565b6040518181527fdb8766dc7a4cbe0b9d514534307d6ed0bc09c930e535e9c61badb099479e13b69060200160405180910390a1505050505050506108b86001606555565b505050565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa158015610910573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109349190612fff565b6001600160a01b0316336001600160a01b0316146109945760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016101ac565b609955565b6001600160a01b037f000000000000000000000000a8372d6ff00d48a25baa1af16d6a86c936708f4e163003610a375760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084016101ac565b7f000000000000000000000000a8372d6ff00d48a25baa1af16d6a86c936708f4e6001600160a01b0316610a927f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b031614610b0e5760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f7879000000000000000000000000000000000000000060648201526084016101ac565b610b1781611cae565b60408051600080825260208201909252610b3391839190611d85565b50565b610b4282333384611f25565b5050565b600054610100900460ff1615808015610b665750600054600160ff909116105b80610b805750303b158015610b80575060005460ff166001145b610bf25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016101ac565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610c5057600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b610c586121c3565b610cec8383609780546001600160a01b03938416610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff90911617905560988054919092167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790557fb9ae7ba14d826de669be54f7c79008181b430f21bd3ff90dac8cce1e60ae88a9609955565b80156108b857600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b6001600160a01b037f000000000000000000000000a8372d6ff00d48a25baa1af16d6a86c936708f4e163003610df15760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084016101ac565b7f000000000000000000000000a8372d6ff00d48a25baa1af16d6a86c936708f4e6001600160a01b0316610e4c7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b031614610ec85760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f7879000000000000000000000000000000000000000060648201526084016101ac565b610ed182611cae565b610b4282826001611d85565b6000306001600160a01b037f000000000000000000000000a8372d6ff00d48a25baa1af16d6a86c936708f4e1614610f7d5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016101ac565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ff5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110199190612fff565b6001600160a01b0316336001600160a01b0316146110795760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016101ac565b60005b82518110156108b85760008382815181106110995761109961301c565b60209081029190910101516040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529091506000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611107573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112b9190612fe6565b90508015611147576111476001600160a01b0383168583611bfe565b505080806111549061307a565b91505061107c565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d39190612fff565b6001600160a01b0316336001600160a01b0316146112335760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016101ac565b609780547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112db9190612fff565b6001600160a01b0316336001600160a01b03161461133b5760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016101ac565b609880547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6108b883338484611f25565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f89190612fff565b6001600160a01b0316336001600160a01b0316146114585760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016101ac565b6098546001600160a01b03166114b05760405162461bcd60e51b815260206004820152600f60248201527f496e76616c6964204c322070616972000000000000000000000000000000000060448201526064016101ac565b6001600160a01b038181166000908152609a602052604090205416156115185760405162461bcd60e51b815260206004820152600e60248201527f416c7265616479206d617070656400000000000000000000000000000000000060448201526064016101ac565b6060816001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa92505050801561157957506040513d6000823e601f3d908101601f1916820160405261157691908101906130b2565b60015b156115815790505b6060826001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa9250505080156115e257506040513d6000823e601f3d908101601f191682016040526115df91908101906130b2565b60015b156115ea5790505b6000836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561162a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164e9190613120565b6040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606087901b16602082015290915060009060340160408051601f1981840301815291905280516020909101206099546098549192506000916116be9184916001600160a01b031661224a565b6001600160a01b038781166000908152609a6020908152604080832080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169486169490941790935533808352609b8252918390205492519394507f1f6a77d013b627d23667409a96b7a68bff41621fe44b53ffc26b3b8da24fdb2f9361174f93918b918b918b918b910161316f565b60408051601f1981840301815290829052611769916131ca565b60405180910390a1336000908152609b6020526040812080549161178c8361307a565b9190505550505050505050565b6002606554036117eb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ac565b6002606555565b6000805b8551811015611b7e57600061187b8683815181106118165761181661301c565b6020026020010151611875876040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b90612274565b905086828151811061188f5761188f61301c565b60200260200101516001600160a01b0316816001600160a01b03161461191d5760405162461bcd60e51b815260206004820152602360248201527f56616c696461746f72207369676e617475726520646f6573206e6f74206d617460448201527f63682e000000000000000000000000000000000000000000000000000000000060648201526084016101ac565b6097546040517f2a2e5e420000000000000000000000000000000000000000000000000000000081526001600160a01b03838116600483015261010090920490911690632a2e5e4290602401602060405180830381865afa158015611986573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119aa91906131dd565b6119f65760405162461bcd60e51b815260206004820152601160248201527f496e76616c69642076616c696461746f7200000000000000000000000000000060448201526064016101ac565b6001600160a01b03808a166000908152609d602090815260408083208c845282528083209385168352929052205460ff1615611a745760405162461bcd60e51b815260206004820152601660248201527f4e6f206475706c69636174652076616c696461746f720000000000000000000060448201526064016101ac565b6001600160a01b038981166000908152609d602090815260408083208c8452825280832085851680855292529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560975491517f5dd9147c000000000000000000000000000000000000000000000000000000008152600481019190915261010090910490911690635dd9147c90602401602060405180830381865afa158015611b2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b519190612fe6565b611b5b90846131fa565b925083831115611b6b5750611b7e565b5080611b768161307a565b9150506117f6565b5081811015611bf55760405162461bcd60e51b815260206004820152603c60248201527f5375626d69747465642076616c696461746f7220736574207369676e6174757260448201527f657320646f206e6f74206861766520656e6f75676820706f7765722e0000000060648201526084016101ac565b50505050505050565b6040516001600160a01b0383166024820152604481018290526108b89084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261229a565b6001606555565b609760019054906101000a90046001600160a01b03166001600160a01b0316633c81df216040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d259190612fff565b6001600160a01b0316336001600160a01b031614610b335760405162461bcd60e51b815260206004820152601160248201527f4d756c746973696720726571756972656400000000000000000000000000000060448201526064016101ac565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611db8576108b88361237f565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611e12575060408051601f3d908101601f19168201909252611e0f91810190612fe6565b60015b611e845760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f74205555505300000000000000000000000000000000000060648201526084016101ac565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8114611f195760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c6555554944000000000000000000000000000000000000000000000060648201526084016101ac565b506108b8838383612455565b60975460ff1615611f785760405162461bcd60e51b815260206004820152600660248201527f506175736564000000000000000000000000000000000000000000000000000060448201526064016101ac565b6098546001600160a01b0316611fd05760405162461bcd60e51b815260206004820152600f60248201527f4e6f7420696d706c656d656e746564000000000000000000000000000000000060448201526064016101ac565b600081116120205760405162461bcd60e51b815260206004820152601160248201527f4e6f7420656e6f75676820616d6f756e7400000000000000000000000000000060448201526064016101ac565b6001600160a01b0382166120765760405162461bcd60e51b815260206004820152600f60248201527f496e76616c69642061646472657373000000000000000000000000000000000060448201526064016101ac565b6001600160a01b038481166000908152609a6020526040902054166120dd5760405162461bcd60e51b815260206004820152600d60248201527f4e6f7420737570706f727465640000000000000000000000000000000000000060448201526064016101ac565b6120f26001600160a01b038516843084612480565b6001600160a01b038381166000818152609b6020908152604080832054898616808552609a845293829020548251938401959095529082018190526060820192909252918316608083015291841660a082015260c081018390527f435881434a980001db54827793d55b4f3b751d216ed457d0f2a143220ae06d259060e00160408051601f198184030181529082905261218b916131ca565b60405180910390a16001600160a01b0384166000908152609b602052604081208054916121b78361307a565b91905055505050505050565b600054610100900460ff166122405760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016101ac565b6122486124d1565b565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6000806000612283858561254e565b9150915061229081612593565b5090505b92915050565b60006122ef826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166126f89092919063ffffffff16565b8051909150156108b8578080602001905181019061230d91906131dd565b6108b85760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016101ac565b6001600160a01b0381163b6123fc5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016101ac565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b61245e83612711565b60008251118061246b5750805b156108b85761247a8383612751565b50505050565b6040516001600160a01b038085166024830152831660448201526064810182905261247a9085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611c43565b600054610100900460ff16611ca75760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016101ac565b60008082516041036125845760208301516040840151606085015160001a6125788782858561285c565b9450945050505061258c565b506000905060025b9250929050565b60008160048111156125a7576125a761320d565b036125af5750565b60018160048111156125c3576125c361320d565b036126105760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016101ac565b60028160048111156126245761262461320d565b036126715760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016101ac565b60038160048111156126855761268561320d565b03610b335760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016101ac565b60606127078484600085612920565b90505b9392505050565b61271a8161237f565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6127d05760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e7472616374000000000000000000000000000000000000000000000000000060648201526084016101ac565b600080846001600160a01b0316846040516127eb919061323c565b600060405180830381855af49150503d8060008114612826576040519150601f19603f3d011682016040523d82523d6000602084013e61282b565b606091505b5091509150612853828260405180606001604052806027815260200161325960279139612a14565b95945050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156128935750600090506003612917565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156128e7573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661291057600060019250925050612917565b9150600090505b94509492505050565b6060824710156129985760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016101ac565b600080866001600160a01b031685876040516129b4919061323c565b60006040518083038185875af1925050503d80600081146129f1576040519150601f19603f3d011682016040523d82523d6000602084013e6129f6565b606091505b5091509150612a0787838387612a2d565b925050505b949350505050565b60608315612a2357508161270a565b61270a8383612aa2565b60608315612a9c578251600003612a95576001600160a01b0385163b612a955760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ac565b5081612a0c565b612a0c83835b815115612ab25781518083602001fd5b8060405162461bcd60e51b81526004016101ac91906131ca565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612b2457612b24612acc565b604052919050565b600067ffffffffffffffff821115612b4657612b46612acc565b5060051b60200190565b6001600160a01b0381168114610b3357600080fd5b600082601f830112612b7657600080fd5b81356020612b8b612b8683612b2c565b612afb565b82815260059290921b84018101918181019086841115612baa57600080fd5b8286015b84811015612bce578035612bc181612b50565b8352918301918301612bae565b509695505050505050565b600067ffffffffffffffff821115612bf357612bf3612acc565b50601f01601f191660200190565b600082601f830112612c1257600080fd5b8135612c20612b8682612bd9565b818152846020838601011115612c3557600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060608486031215612c6757600080fd5b833567ffffffffffffffff80821115612c7f57600080fd5b612c8b87838801612b65565b9450602091508186013581811115612ca257600080fd5b8601601f81018813612cb357600080fd5b8035612cc1612b8682612b2c565b81815260059190911b8201840190848101908a831115612ce057600080fd5b8584015b83811015612d1857803586811115612cfc5760008081fd5b612d0a8d8983890101612c01565b845250918601918601612ce4565b5096505050506040860135915080821115612d3257600080fd5b50612d3f86828701612c01565b9150509250925092565b600060208284031215612d5b57600080fd5b5035919050565b600060208284031215612d7457600080fd5b813561270a81612b50565b600080600060608486031215612d9457600080fd5b8335612d9f81612b50565b9250602084013591506040840135612db681612b50565b809150509250925092565b60008060408385031215612dd457600080fd5b8235612ddf81612b50565b946020939093013593505050565b60008060408385031215612e0057600080fd5b8235612e0b81612b50565b91506020830135612e1b81612b50565b809150509250929050565b60008060408385031215612e3957600080fd5b8235612e4481612b50565b9150602083013567ffffffffffffffff811115612e6057600080fd5b612e6c85828601612c01565b9150509250929050565b60008060408385031215612e8957600080fd5b823567ffffffffffffffff811115612ea057600080fd5b612eac85828601612b65565b9250506020830135612e1b81612b50565b8015158114610b3357600080fd5b600060208284031215612edd57600080fd5b813561270a81612ebd565b600080600060608486031215612efd57600080fd5b8335612f0881612b50565b92506020840135612f1881612b50565b929592945050506040919091013590565b60008060008060008060c08789031215612f4257600080fd5b8651612f4d81612b50565b602088015160408901519197509550612f6581612b50565b6060880151909450612f7681612b50565b6080880151909350612f8781612b50565b8092505060a087015190509295509295509295565b60005b83811015612fb7578181015183820152602001612f9f565b50506000910152565b82815260008251612fd8816020850160208701612f9c565b919091016020019392505050565b600060208284031215612ff857600080fd5b5051919050565b60006020828403121561301157600080fd5b815161270a81612b50565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036130ab576130ab61304b565b5060010190565b6000602082840312156130c457600080fd5b815167ffffffffffffffff8111156130db57600080fd5b8201601f810184136130ec57600080fd5b80516130fa612b8682612bd9565b81815285602083850101111561310f57600080fd5b612853826020830160208601612f9c565b60006020828403121561313257600080fd5b815160ff8116811461270a57600080fd5b6000815180845261315b816020860160208601612f9c565b601f01601f19169290920160200192915050565b60006001600160a01b03808916835287602084015280871660408401525060c060608301526131a160c0830186613143565b82810360808401526131b38186613143565b91505060ff831660a0830152979650505050505050565b60208152600061270a6020830184613143565b6000602082840312156131ef57600080fd5b815161270a81612ebd565b808201808211156122945761229461304b565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000825161324e818460208701612f9c565b919091019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220464d6de02d41cabbbef75ebdd45197404d8512c5cce87d52e2a7b7f8237f42c364736f6c63430008130033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.