Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
NFTBridgeImplementation
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// contracts/Implementation.sol // SPDX-License-Identifier: Apache 2 pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol"; import "./NFTBridge.sol"; contract NFTBridgeImplementation is NFTBridge { // Beacon getter for the token contracts function implementation() public view returns (address) { return tokenImplementation(); } function initialize() initializer public virtual { // this function needs to be exposed for an upgrade to pass uint256 evmChainId; uint16 chain = chainId(); // Wormhole chain ids explicitly enumerated if (chain == 2) { evmChainId = 1; // ethereum } else if (chain == 4) { evmChainId = 56; // bsc } else if (chain == 5) { evmChainId = 137; // polygon } else if (chain == 6) { evmChainId = 43114; // avalanche } else if (chain == 7) { evmChainId = 42262; // oasis } else if (chain == 9) { evmChainId = 1313161554; // aurora } else if (chain == 10) { evmChainId = 250; // fantom } else if (chain == 11) { evmChainId = 686; // karura } else if (chain == 12) { evmChainId = 787; // acala } else if (chain == 13) { evmChainId = 8217; // klaytn } else if (chain == 14) { evmChainId = 42220; // celo } else if (chain == 16) { evmChainId = 1284; // moonbeam } else if (chain == 17) { evmChainId = 245022934; // neon } else if (chain == 23) { evmChainId = 42161; // arbitrum } else if (chain == 24) { evmChainId = 10; // optimism } else if (chain == 25) { evmChainId = 100; // gnosis } else { revert("Unknown chain id."); } setEvmChainId(evmChainId); } modifier initializer() { address impl = ERC1967Upgrade._getImplementation(); require( !isInitialized(impl), "already initialized" ); setInitialized(impl); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "../beacon/IBeacon.sol"; import "../../utils/Address.sol"; import "../../utils/StorageSlot.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 ERC1967Upgrade { // 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 StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot.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) { Address.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallSecure( address newImplementation, bytes memory data, bool forceCall ) internal { address oldImplementation = _getImplementation(); // Initial upgrade and setup call _setImplementation(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } // Perform rollback test if not already in progress StorageSlot.BooleanSlot storage rollbackTesting = StorageSlot.getBooleanSlot(_ROLLBACK_SLOT); if (!rollbackTesting.value) { // Trigger rollback using upgradeTo from the new implementation rollbackTesting.value = true; Address.functionDelegateCall( newImplementation, abi.encodeWithSignature("upgradeTo(address)", oldImplementation) ); rollbackTesting.value = false; // Check rollback was effective require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades"); // Finally reset to the new implementation and log the upgrade _upgradeTo(newImplementation); } } /** * @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 StorageSlot.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"); StorageSlot.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 StorageSlot.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( Address.isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlot.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) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive() external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overriden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IBeacon.sol"; import "../Proxy.sol"; import "../ERC1967/ERC1967Upgrade.sol"; /** * @dev This contract implements a proxy that gets the implementation address for each call from a {UpgradeableBeacon}. * * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't * conflict with the storage layout of the implementation behind the proxy. * * _Available since v3.4._ */ contract BeaconProxy is Proxy, ERC1967Upgrade { /** * @dev Initializes the proxy with `beacon`. * * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This * will typically be an encoded function call, and allows initializating the storage of the proxy like a Solidity * constructor. * * Requirements: * * - `beacon` must be a contract with the interface {IBeacon}. */ constructor(address beacon, bytes memory data) payable { assert(_BEACON_SLOT == bytes32(uint256(keccak256("eip1967.proxy.beacon")) - 1)); _upgradeBeaconToAndCall(beacon, data, false); } /** * @dev Returns the current beacon address. */ function _beacon() internal view virtual returns (address) { return _getBeacon(); } /** * @dev Returns the current implementation address of the associated beacon. */ function _implementation() internal view virtual override returns (address) { return IBeacon(_getBeacon()).implementation(); } /** * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}. * * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. * * Requirements: * * - `beacon` must be a contract. * - The implementation returned by `beacon` must be a contract. */ function _setBeacon(address beacon, bytes memory data) internal virtual { _upgradeBeaconToAndCall(beacon, data, false); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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 `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount ) external returns (bool); /** * @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); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.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)); } } /** * @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 pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 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 functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(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) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT 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 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 StorageSlot { 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) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @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] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// contracts/Structs.sol // SPDX-License-Identifier: Apache 2 pragma solidity ^0.8.0; interface Structs { struct Provider { uint16 chainId; uint16 governanceChainId; bytes32 governanceContract; } struct GuardianSet { address[] keys; uint32 expirationTime; } struct Signature { bytes32 r; bytes32 s; uint8 v; uint8 guardianIndex; } struct VM { uint8 version; uint32 timestamp; uint32 nonce; uint16 emitterChainId; bytes32 emitterAddress; uint64 sequence; uint8 consistencyLevel; bytes payload; uint32 guardianSetIndex; Signature[] signatures; bytes32 hash; } }
// contracts/Messages.sol // SPDX-License-Identifier: Apache 2 pragma solidity ^0.8.0; import "../Structs.sol"; interface IWormhole is Structs { event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel); function publishMessage( uint32 nonce, bytes memory payload, uint8 consistencyLevel ) external payable returns (uint64 sequence); function parseAndVerifyVM(bytes calldata encodedVM) external view returns (Structs.VM memory vm, bool valid, string memory reason); function verifyVM(Structs.VM memory vm) external view returns (bool valid, string memory reason); function verifySignatures(bytes32 hash, Structs.Signature[] memory signatures, Structs.GuardianSet memory guardianSet) external pure returns (bool valid, string memory reason) ; function parseVM(bytes memory encodedVM) external pure returns (Structs.VM memory vm); function getGuardianSet(uint32 index) external view returns (Structs.GuardianSet memory) ; function getCurrentGuardianSetIndex() external view returns (uint32) ; function getGuardianSetExpiry() external view returns (uint32) ; function governanceActionIsConsumed(bytes32 hash) external view returns (bool) ; function isInitialized(address impl) external view returns (bool) ; function chainId() external view returns (uint16) ; function governanceChainId() external view returns (uint16); function governanceContract() external view returns (bytes32); function messageFee() external view returns (uint256) ; }
// SPDX-License-Identifier: Unlicense /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ pragma solidity >=0.8.0 <0.9.0; library BytesLib { function concat( bytes memory _preBytes, bytes memory _postBytes ) internal pure returns (bytes memory) { bytes memory tempBytes; assembly { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // Store the length of the first bytes array at the beginning of // the memory for tempBytes. let length := mload(_preBytes) mstore(tempBytes, length) // Maintain a memory counter for the current write location in the // temp bytes array by adding the 32 bytes for the array length to // the starting location. let mc := add(tempBytes, 0x20) // Stop copying when the memory counter reaches the length of the // first bytes array. let end := add(mc, length) for { // Initialize a copy counter to the start of the _preBytes data, // 32 bytes into its memory. let cc := add(_preBytes, 0x20) } lt(mc, end) { // Increase both counters by 32 bytes each iteration. mc := add(mc, 0x20) cc := add(cc, 0x20) } { // Write the _preBytes data into the tempBytes memory 32 bytes // at a time. mstore(mc, mload(cc)) } // Add the length of _postBytes to the current length of tempBytes // and store it as the new length in the first 32 bytes of the // tempBytes memory. length := mload(_postBytes) mstore(tempBytes, add(length, mload(tempBytes))) // Move the memory counter back from a multiple of 0x20 to the // actual end of the _preBytes data. mc := end // Stop copying when the memory counter reaches the new combined // length of the arrays. end := add(mc, length) for { let cc := add(_postBytes, 0x20) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } // Update the free-memory pointer by padding our last write location // to 32 bytes: add 31 bytes to the end of tempBytes to move to the // next 32 byte block, then round down to the nearest multiple of // 32. If the sum of the length of the two arrays is zero then add // one before rounding down to leave a blank 32 bytes (the length block with 0). mstore(0x40, and( add(add(end, iszero(add(length, mload(_preBytes)))), 31), not(31) // Round down to the nearest 32 bytes. )) } return tempBytes; } function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal { assembly { // Read the first 32 bytes of _preBytes storage, which is the length // of the array. (We don't need to use the offset into the slot // because arrays use the entire slot.) let fslot := sload(_preBytes.slot) // Arrays of 31 bytes or less have an even value in their slot, // while longer arrays have an odd value. The actual length is // the slot divided by two for odd values, and the lowest order // byte divided by two for even values. // If the slot is even, bitwise and the slot with 255 and divide by // two to get the length. If the slot is odd, bitwise and the slot // with -1 and divide by two. let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) let newlength := add(slength, mlength) // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage switch add(lt(slength, 32), lt(newlength, 32)) case 2 { // Since the new array still fits in the slot, we just need to // update the contents of the slot. // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length sstore( _preBytes.slot, // all the modifications to the slot are inside this // next block add( // we can just add to the slot contents because the // bytes we want to change are the LSBs fslot, add( mul( div( // load the bytes from memory mload(add(_postBytes, 0x20)), // zero all bytes to the right exp(0x100, sub(32, mlength)) ), // and now shift left the number of bytes to // leave space for the length in the slot exp(0x100, sub(32, newlength)) ), // increase length by the double of the memory // bytes length mul(mlength, 2) ) ) ) } case 1 { // The stored value fits in the slot, but the combined value // will exceed it. // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // The contents of the _postBytes array start 32 bytes into // the structure. Our first read should obtain the `submod` // bytes that can fit into the unused space in the last word // of the stored array. To get this, we read 32 bytes starting // from `submod`, so the data we read overlaps with the array // contents by `submod` bytes. Masking the lowest-order // `submod` bytes allows us to add that value directly to the // stored value. let submod := sub(32, slength) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore( sc, add( and( fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00 ), and(mload(mc), mask) ) ) for { mc := add(mc, 0x20) sc := add(sc, 1) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } default { // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) // Start copying to the last used word of the stored array. let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // Copy over the first `submod` bytes of the new data as in // case 1 above. let slengthmod := mod(slength, 32) let mlengthmod := mod(mlength, 32) let submod := sub(32, slengthmod) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore(sc, add(sload(sc), and(mload(mc), mask))) for { sc := add(sc, 1) mc := add(mc, 0x20) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } } } function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory) { require(_length + 31 >= _length, "slice_overflow"); require(_bytes.length >= _start + _length, "slice_outOfBounds"); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { require(_bytes.length >= _start + 20, "toAddress_outOfBounds"); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) { require(_bytes.length >= _start + 1 , "toUint8_outOfBounds"); uint8 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x1), _start)) } return tempUint; } function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) { require(_bytes.length >= _start + 2, "toUint16_outOfBounds"); uint16 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x2), _start)) } return tempUint; } function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) { require(_bytes.length >= _start + 4, "toUint32_outOfBounds"); uint32 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x4), _start)) } return tempUint; } function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) { require(_bytes.length >= _start + 8, "toUint64_outOfBounds"); uint64 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x8), _start)) } return tempUint; } function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) { require(_bytes.length >= _start + 12, "toUint96_outOfBounds"); uint96 tempUint; assembly { tempUint := mload(add(add(_bytes, 0xc), _start)) } return tempUint; } function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) { require(_bytes.length >= _start + 16, "toUint128_outOfBounds"); uint128 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x10), _start)) } return tempUint; } function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) { require(_bytes.length >= _start + 32, "toUint256_outOfBounds"); uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) { require(_bytes.length >= _start + 32, "toBytes32_outOfBounds"); bytes32 tempBytes32; assembly { tempBytes32 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes32; } function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) { bool success = true; assembly { let length := mload(_preBytes) // if lengths don't match the arrays are not equal switch eq(length, mload(_postBytes)) case 1 { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 let mc := add(_preBytes, 0x20) let end := add(mc, length) for { let cc := add(_postBytes, 0x20) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) } eq(add(lt(mc, end), cb), 2) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { // if any of these checks fails then arrays are not equal if iszero(eq(mload(mc), mload(cc))) { // unsuccess: success := 0 cb := 0 } } } default { // unsuccess: success := 0 } } return success; } function equalStorage( bytes storage _preBytes, bytes memory _postBytes ) internal view returns (bool) { bool success = true; assembly { // we know _preBytes_offset is 0 let fslot := sload(_preBytes.slot) // Decode the length of the stored array like in concatStorage(). let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) // if lengths don't match the arrays are not equal switch eq(slength, mlength) case 1 { // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage if iszero(iszero(slength)) { switch lt(slength, 32) case 1 { // blank the last byte which is the length fslot := mul(div(fslot, 0x100), 0x100) if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) { // unsuccess: success := 0 } } default { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := keccak256(0x0, 0x20) let mc := add(_postBytes, 0x20) let end := add(mc, mlength) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) for {} eq(add(lt(mc, end), cb), 2) { sc := add(sc, 1) mc := add(mc, 0x20) } { if iszero(eq(sload(sc), mload(mc))) { // unsuccess: success := 0 cb := 0 } } } } } default { // unsuccess: success := 0 } } return success; } }
// contracts/Bridge.sol // SPDX-License-Identifier: Apache 2 pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "../libraries/external/BytesLib.sol"; import "./NFTBridgeGetters.sol"; import "./NFTBridgeSetters.sol"; import "./NFTBridgeStructs.sol"; import "./NFTBridgeGovernance.sol"; import "./token/NFT.sol"; import "./token/NFTImplementation.sol"; contract NFTBridge is NFTBridgeGovernance { using BytesLib for bytes; // Initiate a Transfer function transferNFT(address token, uint256 tokenID, uint16 recipientChain, bytes32 recipient, uint32 nonce) public payable returns (uint64 sequence) { // determine token parameters uint16 tokenChain; bytes32 tokenAddress; if (isWrappedAsset(token)) { tokenChain = NFTImplementation(token).chainId(); tokenAddress = NFTImplementation(token).nativeContract(); } else { tokenChain = chainId(); tokenAddress = bytes32(uint256(uint160(token))); // Verify that the correct interfaces are implemented require(ERC165(token).supportsInterface(type(IERC721).interfaceId), "must support the ERC721 interface"); require(ERC165(token).supportsInterface(type(IERC721Metadata).interfaceId), "must support the ERC721-Metadata extension"); } string memory symbolString; string memory nameString; string memory uriString; { if (tokenChain != 1) { // SPL tokens use cache (,bytes memory queriedSymbol) = token.staticcall(abi.encodeWithSignature("symbol()")); (,bytes memory queriedName) = token.staticcall(abi.encodeWithSignature("name()")); symbolString = abi.decode(queriedSymbol, (string)); nameString = abi.decode(queriedName, (string)); } (,bytes memory queriedURI) = token.staticcall(abi.encodeWithSignature("tokenURI(uint256)", tokenID)); uriString = abi.decode(queriedURI, (string)); } bytes32 symbol; bytes32 name; if (tokenChain == 1) { // use cached SPL token info, as the contracts uses unified values NFTBridgeStorage.SPLCache memory cache = splCache(tokenID); symbol = cache.symbol; name = cache.name; clearSplCache(tokenID); } else { assembly { // first 32 bytes hold string length // mload then loads the next word, i.e. the first 32 bytes of the strings // NOTE: this means that we might end up with an // invalid utf8 string (e.g. if we slice an emoji in half). The VAA // payload specification doesn't require that these are valid utf8 // strings, and it's cheaper to do any validation off-chain for // presentation purposes symbol := mload(add(symbolString, 32)) name := mload(add(nameString, 32)) } } IERC721(token).safeTransferFrom(msg.sender, address(this), tokenID); if (tokenChain != chainId()) { NFTImplementation(token).burn(tokenID); } sequence = logTransfer(NFTBridgeStructs.Transfer({ tokenAddress : tokenAddress, tokenChain : tokenChain, name : name, symbol : symbol, tokenID : tokenID, uri : uriString, to : recipient, toChain : recipientChain }), msg.value, nonce); } function logTransfer(NFTBridgeStructs.Transfer memory transfer, uint256 callValue, uint32 nonce) internal returns (uint64 sequence) { bytes memory encoded = encodeTransfer(transfer); sequence = wormhole().publishMessage{ value : callValue }(nonce, encoded, finality()); } function completeTransfer(bytes memory encodedVm) public { _completeTransfer(encodedVm); } // Execute a Transfer message function _completeTransfer(bytes memory encodedVm) internal { (IWormhole.VM memory vm, bool valid, string memory reason) = wormhole().parseAndVerifyVM(encodedVm); require(valid, reason); require(verifyBridgeVM(vm), "invalid emitter"); NFTBridgeStructs.Transfer memory transfer = parseTransfer(vm.payload); require(!isTransferCompleted(vm.hash), "transfer already completed"); setTransferCompleted(vm.hash); require(transfer.toChain == chainId(), "invalid target chain"); IERC721 transferToken; if (transfer.tokenChain == chainId()) { transferToken = IERC721(address(uint160(uint256(transfer.tokenAddress)))); } else { address wrapped = wrappedAsset(transfer.tokenChain, transfer.tokenAddress); // If the wrapped asset does not exist yet, create it if (wrapped == address(0)) { wrapped = _createWrapped(transfer.tokenChain, transfer.tokenAddress, transfer.name, transfer.symbol); } transferToken = IERC721(wrapped); } // transfer bridged NFT to recipient address transferRecipient = address(uint160(uint256(transfer.to))); if (transfer.tokenChain != chainId()) { if (transfer.tokenChain == 1) { // Cache SPL token info which otherwise would get lost setSplCache(transfer.tokenID, NFTBridgeStorage.SPLCache({ name : transfer.name, symbol : transfer.symbol })); } // mint wrapped asset NFTImplementation(address(transferToken)).mint(transferRecipient, transfer.tokenID, transfer.uri); } else { transferToken.safeTransferFrom(address(this), transferRecipient, transfer.tokenID); } } // Creates a wrapped asset using AssetMeta function _createWrapped(uint16 tokenChain, bytes32 tokenAddress, bytes32 name, bytes32 symbol) internal returns (address token) { require(tokenChain != chainId(), "can only wrap tokens from foreign chains"); require(wrappedAsset(tokenChain, tokenAddress) == address(0), "wrapped asset already exists"); // SPL NFTs all use the same NFT contract, so unify the name if (tokenChain == 1) { // "Wormhole Bridged Solana-NFT" - right-padded name = 0x576f726d686f6c65204272696467656420536f6c616e612d4e46540000000000; // "WORMSPLNFT" - right-padded symbol = 0x574f524d53504c4e465400000000000000000000000000000000000000000000; } // initialize the NFTImplementation bytes memory initialisationArgs = abi.encodeWithSelector( NFTImplementation.initialize.selector, bytes32ToString(name), bytes32ToString(symbol), address(this), tokenChain, tokenAddress ); // initialize the BeaconProxy bytes memory constructorArgs = abi.encode(address(this), initialisationArgs); // deployment code bytes memory bytecode = abi.encodePacked(type(BridgeNFT).creationCode, constructorArgs); bytes32 salt = keccak256(abi.encodePacked(tokenChain, tokenAddress)); assembly { token := create2(0, add(bytecode, 0x20), mload(bytecode), salt) if iszero(extcodesize(token)) { revert(0, 0) } } setWrappedAsset(tokenChain, tokenAddress, token); } function verifyBridgeVM(IWormhole.VM memory vm) internal view returns (bool){ require(!isFork(), "invalid fork"); if (bridgeContracts(vm.emitterChainId) == vm.emitterAddress) { return true; } return false; } function encodeTransfer(NFTBridgeStructs.Transfer memory transfer) public pure returns (bytes memory encoded) { // There is a global limit on 200 bytes of tokenURI in Wormhole due to Solana require(bytes(transfer.uri).length <= 200, "tokenURI must not exceed 200 bytes"); encoded = abi.encodePacked( uint8(1), transfer.tokenAddress, transfer.tokenChain, transfer.symbol, transfer.name, transfer.tokenID, uint8(bytes(transfer.uri).length), transfer.uri, transfer.to, transfer.toChain ); } function parseTransfer(bytes memory encoded) public pure returns (NFTBridgeStructs.Transfer memory transfer) { uint index = 0; uint8 payloadID = encoded.toUint8(index); index += 1; require(payloadID == 1, "invalid Transfer"); transfer.tokenAddress = encoded.toBytes32(index); index += 32; transfer.tokenChain = encoded.toUint16(index); index += 2; transfer.symbol = encoded.toBytes32(index); index += 32; transfer.name = encoded.toBytes32(index); index += 32; transfer.tokenID = encoded.toUint256(index); index += 32; // Ignore length due to malformatted payload index += 1; transfer.uri = string(encoded.slice(index, encoded.length - index - 34)); // From here we read backwards due malformatted package index = encoded.length; index -= 2; transfer.toChain = encoded.toUint16(index); index -= 32; transfer.to = encoded.toBytes32(index); //require(encoded.length == index, "invalid Transfer"); } function onERC721Received( address operator, address, uint256, bytes calldata ) external view returns (bytes4){ require(operator == address(this), "can only bridge tokens via transferNFT method"); return type(IERC721Receiver).interfaceId; } function bytes32ToString(bytes32 input) internal pure returns (string memory) { uint256 i; while (i < 32 && input[i] != 0) { i++; } bytes memory array = new bytes(i); for (uint c = 0; c < i; c++) { array[c] = input[c]; } return string(array); } }
// contracts/Getters.sol // SPDX-License-Identifier: Apache 2 pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../interfaces/IWormhole.sol"; import "./NFTBridgeState.sol"; contract NFTBridgeGetters is NFTBridgeState { function governanceActionIsConsumed(bytes32 hash) public view returns (bool) { return _state.consumedGovernanceActions[hash]; } function isInitialized(address impl) public view returns (bool) { return _state.initializedImplementations[impl]; } function isTransferCompleted(bytes32 hash) public view returns (bool) { return _state.completedTransfers[hash]; } function wormhole() public view returns (IWormhole) { return IWormhole(_state.wormhole); } function chainId() public view returns (uint16){ return _state.provider.chainId; } function evmChainId() public view returns (uint256) { return _state.evmChainId; } function isFork() public view returns (bool) { return evmChainId() != block.chainid; } function governanceChainId() public view returns (uint16){ return _state.provider.governanceChainId; } function governanceContract() public view returns (bytes32){ return _state.provider.governanceContract; } function wrappedAsset(uint16 tokenChainId, bytes32 tokenAddress) public view returns (address){ return _state.wrappedAssets[tokenChainId][tokenAddress]; } function bridgeContracts(uint16 chainId_) public view returns (bytes32){ return _state.bridgeImplementations[chainId_]; } function tokenImplementation() public view returns (address){ return _state.tokenImplementation; } function isWrappedAsset(address token) public view returns (bool){ return _state.isWrappedAsset[token]; } function splCache(uint256 tokenId) public view returns (NFTBridgeStorage.SPLCache memory) { return _state.splCache[tokenId]; } function finality() public view returns (uint8) { return _state.provider.finality; } }
// contracts/Bridge.sol // SPDX-License-Identifier: Apache 2 pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol"; import "../libraries/external/BytesLib.sol"; import "./NFTBridgeGetters.sol"; import "./NFTBridgeSetters.sol"; import "./NFTBridgeStructs.sol"; import "./token/NFT.sol"; import "./token/NFTImplementation.sol"; import "../interfaces/IWormhole.sol"; contract NFTBridgeGovernance is NFTBridgeGetters, NFTBridgeSetters, ERC1967Upgrade { using BytesLib for bytes; // "NFTBridge" (left padded) bytes32 constant module = 0x00000000000000000000000000000000000000000000004e4654427269646765; // Execute a RegisterChain governance message function registerChain(bytes memory encodedVM) public { (IWormhole.VM memory vm, bool valid, string memory reason) = verifyGovernanceVM(encodedVM); require(valid, reason); setGovernanceActionConsumed(vm.hash); NFTBridgeStructs.RegisterChain memory chain = parseRegisterChain(vm.payload); require((chain.chainId == chainId() && !isFork()) || chain.chainId == 0, "invalid chain id"); setBridgeImplementation(chain.emitterChainID, chain.emitterAddress); } // Execute a UpgradeContract governance message function upgrade(bytes memory encodedVM) public { require(!isFork(), "invalid fork"); (IWormhole.VM memory vm, bool valid, string memory reason) = verifyGovernanceVM(encodedVM); require(valid, reason); setGovernanceActionConsumed(vm.hash); NFTBridgeStructs.UpgradeContract memory implementation = parseUpgrade(vm.payload); require(implementation.chainId == chainId(), "wrong chain id"); upgradeImplementation(address(uint160(uint256(implementation.newContract)))); } /** * @dev Updates the `chainId` and `evmChainId` on a forked chain via Governance VAA/VM */ function submitRecoverChainId(bytes memory encodedVM) public { require(isFork(), "not a fork"); (IWormhole.VM memory vm, bool valid, string memory reason) = verifyGovernanceVM(encodedVM); require(valid, reason); setGovernanceActionConsumed(vm.hash); NFTBridgeStructs.RecoverChainId memory rci = parseRecoverChainId(vm.payload); // Verify the VAA is for this chain require(rci.evmChainId == block.chainid, "invalid EVM Chain"); // Update the chainIds setEvmChainId(rci.evmChainId); setChainId(rci.newChainId); } function verifyGovernanceVM(bytes memory encodedVM) internal view returns (IWormhole.VM memory parsedVM, bool isValid, string memory invalidReason){ (IWormhole.VM memory vm, bool valid, string memory reason) = wormhole().parseAndVerifyVM(encodedVM); if(!valid){ return (vm, valid, reason); } if (vm.emitterChainId != governanceChainId()) { return (vm, false, "wrong governance chain"); } if (vm.emitterAddress != governanceContract()) { return (vm, false, "wrong governance contract"); } if(governanceActionIsConsumed(vm.hash)){ return (vm, false, "governance action already consumed"); } return (vm, true, ""); } event ContractUpgraded(address indexed oldContract, address indexed newContract); function upgradeImplementation(address newImplementation) internal { address currentImplementation = _getImplementation(); _upgradeTo(newImplementation); // Call initialize function of the new implementation (bool success, bytes memory reason) = newImplementation.delegatecall(abi.encodeWithSignature("initialize()")); require(success, string(reason)); emit ContractUpgraded(currentImplementation, newImplementation); } function parseRegisterChain(bytes memory encoded) public pure returns(NFTBridgeStructs.RegisterChain memory chain) { uint index = 0; // governance header chain.module = encoded.toBytes32(index); index += 32; require(chain.module == module, "invalid RegisterChain: wrong module"); chain.action = encoded.toUint8(index); index += 1; require(chain.action == 1, "invalid RegisterChain: wrong action"); chain.chainId = encoded.toUint16(index); index += 2; // payload chain.emitterChainID = encoded.toUint16(index); index += 2; chain.emitterAddress = encoded.toBytes32(index); index += 32; require(encoded.length == index, "invalid RegisterChain: wrong length"); } function parseUpgrade(bytes memory encoded) public pure returns(NFTBridgeStructs.UpgradeContract memory chain) { uint index = 0; // governance header chain.module = encoded.toBytes32(index); index += 32; require(chain.module == module, "invalid UpgradeContract: wrong module"); chain.action = encoded.toUint8(index); index += 1; require(chain.action == 2, "invalid UpgradeContract: wrong action"); chain.chainId = encoded.toUint16(index); index += 2; // payload chain.newContract = encoded.toBytes32(index); index += 32; require(encoded.length == index, "invalid UpgradeContract: wrong length"); } /// @dev Parse a recoverChainId (action 3) with minimal validation function parseRecoverChainId(bytes memory encodedRecoverChainId) public pure returns (NFTBridgeStructs.RecoverChainId memory rci) { uint index = 0; rci.module = encodedRecoverChainId.toBytes32(index); index += 32; require(rci.module == module, "invalid RecoverChainId: wrong module"); rci.action = encodedRecoverChainId.toUint8(index); index += 1; require(rci.action == 3, "invalid RecoverChainId: wrong action"); rci.evmChainId = encodedRecoverChainId.toUint256(index); index += 32; rci.newChainId = encodedRecoverChainId.toUint16(index); index += 2; require(encodedRecoverChainId.length == index, "invalid RecoverChainId"); } }
// contracts/Setters.sol // SPDX-License-Identifier: Apache 2 pragma solidity ^0.8.0; import "./NFTBridgeState.sol"; contract NFTBridgeSetters is NFTBridgeState { function setInitialized(address implementatiom) internal { _state.initializedImplementations[implementatiom] = true; } function setGovernanceActionConsumed(bytes32 hash) internal { _state.consumedGovernanceActions[hash] = true; } function setTransferCompleted(bytes32 hash) internal { _state.completedTransfers[hash] = true; } function setChainId(uint16 chainId) internal { _state.provider.chainId = chainId; } function setGovernanceChainId(uint16 chainId) internal { _state.provider.governanceChainId = chainId; } function setGovernanceContract(bytes32 governanceContract) internal { _state.provider.governanceContract = governanceContract; } function setBridgeImplementation(uint16 chainId, bytes32 bridgeContract) internal { _state.bridgeImplementations[chainId] = bridgeContract; } function setTokenImplementation(address impl) internal { _state.tokenImplementation = impl; } function setWormhole(address wh) internal { _state.wormhole = payable(wh); } function setWrappedAsset(uint16 tokenChainId, bytes32 tokenAddress, address wrapper) internal { _state.wrappedAssets[tokenChainId][tokenAddress] = wrapper; _state.isWrappedAsset[wrapper] = true; } function setSplCache(uint256 tokenId, NFTBridgeStorage.SPLCache memory cache) internal { _state.splCache[tokenId] = cache; } function clearSplCache(uint256 tokenId) internal { delete _state.splCache[tokenId]; } function setFinality(uint8 finality) internal { _state.provider.finality = finality; } function setEvmChainId(uint256 evmChainId) internal { require(evmChainId == block.chainid, "invalid evmChainId"); _state.evmChainId = evmChainId; } }
// contracts/State.sol // SPDX-License-Identifier: Apache 2 pragma solidity ^0.8.0; import "./NFTBridgeStructs.sol"; contract NFTBridgeStorage { struct Provider { uint16 chainId; uint16 governanceChainId; // Required number of block confirmations to assume finality uint8 finality; bytes32 governanceContract; } struct Asset { uint16 chainId; bytes32 assetAddress; } struct SPLCache { bytes32 name; bytes32 symbol; } struct State { address payable wormhole; address tokenImplementation; Provider provider; // Mapping of consumed governance actions mapping(bytes32 => bool) consumedGovernanceActions; // Mapping of consumed token transfers mapping(bytes32 => bool) completedTransfers; // Mapping of initialized implementations mapping(address => bool) initializedImplementations; // Mapping of wrapped assets (chainID => nativeAddress => wrappedAddress) mapping(uint16 => mapping(bytes32 => address)) wrappedAssets; // Mapping to safely identify wrapped assets mapping(address => bool) isWrappedAsset; // Mapping of bridge contracts on other chains mapping(uint16 => bytes32) bridgeImplementations; // Mapping of spl token info caches (chainID => nativeAddress => SPLCache) mapping(uint256 => SPLCache) splCache; // EIP-155 Chain ID uint256 evmChainId; } } contract NFTBridgeState { NFTBridgeStorage.State _state; }
// contracts/Structs.sol // SPDX-License-Identifier: Apache 2 pragma solidity ^0.8.0; contract NFTBridgeStructs { struct Transfer { // PayloadID uint8 = 1 // Address of the token. Left-zero-padded if shorter than 32 bytes bytes32 tokenAddress; // Chain ID of the token uint16 tokenChain; // Symbol of the token bytes32 symbol; // Name of the token bytes32 name; // TokenID of the token uint256 tokenID; // URI of the token metadata (UTF-8) string uri; // Address of the recipient. Left-zero-padded if shorter than 32 bytes bytes32 to; // Chain ID of the recipient uint16 toChain; } struct RegisterChain { // Governance Header // module: "NFTBridge" left-padded bytes32 module; // governance action: 1 uint8 action; // governance paket chain id: this or 0 uint16 chainId; // Chain ID uint16 emitterChainID; // Emitter address. Left-zero-padded if shorter than 32 bytes bytes32 emitterAddress; } struct UpgradeContract { // Governance Header // module: "NFTBridge" left-padded bytes32 module; // governance action: 2 uint8 action; // governance paket chain id uint16 chainId; // Address of the new contract bytes32 newContract; } struct RecoverChainId { // Governance Header // module: "NFTBridge" left-padded bytes32 module; // governance action: 3 uint8 action; // EIP-155 Chain ID uint256 evmChainId; // Chain ID uint16 newChainId; } }
// contracts/Structs.sol // SPDX-License-Identifier: Apache 2 pragma solidity ^0.8.0; import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol"; contract BridgeNFT is BeaconProxy { constructor(address beacon, bytes memory data) BeaconProxy(beacon, data) { } }
// contracts/TokenImplementation.sol // SPDX-License-Identifier: Apache 2 pragma solidity ^0.8.0; import "./NFTState.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol"; // Based on the OpenZepplin ERC721 implementation, licensed under MIT contract NFTImplementation is NFTState, Context, IERC721, IERC721Metadata, ERC165 { using Address for address; using Strings for uint256; function initialize( string memory name_, string memory symbol_, address owner_, uint16 chainId_, bytes32 nativeContract_ ) initializer public { _state.name = name_; _state.symbol = symbol_; _state.owner = owner_; _state.chainId = chainId_; _state.nativeContract = nativeContract_; } function supportsInterface(bytes4 interfaceId) public view override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } function balanceOf(address owner_) public view override returns (uint256) { require(owner_ != address(0), "ERC721: balance query for the zero address"); return _state.balances[owner_]; } function ownerOf(uint256 tokenId) public view override returns (address) { address owner_ = _state.owners[tokenId]; require(owner_ != address(0), "ERC721: owner query for nonexistent token"); return owner_; } function name() public view override returns (string memory) { return _state.name; } function symbol() public view override returns (string memory) { return _state.symbol; } function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); return _state.tokenURIs[tokenId]; } function chainId() public view returns (uint16) { return _state.chainId; } function nativeContract() public view returns (bytes32) { return _state.nativeContract; } function owner() public view returns (address) { return _state.owner; } function approve(address to, uint256 tokenId) public override { address owner_ = NFTImplementation.ownerOf(tokenId); require(to != owner_, "ERC721: approval to current owner"); require( _msgSender() == owner_ || isApprovedForAll(owner_, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } function getApproved(uint256 tokenId) public view override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _state.tokenApprovals[tokenId]; } function setApprovalForAll(address operator, bool approved) public override { require(operator != _msgSender(), "ERC721: approve to caller"); _state.operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } function isApprovedForAll(address owner_, address operator) public view override returns (bool) { return _state.operatorApprovals[owner_][operator]; } function transferFrom( address from, address to, uint256 tokenId ) public override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId ) public override { safeTransferFrom(from, to, tokenId, ""); } function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } function _exists(uint256 tokenId) internal view returns (bool) { return _state.owners[tokenId] != address(0); } function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner_ = NFTImplementation.ownerOf(tokenId); return (spender == owner_ || getApproved(tokenId) == spender || isApprovedForAll(owner_, spender)); } function mint(address to, uint256 tokenId, string memory uri) public onlyOwner { _mint(to, tokenId, uri); } function _mint(address to, uint256 tokenId, string memory uri) internal { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _state.balances[to] += 1; _state.owners[tokenId] = to; _state.tokenURIs[tokenId] = uri; emit Transfer(address(0), to, tokenId); } function burn(uint256 tokenId) public onlyOwner { _burn(tokenId); } function _burn(uint256 tokenId) internal { address owner_ = NFTImplementation.ownerOf(tokenId); // Clear approvals _approve(address(0), tokenId); _state.balances[owner_] -= 1; delete _state.owners[tokenId]; emit Transfer(owner_, address(0), tokenId); } function _transfer( address from, address to, uint256 tokenId ) internal { require(NFTImplementation.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); // Clear approvals from the previous owner _approve(address(0), tokenId); _state.balances[from] -= 1; _state.balances[to] += 1; _state.owners[tokenId] = to; emit Transfer(from, to, tokenId); } function _approve(address to, uint256 tokenId) internal { _state.tokenApprovals[tokenId] = to; emit Approval(NFTImplementation.ownerOf(tokenId), to, tokenId); } function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } modifier onlyOwner() { require(owner() == _msgSender(), "caller is not the owner"); _; } modifier initializer() { require( !_state.initialized, "Already initialized" ); _state.initialized = true; _; } }
// contracts/State.sol // SPDX-License-Identifier: Apache 2 pragma solidity ^0.8.0; contract NFTStorage { struct State { // Token name string name; // Token symbol string symbol; // Mapping from token ID to owner address mapping(uint256 => address) owners; // Mapping owner address to token count mapping(address => uint256) balances; // Mapping from token ID to approved address mapping(uint256 => address) tokenApprovals; // Mapping from token ID to URI mapping(uint256 => string) tokenURIs; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) operatorApprovals; address owner; bool initialized; uint16 chainId; bytes32 nativeContract; } } contract NFTState { NFTStorage.State _state; }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "istanbul", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldContract","type":"address"},{"indexed":true,"internalType":"address","name":"newContract","type":"address"}],"name":"ContractUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[{"internalType":"uint16","name":"chainId_","type":"uint16"}],"name":"bridgeContracts","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainId","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedVm","type":"bytes"}],"name":"completeTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"tokenAddress","type":"bytes32"},{"internalType":"uint16","name":"tokenChain","type":"uint16"},{"internalType":"bytes32","name":"symbol","type":"bytes32"},{"internalType":"bytes32","name":"name","type":"bytes32"},{"internalType":"uint256","name":"tokenID","type":"uint256"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint16","name":"toChain","type":"uint16"}],"internalType":"struct NFTBridgeStructs.Transfer","name":"transfer","type":"tuple"}],"name":"encodeTransfer","outputs":[{"internalType":"bytes","name":"encoded","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"evmChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finality","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"}],"name":"governanceActionIsConsumed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governanceChainId","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governanceContract","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isFork","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"impl","type":"address"}],"name":"isInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"}],"name":"isTransferCompleted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"isWrappedAsset","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedRecoverChainId","type":"bytes"}],"name":"parseRecoverChainId","outputs":[{"components":[{"internalType":"bytes32","name":"module","type":"bytes32"},{"internalType":"uint8","name":"action","type":"uint8"},{"internalType":"uint256","name":"evmChainId","type":"uint256"},{"internalType":"uint16","name":"newChainId","type":"uint16"}],"internalType":"struct NFTBridgeStructs.RecoverChainId","name":"rci","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"encoded","type":"bytes"}],"name":"parseRegisterChain","outputs":[{"components":[{"internalType":"bytes32","name":"module","type":"bytes32"},{"internalType":"uint8","name":"action","type":"uint8"},{"internalType":"uint16","name":"chainId","type":"uint16"},{"internalType":"uint16","name":"emitterChainID","type":"uint16"},{"internalType":"bytes32","name":"emitterAddress","type":"bytes32"}],"internalType":"struct NFTBridgeStructs.RegisterChain","name":"chain","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"encoded","type":"bytes"}],"name":"parseTransfer","outputs":[{"components":[{"internalType":"bytes32","name":"tokenAddress","type":"bytes32"},{"internalType":"uint16","name":"tokenChain","type":"uint16"},{"internalType":"bytes32","name":"symbol","type":"bytes32"},{"internalType":"bytes32","name":"name","type":"bytes32"},{"internalType":"uint256","name":"tokenID","type":"uint256"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint16","name":"toChain","type":"uint16"}],"internalType":"struct NFTBridgeStructs.Transfer","name":"transfer","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"encoded","type":"bytes"}],"name":"parseUpgrade","outputs":[{"components":[{"internalType":"bytes32","name":"module","type":"bytes32"},{"internalType":"uint8","name":"action","type":"uint8"},{"internalType":"uint16","name":"chainId","type":"uint16"},{"internalType":"bytes32","name":"newContract","type":"bytes32"}],"internalType":"struct NFTBridgeStructs.UpgradeContract","name":"chain","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedVM","type":"bytes"}],"name":"registerChain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"splCache","outputs":[{"components":[{"internalType":"bytes32","name":"name","type":"bytes32"},{"internalType":"bytes32","name":"symbol","type":"bytes32"}],"internalType":"struct NFTBridgeStorage.SPLCache","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedVM","type":"bytes"}],"name":"submitRecoverChainId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tokenImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenID","type":"uint256"},{"internalType":"uint16","name":"recipientChain","type":"uint16"},{"internalType":"bytes32","name":"recipient","type":"bytes32"},{"internalType":"uint32","name":"nonce","type":"uint32"}],"name":"transferNFT","outputs":[{"internalType":"uint64","name":"sequence","type":"uint64"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedVM","type":"bytes"}],"name":"upgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wormhole","outputs":[{"internalType":"contract IWormhole","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"tokenChainId","type":"uint16"},{"internalType":"bytes32","name":"tokenAddress","type":"bytes32"}],"name":"wrappedAsset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50614299806100206000396000f3fe608060405260043610620001db5760003560e01c806384acd1bb11620000ff578063c96616e11162000095578063e039f224116200006c578063e039f22414620006d7578063e6a853e014620006ef578063fbe3c2cd1462000723578063fbeeacd9146200074457600080fd5b8063c96616e1146200060a578063cb4cfea8146200063a578063d60b347f146200069a57600080fd5b8063aa4efa5b11620000d6578063aa4efa5b1462000565578063ad66a5f11462000599578063b172b22214620005ce578063c687851914620005e557600080fd5b806384acd1bb14620004f65780639a8a05921462000516578063a5799f93146200054057600080fd5b80632c3c02a411620001755780635c60da1b116200014c5780635c60da1b146200047657806364d42b17146200048e578063739fc8d114620004af5780638129fc1c14620004de57600080fd5b80632c3c02a414620003a95780632f3a3d5d14620003dd5780633ca6482614620003fd57600080fd5b80631a2be4da11620001b65780631a2be4da14620002c45780631ff1e28614620003125780632539464514620003505780632b511375146200037557600080fd5b806301f5325514620001e0578063150b7a02146200025e578063178149e7146200029d575b600080fd5b348015620001ed57600080fd5b5062000205620001ff3660046200315a565b620007a4565b604051620002559190600060a0820190508251825260ff6020840151166020830152604083015161ffff808216604085015280606086015116606085015250506080830151608083015292915050565b60405180910390f35b3480156200026b57600080fd5b50620002836200027d3660046200300a565b620009ac565b6040516001600160e01b0319909116815260200162000255565b348015620002aa57600080fd5b50620002c2620002bc3660046200315a565b62000a30565b005b348015620002d157600080fd5b5062000301620002e336600462002fed565b6001600160a01b031660009081526008602052604090205460ff1690565b604051901515815260200162000255565b3480156200031f57600080fd5b50620003376200033136600462003450565b62000b4c565b6040516001600160a01b03909116815260200162000255565b3480156200035d57600080fd5b50620002c26200036f3660046200315a565b62000b78565b3480156200038257600080fd5b506200039a620003943660046200315a565b62000c88565b60405162000255919062003652565b348015620003b657600080fd5b5062000301620003c836600462003128565b60009081526004602052604090205460ff1690565b348015620003ea57600080fd5b506001546001600160a01b031662000337565b3480156200040a57600080fd5b506200045a6200041c36600462003128565b6040805180820190915260008082526020820152506000908152600a6020908152604091829020825180840190935280548352600101549082015290565b6040805182518152602092830151928101929092520162000255565b3480156200048357600080fd5b506200033762000e5e565b3480156200049b57600080fd5b50600b545b60405190815260200162000255565b348015620004bc57600080fd5b50600254640100000000900460ff1660405160ff909116815260200162000255565b348015620004eb57600080fd5b50620002c262000e78565b3480156200050357600080fd5b506000546001600160a01b031662000337565b3480156200052357600080fd5b5060025461ffff165b60405161ffff909116815260200162000255565b3480156200054d57600080fd5b50620002c26200055f3660046200315a565b6200112d565b3480156200057257600080fd5b50620003016200058436600462003128565b60009081526005602052604090205460ff1690565b348015620005a657600080fd5b50620004a0620005b836600462003412565b61ffff1660009081526009602052604090205490565b348015620005db57600080fd5b50600354620004a0565b348015620005f257600080fd5b50620002c2620006043660046200315a565b62001232565b620006216200061b366004620030a8565b62001240565b6040516001600160401b03909116815260200162000255565b3480156200064757600080fd5b506200065f620006593660046200315a565b62001904565b6040516200025591908151815260208083015160ff16908201526040808301519082015260609182015161ffff169181019190915260800190565b348015620006a757600080fd5b5062000301620006b936600462002fed565b6001600160a01b031660009081526006602052604090205460ff1690565b348015620006e457600080fd5b506200030162001ac4565b348015620006fc57600080fd5b50620007146200070e366004620031da565b62001ad8565b604051620002559190620035e9565b3480156200073057600080fd5b5060025462010000900461ffff166200052c565b3480156200075157600080fd5b5062000769620007633660046200315a565b62001b94565b6040516200025591908151815260208083015160ff169082015260408083015161ffff16908201526060918201519181019190915260800190565b6040805160a081018252600080825260208201819052918101829052606081018290526080810182905290620007db838262001d6d565b8252620007ea602082620037d8565b8251909150684e465442726964676514620008585760405162461bcd60e51b815260206004820152602360248201527f696e76616c6964205265676973746572436861696e3a2077726f6e67206d6f64604482015262756c6560e81b60648201526084015b60405180910390fd5b62000864838262001dcf565b60ff16602083015262000879600182620037d8565b9050816020015160ff16600114620008e05760405162461bcd60e51b815260206004820152602360248201527f696e76616c6964205265676973746572436861696e3a2077726f6e672061637460448201526234b7b760e91b60648201526084016200084f565b620008ec838262001e2f565b61ffff16604083015262000902600282620037d8565b905062000910838262001e2f565b61ffff16606083015262000926600282620037d8565b905062000934838262001d6d565b608083015262000946602082620037d8565b905080835114620009a65760405162461bcd60e51b815260206004820152602360248201527f696e76616c6964205265676973746572436861696e3a2077726f6e67206c656e6044820152620cee8d60eb1b60648201526084016200084f565b50919050565b60006001600160a01b038616301462000a1e5760405162461bcd60e51b815260206004820152602d60248201527f63616e206f6e6c792062726964676520746f6b656e7320766961207472616e7360448201526c19995c939195081b595d1a1bd9609a1b60648201526084016200084f565b50630a85bd0160e11b95945050505050565b62000a3a62001ac4565b62000a755760405162461bcd60e51b815260206004820152600a6024820152696e6f74206120666f726b60b01b60448201526064016200084f565b600080600062000a858462001e90565b92509250925081819062000aae5760405162461bcd60e51b81526004016200084f9190620035e9565b5062000abf836101400151620020bf565b600062000ad08460e0015162001904565b90504681604001511462000b1b5760405162461bcd60e51b815260206004820152601160248201527034b73b30b634b21022ab269021b430b4b760791b60448201526064016200084f565b62000b2a8160400151620020da565b60608101516002805461ffff191661ffff9092169190911790555b5050505050565b61ffff91909116600090815260076020908152604080832093835292905220546001600160a01b031690565b62000b8262001ac4565b1562000bc05760405162461bcd60e51b815260206004820152600c60248201526b696e76616c696420666f726b60a01b60448201526064016200084f565b600080600062000bd08462001e90565b92509250925081819062000bf95760405162461bcd60e51b81526004016200084f9190620035e9565b5062000c0a836101400151620020bf565b600062000c1b8460e0015162001b94565b905062000c2b60025461ffff1690565b61ffff16816040015161ffff161462000c785760405162461bcd60e51b815260206004820152600e60248201526d1ddc9bdb99c818da185a5b881a5960921b60448201526064016200084f565b606081015162000b459062002125565b604080516101008101825260008082526020820181905291810182905260608082018390526080820183905260a082015260c0810182905260e08101829052908062000cd5848262001dcf565b905062000ce4600183620037d8565b91508060ff1660011462000d2e5760405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b2102a3930b739b332b960811b60448201526064016200084f565b62000d3a848362001d6d565b835262000d49602083620037d8565b915062000d57848362001e2f565b61ffff16602084015262000d6d600283620037d8565b915062000d7b848362001d6d565b604084015262000d8d602083620037d8565b915062000d9b848362001d6d565b606084015262000dad602083620037d8565b915062000dbb84836200225c565b608084015262000dcd602083620037d8565b915062000ddc600183620037d8565b915062000e0982602284875162000df49190620037f3565b62000e009190620037f3565b869190620022b5565b60a08401528351915062000e1f600283620037f3565b915062000e2d848362001e2f565b61ffff1660e084015262000e43602083620037f3565b915062000e51848362001d6d565b60c0840152509092915050565b600062000e736001546001600160a01b031690565b905090565b600062000eac7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905062000ed1816001600160a01b031660009081526006602052604090205460ff1690565b1562000f165760405162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b60448201526064016200084f565b62000f3f816001600160a01b03166000908152600660205260409020805460ff19166001179055565b60008062000f5060025461ffff1690565b90508061ffff166002141562000f6a57600191506200111d565b8061ffff166004141562000f8257603891506200111d565b8061ffff166005141562000f9a57608991506200111d565b8061ffff166006141562000fb35761a86a91506200111d565b8061ffff166007141562000fcc5761a51691506200111d565b8061ffff166009141562000fe757634e45415291506200111d565b8061ffff16600a141562000fff5760fa91506200111d565b8061ffff16600b141562001018576102ae91506200111d565b8061ffff16600c1415620010315761031391506200111d565b8061ffff16600d14156200104a5761201991506200111d565b8061ffff16600e1415620010635761a4ec91506200111d565b8061ffff16601014156200107c5761050491506200111d565b8061ffff16601114156200109757630e9ac0d691506200111d565b8061ffff1660171415620010b05761a4b191506200111d565b8061ffff1660181415620010c857600a91506200111d565b8061ffff1660191415620010e057606491506200111d565b60405162461bcd60e51b81526020600482015260116024820152702ab735b737bbb71031b430b4b71034b21760791b60448201526064016200084f565b6200112882620020da565b505050565b60008060006200113d8462001e90565b925092509250818190620011665760405162461bcd60e51b81526004016200084f9190620035e9565b5062001177836101400151620020bf565b6000620011888460e00151620007a4565b90506200119860025461ffff1690565b61ffff16816040015161ffff16148015620011ba5750620011b862001ac4565b155b80620011cc5750604081015161ffff16155b6200120d5760405162461bcd60e51b815260206004820152601060248201526f1a5b9d985b1a590818da185a5b881a5960821b60448201526064016200084f565b62000b458160600151826080015161ffff909116600090815260096020526040902055565b6200123d81620023ce565b50565b600080600062001268886001600160a01b031660009081526008602052604090205460ff1690565b156200136257876001600160a01b0316639a8a05926040518163ffffffff1660e01b815260040160206040518083038186803b158015620012a857600080fd5b505afa158015620012bd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620012e3919062003431565b9150876001600160a01b0316633d6c043b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200131f57600080fd5b505afa15801562001334573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200135a919062003141565b90506200152c565b60025461ffff166040516301ffc9a760e01b81526380ac58cd60e01b60048201529092506001600160a01b038916915081906301ffc9a79060240160206040518083038186803b158015620013b657600080fd5b505afa158015620013cb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620013f191906200310b565b620014495760405162461bcd60e51b815260206004820152602160248201527f6d75737420737570706f7274207468652045524337323120696e7465726661636044820152606560f81b60648201526084016200084f565b6040516301ffc9a760e01b8152635b5e139f60e01b60048201526001600160a01b038916906301ffc9a79060240160206040518083038186803b1580156200149057600080fd5b505afa158015620014a5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620014cb91906200310b565b6200152c5760405162461bcd60e51b815260206004820152602a60248201527f6d75737420737570706f727420746865204552433732312d4d657461646174616044820152691032bc3a32b739b4b7b760b11b60648201526084016200084f565b60608060608461ffff16600114620016865760408051600481526024810182526020810180516001600160e01b03166395d89b4160e01b17905290516000916001600160a01b038e1691620015829190620034c9565b600060405180830381855afa9150503d8060008114620015bf576040519150601f19603f3d011682016040523d82523d6000602084013e620015c4565b606091505b5060408051600481526024810182526020810180516001600160e01b03166306fdde0360e01b1790529051919350600092506001600160a01b038f16916200160d9190620034c9565b600060405180830381855afa9150503d80600081146200164a576040519150601f19603f3d011682016040523d82523d6000602084013e6200164f565b606091505b5091505081806020019051810190620016699190620031a4565b945080806020019051810190620016819190620031a4565b935050505b60008b6001600160a01b03168b604051602401620016a691815260200190565b60408051601f198184030181529181526020820180516001600160e01b031663c87b56dd60e01b17905251620016dd9190620034c9565b600060405180830381855afa9150503d80600081146200171a576040519150601f19603f3d011682016040523d82523d6000602084013e6200171f565b606091505b5091505080806020019051810190620017399190620031a4565b9150506000808661ffff1660011415620017b657604080518082018252600080825260209182018190528e8152600a82528281208351808501909452805484526001015491830191909152906020810151815190945092509050620017af8d6000908152600a6020526040812081815560010155565b50620017c3565b5050602083810151908301515b604051632142170760e11b8152336004820152306024820152604481018d90526001600160a01b038e16906342842e0e90606401600060405180830381600087803b1580156200181257600080fd5b505af115801562001827573d6000803e3d6000fd5b505050506200183960025461ffff1690565b61ffff168761ffff1614620018a557604051630852cd8d60e31b8152600481018d90526001600160a01b038e16906342966c6890602401600060405180830381600087803b1580156200188b57600080fd5b505af1158015620018a0573d6000803e3d6000fd5b505050505b620018f36040518061010001604052808881526020018961ffff1681526020018481526020018381526020018e81526020018581526020018c81526020018d61ffff16815250348b620027b2565b9d9c50505050505050505050505050565b60408051608081018252600080825260208201819052918101829052606081018290529062001934838262001d6d565b825262001943602082620037d8565b8251909150684e465442726964676514620019ad5760405162461bcd60e51b8152602060048201526024808201527f696e76616c6964205265636f766572436861696e49643a2077726f6e67206d6f60448201526364756c6560e01b60648201526084016200084f565b620019b9838262001dcf565b60ff166020830152620019ce600182620037d8565b9050816020015160ff1660031462001a355760405162461bcd60e51b8152602060048201526024808201527f696e76616c6964205265636f766572436861696e49643a2077726f6e672061636044820152633a34b7b760e11b60648201526084016200084f565b62001a4183826200225c565b604083015262001a53602082620037d8565b905062001a61838262001e2f565b61ffff16606083015262001a77600282620037d8565b905080835114620009a65760405162461bcd60e51b81526020600482015260166024820152751a5b9d985b1a5908149958dbdd995c90da185a5b925960521b60448201526064016200084f565b60004662001ad1600b5490565b1415905090565b606060c88260a0015151111562001b3d5760405162461bcd60e51b815260206004820152602260248201527f746f6b656e555249206d757374206e6f74206578636565642032303020627974604482015261657360f01b60648201526084016200084f565b81516020808401516040808601516060870151608088015160a0890151805160c08b015160e08c0151965162001b7e9a60019a90999893949391016200351a565b6040516020818303038152906040529050919050565b60408051608081018252600080825260208201819052918101829052606081018290529062001bc4838262001d6d565b825262001bd3602082620037d8565b8251909150684e46544272696467651462001c3f5760405162461bcd60e51b815260206004820152602560248201527f696e76616c69642055706772616465436f6e74726163743a2077726f6e67206d6044820152646f64756c6560d81b60648201526084016200084f565b62001c4b838262001dcf565b60ff16602083015262001c60600182620037d8565b9050816020015160ff1660021462001cc95760405162461bcd60e51b815260206004820152602560248201527f696e76616c69642055706772616465436f6e74726163743a2077726f6e67206160448201526431ba34b7b760d91b60648201526084016200084f565b62001cd5838262001e2f565b61ffff16604083015262001ceb600282620037d8565b905062001cf9838262001d6d565b606083015262001d0b602082620037d8565b905080835114620009a65760405162461bcd60e51b815260206004820152602560248201527f696e76616c69642055706772616465436f6e74726163743a2077726f6e67206c6044820152640cadccee8d60db1b60648201526084016200084f565b600062001d7c826020620037d8565b8351101562001dc65760405162461bcd60e51b8152602060048201526015602482015274746f427974657333325f6f75744f66426f756e647360581b60448201526064016200084f565b50016020015190565b600062001dde826001620037d8565b8351101562001e265760405162461bcd60e51b8152602060048201526013602482015272746f55696e74385f6f75744f66426f756e647360681b60448201526064016200084f565b50016001015190565b600062001e3e826002620037d8565b8351101562001e875760405162461bcd60e51b8152602060048201526014602482015273746f55696e7431365f6f75744f66426f756e647360601b60448201526064016200084f565b50016002015190565b604080516101608101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e08201819052610100820183905261012082015261014081019190915260006060600080600062001f046000546001600160a01b031690565b6001600160a01b031663c0fd8bde886040518263ffffffff1660e01b815260040162001f319190620035e9565b60006040518083038186803b15801562001f4a57600080fd5b505afa15801562001f5f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262001f899190810190620032a3565b9250925092508162001fa25791945092509050620020b8565b60025462010000900461ffff1661ffff16836060015161ffff1614620020005750506040805180820190915260168152753bb937b7339033b7bb32b93730b731b29031b430b4b760511b6020820152909350600092509050620020b8565b6003548360800151146200205357505060408051808201909152601981527f77726f6e6720676f7665726e616e636520636f6e7472616374000000000000006020820152909350600092509050620020b8565b61014083015160009081526004602052604090205460ff16156200209d578260006040518060600160405280602281526020016200424260229139955095509550505050620020b8565b50506040805160208101909152600081529093506001925090505b9193909250565b6000908152600460205260409020805460ff19166001179055565b468114620021205760405162461bcd60e51b81526020600482015260126024820152711a5b9d985b1a5908195d9b50da185a5b925960721b60448201526064016200084f565b600b55565b6000620021597f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905062002166826200287b565b60408051600481526024810182526020810180516001600160e01b031663204a7f0760e21b179052905160009182916001600160a01b03861691620021ab91620034c9565b600060405180830381855af49150503d8060008114620021e8576040519150601f19603f3d011682016040523d82523d6000602084013e620021ed565b606091505b5091509150818190620022155760405162461bcd60e51b81526004016200084f9190620035e9565b50836001600160a01b0316836001600160a01b03167f2e4cc16c100f0b55e2df82ab0b1a7e294aa9cbd01b48fbaf622683fbc0507a4960405160405180910390a350505050565b60006200226b826020620037d8565b8351101562001dc65760405162461bcd60e51b8152602060048201526015602482015274746f55696e743235365f6f75744f66426f756e647360581b60448201526064016200084f565b606081620022c581601f620037d8565b1015620023065760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b60448201526064016200084f565b620023128284620037d8565b84511015620023585760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b60448201526064016200084f565b606082158015620023795760405191506000825260208201604052620023c5565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015620023b45780518352602092830192016200239a565b5050858452601f01601f1916604052505b50949350505050565b6000806000620023e66000546001600160a01b031690565b6001600160a01b031663c0fd8bde856040518263ffffffff1660e01b8152600401620024139190620035e9565b60006040518083038186803b1580156200242c57600080fd5b505afa15801562002441573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526200246b9190810190620032a3565b925092509250818190620024945760405162461bcd60e51b81526004016200084f9190620035e9565b50620024a083620028bd565b620024e05760405162461bcd60e51b815260206004820152600f60248201526e34b73b30b634b21032b6b4ba3a32b960891b60448201526064016200084f565b6000620024f18460e0015162000c88565b90506200251284610140015160009081526005602052604090205460ff1690565b15620025615760405162461bcd60e51b815260206004820152601a60248201527f7472616e7366657220616c726561647920636f6d706c6574656400000000000060448201526064016200084f565b620025868461014001516000908152600560205260409020805460ff19166001179055565b60025461ffff1661ffff168160e0015161ffff1614620025e05760405162461bcd60e51b815260206004820152601460248201527334b73b30b634b2103a30b933b2ba1031b430b4b760611b60448201526064016200084f565b6000620025f060025461ffff1690565b61ffff16826020015161ffff1614156200260d5750805162002658565b6000620026238360200151846000015162000b4c565b90506001600160a01b03811662002655576200265283602001518460000151856060015186604001516200293b565b90505b90505b60c082015160025461ffff1661ffff16836020015161ffff16146200273757826020015161ffff1660011415620026c3576080830151604080518082018252606086015181528186015160208083019182526000948552600a90529190922091518255516001909101555b608083015160a08401516040516334ff261960e21b81526001600160a01b0385169263d3fc986492620026fd9286929190600401620035c0565b600060405180830381600087803b1580156200271857600080fd5b505af11580156200272d573d6000803e3d6000fd5b50505050620027a9565b6080830151604051632142170760e11b81523060048201526001600160a01b0383811660248301526044820192909252908316906342842e0e90606401600060405180830381600087803b1580156200278f57600080fd5b505af1158015620027a4573d6000803e3d6000fd5b505050505b50505050505050565b600080620027c08562001ad8565b9050620027d56000546001600160a01b031690565b6001600160a01b031663b19a437e858584620027fc60025460ff6401000000009091041690565b6040518563ffffffff1660e01b81526004016200281c93929190620036d0565b6020604051808303818588803b1580156200283657600080fd5b505af11580156200284b573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906200287291906200347e565b95945050505050565b620028868162002be8565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6000620028c962001ac4565b15620029075760405162461bcd60e51b815260206004820152600c60248201526b696e76616c696420666f726b60a01b60448201526064016200084f565b6080820151606083015161ffff1660009081526009602052604090205414156200293357506001919050565b506000919050565b60006200294b60025461ffff1690565b61ffff168561ffff161415620029b55760405162461bcd60e51b815260206004820152602860248201527f63616e206f6e6c79207772617020746f6b656e732066726f6d20666f726569676044820152676e20636861696e7360c01b60648201526084016200084f565b6000620029c3868662000b4c565b6001600160a01b03161462002a1b5760405162461bcd60e51b815260206004820152601c60248201527f7772617070656420617373657420616c7265616479206578697374730000000060448201526064016200084f565b8461ffff166001141562002a5d577f576f726d686f6c65204272696467656420536f6c616e612d4e4654000000000092506915d3d49354d41313919560b21b91505b6000627ce50b60e31b62002a718562002c8f565b62002a7c8562002c8f565b30898960405160240162002a95959493929190620035fe565b60408051601f19818403018152918152602080830180516001600160e01b03166001600160e01b0319909516949094179093525190925060009162002adf9130918591016200359a565b604051602081830303815290604052905060006040518060200162002b049062002dca565b601f1982820381018352601f90910116604081905262002b2a91908490602001620034e7565b60408051601f19818403018152908290526001600160f01b031960f08b901b166020830152602282018990529150600090604201604051602081830303815290604052805190602001209050808251602084016000f59450843b62002b8e57600080fd5b61ffff891660009081526007602090815260408083208b8452825280832080546001600160a01b0319166001600160a01b038a16908117909155835260089091529020805460ff1916600117905550505050949350505050565b803b62002c4e5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200084f565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b606060005b60208110801562002cd2575082816020811062002cc157634e487b7160e01b600052603260045260246000fd5b1a60f81b6001600160f81b03191615155b1562002ced578062002ce48162003840565b91505062002c94565b6000816001600160401b0381111562002d1657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801562002d41576020820181803683370190505b50905060005b8281101562002dc25784816020811062002d7157634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811062002d9657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508062002db98162003840565b91505062002d47565b509392505050565b61099380620038af83390190565b600062002def62002de984620037ae565b6200377b565b905082815283838301111562002e0457600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b038116811462002e3357600080fd5b919050565b600082601f83011262002e49578081fd5b815160206001600160401b0382111562002e675762002e6762003874565b62002e77818360051b016200377b565b80838252828201915082860187848660071b890101111562002e97578586fd5b855b8581101562002f0357608080838b03121562002eb3578788fd5b62002ebd62003704565b835181528684015187820152604062002ed881860162002fdb565b90820152606062002eeb85820162002fdb565b90820152855293850193919091019060010162002e99565b5090979650505050505050565b8051801515811462002e3357600080fd5b600082601f83011262002f32578081fd5b815162002f4362002de982620037ae565b81815284602083860101111562002f58578283fd5b62002f6b8260208301602087016200380d565b949350505050565b600082601f83011262002f84578081fd5b62002f958383356020850162002dd8565b9392505050565b803562002e33816200388a565b805162002e33816200388a565b805162002e33816200389b565b80516001600160401b038116811462002e3357600080fd5b805160ff8116811462002e3357600080fd5b60006020828403121562002fff578081fd5b62002f958262002e1b565b60008060008060006080868803121562003022578081fd5b6200302d8662002e1b565b94506200303d6020870162002e1b565b93506040860135925060608601356001600160401b038082111562003060578283fd5b818801915088601f83011262003074578283fd5b81358181111562003083578384fd5b89602082850101111562003095578384fd5b9699959850939650602001949392505050565b600080600080600060a08688031215620030c0578283fd5b620030cb8662002e1b565b9450602086013593506040860135620030e4816200388a565b9250606086013591506080860135620030fd816200389b565b809150509295509295909350565b6000602082840312156200311d578081fd5b62002f958262002f10565b6000602082840312156200313a578081fd5b5035919050565b60006020828403121562003153578081fd5b5051919050565b6000602082840312156200316c578081fd5b81356001600160401b0381111562003182578182fd5b8201601f8101841362003193578182fd5b62002f6b8482356020840162002dd8565b600060208284031215620031b6578081fd5b81516001600160401b03811115620031cc578182fd5b62002f6b8482850162002f21565b600060208284031215620031ec578081fd5b81356001600160401b038082111562003203578283fd5b90830190610100828603121562003218578283fd5b620032226200372f565b82358152620032346020840162002f9c565b602082015260408301356040820152606083013560608201526080830135608082015260a08301358281111562003269578485fd5b620032778782860162002f73565b60a08301525060c083013560c08201526200329560e0840162002f9c565b60e082015295945050505050565b600080600060608486031215620032b8578081fd5b83516001600160401b0380821115620032cf578283fd5b908501906101608288031215620032e4578283fd5b620032ee62003755565b620032f98362002fdb565b8152620033096020840162002fb6565b60208201526200331c6040840162002fb6565b60408201526200332f6060840162002fa9565b6060820152608083015160808201526200334c60a0840162002fc3565b60a08201526200335f60c0840162002fdb565b60c082015260e08301518281111562003376578485fd5b620033848982860162002f21565b60e0830152506101006200339a81850162002fb6565b908201526101208381015183811115620033b2578586fd5b620033c08a82870162002e38565b918301919091525061014083810151908201529450620033e36020870162002f10565b93506040860151915080821115620033f9578283fd5b50620034088682870162002f21565b9150509250925092565b60006020828403121562003424578081fd5b813562002f95816200388a565b60006020828403121562003443578081fd5b815162002f95816200388a565b6000806040838503121562003463578182fd5b823562003470816200388a565b946020939093013593505050565b60006020828403121562003490578081fd5b62002f958262002fc3565b60008151808452620034b58160208601602086016200380d565b601f01601f19169290920160200192915050565b60008251620034dd8184602087016200380d565b9190910192915050565b60008351620034fb8184602088016200380d565b835190830190620035118183602088016200380d565b01949350505050565b600060ff60f81b808d60f81b1683528b600184015261ffff60f01b808c60f01b1660218501528a6023850152896043850152886063850152818860f81b1660838501528651915062003574826084860160208a016200380d565b920160848101949094525060f09190911b1660a482015260a60198975050505050505050565b6001600160a01b038316815260406020820181905260009062002f6b908301846200349b565b60018060a01b03841681528260208201526060604082015260006200287260608301846200349b565b60208152600062002f9560208301846200349b565b60a0815260006200361360a08301886200349b565b82810360208401526200362781886200349b565b6001600160a01b03969096166040840152505061ffff92909216606083015260809091015292915050565b60208152815160208201526000602083015161ffff80821660408501526040850151606085015260608501516080850152608085015160a085015260a085015191506101008060c0860152620036ad6101208601846200349b565b925060c086015160e08601528160e0870151168186015250508091505092915050565b63ffffffff84168152606060208201526000620036f160608301856200349b565b905060ff83166040830152949350505050565b604051608081016001600160401b038111828210171562003729576200372962003874565b60405290565b60405161010081016001600160401b038111828210171562003729576200372962003874565b60405161016081016001600160401b038111828210171562003729576200372962003874565b604051601f8201601f191681016001600160401b0381118282101715620037a657620037a662003874565b604052919050565b60006001600160401b03821115620037ca57620037ca62003874565b50601f01601f191660200190565b60008219821115620037ee57620037ee6200385e565b500190565b6000828210156200380857620038086200385e565b500390565b60005b838110156200382a57818101518382015260200162003810565b838111156200383a576000848401525b50505050565b60006000198214156200385757620038576200385e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b61ffff811681146200123d57600080fd5b63ffffffff811681146200123d57600080fdfe608060405234801561001057600080fd5b5060405161099338038061099383398101604081905261002f9161048e565b818161005c60017fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d51610599565b60008051602061094c8339815191521461008657634e487b7160e01b600052600160045260246000fd5b6100928282600061009b565b505050506105fe565b6100a483610175565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a26000825111806100e55750805b156101705761016e836001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561012657600080fd5b505afa15801561013a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061015e9190610474565b8361031560201b6100291760201c565b505b505050565b6101888161034160201b6100551760201c565b6101e75760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b60648201526084015b60405180910390fd5b61026a816001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561022357600080fd5b505afa158015610237573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025b9190610474565b61034160201b6100551760201c565b6102cf5760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b60648201526084016101de565b806102f460008051602061094c83398151915260001b61034760201b61005b1760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b606061033a838360405180606001604052806027815260200161096c6027913961034a565b9392505050565b3b151590565b90565b6060833b6103a95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016101de565b600080856001600160a01b0316856040516103c4919061054a565b600060405180830381855af49150503d80600081146103ff576040519150601f19603f3d011682016040523d82523d6000602084013e610404565b606091505b50909250905061041582828661041f565b9695505050505050565b6060831561042e57508161033a565b82511561043e5782518084602001fd5b8160405162461bcd60e51b81526004016101de9190610566565b80516001600160a01b038116811461046f57600080fd5b919050565b600060208284031215610485578081fd5b61033a82610458565b600080604083850312156104a0578081fd5b6104a983610458565b60208401519092506001600160401b03808211156104c5578283fd5b818501915085601f8301126104d8578283fd5b8151818111156104ea576104ea6105e8565b604051601f8201601f19908116603f01168101908382118183101715610512576105126105e8565b8160405282815288602084870101111561052a578586fd5b61053b8360208301602088016105bc565b80955050505050509250929050565b6000825161055c8184602087016105bc565b9190910192915050565b60208152600082518060208401526105858160408501602087016105bc565b601f01601f19169190910160400192915050565b6000828210156105b757634e487b7160e01b81526011600452602481fd5b500390565b60005b838110156105d75781810151838201526020016105bf565b8381111561016e5750506000910152565b634e487b7160e01b600052604160045260246000fd5b61033f8061060d6000396000f3fe60806040523661001357610011610017565b005b6100115b61002761002261005e565b610106565b565b606061004e83836040518060600160405280602781526020016102e36027913961012a565b9392505050565b3b151590565b90565b60006100917fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50546001600160a01b031690565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100c957600080fd5b505afa1580156100dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610101919061023c565b905090565b3660008037600080366000845af43d6000803e808015610125573d6000f35b3d6000fd5b6060833b61018e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b0316856040516101a99190610263565b600060405180830381855af49150503d80600081146101e4576040519150601f19603f3d011682016040523d82523d6000602084013e6101e9565b606091505b50915091506101f9828286610203565b9695505050505050565b6060831561021257508161004e565b8251156102225782518084602001fd5b8160405162461bcd60e51b8152600401610185919061027f565b60006020828403121561024d578081fd5b81516001600160a01b038116811461004e578182fd5b600082516102758184602087016102b2565b9190910192915050565b602081526000825180602084015261029e8160408501602087016102b2565b601f01601f19169190910160400192915050565b60005b838110156102cd5781810151838201526020016102b5565b838111156102dc576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220c383d12a666085db2eac57ee60d62a29e11c165ef3006d3555601869d9b9b8eb64736f6c63430008040033a3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564676f7665726e616e636520616374696f6e20616c726561647920636f6e73756d6564a264697066735822122090900c22fa18198cb3b7f7346de57eddb51151efaa077d0c0f82e22e06a8958264736f6c63430008040033
Deployed Bytecode
0x608060405260043610620001db5760003560e01c806384acd1bb11620000ff578063c96616e11162000095578063e039f224116200006c578063e039f22414620006d7578063e6a853e014620006ef578063fbe3c2cd1462000723578063fbeeacd9146200074457600080fd5b8063c96616e1146200060a578063cb4cfea8146200063a578063d60b347f146200069a57600080fd5b8063aa4efa5b11620000d6578063aa4efa5b1462000565578063ad66a5f11462000599578063b172b22214620005ce578063c687851914620005e557600080fd5b806384acd1bb14620004f65780639a8a05921462000516578063a5799f93146200054057600080fd5b80632c3c02a411620001755780635c60da1b116200014c5780635c60da1b146200047657806364d42b17146200048e578063739fc8d114620004af5780638129fc1c14620004de57600080fd5b80632c3c02a414620003a95780632f3a3d5d14620003dd5780633ca6482614620003fd57600080fd5b80631a2be4da11620001b65780631a2be4da14620002c45780631ff1e28614620003125780632539464514620003505780632b511375146200037557600080fd5b806301f5325514620001e0578063150b7a02146200025e578063178149e7146200029d575b600080fd5b348015620001ed57600080fd5b5062000205620001ff3660046200315a565b620007a4565b604051620002559190600060a0820190508251825260ff6020840151166020830152604083015161ffff808216604085015280606086015116606085015250506080830151608083015292915050565b60405180910390f35b3480156200026b57600080fd5b50620002836200027d3660046200300a565b620009ac565b6040516001600160e01b0319909116815260200162000255565b348015620002aa57600080fd5b50620002c2620002bc3660046200315a565b62000a30565b005b348015620002d157600080fd5b5062000301620002e336600462002fed565b6001600160a01b031660009081526008602052604090205460ff1690565b604051901515815260200162000255565b3480156200031f57600080fd5b50620003376200033136600462003450565b62000b4c565b6040516001600160a01b03909116815260200162000255565b3480156200035d57600080fd5b50620002c26200036f3660046200315a565b62000b78565b3480156200038257600080fd5b506200039a620003943660046200315a565b62000c88565b60405162000255919062003652565b348015620003b657600080fd5b5062000301620003c836600462003128565b60009081526004602052604090205460ff1690565b348015620003ea57600080fd5b506001546001600160a01b031662000337565b3480156200040a57600080fd5b506200045a6200041c36600462003128565b6040805180820190915260008082526020820152506000908152600a6020908152604091829020825180840190935280548352600101549082015290565b6040805182518152602092830151928101929092520162000255565b3480156200048357600080fd5b506200033762000e5e565b3480156200049b57600080fd5b50600b545b60405190815260200162000255565b348015620004bc57600080fd5b50600254640100000000900460ff1660405160ff909116815260200162000255565b348015620004eb57600080fd5b50620002c262000e78565b3480156200050357600080fd5b506000546001600160a01b031662000337565b3480156200052357600080fd5b5060025461ffff165b60405161ffff909116815260200162000255565b3480156200054d57600080fd5b50620002c26200055f3660046200315a565b6200112d565b3480156200057257600080fd5b50620003016200058436600462003128565b60009081526005602052604090205460ff1690565b348015620005a657600080fd5b50620004a0620005b836600462003412565b61ffff1660009081526009602052604090205490565b348015620005db57600080fd5b50600354620004a0565b348015620005f257600080fd5b50620002c2620006043660046200315a565b62001232565b620006216200061b366004620030a8565b62001240565b6040516001600160401b03909116815260200162000255565b3480156200064757600080fd5b506200065f620006593660046200315a565b62001904565b6040516200025591908151815260208083015160ff16908201526040808301519082015260609182015161ffff169181019190915260800190565b348015620006a757600080fd5b5062000301620006b936600462002fed565b6001600160a01b031660009081526006602052604090205460ff1690565b348015620006e457600080fd5b506200030162001ac4565b348015620006fc57600080fd5b50620007146200070e366004620031da565b62001ad8565b604051620002559190620035e9565b3480156200073057600080fd5b5060025462010000900461ffff166200052c565b3480156200075157600080fd5b5062000769620007633660046200315a565b62001b94565b6040516200025591908151815260208083015160ff169082015260408083015161ffff16908201526060918201519181019190915260800190565b6040805160a081018252600080825260208201819052918101829052606081018290526080810182905290620007db838262001d6d565b8252620007ea602082620037d8565b8251909150684e465442726964676514620008585760405162461bcd60e51b815260206004820152602360248201527f696e76616c6964205265676973746572436861696e3a2077726f6e67206d6f64604482015262756c6560e81b60648201526084015b60405180910390fd5b62000864838262001dcf565b60ff16602083015262000879600182620037d8565b9050816020015160ff16600114620008e05760405162461bcd60e51b815260206004820152602360248201527f696e76616c6964205265676973746572436861696e3a2077726f6e672061637460448201526234b7b760e91b60648201526084016200084f565b620008ec838262001e2f565b61ffff16604083015262000902600282620037d8565b905062000910838262001e2f565b61ffff16606083015262000926600282620037d8565b905062000934838262001d6d565b608083015262000946602082620037d8565b905080835114620009a65760405162461bcd60e51b815260206004820152602360248201527f696e76616c6964205265676973746572436861696e3a2077726f6e67206c656e6044820152620cee8d60eb1b60648201526084016200084f565b50919050565b60006001600160a01b038616301462000a1e5760405162461bcd60e51b815260206004820152602d60248201527f63616e206f6e6c792062726964676520746f6b656e7320766961207472616e7360448201526c19995c939195081b595d1a1bd9609a1b60648201526084016200084f565b50630a85bd0160e11b95945050505050565b62000a3a62001ac4565b62000a755760405162461bcd60e51b815260206004820152600a6024820152696e6f74206120666f726b60b01b60448201526064016200084f565b600080600062000a858462001e90565b92509250925081819062000aae5760405162461bcd60e51b81526004016200084f9190620035e9565b5062000abf836101400151620020bf565b600062000ad08460e0015162001904565b90504681604001511462000b1b5760405162461bcd60e51b815260206004820152601160248201527034b73b30b634b21022ab269021b430b4b760791b60448201526064016200084f565b62000b2a8160400151620020da565b60608101516002805461ffff191661ffff9092169190911790555b5050505050565b61ffff91909116600090815260076020908152604080832093835292905220546001600160a01b031690565b62000b8262001ac4565b1562000bc05760405162461bcd60e51b815260206004820152600c60248201526b696e76616c696420666f726b60a01b60448201526064016200084f565b600080600062000bd08462001e90565b92509250925081819062000bf95760405162461bcd60e51b81526004016200084f9190620035e9565b5062000c0a836101400151620020bf565b600062000c1b8460e0015162001b94565b905062000c2b60025461ffff1690565b61ffff16816040015161ffff161462000c785760405162461bcd60e51b815260206004820152600e60248201526d1ddc9bdb99c818da185a5b881a5960921b60448201526064016200084f565b606081015162000b459062002125565b604080516101008101825260008082526020820181905291810182905260608082018390526080820183905260a082015260c0810182905260e08101829052908062000cd5848262001dcf565b905062000ce4600183620037d8565b91508060ff1660011462000d2e5760405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b2102a3930b739b332b960811b60448201526064016200084f565b62000d3a848362001d6d565b835262000d49602083620037d8565b915062000d57848362001e2f565b61ffff16602084015262000d6d600283620037d8565b915062000d7b848362001d6d565b604084015262000d8d602083620037d8565b915062000d9b848362001d6d565b606084015262000dad602083620037d8565b915062000dbb84836200225c565b608084015262000dcd602083620037d8565b915062000ddc600183620037d8565b915062000e0982602284875162000df49190620037f3565b62000e009190620037f3565b869190620022b5565b60a08401528351915062000e1f600283620037f3565b915062000e2d848362001e2f565b61ffff1660e084015262000e43602083620037f3565b915062000e51848362001d6d565b60c0840152509092915050565b600062000e736001546001600160a01b031690565b905090565b600062000eac7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905062000ed1816001600160a01b031660009081526006602052604090205460ff1690565b1562000f165760405162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b60448201526064016200084f565b62000f3f816001600160a01b03166000908152600660205260409020805460ff19166001179055565b60008062000f5060025461ffff1690565b90508061ffff166002141562000f6a57600191506200111d565b8061ffff166004141562000f8257603891506200111d565b8061ffff166005141562000f9a57608991506200111d565b8061ffff166006141562000fb35761a86a91506200111d565b8061ffff166007141562000fcc5761a51691506200111d565b8061ffff166009141562000fe757634e45415291506200111d565b8061ffff16600a141562000fff5760fa91506200111d565b8061ffff16600b141562001018576102ae91506200111d565b8061ffff16600c1415620010315761031391506200111d565b8061ffff16600d14156200104a5761201991506200111d565b8061ffff16600e1415620010635761a4ec91506200111d565b8061ffff16601014156200107c5761050491506200111d565b8061ffff16601114156200109757630e9ac0d691506200111d565b8061ffff1660171415620010b05761a4b191506200111d565b8061ffff1660181415620010c857600a91506200111d565b8061ffff1660191415620010e057606491506200111d565b60405162461bcd60e51b81526020600482015260116024820152702ab735b737bbb71031b430b4b71034b21760791b60448201526064016200084f565b6200112882620020da565b505050565b60008060006200113d8462001e90565b925092509250818190620011665760405162461bcd60e51b81526004016200084f9190620035e9565b5062001177836101400151620020bf565b6000620011888460e00151620007a4565b90506200119860025461ffff1690565b61ffff16816040015161ffff16148015620011ba5750620011b862001ac4565b155b80620011cc5750604081015161ffff16155b6200120d5760405162461bcd60e51b815260206004820152601060248201526f1a5b9d985b1a590818da185a5b881a5960821b60448201526064016200084f565b62000b458160600151826080015161ffff909116600090815260096020526040902055565b6200123d81620023ce565b50565b600080600062001268886001600160a01b031660009081526008602052604090205460ff1690565b156200136257876001600160a01b0316639a8a05926040518163ffffffff1660e01b815260040160206040518083038186803b158015620012a857600080fd5b505afa158015620012bd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620012e3919062003431565b9150876001600160a01b0316633d6c043b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200131f57600080fd5b505afa15801562001334573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200135a919062003141565b90506200152c565b60025461ffff166040516301ffc9a760e01b81526380ac58cd60e01b60048201529092506001600160a01b038916915081906301ffc9a79060240160206040518083038186803b158015620013b657600080fd5b505afa158015620013cb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620013f191906200310b565b620014495760405162461bcd60e51b815260206004820152602160248201527f6d75737420737570706f7274207468652045524337323120696e7465726661636044820152606560f81b60648201526084016200084f565b6040516301ffc9a760e01b8152635b5e139f60e01b60048201526001600160a01b038916906301ffc9a79060240160206040518083038186803b1580156200149057600080fd5b505afa158015620014a5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620014cb91906200310b565b6200152c5760405162461bcd60e51b815260206004820152602a60248201527f6d75737420737570706f727420746865204552433732312d4d657461646174616044820152691032bc3a32b739b4b7b760b11b60648201526084016200084f565b60608060608461ffff16600114620016865760408051600481526024810182526020810180516001600160e01b03166395d89b4160e01b17905290516000916001600160a01b038e1691620015829190620034c9565b600060405180830381855afa9150503d8060008114620015bf576040519150601f19603f3d011682016040523d82523d6000602084013e620015c4565b606091505b5060408051600481526024810182526020810180516001600160e01b03166306fdde0360e01b1790529051919350600092506001600160a01b038f16916200160d9190620034c9565b600060405180830381855afa9150503d80600081146200164a576040519150601f19603f3d011682016040523d82523d6000602084013e6200164f565b606091505b5091505081806020019051810190620016699190620031a4565b945080806020019051810190620016819190620031a4565b935050505b60008b6001600160a01b03168b604051602401620016a691815260200190565b60408051601f198184030181529181526020820180516001600160e01b031663c87b56dd60e01b17905251620016dd9190620034c9565b600060405180830381855afa9150503d80600081146200171a576040519150601f19603f3d011682016040523d82523d6000602084013e6200171f565b606091505b5091505080806020019051810190620017399190620031a4565b9150506000808661ffff1660011415620017b657604080518082018252600080825260209182018190528e8152600a82528281208351808501909452805484526001015491830191909152906020810151815190945092509050620017af8d6000908152600a6020526040812081815560010155565b50620017c3565b5050602083810151908301515b604051632142170760e11b8152336004820152306024820152604481018d90526001600160a01b038e16906342842e0e90606401600060405180830381600087803b1580156200181257600080fd5b505af115801562001827573d6000803e3d6000fd5b505050506200183960025461ffff1690565b61ffff168761ffff1614620018a557604051630852cd8d60e31b8152600481018d90526001600160a01b038e16906342966c6890602401600060405180830381600087803b1580156200188b57600080fd5b505af1158015620018a0573d6000803e3d6000fd5b505050505b620018f36040518061010001604052808881526020018961ffff1681526020018481526020018381526020018e81526020018581526020018c81526020018d61ffff16815250348b620027b2565b9d9c50505050505050505050505050565b60408051608081018252600080825260208201819052918101829052606081018290529062001934838262001d6d565b825262001943602082620037d8565b8251909150684e465442726964676514620019ad5760405162461bcd60e51b8152602060048201526024808201527f696e76616c6964205265636f766572436861696e49643a2077726f6e67206d6f60448201526364756c6560e01b60648201526084016200084f565b620019b9838262001dcf565b60ff166020830152620019ce600182620037d8565b9050816020015160ff1660031462001a355760405162461bcd60e51b8152602060048201526024808201527f696e76616c6964205265636f766572436861696e49643a2077726f6e672061636044820152633a34b7b760e11b60648201526084016200084f565b62001a4183826200225c565b604083015262001a53602082620037d8565b905062001a61838262001e2f565b61ffff16606083015262001a77600282620037d8565b905080835114620009a65760405162461bcd60e51b81526020600482015260166024820152751a5b9d985b1a5908149958dbdd995c90da185a5b925960521b60448201526064016200084f565b60004662001ad1600b5490565b1415905090565b606060c88260a0015151111562001b3d5760405162461bcd60e51b815260206004820152602260248201527f746f6b656e555249206d757374206e6f74206578636565642032303020627974604482015261657360f01b60648201526084016200084f565b81516020808401516040808601516060870151608088015160a0890151805160c08b015160e08c0151965162001b7e9a60019a90999893949391016200351a565b6040516020818303038152906040529050919050565b60408051608081018252600080825260208201819052918101829052606081018290529062001bc4838262001d6d565b825262001bd3602082620037d8565b8251909150684e46544272696467651462001c3f5760405162461bcd60e51b815260206004820152602560248201527f696e76616c69642055706772616465436f6e74726163743a2077726f6e67206d6044820152646f64756c6560d81b60648201526084016200084f565b62001c4b838262001dcf565b60ff16602083015262001c60600182620037d8565b9050816020015160ff1660021462001cc95760405162461bcd60e51b815260206004820152602560248201527f696e76616c69642055706772616465436f6e74726163743a2077726f6e67206160448201526431ba34b7b760d91b60648201526084016200084f565b62001cd5838262001e2f565b61ffff16604083015262001ceb600282620037d8565b905062001cf9838262001d6d565b606083015262001d0b602082620037d8565b905080835114620009a65760405162461bcd60e51b815260206004820152602560248201527f696e76616c69642055706772616465436f6e74726163743a2077726f6e67206c6044820152640cadccee8d60db1b60648201526084016200084f565b600062001d7c826020620037d8565b8351101562001dc65760405162461bcd60e51b8152602060048201526015602482015274746f427974657333325f6f75744f66426f756e647360581b60448201526064016200084f565b50016020015190565b600062001dde826001620037d8565b8351101562001e265760405162461bcd60e51b8152602060048201526013602482015272746f55696e74385f6f75744f66426f756e647360681b60448201526064016200084f565b50016001015190565b600062001e3e826002620037d8565b8351101562001e875760405162461bcd60e51b8152602060048201526014602482015273746f55696e7431365f6f75744f66426f756e647360601b60448201526064016200084f565b50016002015190565b604080516101608101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e08201819052610100820183905261012082015261014081019190915260006060600080600062001f046000546001600160a01b031690565b6001600160a01b031663c0fd8bde886040518263ffffffff1660e01b815260040162001f319190620035e9565b60006040518083038186803b15801562001f4a57600080fd5b505afa15801562001f5f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262001f899190810190620032a3565b9250925092508162001fa25791945092509050620020b8565b60025462010000900461ffff1661ffff16836060015161ffff1614620020005750506040805180820190915260168152753bb937b7339033b7bb32b93730b731b29031b430b4b760511b6020820152909350600092509050620020b8565b6003548360800151146200205357505060408051808201909152601981527f77726f6e6720676f7665726e616e636520636f6e7472616374000000000000006020820152909350600092509050620020b8565b61014083015160009081526004602052604090205460ff16156200209d578260006040518060600160405280602281526020016200424260229139955095509550505050620020b8565b50506040805160208101909152600081529093506001925090505b9193909250565b6000908152600460205260409020805460ff19166001179055565b468114620021205760405162461bcd60e51b81526020600482015260126024820152711a5b9d985b1a5908195d9b50da185a5b925960721b60448201526064016200084f565b600b55565b6000620021597f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905062002166826200287b565b60408051600481526024810182526020810180516001600160e01b031663204a7f0760e21b179052905160009182916001600160a01b03861691620021ab91620034c9565b600060405180830381855af49150503d8060008114620021e8576040519150601f19603f3d011682016040523d82523d6000602084013e620021ed565b606091505b5091509150818190620022155760405162461bcd60e51b81526004016200084f9190620035e9565b50836001600160a01b0316836001600160a01b03167f2e4cc16c100f0b55e2df82ab0b1a7e294aa9cbd01b48fbaf622683fbc0507a4960405160405180910390a350505050565b60006200226b826020620037d8565b8351101562001dc65760405162461bcd60e51b8152602060048201526015602482015274746f55696e743235365f6f75744f66426f756e647360581b60448201526064016200084f565b606081620022c581601f620037d8565b1015620023065760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b60448201526064016200084f565b620023128284620037d8565b84511015620023585760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b60448201526064016200084f565b606082158015620023795760405191506000825260208201604052620023c5565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015620023b45780518352602092830192016200239a565b5050858452601f01601f1916604052505b50949350505050565b6000806000620023e66000546001600160a01b031690565b6001600160a01b031663c0fd8bde856040518263ffffffff1660e01b8152600401620024139190620035e9565b60006040518083038186803b1580156200242c57600080fd5b505afa15801562002441573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526200246b9190810190620032a3565b925092509250818190620024945760405162461bcd60e51b81526004016200084f9190620035e9565b50620024a083620028bd565b620024e05760405162461bcd60e51b815260206004820152600f60248201526e34b73b30b634b21032b6b4ba3a32b960891b60448201526064016200084f565b6000620024f18460e0015162000c88565b90506200251284610140015160009081526005602052604090205460ff1690565b15620025615760405162461bcd60e51b815260206004820152601a60248201527f7472616e7366657220616c726561647920636f6d706c6574656400000000000060448201526064016200084f565b620025868461014001516000908152600560205260409020805460ff19166001179055565b60025461ffff1661ffff168160e0015161ffff1614620025e05760405162461bcd60e51b815260206004820152601460248201527334b73b30b634b2103a30b933b2ba1031b430b4b760611b60448201526064016200084f565b6000620025f060025461ffff1690565b61ffff16826020015161ffff1614156200260d5750805162002658565b6000620026238360200151846000015162000b4c565b90506001600160a01b03811662002655576200265283602001518460000151856060015186604001516200293b565b90505b90505b60c082015160025461ffff1661ffff16836020015161ffff16146200273757826020015161ffff1660011415620026c3576080830151604080518082018252606086015181528186015160208083019182526000948552600a90529190922091518255516001909101555b608083015160a08401516040516334ff261960e21b81526001600160a01b0385169263d3fc986492620026fd9286929190600401620035c0565b600060405180830381600087803b1580156200271857600080fd5b505af11580156200272d573d6000803e3d6000fd5b50505050620027a9565b6080830151604051632142170760e11b81523060048201526001600160a01b0383811660248301526044820192909252908316906342842e0e90606401600060405180830381600087803b1580156200278f57600080fd5b505af1158015620027a4573d6000803e3d6000fd5b505050505b50505050505050565b600080620027c08562001ad8565b9050620027d56000546001600160a01b031690565b6001600160a01b031663b19a437e858584620027fc60025460ff6401000000009091041690565b6040518563ffffffff1660e01b81526004016200281c93929190620036d0565b6020604051808303818588803b1580156200283657600080fd5b505af11580156200284b573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906200287291906200347e565b95945050505050565b620028868162002be8565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6000620028c962001ac4565b15620029075760405162461bcd60e51b815260206004820152600c60248201526b696e76616c696420666f726b60a01b60448201526064016200084f565b6080820151606083015161ffff1660009081526009602052604090205414156200293357506001919050565b506000919050565b60006200294b60025461ffff1690565b61ffff168561ffff161415620029b55760405162461bcd60e51b815260206004820152602860248201527f63616e206f6e6c79207772617020746f6b656e732066726f6d20666f726569676044820152676e20636861696e7360c01b60648201526084016200084f565b6000620029c3868662000b4c565b6001600160a01b03161462002a1b5760405162461bcd60e51b815260206004820152601c60248201527f7772617070656420617373657420616c7265616479206578697374730000000060448201526064016200084f565b8461ffff166001141562002a5d577f576f726d686f6c65204272696467656420536f6c616e612d4e4654000000000092506915d3d49354d41313919560b21b91505b6000627ce50b60e31b62002a718562002c8f565b62002a7c8562002c8f565b30898960405160240162002a95959493929190620035fe565b60408051601f19818403018152918152602080830180516001600160e01b03166001600160e01b0319909516949094179093525190925060009162002adf9130918591016200359a565b604051602081830303815290604052905060006040518060200162002b049062002dca565b601f1982820381018352601f90910116604081905262002b2a91908490602001620034e7565b60408051601f19818403018152908290526001600160f01b031960f08b901b166020830152602282018990529150600090604201604051602081830303815290604052805190602001209050808251602084016000f59450843b62002b8e57600080fd5b61ffff891660009081526007602090815260408083208b8452825280832080546001600160a01b0319166001600160a01b038a16908117909155835260089091529020805460ff1916600117905550505050949350505050565b803b62002c4e5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200084f565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b606060005b60208110801562002cd2575082816020811062002cc157634e487b7160e01b600052603260045260246000fd5b1a60f81b6001600160f81b03191615155b1562002ced578062002ce48162003840565b91505062002c94565b6000816001600160401b0381111562002d1657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801562002d41576020820181803683370190505b50905060005b8281101562002dc25784816020811062002d7157634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811062002d9657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508062002db98162003840565b91505062002d47565b509392505050565b61099380620038af83390190565b600062002def62002de984620037ae565b6200377b565b905082815283838301111562002e0457600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b038116811462002e3357600080fd5b919050565b600082601f83011262002e49578081fd5b815160206001600160401b0382111562002e675762002e6762003874565b62002e77818360051b016200377b565b80838252828201915082860187848660071b890101111562002e97578586fd5b855b8581101562002f0357608080838b03121562002eb3578788fd5b62002ebd62003704565b835181528684015187820152604062002ed881860162002fdb565b90820152606062002eeb85820162002fdb565b90820152855293850193919091019060010162002e99565b5090979650505050505050565b8051801515811462002e3357600080fd5b600082601f83011262002f32578081fd5b815162002f4362002de982620037ae565b81815284602083860101111562002f58578283fd5b62002f6b8260208301602087016200380d565b949350505050565b600082601f83011262002f84578081fd5b62002f958383356020850162002dd8565b9392505050565b803562002e33816200388a565b805162002e33816200388a565b805162002e33816200389b565b80516001600160401b038116811462002e3357600080fd5b805160ff8116811462002e3357600080fd5b60006020828403121562002fff578081fd5b62002f958262002e1b565b60008060008060006080868803121562003022578081fd5b6200302d8662002e1b565b94506200303d6020870162002e1b565b93506040860135925060608601356001600160401b038082111562003060578283fd5b818801915088601f83011262003074578283fd5b81358181111562003083578384fd5b89602082850101111562003095578384fd5b9699959850939650602001949392505050565b600080600080600060a08688031215620030c0578283fd5b620030cb8662002e1b565b9450602086013593506040860135620030e4816200388a565b9250606086013591506080860135620030fd816200389b565b809150509295509295909350565b6000602082840312156200311d578081fd5b62002f958262002f10565b6000602082840312156200313a578081fd5b5035919050565b60006020828403121562003153578081fd5b5051919050565b6000602082840312156200316c578081fd5b81356001600160401b0381111562003182578182fd5b8201601f8101841362003193578182fd5b62002f6b8482356020840162002dd8565b600060208284031215620031b6578081fd5b81516001600160401b03811115620031cc578182fd5b62002f6b8482850162002f21565b600060208284031215620031ec578081fd5b81356001600160401b038082111562003203578283fd5b90830190610100828603121562003218578283fd5b620032226200372f565b82358152620032346020840162002f9c565b602082015260408301356040820152606083013560608201526080830135608082015260a08301358281111562003269578485fd5b620032778782860162002f73565b60a08301525060c083013560c08201526200329560e0840162002f9c565b60e082015295945050505050565b600080600060608486031215620032b8578081fd5b83516001600160401b0380821115620032cf578283fd5b908501906101608288031215620032e4578283fd5b620032ee62003755565b620032f98362002fdb565b8152620033096020840162002fb6565b60208201526200331c6040840162002fb6565b60408201526200332f6060840162002fa9565b6060820152608083015160808201526200334c60a0840162002fc3565b60a08201526200335f60c0840162002fdb565b60c082015260e08301518281111562003376578485fd5b620033848982860162002f21565b60e0830152506101006200339a81850162002fb6565b908201526101208381015183811115620033b2578586fd5b620033c08a82870162002e38565b918301919091525061014083810151908201529450620033e36020870162002f10565b93506040860151915080821115620033f9578283fd5b50620034088682870162002f21565b9150509250925092565b60006020828403121562003424578081fd5b813562002f95816200388a565b60006020828403121562003443578081fd5b815162002f95816200388a565b6000806040838503121562003463578182fd5b823562003470816200388a565b946020939093013593505050565b60006020828403121562003490578081fd5b62002f958262002fc3565b60008151808452620034b58160208601602086016200380d565b601f01601f19169290920160200192915050565b60008251620034dd8184602087016200380d565b9190910192915050565b60008351620034fb8184602088016200380d565b835190830190620035118183602088016200380d565b01949350505050565b600060ff60f81b808d60f81b1683528b600184015261ffff60f01b808c60f01b1660218501528a6023850152896043850152886063850152818860f81b1660838501528651915062003574826084860160208a016200380d565b920160848101949094525060f09190911b1660a482015260a60198975050505050505050565b6001600160a01b038316815260406020820181905260009062002f6b908301846200349b565b60018060a01b03841681528260208201526060604082015260006200287260608301846200349b565b60208152600062002f9560208301846200349b565b60a0815260006200361360a08301886200349b565b82810360208401526200362781886200349b565b6001600160a01b03969096166040840152505061ffff92909216606083015260809091015292915050565b60208152815160208201526000602083015161ffff80821660408501526040850151606085015260608501516080850152608085015160a085015260a085015191506101008060c0860152620036ad6101208601846200349b565b925060c086015160e08601528160e0870151168186015250508091505092915050565b63ffffffff84168152606060208201526000620036f160608301856200349b565b905060ff83166040830152949350505050565b604051608081016001600160401b038111828210171562003729576200372962003874565b60405290565b60405161010081016001600160401b038111828210171562003729576200372962003874565b60405161016081016001600160401b038111828210171562003729576200372962003874565b604051601f8201601f191681016001600160401b0381118282101715620037a657620037a662003874565b604052919050565b60006001600160401b03821115620037ca57620037ca62003874565b50601f01601f191660200190565b60008219821115620037ee57620037ee6200385e565b500190565b6000828210156200380857620038086200385e565b500390565b60005b838110156200382a57818101518382015260200162003810565b838111156200383a576000848401525b50505050565b60006000198214156200385757620038576200385e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b61ffff811681146200123d57600080fd5b63ffffffff811681146200123d57600080fdfe608060405234801561001057600080fd5b5060405161099338038061099383398101604081905261002f9161048e565b818161005c60017fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d51610599565b60008051602061094c8339815191521461008657634e487b7160e01b600052600160045260246000fd5b6100928282600061009b565b505050506105fe565b6100a483610175565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a26000825111806100e55750805b156101705761016e836001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561012657600080fd5b505afa15801561013a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061015e9190610474565b8361031560201b6100291760201c565b505b505050565b6101888161034160201b6100551760201c565b6101e75760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b60648201526084015b60405180910390fd5b61026a816001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561022357600080fd5b505afa158015610237573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025b9190610474565b61034160201b6100551760201c565b6102cf5760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b60648201526084016101de565b806102f460008051602061094c83398151915260001b61034760201b61005b1760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b606061033a838360405180606001604052806027815260200161096c6027913961034a565b9392505050565b3b151590565b90565b6060833b6103a95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016101de565b600080856001600160a01b0316856040516103c4919061054a565b600060405180830381855af49150503d80600081146103ff576040519150601f19603f3d011682016040523d82523d6000602084013e610404565b606091505b50909250905061041582828661041f565b9695505050505050565b6060831561042e57508161033a565b82511561043e5782518084602001fd5b8160405162461bcd60e51b81526004016101de9190610566565b80516001600160a01b038116811461046f57600080fd5b919050565b600060208284031215610485578081fd5b61033a82610458565b600080604083850312156104a0578081fd5b6104a983610458565b60208401519092506001600160401b03808211156104c5578283fd5b818501915085601f8301126104d8578283fd5b8151818111156104ea576104ea6105e8565b604051601f8201601f19908116603f01168101908382118183101715610512576105126105e8565b8160405282815288602084870101111561052a578586fd5b61053b8360208301602088016105bc565b80955050505050509250929050565b6000825161055c8184602087016105bc565b9190910192915050565b60208152600082518060208401526105858160408501602087016105bc565b601f01601f19169190910160400192915050565b6000828210156105b757634e487b7160e01b81526011600452602481fd5b500390565b60005b838110156105d75781810151838201526020016105bf565b8381111561016e5750506000910152565b634e487b7160e01b600052604160045260246000fd5b61033f8061060d6000396000f3fe60806040523661001357610011610017565b005b6100115b61002761002261005e565b610106565b565b606061004e83836040518060600160405280602781526020016102e36027913961012a565b9392505050565b3b151590565b90565b60006100917fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50546001600160a01b031690565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100c957600080fd5b505afa1580156100dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610101919061023c565b905090565b3660008037600080366000845af43d6000803e808015610125573d6000f35b3d6000fd5b6060833b61018e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b0316856040516101a99190610263565b600060405180830381855af49150503d80600081146101e4576040519150601f19603f3d011682016040523d82523d6000602084013e6101e9565b606091505b50915091506101f9828286610203565b9695505050505050565b6060831561021257508161004e565b8251156102225782518084602001fd5b8160405162461bcd60e51b8152600401610185919061027f565b60006020828403121561024d578081fd5b81516001600160a01b038116811461004e578182fd5b600082516102758184602087016102b2565b9190910192915050565b602081526000825180602084015261029e8160408501602087016102b2565b601f01601f19169190910160400192915050565b60005b838110156102cd5781810151838201526020016102b5565b838111156102dc576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220c383d12a666085db2eac57ee60d62a29e11c165ef3006d3555601869d9b9b8eb64736f6c63430008040033a3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564676f7665726e616e636520616374696f6e20616c726561647920636f6e73756d6564a264697066735822122090900c22fa18198cb3b7f7346de57eddb51151efaa077d0c0f82e22e06a8958264736f6c63430008040033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.