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
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:
y00ts
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import {ERC2981Upgradeable} from "@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol"; import {Ownable2StepUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol"; import {IWormhole} from "wormhole-solidity/IWormhole.sol"; import {BytesLib} from "wormhole-solidity/BytesLib.sol"; // @@@@@@ @@ // @@@@@@ @@@@@ @@@@@@@@@@@ @@@@@@@@@@@ @@@@@@ // @@@@@@ @@@@@@ @@@@@@@@@@@@@@ @@@@@@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@ // @@@@@@ @@@@@/@@@@@@ @@@@@@ @@@@@@ @@@@@@ @@@@@@@@@@@ @@@@@@(@@@ // @@@@@%@@@@@@ @@@@@ @@@@@ @@@@@ @@@@@ @@@@@@ @@@@@@@@ // @@@@@@@@@@@@ @@@@@@ @@@@@ @@@@@@ @@@@@ @@@@@@ @@@@@@@@@@ // @@@@@@@@@@ @@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@ @@@@@@ @@@@@@@ // &@@@@@@@@ @@@@@@@@@@@@& @@@@@@@@@@@@& @@@@@@@@ @@@@@@@@@@@ // @@@@@@@@@@@. &@@@@@@@ &@@@@@@@ @@@@@@ @@@@@@@@@ // @@@@@@@@ /** * @title y00ts ERC-721 Smart Contract */ contract y00ts is UUPSUpgradeable, ERC2981Upgradeable, Ownable2StepUpgradeable, ERC721Upgradeable { using BytesLib for bytes; using SafeERC20 for IERC20; // Wormhole chain id that valid vaas must have -- must be Polygon. uint16 constant SOURCE_CHAIN_ID = 5; // -- immutable members (baked into the code by the constructor of the logic contract) // Core layer Wormhole contract. Exposed so higher-level contract can // interact with the wormhole interface. IWormhole immutable _wormhole; // Only VAAs from this emitter can mint NFTs with our contract (prevents spoofing). bytes32 private immutable _emitterAddress; // Common URI for all NFTs handled by this contract. bytes32 private immutable _baseUri; uint8 private immutable _baseUriLength; // Dictionary of VAA hash => flag that keeps track of claimed VAAs mapping(bytes32 => bool) private _claimedVaas; // Storage gap so that future upgrades to the contract can add new storage variables. uint256[50] __gap; error WrongEmitterChainId(); error WrongEmitterAddress(); error FailedVaaParseAndVerification(string reason); error VaaAlreadyClaimed(); error InvalidMessageLength(); error BaseUriEmpty(); error BaseUriTooLong(); error InvalidMsgValue(); error FailedToSend(); event Minted(uint256 indexed tokenId, address indexed receiver); event BatchMinted(uint256[] tokenIds, address indexed receiver); //constructor for the logic(!) contract constructor(IWormhole wormhole, bytes32 emitterAddress, bytes memory baseUri) { if (baseUri.length == 0) { revert BaseUriEmpty(); } if (baseUri.length > 32) { revert BaseUriTooLong(); } _wormhole = wormhole; _emitterAddress = emitterAddress; _baseUri = bytes32(baseUri); _baseUriLength = uint8(baseUri.length); //brick logic contract initialize("", "", address(1), 0); renounceOwnership(); } //intentionally empty (we only want the onlyOwner modifier "side-effect") function _authorizeUpgrade(address) internal override onlyOwner {} //"constructor" of the proxy contract function initialize( string memory name, string memory symbol, address royaltyReceiver, uint96 royaltyFeeNumerator ) public initializer { __UUPSUpgradeable_init(); __ERC721_init(name, symbol); __ERC2981_init(); __Ownable_init(); _setDefaultRoyalty(royaltyReceiver, royaltyFeeNumerator); } /** * @notice Mints an NFT based on a valid VAA * @param vaa Wormhole message that must have been published by the Polygon Y00tsV2 instance * of the NFT collection with the specified emitter on Polygon (chainId = 5). The VAA contains * a single token ID and a recipient address. */ function receiveAndMint(bytes calldata vaa) external { IWormhole.VM memory vm = _verifyMintMessage(vaa); (uint256 tokenId, address evmRecipient) = parsePayload(vm.payload); _safeMint(evmRecipient, tokenId); emit Minted(tokenId, evmRecipient); } /** * @notice Mints a batch of NFTs based on a valid VAA * @param vaa Wormhole message that must have been published by the Polygon Y00tsV2 instance * of the NFT collection with the specified emitter on Polygon (chainId = 5). The VAA contains * a list of token IDs and a recipient address. */ function receiveAndMintBatch(bytes calldata vaa) external { IWormhole.VM memory vm = _verifyMintMessage(vaa); (uint256[] memory tokenIds, address evmRecipient) = parseBatchPayload(vm.payload); uint256 tokenCount = tokenIds.length; for (uint256 i = 0; i < tokenCount; ) { _safeMint(evmRecipient, tokenIds[i]); unchecked { i += 1; } } emit BatchMinted(tokenIds, evmRecipient); } function parsePayload( bytes memory message ) internal pure returns (uint256 tokenId, address evmRecipient) { if (message.length != BytesLib.uint16Size + BytesLib.addressSize) revert InvalidMessageLength(); tokenId = message.toUint16(0); evmRecipient = message.toAddress(BytesLib.uint16Size); } function parseBatchPayload( bytes memory message ) internal pure returns (uint256[] memory, address) { uint256 messageLength = message.length; uint256 endTokenIndex = messageLength - BytesLib.addressSize; uint256 batchSize = endTokenIndex / BytesLib.uint16Size; if ( messageLength <= BytesLib.uint16Size + BytesLib.addressSize || endTokenIndex % BytesLib.uint16Size != 0 ) { revert InvalidMessageLength(); } //parse the recipient address evmRecipient = message.toAddress(endTokenIndex); //parse the tokenIds uint256[] memory tokenIds = new uint256[](batchSize); for (uint256 i = 0; i < batchSize; ) { unchecked { tokenIds[i] = message.toUint16(i * BytesLib.uint16Size); i += 1; } } return (tokenIds, evmRecipient); } function _verifyMintMessage(bytes calldata vaa) internal returns (IWormhole.VM memory) { (IWormhole.VM memory vm, bool valid, string memory reason) = _wormhole.parseAndVerifyVM( vaa ); if (!valid) revert FailedVaaParseAndVerification(reason); if (vm.emitterChainId != SOURCE_CHAIN_ID) revert WrongEmitterChainId(); if (vm.emitterAddress != _emitterAddress) revert WrongEmitterAddress(); if (_claimedVaas[vm.hash]) revert VaaAlreadyClaimed(); _claimedVaas[vm.hash] = true; return vm; } // ---- ERC721 ---- function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { return string.concat(super.tokenURI(tokenId), ".json"); } function _baseURI() internal view virtual override returns (string memory baseUri) { baseUri = new string(_baseUriLength); bytes32 tmp = _baseUri; assembly ("memory-safe") { mstore(add(baseUri, 32), tmp) } } // ---- ERC165 ---- function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC2981Upgradeable, ERC721Upgradeable) returns (bool) { return ERC2981Upgradeable.supportsInterface(interfaceId) || ERC721Upgradeable.supportsInterface(interfaceId); } // ---- ERC2981 ---- function setDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyOwner { _setDefaultRoyalty(receiver, feeNumerator); } function deleteDefaultRoyalty() external onlyOwner { _deleteDefaultRoyalty(); } function setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) external onlyOwner { _setTokenRoyalty(tokenId, receiver, feeNumerator); } function resetTokenRoyalty(uint256 tokenId) external onlyOwner { _resetTokenRoyalty(tokenId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (access/Ownable2Step.sol) pragma solidity ^0.8.0; import "./OwnableUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides 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} and {acceptOwnership}. * * This module is used through inheritance. It will make available all functions * from parent (Ownable). */ abstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable { function __Ownable2Step_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable2Step_init_unchained() internal onlyInitializing { } address private _pendingOwner; event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); /** * @dev Returns the address of the pending owner. */ function pendingOwner() public view virtual returns (address) { return _pendingOwner; } /** * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual override onlyOwner { _pendingOwner = newOwner; emit OwnershipTransferStarted(owner(), newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual override { delete _pendingOwner; super._transferOwnership(newOwner); } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwnership() external { address sender = _msgSender(); require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner"); _transferOwnership(sender); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * 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 OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { 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 { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981Upgradeable is IERC165Upgradeable { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822ProxiableUpgradeable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967UpgradeUpgradeable is Initializable { function __ERC1967Upgrade_init() internal onlyInitializing { } function __ERC1967Upgrade_init_unchained() internal onlyInitializing { } // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) { require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed"); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721Upgradeable.sol"; import "./IERC721ReceiverUpgradeable.sol"; import "./extensions/IERC721MetadataUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../utils/StringsUpgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: address zero is not a valid owner"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _ownerOf(tokenId); require(owner != address(0), "ERC721: invalid token ID"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { _requireMinted(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721Upgradeable.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not token owner or approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { _requireMinted(tokenId); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); _safeTransfer(from, to, tokenId, data); } /** * @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. * * `data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist */ function _ownerOf(uint256 tokenId) internal view virtual returns (address) { return _owners[tokenId]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _ownerOf(tokenId) != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { address owner = ERC721Upgradeable.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId, 1); // Check that tokenId was not minted by `_beforeTokenTransfer` hook require(!_exists(tokenId), "ERC721: token already minted"); unchecked { // Will not overflow unless all 2**256 token ids are minted to the same owner. // Given that tokens are minted one by one, it is impossible in practice that // this ever happens. Might change if we allow batch minting. // The ERC fails to describe this case. _balances[to] += 1; } _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId, 1); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * This is an internal function that does not check if the sender is authorized to operate on the token. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId, 1); // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook owner = ERC721Upgradeable.ownerOf(tokenId); // Clear approvals delete _tokenApprovals[tokenId]; unchecked { // Cannot overflow, as that would require more tokens to be burned/transferred // out than the owner initially received through minting and transferring in. _balances[owner] -= 1; } delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId, 1); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId, 1); // Check that tokenId was not transferred by `_beforeTokenTransfer` hook require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); // Clear approvals from the previous owner delete _tokenApprovals[tokenId]; unchecked { // `_balances[from]` cannot overflow for the same reason as described in `_burn`: // `from`'s balance is the number of token held, which is at least one before the current // transfer. // `_balances[to]` could overflow in the conditions described in `_mint`. That would require // all 2**256 token ids to be minted, which in practice is impossible. _balances[from] -= 1; _balances[to] += 1; } _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId, 1); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory data ) private returns (bool) { if (to.isContract()) { try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`. * - When `from` is zero, the tokens will be minted for `to`. * - When `to` is zero, ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * - `batchSize` is non-zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256, /* firstTokenId */ uint256 batchSize ) internal virtual { if (batchSize > 1) { if (from != address(0)) { _balances[from] -= batchSize; } if (to != address(0)) { _balances[to] += batchSize; } } } /** * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`. * - When `from` is zero, the tokens were minted for `to`. * - When `to` is zero, ``from``'s tokens were burned. * - `from` and `to` are never both zero. * - `batchSize` is non-zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize ) internal virtual {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[44] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) 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 IERC721ReceiverUpgradeable { /** * @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 `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @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`. * * 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; /** * @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 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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * 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 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 the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @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 // OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981Upgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable { function __ERC2981_init() internal onlyInitializing { } function __ERC2981_init_unchained() internal onlyInitializing { } struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC165Upgradeable) returns (bool) { return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981Upgradeable */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[48] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/MathUpgradeable.sol"; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = MathUpgradeable.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, MathUpgradeable.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) 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 IERC165Upgradeable { /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library MathUpgradeable { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: 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. * This is a reduced version of the library. */ pragma solidity >=0.8.0 <0.9.0; library BytesLib { uint256 private constant freeMemoryPtr = 0x40; uint256 private constant maskModulo32 = 0x1f; /** * Size of word read by `mload` instruction. */ uint256 private constant memoryWord = 32; uint256 internal constant uint8Size = 1; uint256 internal constant uint16Size = 2; uint256 internal constant uint32Size = 4; uint256 internal constant uint64Size = 8; uint256 internal constant uint128Size = 16; uint256 internal constant uint256Size = 32; uint256 internal constant addressSize = 20; /** * Bits in 12 bytes. */ uint256 private constant bytes12Bits = 96; function slice(bytes memory buffer, uint256 startIndex, uint256 length) internal pure returns (bytes memory) { unchecked { require(length + 31 >= length, "slice_overflow"); } require(buffer.length >= startIndex + length, "slice_outOfBounds"); bytes memory tempBytes; assembly ("memory-safe") { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(freeMemoryPtr) switch iszero(length) case 0 { // 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, maskModulo32) // 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 startOffset := add(lengthmod, mul(memoryWord, iszero(lengthmod))) let dst := add(tempBytes, startOffset) let end := add(dst, length) for { let src := add(add(buffer, startOffset), startIndex) } lt(dst, end) { dst := add(dst, memoryWord) src := add(src, memoryWord) } { mstore(dst, mload(src)) } // Update free-memory pointer // allocating the array padded to 32 bytes like the compiler does now // Note that negating bitwise the `maskModulo32` produces a mask that aligns addressing to 32 bytes. mstore(freeMemoryPtr, and(add(dst, maskModulo32), not(maskModulo32))) } //if we want a zero-length slice let's just return a zero-length array default { mstore(freeMemoryPtr, add(tempBytes, memoryWord)) } // Store the length of the buffer // We need to do it even if the length is zero because Solidity does not garbage collect mstore(tempBytes, length) } return tempBytes; } function toAddress(bytes memory buffer, uint256 startIndex) internal pure returns (address) { require(buffer.length >= startIndex + addressSize, "toAddress_outOfBounds"); address tempAddress; assembly ("memory-safe") { // We want to shift into the lower 12 bytes and leave the upper 12 bytes clear. tempAddress := shr(bytes12Bits, mload(add(add(buffer, memoryWord), startIndex))) } return tempAddress; } function toUint8(bytes memory buffer, uint256 startIndex) internal pure returns (uint8) { require(buffer.length > startIndex, "toUint8_outOfBounds"); // Note that `endIndex == startOffset` for a given buffer due to the 32 bytes at the start that store the length. uint256 startOffset = startIndex + uint8Size; uint8 tempUint; assembly ("memory-safe") { tempUint := mload(add(buffer, startOffset)) } return tempUint; } function toUint16(bytes memory buffer, uint256 startIndex) internal pure returns (uint16) { uint256 endIndex = startIndex + uint16Size; require(buffer.length >= endIndex, "toUint16_outOfBounds"); uint16 tempUint; assembly ("memory-safe") { // Note that `endIndex == startOffset` for a given buffer due to the 32 bytes at the start that store the length. tempUint := mload(add(buffer, endIndex)) } return tempUint; } function toUint32(bytes memory buffer, uint256 startIndex) internal pure returns (uint32) { uint256 endIndex = startIndex + uint32Size; require(buffer.length >= endIndex, "toUint32_outOfBounds"); uint32 tempUint; assembly ("memory-safe") { // Note that `endIndex == startOffset` for a given buffer due to the 32 bytes at the start that store the length. tempUint := mload(add(buffer, endIndex)) } return tempUint; } function toUint64(bytes memory buffer, uint256 startIndex) internal pure returns (uint64) { uint256 endIndex = startIndex + uint64Size; require(buffer.length >= endIndex, "toUint64_outOfBounds"); uint64 tempUint; assembly ("memory-safe") { // Note that `endIndex == startOffset` for a given buffer due to the 32 bytes at the start that store the length. tempUint := mload(add(buffer, endIndex)) } return tempUint; } function toUint128(bytes memory buffer, uint256 startIndex) internal pure returns (uint128) { uint256 endIndex = startIndex + uint128Size; require(buffer.length >= endIndex, "toUint128_outOfBounds"); uint128 tempUint; assembly ("memory-safe") { // Note that `endIndex == startOffset` for a given buffer due to the 32 bytes at the start that store the length. tempUint := mload(add(buffer, endIndex)) } return tempUint; } function toUint256(bytes memory buffer, uint256 startIndex) internal pure returns (uint256) { uint256 endIndex = startIndex + uint256Size; require(buffer.length >= endIndex, "toUint256_outOfBounds"); uint256 tempUint; assembly ("memory-safe") { // Note that `endIndex == startOffset` for a given buffer due to the 32 bytes at the start that store the length. tempUint := mload(add(buffer, endIndex)) } return tempUint; } function toBytes32(bytes memory buffer, uint256 startIndex) internal pure returns (bytes32) { uint256 endIndex = startIndex + uint256Size; require(buffer.length >= endIndex, "toBytes32_outOfBounds"); bytes32 tempBytes32; assembly ("memory-safe") { // Note that `endIndex == startOffset` for a given buffer due to the 32 bytes at the start that store the length. tempBytes32 := mload(add(buffer, endIndex)) } return tempBytes32; } }
// contracts/Messages.sol // SPDX-License-Identifier: Apache 2 pragma solidity ^0.8.0; interface IWormhole { 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; } struct ContractUpgrade { bytes32 module; uint8 action; uint16 chain; address newContract; } struct GuardianSetUpgrade { bytes32 module; uint8 action; uint16 chain; GuardianSet newGuardianSet; uint32 newGuardianSetIndex; } struct SetMessageFee { bytes32 module; uint8 action; uint16 chain; uint256 messageFee; } struct TransferFees { bytes32 module; uint8 action; uint16 chain; uint256 amount; bytes32 recipient; } struct RecoverChainId { bytes32 module; uint8 action; uint256 evmChainId; uint16 newChainId; } event LogMessagePublished( address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel ); event ContractUpgraded(address indexed oldContract, address indexed newContract); event GuardianSetAdded(uint32 indexed index); function publishMessage(uint32 nonce, bytes memory payload, uint8 consistencyLevel) external payable returns (uint64 sequence); function initialize() external; function parseAndVerifyVM(bytes calldata encodedVM) external view returns (VM memory vm, bool valid, string memory reason); function verifyVM(VM memory vm) external view returns (bool valid, string memory reason); function verifySignatures(bytes32 hash, Signature[] memory signatures, GuardianSet memory guardianSet) external pure returns (bool valid, string memory reason); function parseVM(bytes memory encodedVM) external pure returns (VM memory vm); function quorum(uint256 numGuardians) external pure returns (uint256 numSignaturesRequiredForQuorum); function getGuardianSet(uint32 index) external view returns (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 isFork() external view returns (bool); function governanceChainId() external view returns (uint16); function governanceContract() external view returns (bytes32); function messageFee() external view returns (uint256); function evmChainId() external view returns (uint256); function nextSequence(address emitter) external view returns (uint64); function parseContractUpgrade(bytes memory encodedUpgrade) external pure returns (ContractUpgrade memory cu); function parseGuardianSetUpgrade(bytes memory encodedUpgrade) external pure returns (GuardianSetUpgrade memory gsu); function parseSetMessageFee(bytes memory encodedSetMessageFee) external pure returns (SetMessageFee memory smf); function parseTransferFees(bytes memory encodedTransferFees) external pure returns (TransferFees memory tf); function parseRecoverChainId(bytes memory encodedRecoverChainId) external pure returns (RecoverChainId memory rci); function submitContractUpgrade(bytes memory _vm) external; function submitSetMessageFee(bytes memory _vm) external; function submitNewGuardianSet(bytes memory _vm) external; function submitTransferFees(bytes memory _vm) external; function submitRecoverChainId(bytes memory _vm) external; }
{ "remappings": [ "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "ERC5058/=modules/ERC5058/", "ERC5192/=modules/ERC5192/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "opensea/=modules/opensea/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "wormhole-solidity/=modules/wormhole/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "viaIR": true, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IWormhole","name":"wormhole","type":"address"},{"internalType":"bytes32","name":"emitterAddress","type":"bytes32"},{"internalType":"bytes","name":"baseUri","type":"bytes"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BaseUriEmpty","type":"error"},{"inputs":[],"name":"BaseUriTooLong","type":"error"},{"inputs":[],"name":"FailedToSend","type":"error"},{"inputs":[{"internalType":"string","name":"reason","type":"string"}],"name":"FailedVaaParseAndVerification","type":"error"},{"inputs":[],"name":"InvalidMessageLength","type":"error"},{"inputs":[],"name":"InvalidMsgValue","type":"error"},{"inputs":[],"name":"VaaAlreadyClaimed","type":"error"},{"inputs":[],"name":"WrongEmitterAddress","type":"error"},{"inputs":[],"name":"WrongEmitterChainId","type":"error"},{"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":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"}],"name":"BatchMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"}],"name":"Minted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deleteDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"address","name":"royaltyReceiver","type":"address"},{"internalType":"uint96","name":"royaltyFeeNumerator","type":"uint96"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"vaa","type":"bytes"}],"name":"receiveAndMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"vaa","type":"bytes"}],"name":"receiveAndMintBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"resetTokenRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setTokenRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
6040610120815234620005ef57620032ea9081380380620000208162000614565b938439820191606081840312620005ef5780516001600160a01b03908181168103620005ef57602094858401518585015160018060401b0395868211620005ef570190601f93838584011215620005ef578251928784116200034157601f19936200009187820186168c0162000614565b958187528b8284010111620005ef578a9160005b828110620005db575050906000918601015230608052835115620005ca5788845111620005b95760a05260c05281518783015190888110620005a7575b5060e05260ff8092511696610100978852620000fd620005f4565b93600085526200010c620005f4565b906000825260005493858560081c1615968780986200059a575b801562000582575b156200052757600195888760ff1983161760005562000514575b50620001718760005460081c1662000160816200063a565b6200016b816200063a565b6200063a565b80518a8111620003415761015f918254908882811c9216801562000509575b8883101462000422578186849311620004b3575b5087908683116001146200044f5760009262000443575b5050600019600383901b1c191690871b1790555b8251918983116200034157610160938454928784811c9416801562000438575b8785101462000422578383869511620003c8575b508692841160011462000363575060009262000357575b5050600019600383901b1c191690841b1790555b62000246600054938460081c1662000160816200063a565b60018060a01b03199261012d91848354169360fb54967f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e098339089168a600080a38a51808c019a8b11818c101762000341578360009b918c928e5284815201528160c95562000309575b5050505580331691161760fb5533908280a351612c4e91826200069c833960805182818161115501528181611243015261153f015260a051826127fa015260c05182612855015260e051826105780152518161054d0152f35b7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989261ff00191689558951908152a1388080620002b0565b634e487b7160e01b600052604160045260246000fd5b0151905038806200021a565b8794929192169185600052866000209260005b88828210620003b1575050841162000397575b505050811b0190556200022e565b015160001960f88460031b161c1916905538808062000389565b8385015186558a9790950194938401930162000376565b909192935085600052866000208480870160051c82019289881062000418575b9187968b92969594930160051c01915b8281106200040857505062000203565b600081558796508a9101620003f8565b92508192620003e8565b634e487b7160e01b600052602260045260246000fd5b93607f1693620001ef565b015190503880620001bb565b90858a94169185600052896000209260005b8b8282106200049c575050841162000482575b505050811b019055620001cf565b015160001960f88460031b161c1916905538808062000474565b8385015186558d9790950194938401930162000461565b90915083600052876000208680850160051c8201928a8610620004ff575b918b91869594930160051c01915b828110620004ef575050620001a4565b600081558594508b9101620004df565b92508192620004d1565b91607f169162000190565b61ffff1916610101176000553862000148565b8a5162461bcd60e51b815260048101869052602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b1580156200012e57506001878716146200012e565b5060018787161062000126565b60001990890360031b1b1638620000e2565b875163d1eae93360e01b8152600490fd5b8751633b0187cd60e21b8152600490fd5b8181018401518882018501528301620000a5565b600080fd5b60405190602082016001600160401b038111838210176200034157604052565b6040519190601f01601f191682016001600160401b038111838210176200034157604052565b156200064257565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fdfe608080604052600436101561001357600080fd5b60003560e01c90816301ffc9a714611a145750806304634d8d146119dc57806306fdde0314611945578063081812fc14611927578063095ea7b3146117ab57806323b872dd146117875780632a55205a146116db5780633659cfe61461151b57806342842e0e146114e85780634f1ef2861461120657806352d1902d146111425780635944c753146110655780636352211e1461103557806370a0823114610f9d578063715018a614610f3557806379ba509714610eaf5780638a616bc014610e825780638da5cb5b14610e5957806395d89b4114610d71578063a22cb46514610c9e578063aa1b103f14610c7e578063b7e31add14610806578063b88d4fde14610790578063c87b56dd1461050c578063cef9a20214610356578063e02c792c14610252578063e30c397814610228578063e985e9c5146101d15763f2fde38b1461015e57600080fd5b346101cc5760203660031901126101cc57610177611aad565b61017f611ce4565b61012d80546001600160a01b0319166001600160a01b0392831690811790915560fb549091167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700600080a3005b600080fd5b346101cc5760403660031901126101cc576101ea611aad565b6101f2611ac3565b9060018060a01b0380911660005261016460205260406000209116600052602052602060ff604060002054166040519015158152f35b346101cc5760003660031901126101cc5761012d546040516001600160a01b039091168152602090f35b346101cc5760e061026b61026536611c46565b90612767565b015160168151036103445760028151106103085761ffff6002820151169060168151106102cb576022015160601c906102a4818361256b565b7fb9203d657e9c0ec8274c818292ab0f58b04e1970050716891770eb1bab5d655e600080a3005b60405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606490fd5b60405162461bcd60e51b8152602060048201526014602482015273746f55696e7431365f6f75744f66426f756e647360601b6044820152606490fd5b604051638d0242c960e01b8152600490fd5b346101cc5760e061036961026536611c46565b0151805160131980820192918084116104e857600193841c9160168211908115916104fe575b5061034457808351106102cb578201600c015160601c92916103b0826126fc565b926103be6040519485611bc3565b8284526103ca836126fc565b9260209283860194601f190136863760005b82811061047257505050835160005b81811061044f57505060405193828501908386525180915260408501939260005b82811061043c57877f03594fecb8a9aaa7406dd20a32bce98ef745336eb214761b085e7c924b71bda688880389a2005b845186529481019493810193830161040c565b918261046861046188958497996126d2565b518961256b565b01949291946103eb565b80849597941b6002908181018082116104e8578451106104ac578301015185919061ffff166104a182876126d2565b5201959392956103dc565b60405162461bcd60e51b8152600481018a90526014602482015273746f55696e7431365f6f75744f66426f756e647360601b6044820152606490fd5b634e487b7160e01b600052601160045260246000fd5b60029150820815158561038f565b346101cc576020806003193601126101cc5760043560008181526101616020526040902054610545906001600160a01b03161515611ebe565b8161057260ff7f000000000000000000000000000000000000000000000000000000000000000016612ba6565b918183017f000000000000000000000000000000000000000000000000000000000000000081528351151560001461077657600091807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008181811015610768575b5050846d04ee2d6d415b85acef81000000008084101561075a575b5050662386f26fc100008083101561074b575b506305f5e1008083101561073c575b506127108083101561072d575b50606482101561071d575b600a80921015610713575b60019081602161063f828801612ba6565b96870101905b6106dd575b505050509261068a929161066a9460405195869351809286860190611ad9565b820161067e82518093868085019101611ad9565b01038084520182611bc3565b905b6106c56025604051846106a88296518092878086019101611ad9565b810164173539b7b760d91b85820152036005810185520183611bc3565b6106d9604051928284938452830190611afc565b0390f35b600019019083906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a83530491821561070e57919082610645565b61064a565b926001019261062e565b9290606460029104910192610623565b60049194920491019287610618565b6008919492049101928761060b565b601091949204910192876105fc565b9401939091049084886105e9565b6040955004915087806105ce565b5050505060405161078681611b8d565b600081529061068c565b346101cc5760803660031901126101cc576107a9611aad565b6107b1611ac3565b90606435906044356001600160401b0383116101cc57610804936107dc6107ff943690600401611bff565b926107ef6107ea8433612084565b611fab565b6107fa83838361214d565b61235c565b612060565b005b346101cc5760803660031901126101cc576004356001600160401b0381116101cc57610836903690600401611bff565b6024356001600160401b0381116101cc57610855903690600401611bff565b906044356001600160a01b03811681036101cc57606435906001600160601b03821682036101cc576000549260ff8460081c161593848095610c71575b8015610c5a575b15610bfe5760ff19811660011760005584610bec575b506108d360ff60005460081c166108c581612417565b6108ce81612417565b612417565b8051906001600160401b038211610add5781906108f261015f54611f31565b601f8111610b74575b50602090601f8311600114610afe57600092610af3575b50508160011b916000199060031b1c19161761015f555b8351936001600160401b038511610add57610160906109488254611f31565b601f8111610a79575b50602090601f87116001146109f1579580916109a896976000926109e6575b50508160011b916000199060031b1c19161790555b61099a60ff60005460081c166108c581612417565b6109a333611c8f565b6124d6565b6109ae57005b61ff0019600054166000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a1005b015190508780610970565b90601f19871691836000527fec7e130cdeeae65215fabbcddb1de429e603c4887cc659532eda903e493396639260005b818110610a6157509160019391896109a8999a9410610a48575b505050811b019055610985565b015160001960f88460031b161c19169055878080610a3b565b92936020600181928786015181550195019301610a21565b826000527fec7e130cdeeae65215fabbcddb1de429e603c4887cc659532eda903e49339663601f880160051c81019160208910610ad3575b601f0160051c01905b818110610ac75750610951565b60008155600101610aba565b9091508190610ab1565b634e487b7160e01b600052604160045260246000fd5b015190508680610912565b61015f6000908152600080516020612bf98339815191529350601f198516905b818110610b5c5750908460019594939210610b43575b505050811b0161015f55610929565b015160001960f88460031b161c19169055868080610b34565b92936020600181928786015181550195019301610b1e565b90915061015f600052601f830160051c600080516020612bf9833981519152019060208410610bd6575b90601f8493920160051c600080516020612bf983398151915201905b818110610bc757506108fb565b60008155849350600101610bba565b600080516020612bf98339815191529150610b9e565b61ffff191661010117600055856108af565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b1580156108995750600160ff821614610899565b50600160ff821610610892565b346101cc5760003660031901126101cc57610c97611ce4565b600060c955005b346101cc5760403660031901126101cc57610cb7611aad565b602435908115158092036101cc576001600160a01b031690338214610d2c5733600052610164602052604060002082600052602052604060002060ff1981541660ff83161790556040519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b60405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606490fd5b346101cc5760003660031901126101cc5760405160006101608054610d9581611f31565b80855291600191808316908115610e2f5750600114610dd3575b6106d985610dbf81870382611bc3565b604051918291602083526020830190611afc565b600090815292507fec7e130cdeeae65215fabbcddb1de429e603c4887cc659532eda903e493396635b828410610e17575050508101602001610dbf826106d9610daf565b80546020858701810191909152909301928101610dfc565b8695506106d996935060209250610dbf94915060ff191682840152151560051b8201019293610daf565b346101cc5760003660031901126101cc5760fb546040516001600160a01b039091168152602090f35b346101cc5760203660031901126101cc57610e9b611ce4565b600435600090815260ca6020526040812055005b346101cc5760003660031901126101cc5761012d54336001600160a01b0390911603610ede5761080433611c8f565b60405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608490fd5b346101cc5760003660031901126101cc57610f4e611ce4565b61012d80546001600160a01b031990811690915560fb805491821690556000906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346101cc5760203660031901126101cc576001600160a01b03610fbe611aad565b168015610fde576000526101626020526020604060002054604051908152f35b60405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608490fd5b346101cc5760203660031901126101cc576020611053600435611f0a565b6040516001600160a01b039091168152f35b346101cc5760603660031901126101cc5761107e611ac3565b6044356001600160601b0381168091036101cc5761109a611ce4565b6110a8612710821115612477565b6001600160a01b039182169182156110fd57604051926110c784611b56565b83526020830191825260043560005260ca6020526040600020925116906001600160601b0360a01b905160a01b16179055600080f35b60405162461bcd60e51b815260206004820152601b60248201527f455243323938313a20496e76616c696420706172616d657465727300000000006044820152606490fd5b346101cc5760003660031901126101cc577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316300361119b576020604051600080516020612bd98339815191528152f35b60405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608490fd5b60403660031901126101cc5761121a611aad565b6024356001600160401b0381116101cc57611239903690600401611bff565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811692919061127330851415611d3c565b611290600080516020612bd9833981519152948286541614611d9d565b611298611ce4565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156112ce5750506108049150611dfe565b82919216604051936352d1902d60e01b85526020948581600481865afa600091816114b9575b506113555760405162461bcd60e51b815260048101879052602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608490fd5b036114625761136382611dfe565b604051907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a282511580159061145a575b61139d57005b813b1561140957506000828192856108049695519201905af46113be611e8e565b907f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c604051936113ed85611ba8565b60278552840152660819985a5b195960ca1b60408401526123d7565b62461bcd60e51b815260048101849052602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608490fd5b506001611397565b60405162461bcd60e51b815260048101859052602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608490fd5b9091508681813d83116114e1575b6114d18183611bc3565b810103126101cc575190876112f4565b503d6114c7565b346101cc576108046107ff6114fc36611b21565b906040519261150a84611b8d565b600084526107ef6107ea8433612084565b346101cc576020806003193601126101cc57611535611aad565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811661156c30821415611d3c565b611589600080516020612bd9833981519152918383541614611d9d565b611591611ce4565b6040519161159e83611b8d565b600083527f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156115d9575050506108049150611dfe565b83929316906040516352d1902d60e01b81528581600481865afa600091816116ac575b5061165d5760405162461bcd60e51b815260048101879052602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608490fd5b036114625761166b82611dfe565b604051907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a28251158015906116a45761139d57005b506000611397565b9091508681813d83116116d4575b6116c48183611bc3565b810103126101cc575190876115fc565b503d6116ba565b346101cc5760403660031901126101cc5760243560043560005260ca6020526040600020906040519161170d83611b56565b546001600160a01b0380821680855260a09290921c6020850152929015611765575b6001600160601b03602082015116918281029281840414901517156104e857604092612710915116918351928352046020820152f35b5060405161177281611b56565b60c954838116825260a01c602082015261172f565b346101cc5761080461179836611b21565b916117a66107ea8433612084565b61214d565b346101cc5760403660031901126101cc576117c4611aad565b602435906001600160a01b0380806117db85611f0a565b169216918083146118d8578033149081156118b2575b50156118475760008381526101636020526040902080546001600160a01b0319168317905561181f83611f0a565b167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a4005b60405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608490fd5b905060005261016460205260406000203360005260205260ff60406000205416846117f1565b60405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608490fd5b346101cc5760203660031901126101cc576020611053600435611f6b565b346101cc5760003660031901126101cc57604051600061015f805461196981611f31565b80855291600191808316908115610e2f5750600114611992576106d985610dbf81870382611bc3565b60009081529250600080516020612bf98339815191525b8284106119c4575050508101602001610dbf826106d9610daf565b805460208587018101919091529093019281016119a9565b346101cc5760403660031901126101cc576119f5611aad565b6024356001600160601b03811681036101cc57610804916109a3611ce4565b346101cc5760203660031901126101cc576004359063ffffffff60e01b82168092036101cc5760209163152a902d60e11b8114908115611a9c575b818015611a5f575b505015158152f35b6380ac58cd60e01b82149250908215611a8b575b508115611a83575b508380611a57565b905083611a7b565b635b5e139f60e01b14915084611a73565b6301ffc9a760e01b81149150611a4f565b600435906001600160a01b03821682036101cc57565b602435906001600160a01b03821682036101cc57565b60005b838110611aec5750506000910152565b8181015183820152602001611adc565b90602091611b1581518092818552858086019101611ad9565b601f01601f1916010190565b60609060031901126101cc576001600160a01b039060043582811681036101cc579160243590811681036101cc579060443590565b604081019081106001600160401b03821117610add57604052565b61016081019081106001600160401b03821117610add57604052565b602081019081106001600160401b03821117610add57604052565b606081019081106001600160401b03821117610add57604052565b90601f801991011681019081106001600160401b03821117610add57604052565b6001600160401b038111610add57601f01601f191660200190565b81601f820112156101cc57803590611c1682611be4565b92611c246040519485611bc3565b828452602083830101116101cc57816000926020809301838601378301015290565b9060206003198301126101cc576004356001600160401b03928382116101cc57806023830112156101cc5781600401359384116101cc57602484830101116101cc576024019190565b61012d80546001600160a01b031990811690915560fb80549182166001600160a01b0393841690811790915591167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b60fb546001600160a01b03163303611cf857565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b15611d4357565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b6064820152608490fd5b15611da457565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b6064820152608490fd5b803b15611e3357600080516020612bd983398151915280546001600160a01b0319166001600160a01b03909216919091179055565b60405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b3d15611eb9573d90611e9f82611be4565b91611ead6040519384611bc3565b82523d6000602084013e565b606090565b15611ec557565b60405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606490fd5b600090815261016160205260409020546001600160a01b0316611f2e811515611ebe565b90565b90600182811c92168015611f61575b6020831014611f4b57565b634e487b7160e01b600052602260045260246000fd5b91607f1691611f40565b60008181526101616020526040902054611f8f906001600160a01b03161515611ebe565b600090815261016360205260409020546001600160a01b031690565b15611fb257565b60405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b6064820152608490fd5b60809060208152603260208201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b60608201520190565b1561206757565b60405162461bcd60e51b8152806120806004820161200d565b0390fd5b906001600160a01b03808061209884611f0a565b169316918383149384156120cb575b5083156120b5575b50505090565b6120c191929350611f6b565b16143880806120af565b90935060005261016460205260406000208260005260205260ff6040600020541692386120a7565b156120fa57565b60405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608490fd5b906121759161215b84611f0a565b6001600160a01b03939184169284929091831684146120f3565b1691821561221057816121929161218b86611f0a565b16146120f3565b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6000848152610163602052604081206001600160601b0360a01b90818154169055838252610162602052604082206000198154019055848252604082206001815401905585825261016160205284604083209182541617905580a4565b60405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608490fd5b9091600091803b15612353576122ac6020918493604051948580948193630a85bd0160e11b9a8b84523360048501528460248501526044840152608060648401526084830190611afc565b03926001600160a01b03165af190829082612304575b50506122f6576122d0611e8e565b805190816122f15760405162461bcd60e51b8152806120806004820161200d565b602001fd5b6001600160e01b0319161490565b909192506020813d821161234b575b8161232060209383611bc3565b810103126123475751906001600160e01b03198216820361234457509038806122c2565b80fd5b5080fd5b3d9150612313565b50505050600190565b91926000929190813b156123cd576020916123b29185604051958680958194630a85bd0160e11b9b8c845233600485015260018060a01b0380951660248501526044840152608060648401526084830190611afc565b0393165af1908290826123045750506122f6576122d0611e8e565b5050505050600190565b909190156123e3575090565b8151156123f35750805190602001fd5b60405162461bcd60e51b815260206004820152908190612080906024830190611afc565b1561241e57565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b1561247e57565b60405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608490fd5b906001600160601b038116916124f0612710841115612477565b6001600160a01b031691821561252657602060405161250e81611b56565b848152015260a01b6001600160a01b0319161760c955565b60405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606490fd5b60405161257781611b8d565b6000808252926001600160a01b03831692831561264257816107ff94612640966125c06125ba8460005261016160205260018060a01b0360406000205416151590565b15612686565b600083815261016160205260409020546125e4906001600160a01b031615156125ba565b818152610162602052604081206001815401905582815261016160205260408120826001600160601b0360a01b8254161790557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4612261565b565b606460405162461bcd60e51b815260206004820152602060248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152fd5b1561268d57565b60405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606490fd5b80518210156126e65760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b6001600160401b038111610add5760051b60200190565b519060ff821682036101cc57565b519063ffffffff821682036101cc57565b9092919261273f81611be4565b9161274d6040519384611bc3565b8294828452828201116101cc576020612640930190611ad9565b60405160449161277682611b71565b8360009384928385528360208601528360408601528360608601528360808601528360a08601528360c0860152606060e08601528361014061010096828882015260606101208201520152604051968793849263607ec5ef60e11b845260206004850152816024850152848401378181018301859052601f01601f191681010301817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa908115612b9b57829383918493612909575b5050156128e45750600561ffff606084015116036128d25760808201517f0000000000000000000000000000000000000000000000000000000000000000036128c057610140820190815181526101918060205260ff6040832054166128ae5760409251825260205220600160ff1982541617905590565b60405163032a925360e41b8152600490fd5b604051636b99980160e11b8152600490fd5b60405163eae0fb0960e01b8152600490fd5b6040516366fd14ef60e01b815260206004820152908190612080906024830190611afc565b92509350503d928383823e61291e8482611bc3565b6060818581010312612b975780516001600160401b038111612b02576101608183018684010312612b02576040519261295684611b71565b612961828401612713565b8452612971602083850101612721565b6020850152612984604083850101612721565b60408501526060828401015161ffff81168103612b935760608501528282016080818101519086015260a001516001600160401b0381168103612b935760a08501526129d460c083850101612713565b60c085015260e082840101516001600160401b038111612b935782840101868401601f82011215612b9357612a129087850190602081519101612732565b60e0850152612a248183850101612721565b9084015261012081830101516001600160401b038111612afe5781830101858301601f82011215612afe57805190612a5b826126fc565b91612a696040519384611bc3565b808352602083019188860160208360071b83010111612b8f5760208101925b60208360071b8301018410612b0657505050509061014091610120850152820101516101408301526020810151938415158503612b025760408201516001600160401b038111612afe57820191818101601f84011215612afe5790612af592910190602081519101612732565b90923880612836565b8480fd5b8380fd5b6080848b89010312612b8b576040518060808101106001600160401b03608083011117612b77576020809392826080809401604052875181528288015183820152612b5360408901612713565b6040820152612b6460608901612713565b6060820152815201940193909150612a88565b634e487b7160e01b8a52604160045260248afd5b8880fd5b8780fd5b8580fd5b8280fd5b6040513d84823e3d90fd5b90612bb082611be4565b612bbd6040519182611bc3565b8281528092612bce601f1991611be4565b019060203691013756fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8c9815a58669fc89297bdc7dd447c098116f98e79093735c0992d0967b696ed9a264697066735822122077ab3363a173d281c5b021a5972ba9833f75cb633b2b18fa5c18dce0bbb0d35d64736f6c6343000813003300000000000000000000000098f3c9e6e3face36baad05fe09d375ef1464288b000000000000000000000000670fd103b1a08628e9557cd66b87ded8411151900000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001d68747470733a2f2f6d657461646174612e79303074732e636f6d2f792f000000
Deployed Bytecode
0x608080604052600436101561001357600080fd5b60003560e01c90816301ffc9a714611a145750806304634d8d146119dc57806306fdde0314611945578063081812fc14611927578063095ea7b3146117ab57806323b872dd146117875780632a55205a146116db5780633659cfe61461151b57806342842e0e146114e85780634f1ef2861461120657806352d1902d146111425780635944c753146110655780636352211e1461103557806370a0823114610f9d578063715018a614610f3557806379ba509714610eaf5780638a616bc014610e825780638da5cb5b14610e5957806395d89b4114610d71578063a22cb46514610c9e578063aa1b103f14610c7e578063b7e31add14610806578063b88d4fde14610790578063c87b56dd1461050c578063cef9a20214610356578063e02c792c14610252578063e30c397814610228578063e985e9c5146101d15763f2fde38b1461015e57600080fd5b346101cc5760203660031901126101cc57610177611aad565b61017f611ce4565b61012d80546001600160a01b0319166001600160a01b0392831690811790915560fb549091167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700600080a3005b600080fd5b346101cc5760403660031901126101cc576101ea611aad565b6101f2611ac3565b9060018060a01b0380911660005261016460205260406000209116600052602052602060ff604060002054166040519015158152f35b346101cc5760003660031901126101cc5761012d546040516001600160a01b039091168152602090f35b346101cc5760e061026b61026536611c46565b90612767565b015160168151036103445760028151106103085761ffff6002820151169060168151106102cb576022015160601c906102a4818361256b565b7fb9203d657e9c0ec8274c818292ab0f58b04e1970050716891770eb1bab5d655e600080a3005b60405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606490fd5b60405162461bcd60e51b8152602060048201526014602482015273746f55696e7431365f6f75744f66426f756e647360601b6044820152606490fd5b604051638d0242c960e01b8152600490fd5b346101cc5760e061036961026536611c46565b0151805160131980820192918084116104e857600193841c9160168211908115916104fe575b5061034457808351106102cb578201600c015160601c92916103b0826126fc565b926103be6040519485611bc3565b8284526103ca836126fc565b9260209283860194601f190136863760005b82811061047257505050835160005b81811061044f57505060405193828501908386525180915260408501939260005b82811061043c57877f03594fecb8a9aaa7406dd20a32bce98ef745336eb214761b085e7c924b71bda688880389a2005b845186529481019493810193830161040c565b918261046861046188958497996126d2565b518961256b565b01949291946103eb565b80849597941b6002908181018082116104e8578451106104ac578301015185919061ffff166104a182876126d2565b5201959392956103dc565b60405162461bcd60e51b8152600481018a90526014602482015273746f55696e7431365f6f75744f66426f756e647360601b6044820152606490fd5b634e487b7160e01b600052601160045260246000fd5b60029150820815158561038f565b346101cc576020806003193601126101cc5760043560008181526101616020526040902054610545906001600160a01b03161515611ebe565b8161057260ff7f000000000000000000000000000000000000000000000000000000000000001d16612ba6565b918183017f68747470733a2f2f6d657461646174612e79303074732e636f6d2f792f00000081528351151560001461077657600091807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008181811015610768575b5050846d04ee2d6d415b85acef81000000008084101561075a575b5050662386f26fc100008083101561074b575b506305f5e1008083101561073c575b506127108083101561072d575b50606482101561071d575b600a80921015610713575b60019081602161063f828801612ba6565b96870101905b6106dd575b505050509261068a929161066a9460405195869351809286860190611ad9565b820161067e82518093868085019101611ad9565b01038084520182611bc3565b905b6106c56025604051846106a88296518092878086019101611ad9565b810164173539b7b760d91b85820152036005810185520183611bc3565b6106d9604051928284938452830190611afc565b0390f35b600019019083906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a83530491821561070e57919082610645565b61064a565b926001019261062e565b9290606460029104910192610623565b60049194920491019287610618565b6008919492049101928761060b565b601091949204910192876105fc565b9401939091049084886105e9565b6040955004915087806105ce565b5050505060405161078681611b8d565b600081529061068c565b346101cc5760803660031901126101cc576107a9611aad565b6107b1611ac3565b90606435906044356001600160401b0383116101cc57610804936107dc6107ff943690600401611bff565b926107ef6107ea8433612084565b611fab565b6107fa83838361214d565b61235c565b612060565b005b346101cc5760803660031901126101cc576004356001600160401b0381116101cc57610836903690600401611bff565b6024356001600160401b0381116101cc57610855903690600401611bff565b906044356001600160a01b03811681036101cc57606435906001600160601b03821682036101cc576000549260ff8460081c161593848095610c71575b8015610c5a575b15610bfe5760ff19811660011760005584610bec575b506108d360ff60005460081c166108c581612417565b6108ce81612417565b612417565b8051906001600160401b038211610add5781906108f261015f54611f31565b601f8111610b74575b50602090601f8311600114610afe57600092610af3575b50508160011b916000199060031b1c19161761015f555b8351936001600160401b038511610add57610160906109488254611f31565b601f8111610a79575b50602090601f87116001146109f1579580916109a896976000926109e6575b50508160011b916000199060031b1c19161790555b61099a60ff60005460081c166108c581612417565b6109a333611c8f565b6124d6565b6109ae57005b61ff0019600054166000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a1005b015190508780610970565b90601f19871691836000527fec7e130cdeeae65215fabbcddb1de429e603c4887cc659532eda903e493396639260005b818110610a6157509160019391896109a8999a9410610a48575b505050811b019055610985565b015160001960f88460031b161c19169055878080610a3b565b92936020600181928786015181550195019301610a21565b826000527fec7e130cdeeae65215fabbcddb1de429e603c4887cc659532eda903e49339663601f880160051c81019160208910610ad3575b601f0160051c01905b818110610ac75750610951565b60008155600101610aba565b9091508190610ab1565b634e487b7160e01b600052604160045260246000fd5b015190508680610912565b61015f6000908152600080516020612bf98339815191529350601f198516905b818110610b5c5750908460019594939210610b43575b505050811b0161015f55610929565b015160001960f88460031b161c19169055868080610b34565b92936020600181928786015181550195019301610b1e565b90915061015f600052601f830160051c600080516020612bf9833981519152019060208410610bd6575b90601f8493920160051c600080516020612bf983398151915201905b818110610bc757506108fb565b60008155849350600101610bba565b600080516020612bf98339815191529150610b9e565b61ffff191661010117600055856108af565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b1580156108995750600160ff821614610899565b50600160ff821610610892565b346101cc5760003660031901126101cc57610c97611ce4565b600060c955005b346101cc5760403660031901126101cc57610cb7611aad565b602435908115158092036101cc576001600160a01b031690338214610d2c5733600052610164602052604060002082600052602052604060002060ff1981541660ff83161790556040519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b60405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606490fd5b346101cc5760003660031901126101cc5760405160006101608054610d9581611f31565b80855291600191808316908115610e2f5750600114610dd3575b6106d985610dbf81870382611bc3565b604051918291602083526020830190611afc565b600090815292507fec7e130cdeeae65215fabbcddb1de429e603c4887cc659532eda903e493396635b828410610e17575050508101602001610dbf826106d9610daf565b80546020858701810191909152909301928101610dfc565b8695506106d996935060209250610dbf94915060ff191682840152151560051b8201019293610daf565b346101cc5760003660031901126101cc5760fb546040516001600160a01b039091168152602090f35b346101cc5760203660031901126101cc57610e9b611ce4565b600435600090815260ca6020526040812055005b346101cc5760003660031901126101cc5761012d54336001600160a01b0390911603610ede5761080433611c8f565b60405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608490fd5b346101cc5760003660031901126101cc57610f4e611ce4565b61012d80546001600160a01b031990811690915560fb805491821690556000906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346101cc5760203660031901126101cc576001600160a01b03610fbe611aad565b168015610fde576000526101626020526020604060002054604051908152f35b60405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608490fd5b346101cc5760203660031901126101cc576020611053600435611f0a565b6040516001600160a01b039091168152f35b346101cc5760603660031901126101cc5761107e611ac3565b6044356001600160601b0381168091036101cc5761109a611ce4565b6110a8612710821115612477565b6001600160a01b039182169182156110fd57604051926110c784611b56565b83526020830191825260043560005260ca6020526040600020925116906001600160601b0360a01b905160a01b16179055600080f35b60405162461bcd60e51b815260206004820152601b60248201527f455243323938313a20496e76616c696420706172616d657465727300000000006044820152606490fd5b346101cc5760003660031901126101cc577f000000000000000000000000ef9080ae61c13c8d389b1811b5708fb363f39be16001600160a01b0316300361119b576020604051600080516020612bd98339815191528152f35b60405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608490fd5b60403660031901126101cc5761121a611aad565b6024356001600160401b0381116101cc57611239903690600401611bff565b6001600160a01b037f000000000000000000000000ef9080ae61c13c8d389b1811b5708fb363f39be1811692919061127330851415611d3c565b611290600080516020612bd9833981519152948286541614611d9d565b611298611ce4565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156112ce5750506108049150611dfe565b82919216604051936352d1902d60e01b85526020948581600481865afa600091816114b9575b506113555760405162461bcd60e51b815260048101879052602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608490fd5b036114625761136382611dfe565b604051907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a282511580159061145a575b61139d57005b813b1561140957506000828192856108049695519201905af46113be611e8e565b907f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c604051936113ed85611ba8565b60278552840152660819985a5b195960ca1b60408401526123d7565b62461bcd60e51b815260048101849052602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608490fd5b506001611397565b60405162461bcd60e51b815260048101859052602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608490fd5b9091508681813d83116114e1575b6114d18183611bc3565b810103126101cc575190876112f4565b503d6114c7565b346101cc576108046107ff6114fc36611b21565b906040519261150a84611b8d565b600084526107ef6107ea8433612084565b346101cc576020806003193601126101cc57611535611aad565b6001600160a01b037f000000000000000000000000ef9080ae61c13c8d389b1811b5708fb363f39be1811661156c30821415611d3c565b611589600080516020612bd9833981519152918383541614611d9d565b611591611ce4565b6040519161159e83611b8d565b600083527f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156115d9575050506108049150611dfe565b83929316906040516352d1902d60e01b81528581600481865afa600091816116ac575b5061165d5760405162461bcd60e51b815260048101879052602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608490fd5b036114625761166b82611dfe565b604051907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a28251158015906116a45761139d57005b506000611397565b9091508681813d83116116d4575b6116c48183611bc3565b810103126101cc575190876115fc565b503d6116ba565b346101cc5760403660031901126101cc5760243560043560005260ca6020526040600020906040519161170d83611b56565b546001600160a01b0380821680855260a09290921c6020850152929015611765575b6001600160601b03602082015116918281029281840414901517156104e857604092612710915116918351928352046020820152f35b5060405161177281611b56565b60c954838116825260a01c602082015261172f565b346101cc5761080461179836611b21565b916117a66107ea8433612084565b61214d565b346101cc5760403660031901126101cc576117c4611aad565b602435906001600160a01b0380806117db85611f0a565b169216918083146118d8578033149081156118b2575b50156118475760008381526101636020526040902080546001600160a01b0319168317905561181f83611f0a565b167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a4005b60405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608490fd5b905060005261016460205260406000203360005260205260ff60406000205416846117f1565b60405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608490fd5b346101cc5760203660031901126101cc576020611053600435611f6b565b346101cc5760003660031901126101cc57604051600061015f805461196981611f31565b80855291600191808316908115610e2f5750600114611992576106d985610dbf81870382611bc3565b60009081529250600080516020612bf98339815191525b8284106119c4575050508101602001610dbf826106d9610daf565b805460208587018101919091529093019281016119a9565b346101cc5760403660031901126101cc576119f5611aad565b6024356001600160601b03811681036101cc57610804916109a3611ce4565b346101cc5760203660031901126101cc576004359063ffffffff60e01b82168092036101cc5760209163152a902d60e11b8114908115611a9c575b818015611a5f575b505015158152f35b6380ac58cd60e01b82149250908215611a8b575b508115611a83575b508380611a57565b905083611a7b565b635b5e139f60e01b14915084611a73565b6301ffc9a760e01b81149150611a4f565b600435906001600160a01b03821682036101cc57565b602435906001600160a01b03821682036101cc57565b60005b838110611aec5750506000910152565b8181015183820152602001611adc565b90602091611b1581518092818552858086019101611ad9565b601f01601f1916010190565b60609060031901126101cc576001600160a01b039060043582811681036101cc579160243590811681036101cc579060443590565b604081019081106001600160401b03821117610add57604052565b61016081019081106001600160401b03821117610add57604052565b602081019081106001600160401b03821117610add57604052565b606081019081106001600160401b03821117610add57604052565b90601f801991011681019081106001600160401b03821117610add57604052565b6001600160401b038111610add57601f01601f191660200190565b81601f820112156101cc57803590611c1682611be4565b92611c246040519485611bc3565b828452602083830101116101cc57816000926020809301838601378301015290565b9060206003198301126101cc576004356001600160401b03928382116101cc57806023830112156101cc5781600401359384116101cc57602484830101116101cc576024019190565b61012d80546001600160a01b031990811690915560fb80549182166001600160a01b0393841690811790915591167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b60fb546001600160a01b03163303611cf857565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b15611d4357565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b6064820152608490fd5b15611da457565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b6064820152608490fd5b803b15611e3357600080516020612bd983398151915280546001600160a01b0319166001600160a01b03909216919091179055565b60405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b3d15611eb9573d90611e9f82611be4565b91611ead6040519384611bc3565b82523d6000602084013e565b606090565b15611ec557565b60405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606490fd5b600090815261016160205260409020546001600160a01b0316611f2e811515611ebe565b90565b90600182811c92168015611f61575b6020831014611f4b57565b634e487b7160e01b600052602260045260246000fd5b91607f1691611f40565b60008181526101616020526040902054611f8f906001600160a01b03161515611ebe565b600090815261016360205260409020546001600160a01b031690565b15611fb257565b60405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b6064820152608490fd5b60809060208152603260208201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b60608201520190565b1561206757565b60405162461bcd60e51b8152806120806004820161200d565b0390fd5b906001600160a01b03808061209884611f0a565b169316918383149384156120cb575b5083156120b5575b50505090565b6120c191929350611f6b565b16143880806120af565b90935060005261016460205260406000208260005260205260ff6040600020541692386120a7565b156120fa57565b60405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608490fd5b906121759161215b84611f0a565b6001600160a01b03939184169284929091831684146120f3565b1691821561221057816121929161218b86611f0a565b16146120f3565b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6000848152610163602052604081206001600160601b0360a01b90818154169055838252610162602052604082206000198154019055848252604082206001815401905585825261016160205284604083209182541617905580a4565b60405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608490fd5b9091600091803b15612353576122ac6020918493604051948580948193630a85bd0160e11b9a8b84523360048501528460248501526044840152608060648401526084830190611afc565b03926001600160a01b03165af190829082612304575b50506122f6576122d0611e8e565b805190816122f15760405162461bcd60e51b8152806120806004820161200d565b602001fd5b6001600160e01b0319161490565b909192506020813d821161234b575b8161232060209383611bc3565b810103126123475751906001600160e01b03198216820361234457509038806122c2565b80fd5b5080fd5b3d9150612313565b50505050600190565b91926000929190813b156123cd576020916123b29185604051958680958194630a85bd0160e11b9b8c845233600485015260018060a01b0380951660248501526044840152608060648401526084830190611afc565b0393165af1908290826123045750506122f6576122d0611e8e565b5050505050600190565b909190156123e3575090565b8151156123f35750805190602001fd5b60405162461bcd60e51b815260206004820152908190612080906024830190611afc565b1561241e57565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b1561247e57565b60405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608490fd5b906001600160601b038116916124f0612710841115612477565b6001600160a01b031691821561252657602060405161250e81611b56565b848152015260a01b6001600160a01b0319161760c955565b60405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606490fd5b60405161257781611b8d565b6000808252926001600160a01b03831692831561264257816107ff94612640966125c06125ba8460005261016160205260018060a01b0360406000205416151590565b15612686565b600083815261016160205260409020546125e4906001600160a01b031615156125ba565b818152610162602052604081206001815401905582815261016160205260408120826001600160601b0360a01b8254161790557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4612261565b565b606460405162461bcd60e51b815260206004820152602060248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152fd5b1561268d57565b60405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606490fd5b80518210156126e65760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b6001600160401b038111610add5760051b60200190565b519060ff821682036101cc57565b519063ffffffff821682036101cc57565b9092919261273f81611be4565b9161274d6040519384611bc3565b8294828452828201116101cc576020612640930190611ad9565b60405160449161277682611b71565b8360009384928385528360208601528360408601528360608601528360808601528360a08601528360c0860152606060e08601528361014061010096828882015260606101208201520152604051968793849263607ec5ef60e11b845260206004850152816024850152848401378181018301859052601f01601f191681010301817f00000000000000000000000098f3c9e6e3face36baad05fe09d375ef1464288b6001600160a01b03165afa908115612b9b57829383918493612909575b5050156128e45750600561ffff606084015116036128d25760808201517f000000000000000000000000670fd103b1a08628e9557cd66b87ded841115190036128c057610140820190815181526101918060205260ff6040832054166128ae5760409251825260205220600160ff1982541617905590565b60405163032a925360e41b8152600490fd5b604051636b99980160e11b8152600490fd5b60405163eae0fb0960e01b8152600490fd5b6040516366fd14ef60e01b815260206004820152908190612080906024830190611afc565b92509350503d928383823e61291e8482611bc3565b6060818581010312612b975780516001600160401b038111612b02576101608183018684010312612b02576040519261295684611b71565b612961828401612713565b8452612971602083850101612721565b6020850152612984604083850101612721565b60408501526060828401015161ffff81168103612b935760608501528282016080818101519086015260a001516001600160401b0381168103612b935760a08501526129d460c083850101612713565b60c085015260e082840101516001600160401b038111612b935782840101868401601f82011215612b9357612a129087850190602081519101612732565b60e0850152612a248183850101612721565b9084015261012081830101516001600160401b038111612afe5781830101858301601f82011215612afe57805190612a5b826126fc565b91612a696040519384611bc3565b808352602083019188860160208360071b83010111612b8f5760208101925b60208360071b8301018410612b0657505050509061014091610120850152820101516101408301526020810151938415158503612b025760408201516001600160401b038111612afe57820191818101601f84011215612afe5790612af592910190602081519101612732565b90923880612836565b8480fd5b8380fd5b6080848b89010312612b8b576040518060808101106001600160401b03608083011117612b77576020809392826080809401604052875181528288015183820152612b5360408901612713565b6040820152612b6460608901612713565b6060820152815201940193909150612a88565b634e487b7160e01b8a52604160045260248afd5b8880fd5b8780fd5b8580fd5b8280fd5b6040513d84823e3d90fd5b90612bb082611be4565b612bbd6040519182611bc3565b8281528092612bce601f1991611be4565b019060203691013756fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8c9815a58669fc89297bdc7dd447c098116f98e79093735c0992d0967b696ed9a264697066735822122077ab3363a173d281c5b021a5972ba9833f75cb633b2b18fa5c18dce0bbb0d35d64736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000098f3c9e6e3face36baad05fe09d375ef1464288b000000000000000000000000670fd103b1a08628e9557cd66b87ded8411151900000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001d68747470733a2f2f6d657461646174612e79303074732e636f6d2f792f000000
-----Decoded View---------------
Arg [0] : wormhole (address): 0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B
Arg [1] : emitterAddress (bytes32): 0x000000000000000000000000670fd103b1a08628e9557cd66b87ded841115190
Arg [2] : baseUri (bytes): 0x68747470733a2f2f6d657461646174612e79303074732e636f6d2f792f
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 00000000000000000000000098f3c9e6e3face36baad05fe09d375ef1464288b
Arg [1] : 000000000000000000000000670fd103b1a08628e9557cd66b87ded841115190
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [3] : 000000000000000000000000000000000000000000000000000000000000001d
Arg [4] : 68747470733a2f2f6d657461646174612e79303074732e636f6d2f792f000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.