Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 2,514 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Deploy Bueno Con... | 16902698 | 639 days ago | IN | 0 ETH | 0.01004022 | ||||
Deploy Bueno Con... | 16900324 | 640 days ago | IN | 0 ETH | 0.01817911 | ||||
Deploy Bueno Con... | 16900221 | 640 days ago | IN | 0 ETH | 0.02069101 | ||||
Deploy Bueno Con... | 16898901 | 640 days ago | IN | 0 ETH | 0.02185603 | ||||
Deploy Bueno Con... | 16898668 | 640 days ago | IN | 0 ETH | 0.03122947 | ||||
Deploy Bueno Con... | 16898664 | 640 days ago | IN | 0 ETH | 0.02006053 | ||||
Deploy Bueno Con... | 16898252 | 640 days ago | IN | 0 ETH | 0.02604632 | ||||
Deploy Bueno Con... | 16898058 | 640 days ago | IN | 0 ETH | 0.01548169 | ||||
Deploy Bueno Con... | 16897713 | 640 days ago | IN | 0 ETH | 0.02835692 | ||||
Deploy Bueno Con... | 16896780 | 640 days ago | IN | 0 ETH | 0.01508934 | ||||
Deploy Bueno Con... | 16894683 | 641 days ago | IN | 0 ETH | 0.01173824 | ||||
Deploy Bueno Con... | 16894042 | 641 days ago | IN | 0 ETH | 0.01056645 | ||||
Deploy Bueno Con... | 16892779 | 641 days ago | IN | 0 ETH | 0.02188514 | ||||
Deploy Bueno Con... | 16892749 | 641 days ago | IN | 0 ETH | 0.02393809 | ||||
Deploy Bueno Con... | 16890384 | 641 days ago | IN | 0 ETH | 0.02504566 | ||||
Deploy Bueno Con... | 16882429 | 642 days ago | IN | 0 ETH | 0.00908549 | ||||
Deploy Bueno Con... | 16881309 | 642 days ago | IN | 0 ETH | 0.00882745 | ||||
Deploy Bueno Con... | 16879906 | 643 days ago | IN | 0 ETH | 0.00880956 | ||||
Deploy Bueno Con... | 16879006 | 643 days ago | IN | 0 ETH | 0.013235 | ||||
Deploy Bueno Con... | 16878846 | 643 days ago | IN | 0 ETH | 0.01405912 | ||||
Deploy Bueno Con... | 16877877 | 643 days ago | IN | 0 ETH | 0.01505937 | ||||
Deploy Bueno Con... | 16877778 | 643 days ago | IN | 0 ETH | 0.02042199 | ||||
Deploy Bueno Con... | 16877452 | 643 days ago | IN | 0 ETH | 0.02568721 | ||||
Deploy Bueno Con... | 16876545 | 643 days ago | IN | 0 ETH | 0.02087653 | ||||
Deploy Bueno Con... | 16875642 | 643 days ago | IN | 0 ETH | 0.00936798 |
Latest 25 internal transactions (View All)
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:
BuenoFactory
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 500 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "./Bueno721Drop.sol"; import "@openzeppelin/contracts/proxy/Clones.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; contract BuenoFactory is AccessControl { address private implementation; address private DEFAULT_OPERATOR_FILTER = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6); event ContractCreated(address creator, address contractAddress); constructor() { implementation = address(new Bueno721Drop()); _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); } function updateDefaultOperatorFilter( address newFilter ) external onlyRole(DEFAULT_ADMIN_ROLE) { DEFAULT_OPERATOR_FILTER = newFilter; } function updateImplementation( address newImplementation ) external onlyRole(DEFAULT_ADMIN_ROLE) { implementation = newImplementation; } function getOperatorFilter() external view returns (address) { return DEFAULT_OPERATOR_FILTER; } function getImplementationAddress() external view returns (address) { return implementation; } function deployBuenoContract( string memory _name, string memory _symbol, string memory _baseUri, RoyaltySettings calldata _royaltySettings, PhaseSettings[] calldata _phases, BaseSettings calldata _baseSettings, PaymentSplitterSettings calldata _paymentSplitterSettings, uint256 _maxIntendedSupply, bool _registerOperatorFilter, bool _allowBurning ) external { address payable clone = payable(Clones.clone(implementation)); address operatorFilter = _registerOperatorFilter ? DEFAULT_OPERATOR_FILTER : address(0); Bueno721Drop(clone).initialize( _name, _symbol, _baseUri, _royaltySettings, _phases, _baseSettings, _paymentSplitterSettings, _maxIntendedSupply, _allowBurning, msg.sender, operatorFilter ); emit ContractCreated(msg.sender, clone); } }
// 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.8.0) (finance/PaymentSplitter.sol) pragma solidity ^0.8.0; import "../token/ERC20/utils/SafeERC20Upgradeable.sol"; import "../utils/AddressUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @title PaymentSplitter * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware * that the Ether will be split in this way, since it is handled transparently by the contract. * * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim * an amount proportional to the percentage of total shares they were assigned. The distribution of shares is set at the * time of contract deployment and can't be updated thereafter. * * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release} * function. * * NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and * tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you * to run tests before sending real value to this contract. */ contract PaymentSplitterUpgradeable is Initializable, ContextUpgradeable { event PayeeAdded(address account, uint256 shares); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20Upgradeable indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20Upgradeable => uint256) private _erc20TotalReleased; mapping(IERC20Upgradeable => mapping(address => uint256)) private _erc20Released; /** * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at * the matching position in the `shares` array. * * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no * duplicates in `payees`. */ function __PaymentSplitter_init(address[] memory payees, uint256[] memory shares_) internal onlyInitializing { __PaymentSplitter_init_unchained(payees, shares_); } function __PaymentSplitter_init_unchained(address[] memory payees, uint256[] memory shares_) internal onlyInitializing { require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch"); require(payees.length > 0, "PaymentSplitter: no payees"); for (uint256 i = 0; i < payees.length; i++) { _addPayee(payees[i], shares_[i]); } } /** * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the * reliability of the events, and not the actual splitting of Ether. * * To learn more about this see the Solidity documentation for * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback * functions]. */ receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20Upgradeable token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20Upgradeable token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Getter for the amount of payee's releasable Ether. */ function releasable(address account) public view returns (uint256) { uint256 totalReceived = address(this).balance + totalReleased(); return _pendingPayment(account, totalReceived, released(account)); } /** * @dev Getter for the amount of payee's releasable `token` tokens. `token` should be the address of an * IERC20 contract. */ function releasable(IERC20Upgradeable token, address account) public view returns (uint256) { uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); return _pendingPayment(account, totalReceived, released(token, account)); } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) public virtual { require(_shares[account] > 0, "PaymentSplitter: account has no shares"); uint256 payment = releasable(account); require(payment != 0, "PaymentSplitter: account is not due payment"); // _totalReleased is the sum of all values in _released. // If "_totalReleased += payment" does not overflow, then "_released[account] += payment" cannot overflow. _totalReleased += payment; unchecked { _released[account] += payment; } AddressUpgradeable.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20Upgradeable token, address account) public virtual { require(_shares[account] > 0, "PaymentSplitter: account has no shares"); uint256 payment = releasable(token, account); require(payment != 0, "PaymentSplitter: account is not due payment"); // _erc20TotalReleased[token] is the sum of all values in _erc20Released[token]. // If "_erc20TotalReleased[token] += payment" does not overflow, then "_erc20Released[token][account] += payment" // cannot overflow. _erc20TotalReleased[token] += payment; unchecked { _erc20Released[token][account] += payment; } SafeERC20Upgradeable.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require(account != address(0), "PaymentSplitter: account is the zero address"); require(shares_ > 0, "PaymentSplitter: shares are 0"); require(_shares[account] == 0, "PaymentSplitter: account already has shares"); _payees.push(account); _shares[account] = shares_; _totalShares = _totalShares + shares_; emit PayeeAdded(account, shares_); } /** * @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[43] 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.8.0) (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 Internal function that returns the initialized version. Returns `_initialized` */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Internal function that returns the initialized version. Returns `_initializing` */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// 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 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 IERC20PermitUpgradeable { /** * @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.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; import "../extensions/draft-IERC20PermitUpgradeable.sol"; import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable { using AddressUpgradeable for address; function safeTransfer( IERC20Upgradeable token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20Upgradeable 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( IERC20Upgradeable 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( IERC20Upgradeable 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( IERC20Upgradeable 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( IERC20PermitUpgradeable 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(IERC20Upgradeable 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 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 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) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/Clones.sol) pragma solidity ^0.8.0; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. * * _Available since v3.4._ */ library Clones { /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes // of the `implementation` address with the bytecode before the address. mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) // Packs the remaining 17 bytes of `implementation` with the bytecode after the address. mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3)) instance := create(0, 0x09, 0x37) } require(instance != address(0), "ERC1167: create failed"); } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes // of the `implementation` address with the bytecode before the address. mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) // Packs the remaining 17 bytes of `implementation` with the bytecode after the address. mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3)) instance := create2(0, 0x09, 0x37, salt) } require(instance != address(0), "ERC1167: create2 failed"); } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(add(ptr, 0x38), deployer) mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff) mstore(add(ptr, 0x14), implementation) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73) mstore(add(ptr, 0x58), salt) mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37)) predicted := keccak256(add(ptr, 0x43), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress(address implementation, bytes32 salt) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates merkle trees that are safe * against this attack out of the box. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} * * _Available since v4.7._ */ function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} * * _Available since v4.7._ */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // 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 IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "erc721a-upgradeable/contracts/extensions/ERC721AQueryableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "@openzeppelin/contracts-upgradeable/finance/PaymentSplitterUpgradeable.sol"; import "operator-filter-registry/src/upgradeable/OperatorFiltererUpgradeable.sol"; struct PhaseSettings { /// @dev phase supply. This can be released to public by ending the phase. uint64 maxSupply; /// @dev tracks the total amount minted in the phase uint64 amountMinted; /// @dev wallet maximum for the phase uint64 maxPerWallet; /// @dev merkle root for the phase (if applicable, otherwise bytes32(0)) bytes32 merkleRoot; /// @dev whether the phase is active bool isActive; /// @dev price for the phase (or free if 0) uint256 price; } struct BaseSettings { /// @dev public sale supply. ending a phase will carry supply into this value uint64 maxSupply; /// @dev global wallet maximum across all phases (including public) uint64 maxPerWallet; /// @dev tracks the total amount minted in the public sale uint64 amountMinted; /// @dev price for the public sale (or free if 0) uint256 price; } struct SaleState { uint64 numPhases; mapping(uint256 => PhaseSettings) phases; } struct PaymentSplitterSettings { address[] payees; uint256[] shares; } struct RoyaltySettings { address royaltyAddress; uint96 royaltyAmount; } error SaleInactive(); error SoldOut(); error InvalidPrice(); error ExceedMaxPerWallet(); error InvalidProof(); error PhaseNotActive(); error NotAllowlisted(); error InvalidMintFunction(); error InvalidAirdrop(); error InvalidPhase(); error BurningNotAllowed(); /// @author Bueno.art /// @title ERC-721 Multi-Phase Drop Contract contract Bueno721Drop is ERC721AQueryableUpgradeable, OwnableUpgradeable, ERC2981Upgradeable, PaymentSplitterUpgradeable, OperatorFiltererUpgradeable { string public _baseTokenURI; SaleState public saleState; BaseSettings public baseSettings; address[] public withdrawAddresses; mapping(address => mapping(uint256 => uint64)) private amountMintedForPhase; bool public isPublicActive; bool private allowBurning; event TokensMinted(address indexed to, uint256 quantity); event TokenBurned(address indexed owner, uint256 tokenId); event TokensAirdropped(uint256 numRecipients, uint256 numTokens); event PhasesActivated(uint256[] phaseIds, bool activatedPublic); event PhasesPaused(uint256[] phaseIds, bool pausedPublic); event PhaseEnded(uint256 phaseIds); event BurnStatusChanged(bool burnActive); event PhaseSettingsUpdated(uint256 phaseId, PhaseSettings settings); event BaseSettingsUpdated(BaseSettings settings); event BaseURIUpdated(string baseURI); event RoyaltyUpdated(address royaltyAddress, uint96 royaltyAmount); /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } function initialize( string memory _name, string memory _symbol, string memory _baseUri, RoyaltySettings calldata _royaltySettings, PhaseSettings[] calldata _phases, BaseSettings calldata _baseSettings, PaymentSplitterSettings calldata _paymentSplitterSettings, uint256 _maxIntendedSupply, bool _allowBurning, address _deployer, address _operatorFilter ) public initializerERC721A initializer { __ERC721A_init(_name, _symbol); __Ownable_init(); __PaymentSplitter_init( _paymentSplitterSettings.payees, _paymentSplitterSettings.shares ); uint64 numPhases = uint64(_phases.length); uint256 supplyValidationCount = _baseSettings.maxSupply; for (uint256 i = 0; i < numPhases; ) { saleState.phases[i] = _phases[i]; supplyValidationCount += _phases[i].maxSupply; // numPhases has a maximum value of 2^64 - 1 unchecked { ++i; } } require( supplyValidationCount == _maxIntendedSupply, "Supply of all phases must equal maxIntendedSupply" ); _baseTokenURI = _baseUri; withdrawAddresses = _paymentSplitterSettings.payees; saleState.numPhases = numPhases; baseSettings = _baseSettings; allowBurning = _allowBurning; _setDefaultRoyalty( _royaltySettings.royaltyAddress, _royaltySettings.royaltyAmount ); transferOwnership(_deployer); OperatorFiltererUpgradeable.__OperatorFilterer_init( _operatorFilter, _operatorFilter == address(0) ? false : true // only subscribe if a filter is provided ); } // ========= EXTERNAL MINTING METHODS ========= /** * @notice Mint tokens for an allowlisted phase * @dev Calling this function for a phase that doesn't have an allowlist will fail */ function mintPhaseAllowlist( uint256 phaseIndex, uint64 quantity, bytes32[] calldata proof ) external payable { uint64 updatedAmountMinted = _checkAllowlistPhaseMintConditions( msg.sender, quantity, proof, phaseIndex, msg.value ); _checkGlobalPerWalletMax(msg.sender, quantity); saleState.phases[phaseIndex].amountMinted += quantity; amountMintedForPhase[msg.sender][phaseIndex] = updatedAmountMinted; _mint(msg.sender, quantity); emit TokensMinted(msg.sender, quantity); } /** * @notice Mint tokens for a non-allowlist phase. * @dev Calling this function for a phase that has an allowlist will fail */ function mintPhase(uint256 phaseIndex, uint64 quantity) external payable { uint64 updatedAmountMinted = _checkPhaseMintConditions( msg.sender, quantity, phaseIndex, msg.value ); _checkGlobalPerWalletMax(msg.sender, quantity); saleState.phases[phaseIndex].amountMinted += quantity; amountMintedForPhase[msg.sender][phaseIndex] = updatedAmountMinted; _mint(msg.sender, quantity); emit TokensMinted(msg.sender, quantity); } /** * @notice Mint tokens in the public sale */ function mintPublic(uint64 quantity) external payable { uint64 updatedAmountMinted = _checkPublicMintConditions( quantity, msg.value ); _checkGlobalPerWalletMax(msg.sender, quantity); baseSettings.amountMinted = updatedAmountMinted; _mint(msg.sender, quantity); emit TokensMinted(msg.sender, quantity); } /** * @notice Mint tokens in all possible phases (including public sale) */ function mintBatch( uint64[] calldata quantities, bytes32[][] calldata proofs, uint256[] calldata phaseIndices, uint64 publicQuantity ) external payable { uint256 phaseLength = phaseIndices.length; if ( phaseLength > saleState.numPhases || phaseLength != quantities.length || phaseLength != proofs.length ) { revert InvalidPhase(); } uint256 balance = msg.value; uint256 quantityToMint; for (uint256 i = 0; i < phaseLength; ) { uint64 updatedAmount; uint256 phaseIndex = phaseIndices[i]; uint64 quantity = quantities[i]; bytes32[] calldata proof = proofs[i]; PhaseSettings storage phase = saleState.phases[phaseIndex]; uint256 priceForPhase = phase.price * quantity; // Since price is strictly checked in the _check* functions below, // we have an additional check here to ensure that the balance doesn't underflow if (balance < priceForPhase) { revert InvalidPrice(); } // if the phase has no allowlist, the merkleRoot will be zeroed out. if (phase.merkleRoot == bytes32(0)) { updatedAmount = _checkPhaseMintConditions( msg.sender, quantity, phaseIndex, priceForPhase ); } else { updatedAmount = _checkAllowlistPhaseMintConditions( msg.sender, quantity, proof, phaseIndex, priceForPhase ); } // quantity & phaseLength have a maximum value of 2^64 - 1 // balance underflow is checked above unchecked { saleState.phases[phaseIndex].amountMinted += quantity; amountMintedForPhase[msg.sender][phaseIndex] = updatedAmount; balance -= priceForPhase; quantityToMint += quantity; ++i; } } uint256 totalMintQuantity = quantityToMint; if (publicQuantity > 0) { _checkPublicMintConditions(publicQuantity, balance); // publicQuantity has a max value of 2^64 - 1 unchecked { baseSettings.amountMinted += publicQuantity; totalMintQuantity += publicQuantity; } } _checkGlobalPerWalletMax(msg.sender, totalMintQuantity); _mint(msg.sender, totalMintQuantity); emit TokensMinted(msg.sender, totalMintQuantity); } /** * @notice Burn a token, if the contract allows for it */ function burn(uint256 tokenId) external { if (!allowBurning) { revert BurningNotAllowed(); } _burn(tokenId, true); emit TokenBurned(msg.sender, tokenId); } // ========= OWNER METHODS ========= /** * @notice Perform a batch airdrop for a particular phase. * @dev Minted tokens are pulled from the phase that is specified in the airdropper. */ function airdropForPhase( uint256 phaseIndex, uint64[] calldata quantities, address[] calldata recipients ) external onlyOwner { uint256 numRecipients = recipients.length; uint256 totalAirdropped; if (numRecipients != quantities.length) revert InvalidAirdrop(); PhaseSettings storage phase = saleState.phases[phaseIndex]; for (uint256 i = 0; i < numRecipients; ) { uint64 updatedAmountMinted = phase.amountMinted + quantities[i]; if (updatedAmountMinted > phase.maxSupply) { revert SoldOut(); } // airdrops are not subject to the per-wallet mint limits, // but we track how much is minted for the phase phase.amountMinted = updatedAmountMinted; totalAirdropped += quantities[i]; _mint(recipients[i], quantities[i]); // numRecipients has a maximum value of 2^256 - 1 unchecked { ++i; } } emit TokensAirdropped(numRecipients, totalAirdropped); } /** * @notice Perform a batch airdrop for the public phase. * @dev Minted tokens are pulled from the public phase. */ function airdropPublic( uint64[] calldata quantities, address[] calldata recipients ) external onlyOwner { uint256 numRecipients = recipients.length; uint256 totalAirdropped; if (numRecipients != quantities.length) revert InvalidAirdrop(); for (uint256 i = 0; i < numRecipients; ) { uint64 updatedAmountMinted = baseSettings.amountMinted + quantities[i]; if (updatedAmountMinted > baseSettings.maxSupply) { revert SoldOut(); } // airdrops are not subject to the per-wallet mint limits, // but we track how much is minted for the phase baseSettings.amountMinted = updatedAmountMinted; totalAirdropped += quantities[i]; _mint(recipients[i], quantities[i]); // numRecipients has a maximum value of 2^256 - 1 unchecked { ++i; } } emit TokensAirdropped(numRecipients, totalAirdropped); } /** * @notice Specify which phases are active. * Public sale can be activated by setting `activatePublic` to true. */ function activatePhases( uint256[] calldata phaseIndices, bool activatePublic ) external onlyOwner { uint256 numPhases = phaseIndices.length; // activate all the phases provided in phaseIndices for (uint256 i = 0; i < numPhases; ) { uint256 phaseIndex = phaseIndices[i]; if (phaseIndex >= saleState.numPhases) { // phaseIndex is out of bounds revert InvalidPhase(); } saleState.phases[phaseIndices[i]].isActive = true; // numPhases has a maximum value of 2^256 - 1 unchecked { ++i; } } // calling this function with activatePublic=false only indicates the public sale // is not intended to be activated, but it does not pause it. if (activatePublic) { isPublicActive = true; } emit PhasesActivated(phaseIndices, activatePublic); } /** * @notice Specify which phases are inactive (paused). * Public sale can be paused by setting `pausePublic` to true. * Pausing is separate from ending, since ending permanently closes the phase. */ function pausePhases( uint256[] calldata phaseIndices, bool pausePublic ) external onlyOwner { uint256 numPhases = phaseIndices.length; for (uint256 i = 0; i < numPhases; ) { uint256 phaseIndex = phaseIndices[i]; if (phaseIndex >= saleState.numPhases) { // phaseIndex is out of bounds revert InvalidPhase(); } saleState.phases[phaseIndex].isActive = false; // numPhases has a maximum value of 2^256 - 1 unchecked { ++i; } } // calling this function with pausePublic=false only indicates the public sale // is not intended to be paused, but it does not pause it. if (pausePublic) { isPublicActive = false; } emit PhasesPaused(phaseIndices, pausePublic); } /** * @notice If enabled, the token can be burned, for approved operators. * @dev The burn method will revert unless this is enabled */ function toggleBurning() external onlyOwner { allowBurning = !allowBurning; emit BurnStatusChanged(allowBurning); } /** * @notice Permanently closes a phase by capping the supply & releasing it */ function endPhase(uint256 phaseIndex) public onlyOwner { PhaseSettings storage phase = saleState.phases[phaseIndex]; // if the phase never had supply, there is nothing to do if (phase.maxSupply == 0) { revert InvalidPhase(); } // transfer the remaining supply into the base settings (used for public sale accounting) baseSettings.maxSupply += phase.maxSupply - phase.amountMinted; // remove the supply from the phase phase.maxSupply = 0; emit PhaseEnded(phaseIndex); } function endPhases(uint64[] calldata phaseIndices) external onlyOwner { uint256 phaseIndicesLength = phaseIndices.length; // ensure that phaseIndices argument will only ever be as large as the number of phases if (phaseIndicesLength > saleState.numPhases) { revert InvalidPhase(); } for (uint256 i = 0; i < phaseIndicesLength; ) { endPhase(phaseIndices[i]); // phaseIndicesLength has a maximum value of 2^256 - 1 unchecked { ++i; } } } /** * @notice Updates the minting rules for a particular phase * @dev supply & amountMinted are not changeable */ function updatePhaseSettings( uint256 phaseIndex, PhaseSettings calldata phase ) external onlyOwner { uint64 existingAmountMinted = saleState.phases[phaseIndex].amountMinted; uint64 existingMaxSupply = saleState.phases[phaseIndex].maxSupply; bool existingStatus = saleState.phases[phaseIndex].isActive; saleState.phases[phaseIndex] = phase; // ensure that the amountMinted, maxSupply, and status values cannot be set saleState.phases[phaseIndex].amountMinted = existingAmountMinted; saleState.phases[phaseIndex].maxSupply = existingMaxSupply; saleState.phases[phaseIndex].isActive = existingStatus; emit PhaseSettingsUpdated(phaseIndex, phase); } /** * @notice Updates the the base minting settings * The global maxPerWallet setting applies to all phases * Pricing and other fields will apply to the public sale * * @dev maxSupply & amountMinted are not changeable */ function updateBaseSettings( BaseSettings calldata _baseSettings ) external onlyOwner { uint64 existingMaxSupply = baseSettings.maxSupply; uint64 existingAmountMinted = baseSettings.amountMinted; baseSettings = _baseSettings; // ensure that the maxSupply & amountMinted value cannot be set baseSettings.maxSupply = existingMaxSupply; baseSettings.amountMinted = existingAmountMinted; emit BaseSettingsUpdated(_baseSettings); } /** * @dev Payment can be pulled via PaymentSplitter.release * this method is provided for convenience to release all payee funds */ function withdraw() external onlyOwner { uint256 numAddresses = withdrawAddresses.length; for (uint256 i = 0; i < numAddresses; ) { address payable withdrawAddress = payable(withdrawAddresses[i]); if (releasable(withdrawAddress) > 0) { release(withdrawAddress); } // numAddresses has a maximum value of 2^256 - 1 unchecked { ++i; } } } function setBaseURI(string memory baseURI) external onlyOwner { _baseTokenURI = baseURI; emit BaseURIUpdated(baseURI); } function setRoyaltyInfo( address receiver, uint96 feeBasisPoints ) external onlyOwner { _setDefaultRoyalty(receiver, feeBasisPoints); emit RoyaltyUpdated(receiver, feeBasisPoints); } // ========= VIEW METHODS ========= function _startTokenId() internal view virtual override returns (uint256) { return 1; } function _checkAllowlistPhaseMintConditions( address wallet, uint64 quantity, bytes32[] calldata proof, uint256 phaseIndex, uint256 balance ) internal view returns (uint64) { PhaseSettings storage phase = saleState.phases[phaseIndex]; if (!phase.isActive) { revert PhaseNotActive(); } // there should be a valid merkle root for the phase if (phase.merkleRoot == bytes32(0)) { revert InvalidMintFunction(); } if (phase.amountMinted + quantity > phase.maxSupply) { revert SoldOut(); } if (balance != quantity * phase.price) { revert InvalidPrice(); } if ( !MerkleProof.verify( proof, phase.merkleRoot, keccak256(abi.encodePacked(wallet)) ) ) { revert InvalidProof(); } uint256 amountMinted = amountMintedForPhase[wallet][phaseIndex]; uint256 updatedAmountMinted = amountMinted + quantity; // phases can have a maxPerWallet if ( phase.maxPerWallet > 0 && updatedAmountMinted > phase.maxPerWallet ) { revert ExceedMaxPerWallet(); } return uint64(updatedAmountMinted); } function _checkPhaseMintConditions( address wallet, uint256 quantity, uint256 phaseIndex, uint256 balance ) internal view returns (uint64) { PhaseSettings storage phase = saleState.phases[phaseIndex]; if (!phase.isActive) { revert PhaseNotActive(); } // the phase should not have a merkleRoot if (phase.merkleRoot != bytes32(0)) { revert InvalidMintFunction(); } if (phase.amountMinted + quantity > phase.maxSupply) { revert SoldOut(); } if (balance != quantity * phase.price) { revert InvalidPrice(); } uint256 amountMinted = amountMintedForPhase[wallet][phaseIndex]; uint256 updatedAmountMinted = amountMinted + quantity; // phases can have a maxPerWallet if ( phase.maxPerWallet > 0 && updatedAmountMinted > phase.maxPerWallet ) { revert ExceedMaxPerWallet(); } return uint64(updatedAmountMinted); } function _checkPublicMintConditions( uint256 quantity, uint256 balance ) internal view returns (uint64) { if (!isPublicActive) { revert PhaseNotActive(); } uint256 updatedAmountMinted = baseSettings.amountMinted + quantity; if (updatedAmountMinted > baseSettings.maxSupply) { revert SoldOut(); } if (balance != quantity * baseSettings.price) { revert InvalidPrice(); } return uint64(updatedAmountMinted); } function _checkGlobalPerWalletMax( address wallet, uint256 quantity ) internal view { if ( baseSettings.maxPerWallet > 0 && _numberMinted(wallet) + quantity > baseSettings.maxPerWallet ) { revert ExceedMaxPerWallet(); } } function getDataForPhase( uint256 phaseIndex ) external view returns (PhaseSettings memory) { return saleState.phases[phaseIndex]; } function getMintBalance(address wallet) external view returns (uint256) { return _numberMinted(wallet); } function getAmountMintedForPhase( uint256 phaseIndex, address wallet ) external view returns (uint64) { return amountMintedForPhase[wallet][phaseIndex]; } function getAmountMintedForOwner( address wallet ) external view returns (uint256[] memory) { uint256[] memory amountMintedPerPhase = new uint256[]( saleState.numPhases + 1 ); for (uint64 i = 0; i < saleState.numPhases; ) { amountMintedPerPhase[i] = amountMintedForPhase[wallet][i]; // numPhases has a maximum value of 2^64 - 1 unchecked { ++i; } } amountMintedPerPhase[saleState.numPhases] = _numberMinted(wallet); return amountMintedPerPhase; } /** * @dev See {ERC721-_baseURI}. */ function _baseURI() internal view virtual override returns (string memory) { return _baseTokenURI; } function supportsInterface( bytes4 interfaceId ) public view virtual override(IERC721AUpgradeable, ERC721AUpgradeable, ERC2981Upgradeable) returns (bool) { return ERC721AUpgradeable.supportsInterface(interfaceId) || ERC2981Upgradeable.supportsInterface(interfaceId); } // ========= OPERATOR FILTERER OVERRIDES ========= function setApprovalForAll( address operator, bool approved ) public override(ERC721AUpgradeable, IERC721AUpgradeable) onlyAllowedOperatorApproval(operator) { super.setApprovalForAll(operator, approved); } function approve( address operator, uint256 tokenId ) public payable override(ERC721AUpgradeable, IERC721AUpgradeable) onlyAllowedOperatorApproval(operator) { super.approve(operator, tokenId); } function transferFrom( address from, address to, uint256 tokenId ) public payable override(ERC721AUpgradeable, IERC721AUpgradeable) onlyAllowedOperator(from) { super.transferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId ) public payable override(ERC721AUpgradeable, IERC721AUpgradeable) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public payable override(ERC721AUpgradeable, IERC721AUpgradeable) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId, data); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable diamond facet 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. * * 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. */ import {ERC721A__InitializableStorage} from './ERC721A__InitializableStorage.sol'; abstract contract ERC721A__Initializable { using ERC721A__InitializableStorage for ERC721A__InitializableStorage.Layout; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializerERC721A() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require( ERC721A__InitializableStorage.layout()._initializing ? _isConstructor() : !ERC721A__InitializableStorage.layout()._initialized, 'ERC721A__Initializable: contract is already initialized' ); bool isTopLevelCall = !ERC721A__InitializableStorage.layout()._initializing; if (isTopLevelCall) { ERC721A__InitializableStorage.layout()._initializing = true; ERC721A__InitializableStorage.layout()._initialized = true; } _; if (isTopLevelCall) { ERC721A__InitializableStorage.layout()._initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializingERC721A() { require( ERC721A__InitializableStorage.layout()._initializing, 'ERC721A__Initializable: contract is not initializing' ); _; } /// @dev Returns true if and only if the function is running in the constructor function _isConstructor() private view returns (bool) { // extcodesize checks the size of the code stored in an address, and // address returns the current address. Since the code is still not // deployed when running a constructor, any checks on its code size will // yield zero, making it an effective way to detect if a contract is // under construction or not. address self = address(this); uint256 cs; assembly { cs := extcodesize(self) } return cs == 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base storage for the initialization function for upgradeable diamond facet contracts **/ library ERC721A__InitializableStorage { struct Layout { /* * Indicates that the contract has been initialized. */ bool _initialized; /* * Indicates that the contract is in the process of being initialized. */ bool _initializing; } bytes32 internal constant STORAGE_SLOT = keccak256('ERC721A.contracts.storage.initializable.facet'); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library ERC721AStorage { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } struct Layout { // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 _currentIndex; // The number of tokens burned. uint256 _burnCounter; // Token name string _name; // Token symbol string _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See {_packedOwnershipOf} implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => ERC721AStorage.TokenApprovalRef) _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) _operatorApprovals; } bytes32 internal constant STORAGE_SLOT = keccak256('ERC721A.contracts.storage.ERC721A'); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721AUpgradeable.sol'; import {ERC721AStorage} from './ERC721AStorage.sol'; import './ERC721A__Initializable.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721ReceiverUpgradeable { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721AUpgradeable is ERC721A__Initializable, IERC721AUpgradeable { using ERC721AStorage for ERC721AStorage.Layout; // ============================================================= // CONSTANTS // ============================================================= // Mask of an entry in packed address data. uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant _BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant _BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant _BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant _BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant _BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant _BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // CONSTRUCTOR // ============================================================= function __ERC721A_init(string memory name_, string memory symbol_) internal onlyInitializingERC721A { __ERC721A_init_unchained(name_, symbol_); } function __ERC721A_init_unchained(string memory name_, string memory symbol_) internal onlyInitializingERC721A { ERC721AStorage.layout()._name = name_; ERC721AStorage.layout()._symbol = symbol_; ERC721AStorage.layout()._currentIndex = _startTokenId(); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return ERC721AStorage.layout()._currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return ERC721AStorage.layout()._currentIndex - ERC721AStorage.layout()._burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return ERC721AStorage.layout()._currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return ERC721AStorage.layout()._burnCounter; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return ERC721AStorage.layout()._packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (ERC721AStorage.layout()._packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (ERC721AStorage.layout()._packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(ERC721AStorage.layout()._packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = ERC721AStorage.layout()._packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); ERC721AStorage.layout()._packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return ERC721AStorage.layout()._name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return ERC721AStorage.layout()._symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @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, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(ERC721AStorage.layout()._packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (ERC721AStorage.layout()._packedOwnerships[index] == 0) { ERC721AStorage.layout()._packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) { if (_startTokenId() <= tokenId) { packed = ERC721AStorage.layout()._packedOwnerships[tokenId]; // If not burned. if (packed & _BITMASK_BURNED == 0) { // If the data at the starting slot does not exist, start the scan. if (packed == 0) { if (tokenId >= ERC721AStorage.layout()._currentIndex) revert OwnerQueryForNonexistentToken(); // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `tokenId` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. for (;;) { unchecked { packed = ERC721AStorage.layout()._packedOwnerships[--tokenId]; } if (packed == 0) continue; return packed; } } // Otherwise, the data exists and is not burned. We can skip the scan. // This is possible because we have already achieved the target condition. // This saves 2143 gas on transfers of initialized tokens. return packed; } } revert OwnerQueryForNonexistentToken(); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}. * * Requirements: * * - The caller must own the token or be an approved operator. */ function approve(address to, uint256 tokenId) public payable virtual override { _approve(to, tokenId, true); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return ERC721AStorage.layout()._tokenApprovals[tokenId].value; } /** * @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) public virtual override { ERC721AStorage.layout()._operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return ERC721AStorage.layout()._operatorApprovals[owner][operator]; } /** * @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. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _startTokenId() <= tokenId && tokenId < ERC721AStorage.layout()._currentIndex && // If within bounds, ERC721AStorage.layout()._packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned. } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { ERC721AStorage.TokenApprovalRef storage tokenApproval = ERC721AStorage.layout()._tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * 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 ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --ERC721AStorage.layout()._packedAddressData[from]; // Updates: `balance -= 1`. ++ERC721AStorage.layout()._packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. ERC721AStorage.layout()._packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (ERC721AStorage.layout()._packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != ERC721AStorage.layout()._currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. ERC721AStorage.layout()._packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @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 memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721ReceiverUpgradeable(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (bytes4 retval) { return retval == ERC721A__IERC721ReceiverUpgradeable(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = ERC721AStorage.layout()._currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. ERC721AStorage.layout()._packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); uint256 toMasked; uint256 end = startTokenId + quantity; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. startTokenId // `tokenId`. ) // The `iszero(eq(,))` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. // The compiler will optimize the `iszero` away for performance. for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } if (toMasked == 0) revert MintToZeroAddress(); ERC721AStorage.layout()._currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = ERC721AStorage.layout()._currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. ERC721AStorage.layout()._packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); ERC721AStorage.layout()._currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = ERC721AStorage.layout()._currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (ERC721AStorage.layout()._currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Equivalent to `_approve(to, tokenId, false)`. */ function _approve(address to, uint256 tokenId) internal virtual { _approve(to, tokenId, false); } /** * @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: * * - `tokenId` must exist. * * Emits an {Approval} event. */ function _approve( address to, uint256 tokenId, bool approvalCheck ) internal virtual { address owner = ownerOf(tokenId); if (approvalCheck) if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } ERC721AStorage.layout()._tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. ERC721AStorage.layout()._packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. ERC721AStorage.layout()._packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (ERC721AStorage.layout()._packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != ERC721AStorage.layout()._currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. ERC721AStorage.layout()._packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { ERC721AStorage.layout()._burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = ERC721AStorage.layout()._packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); ERC721AStorage.layout()._packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721AQueryableUpgradeable.sol'; import '../ERC721AUpgradeable.sol'; import '../ERC721A__Initializable.sol'; /** * @title ERC721AQueryable. * * @dev ERC721A subclass with convenience query functions. */ abstract contract ERC721AQueryableUpgradeable is ERC721A__Initializable, ERC721AUpgradeable, IERC721AQueryableUpgradeable { function __ERC721AQueryable_init() internal onlyInitializingERC721A { __ERC721AQueryable_init_unchained(); } function __ERC721AQueryable_init_unchained() internal onlyInitializingERC721A {} /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) public view virtual override returns (TokenOwnership memory) { TokenOwnership memory ownership; if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) { return ownership; } ownership = _ownershipAt(tokenId); if (ownership.burned) { return ownership; } return _ownershipOf(tokenId); } /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] calldata tokenIds) external view virtual override returns (TokenOwnership[] memory) { unchecked { uint256 tokenIdsLength = tokenIds.length; TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength); for (uint256 i; i != tokenIdsLength; ++i) { ownerships[i] = explicitOwnershipOf(tokenIds[i]); } return ownerships; } } /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view virtual override returns (uint256[] memory) { unchecked { if (start >= stop) revert InvalidQueryRange(); uint256 tokenIdsIdx; uint256 stopLimit = _nextTokenId(); // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) { start = _startTokenId(); } // Set `stop = min(stop, stopLimit)`. if (stop > stopLimit) { stop = stopLimit; } uint256 tokenIdsMaxLength = balanceOf(owner); // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`, // to cater for cases where `balanceOf(owner)` is too big. if (start < stop) { uint256 rangeLength = stop - start; if (rangeLength < tokenIdsMaxLength) { tokenIdsMaxLength = rangeLength; } } else { tokenIdsMaxLength = 0; } uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength); if (tokenIdsMaxLength == 0) { return tokenIds; } // We need to call `explicitOwnershipOf(start)`, // because the slot at `start` may not be initialized. TokenOwnership memory ownership = explicitOwnershipOf(start); address currOwnershipAddr; // If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`. // `ownership.address` will not be zero, as `start` is clamped to the valid token ID range. if (!ownership.burned) { currOwnershipAddr = ownership.addr; } for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } // Downsize the array to fit. assembly { mstore(tokenIds, tokenIdsIdx) } return tokenIds; } } /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) { unchecked { uint256 tokenIdsIdx; address currOwnershipAddr; uint256 tokenIdsLength = balanceOf(owner); uint256[] memory tokenIds = new uint256[](tokenIdsLength); TokenOwnership memory ownership; for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } return tokenIds; } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import '../IERC721AUpgradeable.sol'; /** * @dev Interface of ERC721AQueryable. */ interface IERC721AQueryableUpgradeable is IERC721AUpgradeable { /** * Invalid query range (`start` >= `stop`). */ error InvalidQueryRange(); /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory); /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory); /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view returns (uint256[] memory); /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view returns (uint256[] memory); }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721AUpgradeable { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Transfers `tokenId` from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} * whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external payable; /** * @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 payable; /** * @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); // ============================================================= // IERC721Metadata // ============================================================= /** * @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); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IOperatorFilterRegistry { function isOperatorAllowed(address registrant, address operator) external view returns (bool); function register(address registrant) external; function registerAndSubscribe(address registrant, address subscription) external; function registerAndCopyEntries(address registrant, address registrantToCopy) external; function unregister(address addr) external; function updateOperator(address registrant, address operator, bool filtered) external; function updateOperators(address registrant, address[] calldata operators, bool filtered) external; function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external; function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external; function subscribe(address registrant, address registrantToSubscribe) external; function unsubscribe(address registrant, bool copyExistingEntries) external; function subscriptionOf(address addr) external returns (address registrant); function subscribers(address registrant) external returns (address[] memory); function subscriberAt(address registrant, uint256 index) external returns (address); function copyEntriesOf(address registrant, address registrantToCopy) external; function isOperatorFiltered(address registrant, address operator) external returns (bool); function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); function filteredOperators(address addr) external returns (address[] memory); function filteredCodeHashes(address addr) external returns (bytes32[] memory); function filteredOperatorAt(address registrant, uint256 index) external returns (address); function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); function isRegistered(address addr) external returns (bool); function codeHashOf(address addr) external returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {IOperatorFilterRegistry} from "../IOperatorFilterRegistry.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; abstract contract OperatorFiltererUpgradeable is Initializable { error OperatorNotAllowed(address operator); IOperatorFilterRegistry constant operatorFilterRegistry = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); function __OperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe) internal onlyInitializing { // If an inheriting token contract is deployed to a network without the registry deployed, the modifier // will not revert, but the contract will need to be registered with the registry once it is deployed in // order for the modifier to filter addresses. if (address(operatorFilterRegistry).code.length > 0) { if (!operatorFilterRegistry.isRegistered(address(this))) { if (subscribe) { operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy); } else { if (subscriptionOrRegistrantToCopy != address(0)) { operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy); } else { operatorFilterRegistry.register(address(this)); } } } } } modifier onlyAllowedOperator(address from) virtual { // Check registry code length to facilitate testing in environments without a deployed registry. if (address(operatorFilterRegistry).code.length > 0) { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred // from an EOA. if (from == msg.sender) { _; return; } if (!operatorFilterRegistry.isOperatorAllowed(address(this), msg.sender)) { revert OperatorNotAllowed(msg.sender); } } _; } modifier onlyAllowedOperatorApproval(address operator) virtual { // Check registry code length to facilitate testing in environments without a deployed registry. if (address(operatorFilterRegistry).code.length > 0) { if (!operatorFilterRegistry.isOperatorAllowed(address(this), operator)) { revert OperatorNotAllowed(operator); } } _; } }
{ "optimizer": { "enabled": true, "runs": 500, "details": { "yul": true } }, "viaIR": true, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"address","name":"contractAddress","type":"address"}],"name":"ContractCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"string","name":"_baseUri","type":"string"},{"components":[{"internalType":"address","name":"royaltyAddress","type":"address"},{"internalType":"uint96","name":"royaltyAmount","type":"uint96"}],"internalType":"struct RoyaltySettings","name":"_royaltySettings","type":"tuple"},{"components":[{"internalType":"uint64","name":"maxSupply","type":"uint64"},{"internalType":"uint64","name":"amountMinted","type":"uint64"},{"internalType":"uint64","name":"maxPerWallet","type":"uint64"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct PhaseSettings[]","name":"_phases","type":"tuple[]"},{"components":[{"internalType":"uint64","name":"maxSupply","type":"uint64"},{"internalType":"uint64","name":"maxPerWallet","type":"uint64"},{"internalType":"uint64","name":"amountMinted","type":"uint64"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct BaseSettings","name":"_baseSettings","type":"tuple"},{"components":[{"internalType":"address[]","name":"payees","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"}],"internalType":"struct PaymentSplitterSettings","name":"_paymentSplitterSettings","type":"tuple"},{"internalType":"uint256","name":"_maxIntendedSupply","type":"uint256"},{"internalType":"bool","name":"_registerOperatorFilter","type":"bool"},{"internalType":"bool","name":"_allowBurning","type":"bool"}],"name":"deployBuenoContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getImplementationAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOperatorFilter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","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":[{"internalType":"address","name":"newFilter","type":"address"}],"name":"updateDefaultOperatorFilter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"updateImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040908082523461010a57600280546001600160a01b0319908116733cc6cdda760b79bafa08df41ecfa224f810dceb61790915561602082810192906001600160401b038411828510176100f457611094823980600093039083f080156100ea5760018060a01b03169060015416176001558080528060205281812033825260205260ff82822054161561009e575b5051610f8490816101108239f35b80805280602052818120338252602052818120600160ff19825416179055339033907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a438610090565b83513d84823e3d90fd5b634e487b7160e01b600052604160045260246000fd5b600080fdfe608080604052600436101561001357600080fd5b600090813560e01c90816301ffc9a7146108c457508063025b22bc146108855780630cbcae701461085e578063248a9ca3146108325780632f2ff15d1461078557806336568abe146106e457806342a8da35146106bd5780638cafd2841461018e57806391d1485414610142578063a217fddf14610126578063d547741f146100e65763ee4d2b20146100a557600080fd5b346100e35760203660031901126100e3576001600160a01b036100c6610919565b6100ce6109f5565b166001600160a01b0319600254161760025580f35b80fd5b50346100e35760403660031901126100e357610123600435610106610934565b908084528360205261011e6001604086200154610c01565b610d59565b80f35b50346100e357806003193601126100e357602090604051908152f35b50346100e35760403660031901126100e3576001600160a01b036040610166610934565b92600435815280602052209116600052602052602060ff604060002054166040519015158152f35b50346100e3576101c03660031901126100e35760043567ffffffffffffffff81116106b9576101c190369060040161099e565b9060243567ffffffffffffffff81116106b9576101e290369060040161099e565b9160443567ffffffffffffffff81116106b55761020390369060040161099e565b9260403660631901126106b55767ffffffffffffffff60a435116106b55736602360a4350112156106b55767ffffffffffffffff60a43560040135116106b55736602460c060a435600401350260a4350101116106b55760803660c31901126106b55767ffffffffffffffff61014435116106b557604061014435360360031901126106b55761018435151561018435036106b5576101a43580151581036106b157600154608881901c62ffffff16763d602d80600a3d3981f3363d3d373d3d3d363d7300000017855260781b6effffffffffffffffffffffffffffff19166e5af43d82803e903d91602b57fd5bf3176020526001600160a01b036037600986f01694851561066c576101843515610665576001600160a01b0360025416925b863b156105d8579061036861037a9261035660405197639ee8dba560e01b89526101e060048a01526101e4890190610d34565b87810360031901602489015290610d34565b85810360031901604487015290610d34565b6064356001600160a01b03811681036105d8576001600160a01b031660648501526084356bffffffffffffffffffffffff811681036105d857906bffffffffffffffffffffffff6020921660848601526003198582030160a486015260a4356004013581520191602460a43501855b60a4356004013581106105dc57505060c43567ffffffffffffffff81168091036105d85760c485015260e43567ffffffffffffffff81168091036105d85760e48501526101043567ffffffffffffffff811681036105d85767ffffffffffffffff166101048501526101248035908501526003198484030161014485015260408301916104826101443560040161014435600401610f19565b6040865293849052606085019387905b8082106105a3575050506104b26024610144350161014435600401610f19565b909460208186039101528084527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811161059f579385936001600160a01b0360209486948a9860051b8095888601376101648035908701521515610184860152336101a4860152166101c48401520103018183875af1801561059457610567575b507f2d49c67975aadd2d389580b368cfff5b49965b0bd5da33c144922ce01e7a4d7b6040838151903382526020820152a180f35b67ffffffffffffffff8111610580576040908152610533565b634e487b7160e01b82526041600452602482fd5b6040513d84823e3d90fd5b8680fd5b90919485356001600160a01b03811681036105d4576001600160a01b03168152602090810195019160010190610492565b8980fd5b8580fd5b909367ffffffffffffffff6105f086610f04565b16815267ffffffffffffffff61060860208701610f04565b16602082015267ffffffffffffffff61062360408701610f04565b16604082015260608086013590820152608085013580151580910361066157608082015260a0858101359082015260c09081019401906001016103e9565b8780fd5b8492610323565b60405162461bcd60e51b815260206004820152601660248201527f455243313136373a20637265617465206661696c6564000000000000000000006044820152606490fd5b8380fd5b8280fd5b5080fd5b50346100e357806003193601126100e35760206001600160a01b0360025416604051908152f35b50346100e35760403660031901126100e3576106fe610934565b336001600160a01b0382160361071a5761012390600435610d59565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608490fd5b50346100e35760403660031901126100e3576004356107a2610934565b818352826020526107b96001604085200154610c01565b818352826020526001600160a01b036040842091169081845260205260ff604084205416156107e6578280f35b818352826020526040832081845260205260408320600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8480a438808280f35b50346100e35760203660031901126100e357600160406020926004358152808452200154604051908152f35b50346100e357806003193601126100e35760206001600160a01b0360015416604051908152f35b50346100e35760203660031901126100e3576001600160a01b036108a7610919565b6108af6109f5565b166001600160a01b0319600154161760015580f35b9050346106b95760203660031901126106b95760043563ffffffff60e01b81168091036106b55760209250637965db0b60e01b8114908115610908575b5015158152f35b6301ffc9a760e01b14905038610901565b600435906001600160a01b038216820361092f57565b600080fd5b602435906001600160a01b038216820361092f57565b6080810190811067ffffffffffffffff82111761096657604052565b634e487b7160e01b600052604160045260246000fd5b90601f8019910116810190811067ffffffffffffffff82111761096657604052565b81601f8201121561092f5780359067ffffffffffffffff821161096657604051926109d3601f8401601f19166020018561097c565b8284526020838301011161092f57816000926020809301838601378301015290565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602090815260408083205490929060ff1615610a3757505050565b610a4033610df5565b9080845190610a4e8261094a565b60428252848201926060368537825115610bed5760308453825190600191821015610bed5790607860218501536041915b818311610b7f57505050610b3d576048610b39938693610b1d93610b0e98519889937f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a860152610ad9815180928c603789019101610d11565b8401917f206973206d697373696e6720726f6c6520000000000000000000000000000000603784015251809386840190610d11565b0103602881018752018561097c565b5192839262461bcd60e51b845260048401526024830190610d34565b0390fd5b60648486519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015610bd9576f181899199a1a9b1b9c1cb0b131b232b360811b901a610baf8587610dce565b5360041c928015610bc557600019019190610a7f565b634e487b7160e01b82526011600452602482fd5b634e487b7160e01b83526032600452602483fd5b634e487b7160e01b81526032600452602490fd5b600090808252602090828252604092838120338252835260ff848220541615610c2a5750505050565b610c3333610df5565b91845190610c408261094a565b60428252848201926060368537825115610bed5760308453825190600191821015610bed5790607860218501536041915b818311610ccb57505050610b3d576048610b39938693610b1d93610b0e98519889937f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a860152610ad9815180928c603789019101610d11565b909192600f81166010811015610bd9576f181899199a1a9b1b9c1cb0b131b232b360811b901a610cfb8587610dce565b5360041c928015610bc557600019019190610c71565b60005b838110610d245750506000910152565b8181015183820152602001610d14565b90602091610d4d81518092818552858086019101610d11565b601f01601f1916010190565b90600091808352826020526001600160a01b036040842092169182845260205260ff604084205416610d8a57505050565b80835282602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4565b908151811015610ddf570160200190565b634e487b7160e01b600052603260045260246000fd5b604051906060820182811067ffffffffffffffff82111761096657604052602a8252602082016040368237825115610ddf57603090538151600190811015610ddf57607860218401536029905b808211610e96575050610e525790565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015610eef576f181899199a1a9b1b9c1cb0b131b232b360811b901a610ec58486610dce565b5360041c918015610eda576000190190610e42565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fd5b359067ffffffffffffffff8216820361092f57565b9035601e198236030181121561092f57016020813591019167ffffffffffffffff821161092f578160051b3603831361092f5756fea2646970667358221220d64030fb997228e10847a91845ccea758651ef9a8a0a6d7dd346b37e80e98ef364736f6c6343000811003360808060405234620000c6576000549060ff8260081c1662000074575060ff8082161062000038575b604051615f549081620000cc8239f35b60ff90811916176000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160ff8152a13862000028565b62461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b6064820152608490fd5b600080fdfe60806040526004361015610023575b361561001957600080fd5b6100216131ad565b005b60003560e01c806301ffc9a7146104d357806302fa7c47146104ca57806306fdde03146104c1578063081812fc146104b8578063095ea7b3146104af5780630d1d7ae5146104a657806318160ddd1461049d5780631916558714610494578063199bdb171461048b5780631f06b55a1461048257806322dcb0a71461047957806323b872dd146104705780632a55205a146104675780632c0e69b31461045e57806333d3c80e146104555780633a98ef391461044c5780633ccfd60b14610443578063406072a91461043a57806342842e0e1461043157806342966c681461042857806344bb82791461041f57806348b7504414610416578063528307c81461040d57806355f804b3146104045780635bbb2177146103fb578063603f4d52146103f25780636352211e146103e95780636f0a90d7146103e057806370a08231146103d7578063715018a6146103ce5780638462151c146103c55780638b83209b146103bc5780638da5cb5b146103b357806393a69f89146103aa57806395d89b41146103a157806397474f13146103985780639852595c1461038f57806399a2557a146103865780639ee8dba51461037d5780639ff7075514610374578063a22cb4651461036b578063a3330d2514610362578063a3f8eace14610359578063ab5161a114610350578063b06f731514610347578063b88d4fde1461033e578063ba09f3d714610335578063c0d7f1471461032c578063c23dc68f14610323578063c45ac0501461031a578063c87b56dd14610311578063ce7c2ac214610308578063cfc86f7b146102ff578063d79779b2146102f6578063db980f4f146102ed578063e33b7de3146102e4578063e985e9c5146102db578063eba5267e146102d2578063f2fde38b146102c95763ff489fe10361000e576102c46130ab565b61000e565b506102c4613019565b506102c4612f18565b506102c4612e9f565b506102c4612e80565b506102c4612db6565b506102c4612d77565b506102c4612ca4565b506102c4612b6f565b506102c4612aa1565b506102c4612a87565b506102c4612a22565b506102c461296b565b506102c46127db565b506102c4612778565b506102c4612645565b506102c46125a0565b506102c4612578565b506102c4612553565b506102c4612472565b506102c46121e0565b506102c461210e565b506102c4612082565b506102c4612043565b506102c4611f25565b506102c4611e5c565b506102c4611cc8565b506102c4611ca0565b506102c4611c38565b506102c4611b7f565b506102c4611b29565b506102c4611af9565b506102c46119fe565b506102c4611993565b506102c461196b565b506102c46118c6565b506102c46116ce565b506102c46114c1565b506102c4611383565b506102c4611327565b506102c461104a565b506102c4611037565b506102c4610fec565b506102c4610f2b565b506102c4610f0c565b506102c4610dfd565b506102c4610d48565b506102c4610c97565b506102c4610c84565b506102c4610bec565b506102c4610b8e565b506102c4610a6b565b506102c4610a23565b506102c46109cf565b506102c4610935565b506102c461083c565b506102c46107c7565b506102c46106bd565b506102c46105d3565b506102c46104f3565b6001600160e01b03198116036104ee57565b600080fd5b50346104ee5760203660031901126104ee576020600435610513816104dc565b63ffffffff60e01b166301ffc9a760e01b8114908190821561057d575b821561056c575b821561054a575b50506040519015158152f35b63152a902d60e11b1491508115610564575b50388061053e565b90503861055c565b635b5e139f60e01b81149250610537565b6380ac58cd60e01b81149250610530565b6001600160a01b038116036104ee57565b6101a435906105ad8261058e565b565b6101c435906105ad8261058e565b6bffffffffffffffffffffffff8116036104ee57565b50346104ee5760403660031901126104ee577f8039bd6e4e7dba001c8840eb2e118d9d131246faa7d0d04335f7305127ec0b1060406004356106148161058e565b6bffffffffffffffffffffffff60243561062d816105bd565b6106356130f1565b61063f8184614860565b6001600160a01b03845193168352166020820152a1005b60009103126104ee57565b60005b8381106106745750506000910152565b8181015183820152602001610664565b9060209161069d81518092818552858086019101610661565b601f01601f1916010190565b9060206106ba928181520190610684565b90565b50346104ee576000806003193601126107c45760405190807f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c429081549061070382612bae565b80865292600192808416908115610797575060011461073d575b6107398661072d81880382611624565b604051918291826106a9565b0390f35b815292507f933ecf8acb7824b680a8d16f3ff3db8864228d986aa4c2ebab1eeb2703b4beb35b82841061077f57505050810160200161072d826107393861071d565b80546020858701810191909152909301928101610763565b90508695506107399693506020925061072d94915060ff191682840152151560051b82010192933861071d565b80fd5b50346104ee5760203660031901126104ee576004356107e581615589565b1561082a576000527f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4660205260206001600160a01b0360406000205416604051908152f35b6040516333d1c03960e21b8152600490fd5b5060403660031901126104ee576004356108558161058e565b6daaeb6d7670e522a718067333cd4e803b610877575b6100216024358361541c565b604051633185c44d60e21b81523060048201526001600160a01b038316602482015290602090829060449082905afa908115610917575b6000916108e9575b50156108c2573861086b565b604051633b79c77360e21b81526001600160a01b03919091166004820152602490fd5b0390fd5b61090a915060203d8111610910575b6109028183611624565b8101906136fa565b386108b6565b503d6108f8565b61091f61324f565b6108ae565b6001600160401b038116036104ee57565b5060203660031901126104ee576001600160401b0360043561095681610924565b166109976109643483614df1565b61096e8333614e47565b67ffffffffffffffff60801b1967ffffffffffffffff60801b60fe549260801b1691161760fe55565b6109a18133615983565b6040519081527f3f2c9d57c068687834f0de942a9babb9e5acab57d516d3480a3c16ee165a427360203392a2005b50346104ee5760003660031901126104ee57600080516020615ebf833981519152547f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c41546040519103600019018152602090f35b50346104ee5760203660031901126104ee57610021600435610a448161058e565b6133f7565b60809060031901126104ee57600490565b60809060c31901126104ee5760c490565b50346104ee5760803660031901126104ee577f6f14260768729ce57b5eef3dc9dd01f100501b88d2a22b4ea9d91102c2bd3178610b89610aaa36610a49565b610ab26130f1565b610b7d60fe54610ae28335610ac681610924565b6001600160401b03166001600160401b031960fe54161760fe55565b610b1c6020840135610af381610924565b67ffffffffffffffff60401b60fe549160401b169067ffffffffffffffff60401b19161760fe55565b610b2d604084013561096e81610924565b606083013560ff5560fe80547fffffffffffffffff0000000000000000ffffffffffffffff0000000000000000166001600160401b0383161767ffffffffffffffff60801b909216919091179055565b60405191829182614ac5565b0390a1005b50346104ee5760203660031901126104ee576020610bd7600435610bb18161058e565b6001600160a01b0316600052600080516020615eff833981519152602052604060002090565b546001600160401b036040519160401c168152f35b50346104ee5760003660031901126104ee57610c066130f1565b7f1509137b40df48e8ef9596f9db16b632b15353d0e0688d9f23221953eb0328dd6020610102805461ff0060ff8260081c161560081b169061ff0019161780915560ff6040519160081c1615158152a1005b60609060031901126104ee57600435610c708161058e565b90602435610c7d8161058e565b9060443590565b50610021610c9136610c58565b91614ef5565b50346104ee5760403660031901126104ee576004356000526098602052604060002060405190610cc6826115db565b54906001600160a01b03908183169283825260a01c60208201529115610d38575b610d10610d086bffffffffffffffffffffffff602085015116602435613570565b612710900490565b91511661073960405192839283602090939291936001600160a01b0360408201951681520152565b9050610d4261370f565b90610ce7565b50346104ee5760403660031901126104ee576001600160a01b03602435610d6e8161058e565b16600052610101602052604060002060043560005260205260206001600160401b0360406000205416604051908152f35b9181601f840112156104ee578235916001600160401b0383116104ee576020808501948460051b0101116104ee57565b60206003198201126104ee57600435906001600160401b0382116104ee57610df991600401610d9f565b9091565b50346104ee57610e0c36610dcf565b610e146130f1565b6001600160401b03918260fc54168211610efa5760005b828110610e3457005b83610e408285856149b0565b35610e4a81610924565b16610e536130f1565b8060005260fd6020526040806000208054878116908115610ee95792610ed2610ee093610ec1610ac6610eb060019a99968e7fc2067c23a9ebd515eec7748db8a487f8e13247aebbd537dcd7da1a54f63607159a881c1690614a3d565b60fe546001600160401b0316614995565b805467ffffffffffffffff19169055565b519081529081906020820190565b0390a101610e2b565b835163268dbf6760e21b8152600490fd5b60405163268dbf6760e21b8152600490fd5b50346104ee5760003660031901126104ee57602060c954604051908152f35b50346104ee576000806003193601126107c457610f466130f1565b610100805490825b828110610f59578380f35b6001908254811015610fba575b8285526001600160a01b03817f45e010b9ae401e2eb71529478da8bd513a9bdc2d095a111e324f5b95c09ed87b015416610f9f81613212565b610fab575b5001610f4e565b610fb4906133f7565b38610fa4565b610fc2611310565b610f66565b60409060031901126104ee57600435610fdf8161058e565b906024356106ba8161058e565b50346104ee57602061102e6001600160a01b0361100836610fc7565b911660005260cf83526040600020906001600160a01b0316600052602052604060002090565b54604051908152f35b5061002161104436610c58565b91614fac565b50346104ee5760203660031901126104ee5760043560ff6101025460081c16156112fe576110778161535f565b6001600160a01b0381166110b7836000527f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c46602052604060002090815490565b92906110d66001600160a01b03841633908114908614171590565b1590565b611282575b7f1af5163f80e79b5e554f61e1d052084d3a3fe1166e42a265798c4e2ddce8ffa293611278575b5061112d826001600160a01b0316600052600080516020615eff833981519152602052604060002090565b80546fffffffffffffffffffffffffffffffff0190556000848152600080516020615edf833981519152602052604090204260a01b8317600360e01b179055600160e11b811615611207575b50826000604051927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8280a46111f76111d37f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c415460010190565b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4155565b918252339180602081015b0390a2005b6001840161122c81600052600080516020615edf833981519152602052604060002090565b5415611239575b50611179565b600080516020615ebf8339815191525481146112335761127090600052600080516020615edf833981519152602052604060002090565b553880611233565b6000905538611102565b6112e76110d26112e0336112c8876001600160a01b03166000527f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c47602052604060002090565b906001600160a01b0316600052602052604060002090565b5460ff1690565b156110db57604051632ce44b5f60e11b8152600490fd5b60405163fa32799b60e01b8152600490fd5b50634e487b7160e01b600052603260045260246000fd5b50346104ee5760203660031901126104ee5760043561010080548210156104ee576020916001600160a01b03916000527f45e010b9ae401e2eb71529478da8bd513a9bdc2d095a111e324f5b95c09ed87b015416604051908152f35b50346104ee5761139236610fc7565b907f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a6001600160a01b03928061143f600095808316875260cb6020526113dd6040882054151561333c565b6113e7838761325c565b9384916113f5831515613397565b87169687895260ce60205260408920805490848201809211611464575b55611434826112c8836001600160a01b031660005260cf602052604060002090565b8381540190556135db565b604080516001600160a01b039092168252602082019290925290819081015b0390a280f35b61146c6131e6565b611412565b801515036104ee57565b61018435906105ad82611471565b60406003198201126104ee57600435906001600160401b0382116104ee576114b391600401610d9f565b90916024356106ba81611471565b50346104ee576114d036611489565b916114d96130f1565b60005b82811061152e5750610b89837f906568ccdea6378b9108aec731550e3e47f4541a63781939312428b90a4b4c6d9461151b575b604051938493846149ee565b610102805460ff1916600117905561150f565b6115398184846149b0565b3561155b61154f60fc546001600160401b031690565b6001600160401b031690565b1115610efa5780611596600261158861157760019588886149b0565b3560005260fd602052604060002090565b01805460ff19166001179055565b016114dc565b50634e487b7160e01b600052604160045260246000fd5b60c081019081106001600160401b038211176115ce57604052565b6115d661159c565b604052565b604081019081106001600160401b038211176115ce57604052565b6001600160401b0381116115ce57604052565b602081019081106001600160401b038211176115ce57604052565b90601f801991011681019081106001600160401b038211176115ce57604052565b604051906105ad826115db565b6020906001600160401b03811161166f575b601f01601f19160190565b61167761159c565b611664565b92919261168882611652565b916116966040519384611624565b8294818452818301116104ee578281602093846000960137010152565b9080601f830112156104ee578160206106ba9335910161167c565b50346104ee576020806003193601126104ee576001600160401b036004358181116104ee576117019036906004016116b3565b9161170a6130f1565b825191821161183a575b6117288261172360fb54612bae565b613dd5565b80601f831160011461179057509181610b89927f6741b2fc379fad678116fe3d4d4b9a1a184ab53ba36b86ad0fa66340b1ab41ad94600091611785575b508160011b916000199060031b1c19161760fb55604051918291826106a9565b905082015138611765565b60fb60005290601f1983167f3e7257b7272bb46d49cd6019b04ddee20da7c0cb13f7c1ec3391291b2ccebabc926000905b828210611822575050927f6741b2fc379fad678116fe3d4d4b9a1a184ab53ba36b86ad0fa66340b1ab41ad949260019282610b899610611809575b5050811b0160fb5561072d565b84015160001960f88460031b161c1916905538806117fc565b80600185968294968a015181550195019301906117c1565b61184261159c565b611714565b6020908160408183019282815285518094520193019160005b82811061186e575050505090565b90919293826080826118ba600194895162ffffff606080926001600160a01b0381511685526001600160401b036020820151166020860152604081015115156040860152015116910152565b01950193929101611860565b50346104ee576118d536610dcf565b906118df82613aa5565b916118ed6040519384611624565b808352601f196118fc82613aa5565b0160005b81811061195457505060005b81810361192157604051806107398682611847565b8061193861193260019385876149b0565b35615ada565b61194282876145f4565b5261194d81866145f4565b500161190c565b60209061195f615a97565b82828801015201611900565b50346104ee5760003660031901126104ee5760206001600160401b0360fc5416604051908152f35b50346104ee5760203660031901126104ee5760206001600160a01b036119ba60043561535f565b16604051908152f35b6020908160408183019282815285518094520193019160005b8281106119ea575050505090565b8351855293810193928101926001016119dc565b50346104ee576020806003193601126104ee5760043590611a1e8261058e565b6001600160401b03908160fc5416611a3f83611a398361497d565b16614ec3565b90600080936001600160a01b038716945b86811684811015611aad5787916001918886526101018552611aa5611a9e61154f611a918560408b20906001600160401b0316600052602052604060002090565b546001600160401b031690565b91896145f4565b520116611a50565b6107398686611aec8b611ae08e6001600160a01b0316600052600080516020615eff833981519152602052604060002090565b5460401c1691836145f4565b52604051918291826119c3565b50346104ee5760203660031901126104ee576020611b21600435611b1c8161058e565b6152f4565b604051908152f35b50346104ee576000806003193601126107c457611b446130f1565b806001600160a01b0360335481198116603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50346104ee5760203660031901126104ee57600435611b9d8161058e565b60008091611baa816152f4565b611bb381614ec3565b92611bbc615a97565b506001926001600160a01b0390811690845b848403611be3576040518061073989826119c3565b81611bed82615b46565b876040820151611c2f5750511680611c27575b50859083838a1614611c13575b01611bce565b80611c21838701968a6145f4565b52611c0d565b975085611c00565b92915050611c0d565b50346104ee5760203660031901126104ee5760206001600160a01b0360043560cd54811015611c93575b60cd6000527f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e015416604051908152f35b611c9b611310565b611c62565b50346104ee5760003660031901126104ee5760206001600160a01b0360335416604051908152f35b50346104ee5760603660031901126104ee576024356001600160401b038082116104ee57611cfb60049236908401610d9f565b916044358181116104ee57611d139036908601610d9f565b929093611d1e6130f1565b600094818503611e4b579190611d3f873560005260fd602052604060002090565b9286945b868610611d835760408051888152602081018a90527f71cc7095cc35ed4701c217a8efb440732eb0737da67f6548c008ac26fba954649181908101610b89565b9091929394968554611d9e611d998a87896149b0565b613b71565b83611daf6040928285851c16614995565b921684831611611e3c575086546fffffffffffffffff0000000000000000191660409190911b67ffffffffffffffff60401b16178655600190611e0390611dfd61154f611d998c898b6149b0565b906131fd565b97611e31611e1a611e15838b886149b0565b614149565b611e2b61154f611d99858a8c6149b0565b90615983565b019493929190611d43565b516352df9fe560e01b81528a90fd5b60405163e6dcad7760e01b81528790fd5b50346104ee576000806003193601126107c45760405190807f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4390815490611ea282612bae565b808652926001928084169081156107975750600114611ecb576107398661072d81880382611624565b815292507f617167b76dcc8247761fd21f427ad8ec3be6b3be203aed34e3aac08b4d31817c5b828410611f0d57505050810160200161072d826107393861071d565b80546020858701810191909152909301928101611ef1565b5060603660031901126104ee57600435602435611f4181610924565b6044356001600160401b03928382116104ee57611fff611f7682611f6c612005953690600401610d9f565b3492918833614b18565b85851692611f848433614e47565b611fcd60009782895260fd602052611fa68860408b2092835460401c16614995565b67ffffffffffffffff60401b82549160401b169067ffffffffffffffff60401b1916179055565b3387526101016020526040872090875260205260408620906001600160401b03166001600160401b0319825416179055565b33615983565b6040516001600160401b03909116815233907f3f2c9d57c068687834f0de942a9babb9e5acab57d516d3480a3c16ee165a427390806020810161145e565b50346104ee5760203660031901126104ee576001600160a01b036004356120698161058e565b1660005260cc6020526020604060002054604051908152f35b50346104ee5760603660031901126104ee576107396120b36004356120a68161058e565b6044359060243590615bae565b604051918291826119c3565b60409060631901126104ee57606490565b908160409103126104ee5790565b9181601f840112156104ee578235916001600160401b0383116104ee5760208085019460c085020101116104ee57565b50346104ee576101e03660031901126104ee5760046001600160401b0381358181116104ee5761214190369084016116b3565b6024358281116104ee5761215890369085016116b3565b916044358181116104ee5761217090369086016116b3565b9161217a366120bf565b9160a4358181116104ee5761219290369088016120de565b61219e92919236610a5a565b91610144359081116104ee57610021986121ba913691016120d0565b926121c361147b565b956121cc61059f565b976121d56105af565b9961016435976137f6565b5060803660031901126104ee576001600160401b03600480358281116104ee5761220d9036908301610d9f565b91906024358481116104ee576122269036908401610d9f565b91906044358681116104ee5761223f9036908601610d9f565b9490916064359461224f86610924565b61226461154f60fc546001600160401b031690565b87118015612468575b801561245e575b61244d57969593929190349760009788965b8088106123205789898d16818b8e836122e3575b846122a58133614e47565b6122af8133615983565b60405190815233907f3f2c9d57c068687834f0de942a9babb9e5acab57d516d3480a3c16ee165a4273908060208101611202565b839450906122f861096e926123169495614df1565b5060fe5460801c6001600160401b03165b016001600160401b031690565b018180808061229a565b9091929394959698998b6123358b848a6149b0565b35612344611d998d878d6149b0565b926123508d888a6149c8565b9490926123678160005260fd602052604060002090565b9561237a60038801549684168097613570565b9485851061243d57916123fc91612417949387836001809c015415600014612428576123dc93506123ad92508a33614d02565b935b611fa66123c68460005260fd602052604060002090565b9161230983546001600160401b039060401c1690565b336000908152610101602052604090205b90600052602052604060002090565b906001600160401b03166001600160401b0319825416179055565b039b01990196959493929190612286565b6123dc93612437938833614b18565b936123af565b60405162bfc92160e01b81528d90fd5b60405163268dbf6760e21b81528390fd5b5080871415612274565b508787141561226d565b50346104ee5760403660031901126104ee576004356124908161058e565b60243561249c81611471565b6daaeb6d7670e522a718067333cd4e803b6124bc575b50610021916154f9565b604051633185c44d60e21b81523060048201526001600160a01b038416602482015290602090829060449082905afa908115612546575b600091612528575b501561250757386124b2565b604051633b79c77360e21b81526001600160a01b0383166004820152602490fd5b612540915060203d8111610910576109028183611624565b386124fb565b61254e61324f565b6124f3565b50346104ee5760003660031901126104ee57602060ff61010254166040519015158152f35b50346104ee5760203660031901126104ee576020611b2160043561259b8161058e565b613212565b50346104ee5760203660031901126104ee576004356125bd6130f1565b8060005260fd60205260406000208054916001600160401b0391828416938415610efa57610ac68461261c7fc2067c23a9ebd515eec7748db8a487f8e13247aebbd537dcd7da1a54f636071597610b89976126269560401c1690614a3d565b9060fe5416614995565b805467ffffffffffffffff191690556040519081529081906020820190565b50346104ee5760e03660031901126104ee5760043560c03660231901126104ee5761266e6130f1565b7fc0008a9740d8043d4c62e9129808dfe671c91ae530a5fe058ebb07b6b2fc95fe61277260009280845260fd6020526127666001600160401b0361273e81604088205460401c169160408820541661272a6126d1600260408b200160ff90541690565b936126ee6126e98860005260fd602052604060002090565b613b98565b6127028760005260fd602052604060002090565b9067ffffffffffffffff60401b82549160401b169067ffffffffffffffff60401b1916179055565b6123fc8560005260fd602052604060002090565b60026127548460005260fd602052604060002090565b019060ff801983541691151516179055565b60405191829182614a56565b0390a180f35b5060803660031901126104ee576004356127918161058e565b60243561279d8161058e565b606435916001600160401b0383116104ee57366023840112156104ee576127d161002193369060248160040135910161167c565b916044359161504b565b50346104ee576040806003193601126104ee5760048035916001600160401b03928381116104ee576128109036908401610d9f565b9190936024358181116104ee5761282a9036908601610d9f565b93906128346130f1565b60009582860361295d5792919086935b868510612883578551878152602081018990527f71cc7095cc35ed4701c217a8efb440732eb0737da67f6548c008ac26fba95464908060408101610b89565b909192939688856128a961289e611d998c8960fe54966149b0565b828460801c16614995565b91168682161161294d576128e09067ffffffffffffffff60801b1967ffffffffffffffff60801b60fe549260801b1691161760fe55565b6128eb88858b6149b0565b6128f490613b71565b6001600160401b0316612906916131fd565b966129128188856149b0565b61291b90614149565b61292682868c6149b0565b61292f90613b71565b6001600160401b031661294191615983565b60010193929190612844565b86516352df9fe560e01b81528390fd5b845163e6dcad7760e01b8152fd5b50346104ee5761297a36611489565b916129836130f1565b60005b8281106129d45750610b89837f4f1e98f5c7093632a49c02ecd1c1283bf1689573db8338b3814dfd7d9cf013c8946129c457604051938493846149ee565b610102805460ff1916905561150f565b6129df8184846149b0565b60fc54903591906001600160401b0316821015610efa57612a1c6002612a1160019460005260fd602052604060002090565b01805460ff19169055565b01612986565b50346104ee5760203660031901126104ee576080612a41600435615ada565b612a85604051809262ffffff606080926001600160a01b0381511685526001600160401b036020820151166020860152604081015115156040860152015116910152565bf35b50346104ee576020611b21612a9b36610fc7565b9061325c565b50346104ee5760203660031901126104ee57600435612abf81615589565b15612b5d57612acc612be8565b805160009015612b43575060405160a08101604052608081019260008452925b6000190192600a906030828206018553049283612aec576107399350612b3192612b3761072d936080601f19948581019203018152604051958693602085019061534c565b9061534c565b03908101835282611624565b60405161073993509150612b5682611609565b815261072d565b604051630a14c4b560e41b8152600490fd5b50346104ee5760203660031901126104ee576001600160a01b03600435612b958161058e565b1660005260cb6020526020604060002054604051908152f35b90600182811c92168015612bde575b6020831014612bc857565b634e487b7160e01b600052602260045260246000fd5b91607f1691612bbd565b6040519060008260fb5491612bfc83612bae565b80835292600190818116908115612c825750600114612c23575b506105ad92500383611624565b60fb600090815291507f3e7257b7272bb46d49cd6019b04ddee20da7c0cb13f7c1ec3391291b2ccebabc5b848310612c6757506105ad935050810160200138612c16565b81935090816020925483858a01015201910190918592612c4e565b9050602092506105ad94915060ff191682840152151560051b82010138612c16565b50346104ee576000806003193601126107c457604051908060fb54612cc881612bae565b80855291600191808316908115612d4d5750600114612cf2575b6107398561072d81870382611624565b925060fb83527f3e7257b7272bb46d49cd6019b04ddee20da7c0cb13f7c1ec3391291b2ccebabc5b828410612d3557505050810160200161072d82610739612ce2565b80546020858701810191909152909301928101612d1a565b8695506107399693506020925061072d94915060ff191682840152151560051b8201019293612ce2565b50346104ee5760203660031901126104ee576001600160a01b03600435612d9d8161058e565b1660005260ce6020526020604060002054604051908152f35b506040806003193601126104ee5760043560243591612dd483610924565b612e496001600160401b0380851693612e19612df234838833614d02565b92612dfd8733614e47565b611fa6600098848a5260fd602052878a20928354891c16614995565b338652610101602052838620908652602052828520906001600160401b03166001600160401b0319825416179055565b612e538233615983565b519081527f3f2c9d57c068687834f0de942a9babb9e5acab57d516d3480a3c16ee165a427360203392a280f35b50346104ee5760003660031901126104ee57602060ca54604051908152f35b50346104ee5760403660031901126104ee57602060ff612f0c600435612ec48161058e565b6112c860243591612ed48361058e565b6001600160a01b03166000527f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c47602052604060002090565b54166040519015158152f35b50346104ee5760203660031901126104ee5761073960408060a08151612f3d816115b3565b600091818380935282602082015282858201528260608201528260808201520152600435815260fd60205220906003815192612f78846115b3565b80546001600160401b03808216865281851c8116602087015260809190911c168385015260018101546060850152612fc0612fb7600283015460ff1690565b15156080860152565b015460a0830152519182918291909160a08060c08301946001600160401b038082511685528060208301511660208601526040820151166040850152606081015160608501526080810151151560808501520151910152565b50346104ee5760203660031901126104ee576004356130378161058e565b61303f6130f1565b6001600160a01b038116156130575761002190613165565b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b50346104ee5760003660031901126104ee57608060fe5460ff54604051916001600160401b03908181168452818160401c166020850152841c1660408301526060820152f35b6001600160a01b0360335416330361310557565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6131516130f1565b6001600160a01b03811615613057576105ad905b603354906001600160a01b0380911691826001600160a01b0319821617603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b604080513381523460208201527f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77091819081015b0390a1565b50634e487b7160e01b600052601160045260246000fd5b9190820180921161320a57565b6105ad6131e6565b6106ba904760ca548101809111613242575b6001600160a01b03821660005260cc60205260406000205491613583565b61324a6131e6565b613224565b506040513d6000823e3d90fd5b6040516370a0823160e01b8152306004820152909291906001600160a01b038416602082602481845afa91821561332f575b6000926132fc575b50826112c86106ba95966132d49360005260ce60205260406000205485018095116132db576001600160a01b031660005260cf602052604060002090565b5491613583565b6132e36131e6565b6001600160a01b031660005260cf602052604060002090565b90916020823d8211613327575b8161331660209383611624565b810103126107c45750519082613296565b3d9150613309565b61333761324f565b61328e565b1561334357565b60405162461bcd60e51b815260206004820152602660248201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060448201526573686172657360d01b6064820152608490fd5b1561339e57565b60405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060448201526a191d59481c185e5b595b9d60aa1b6064820152608490fd5b6001600160a01b038116600081815260cb60205261341a6040822054151561333c565b61342382613212565b9161342f831515613397565b60ca54838101809111613563575b60ca5580825260cc6020526040822083815401905582471061351e5781808481935af1613468613735565b50156134b357604080516001600160a01b03909316835260208301919091527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b0569190819081016131e1565b60405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608490fd5b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606490fd5b61356b6131e6565b61343d565b8181029291811591840414171561320a57565b906001600160a01b036135a5921660005260cb60205260406000205490613570565b60c9549081156135c557049081039081116135bd5790565b6106ba6131e6565b634e487b7160e01b600052601260045260246000fd5b61367e916000806001600160a01b03604051946136338661362560209a8b83019863a9059cbb60e01b8a5260248401602090939291936001600160a01b0360408201951681520152565b03601f198101885287611624565b169260405194613642866115db565b8786527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656488870152519082855af1613678613735565b91613765565b8051908161368b57505050565b828061369b9383010191016136fa565b156136a35750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b908160209103126104ee57516106ba81611471565b6040519061371c826115db565b6097546001600160a01b038116835260a01c6020830152565b3d15613760573d9061374682611652565b916137546040519384611624565b82523d6000602084013e565b606090565b919290156137c75750815115613779575090565b3b156137825790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156137da5750805190602001fd5b60405162461bcd60e51b81529081906108e590600483016106a9565b9a989694929099979593917fee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85f549a60ff8c60081c169b8c60001461391e5750303b155b156138b35761384e9b159c8d61388057613927565b61385457565b7fee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85f805461ff0019169055565b7fee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85f805461ffff1916610101179055613927565b60405162461bcd60e51b815260206004820152603760248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e747261637460448201527f20697320616c726561647920696e697469616c697a65640000000000000000006064820152608490fd5b60ff1615613839565b99979593919a98969492909a6000549b60ff8d60081c1615809d819e613a62575b8115613a42575b50156139d7576139759b8d61396c600160ff196000541617600055565b6139be576142a2565b61397b57565b61398b61ff001960005416600055565b604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989080602081016131e1565b6139d261010061ff00196000541617600055565b6142a2565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608490fd5b303b15915081613a54575b503861394f565b6001915060ff161438613a4d565b600160ff8216109150613948565b903590601e19813603018212156104ee57018035906001600160401b0382116104ee57602001918160051b360383136104ee57565b6020906001600160401b038111613abe575b60051b0190565b613ac661159c565b613ab7565b9291613ad682613aa5565b91613ae46040519384611624565b829481845260208094019160051b81019283116104ee57905b828210613b0a5750505050565b8380918335613b188161058e565b815201910190613afd565b9291613b2e82613aa5565b91613b3c6040519384611624565b829481845260208094019160051b81019283116104ee57905b828210613b625750505050565b81358152908301908301613b55565b356106ba81610924565b9160c091811015613b8b57020190565b613b93611310565b020190565b613bc4602435613ba781610924565b825467ffffffffffffffff19166001600160401b03909116178255565b613c00604435613bd381610924565b82546fffffffffffffffff0000000000000000191660409190911b67ffffffffffffffff60401b16178255565b613c37606435613c0f81610924565b825467ffffffffffffffff60801b191660809190911b67ffffffffffffffff60801b16178255565b6084356001820155613c6360a435613c4e81611471565b600283019060ff801983541691151516179055565b600360c435910155565b9060a0600391613c9e8135613c8181610924565b855467ffffffffffffffff19166001600160401b03909116178555565b613cdc6020820135613caf81610924565b85546fffffffffffffffff0000000000000000191660409190911b67ffffffffffffffff60401b16178555565b613d156040820135613ced81610924565b855467ffffffffffffffff60801b191660809190911b67ffffffffffffffff60801b16178555565b60608101356001850155613d456080820135613d3081611471565b600286019060ff801983541691151516179055565b0135910155565b15613d5357565b60405162461bcd60e51b815260206004820152603160248201527f537570706c79206f6620616c6c20706861736573206d75737420657175616c2060448201527f6d6178496e74656e646564537570706c790000000000000000000000000000006064820152608490fd5b818110613dc9575050565b60008155600101613dbe565b90601f8211613de2575050565b6105ad9160fb6000527f3e7257b7272bb46d49cd6019b04ddee20da7c0cb13f7c1ec3391291b2ccebabc906020601f840160051c83019310613e2c575b601f0160051c0190613dbe565b9091508190613e1f565b90601f8211613e43575050565b6105ad917f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c426000527f933ecf8acb7824b680a8d16f3ff3db8864228d986aa4c2ebab1eeb2703b4beb3906020601f840160051c83019310613e2c57601f0160051c0190613dbe565b90601f8211613eb8575050565b6105ad917f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c436000527f617167b76dcc8247761fd21f427ad8ec3be6b3be203aed34e3aac08b4d31817c906020601f840160051c83019310613e2c57601f0160051c0190613dbe565b9081516001600160401b038111614005575b613f418161172360fb54612bae565b602080601f8311600114613f7d5750819293600092613f72575b50508160011b916000199060031b1c19161760fb55565b015190503880613f5b565b90601f19831694613fb060fb6000527f3e7257b7272bb46d49cd6019b04ddee20da7c0cb13f7c1ec3391291b2ccebabc90565b926000905b878210613fed575050836001959610613fd4575b505050811b0160fb55565b015160001960f88460031b161c19169055388080613fc9565b80600185968294968601518155019501930190613fb5565b61400d61159c565b613f32565b9081516001600160401b03811161413c575b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4390614059816140548454612bae565b613eab565b602080601f831160011461409557508192939460009261408a575b50508160011b916000199060031b1c1916179055565b015190503880614074565b90601f198316956140e77f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c436000527f617167b76dcc8247761fd21f427ad8ec3be6b3be203aed34e3aac08b4d31817c90565b926000905b8882106141245750508360019596971061410b575b505050811b019055565b015160001960f88460031b161c19169055388080614101565b806001859682949686015181550195019301906140ec565b61414461159c565b614024565b356106ba8161058e565b6001600160401b038211614218575b68010000000000000000821161420b575b6101009081548383558084106141d5575b509060005260005b82811061419857505050565b60019060208335936141a98561058e565b0192817f45e010b9ae401e2eb71529478da8bd513a9bdc2d095a111e324f5b95c09ed87b01550161418c565b61420590847f45e010b9ae401e2eb71529478da8bd513a9bdc2d095a111e324f5b95c09ed87b9182019101613dbe565b38614184565b61421361159c565b614173565b61422061159c565b614162565b606090803561423381610924565b60fe5467ffffffffffffffff60401b60208401359161425183610924565b6001600160401b0367ffffffffffffffff60801b604087013561427381610924565b60801b169416906001600160401b0360c01b16179160401b16171760fe55013560ff55565b356106ba816105bd565b906142b791999893999795969794929461515d565b6142bf614483565b6142fa6142f46142cf8680613a70565b6142ec6142e260208a959495018a613a70565b9490923691613acb565b923691613b23565b906144a6565b6001600160401b0385169461431161154f88613b71565b916000915b8783106143d9575050509461437b6143bb989561435f61435961439b976143536105ad9f9e9c9861434e614380996143b69e14613d4c565b613f20565b80613a70565b90614153565b6001600160401b03166001600160401b031960fc54161760fc55565b614225565b6101029061ff00825491151560081b169061ff001916179055565b6143b060206143a983614149565b9201614298565b90614860565b613149565b6001600160a01b0381166143d157600090615d0e565b600190615d0e565b90919261441a6001916144096143f0878688613b7b565b6144048860005260fd602052604060002090565b613c6d565b611dfd61154f611d99888789613b7b565b93019190614316565b1561442a57565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b61449d60ff60005460081c1661449881614423565b614423565b6105ad33613165565b9190916144be60ff60005460081c1661449881614423565b8051835103614521576144d38151151561458c565b60005b815181101561451b57806145116145006144f361451694866145f4565b516001600160a01b031690565b61450a83886145f4565b5190614743565b6145d8565b6144d6565b50509050565b60405162461bcd60e51b815260206004820152603260248201527f5061796d656e7453706c69747465723a2070617965657320616e64207368617260448201527f6573206c656e677468206d69736d6174636800000000000000000000000000006064820152608490fd5b1561459357565b60405162461bcd60e51b815260206004820152601a60248201527f5061796d656e7453706c69747465723a206e6f207061796565730000000000006044820152606490fd5b60019060001981146145e8570190565b6145f06131e6565b0190565b6020918151811015614609575b60051b010190565b614611611310565b614601565b1561461d57565b60405162461bcd60e51b815260206004820152601d60248201527f5061796d656e7453706c69747465723a207368617265732061726520300000006044820152606490fd5b1561466957565b60405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e7420616c726561647960448201526a206861732073686172657360a81b6064820152608490fd5b6001600160a01b0360cd5468010000000000000000811015614736575b600181018060cd55811015614729575b60cd6000527f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e0191166001600160a01b0319825416179055565b614731611310565b6146ef565b61473e61159c565b6146df565b906001600160a01b03821615614806577f40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac91614780821515614616565b6147a76147a0826001600160a01b031660005260cb602052604060002090565b5415614662565b6147b0816146c2565b816147ce826001600160a01b031660005260cb602052604060002090565b556147e36147de8360c9546131fd565b60c955565b604080516001600160a01b039092168252602082019290925290819081016131e1565b60405162461bcd60e51b815260206004820152602c60248201527f5061796d656e7453706c69747465723a206163636f756e74206973207468652060448201526b7a65726f206164647265737360a01b6064820152608490fd5b6127106bffffffffffffffffffffffff831611614925576001600160a01b038116156148e0576148bc6105ad926148a7614898611645565b6001600160a01b039094168452565b6bffffffffffffffffffffffff166020830152565b6001600160a01b038151169060206001600160a01b031991015160a01b1617609755565b60405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608490fd5b9060016001600160401b038093160191821161320a57565b9190916001600160401b038080941691160191821161320a57565b91908110156149c05760051b0190565b613ac6611310565b9091610df9928110156149e1575b60051b810190613a70565b6149e9611310565b6149d6565b91939293604083528060408401527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81116104ee5760209160609160051b809183860137830101931515910152565b6001600160401b03918216908216039190821161320a57565b90815260e081019190602435614a6b81610924565b6001600160401b03809116602083015280604435614a8881610924565b166040830152606435614a9a81610924565b166060820152608435608082015260a435614ab481611471565b151560a082015260c060c435910152565b91909160608060808301948035614adb81610924565b6001600160401b038091168552806020830135614af781610924565b1660208601526040820135614b0b81610924565b1660408501520135910152565b93909193614b308260005260fd602052604060002090565b93614b426110d2600287015460ff1690565b614c935760018501548015614c81578554966001600160401b0398604097614b6e888c8c8c1c16614995565b8b808c16911611614c70578a6003614b8b92015498169788613570565b03614c6057916110d291614be1614be69489516020810190614bd681614bc88b856014916bffffffffffffffffffffffff199060601b1681520190565b03601f198101835282611624565b519020933691613b23565b614ca5565b614c4f5791614c1761154f611a91614c1c946123ed8a976001600160a01b0316600052610101602052604060002090565b6131fd565b9260801c168015159081614c45575b50614c3557501690565b51636c80554560e11b8152600490fd5b9050821138614c2b565b83516309bde33960e01b8152600490fd5b865162bfc92160e01b8152600490fd5b88516352df9fe560e01b8152600490fd5b604051634d0ee1f560e11b8152600490fd5b6040516321094a9b60e01b8152600490fd5b929091906000915b8451831015614cfa57614cc083866145f4565b5190600082821015614ce85750600052602052614ce260406000205b926145d8565b91614cad565b604091614ce293825260205220614cdc565b915092501490565b909291614d198160005260fd602052604060002090565b93614d2b6110d2600287015460ff1690565b614c93576001850154614c81578454936001600160401b0395614d5383888860401c166131fd565b87871610614ddf576003614d6991015483613570565b03614dce57614c1761154f611a91614d9a946123ed89976001600160a01b0316600052610101602052604060002090565b9160801c168015159081614dc4575b50614db2571690565b604051636c80554560e11b8152600490fd5b9050811138614da9565b60405162bfc92160e01b8152600490fd5b6040516352df9fe560e01b8152600490fd5b9060ff610102541615614c935760fe54906001600160401b039283808460801c1693828501809511614e3a575b168311614ddf5760ff54614e3191613570565b03614dce571690565b614e426131e6565b614e1e565b906001600160401b03908160fe5460401c16918215159384614e6e575b50505050614db257565b614e9c91929394506001600160a01b0316600052600080516020615eff833981519152602052604060002090565b5460401c16908101809111614eb6575b1138808080614e64565b614ebe6131e6565b614eac565b90614ecd82613aa5565b614eda6040519182611624565b8281528092614eeb601f1991613aa5565b0190602036910137565b91906daaeb6d7670e522a718067333cd4e803b614f17575b506105ad926155de565b336001600160a01b03851614614f0d57604051633185c44d60e21b815230600482015233602482015290602090829060449082905afa908115614f9f575b600091614f81575b5015614f695738614f0d565b604051633b79c77360e21b8152336004820152602490fd5b614f99915060203d8111610910576109028183611624565b38614f5d565b614fa761324f565b614f55565b91906daaeb6d7670e522a718067333cd4e803b614fce575b506105ad92615818565b336001600160a01b03851614614fc457604051633185c44d60e21b815230600482015233602482015290602090829060449082905afa90811561503e575b600091615020575b5015614f695738614fc4565b615038915060203d8111610910576109028183611624565b38615014565b61504661324f565b61500c565b9291906daaeb6d7670e522a718067333cd4e803b61506e575b506105ad93615852565b336001600160a01b0386161461506457604051633185c44d60e21b815230600482015233602482015290602090829060449082905afa9081156150de575b6000916150c0575b5015614f695738615064565b6150d8915060203d8111610910576109028183611624565b386150b4565b6150e661324f565b6150ac565b156150f257565b60405162461bcd60e51b815260206004820152603460248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e747261637460448201527f206973206e6f7420696e697469616c697a696e670000000000000000000000006064820152608490fd5b919061519860ff7fee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85f5460081c16615193816150eb565b6150eb565b82516001600160401b0381116152e7575b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c42906151de816151d98454612bae565b613e36565b602080601f831160011461523757508190615215959660009261522c575b50508160011b916000199060031b1c1916179055614012565b6105ad6001600080516020615ebf83398151915255565b0151905038806151fc565b90601f198316966152897f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c426000527f933ecf8acb7824b680a8d16f3ff3db8864228d986aa4c2ebab1eeb2703b4beb390565b926000905b8982106152cf575050908392916001946152159899106152b6575b505050811b019055614012565b015160001960f88460031b161c191690553880806152a9565b8060018596829496860151815501950193019061528e565b6152ef61159c565b6151a9565b6001600160a01b0381161561533a576153356001600160401b03916001600160a01b0316600052600080516020615eff833981519152602052604060002090565b541690565b6040516323d3ad8160e21b8152600490fd5b906145f060209282815194859201610661565b6001908082111561537d575b604051636f96cda160e11b8152600490fd5b61539e81600052600080516020615edf833981519152602052604060002090565b5491600160e01b8316156153b2575061536b565b82156153bd57505090565b600080516020615ebf8339815191525482101561536b5790815b6153e057505090565b9091506000190161540881600052600080516020615edf833981519152602052604060002090565b5491821561541557505090565b90816153d7565b6001600160a01b038061542e8461535f565b169081330361549f575b836000527f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c466020526040600020921691826001600160a01b03198254161790557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a4565b60ff6154e1336112c8856001600160a01b03166000527f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c47602052604060002090565b5416615438576040516367d9dca160e11b8152600490fd5b6001600160a01b039061555783615546836112c8336001600160a01b03166000527f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c47602052604060002090565b9060ff801983541691151516179055565b604051921515835216907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3565b806001111590816155c5575b8161559e575090565b9050600052600080516020615edf833981519152602052600160e01b604060002054161590565b600080516020615ebf8339815191525481109150615595565b906155e88361535f565b6001600160a01b038084169283828416036158075760008681527f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4660205260409020805490926156476001600160a01b03881633908114908414171590565b6157aa575b8216958615615798576156b7936156899261578e575b506001600160a01b0316600052600080516020615eff833981519152602052604060002090565b80546000190190556001600160a01b0316600052600080516020615eff833981519152602052604060002090565b80546001019055600160e11b804260a01b8517176156ec86600052600080516020615edf833981519152602052604060002090565b5581161561571d575b507fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4565b6001840161574281600052600080516020615edf833981519152602052604060002090565b541561574f575b506156f5565b600080516020615ebf8339815191525481146157495761578690600052600080516020615edf833981519152602052604060002090565b553880615749565b6000905538615662565b604051633a954ecd60e21b8152600490fd5b6157f06110d26112e0336112c88b6001600160a01b03166000527f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c47602052604060002090565b1561564c57604051632ce44b5f60e11b8152600490fd5b60405162a1148160e81b8152600490fd5b90916105ad9260405192602084018481106001600160401b03821117615845575b6040526000845261504b565b61584d61159c565b615839565b929190615860828286614ef5565b803b61586d575b50505050565b615876936158da565b156158845738808080615867565b6040516368d2bf6b60e11b8152600490fd5b908160209103126104ee57516106ba816104dc565b90926106ba94936080936001600160a01b03809216845216602083015260408201528160608201520190610684565b9260209161590b9360006001600160a01b03604051809781968295630a85bd0160e11b9b8c855233600486016158ab565b0393165af160009181615953575b5061594557615926613735565b80519081615940576040516368d2bf6b60e11b8152600490fd5b602001fd5b6001600160e01b0319161490565b61597591925060203d811161597c575b61596d8183611624565b810190615896565b9038615919565b503d615963565b90600080516020615ebf83398151915254918115615a85576159c5816001600160a01b0316600052600080516020615eff833981519152602052604060002090565b68010000000000000001830281540190556001600160a01b03600191169181811460e11b4260a01b178317615a1185600052600080516020615edf833981519152602052604060002090565b558301926000827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92808684868180a4015b858103615a76575050505015615a6557600080516020615ebf83398151915255565b604051622e076360e81b8152600490fd5b8084918684868180a401615a43565b60405163b562e8dd60e01b8152600490fd5b60405190608082018281106001600160401b03821117615acd575b60405260006060838281528260208201528260408201520152565b615ad561159c565b615ab2565b615ae2615a97565b50615aeb615a97565b600182108015615b2d575b615b285750615b0481615b46565b6040810151615b285750615b236106ba91615b1d615a97565b5061535f565b615b6e565b905090565b50600080516020615ebf83398151915254821015615af6565b615b4e615a97565b50600052600080516020615edf8339815191526020526106ba6040600020545b90615b77615a97565b916001600160a01b03811683526001600160401b038160a01c166020840152600160e01b81161515604084015260e81c6060830152565b9082811015615cfc57600091600080516020615ebf8339815191525491600192838210615cf4575b808611615cec575b50615be8826152f4565b9185821015615ce457818603838110615cdc575b505b615c0783614ec3565b958315615cd3578493615c1984615ada565b918794604093615c2e6110d286830151151590565b615cc1575b50955b615c47575b50505050505050815290565b8086141580615cb7575b15615cb2578686615c628298615b46565b80860151615cac57516001600160a01b0390811680615ca4575b5080871690881614615c90575b0195615c36565b80615c9e838c019b8d6145f4565b52615c89565b975038615c7c565b50615c89565b615c3b565b5081881415615c51565b516001600160a01b0316955038615c33565b50505050505090565b925038615bfc565b849250615bfe565b945038615bde565b839150615bd6565b604051631960ccad60e11b8152600490fd5b90600091615d2260ff845460081c16614423565b6daaeb6d7670e522a718067333cd4e91823b615d3e5750505050565b60405163c3c5a54760e01b815230600482015260208160248188885af1908115615eb1575b8591615e93575b506158675715615ded57813b15615de957604051633e9f1edf60e11b81523060048201526001600160a01b0391909116602482015291908290604490829084905af18015615ddc575b615dc3575b505b38808080615867565b80615dd0615dd6926115f6565b80610656565b38615db8565b615de461324f565b615db3565b8280fd5b6001600160a01b03811615615e6857813b15615de95760405163a0af290360e01b81523060048201526001600160a01b03909116602482015291908290818381604481015b03925af18015615e5b575b615e48575b50615dba565b80615dd0615e55926115f6565b38615e42565b615e6361324f565b615e3d565b5090813b156107c457604051632210724360e11b815230600482015291829081838160248101615e32565b615eab915060203d8111610910576109028183611624565b38615d6a565b615eb961324f565b615d6356fe2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c402569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c442569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c45a2646970667358221220f22dea75f3d31e04fa69fc6d89480cdeed68fd72582a1d2b3d09fd29d97854d864736f6c63430008110033
Deployed Bytecode
0x608080604052600436101561001357600080fd5b600090813560e01c90816301ffc9a7146108c457508063025b22bc146108855780630cbcae701461085e578063248a9ca3146108325780632f2ff15d1461078557806336568abe146106e457806342a8da35146106bd5780638cafd2841461018e57806391d1485414610142578063a217fddf14610126578063d547741f146100e65763ee4d2b20146100a557600080fd5b346100e35760203660031901126100e3576001600160a01b036100c6610919565b6100ce6109f5565b166001600160a01b0319600254161760025580f35b80fd5b50346100e35760403660031901126100e357610123600435610106610934565b908084528360205261011e6001604086200154610c01565b610d59565b80f35b50346100e357806003193601126100e357602090604051908152f35b50346100e35760403660031901126100e3576001600160a01b036040610166610934565b92600435815280602052209116600052602052602060ff604060002054166040519015158152f35b50346100e3576101c03660031901126100e35760043567ffffffffffffffff81116106b9576101c190369060040161099e565b9060243567ffffffffffffffff81116106b9576101e290369060040161099e565b9160443567ffffffffffffffff81116106b55761020390369060040161099e565b9260403660631901126106b55767ffffffffffffffff60a435116106b55736602360a4350112156106b55767ffffffffffffffff60a43560040135116106b55736602460c060a435600401350260a4350101116106b55760803660c31901126106b55767ffffffffffffffff61014435116106b557604061014435360360031901126106b55761018435151561018435036106b5576101a43580151581036106b157600154608881901c62ffffff16763d602d80600a3d3981f3363d3d373d3d3d363d7300000017855260781b6effffffffffffffffffffffffffffff19166e5af43d82803e903d91602b57fd5bf3176020526001600160a01b036037600986f01694851561066c576101843515610665576001600160a01b0360025416925b863b156105d8579061036861037a9261035660405197639ee8dba560e01b89526101e060048a01526101e4890190610d34565b87810360031901602489015290610d34565b85810360031901604487015290610d34565b6064356001600160a01b03811681036105d8576001600160a01b031660648501526084356bffffffffffffffffffffffff811681036105d857906bffffffffffffffffffffffff6020921660848601526003198582030160a486015260a4356004013581520191602460a43501855b60a4356004013581106105dc57505060c43567ffffffffffffffff81168091036105d85760c485015260e43567ffffffffffffffff81168091036105d85760e48501526101043567ffffffffffffffff811681036105d85767ffffffffffffffff166101048501526101248035908501526003198484030161014485015260408301916104826101443560040161014435600401610f19565b6040865293849052606085019387905b8082106105a3575050506104b26024610144350161014435600401610f19565b909460208186039101528084527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811161059f579385936001600160a01b0360209486948a9860051b8095888601376101648035908701521515610184860152336101a4860152166101c48401520103018183875af1801561059457610567575b507f2d49c67975aadd2d389580b368cfff5b49965b0bd5da33c144922ce01e7a4d7b6040838151903382526020820152a180f35b67ffffffffffffffff8111610580576040908152610533565b634e487b7160e01b82526041600452602482fd5b6040513d84823e3d90fd5b8680fd5b90919485356001600160a01b03811681036105d4576001600160a01b03168152602090810195019160010190610492565b8980fd5b8580fd5b909367ffffffffffffffff6105f086610f04565b16815267ffffffffffffffff61060860208701610f04565b16602082015267ffffffffffffffff61062360408701610f04565b16604082015260608086013590820152608085013580151580910361066157608082015260a0858101359082015260c09081019401906001016103e9565b8780fd5b8492610323565b60405162461bcd60e51b815260206004820152601660248201527f455243313136373a20637265617465206661696c6564000000000000000000006044820152606490fd5b8380fd5b8280fd5b5080fd5b50346100e357806003193601126100e35760206001600160a01b0360025416604051908152f35b50346100e35760403660031901126100e3576106fe610934565b336001600160a01b0382160361071a5761012390600435610d59565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608490fd5b50346100e35760403660031901126100e3576004356107a2610934565b818352826020526107b96001604085200154610c01565b818352826020526001600160a01b036040842091169081845260205260ff604084205416156107e6578280f35b818352826020526040832081845260205260408320600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8480a438808280f35b50346100e35760203660031901126100e357600160406020926004358152808452200154604051908152f35b50346100e357806003193601126100e35760206001600160a01b0360015416604051908152f35b50346100e35760203660031901126100e3576001600160a01b036108a7610919565b6108af6109f5565b166001600160a01b0319600154161760015580f35b9050346106b95760203660031901126106b95760043563ffffffff60e01b81168091036106b55760209250637965db0b60e01b8114908115610908575b5015158152f35b6301ffc9a760e01b14905038610901565b600435906001600160a01b038216820361092f57565b600080fd5b602435906001600160a01b038216820361092f57565b6080810190811067ffffffffffffffff82111761096657604052565b634e487b7160e01b600052604160045260246000fd5b90601f8019910116810190811067ffffffffffffffff82111761096657604052565b81601f8201121561092f5780359067ffffffffffffffff821161096657604051926109d3601f8401601f19166020018561097c565b8284526020838301011161092f57816000926020809301838601378301015290565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602090815260408083205490929060ff1615610a3757505050565b610a4033610df5565b9080845190610a4e8261094a565b60428252848201926060368537825115610bed5760308453825190600191821015610bed5790607860218501536041915b818311610b7f57505050610b3d576048610b39938693610b1d93610b0e98519889937f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a860152610ad9815180928c603789019101610d11565b8401917f206973206d697373696e6720726f6c6520000000000000000000000000000000603784015251809386840190610d11565b0103602881018752018561097c565b5192839262461bcd60e51b845260048401526024830190610d34565b0390fd5b60648486519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015610bd9576f181899199a1a9b1b9c1cb0b131b232b360811b901a610baf8587610dce565b5360041c928015610bc557600019019190610a7f565b634e487b7160e01b82526011600452602482fd5b634e487b7160e01b83526032600452602483fd5b634e487b7160e01b81526032600452602490fd5b600090808252602090828252604092838120338252835260ff848220541615610c2a5750505050565b610c3333610df5565b91845190610c408261094a565b60428252848201926060368537825115610bed5760308453825190600191821015610bed5790607860218501536041915b818311610ccb57505050610b3d576048610b39938693610b1d93610b0e98519889937f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a860152610ad9815180928c603789019101610d11565b909192600f81166010811015610bd9576f181899199a1a9b1b9c1cb0b131b232b360811b901a610cfb8587610dce565b5360041c928015610bc557600019019190610c71565b60005b838110610d245750506000910152565b8181015183820152602001610d14565b90602091610d4d81518092818552858086019101610d11565b601f01601f1916010190565b90600091808352826020526001600160a01b036040842092169182845260205260ff604084205416610d8a57505050565b80835282602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4565b908151811015610ddf570160200190565b634e487b7160e01b600052603260045260246000fd5b604051906060820182811067ffffffffffffffff82111761096657604052602a8252602082016040368237825115610ddf57603090538151600190811015610ddf57607860218401536029905b808211610e96575050610e525790565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015610eef576f181899199a1a9b1b9c1cb0b131b232b360811b901a610ec58486610dce565b5360041c918015610eda576000190190610e42565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fd5b359067ffffffffffffffff8216820361092f57565b9035601e198236030181121561092f57016020813591019167ffffffffffffffff821161092f578160051b3603831361092f5756fea2646970667358221220d64030fb997228e10847a91845ccea758651ef9a8a0a6d7dd346b37e80e98ef364736f6c63430008110033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ 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.