Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 15047869 | 826 days ago | IN | 0 ETH | 0.18297102 |
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 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 uint8 finality; uint16 chain = chainId(); // Wormhole chain ids explicitly enumerated if (chain == 2) { finality = 15; // ethereum } else if (chain == 4) { finality = 15; // bsc } else if (chain == 5) { finality = 15; // polygon } else if (chain == 6) { finality = 1; // avalanche } else if (chain == 7) { finality = 1; // oasis } else if (chain == 9) { finality = 1; // aurora } else if (chain == 10) { finality = 1; // fantom } else if (chain == 11) { finality = 1; // karura } else if (chain == 12) { finality = 1; // acala } else if (chain == 13) { finality = 1; // klaytn } else if (chain == 14) { finality = 1; // celo } else if (chain == 16) { finality = 1; // moonbeam } else if (chain == 17) { finality = 32; // neon } else { revert("Unknown chain id."); } setFinality(finality); } 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){ 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 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() || chain.chainId == 0, "invalid chain id"); setBridgeImplementation(chain.emitterChainID, chain.emitterAddress); } // Execute a UpgradeContract governance message function upgrade(bytes memory encodedVM) public { (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)))); } 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"); } }
// 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; } }
// 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; } } 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; } }
// 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":"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":[{"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":"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":[],"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
608060405234801561001057600080fd5b50613d6d806100206000396000f3fe608060405260043610620001675760003560e01c806384acd1bb11620000c5578063c68785191162000078578063c6878519146200053a578063c96616e1146200055f578063d60b347f146200058f578063e6a853e014620005cc578063fbe3c2cd1462000600578063fbeeacd9146200062157600080fd5b806384acd1bb146200043c5780639a8a0592146200045c578063a5799f931462000486578063aa4efa5b14620004ab578063ad66a5f114620004df578063b172b222146200052357600080fd5b80632c3c02a4116200011e5780632c3c02a414620003105780632f3a3d5d14620003445780633ca6482614620003645780635c60da1b14620003dd578063739fc8d114620003f55780638129fc1c146200042457600080fd5b806301f53255146200016c578063150b7a0214620001ea5780631a2be4da14620002295780631ff1e28614620002775780632539464514620002b55780632b51137514620002dc575b600080fd5b3480156200017957600080fd5b50620001916200018b36600462002c2e565b62000681565b604051620001e19190600060a0820190508251825260ff6020840151166020830152604083015161ffff808216604085015280606086015116606085015250506080830151608083015292915050565b60405180910390f35b348015620001f757600080fd5b506200020f6200020936600462002ade565b62000889565b6040516001600160e01b03199091168152602001620001e1565b3480156200023657600080fd5b50620002666200024836600462002ac1565b6001600160a01b031660009081526008602052604090205460ff1690565b6040519015158152602001620001e1565b3480156200028457600080fd5b506200029c6200029636600462002f24565b6200090d565b6040516001600160a01b039091168152602001620001e1565b348015620002c257600080fd5b50620002da620002d436600462002c2e565b62000939565b005b348015620002e957600080fd5b5062000301620002fb36600462002c2e565b62000a1d565b604051620001e1919062003126565b3480156200031d57600080fd5b50620002666200032f36600462002bfc565b60009081526004602052604090205460ff1690565b3480156200035157600080fd5b506001546001600160a01b03166200029c565b3480156200037157600080fd5b50620003c16200038336600462002bfc565b6040805180820190915260008082526020820152506000908152600a6020908152604091829020825180840190935280548352600101549082015290565b60408051825181526020928301519281019290925201620001e1565b348015620003ea57600080fd5b506200029c62000bf3565b3480156200040257600080fd5b50600254640100000000900460ff1660405160ff9091168152602001620001e1565b3480156200043157600080fd5b50620002da62000c0d565b3480156200044957600080fd5b506000546001600160a01b03166200029c565b3480156200046957600080fd5b5060025461ffff165b60405161ffff9091168152602001620001e1565b3480156200049357600080fd5b50620002da620004a536600462002c2e565b62000e7b565b348015620004b857600080fd5b5062000266620004ca36600462002bfc565b60009081526005602052604090205460ff1690565b348015620004ec57600080fd5b5062000514620004fe36600462002ee6565b61ffff1660009081526009602052604090205490565b604051908152602001620001e1565b3480156200053057600080fd5b5060035462000514565b3480156200054757600080fd5b50620002da6200055936600462002c2e565b62000f81565b620005766200057036600462002b7c565b62000f8f565b6040516001600160401b039091168152602001620001e1565b3480156200059c57600080fd5b5062000266620005ae36600462002ac1565b6001600160a01b031660009081526006602052604090205460ff1690565b348015620005d957600080fd5b50620005f1620005eb36600462002cae565b62001653565b604051620001e19190620030bd565b3480156200060d57600080fd5b5060025462010000900461ffff1662000472565b3480156200062e57600080fd5b50620006466200064036600462002c2e565b6200170f565b604051620001e191908151815260208083015160ff169082015260408083015161ffff16908201526060918201519181019190915260800190565b6040805160a081018252600080825260208201819052918101829052606081018290526080810182905290620006b88382620018e8565b8252620006c7602082620032ac565b8251909150684e465442726964676514620007355760405162461bcd60e51b815260206004820152602360248201527f696e76616c6964205265676973746572436861696e3a2077726f6e67206d6f64604482015262756c6560e81b60648201526084015b60405180910390fd5b6200074183826200194a565b60ff16602083015262000756600182620032ac565b9050816020015160ff16600114620007bd5760405162461bcd60e51b815260206004820152602360248201527f696e76616c6964205265676973746572436861696e3a2077726f6e672061637460448201526234b7b760e91b60648201526084016200072c565b620007c98382620019aa565b61ffff166040830152620007df600282620032ac565b9050620007ed8382620019aa565b61ffff16606083015262000803600282620032ac565b9050620008118382620018e8565b608083015262000823602082620032ac565b905080835114620008835760405162461bcd60e51b815260206004820152602360248201527f696e76616c6964205265676973746572436861696e3a2077726f6e67206c656e6044820152620cee8d60eb1b60648201526084016200072c565b50919050565b60006001600160a01b0386163014620008fb5760405162461bcd60e51b815260206004820152602d60248201527f63616e206f6e6c792062726964676520746f6b656e7320766961207472616e7360448201526c19995c939195081b595d1a1bd9609a1b60648201526084016200072c565b50630a85bd0160e11b95945050505050565b61ffff91909116600090815260076020908152604080832093835292905220546001600160a01b031690565b6000806000620009498462001a0b565b925092509250818190620009725760405162461bcd60e51b81526004016200072c9190620030bd565b50620009988361014001516000908152600460205260409020805460ff19166001179055565b6000620009a98460e001516200170f565b9050620009b960025461ffff1690565b61ffff16816040015161ffff161462000a065760405162461bcd60e51b815260206004820152600e60248201526d1ddc9bdb99c818da185a5b881a5960921b60448201526064016200072c565b606081015162000a169062001c3a565b5050505050565b604080516101008101825260008082526020820181905291810182905260608082018390526080820183905260a082015260c0810182905260e08101829052908062000a6a84826200194a565b905062000a79600183620032ac565b91508060ff1660011462000ac35760405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b2102a3930b739b332b960811b60448201526064016200072c565b62000acf8483620018e8565b835262000ade602083620032ac565b915062000aec8483620019aa565b61ffff16602084015262000b02600283620032ac565b915062000b108483620018e8565b604084015262000b22602083620032ac565b915062000b308483620018e8565b606084015262000b42602083620032ac565b915062000b50848362001d71565b608084015262000b62602083620032ac565b915062000b71600183620032ac565b915062000b9e82602284875162000b899190620032c7565b62000b959190620032c7565b86919062001dca565b60a08401528351915062000bb4600283620032c7565b915062000bc28483620019aa565b61ffff1660e084015262000bd8602083620032c7565b915062000be68483620018e8565b60c0840152509092915050565b600062000c086001546001600160a01b031690565b905090565b600062000c417f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905062000c66816001600160a01b031660009081526006602052604090205460ff1690565b1562000cab5760405162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b60448201526064016200072c565b62000cd4816001600160a01b03166000908152600660205260409020805460ff19166001179055565b60008062000ce560025461ffff1690565b90508061ffff166002141562000cff57600f915062000e5c565b8061ffff166004141562000d1757600f915062000e5c565b8061ffff166005141562000d2f57600f915062000e5c565b8061ffff166006141562000d47576001915062000e5c565b8061ffff166007141562000d5f576001915062000e5c565b8061ffff166009141562000d77576001915062000e5c565b8061ffff16600a141562000d8f576001915062000e5c565b8061ffff16600b141562000da7576001915062000e5c565b8061ffff16600c141562000dbf576001915062000e5c565b8061ffff16600d141562000dd7576001915062000e5c565b8061ffff16600e141562000def576001915062000e5c565b8061ffff166010141562000e07576001915062000e5c565b8061ffff166011141562000e1f576020915062000e5c565b60405162461bcd60e51b81526020600482015260116024820152702ab735b737bbb71031b430b4b71034b21760791b60448201526064016200072c565b6002805464ff00000000191664010000000060ff851602179055505050565b600080600062000e8b8462001a0b565b92509250925081819062000eb45760405162461bcd60e51b81526004016200072c9190620030bd565b5062000eda8361014001516000908152600460205260409020805460ff19166001179055565b600062000eeb8460e0015162000681565b905062000efb60025461ffff1690565b61ffff16816040015161ffff16148062000f1b5750604081015161ffff16155b62000f5c5760405162461bcd60e51b815260206004820152601060248201526f1a5b9d985b1a590818da185a5b881a5960821b60448201526064016200072c565b62000a168160600151826080015161ffff909116600090815260096020526040902055565b62000f8c8162001ee3565b50565b600080600062000fb7886001600160a01b031660009081526008602052604090205460ff1690565b15620010b157876001600160a01b0316639a8a05926040518163ffffffff1660e01b815260040160206040518083038186803b15801562000ff757600080fd5b505afa1580156200100c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001032919062002f05565b9150876001600160a01b0316633d6c043b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200106e57600080fd5b505afa15801562001083573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620010a9919062002c15565b90506200127b565b60025461ffff166040516301ffc9a760e01b81526380ac58cd60e01b60048201529092506001600160a01b038916915081906301ffc9a79060240160206040518083038186803b1580156200110557600080fd5b505afa1580156200111a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001140919062002bdf565b620011985760405162461bcd60e51b815260206004820152602160248201527f6d75737420737570706f7274207468652045524337323120696e7465726661636044820152606560f81b60648201526084016200072c565b6040516301ffc9a760e01b8152635b5e139f60e01b60048201526001600160a01b038916906301ffc9a79060240160206040518083038186803b158015620011df57600080fd5b505afa158015620011f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200121a919062002bdf565b6200127b5760405162461bcd60e51b815260206004820152602a60248201527f6d75737420737570706f727420746865204552433732312d4d657461646174616044820152691032bc3a32b739b4b7b760b11b60648201526084016200072c565b60608060608461ffff16600114620013d55760408051600481526024810182526020810180516001600160e01b03166395d89b4160e01b17905290516000916001600160a01b038e1691620012d1919062002f9d565b600060405180830381855afa9150503d80600081146200130e576040519150601f19603f3d011682016040523d82523d6000602084013e62001313565b606091505b5060408051600481526024810182526020810180516001600160e01b03166306fdde0360e01b1790529051919350600092506001600160a01b038f16916200135c919062002f9d565b600060405180830381855afa9150503d806000811462001399576040519150601f19603f3d011682016040523d82523d6000602084013e6200139e565b606091505b5091505081806020019051810190620013b8919062002c78565b945080806020019051810190620013d0919062002c78565b935050505b60008b6001600160a01b03168b604051602401620013f591815260200190565b60408051601f198184030181529181526020820180516001600160e01b031663c87b56dd60e01b179052516200142c919062002f9d565b600060405180830381855afa9150503d806000811462001469576040519150601f19603f3d011682016040523d82523d6000602084013e6200146e565b606091505b509150508080602001905181019062001488919062002c78565b9150506000808661ffff16600114156200150557604080518082018252600080825260209182018190528e8152600a82528281208351808501909452805484526001015491830191909152906020810151815190945092509050620014fe8d6000908152600a6020526040812081815560010155565b5062001512565b5050602083810151908301515b604051632142170760e11b8152336004820152306024820152604481018d90526001600160a01b038e16906342842e0e90606401600060405180830381600087803b1580156200156157600080fd5b505af115801562001576573d6000803e3d6000fd5b505050506200158860025461ffff1690565b61ffff168761ffff1614620015f457604051630852cd8d60e31b8152600481018d90526001600160a01b038e16906342966c6890602401600060405180830381600087803b158015620015da57600080fd5b505af1158015620015ef573d6000803e3d6000fd5b505050505b620016426040518061010001604052808881526020018961ffff1681526020018481526020018381526020018e81526020018581526020018c81526020018d61ffff16815250348b620022c7565b9d9c50505050505050505050505050565b606060c88260a00151511115620016b85760405162461bcd60e51b815260206004820152602260248201527f746f6b656e555249206d757374206e6f74206578636565642032303020627974604482015261657360f01b60648201526084016200072c565b81516020808401516040808601516060870151608088015160a0890151805160c08b015160e08c01519651620016f99a60019a909998939493910162002fee565b6040516020818303038152906040529050919050565b6040805160808101825260008082526020820181905291810182905260608101829052906200173f8382620018e8565b82526200174e602082620032ac565b8251909150684e465442726964676514620017ba5760405162461bcd60e51b815260206004820152602560248201527f696e76616c69642055706772616465436f6e74726163743a2077726f6e67206d6044820152646f64756c6560d81b60648201526084016200072c565b620017c683826200194a565b60ff166020830152620017db600182620032ac565b9050816020015160ff16600214620018445760405162461bcd60e51b815260206004820152602560248201527f696e76616c69642055706772616465436f6e74726163743a2077726f6e67206160448201526431ba34b7b760d91b60648201526084016200072c565b620018508382620019aa565b61ffff16604083015262001866600282620032ac565b9050620018748382620018e8565b606083015262001886602082620032ac565b905080835114620008835760405162461bcd60e51b815260206004820152602560248201527f696e76616c69642055706772616465436f6e74726163743a2077726f6e67206c6044820152640cadccee8d60db1b60648201526084016200072c565b6000620018f7826020620032ac565b83511015620019415760405162461bcd60e51b8152602060048201526015602482015274746f427974657333325f6f75744f66426f756e647360581b60448201526064016200072c565b50016020015190565b600062001959826001620032ac565b83511015620019a15760405162461bcd60e51b8152602060048201526013602482015272746f55696e74385f6f75744f66426f756e647360681b60448201526064016200072c565b50016001015190565b6000620019b9826002620032ac565b8351101562001a025760405162461bcd60e51b8152602060048201526014602482015273746f55696e7431365f6f75744f66426f756e647360601b60448201526064016200072c565b50016002015190565b604080516101608101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e08201819052610100820183905261012082015261014081019190915260006060600080600062001a7f6000546001600160a01b031690565b6001600160a01b031663c0fd8bde886040518263ffffffff1660e01b815260040162001aac9190620030bd565b60006040518083038186803b15801562001ac557600080fd5b505afa15801562001ada573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262001b04919081019062002d77565b9250925092508162001b1d579194509250905062001c33565b60025462010000900461ffff1661ffff16836060015161ffff161462001b7b5750506040805180820190915260168152753bb937b7339033b7bb32b93730b731b29031b430b4b760511b602082015290935060009250905062001c33565b60035483608001511462001bce57505060408051808201909152601981527f77726f6e6720676f7665726e616e636520636f6e747261637400000000000000602082015290935060009250905062001c33565b61014083015160009081526004602052604090205460ff161562001c185782600060405180606001604052806022815260200162003d166022913995509550955050505062001c33565b50506040805160208101909152600081529093506001925090505b9193909250565b600062001c6e7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905062001c7b8262002390565b60408051600481526024810182526020810180516001600160e01b031663204a7f0760e21b179052905160009182916001600160a01b0386169162001cc09162002f9d565b600060405180830381855af49150503d806000811462001cfd576040519150601f19603f3d011682016040523d82523d6000602084013e62001d02565b606091505b509150915081819062001d2a5760405162461bcd60e51b81526004016200072c9190620030bd565b50836001600160a01b0316836001600160a01b03167f2e4cc16c100f0b55e2df82ab0b1a7e294aa9cbd01b48fbaf622683fbc0507a4960405160405180910390a350505050565b600062001d80826020620032ac565b83511015620019415760405162461bcd60e51b8152602060048201526015602482015274746f55696e743235365f6f75744f66426f756e647360581b60448201526064016200072c565b60608162001dda81601f620032ac565b101562001e1b5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b60448201526064016200072c565b62001e278284620032ac565b8451101562001e6d5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b60448201526064016200072c565b60608215801562001e8e576040519150600082526020820160405262001eda565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101562001ec957805183526020928301920162001eaf565b5050858452601f01601f1916604052505b50949350505050565b600080600062001efb6000546001600160a01b031690565b6001600160a01b031663c0fd8bde856040518263ffffffff1660e01b815260040162001f289190620030bd565b60006040518083038186803b15801562001f4157600080fd5b505afa15801562001f56573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262001f80919081019062002d77565b92509250925081819062001fa95760405162461bcd60e51b81526004016200072c9190620030bd565b5062001fb583620023d2565b62001ff55760405162461bcd60e51b815260206004820152600f60248201526e34b73b30b634b21032b6b4ba3a32b960891b60448201526064016200072c565b6000620020068460e0015162000a1d565b90506200202784610140015160009081526005602052604090205460ff1690565b15620020765760405162461bcd60e51b815260206004820152601a60248201527f7472616e7366657220616c726561647920636f6d706c6574656400000000000060448201526064016200072c565b6200209b8461014001516000908152600560205260409020805460ff19166001179055565b60025461ffff1661ffff168160e0015161ffff1614620020f55760405162461bcd60e51b815260206004820152601460248201527334b73b30b634b2103a30b933b2ba1031b430b4b760611b60448201526064016200072c565b60006200210560025461ffff1690565b61ffff16826020015161ffff16141562002122575080516200216d565b600062002138836020015184600001516200090d565b90506001600160a01b0381166200216a576200216783602001518460000151856060015186604001516200240f565b90505b90505b60c082015160025461ffff1661ffff16836020015161ffff16146200224c57826020015161ffff1660011415620021d8576080830151604080518082018252606086015181528186015160208083019182526000948552600a90529190922091518255516001909101555b608083015160a08401516040516334ff261960e21b81526001600160a01b0385169263d3fc98649262002212928692919060040162003094565b600060405180830381600087803b1580156200222d57600080fd5b505af115801562002242573d6000803e3d6000fd5b50505050620022be565b6080830151604051632142170760e11b81523060048201526001600160a01b0383811660248301526044820192909252908316906342842e0e90606401600060405180830381600087803b158015620022a457600080fd5b505af1158015620022b9573d6000803e3d6000fd5b505050505b50505050505050565b600080620022d58562001653565b9050620022ea6000546001600160a01b031690565b6001600160a01b031663b19a437e8585846200231160025460ff6401000000009091041690565b6040518563ffffffff1660e01b81526004016200233193929190620031a4565b6020604051808303818588803b1580156200234b57600080fd5b505af115801562002360573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019062002387919062002f52565b95945050505050565b6200239b81620026bc565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60008160800151620023f8836060015161ffff1660009081526009602052604090205490565b14156200240757506001919050565b506000919050565b60006200241f60025461ffff1690565b61ffff168561ffff161415620024895760405162461bcd60e51b815260206004820152602860248201527f63616e206f6e6c79207772617020746f6b656e732066726f6d20666f726569676044820152676e20636861696e7360c01b60648201526084016200072c565b60006200249786866200090d565b6001600160a01b031614620024ef5760405162461bcd60e51b815260206004820152601c60248201527f7772617070656420617373657420616c7265616479206578697374730000000060448201526064016200072c565b8461ffff166001141562002531577f576f726d686f6c65204272696467656420536f6c616e612d4e4654000000000092506915d3d49354d41313919560b21b91505b6000627ce50b60e31b620025458562002763565b620025508562002763565b30898960405160240162002569959493929190620030d2565b60408051601f19818403018152918152602080830180516001600160e01b03166001600160e01b03199095169490941790935251909250600091620025b39130918591016200306e565b6040516020818303038152906040529050600060405180602001620025d8906200289e565b601f1982820381018352601f909101166040819052620025fe9190849060200162002fbb565b60408051601f19818403018152908290526001600160f01b031960f08b901b166020830152602282018990529150600090604201604051602081830303815290604052805190602001209050808251602084016000f59450843b6200266257600080fd5b61ffff891660009081526007602090815260408083208b8452825280832080546001600160a01b0319166001600160a01b038a16908117909155835260089091529020805460ff1916600117905550505050949350505050565b803b620027225760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200072c565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b606060005b602081108015620027a657508281602081106200279557634e487b7160e01b600052603260045260246000fd5b1a60f81b6001600160f81b03191615155b15620027c15780620027b88162003314565b91505062002768565b6000816001600160401b03811115620027ea57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801562002815576020820181803683370190505b50905060005b8281101562002896578481602081106200284557634e487b7160e01b600052603260045260246000fd5b1a60f81b8282815181106200286a57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350806200288d8162003314565b9150506200281b565b509392505050565b610993806200338383390190565b6000620028c3620028bd8462003282565b6200324f565b9050828152838383011115620028d857600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146200290757600080fd5b919050565b600082601f8301126200291d578081fd5b815160206001600160401b038211156200293b576200293b62003348565b6200294b818360051b016200324f565b80838252828201915082860187848660071b89010111156200296b578586fd5b855b85811015620029d757608080838b03121562002987578788fd5b62002991620031d8565b8351815286840151878201526040620029ac81860162002aaf565b908201526060620029bf85820162002aaf565b9082015285529385019391909101906001016200296d565b5090979650505050505050565b805180151581146200290757600080fd5b600082601f83011262002a06578081fd5b815162002a17620028bd8262003282565b81815284602083860101111562002a2c578283fd5b62002a3f826020830160208701620032e1565b949350505050565b600082601f83011262002a58578081fd5b62002a6983833560208501620028ac565b9392505050565b803562002907816200335e565b805162002907816200335e565b805162002907816200336f565b80516001600160401b03811681146200290757600080fd5b805160ff811681146200290757600080fd5b60006020828403121562002ad3578081fd5b62002a6982620028ef565b60008060008060006080868803121562002af6578081fd5b62002b0186620028ef565b945062002b1160208701620028ef565b93506040860135925060608601356001600160401b038082111562002b34578283fd5b818801915088601f83011262002b48578283fd5b81358181111562002b57578384fd5b89602082850101111562002b69578384fd5b9699959850939650602001949392505050565b600080600080600060a0868803121562002b94578283fd5b62002b9f86620028ef565b945060208601359350604086013562002bb8816200335e565b925060608601359150608086013562002bd1816200336f565b809150509295509295909350565b60006020828403121562002bf1578081fd5b62002a6982620029e4565b60006020828403121562002c0e578081fd5b5035919050565b60006020828403121562002c27578081fd5b5051919050565b60006020828403121562002c40578081fd5b81356001600160401b0381111562002c56578182fd5b8201601f8101841362002c67578182fd5b62002a3f84823560208401620028ac565b60006020828403121562002c8a578081fd5b81516001600160401b0381111562002ca0578182fd5b62002a3f84828501620029f5565b60006020828403121562002cc0578081fd5b81356001600160401b038082111562002cd7578283fd5b90830190610100828603121562002cec578283fd5b62002cf662003203565b8235815262002d086020840162002a70565b602082015260408301356040820152606083013560608201526080830135608082015260a08301358281111562002d3d578485fd5b62002d4b8782860162002a47565b60a08301525060c083013560c082015262002d6960e0840162002a70565b60e082015295945050505050565b60008060006060848603121562002d8c578081fd5b83516001600160401b038082111562002da3578283fd5b90850190610160828803121562002db8578283fd5b62002dc262003229565b62002dcd8362002aaf565b815262002ddd6020840162002a8a565b602082015262002df06040840162002a8a565b604082015262002e036060840162002a7d565b60608201526080830151608082015262002e2060a0840162002a97565b60a082015262002e3360c0840162002aaf565b60c082015260e08301518281111562002e4a578485fd5b62002e5889828601620029f5565b60e08301525061010062002e6e81850162002a8a565b90820152610120838101518381111562002e86578586fd5b62002e948a8287016200290c565b91830191909152506101408381015190820152945062002eb760208701620029e4565b9350604086015191508082111562002ecd578283fd5b5062002edc86828701620029f5565b9150509250925092565b60006020828403121562002ef8578081fd5b813562002a69816200335e565b60006020828403121562002f17578081fd5b815162002a69816200335e565b6000806040838503121562002f37578182fd5b823562002f44816200335e565b946020939093013593505050565b60006020828403121562002f64578081fd5b62002a698262002a97565b6000815180845262002f89816020860160208601620032e1565b601f01601f19169290920160200192915050565b6000825162002fb1818460208701620032e1565b9190910192915050565b6000835162002fcf818460208801620032e1565b83519083019062002fe5818360208801620032e1565b01949350505050565b600060ff60f81b808d60f81b1683528b600184015261ffff60f01b808c60f01b1660218501528a6023850152896043850152886063850152818860f81b1660838501528651915062003048826084860160208a01620032e1565b920160848101949094525060f09190911b1660a482015260a60198975050505050505050565b6001600160a01b038316815260406020820181905260009062002a3f9083018462002f6f565b60018060a01b038416815282602082015260606040820152600062002387606083018462002f6f565b60208152600062002a69602083018462002f6f565b60a081526000620030e760a083018862002f6f565b8281036020840152620030fb818862002f6f565b6001600160a01b03969096166040840152505061ffff92909216606083015260809091015292915050565b60208152815160208201526000602083015161ffff80821660408501526040850151606085015260608501516080850152608085015160a085015260a085015191506101008060c08601526200318161012086018462002f6f565b925060c086015160e08601528160e0870151168186015250508091505092915050565b63ffffffff84168152606060208201526000620031c5606083018562002f6f565b905060ff83166040830152949350505050565b604051608081016001600160401b0381118282101715620031fd57620031fd62003348565b60405290565b60405161010081016001600160401b0381118282101715620031fd57620031fd62003348565b60405161016081016001600160401b0381118282101715620031fd57620031fd62003348565b604051601f8201601f191681016001600160401b03811182821017156200327a576200327a62003348565b604052919050565b60006001600160401b038211156200329e576200329e62003348565b50601f01601f191660200190565b60008219821115620032c257620032c262003332565b500190565b600082821015620032dc57620032dc62003332565b500390565b60005b83811015620032fe578181015183820152602001620032e4565b838111156200330e576000848401525b50505050565b60006000198214156200332b576200332b62003332565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b61ffff8116811462000f8c57600080fd5b63ffffffff8116811462000f8c57600080fdfe608060405234801561001057600080fd5b5060405161099338038061099383398101604081905261002f9161048e565b818161005c60017fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d51610599565b60008051602061094c8339815191521461008657634e487b7160e01b600052600160045260246000fd5b6100928282600061009b565b505050506105fe565b6100a483610175565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a26000825111806100e55750805b156101705761016e836001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561012657600080fd5b505afa15801561013a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061015e9190610474565b8361031560201b6100291760201c565b505b505050565b6101888161034160201b6100551760201c565b6101e75760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b60648201526084015b60405180910390fd5b61026a816001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561022357600080fd5b505afa158015610237573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025b9190610474565b61034160201b6100551760201c565b6102cf5760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b60648201526084016101de565b806102f460008051602061094c83398151915260001b61034760201b61005b1760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b606061033a838360405180606001604052806027815260200161096c6027913961034a565b9392505050565b3b151590565b90565b6060833b6103a95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016101de565b600080856001600160a01b0316856040516103c4919061054a565b600060405180830381855af49150503d80600081146103ff576040519150601f19603f3d011682016040523d82523d6000602084013e610404565b606091505b50909250905061041582828661041f565b9695505050505050565b6060831561042e57508161033a565b82511561043e5782518084602001fd5b8160405162461bcd60e51b81526004016101de9190610566565b80516001600160a01b038116811461046f57600080fd5b919050565b600060208284031215610485578081fd5b61033a82610458565b600080604083850312156104a0578081fd5b6104a983610458565b60208401519092506001600160401b03808211156104c5578283fd5b818501915085601f8301126104d8578283fd5b8151818111156104ea576104ea6105e8565b604051601f8201601f19908116603f01168101908382118183101715610512576105126105e8565b8160405282815288602084870101111561052a578586fd5b61053b8360208301602088016105bc565b80955050505050509250929050565b6000825161055c8184602087016105bc565b9190910192915050565b60208152600082518060208401526105858160408501602087016105bc565b601f01601f19169190910160400192915050565b6000828210156105b757634e487b7160e01b81526011600452602481fd5b500390565b60005b838110156105d75781810151838201526020016105bf565b8381111561016e5750506000910152565b634e487b7160e01b600052604160045260246000fd5b61033f8061060d6000396000f3fe60806040523661001357610011610017565b005b6100115b61002761002261005e565b610106565b565b606061004e83836040518060600160405280602781526020016102e36027913961012a565b9392505050565b3b151590565b90565b60006100917fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50546001600160a01b031690565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100c957600080fd5b505afa1580156100dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610101919061023c565b905090565b3660008037600080366000845af43d6000803e808015610125573d6000f35b3d6000fd5b6060833b61018e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b0316856040516101a99190610263565b600060405180830381855af49150503d80600081146101e4576040519150601f19603f3d011682016040523d82523d6000602084013e6101e9565b606091505b50915091506101f9828286610203565b9695505050505050565b6060831561021257508161004e565b8251156102225782518084602001fd5b8160405162461bcd60e51b8152600401610185919061027f565b60006020828403121561024d578081fd5b81516001600160a01b038116811461004e578182fd5b600082516102758184602087016102b2565b9190910192915050565b602081526000825180602084015261029e8160408501602087016102b2565b601f01601f19169190910160400192915050565b60005b838110156102cd5781810151838201526020016102b5565b838111156102dc576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220c383d12a666085db2eac57ee60d62a29e11c165ef3006d3555601869d9b9b8eb64736f6c63430008040033a3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564676f7665726e616e636520616374696f6e20616c726561647920636f6e73756d6564a26469706673582212209fec54cc34b65fa7bdf8088122f1c1b4f9e642d4766812e4c7e45295686a5a4964736f6c63430008040033
Deployed Bytecode
0x608060405260043610620001675760003560e01c806384acd1bb11620000c5578063c68785191162000078578063c6878519146200053a578063c96616e1146200055f578063d60b347f146200058f578063e6a853e014620005cc578063fbe3c2cd1462000600578063fbeeacd9146200062157600080fd5b806384acd1bb146200043c5780639a8a0592146200045c578063a5799f931462000486578063aa4efa5b14620004ab578063ad66a5f114620004df578063b172b222146200052357600080fd5b80632c3c02a4116200011e5780632c3c02a414620003105780632f3a3d5d14620003445780633ca6482614620003645780635c60da1b14620003dd578063739fc8d114620003f55780638129fc1c146200042457600080fd5b806301f53255146200016c578063150b7a0214620001ea5780631a2be4da14620002295780631ff1e28614620002775780632539464514620002b55780632b51137514620002dc575b600080fd5b3480156200017957600080fd5b50620001916200018b36600462002c2e565b62000681565b604051620001e19190600060a0820190508251825260ff6020840151166020830152604083015161ffff808216604085015280606086015116606085015250506080830151608083015292915050565b60405180910390f35b348015620001f757600080fd5b506200020f6200020936600462002ade565b62000889565b6040516001600160e01b03199091168152602001620001e1565b3480156200023657600080fd5b50620002666200024836600462002ac1565b6001600160a01b031660009081526008602052604090205460ff1690565b6040519015158152602001620001e1565b3480156200028457600080fd5b506200029c6200029636600462002f24565b6200090d565b6040516001600160a01b039091168152602001620001e1565b348015620002c257600080fd5b50620002da620002d436600462002c2e565b62000939565b005b348015620002e957600080fd5b5062000301620002fb36600462002c2e565b62000a1d565b604051620001e1919062003126565b3480156200031d57600080fd5b50620002666200032f36600462002bfc565b60009081526004602052604090205460ff1690565b3480156200035157600080fd5b506001546001600160a01b03166200029c565b3480156200037157600080fd5b50620003c16200038336600462002bfc565b6040805180820190915260008082526020820152506000908152600a6020908152604091829020825180840190935280548352600101549082015290565b60408051825181526020928301519281019290925201620001e1565b348015620003ea57600080fd5b506200029c62000bf3565b3480156200040257600080fd5b50600254640100000000900460ff1660405160ff9091168152602001620001e1565b3480156200043157600080fd5b50620002da62000c0d565b3480156200044957600080fd5b506000546001600160a01b03166200029c565b3480156200046957600080fd5b5060025461ffff165b60405161ffff9091168152602001620001e1565b3480156200049357600080fd5b50620002da620004a536600462002c2e565b62000e7b565b348015620004b857600080fd5b5062000266620004ca36600462002bfc565b60009081526005602052604090205460ff1690565b348015620004ec57600080fd5b5062000514620004fe36600462002ee6565b61ffff1660009081526009602052604090205490565b604051908152602001620001e1565b3480156200053057600080fd5b5060035462000514565b3480156200054757600080fd5b50620002da6200055936600462002c2e565b62000f81565b620005766200057036600462002b7c565b62000f8f565b6040516001600160401b039091168152602001620001e1565b3480156200059c57600080fd5b5062000266620005ae36600462002ac1565b6001600160a01b031660009081526006602052604090205460ff1690565b348015620005d957600080fd5b50620005f1620005eb36600462002cae565b62001653565b604051620001e19190620030bd565b3480156200060d57600080fd5b5060025462010000900461ffff1662000472565b3480156200062e57600080fd5b50620006466200064036600462002c2e565b6200170f565b604051620001e191908151815260208083015160ff169082015260408083015161ffff16908201526060918201519181019190915260800190565b6040805160a081018252600080825260208201819052918101829052606081018290526080810182905290620006b88382620018e8565b8252620006c7602082620032ac565b8251909150684e465442726964676514620007355760405162461bcd60e51b815260206004820152602360248201527f696e76616c6964205265676973746572436861696e3a2077726f6e67206d6f64604482015262756c6560e81b60648201526084015b60405180910390fd5b6200074183826200194a565b60ff16602083015262000756600182620032ac565b9050816020015160ff16600114620007bd5760405162461bcd60e51b815260206004820152602360248201527f696e76616c6964205265676973746572436861696e3a2077726f6e672061637460448201526234b7b760e91b60648201526084016200072c565b620007c98382620019aa565b61ffff166040830152620007df600282620032ac565b9050620007ed8382620019aa565b61ffff16606083015262000803600282620032ac565b9050620008118382620018e8565b608083015262000823602082620032ac565b905080835114620008835760405162461bcd60e51b815260206004820152602360248201527f696e76616c6964205265676973746572436861696e3a2077726f6e67206c656e6044820152620cee8d60eb1b60648201526084016200072c565b50919050565b60006001600160a01b0386163014620008fb5760405162461bcd60e51b815260206004820152602d60248201527f63616e206f6e6c792062726964676520746f6b656e7320766961207472616e7360448201526c19995c939195081b595d1a1bd9609a1b60648201526084016200072c565b50630a85bd0160e11b95945050505050565b61ffff91909116600090815260076020908152604080832093835292905220546001600160a01b031690565b6000806000620009498462001a0b565b925092509250818190620009725760405162461bcd60e51b81526004016200072c9190620030bd565b50620009988361014001516000908152600460205260409020805460ff19166001179055565b6000620009a98460e001516200170f565b9050620009b960025461ffff1690565b61ffff16816040015161ffff161462000a065760405162461bcd60e51b815260206004820152600e60248201526d1ddc9bdb99c818da185a5b881a5960921b60448201526064016200072c565b606081015162000a169062001c3a565b5050505050565b604080516101008101825260008082526020820181905291810182905260608082018390526080820183905260a082015260c0810182905260e08101829052908062000a6a84826200194a565b905062000a79600183620032ac565b91508060ff1660011462000ac35760405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b2102a3930b739b332b960811b60448201526064016200072c565b62000acf8483620018e8565b835262000ade602083620032ac565b915062000aec8483620019aa565b61ffff16602084015262000b02600283620032ac565b915062000b108483620018e8565b604084015262000b22602083620032ac565b915062000b308483620018e8565b606084015262000b42602083620032ac565b915062000b50848362001d71565b608084015262000b62602083620032ac565b915062000b71600183620032ac565b915062000b9e82602284875162000b899190620032c7565b62000b959190620032c7565b86919062001dca565b60a08401528351915062000bb4600283620032c7565b915062000bc28483620019aa565b61ffff1660e084015262000bd8602083620032c7565b915062000be68483620018e8565b60c0840152509092915050565b600062000c086001546001600160a01b031690565b905090565b600062000c417f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905062000c66816001600160a01b031660009081526006602052604090205460ff1690565b1562000cab5760405162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b60448201526064016200072c565b62000cd4816001600160a01b03166000908152600660205260409020805460ff19166001179055565b60008062000ce560025461ffff1690565b90508061ffff166002141562000cff57600f915062000e5c565b8061ffff166004141562000d1757600f915062000e5c565b8061ffff166005141562000d2f57600f915062000e5c565b8061ffff166006141562000d47576001915062000e5c565b8061ffff166007141562000d5f576001915062000e5c565b8061ffff166009141562000d77576001915062000e5c565b8061ffff16600a141562000d8f576001915062000e5c565b8061ffff16600b141562000da7576001915062000e5c565b8061ffff16600c141562000dbf576001915062000e5c565b8061ffff16600d141562000dd7576001915062000e5c565b8061ffff16600e141562000def576001915062000e5c565b8061ffff166010141562000e07576001915062000e5c565b8061ffff166011141562000e1f576020915062000e5c565b60405162461bcd60e51b81526020600482015260116024820152702ab735b737bbb71031b430b4b71034b21760791b60448201526064016200072c565b6002805464ff00000000191664010000000060ff851602179055505050565b600080600062000e8b8462001a0b565b92509250925081819062000eb45760405162461bcd60e51b81526004016200072c9190620030bd565b5062000eda8361014001516000908152600460205260409020805460ff19166001179055565b600062000eeb8460e0015162000681565b905062000efb60025461ffff1690565b61ffff16816040015161ffff16148062000f1b5750604081015161ffff16155b62000f5c5760405162461bcd60e51b815260206004820152601060248201526f1a5b9d985b1a590818da185a5b881a5960821b60448201526064016200072c565b62000a168160600151826080015161ffff909116600090815260096020526040902055565b62000f8c8162001ee3565b50565b600080600062000fb7886001600160a01b031660009081526008602052604090205460ff1690565b15620010b157876001600160a01b0316639a8a05926040518163ffffffff1660e01b815260040160206040518083038186803b15801562000ff757600080fd5b505afa1580156200100c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001032919062002f05565b9150876001600160a01b0316633d6c043b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200106e57600080fd5b505afa15801562001083573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620010a9919062002c15565b90506200127b565b60025461ffff166040516301ffc9a760e01b81526380ac58cd60e01b60048201529092506001600160a01b038916915081906301ffc9a79060240160206040518083038186803b1580156200110557600080fd5b505afa1580156200111a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001140919062002bdf565b620011985760405162461bcd60e51b815260206004820152602160248201527f6d75737420737570706f7274207468652045524337323120696e7465726661636044820152606560f81b60648201526084016200072c565b6040516301ffc9a760e01b8152635b5e139f60e01b60048201526001600160a01b038916906301ffc9a79060240160206040518083038186803b158015620011df57600080fd5b505afa158015620011f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200121a919062002bdf565b6200127b5760405162461bcd60e51b815260206004820152602a60248201527f6d75737420737570706f727420746865204552433732312d4d657461646174616044820152691032bc3a32b739b4b7b760b11b60648201526084016200072c565b60608060608461ffff16600114620013d55760408051600481526024810182526020810180516001600160e01b03166395d89b4160e01b17905290516000916001600160a01b038e1691620012d1919062002f9d565b600060405180830381855afa9150503d80600081146200130e576040519150601f19603f3d011682016040523d82523d6000602084013e62001313565b606091505b5060408051600481526024810182526020810180516001600160e01b03166306fdde0360e01b1790529051919350600092506001600160a01b038f16916200135c919062002f9d565b600060405180830381855afa9150503d806000811462001399576040519150601f19603f3d011682016040523d82523d6000602084013e6200139e565b606091505b5091505081806020019051810190620013b8919062002c78565b945080806020019051810190620013d0919062002c78565b935050505b60008b6001600160a01b03168b604051602401620013f591815260200190565b60408051601f198184030181529181526020820180516001600160e01b031663c87b56dd60e01b179052516200142c919062002f9d565b600060405180830381855afa9150503d806000811462001469576040519150601f19603f3d011682016040523d82523d6000602084013e6200146e565b606091505b509150508080602001905181019062001488919062002c78565b9150506000808661ffff16600114156200150557604080518082018252600080825260209182018190528e8152600a82528281208351808501909452805484526001015491830191909152906020810151815190945092509050620014fe8d6000908152600a6020526040812081815560010155565b5062001512565b5050602083810151908301515b604051632142170760e11b8152336004820152306024820152604481018d90526001600160a01b038e16906342842e0e90606401600060405180830381600087803b1580156200156157600080fd5b505af115801562001576573d6000803e3d6000fd5b505050506200158860025461ffff1690565b61ffff168761ffff1614620015f457604051630852cd8d60e31b8152600481018d90526001600160a01b038e16906342966c6890602401600060405180830381600087803b158015620015da57600080fd5b505af1158015620015ef573d6000803e3d6000fd5b505050505b620016426040518061010001604052808881526020018961ffff1681526020018481526020018381526020018e81526020018581526020018c81526020018d61ffff16815250348b620022c7565b9d9c50505050505050505050505050565b606060c88260a00151511115620016b85760405162461bcd60e51b815260206004820152602260248201527f746f6b656e555249206d757374206e6f74206578636565642032303020627974604482015261657360f01b60648201526084016200072c565b81516020808401516040808601516060870151608088015160a0890151805160c08b015160e08c01519651620016f99a60019a909998939493910162002fee565b6040516020818303038152906040529050919050565b6040805160808101825260008082526020820181905291810182905260608101829052906200173f8382620018e8565b82526200174e602082620032ac565b8251909150684e465442726964676514620017ba5760405162461bcd60e51b815260206004820152602560248201527f696e76616c69642055706772616465436f6e74726163743a2077726f6e67206d6044820152646f64756c6560d81b60648201526084016200072c565b620017c683826200194a565b60ff166020830152620017db600182620032ac565b9050816020015160ff16600214620018445760405162461bcd60e51b815260206004820152602560248201527f696e76616c69642055706772616465436f6e74726163743a2077726f6e67206160448201526431ba34b7b760d91b60648201526084016200072c565b620018508382620019aa565b61ffff16604083015262001866600282620032ac565b9050620018748382620018e8565b606083015262001886602082620032ac565b905080835114620008835760405162461bcd60e51b815260206004820152602560248201527f696e76616c69642055706772616465436f6e74726163743a2077726f6e67206c6044820152640cadccee8d60db1b60648201526084016200072c565b6000620018f7826020620032ac565b83511015620019415760405162461bcd60e51b8152602060048201526015602482015274746f427974657333325f6f75744f66426f756e647360581b60448201526064016200072c565b50016020015190565b600062001959826001620032ac565b83511015620019a15760405162461bcd60e51b8152602060048201526013602482015272746f55696e74385f6f75744f66426f756e647360681b60448201526064016200072c565b50016001015190565b6000620019b9826002620032ac565b8351101562001a025760405162461bcd60e51b8152602060048201526014602482015273746f55696e7431365f6f75744f66426f756e647360601b60448201526064016200072c565b50016002015190565b604080516101608101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e08201819052610100820183905261012082015261014081019190915260006060600080600062001a7f6000546001600160a01b031690565b6001600160a01b031663c0fd8bde886040518263ffffffff1660e01b815260040162001aac9190620030bd565b60006040518083038186803b15801562001ac557600080fd5b505afa15801562001ada573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262001b04919081019062002d77565b9250925092508162001b1d579194509250905062001c33565b60025462010000900461ffff1661ffff16836060015161ffff161462001b7b5750506040805180820190915260168152753bb937b7339033b7bb32b93730b731b29031b430b4b760511b602082015290935060009250905062001c33565b60035483608001511462001bce57505060408051808201909152601981527f77726f6e6720676f7665726e616e636520636f6e747261637400000000000000602082015290935060009250905062001c33565b61014083015160009081526004602052604090205460ff161562001c185782600060405180606001604052806022815260200162003d166022913995509550955050505062001c33565b50506040805160208101909152600081529093506001925090505b9193909250565b600062001c6e7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905062001c7b8262002390565b60408051600481526024810182526020810180516001600160e01b031663204a7f0760e21b179052905160009182916001600160a01b0386169162001cc09162002f9d565b600060405180830381855af49150503d806000811462001cfd576040519150601f19603f3d011682016040523d82523d6000602084013e62001d02565b606091505b509150915081819062001d2a5760405162461bcd60e51b81526004016200072c9190620030bd565b50836001600160a01b0316836001600160a01b03167f2e4cc16c100f0b55e2df82ab0b1a7e294aa9cbd01b48fbaf622683fbc0507a4960405160405180910390a350505050565b600062001d80826020620032ac565b83511015620019415760405162461bcd60e51b8152602060048201526015602482015274746f55696e743235365f6f75744f66426f756e647360581b60448201526064016200072c565b60608162001dda81601f620032ac565b101562001e1b5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b60448201526064016200072c565b62001e278284620032ac565b8451101562001e6d5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b60448201526064016200072c565b60608215801562001e8e576040519150600082526020820160405262001eda565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101562001ec957805183526020928301920162001eaf565b5050858452601f01601f1916604052505b50949350505050565b600080600062001efb6000546001600160a01b031690565b6001600160a01b031663c0fd8bde856040518263ffffffff1660e01b815260040162001f289190620030bd565b60006040518083038186803b15801562001f4157600080fd5b505afa15801562001f56573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262001f80919081019062002d77565b92509250925081819062001fa95760405162461bcd60e51b81526004016200072c9190620030bd565b5062001fb583620023d2565b62001ff55760405162461bcd60e51b815260206004820152600f60248201526e34b73b30b634b21032b6b4ba3a32b960891b60448201526064016200072c565b6000620020068460e0015162000a1d565b90506200202784610140015160009081526005602052604090205460ff1690565b15620020765760405162461bcd60e51b815260206004820152601a60248201527f7472616e7366657220616c726561647920636f6d706c6574656400000000000060448201526064016200072c565b6200209b8461014001516000908152600560205260409020805460ff19166001179055565b60025461ffff1661ffff168160e0015161ffff1614620020f55760405162461bcd60e51b815260206004820152601460248201527334b73b30b634b2103a30b933b2ba1031b430b4b760611b60448201526064016200072c565b60006200210560025461ffff1690565b61ffff16826020015161ffff16141562002122575080516200216d565b600062002138836020015184600001516200090d565b90506001600160a01b0381166200216a576200216783602001518460000151856060015186604001516200240f565b90505b90505b60c082015160025461ffff1661ffff16836020015161ffff16146200224c57826020015161ffff1660011415620021d8576080830151604080518082018252606086015181528186015160208083019182526000948552600a90529190922091518255516001909101555b608083015160a08401516040516334ff261960e21b81526001600160a01b0385169263d3fc98649262002212928692919060040162003094565b600060405180830381600087803b1580156200222d57600080fd5b505af115801562002242573d6000803e3d6000fd5b50505050620022be565b6080830151604051632142170760e11b81523060048201526001600160a01b0383811660248301526044820192909252908316906342842e0e90606401600060405180830381600087803b158015620022a457600080fd5b505af1158015620022b9573d6000803e3d6000fd5b505050505b50505050505050565b600080620022d58562001653565b9050620022ea6000546001600160a01b031690565b6001600160a01b031663b19a437e8585846200231160025460ff6401000000009091041690565b6040518563ffffffff1660e01b81526004016200233193929190620031a4565b6020604051808303818588803b1580156200234b57600080fd5b505af115801562002360573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019062002387919062002f52565b95945050505050565b6200239b81620026bc565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60008160800151620023f8836060015161ffff1660009081526009602052604090205490565b14156200240757506001919050565b506000919050565b60006200241f60025461ffff1690565b61ffff168561ffff161415620024895760405162461bcd60e51b815260206004820152602860248201527f63616e206f6e6c79207772617020746f6b656e732066726f6d20666f726569676044820152676e20636861696e7360c01b60648201526084016200072c565b60006200249786866200090d565b6001600160a01b031614620024ef5760405162461bcd60e51b815260206004820152601c60248201527f7772617070656420617373657420616c7265616479206578697374730000000060448201526064016200072c565b8461ffff166001141562002531577f576f726d686f6c65204272696467656420536f6c616e612d4e4654000000000092506915d3d49354d41313919560b21b91505b6000627ce50b60e31b620025458562002763565b620025508562002763565b30898960405160240162002569959493929190620030d2565b60408051601f19818403018152918152602080830180516001600160e01b03166001600160e01b03199095169490941790935251909250600091620025b39130918591016200306e565b6040516020818303038152906040529050600060405180602001620025d8906200289e565b601f1982820381018352601f909101166040819052620025fe9190849060200162002fbb565b60408051601f19818403018152908290526001600160f01b031960f08b901b166020830152602282018990529150600090604201604051602081830303815290604052805190602001209050808251602084016000f59450843b6200266257600080fd5b61ffff891660009081526007602090815260408083208b8452825280832080546001600160a01b0319166001600160a01b038a16908117909155835260089091529020805460ff1916600117905550505050949350505050565b803b620027225760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200072c565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b606060005b602081108015620027a657508281602081106200279557634e487b7160e01b600052603260045260246000fd5b1a60f81b6001600160f81b03191615155b15620027c15780620027b88162003314565b91505062002768565b6000816001600160401b03811115620027ea57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801562002815576020820181803683370190505b50905060005b8281101562002896578481602081106200284557634e487b7160e01b600052603260045260246000fd5b1a60f81b8282815181106200286a57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350806200288d8162003314565b9150506200281b565b509392505050565b610993806200338383390190565b6000620028c3620028bd8462003282565b6200324f565b9050828152838383011115620028d857600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146200290757600080fd5b919050565b600082601f8301126200291d578081fd5b815160206001600160401b038211156200293b576200293b62003348565b6200294b818360051b016200324f565b80838252828201915082860187848660071b89010111156200296b578586fd5b855b85811015620029d757608080838b03121562002987578788fd5b62002991620031d8565b8351815286840151878201526040620029ac81860162002aaf565b908201526060620029bf85820162002aaf565b9082015285529385019391909101906001016200296d565b5090979650505050505050565b805180151581146200290757600080fd5b600082601f83011262002a06578081fd5b815162002a17620028bd8262003282565b81815284602083860101111562002a2c578283fd5b62002a3f826020830160208701620032e1565b949350505050565b600082601f83011262002a58578081fd5b62002a6983833560208501620028ac565b9392505050565b803562002907816200335e565b805162002907816200335e565b805162002907816200336f565b80516001600160401b03811681146200290757600080fd5b805160ff811681146200290757600080fd5b60006020828403121562002ad3578081fd5b62002a6982620028ef565b60008060008060006080868803121562002af6578081fd5b62002b0186620028ef565b945062002b1160208701620028ef565b93506040860135925060608601356001600160401b038082111562002b34578283fd5b818801915088601f83011262002b48578283fd5b81358181111562002b57578384fd5b89602082850101111562002b69578384fd5b9699959850939650602001949392505050565b600080600080600060a0868803121562002b94578283fd5b62002b9f86620028ef565b945060208601359350604086013562002bb8816200335e565b925060608601359150608086013562002bd1816200336f565b809150509295509295909350565b60006020828403121562002bf1578081fd5b62002a6982620029e4565b60006020828403121562002c0e578081fd5b5035919050565b60006020828403121562002c27578081fd5b5051919050565b60006020828403121562002c40578081fd5b81356001600160401b0381111562002c56578182fd5b8201601f8101841362002c67578182fd5b62002a3f84823560208401620028ac565b60006020828403121562002c8a578081fd5b81516001600160401b0381111562002ca0578182fd5b62002a3f84828501620029f5565b60006020828403121562002cc0578081fd5b81356001600160401b038082111562002cd7578283fd5b90830190610100828603121562002cec578283fd5b62002cf662003203565b8235815262002d086020840162002a70565b602082015260408301356040820152606083013560608201526080830135608082015260a08301358281111562002d3d578485fd5b62002d4b8782860162002a47565b60a08301525060c083013560c082015262002d6960e0840162002a70565b60e082015295945050505050565b60008060006060848603121562002d8c578081fd5b83516001600160401b038082111562002da3578283fd5b90850190610160828803121562002db8578283fd5b62002dc262003229565b62002dcd8362002aaf565b815262002ddd6020840162002a8a565b602082015262002df06040840162002a8a565b604082015262002e036060840162002a7d565b60608201526080830151608082015262002e2060a0840162002a97565b60a082015262002e3360c0840162002aaf565b60c082015260e08301518281111562002e4a578485fd5b62002e5889828601620029f5565b60e08301525061010062002e6e81850162002a8a565b90820152610120838101518381111562002e86578586fd5b62002e948a8287016200290c565b91830191909152506101408381015190820152945062002eb760208701620029e4565b9350604086015191508082111562002ecd578283fd5b5062002edc86828701620029f5565b9150509250925092565b60006020828403121562002ef8578081fd5b813562002a69816200335e565b60006020828403121562002f17578081fd5b815162002a69816200335e565b6000806040838503121562002f37578182fd5b823562002f44816200335e565b946020939093013593505050565b60006020828403121562002f64578081fd5b62002a698262002a97565b6000815180845262002f89816020860160208601620032e1565b601f01601f19169290920160200192915050565b6000825162002fb1818460208701620032e1565b9190910192915050565b6000835162002fcf818460208801620032e1565b83519083019062002fe5818360208801620032e1565b01949350505050565b600060ff60f81b808d60f81b1683528b600184015261ffff60f01b808c60f01b1660218501528a6023850152896043850152886063850152818860f81b1660838501528651915062003048826084860160208a01620032e1565b920160848101949094525060f09190911b1660a482015260a60198975050505050505050565b6001600160a01b038316815260406020820181905260009062002a3f9083018462002f6f565b60018060a01b038416815282602082015260606040820152600062002387606083018462002f6f565b60208152600062002a69602083018462002f6f565b60a081526000620030e760a083018862002f6f565b8281036020840152620030fb818862002f6f565b6001600160a01b03969096166040840152505061ffff92909216606083015260809091015292915050565b60208152815160208201526000602083015161ffff80821660408501526040850151606085015260608501516080850152608085015160a085015260a085015191506101008060c08601526200318161012086018462002f6f565b925060c086015160e08601528160e0870151168186015250508091505092915050565b63ffffffff84168152606060208201526000620031c5606083018562002f6f565b905060ff83166040830152949350505050565b604051608081016001600160401b0381118282101715620031fd57620031fd62003348565b60405290565b60405161010081016001600160401b0381118282101715620031fd57620031fd62003348565b60405161016081016001600160401b0381118282101715620031fd57620031fd62003348565b604051601f8201601f191681016001600160401b03811182821017156200327a576200327a62003348565b604052919050565b60006001600160401b038211156200329e576200329e62003348565b50601f01601f191660200190565b60008219821115620032c257620032c262003332565b500190565b600082821015620032dc57620032dc62003332565b500390565b60005b83811015620032fe578181015183820152602001620032e4565b838111156200330e576000848401525b50505050565b60006000198214156200332b576200332b62003332565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b61ffff8116811462000f8c57600080fd5b63ffffffff8116811462000f8c57600080fdfe608060405234801561001057600080fd5b5060405161099338038061099383398101604081905261002f9161048e565b818161005c60017fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d51610599565b60008051602061094c8339815191521461008657634e487b7160e01b600052600160045260246000fd5b6100928282600061009b565b505050506105fe565b6100a483610175565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a26000825111806100e55750805b156101705761016e836001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561012657600080fd5b505afa15801561013a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061015e9190610474565b8361031560201b6100291760201c565b505b505050565b6101888161034160201b6100551760201c565b6101e75760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b60648201526084015b60405180910390fd5b61026a816001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561022357600080fd5b505afa158015610237573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025b9190610474565b61034160201b6100551760201c565b6102cf5760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b60648201526084016101de565b806102f460008051602061094c83398151915260001b61034760201b61005b1760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b606061033a838360405180606001604052806027815260200161096c6027913961034a565b9392505050565b3b151590565b90565b6060833b6103a95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016101de565b600080856001600160a01b0316856040516103c4919061054a565b600060405180830381855af49150503d80600081146103ff576040519150601f19603f3d011682016040523d82523d6000602084013e610404565b606091505b50909250905061041582828661041f565b9695505050505050565b6060831561042e57508161033a565b82511561043e5782518084602001fd5b8160405162461bcd60e51b81526004016101de9190610566565b80516001600160a01b038116811461046f57600080fd5b919050565b600060208284031215610485578081fd5b61033a82610458565b600080604083850312156104a0578081fd5b6104a983610458565b60208401519092506001600160401b03808211156104c5578283fd5b818501915085601f8301126104d8578283fd5b8151818111156104ea576104ea6105e8565b604051601f8201601f19908116603f01168101908382118183101715610512576105126105e8565b8160405282815288602084870101111561052a578586fd5b61053b8360208301602088016105bc565b80955050505050509250929050565b6000825161055c8184602087016105bc565b9190910192915050565b60208152600082518060208401526105858160408501602087016105bc565b601f01601f19169190910160400192915050565b6000828210156105b757634e487b7160e01b81526011600452602481fd5b500390565b60005b838110156105d75781810151838201526020016105bf565b8381111561016e5750506000910152565b634e487b7160e01b600052604160045260246000fd5b61033f8061060d6000396000f3fe60806040523661001357610011610017565b005b6100115b61002761002261005e565b610106565b565b606061004e83836040518060600160405280602781526020016102e36027913961012a565b9392505050565b3b151590565b90565b60006100917fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50546001600160a01b031690565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100c957600080fd5b505afa1580156100dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610101919061023c565b905090565b3660008037600080366000845af43d6000803e808015610125573d6000f35b3d6000fd5b6060833b61018e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b0316856040516101a99190610263565b600060405180830381855af49150503d80600081146101e4576040519150601f19603f3d011682016040523d82523d6000602084013e6101e9565b606091505b50915091506101f9828286610203565b9695505050505050565b6060831561021257508161004e565b8251156102225782518084602001fd5b8160405162461bcd60e51b8152600401610185919061027f565b60006020828403121561024d578081fd5b81516001600160a01b038116811461004e578182fd5b600082516102758184602087016102b2565b9190910192915050565b602081526000825180602084015261029e8160408501602087016102b2565b601f01601f19169190910160400192915050565b60005b838110156102cd5781810151838201526020016102b5565b838111156102dc576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220c383d12a666085db2eac57ee60d62a29e11c165ef3006d3555601869d9b9b8eb64736f6c63430008040033a3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564676f7665726e616e636520616374696f6e20616c726561647920636f6e73756d6564a26469706673582212209fec54cc34b65fa7bdf8088122f1c1b4f9e642d4766812e4c7e45295686a5a4964736f6c63430008040033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 27 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.