Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60406101 | 16940172 | 527 days ago | IN | 0 ETH | 0.09646416 |
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:
DeGods
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
default 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 {IERC721Upgradeable, ERC721Upgradeable, ERC721EnumerableUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.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 DeBridge * @notice ERC721 that mints tokens based on VAAs. */ contract DeGods is UUPSUpgradeable, ERC721EnumerableUpgradeable, ERC2981Upgradeable, Ownable2StepUpgradeable { using BytesLib for bytes; using SafeERC20 for IERC20; // Wormhole chain id that valid vaas must have -- must be Solana. uint16 constant SOURCE_CHAIN_ID = 1; // -- immutable members (baked into the code by the constructor of the logic contract) // Core layer Wormhole contract. IWormhole private immutable _wormhole; // ERC20 DUST token contract. IERC20 private immutable _dustToken; // 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; // Amount of DUST to transfer to the minter on upon relayed mint. uint256 private _dustAmountOnMint; // Amount of gas token (ETH, MATIC, etc.) to transfer to the minter on upon relayed mint. uint256 private _gasTokenAmountOnMint; // Dictionary of VAA hash => flag that keeps track of claimed VAAs mapping(bytes32 => bool) private _claimedVaas; error WrongEmitterChainId(); error WrongEmitterAddress(); error FailedVaaParseAndVerification(string reason); error VaaAlreadyClaimed(); error InvalidMessageLength(); error BaseUriEmpty(); error BaseUriTooLong(); error InvalidMsgValue(); event Minted( uint256 indexed tokenId, address indexed receiver ); //constructor for the logic(!) contract constructor( IWormhole wormhole, IERC20 dustToken, bytes32 emitterAddress, bytes memory baseUri ) { if (baseUri.length == 0) { revert BaseUriEmpty(); } if (baseUri.length > 32) { revert BaseUriTooLong(); } _wormhole = wormhole; _dustToken = dustToken; _emitterAddress = emitterAddress; _baseUri = bytes32(baseUri); _baseUriLength = uint8(baseUri.length); //brick logic contract initialize("","",0,0,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, uint256 dustAmountOnMint, uint256 gasTokenAmountOnMint, address royaltyReceiver, uint96 royaltyFeeNumerator ) public initializer { _dustAmountOnMint = dustAmountOnMint; _gasTokenAmountOnMint = gasTokenAmountOnMint; __UUPSUpgradeable_init(); __ERC721_init(name, symbol); __ERC2981_init(); __Ownable_init(); _setDefaultRoyalty(royaltyReceiver, royaltyFeeNumerator); } function updateAmountsOnMint( uint256 dustAmountOnMint, uint256 gasTokenAmountOnMint ) external onlyOwner { _dustAmountOnMint = dustAmountOnMint; _gasTokenAmountOnMint = gasTokenAmountOnMint; } function getAmountsOnMint() external view returns (uint256 dustAmountOnMint, uint256 gasTokenAmountOnMint) { dustAmountOnMint = _dustAmountOnMint; gasTokenAmountOnMint = _gasTokenAmountOnMint; } /** * Mints an NFT based on an valid VAA and kickstarts the recipient's wallet with * gas tokens (ETH or MATIC) and DUST (taken from msg.sender unless msg.sender is recipient). * TokenId and recipient address are taken from the VAA. * The Wormhole message must have been published by the DeBridge instance of the * NFT collection with the specified emitter on Solana (chainId = 1). */ function receiveAndMint(bytes calldata vaa) external payable { (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; (uint256 tokenId, address evmRecipient) = parsePayload(vm.payload); _safeMint(evmRecipient, tokenId); emit Minted(tokenId, evmRecipient); if (msg.sender != evmRecipient) { if (msg.value != _gasTokenAmountOnMint) revert InvalidMsgValue(); payable(evmRecipient).transfer(msg.value); _dustToken.safeTransferFrom(msg.sender, evmRecipient, _dustAmountOnMint); } else //if the recipient relays the message themselves then they must not include any gas token if (msg.value != 0) revert InvalidMsgValue(); } 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); } // ---- ERC721 ---- function tokenURI(uint256 tokenId) public view override returns (string memory) { return string.concat(super.tokenURI(tokenId), ".json"); } function _baseURI() internal view override returns (string memory baseUri) { baseUri = new string(_baseUriLength); bytes32 tmp = _baseUri; assembly ("memory-safe") { mstore(add(baseUri, 32), tmp) } } // ---- 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); } // ---- ERC165 ---- function supportsInterface(bytes4 interfaceId) public view override(ERC721EnumerableUpgradeable, ERC2981Upgradeable) returns (bool) { return super.supportsInterface(interfaceId); } }
// 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 (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; import "../ERC721Upgradeable.sol"; import "./IERC721EnumerableUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable { function __ERC721Enumerable_init() internal onlyInitializing { } function __ERC721Enumerable_init_unchained() internal onlyInitializing { } // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) { return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721Upgradeable.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721EnumerableUpgradeable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev See {ERC721-_beforeTokenTransfer}. */ function _beforeTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize ) internal virtual override { super._beforeTokenTransfer(from, to, firstTokenId, batchSize); if (batchSize > 1) { // Will only trigger during construction. Batch transferring (minting) is not available afterwards. revert("ERC721Enumerable: consecutive transfers not supported"); } uint256 tokenId = firstTokenId; if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721Upgradeable.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } /** * @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[46] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721EnumerableUpgradeable is IERC721Upgradeable { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// 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/", "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":"contract IERC20","name":"dustToken","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":[{"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":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":[],"name":"getAmountsOnMint","outputs":[{"internalType":"uint256","name":"dustAmountOnMint","type":"uint256"},{"internalType":"uint256","name":"gasTokenAmountOnMint","type":"uint256"}],"stateMutability":"view","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":"uint256","name":"dustAmountOnMint","type":"uint256"},{"internalType":"uint256","name":"gasTokenAmountOnMint","type":"uint256"},{"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":"payable","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":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"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":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"dustAmountOnMint","type":"uint256"},{"internalType":"uint256","name":"gasTokenAmountOnMint","type":"uint256"}],"name":"updateAmountsOnMint","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
6040610140815234620006255762003732803803806200001f816200064a565b92833981019160808284031262000625578151916001600160a01b038084168403620006255760209384830151828116810362000625578385015160608501516001600160401b039586821162000625570191601f93898585011215620006255783518781116200036d57601f19946200009f82880187168c016200064a565b9b828d528b838301011162000625578a9060005b838110620006105750506000918c01015230608052895115620005ff57888a5111620005ee5760a05260c05260e0528651968681015197878110620005d9575b5061010097885260ff8091511696610120978852620001116200062a565b9260008452620001206200062a565b906000825260005495848760081c161595868097620005cc575b8015620005b4575b156200055957600197878960ff1983161760005562000546575b5060006101c35560006101c455620001918660005460081c16620001808162000670565b6200018b8162000670565b62000670565b8051908a82116200036d5760c954908982811c921680156200053b575b8783101462000451578184849311620004e4575b5086908483116001146200047e5760009262000472575b5050600019600383901b1c191690881b1760c9555b8251928984116200036d5760ca54928884811c9416801562000467575b8685101462000451578383869511620003f6575b50859284116001146200038f575060009262000383575b5050600019600383901b1c191690851b1760ca555b62000263600054928360081c16620001808162000670565b610191805461015f80547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e098919790966001600160a01b0319969387169592339089168b600080a38b51808d019b8c11818d10176200036d578360009c918d928f5284815201528161012d5562000335575b50505055803316911617905533908280a351906130609283620006d28439608051838181611750015281816118d20152611be5015260a05183610304015260c051836105c3015260e0518361035f01525182610b9e01525181610b720152f35b7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989261ff0019168a558a51908152a1388080620002d5565b634e487b7160e01b600052604160045260246000fd5b01519050388062000236565b8894929192169160ca600052856000209260005b87828210620003df5750508411620003c5575b505050811b0160ca556200024b565b015160001960f88460031b161c19169055388080620003b6565b8385015186558b97909501949384019301620003a3565b909192935060ca600052856000208480870160051c82019288881062000447575b9187968c92969594930160051c01915b828110620004375750506200021f565b600081558796508b910162000427565b9250819262000417565b634e487b7160e01b600052602260045260246000fd5b93607f16936200020b565b015190503880620001d9565b90858b94169160c9600052886000209260005b8a828210620004cd5750508411620004b3575b505050811b0160c955620001ee565b015160001960f88460031b161c19169055388080620004a4565b8385015186558e9790950194938401930162000491565b90915060c9600052866000208480850160051c82019289861062000531575b918c91869594930160051c01915b82811062000521575050620001c2565b600081558594508c910162000511565b9250819262000503565b91607f1691620001ae565b61ffff191661010117600055386200015c565b8a5162461bcd60e51b815260048101869052602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b15801562000142575060018689161462000142565b506001868916106200013a565b60001990880360031b1b9097169638620000f3565b875163d1eae93360e01b8152600490fd5b8751633b0187cd60e21b8152600490fd5b818101830151818f018401528c9201620000b3565b600080fd5b60405190602082016001600160401b038111838210176200036d57604052565b6040519190601f01601f191682016001600160401b038111838210176200036d57604052565b156200067857565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fdfe6080806040526004908136101561001557600080fd5b600091823560e01c91826301ffc9a7146121ad5750816304634d8d1461217457816306fdde03146120ce578163081812fc146120b0578163095ea7b314611f3a57816318160ddd14611f1c57816323b872dd14611ef75781632a55205a14611e3a5781632f745c5914611d8b5781633659cfe614611bbd57816342842e0e14611b8a5781634f1ef286146118925781634f6ccce71461180057816352d1902d1461173c5781635944c753146116625781636352211e146116325781636a76d4ae1461160b57816370a08231146115df578163715018a61461157657816379ba5097146114ef5781638a616bc0146114c25781638da5cb5b1461149857816395d89b41146113b357816397b3355214610f43578163a22cb46514610e72578163aa1b103f14610e51578163b128a29914610e2e578163b88d4fde14610db7578163c87b56dd14610b2d578163e02c792c1461027b57508063e30c397814610251578063e985e9c5146102015763f2fde38b1461018f57600080fd5b346101fe5760203660031901126101fe576101a861224c565b6101b0612450565b61019180546001600160a01b0319166001600160a01b0392831690811790915561015f549091167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227008380a380f35b80fd5b50346101fe5760403660031901126101fe5760ff604060209261022261224c565b61022a612267565b6001600160a01b03918216835260ce86528383209116825284522054604051911615158152f35b50346101fe57806003193601126101fe57610191546040516001600160a01b039091168152602090f35b90506020366003190112610b295780356001600160401b038111610b255736602382011215610b2557808201356001600160401b038111610b215760249184368484840101116101fe5783926040519283809263607ec5ef60e11b8252602089830152808783015280604498899401848401378181018301859052601f01601f191681010301817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa8015610b1657859186908792610848575b5015610821575061ffff90600182606083015116036108105760808101517f0000000000000000000000000000000000000000000000000000000000000000036107ff576101408101805187526101c5908160205260ff6040892054166107ee5751875260205260408620805460ff1916600117905560e001518051909190601519016107dd5760028251106107a45760028201511690601681511061076a576022015160601c906040516103f381612341565b868152821561072857600082815260cb6020526040902054610421906001600160a01b031615155b15612f24565b60fd5482885260fe602052806040892055600160401b811015610716576105269161047284610459846001610521960160fd55612cda565b90919082549060031b91821b91600019901b1916179055565b61047b8561262b565b858a5260fb60205260408a20818b526020528460408b2055848a5260fc60205260408a20556104c261041b8560005260cb60205260018060a01b0360406000205416151590565b84895260cc602052604089206001815401905583895260cb60205260408920856001600160601b0360a01b82541617905583858a7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a48385612b6b565b612841565b81604051917fb9203d657e9c0ec8274c818292ab0f58b04e1970050716891770eb1bab5d655e8880a33382146106fc57506101c45434036106eb57848034156106e2575b81808092853491f1156106d7576101c3546040519060208201926323b872dd60e01b845233858401528583015260648201526064815260a08101918183106001600160401b038411176106c557604083905261063892917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169188918291906105fa86612310565b602086527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460c0820152519082855af16106326125fb565b91612f70565b805180610648575b505050505080f35b81602091810103126106c15760206106609101612f17565b1561066c578080610640565b60849291602a7f5361666545524332303a204552433230206f7065726174696f6e20646964206e9260206040519562461bcd60e51b8752860152840152820152691bdd081cdd58d8d9595960b21b6064820152fd5b8480fd5b634e487b7160e01b8752604186528387fd5b6040513d86823e3d90fd5b506108fc61056a565b604051631841b4e160e01b81528490fd5b925050503461070a57505080f35b631841b4e160e01b8152fd5b634e487b7160e01b8852604187528488fd5b60405162461bcd60e51b81526020818801819052818601527f4552433732313a206d696e7420746f20746865207a65726f206164647265737381870152606490fd5b60405162461bcd60e51b815260208187015260158185015274746f416464726573735f6f75744f66426f756e647360581b81860152606490fd5b60405162461bcd60e51b815260208187015260148185015273746f55696e7431365f6f75744f66426f756e647360601b81860152606490fd5b604051638d0242c960e01b81528590fd5b60405163032a925360e41b81528790fd5b604051636b99980160e11b81528590fd5b60405163eae0fb0960e01b81528590fd5b6040516366fd14ef60e01b815260208187015290819061084490828601906122a0565b0390fd5b925050503d908186823e61085c8282612377565b60609081818481010312610b125780516001600160401b038111610b0e5761016092838284018685010312610a57576040519384018481106001600160401b03821117610afc576040526108b1828401612ec1565b84526108c1602083850101612ecf565b60208501526108d4604083850101612ecf565b604085015280828401015161ffff81168103610af8578185015260808083850101518186015260a083850101516001600160401b0381168103610af45760a086015261092460c084860101612ec1565b60c086015260e083850101516001600160401b038111610af45783850101868501601f82011215610af4576109629087860190602081519101612ee0565b60e08601526101006109778185870101612ecf565b9086015261012083850101516001600160401b038111610af45783850101868501601f82011215610af4578051906001600160401b038211610ae257604051936109c760208460051b0186612377565b828552602085019189880160208560071b83010111610ade5760208101925b60208560071b8301018410610a5b5750505050505061012084015261014080918301015190830152610a1a60208201612f17565b9260408201516001600160401b038111610a5757820190808301601f83011215610a5757610a4f920190602081519101612ee0565b90913861033f565b8880fd5b85848c8b010312610ada5760405180878101106001600160401b038883011117610ac65760208093928289809401604052875181528288015183820152610aa460408901612ec1565b6040820152610ab4878901612ec1565b878201528152019401939091506109e6565b5050634e487b7160e01b8e5260418d528a8efd5b8e80fd5b8d80fd5b634e487b7160e01b8c5260418b52888cfd5b8a80fd5b8980fd5b634e487b7160e01b8a5260418952868afd5b8780fd5b8680fd5b6040513d87823e3d90fd5b8380fd5b8280fd5b5080fd5b905034610b2957602091826003193601126101fe578135600081815260cb602052604090205484929190610b6b906001600160a01b031615156126a2565b610b9760ff7f000000000000000000000000000000000000000000000000000000000000000016612fd8565b93838501917f0000000000000000000000000000000000000000000000000000000000000000835285511515600014610d9c5780809285917a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000009081811015610d8e575b5050866d04ee2d6d415b85acef810000000080861015610d7f575b5050662386f26fc1000080851015610d70575b506305f5e10080851015610d61575b5061271080851015610d55575b50506064831015610d47575b600a80931015610d3f575b9060219160019281610c6a85809401612fd8565b9750870101905b610d09575b5050505092610cb69291610c96946040519586935180928686019061227d565b8201610caa8251809386808501910161227d565b01038084520182612377565b905b610cf1602560405184610cd4829651809287808601910161227d565b810164173539b7b760d91b85820152036005810185520183612377565b610d056040519282849384528301906122a0565b0390f35b600019019083906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a835304918215610d3a57919082610c71565b610c76565b600101610c56565b916064600291049201610c4b565b90930492013880610c3f565b60089192940493019038610c32565b60109192940493019038610c23565b90919294049301908638610c10565b049350604091503880610bf5565b50505091505060405190610daf82612341565b815290610cb8565b905034610b29576080366003190112610b2957610dd261224c565b90610ddb612267565b91604435606435936001600160401b038511610e2a57610e0461052194610e27963691016123b3565b92610e17610e128433612861565b61278c565b610e22838383612929565b612c5f565b80f35b8580fd5b82346101fe57610e3d366122fa565b90610e46612450565b6101c3556101c45580f35b82346101fe57806003193601126101fe57610e6a612450565b8061012d5580f35b905034610b29576040366003190112610b2957610e8d61224c565b60243590811515809203610b21576001600160a01b031691338314610eff575033835260ce602052604083208284526020526040832060ff1981541660ff83161790556040519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a380f35b60649060206040519162461bcd60e51b8352820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152fd5b905034610b295760c0366003190112610b29576001600160401b03908035828111610b2157610f7590369083016123b3565b6024358381116106c157610f8c90369084016123b3565b92608435906001600160a01b0382168203610e2a5760a435926001600160601b0384168403610b125786549560ff8760081c1615958680976113a6575b801561138f575b1561133457600197878960ff198316178b55611323575b506044356101c3556064356101c45561101860ff8a5460081c1661100a81612d6c565b61101381612d6c565b612d6c565b8251848111611310578061102d60c954612714565b94601f958681116112a2575b50602090868311600114611223578c92611218575b5050600019600383901b1c191690891b1760c9555b8151938411611205575061107860ca54612714565b8281116111a2575b50602091831160011461111d576110d394939291889183611112575b5050600019600383901b1c191690861b1760ca555b6110c560ff875460081c1661100a81612d6c565b6110ce336123fa565b612e2b565b6110db575080f35b60207f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989161ff00198454168455604051908152a180f35b01519050388061109c565b60ca885293929186917f42d72674974f694b5f5159593243114d38a5c39c89d6b62fee061ff523240ee190601f1983168a5b81811061118a575096836110d39810611171575b505050811b0160ca556110b1565b015160001960f88460031b161c19169055388080611163565b8289015184558a95909301926020928301920161114f565b60ca89527f42d72674974f694b5f5159593243114d38a5c39c89d6b62fee061ff523240ee18380860160051c820192602087106111fc575b0160051c019088905b8281106111f1575050611080565b8a81550188906111e3565b925081926111da565b634e487b7160e01b895260419052602488fd5b01519050388061104e565b60c98d528b93507f66be4f155c5ef2ebd3772b228f2f00681e4ed5826cdb3b1943cc11ad15ad1d289190601f1984168e5b81811061128a57508411611271575b505050811b0160c955611063565b015160001960f88460031b161c19169055388080611263565b8284015185558e969094019360209384019301611254565b90915060c98c527f66be4f155c5ef2ebd3772b228f2f00681e4ed5826cdb3b1943cc11ad15ad1d288680850160051c82019260208610611307575b918d91869594930160051c01915b8281106112f9575050611039565b8e81558594508d91016112eb565b925081926112dd565b634e487b7160e01b8a526041825260248afd5b61ffff191661010117895538610fe7565b60849060206040519162461bcd60e51b8352820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152fd5b50303b158015610fd05750600160ff891614610fd0565b50600160ff891610610fc9565b82346101fe57806003193601126101fe57604051908060ca546113d581612714565b8085529160019180831690811561146e5750600114611413575b610d05856113ff81870382612377565b6040519182916020835260208301906122a0565b925060ca83527f42d72674974f694b5f5159593243114d38a5c39c89d6b62fee061ff523240ee15b8284106114565750505081016020016113ff82610d056113ef565b8054602085870181019190915290930192810161143b565b869550610d05969350602092506113ff94915060ff191682840152151560051b82010192936113ef565b82346101fe57806003193601126101fe5761015f546040516001600160a01b039091168152602090f35b905034610b29576020366003190112610b29576114dd612450565b35815261012e60205280604081205580f35b905034610b295781600319360112610b295761019154336001600160a01b03909116036115205750610e27336123fa565b60849060206040519162461bcd60e51b8352820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152fd5b82346101fe57806003193601126101fe5761158f612450565b61019180546001600160a01b031990811690915561015f8054918216905581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b82346101fe5760203660031901126101fe5760206116036115fe61224c565b61262b565b604051908152f35b82346101fe57806003193601126101fe5760406101c3546101c45482519182526020820152f35b82346101fe5760203660031901126101fe57602061165083356126ee565b6040516001600160a01b039091168152f35b905034610b29576060366003190112610b295761167d612267565b604435906001600160601b038216809203610b215761169a612450565b6116a8612710831115612dcc565b6001600160a01b039081169283156116f857604051936116c785612310565b84526020840192835235845261012e60205260408420925116906001600160601b0360a01b905160a01b1617905580f35b60649060206040519162461bcd60e51b8352820152601b60248201527f455243323938313a20496e76616c696420706172616d657465727300000000006044820152fd5b82346101fe57806003193601126101fe57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316300361179657602060405160008051602061300b8339815191528152f35b60849060206040519162461bcd60e51b8352820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152fd5b82346101fe5760203660031901126101fe575080359060fd5482101561183957602061182b83612cda565b90546040519160031b1c8152f35b60849060206040519162461bcd60e51b8352820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152fd5b90506040366003190112610b29576118a861224c565b906024356001600160401b038111610b21576118c790369083016123b3565b906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811690611900308314156124a9565b61191d60008051602061300b83398151915292828454161461250a565b611925612450565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561195c5750505050610e279061256b565b84919395929416604051936352d1902d60e01b855260209485818881865afa859181611b5b575b506119e35760405162461bcd60e51b8152808801879052602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608490fd5b959192939503611b05576119f68361256b565b604051917fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8680a2855115801590611afd575b611a37575b50505050905080f35b823b15611aae575050918084611aa394848397519201905af4611a586125fb565b907f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c60405193611a878561235c565b60278552840152660819985a5b195960ca1b6040840152612d27565b508038808080611a2e565b62461bcd60e51b82528101839052602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608490fd5b506001611a29565b60405162461bcd60e51b8152908101849052602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608490fd5b9091508681813d8311611b83575b611b738183612377565b81010312610e2a57519038611983565b503d611b69565b82346101fe57610e27610521611b9f366122c5565b9060405192611bad84612341565b868452610e17610e128433612861565b905034610b2957602080600319360112610b2557611bd961224c565b916001600160a01b03917f00000000000000000000000000000000000000000000000000000000000000008316611c12308214156124a9565b611c2f60008051602061300b83398151915291858354161461250a565b611c37612450565b60405193611c4485612341565b8685527f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611c7f575050505050610e279061256b565b85929496939516906040516352d1902d60e01b815285818881865afa859181611d5c575b50611d035760405162461bcd60e51b8152808801879052602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608490fd5b959192939503611b0557611d168361256b565b604051917fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8680a2855115801590611d5557611a375750505050905080f35b5084611a29565b9091508681813d8311611d84575b611d748183612377565b81010312610e2a57519038611ca3565b503d611d6a565b905034610b29576040366003190112610b2957611da661224c565b60243591611db38261262b565b831015611de2576001600160a01b038216845260fb602090815260408086208587528252808620549051908152f35b60849060206040519162461bcd60e51b8352820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152fd5b82346101fe57611e49366122fa565b9190815261012e602052604081209060405191611e6583612310565b546001600160a01b0380821680855260a09290921c602085015292919015611ed2575b6001600160601b0360208301511693848102948186041490151715611ebf5760408461271085855116918351928352046020820152f35b634e487b7160e01b815260118552602490fd5b9050604051611ee081612310565b61012d54838116825260a01c602082015290611e88565b82346101fe57610e27611f09366122c5565b91611f17610e128433612861565b612929565b82346101fe57806003193601126101fe57602060fd54604051908152f35b905034610b29576040366003190112610b2957611f5561224c565b602435916001600160a01b03908180611f6d866126ee565b1693169280841461206257803314908115612041575b5015611fd7575082845260cd6020526040842080546001600160a01b03191683179055611faf836126ee565b167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258480a480f35b60849060206040519162461bcd60e51b8352820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152fd5b9050855260ce6020526040852033865260205260ff60408620541638611f83565b60405162461bcd60e51b8152602081840152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608490fd5b82346101fe5760203660031901126101fe576020611650833561274e565b82346101fe57806003193601126101fe57604051908060c9546120f081612714565b8085529160019180831690811561146e575060011461211957610d05856113ff81870382612377565b925060c983527f66be4f155c5ef2ebd3772b228f2f00681e4ed5826cdb3b1943cc11ad15ad1d285b82841061215c5750505081016020016113ff82610d056113ef565b80546020858701810191909152909301928101612141565b82346101fe5760403660031901126101fe5761218e61224c565b6024356001600160601b0381168103610b2557610e27916110ce612450565b915034610b25576020366003190112610b25573563ffffffff60e01b8116809103610b25576020925063152a902d60e11b81149081156121ef575b5015158152f35b63780e9d6360e01b811491508115612209575b50386121e8565b6380ac58cd60e01b81149150811561223b575b811561222a575b5038612202565b6301ffc9a760e01b14905038612223565b635b5e139f60e01b8114915061221c565b600435906001600160a01b038216820361226257565b600080fd5b602435906001600160a01b038216820361226257565b60005b8381106122905750506000910152565b8181015183820152602001612280565b906020916122b98151809281855285808601910161227d565b601f01601f1916010190565b6060906003190112612262576001600160a01b0390600435828116810361226257916024359081168103612262579060443590565b6040906003190112612262576004359060243590565b604081019081106001600160401b0382111761232b57604052565b634e487b7160e01b600052604160045260246000fd5b602081019081106001600160401b0382111761232b57604052565b606081019081106001600160401b0382111761232b57604052565b90601f801991011681019081106001600160401b0382111761232b57604052565b6001600160401b03811161232b57601f01601f191660200190565b81601f82011215612262578035906123ca82612398565b926123d86040519485612377565b8284526020838301011161226257816000926020809301838601378301015290565b61019180546001600160a01b031990811690915561015f80549182166001600160a01b0393841690811790915591167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b61015f546001600160a01b0316330361246557565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b156124b057565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b6064820152608490fd5b1561251157565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b6064820152608490fd5b803b156125a05760008051602061300b83398151915280546001600160a01b0319166001600160a01b03909216919091179055565b60405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b3d15612626573d9061260c82612398565b9161261a6040519384612377565b82523d6000602084013e565b606090565b6001600160a01b0316801561264b5760005260cc60205260406000205490565b60405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608490fd5b156126a957565b60405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606490fd5b600090815260cb60205260409020546001600160a01b03166127118115156126a2565b90565b90600182811c92168015612744575b602083101461272e57565b634e487b7160e01b600052602260045260246000fd5b91607f1691612723565b600081815260cb6020526040902054612771906001600160a01b031615156126a2565b600090815260cd60205260409020546001600160a01b031690565b1561279357565b60405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b6064820152608490fd5b60809060208152603260208201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b60608201520190565b1561284857565b60405162461bcd60e51b815280610844600482016127ee565b906001600160a01b038080612875846126ee565b169316918383149384156128a8575b508315612892575b50505090565b61289e9192935061274e565b161438808061288c565b90935060005260ce60205260406000208260005260205260ff604060002054169238612884565b156128d657565b60405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608490fd5b61294d91612936846126ee565b6001600160a01b03938484169391851684146128cf565b838216938415612b1a57839182612a615750905060fd54908560005260fe60205281604060002055600160401b82101561232b576129b39261299a8761045985600189970160fd55612cda565b828603612a2e575b506129ac866126ee565b16146128cf565b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600084815260cd602052604081206001600160601b0360a01b9081815416905583825260cc602052604082206000198154019055848252604082206001815401905585825260cb60205284604083209182541617905580a4565b612a379061262b565b6040600087815260fb602052818120838252602052888282205588815260fc6020522055386129a2565b858303612a73575b506129b39261299a565b612a7e91925061262b565b600019810191908211612b04576129b392849260009088825260209060fc825260409182842054828103612acd575b508a8452838381205586845260fb81528284209184525281205592612a69565b87855260fb825283852083865282528385205488865260fb835284862082875283528085872055855260fc82528385205538612aad565b634e487b7160e01b600052601160045260246000fd5b60405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608490fd5b9091600091803b15612c5657612bb66020918493604051948580948193630a85bd0160e11b9a8b845233600485015284602485015260448401526080606484015260848301906122a0565b03926001600160a01b03165af190829082612c0e575b5050612c0057612bda6125fb565b80519081612bfb5760405162461bcd60e51b815280610844600482016127ee565b602001fd5b6001600160e01b0319161490565b909192506020813d8211612c4e575b81612c2a60209383612377565b81010312610b295751906001600160e01b0319821682036101fe5750903880612bcc565b3d9150612c1d565b50505050600190565b91926000929190813b15612cd057602091612cb59185604051958680958194630a85bd0160e11b9b8c845233600485015260018060a01b03809516602485015260448401526080606484015260848301906122a0565b0393165af190829082612c0e575050612c0057612bda6125fb565b5050505050600190565b60fd54811015612d115760fd6000527f9346ac6dd7de6b96975fec380d4d994c4c12e6a8897544f22915316cc6cca2800190600090565b634e487b7160e01b600052603260045260246000fd5b90919015612d33575090565b905b805190919015612d485750805190602001fd5b60405162461bcd60e51b8152602060048201529081906108449060248301906122a0565b15612d7357565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b15612dd357565b60405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608490fd5b906001600160601b03811691612e45612710841115612dcc565b6001600160a01b0316918215612e7c576020604051612e6381612310565b848152015260a01b6001600160a01b0319161761012d55565b60405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606490fd5b519060ff8216820361226257565b519063ffffffff8216820361226257565b90929192612eed81612398565b91612efb6040519384612377565b829482845282820111612262576020612f1593019061227d565b565b5190811515820361226257565b15612f2b57565b60405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606490fd5b91929015612fd25750815115612f84575090565b3b15612f8d5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b82612d35565b90612fe282612398565b612fef6040519182612377565b8281528092613000601f1991612398565b019060203691013756fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca2646970667358221220355486524ecb4d0537b03c8a88d9eb9d8268357df08250fef1315a39ca965f6c64736f6c6343000813003300000000000000000000000098f3c9e6e3face36baad05fe09d375ef1464288b000000000000000000000000b5b1b659da79a2507c27aad509f15b4874edc0cce298490ef8d01f56d0460c07e60e753040fe2ca53f56d39925df0f654cd995bd0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001e68747470733a2f2f6d657461646174612e6465676f64732e636f6d2f672f0000
Deployed Bytecode
0x6080806040526004908136101561001557600080fd5b600091823560e01c91826301ffc9a7146121ad5750816304634d8d1461217457816306fdde03146120ce578163081812fc146120b0578163095ea7b314611f3a57816318160ddd14611f1c57816323b872dd14611ef75781632a55205a14611e3a5781632f745c5914611d8b5781633659cfe614611bbd57816342842e0e14611b8a5781634f1ef286146118925781634f6ccce71461180057816352d1902d1461173c5781635944c753146116625781636352211e146116325781636a76d4ae1461160b57816370a08231146115df578163715018a61461157657816379ba5097146114ef5781638a616bc0146114c25781638da5cb5b1461149857816395d89b41146113b357816397b3355214610f43578163a22cb46514610e72578163aa1b103f14610e51578163b128a29914610e2e578163b88d4fde14610db7578163c87b56dd14610b2d578163e02c792c1461027b57508063e30c397814610251578063e985e9c5146102015763f2fde38b1461018f57600080fd5b346101fe5760203660031901126101fe576101a861224c565b6101b0612450565b61019180546001600160a01b0319166001600160a01b0392831690811790915561015f549091167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227008380a380f35b80fd5b50346101fe5760403660031901126101fe5760ff604060209261022261224c565b61022a612267565b6001600160a01b03918216835260ce86528383209116825284522054604051911615158152f35b50346101fe57806003193601126101fe57610191546040516001600160a01b039091168152602090f35b90506020366003190112610b295780356001600160401b038111610b255736602382011215610b2557808201356001600160401b038111610b215760249184368484840101116101fe5783926040519283809263607ec5ef60e11b8252602089830152808783015280604498899401848401378181018301859052601f01601f191681010301817f00000000000000000000000098f3c9e6e3face36baad05fe09d375ef1464288b6001600160a01b03165afa8015610b1657859186908792610848575b5015610821575061ffff90600182606083015116036108105760808101517fe298490ef8d01f56d0460c07e60e753040fe2ca53f56d39925df0f654cd995bd036107ff576101408101805187526101c5908160205260ff6040892054166107ee5751875260205260408620805460ff1916600117905560e001518051909190601519016107dd5760028251106107a45760028201511690601681511061076a576022015160601c906040516103f381612341565b868152821561072857600082815260cb6020526040902054610421906001600160a01b031615155b15612f24565b60fd5482885260fe602052806040892055600160401b811015610716576105269161047284610459846001610521960160fd55612cda565b90919082549060031b91821b91600019901b1916179055565b61047b8561262b565b858a5260fb60205260408a20818b526020528460408b2055848a5260fc60205260408a20556104c261041b8560005260cb60205260018060a01b0360406000205416151590565b84895260cc602052604089206001815401905583895260cb60205260408920856001600160601b0360a01b82541617905583858a7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a48385612b6b565b612841565b81604051917fb9203d657e9c0ec8274c818292ab0f58b04e1970050716891770eb1bab5d655e8880a33382146106fc57506101c45434036106eb57848034156106e2575b81808092853491f1156106d7576101c3546040519060208201926323b872dd60e01b845233858401528583015260648201526064815260a08101918183106001600160401b038411176106c557604083905261063892917f000000000000000000000000b5b1b659da79a2507c27aad509f15b4874edc0cc6001600160a01b03169188918291906105fa86612310565b602086527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460c0820152519082855af16106326125fb565b91612f70565b805180610648575b505050505080f35b81602091810103126106c15760206106609101612f17565b1561066c578080610640565b60849291602a7f5361666545524332303a204552433230206f7065726174696f6e20646964206e9260206040519562461bcd60e51b8752860152840152820152691bdd081cdd58d8d9595960b21b6064820152fd5b8480fd5b634e487b7160e01b8752604186528387fd5b6040513d86823e3d90fd5b506108fc61056a565b604051631841b4e160e01b81528490fd5b925050503461070a57505080f35b631841b4e160e01b8152fd5b634e487b7160e01b8852604187528488fd5b60405162461bcd60e51b81526020818801819052818601527f4552433732313a206d696e7420746f20746865207a65726f206164647265737381870152606490fd5b60405162461bcd60e51b815260208187015260158185015274746f416464726573735f6f75744f66426f756e647360581b81860152606490fd5b60405162461bcd60e51b815260208187015260148185015273746f55696e7431365f6f75744f66426f756e647360601b81860152606490fd5b604051638d0242c960e01b81528590fd5b60405163032a925360e41b81528790fd5b604051636b99980160e11b81528590fd5b60405163eae0fb0960e01b81528590fd5b6040516366fd14ef60e01b815260208187015290819061084490828601906122a0565b0390fd5b925050503d908186823e61085c8282612377565b60609081818481010312610b125780516001600160401b038111610b0e5761016092838284018685010312610a57576040519384018481106001600160401b03821117610afc576040526108b1828401612ec1565b84526108c1602083850101612ecf565b60208501526108d4604083850101612ecf565b604085015280828401015161ffff81168103610af8578185015260808083850101518186015260a083850101516001600160401b0381168103610af45760a086015261092460c084860101612ec1565b60c086015260e083850101516001600160401b038111610af45783850101868501601f82011215610af4576109629087860190602081519101612ee0565b60e08601526101006109778185870101612ecf565b9086015261012083850101516001600160401b038111610af45783850101868501601f82011215610af4578051906001600160401b038211610ae257604051936109c760208460051b0186612377565b828552602085019189880160208560071b83010111610ade5760208101925b60208560071b8301018410610a5b5750505050505061012084015261014080918301015190830152610a1a60208201612f17565b9260408201516001600160401b038111610a5757820190808301601f83011215610a5757610a4f920190602081519101612ee0565b90913861033f565b8880fd5b85848c8b010312610ada5760405180878101106001600160401b038883011117610ac65760208093928289809401604052875181528288015183820152610aa460408901612ec1565b6040820152610ab4878901612ec1565b878201528152019401939091506109e6565b5050634e487b7160e01b8e5260418d528a8efd5b8e80fd5b8d80fd5b634e487b7160e01b8c5260418b52888cfd5b8a80fd5b8980fd5b634e487b7160e01b8a5260418952868afd5b8780fd5b8680fd5b6040513d87823e3d90fd5b8380fd5b8280fd5b5080fd5b905034610b2957602091826003193601126101fe578135600081815260cb602052604090205484929190610b6b906001600160a01b031615156126a2565b610b9760ff7f000000000000000000000000000000000000000000000000000000000000001e16612fd8565b93838501917f68747470733a2f2f6d657461646174612e6465676f64732e636f6d2f672f0000835285511515600014610d9c5780809285917a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000009081811015610d8e575b5050866d04ee2d6d415b85acef810000000080861015610d7f575b5050662386f26fc1000080851015610d70575b506305f5e10080851015610d61575b5061271080851015610d55575b50506064831015610d47575b600a80931015610d3f575b9060219160019281610c6a85809401612fd8565b9750870101905b610d09575b5050505092610cb69291610c96946040519586935180928686019061227d565b8201610caa8251809386808501910161227d565b01038084520182612377565b905b610cf1602560405184610cd4829651809287808601910161227d565b810164173539b7b760d91b85820152036005810185520183612377565b610d056040519282849384528301906122a0565b0390f35b600019019083906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a835304918215610d3a57919082610c71565b610c76565b600101610c56565b916064600291049201610c4b565b90930492013880610c3f565b60089192940493019038610c32565b60109192940493019038610c23565b90919294049301908638610c10565b049350604091503880610bf5565b50505091505060405190610daf82612341565b815290610cb8565b905034610b29576080366003190112610b2957610dd261224c565b90610ddb612267565b91604435606435936001600160401b038511610e2a57610e0461052194610e27963691016123b3565b92610e17610e128433612861565b61278c565b610e22838383612929565b612c5f565b80f35b8580fd5b82346101fe57610e3d366122fa565b90610e46612450565b6101c3556101c45580f35b82346101fe57806003193601126101fe57610e6a612450565b8061012d5580f35b905034610b29576040366003190112610b2957610e8d61224c565b60243590811515809203610b21576001600160a01b031691338314610eff575033835260ce602052604083208284526020526040832060ff1981541660ff83161790556040519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a380f35b60649060206040519162461bcd60e51b8352820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152fd5b905034610b295760c0366003190112610b29576001600160401b03908035828111610b2157610f7590369083016123b3565b6024358381116106c157610f8c90369084016123b3565b92608435906001600160a01b0382168203610e2a5760a435926001600160601b0384168403610b125786549560ff8760081c1615958680976113a6575b801561138f575b1561133457600197878960ff198316178b55611323575b506044356101c3556064356101c45561101860ff8a5460081c1661100a81612d6c565b61101381612d6c565b612d6c565b8251848111611310578061102d60c954612714565b94601f958681116112a2575b50602090868311600114611223578c92611218575b5050600019600383901b1c191690891b1760c9555b8151938411611205575061107860ca54612714565b8281116111a2575b50602091831160011461111d576110d394939291889183611112575b5050600019600383901b1c191690861b1760ca555b6110c560ff875460081c1661100a81612d6c565b6110ce336123fa565b612e2b565b6110db575080f35b60207f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989161ff00198454168455604051908152a180f35b01519050388061109c565b60ca885293929186917f42d72674974f694b5f5159593243114d38a5c39c89d6b62fee061ff523240ee190601f1983168a5b81811061118a575096836110d39810611171575b505050811b0160ca556110b1565b015160001960f88460031b161c19169055388080611163565b8289015184558a95909301926020928301920161114f565b60ca89527f42d72674974f694b5f5159593243114d38a5c39c89d6b62fee061ff523240ee18380860160051c820192602087106111fc575b0160051c019088905b8281106111f1575050611080565b8a81550188906111e3565b925081926111da565b634e487b7160e01b895260419052602488fd5b01519050388061104e565b60c98d528b93507f66be4f155c5ef2ebd3772b228f2f00681e4ed5826cdb3b1943cc11ad15ad1d289190601f1984168e5b81811061128a57508411611271575b505050811b0160c955611063565b015160001960f88460031b161c19169055388080611263565b8284015185558e969094019360209384019301611254565b90915060c98c527f66be4f155c5ef2ebd3772b228f2f00681e4ed5826cdb3b1943cc11ad15ad1d288680850160051c82019260208610611307575b918d91869594930160051c01915b8281106112f9575050611039565b8e81558594508d91016112eb565b925081926112dd565b634e487b7160e01b8a526041825260248afd5b61ffff191661010117895538610fe7565b60849060206040519162461bcd60e51b8352820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152fd5b50303b158015610fd05750600160ff891614610fd0565b50600160ff891610610fc9565b82346101fe57806003193601126101fe57604051908060ca546113d581612714565b8085529160019180831690811561146e5750600114611413575b610d05856113ff81870382612377565b6040519182916020835260208301906122a0565b925060ca83527f42d72674974f694b5f5159593243114d38a5c39c89d6b62fee061ff523240ee15b8284106114565750505081016020016113ff82610d056113ef565b8054602085870181019190915290930192810161143b565b869550610d05969350602092506113ff94915060ff191682840152151560051b82010192936113ef565b82346101fe57806003193601126101fe5761015f546040516001600160a01b039091168152602090f35b905034610b29576020366003190112610b29576114dd612450565b35815261012e60205280604081205580f35b905034610b295781600319360112610b295761019154336001600160a01b03909116036115205750610e27336123fa565b60849060206040519162461bcd60e51b8352820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152fd5b82346101fe57806003193601126101fe5761158f612450565b61019180546001600160a01b031990811690915561015f8054918216905581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b82346101fe5760203660031901126101fe5760206116036115fe61224c565b61262b565b604051908152f35b82346101fe57806003193601126101fe5760406101c3546101c45482519182526020820152f35b82346101fe5760203660031901126101fe57602061165083356126ee565b6040516001600160a01b039091168152f35b905034610b29576060366003190112610b295761167d612267565b604435906001600160601b038216809203610b215761169a612450565b6116a8612710831115612dcc565b6001600160a01b039081169283156116f857604051936116c785612310565b84526020840192835235845261012e60205260408420925116906001600160601b0360a01b905160a01b1617905580f35b60649060206040519162461bcd60e51b8352820152601b60248201527f455243323938313a20496e76616c696420706172616d657465727300000000006044820152fd5b82346101fe57806003193601126101fe57507f000000000000000000000000da2a61615e1966440724747cf65e93592434ae0f6001600160a01b0316300361179657602060405160008051602061300b8339815191528152f35b60849060206040519162461bcd60e51b8352820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152fd5b82346101fe5760203660031901126101fe575080359060fd5482101561183957602061182b83612cda565b90546040519160031b1c8152f35b60849060206040519162461bcd60e51b8352820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152fd5b90506040366003190112610b29576118a861224c565b906024356001600160401b038111610b21576118c790369083016123b3565b906001600160a01b037f000000000000000000000000da2a61615e1966440724747cf65e93592434ae0f811690611900308314156124a9565b61191d60008051602061300b83398151915292828454161461250a565b611925612450565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561195c5750505050610e279061256b565b84919395929416604051936352d1902d60e01b855260209485818881865afa859181611b5b575b506119e35760405162461bcd60e51b8152808801879052602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608490fd5b959192939503611b05576119f68361256b565b604051917fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8680a2855115801590611afd575b611a37575b50505050905080f35b823b15611aae575050918084611aa394848397519201905af4611a586125fb565b907f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c60405193611a878561235c565b60278552840152660819985a5b195960ca1b6040840152612d27565b508038808080611a2e565b62461bcd60e51b82528101839052602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608490fd5b506001611a29565b60405162461bcd60e51b8152908101849052602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608490fd5b9091508681813d8311611b83575b611b738183612377565b81010312610e2a57519038611983565b503d611b69565b82346101fe57610e27610521611b9f366122c5565b9060405192611bad84612341565b868452610e17610e128433612861565b905034610b2957602080600319360112610b2557611bd961224c565b916001600160a01b03917f000000000000000000000000da2a61615e1966440724747cf65e93592434ae0f8316611c12308214156124a9565b611c2f60008051602061300b83398151915291858354161461250a565b611c37612450565b60405193611c4485612341565b8685527f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611c7f575050505050610e279061256b565b85929496939516906040516352d1902d60e01b815285818881865afa859181611d5c575b50611d035760405162461bcd60e51b8152808801879052602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608490fd5b959192939503611b0557611d168361256b565b604051917fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8680a2855115801590611d5557611a375750505050905080f35b5084611a29565b9091508681813d8311611d84575b611d748183612377565b81010312610e2a57519038611ca3565b503d611d6a565b905034610b29576040366003190112610b2957611da661224c565b60243591611db38261262b565b831015611de2576001600160a01b038216845260fb602090815260408086208587528252808620549051908152f35b60849060206040519162461bcd60e51b8352820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152fd5b82346101fe57611e49366122fa565b9190815261012e602052604081209060405191611e6583612310565b546001600160a01b0380821680855260a09290921c602085015292919015611ed2575b6001600160601b0360208301511693848102948186041490151715611ebf5760408461271085855116918351928352046020820152f35b634e487b7160e01b815260118552602490fd5b9050604051611ee081612310565b61012d54838116825260a01c602082015290611e88565b82346101fe57610e27611f09366122c5565b91611f17610e128433612861565b612929565b82346101fe57806003193601126101fe57602060fd54604051908152f35b905034610b29576040366003190112610b2957611f5561224c565b602435916001600160a01b03908180611f6d866126ee565b1693169280841461206257803314908115612041575b5015611fd7575082845260cd6020526040842080546001600160a01b03191683179055611faf836126ee565b167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258480a480f35b60849060206040519162461bcd60e51b8352820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152fd5b9050855260ce6020526040852033865260205260ff60408620541638611f83565b60405162461bcd60e51b8152602081840152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608490fd5b82346101fe5760203660031901126101fe576020611650833561274e565b82346101fe57806003193601126101fe57604051908060c9546120f081612714565b8085529160019180831690811561146e575060011461211957610d05856113ff81870382612377565b925060c983527f66be4f155c5ef2ebd3772b228f2f00681e4ed5826cdb3b1943cc11ad15ad1d285b82841061215c5750505081016020016113ff82610d056113ef565b80546020858701810191909152909301928101612141565b82346101fe5760403660031901126101fe5761218e61224c565b6024356001600160601b0381168103610b2557610e27916110ce612450565b915034610b25576020366003190112610b25573563ffffffff60e01b8116809103610b25576020925063152a902d60e11b81149081156121ef575b5015158152f35b63780e9d6360e01b811491508115612209575b50386121e8565b6380ac58cd60e01b81149150811561223b575b811561222a575b5038612202565b6301ffc9a760e01b14905038612223565b635b5e139f60e01b8114915061221c565b600435906001600160a01b038216820361226257565b600080fd5b602435906001600160a01b038216820361226257565b60005b8381106122905750506000910152565b8181015183820152602001612280565b906020916122b98151809281855285808601910161227d565b601f01601f1916010190565b6060906003190112612262576001600160a01b0390600435828116810361226257916024359081168103612262579060443590565b6040906003190112612262576004359060243590565b604081019081106001600160401b0382111761232b57604052565b634e487b7160e01b600052604160045260246000fd5b602081019081106001600160401b0382111761232b57604052565b606081019081106001600160401b0382111761232b57604052565b90601f801991011681019081106001600160401b0382111761232b57604052565b6001600160401b03811161232b57601f01601f191660200190565b81601f82011215612262578035906123ca82612398565b926123d86040519485612377565b8284526020838301011161226257816000926020809301838601378301015290565b61019180546001600160a01b031990811690915561015f80549182166001600160a01b0393841690811790915591167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b61015f546001600160a01b0316330361246557565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b156124b057565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b6064820152608490fd5b1561251157565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b6064820152608490fd5b803b156125a05760008051602061300b83398151915280546001600160a01b0319166001600160a01b03909216919091179055565b60405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b3d15612626573d9061260c82612398565b9161261a6040519384612377565b82523d6000602084013e565b606090565b6001600160a01b0316801561264b5760005260cc60205260406000205490565b60405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608490fd5b156126a957565b60405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606490fd5b600090815260cb60205260409020546001600160a01b03166127118115156126a2565b90565b90600182811c92168015612744575b602083101461272e57565b634e487b7160e01b600052602260045260246000fd5b91607f1691612723565b600081815260cb6020526040902054612771906001600160a01b031615156126a2565b600090815260cd60205260409020546001600160a01b031690565b1561279357565b60405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b6064820152608490fd5b60809060208152603260208201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b60608201520190565b1561284857565b60405162461bcd60e51b815280610844600482016127ee565b906001600160a01b038080612875846126ee565b169316918383149384156128a8575b508315612892575b50505090565b61289e9192935061274e565b161438808061288c565b90935060005260ce60205260406000208260005260205260ff604060002054169238612884565b156128d657565b60405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608490fd5b61294d91612936846126ee565b6001600160a01b03938484169391851684146128cf565b838216938415612b1a57839182612a615750905060fd54908560005260fe60205281604060002055600160401b82101561232b576129b39261299a8761045985600189970160fd55612cda565b828603612a2e575b506129ac866126ee565b16146128cf565b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600084815260cd602052604081206001600160601b0360a01b9081815416905583825260cc602052604082206000198154019055848252604082206001815401905585825260cb60205284604083209182541617905580a4565b612a379061262b565b6040600087815260fb602052818120838252602052888282205588815260fc6020522055386129a2565b858303612a73575b506129b39261299a565b612a7e91925061262b565b600019810191908211612b04576129b392849260009088825260209060fc825260409182842054828103612acd575b508a8452838381205586845260fb81528284209184525281205592612a69565b87855260fb825283852083865282528385205488865260fb835284862082875283528085872055855260fc82528385205538612aad565b634e487b7160e01b600052601160045260246000fd5b60405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608490fd5b9091600091803b15612c5657612bb66020918493604051948580948193630a85bd0160e11b9a8b845233600485015284602485015260448401526080606484015260848301906122a0565b03926001600160a01b03165af190829082612c0e575b5050612c0057612bda6125fb565b80519081612bfb5760405162461bcd60e51b815280610844600482016127ee565b602001fd5b6001600160e01b0319161490565b909192506020813d8211612c4e575b81612c2a60209383612377565b81010312610b295751906001600160e01b0319821682036101fe5750903880612bcc565b3d9150612c1d565b50505050600190565b91926000929190813b15612cd057602091612cb59185604051958680958194630a85bd0160e11b9b8c845233600485015260018060a01b03809516602485015260448401526080606484015260848301906122a0565b0393165af190829082612c0e575050612c0057612bda6125fb565b5050505050600190565b60fd54811015612d115760fd6000527f9346ac6dd7de6b96975fec380d4d994c4c12e6a8897544f22915316cc6cca2800190600090565b634e487b7160e01b600052603260045260246000fd5b90919015612d33575090565b905b805190919015612d485750805190602001fd5b60405162461bcd60e51b8152602060048201529081906108449060248301906122a0565b15612d7357565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b15612dd357565b60405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608490fd5b906001600160601b03811691612e45612710841115612dcc565b6001600160a01b0316918215612e7c576020604051612e6381612310565b848152015260a01b6001600160a01b0319161761012d55565b60405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606490fd5b519060ff8216820361226257565b519063ffffffff8216820361226257565b90929192612eed81612398565b91612efb6040519384612377565b829482845282820111612262576020612f1593019061227d565b565b5190811515820361226257565b15612f2b57565b60405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606490fd5b91929015612fd25750815115612f84575090565b3b15612f8d5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b82612d35565b90612fe282612398565b612fef6040519182612377565b8281528092613000601f1991612398565b019060203691013756fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca2646970667358221220355486524ecb4d0537b03c8a88d9eb9d8268357df08250fef1315a39ca965f6c64736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000098f3c9e6e3face36baad05fe09d375ef1464288b000000000000000000000000b5b1b659da79a2507c27aad509f15b4874edc0cce298490ef8d01f56d0460c07e60e753040fe2ca53f56d39925df0f654cd995bd0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001e68747470733a2f2f6d657461646174612e6465676f64732e636f6d2f672f0000
-----Decoded View---------------
Arg [0] : wormhole (address): 0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B
Arg [1] : dustToken (address): 0xB5b1b659dA79A2507C27AaD509f15B4874EDc0Cc
Arg [2] : emitterAddress (bytes32): 0xe298490ef8d01f56d0460c07e60e753040fe2ca53f56d39925df0f654cd995bd
Arg [3] : baseUri (bytes): 0x68747470733a2f2f6d657461646174612e6465676f64732e636f6d2f672f
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 00000000000000000000000098f3c9e6e3face36baad05fe09d375ef1464288b
Arg [1] : 000000000000000000000000b5b1b659da79a2507c27aad509f15b4874edc0cc
Arg [2] : e298490ef8d01f56d0460c07e60e753040fe2ca53f56d39925df0f654cd995bd
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [4] : 000000000000000000000000000000000000000000000000000000000000001e
Arg [5] : 68747470733a2f2f6d657461646174612e6465676f64732e636f6d2f672f0000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.