Overview
xDAI Balance
xDAI Value
$0.00More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 3 internal transactions
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
39373066 | 19 days ago | Contract Creation | 0 xDAI | |||
39373066 | 19 days ago | Contract Creation | 0 xDAI | |||
39373066 | 19 days ago | Contract Creation | 0 xDAI |
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:
ERC1155PackFactory
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 20000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.19; import {ERC1155Pack} from "@0xsequence/contracts-library/tokens/ERC1155/presets/pack/ERC1155Pack.sol"; import { IERC1155PackFactory, IERC1155PackFactoryFunctions } from "@0xsequence/contracts-library/tokens/ERC1155/presets/pack/IERC1155PackFactory.sol"; import {SequenceProxyFactory} from "@0xsequence/contracts-library/proxies/SequenceProxyFactory.sol"; /** * Deployer of ERC-1155 Pack proxies. */ contract ERC1155PackFactory is IERC1155PackFactory, SequenceProxyFactory { /** * Creates an ERC-1155 Pack Factory. * @param factoryOwner The owner of the ERC-1155 Pack Factory */ constructor(address factoryOwner) { ERC1155Pack impl = new ERC1155Pack(); SequenceProxyFactory._initialize(address(impl), factoryOwner); } /// @inheritdoc IERC1155PackFactoryFunctions function deploy( address proxyOwner, address tokenOwner, string memory name, string memory baseURI, string memory contractURI, address royaltyReceiver, uint96 royaltyFeeNumerator, bytes32 merkleRoot, uint256 supply ) external returns (address proxyAddr) { bytes32 salt = keccak256(abi.encode(tokenOwner, name, baseURI, contractURI, royaltyReceiver, royaltyFeeNumerator)); proxyAddr = _createProxy(salt, proxyOwner, ""); ERC1155Pack(proxyAddr).initialize( tokenOwner, name, baseURI, contractURI, royaltyReceiver, royaltyFeeNumerator, merkleRoot, supply ); emit ERC1155PackDeployed(proxyAddr); return proxyAddr; } /// @inheritdoc IERC1155PackFactoryFunctions function determineAddress( address proxyOwner, address tokenOwner, string memory name, string memory baseURI, string memory contractURI, address royaltyReceiver, uint96 royaltyFeeNumerator ) external view returns (address proxyAddr) { bytes32 salt = keccak256(abi.encode(tokenOwner, name, baseURI, contractURI, royaltyReceiver, royaltyFeeNumerator)); return _computeProxyAddress(salt, proxyOwner, ""); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.19; import {IERC1155Pack} from "./IERC1155Pack.sol"; import {ERC1155Items} from "@0xsequence/contracts-library/tokens/ERC1155/presets/items/ERC1155Items.sol"; import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import {IERC1155ItemsFunctions} from "@0xsequence/contracts-library/tokens/ERC1155/presets/items/IERC1155Items.sol"; contract ERC1155Pack is ERC1155Items, IERC1155Pack { bytes32 internal constant PACK_ADMIN_ROLE = keccak256("PACK_ADMIN_ROLE"); bytes32 public merkleRoot; uint256 public supply; uint256 public remainingSupply; mapping(address => uint256) internal _commitments; mapping(uint256 => uint256) internal _availableIndices; constructor() ERC1155Items() {} /// @inheritdoc IERC1155Pack function initialize( address owner, string memory tokenName, string memory tokenBaseURI, string memory tokenContractURI, address royaltyReceiver, uint96 royaltyFeeNumerator, bytes32 _merkleRoot, uint256 _supply ) public virtual { _grantRole(PACK_ADMIN_ROLE, owner); merkleRoot = _merkleRoot; supply = _supply; remainingSupply = _supply; super.initialize(owner, tokenName, tokenBaseURI, tokenContractURI, royaltyReceiver, royaltyFeeNumerator); } /// @inheritdoc IERC1155Pack function setPacksContent(bytes32 _merkleRoot, uint256 _supply) external onlyRole(PACK_ADMIN_ROLE) { merkleRoot = _merkleRoot; supply = _supply; remainingSupply = _supply; } /// @inheritdoc IERC1155Pack function commit() external { if (_commitments[msg.sender] != 0) { revert PendingReveal(); } if (balanceOf(msg.sender, 1) == 0) { revert NoBalance(); } _burn(msg.sender, 1, 1); uint256 revealAfterBlock = block.number + 1; _commitments[msg.sender] = revealAfterBlock; emit Commit(msg.sender, revealAfterBlock); } /// @inheritdoc IERC1155Pack function reveal(address user, PackContent calldata packContent, bytes32[] calldata proof) external { (uint256 randomIndex, uint256 revealIdx) = _getRevealIdx(user); bytes32 leaf = keccak256(abi.encode(revealIdx, packContent)); if (!MerkleProof.verify(proof, merkleRoot, leaf)) { revert InvalidProof(); } delete _commitments[user]; remainingSupply--; // Point this index to the last index's value _availableIndices[randomIndex] = _getIndexOrDefault(remainingSupply); for (uint256 i = 0; i < packContent.tokenAddresses.length; i++) { IERC1155ItemsFunctions(packContent.tokenAddresses[i]).batchMint( user, packContent.tokenIds[i], packContent.amounts[i], "" ); } emit Reveal(user); } /// @inheritdoc IERC1155Pack function refundPack(address user) external { if (_commitments[user] == 0) { revert NoCommit(); } if (uint256(blockhash(_commitments[user])) != 0 || block.number <= _commitments[user]) { revert PendingReveal(); } delete _commitments[user]; _mint(user, 1, 1, ""); } /// @inheritdoc IERC1155Pack function getRevealIdx(address user) public view returns (uint256 revealIdx) { (, revealIdx) = _getRevealIdx(user); return revealIdx; } function _getRevealIdx(address user) internal view returns (uint256 randomIdx, uint256 revealIdx) { if (remainingSupply == 0) { revert AllPacksOpened(); } bytes32 blockHash = blockhash(_commitments[user]); if (uint256(blockHash) == 0) { revert InvalidCommit(); } if (_commitments[user] == 0) { revert NoCommit(); } randomIdx = uint256(keccak256(abi.encode(blockHash, user))) % remainingSupply; revealIdx = _getIndexOrDefault(randomIdx); return (randomIdx, revealIdx); } function _getIndexOrDefault(uint256 index) internal view returns (uint256) { uint256 value = _availableIndices[index]; return value == 0 ? index : value; } function supportsInterface(bytes4 interfaceId) public view override returns (bool) { return type(IERC1155Pack).interfaceId == interfaceId || super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.19; interface IERC1155PackFactoryFunctions { /** * Creates an ERC-1155 Pack proxy. * @param proxyOwner The owner of the ERC-1155 Pack proxy * @param tokenOwner The owner of the ERC-1155 Pack implementation * @param name The name of the ERC-1155 Pack proxy * @param baseURI The base URI of the ERC-1155 Pack proxy * @param contractURI The contract URI of the ERC-1155 Pack proxy * @param royaltyReceiver Address of who should be sent the royalty payment * @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500) * @param merkleRoot merkle root built from all possible pack contents. * @param supply total amount of packs. * @return proxyAddr The address of the ERC-1155 Pack Proxy */ function deploy( address proxyOwner, address tokenOwner, string memory name, string memory baseURI, string memory contractURI, address royaltyReceiver, uint96 royaltyFeeNumerator, bytes32 merkleRoot, uint256 supply ) external returns (address proxyAddr); /** * Computes the address of a proxy instance. * @param proxyOwner The owner of the ERC-1155 Pack proxy * @param tokenOwner The owner of the ERC-1155 Pack implementation * @param name The name of the ERC-1155 Pack proxy * @param baseURI The base URI of the ERC-1155 Pack proxy * @param contractURI The contract URI of the ERC-1155 Pack proxy * @param royaltyReceiver Address of who should be sent the royalty payment * @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500) * @return proxyAddr The address of the ERC-1155 Pack Proxy */ function determineAddress( address proxyOwner, address tokenOwner, string memory name, string memory baseURI, string memory contractURI, address royaltyReceiver, uint96 royaltyFeeNumerator ) external returns (address proxyAddr); } interface IERC1155PackFactorySignals { /** * Event emitted when a new ERC-1155 Pack proxy contract is deployed. * @param proxyAddr The address of the deployed proxy. */ event ERC1155PackDeployed(address proxyAddr); } interface IERC1155PackFactory is IERC1155PackFactoryFunctions, IERC1155PackFactorySignals {}
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.19; import { TransparentUpgradeableBeaconProxy, ITransparentUpgradeableBeaconProxy } from "./TransparentUpgradeableBeaconProxy.sol"; import {Create2} from "@openzeppelin/contracts/utils/Create2.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {UpgradeableBeacon} from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol"; /** * An proxy factory that deploys upgradeable beacon proxies. * @dev The factory owner is able to upgrade the beacon implementation. * @dev Proxy deployers are able to override the beacon reference with their own. */ abstract contract SequenceProxyFactory is Ownable { UpgradeableBeacon public beacon; /** * Initialize a Sequence Proxy Factory. * @param implementation The initial beacon implementation. * @param factoryOwner The owner of the factory. */ function _initialize(address implementation, address factoryOwner) internal { beacon = new UpgradeableBeacon(implementation); Ownable._transferOwnership(factoryOwner); } /** * Deploys and initializes a new proxy instance. * @param _salt The deployment salt. * @param _proxyOwner The owner of the proxy. * @param _data The initialization data. * @return proxyAddress The address of the deployed proxy. */ function _createProxy(bytes32 _salt, address _proxyOwner, bytes memory _data) internal returns (address proxyAddress) { bytes32 saltedHash = keccak256(abi.encodePacked(_salt, _proxyOwner, address(beacon), _data)); bytes memory bytecode = type(TransparentUpgradeableBeaconProxy).creationCode; proxyAddress = Create2.deploy(0, saltedHash, bytecode); ITransparentUpgradeableBeaconProxy(payable(proxyAddress)).initialize(_proxyOwner, address(beacon), _data); } /** * Computes the address of a proxy instance. * @param _salt The deployment salt. * @param _proxyOwner The owner of the proxy. * @return proxy The expected address of the deployed proxy. */ function _computeProxyAddress(bytes32 _salt, address _proxyOwner, bytes memory _data) internal view returns (address) { bytes32 saltedHash = keccak256(abi.encodePacked(_salt, _proxyOwner, address(beacon), _data)); bytes32 bytecodeHash = keccak256(type(TransparentUpgradeableBeaconProxy).creationCode); return Create2.computeAddress(saltedHash, bytecodeHash); } /** * Upgrades the beacon implementation. * @param implementation The new beacon implementation. */ function upgradeBeacon(address implementation) public onlyOwner { beacon.upgradeTo(implementation); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.19; interface IERC1155Pack { struct PackContent { address[] tokenAddresses; uint256[][] tokenIds; uint256[][] amounts; } /** * Commit expired or never made. */ error InvalidCommit(); /** * Reveal is pending. */ error PendingReveal(); /** * Commit never made. */ error NoCommit(); /** * No balance. */ error NoBalance(); /** * Invalid proof. */ error InvalidProof(); /** * All packs opened. */ error AllPacksOpened(); /// @notice Emitted when a user make a commitment event Commit(address indexed user, uint256 blockNumber); /// @notice Emitted when a reveal is successful event Reveal(address user); /** * Initialize the contract. * @param owner Owner address * @param tokenName Token name * @param tokenBaseURI Base URI for token metadata * @param tokenContractURI Contract URI for token metadata * @param royaltyReceiver Address of who should be sent the royalty payment * @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500) * @param _merkleRoot merkle root built from all possible pack contents. * @param _supply total amount of packs. * @dev This should be called immediately after deployment. */ function initialize( address owner, string memory tokenName, string memory tokenBaseURI, string memory tokenContractURI, address royaltyReceiver, uint96 royaltyFeeNumerator, bytes32 _merkleRoot, uint256 _supply ) external; /** * Set all possible pack contents. * @param _merkleRoot merkle root built from all possible pack contents. * @param _supply total amount of packs. * @dev Updating these values before all the packs have been opened may lead to undesirable behavior. */ function setPacksContent(bytes32 _merkleRoot, uint256 _supply) external; /** * Get random reveal index. * @param user address of reward recipient. */ function getRevealIdx(address user) external view returns (uint256); /** * Commit to reveal pack content. * @notice this function burns user's pack. */ function commit() external; /** * Reveal pack content. * @param user address of reward recipient. * @param packContent reward selected with random index. * @param proof Pack contents merkle proof. */ function reveal( address user, PackContent calldata packContent, bytes32[] calldata proof ) external; /** * Ask for pack refund after commit expiration. * @param user address of pack owner. * @notice this function mints a pack for the user when his commit is expired. */ function refundPack(address user) external; }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.19; import { IERC1155Items, IERC1155ItemsFunctions } from "@0xsequence/contracts-library/tokens/ERC1155/presets/items/IERC1155Items.sol"; import {ERC1155BaseToken} from "@0xsequence/contracts-library/tokens/ERC1155/ERC1155BaseToken.sol"; import {ERC2981Controlled} from "@0xsequence/contracts-library/tokens/common/ERC2981Controlled.sol"; /** * An implementation of ERC-1155 capable of minting when role provided. */ contract ERC1155Items is ERC1155BaseToken, IERC1155Items { bytes32 internal constant MINTER_ROLE = keccak256("MINTER_ROLE"); address private immutable initializer; bool private initialized; constructor() { initializer = msg.sender; } /** * Initialize the contract. * @param owner Owner address * @param tokenName Token name * @param tokenBaseURI Base URI for token metadata * @param tokenContractURI Contract URI for token metadata * @param royaltyReceiver Address of who should be sent the royalty payment * @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500) * @dev This should be called immediately after deployment. */ function initialize( address owner, string memory tokenName, string memory tokenBaseURI, string memory tokenContractURI, address royaltyReceiver, uint96 royaltyFeeNumerator ) public virtual { if (msg.sender != initializer || initialized) { revert InvalidInitialization(); } ERC1155BaseToken._initialize(owner, tokenName, tokenBaseURI, tokenContractURI); _setDefaultRoyalty(royaltyReceiver, royaltyFeeNumerator); _grantRole(MINTER_ROLE, owner); initialized = true; } // // Minting // /** * Mint tokens. * @param to Address to mint tokens to. * @param tokenId Token ID to mint. * @param amount Amount of tokens to mint. * @param data Data to pass if receiver is contract. */ function mint(address to, uint256 tokenId, uint256 amount, bytes memory data) external onlyRole(MINTER_ROLE) { _mint(to, tokenId, amount, data); } /** * Mint tokens. * @param to Address to mint tokens to. * @param tokenIds Token IDs to mint. * @param amounts Amounts of tokens to mint. * @param data Data to pass if receiver is contract. */ function batchMint(address to, uint256[] memory tokenIds, uint256[] memory amounts, bytes memory data) external onlyRole(MINTER_ROLE) { _batchMint(to, tokenIds, amounts, data); } // // Views // /** * Check interface support. * @param interfaceId Interface id * @return True if supported */ function supportsInterface(bytes4 interfaceId) public view virtual override (ERC1155BaseToken) returns (bool) { return type(IERC1155ItemsFunctions).interfaceId == interfaceId || ERC1155BaseToken.supportsInterface(interfaceId) || super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.2) (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 rebuilds 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 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proofLen - 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 from 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) { require(proofPos == proofLen, "MerkleProof: invalid multiproof"); unchecked { 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 rebuilds 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 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proofLen - 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 from 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) { require(proofPos == proofLen, "MerkleProof: invalid multiproof"); unchecked { 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: Apache-2.0 pragma solidity ^0.8.19; interface IERC1155ItemsFunctions { /** * Mint tokens. * @param to Address to mint tokens to. * @param tokenId Token ID to mint. * @param amount Amount of tokens to mint. * @param data Data to pass if receiver is contract. */ function mint(address to, uint256 tokenId, uint256 amount, bytes memory data) external; /** * Mint tokens. * @param to Address to mint tokens to. * @param tokenIds Token IDs to mint. * @param amounts Amounts of tokens to mint. * @param data Data to pass if receiver is contract. */ function batchMint(address to, uint256[] memory tokenIds, uint256[] memory amounts, bytes memory data) external; } interface IERC1155ItemsSignals { /** * Invalid initialization error. */ error InvalidInitialization(); } interface IERC1155Items is IERC1155ItemsFunctions, IERC1155ItemsSignals {}
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.19; import {BeaconProxy, Proxy} from "./openzeppelin/BeaconProxy.sol"; import {TransparentUpgradeableProxy, ERC1967Proxy} from "./openzeppelin/TransparentUpgradeableProxy.sol"; interface ITransparentUpgradeableBeaconProxy { function initialize(address admin, address beacon, bytes memory data) external; } error InvalidInitialization(); /** * @dev As the underlying proxy implementation (TransparentUpgradeableProxy) allows the admin to call the implementation, * care must be taken to avoid proxy selector collisions. Implementation selectors must not conflict with the proxy selectors. * See https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing]. * The proxy selectors are: * - 0xcf7a1d77: initialize * - 0x3659cfe6: upgradeTo (from TransparentUpgradeableProxy) * - 0x4f1ef286: upgradeToAndCall (from TransparentUpgradeableProxy) * - 0x8f283970: changeAdmin (from TransparentUpgradeableProxy) * - 0xf851a440: admin (from TransparentUpgradeableProxy) * - 0x5c60da1b: implementation (from TransparentUpgradeableProxy) */ contract TransparentUpgradeableBeaconProxy is TransparentUpgradeableProxy, BeaconProxy { /** * Decode the initialization data from the msg.data and call the initialize function. */ function _dispatchInitialize() private returns (bytes memory) { _requireZeroValue(); (address admin, address beacon, bytes memory data) = abi.decode(msg.data[4:], (address, address, bytes)); initialize(admin, beacon, data); return ""; } function initialize(address admin, address beacon, bytes memory data) internal { if (_admin() != address(0)) { // Redundant call. This function can only be called when the admin is not set. revert InvalidInitialization(); } _changeAdmin(admin); _upgradeBeaconToAndCall(beacon, data, false); } /** * @dev If the admin is not set, the fallback function is used to initialize the proxy. * @dev If the admin is set, the fallback function is used to delegatecall the implementation. */ function _fallback() internal override (TransparentUpgradeableProxy, Proxy) { if (_getAdmin() == address(0)) { bytes memory ret; bytes4 selector = msg.sig; if (selector == ITransparentUpgradeableBeaconProxy.initialize.selector) { ret = _dispatchInitialize(); // solhint-disable-next-line no-inline-assembly assembly { return(add(ret, 0x20), mload(ret)) } } // When the admin is not set, the fallback function is used to initialize the proxy. revert InvalidInitialization(); } TransparentUpgradeableProxy._fallback(); } /** * Returns the current implementation address. * @dev This is the implementation address set by the admin, or the beacon implementation. */ function _implementation() internal view override (ERC1967Proxy, BeaconProxy) returns (address) { address implementation = ERC1967Proxy._implementation(); if (implementation != address(0)) { return implementation; } return BeaconProxy._implementation(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol) pragma solidity ^0.8.0; /** * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer. * `CREATE2` can be used to compute in advance the address where a smart * contract will be deployed, which allows for interesting new mechanisms known * as 'counterfactual interactions'. * * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more * information. */ library Create2 { /** * @dev Deploys a contract using `CREATE2`. The address where the contract * will be deployed can be known in advance via {computeAddress}. * * The bytecode for a contract can be obtained from Solidity with * `type(contractName).creationCode`. * * Requirements: * * - `bytecode` must not be empty. * - `salt` must have not been used for `bytecode` already. * - the factory must have a balance of at least `amount`. * - if `amount` is non-zero, `bytecode` must have a `payable` constructor. */ function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) { require(address(this).balance >= amount, "Create2: insufficient balance"); require(bytecode.length != 0, "Create2: bytecode length is zero"); /// @solidity memory-safe-assembly assembly { addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt) } require(addr != address(0), "Create2: Failed on deploy"); } /** * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the * `bytecodeHash` or `salt` will result in a new destination address. */ function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) { return computeAddress(salt, bytecodeHash, address(this)); } /** * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}. */ function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) // Get free memory pointer // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... | // |-------------------|---------------------------------------------------------------------------| // | bytecodeHash | CCCCCCCCCCCCC...CC | // | salt | BBBBBBBBBBBBB...BB | // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA | // | 0xFF | FF | // |-------------------|---------------------------------------------------------------------------| // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC | // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | mstore(add(ptr, 0x40), bytecodeHash) mstore(add(ptr, 0x20), salt) mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff mstore8(start, 0xff) addr := keccak256(start, 85) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _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. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling 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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/UpgradeableBeacon.sol) pragma solidity ^0.8.0; import "./IBeacon.sol"; import "../../access/Ownable.sol"; import "../../utils/Address.sol"; /** * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their * implementation contract, which is where they will delegate all function calls. * * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon. */ contract UpgradeableBeacon is IBeacon, Ownable { address private _implementation; /** * @dev Emitted when the implementation returned by the beacon is changed. */ event Upgraded(address indexed implementation); /** * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the * beacon. */ constructor(address implementation_) { _setImplementation(implementation_); } /** * @dev Returns the current implementation address. */ function implementation() public view virtual override returns (address) { return _implementation; } /** * @dev Upgrades the beacon to a new implementation. * * Emits an {Upgraded} event. * * Requirements: * * - msg.sender must be the owner of the contract. * - `newImplementation` must be a contract. */ function upgradeTo(address newImplementation) public virtual onlyOwner { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Sets the implementation contract address for this beacon * * Requirements: * * - `newImplementation` must be a contract. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "UpgradeableBeacon: implementation is not a contract"); _implementation = newImplementation; } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.19; import { ERC1155Supply, ERC1155 } from "@0xsequence/contracts-library/tokens/ERC1155/extensions/supply/ERC1155Supply.sol"; import {ERC1155Metadata} from "@0xsequence/erc-1155/contracts/tokens/ERC1155/ERC1155Metadata.sol"; import {ERC2981Controlled} from "@0xsequence/contracts-library/tokens/common/ERC2981Controlled.sol"; error InvalidInitialization(); /** * A standard base implementation of ERC-1155 for use in Sequence library contracts. */ abstract contract ERC1155BaseToken is ERC1155Supply, ERC1155Metadata, ERC2981Controlled { bytes32 internal constant METADATA_ADMIN_ROLE = keccak256("METADATA_ADMIN_ROLE"); string private _contractURI; /** * Deploy contract. */ constructor() ERC1155Metadata("", "") {} /** * Initialize the contract. * @param owner Owner address. * @param tokenName Token name. * @param tokenBaseURI Base URI for token metadata. * @param tokenContractURI Contract URI for token metadata. * @dev This should be called immediately after deployment. */ function _initialize( address owner, string memory tokenName, string memory tokenBaseURI, string memory tokenContractURI ) internal { name = tokenName; baseURI = tokenBaseURI; _contractURI = tokenContractURI; _grantRole(DEFAULT_ADMIN_ROLE, owner); _grantRole(ROYALTY_ADMIN_ROLE, owner); _grantRole(METADATA_ADMIN_ROLE, owner); } // // Metadata // /** * Update the base URI of token's URI. * @param tokenBaseURI New base URI of token's URI */ function setBaseMetadataURI(string memory tokenBaseURI) external onlyRole(METADATA_ADMIN_ROLE) { _setBaseMetadataURI(tokenBaseURI); } /** * Update the name of the contract. * @param tokenName New contract name */ function setContractName(string memory tokenName) external onlyRole(METADATA_ADMIN_ROLE) { _setContractName(tokenName); } /** * Update the contract URI of token's URI. * @param tokenContractURI New contract URI of token's URI * @notice Refer to https://docs.opensea.io/docs/contract-level-metadata */ function setContractURI(string memory tokenContractURI) external onlyRole(METADATA_ADMIN_ROLE) { _contractURI = tokenContractURI; } // // Burn // /** * Allows the owner of the token to burn their tokens. * @param tokenId Id of token to burn * @param amount Amount of tokens to burn */ function burn(uint256 tokenId, uint256 amount) public virtual { _burn(msg.sender, tokenId, amount); } /** * Burn tokens of given token id for each (tokenIds[i], amounts[i]) pair. * @param tokenIds Array of token ids to burn * @param amounts Array of the amount to be burned */ function batchBurn(uint256[] memory tokenIds, uint256[] memory amounts) public virtual { _batchBurn(msg.sender, tokenIds, amounts); } // // Views // /** * Get the contract URI of token's URI. * @return Contract URI of token's URI * @notice Refer to https://docs.opensea.io/docs/contract-level-metadata */ function contractURI() public view returns (string memory) { return _contractURI; } /** * Check interface support. * @param interfaceId Interface id * @return True if supported */ function supportsInterface(bytes4 interfaceId) public view virtual override (ERC1155Supply, ERC1155Metadata, ERC2981Controlled) returns (bool) { return ERC1155Supply.supportsInterface(interfaceId) || ERC1155Metadata.supportsInterface(interfaceId) || ERC2981Controlled.supportsInterface(interfaceId) || super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.19; import {IERC2981Controlled} from "@0xsequence/contracts-library/tokens/common/IERC2981Controlled.sol"; import {ERC2981} from "@openzeppelin/contracts/token/common/ERC2981.sol"; import {AccessControlEnumerable} from "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; /** * An implementation of ERC-2981 that allows updates by roles. */ abstract contract ERC2981Controlled is ERC2981, AccessControlEnumerable, IERC2981Controlled { bytes32 internal constant ROYALTY_ADMIN_ROLE = keccak256("ROYALTY_ADMIN_ROLE"); // // Royalty // /** * Sets the royalty information that all ids in this contract will default to. * @param receiver Address of who should be sent the royalty payment * @param feeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500) */ function setDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyRole(ROYALTY_ADMIN_ROLE) { _setDefaultRoyalty(receiver, feeNumerator); } /** * Sets the royalty information that a given token id in this contract will use. * @param tokenId The token id to set the royalty information for * @param receiver Address of who should be sent the royalty payment * @param feeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500) * @notice This overrides the default royalty information for this token id */ function setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) external onlyRole(ROYALTY_ADMIN_ROLE) { _setTokenRoyalty(tokenId, receiver, feeNumerator); } // // Views // /** * Check interface support. * @param interfaceId Interface id * @return True if supported */ function supportsInterface(bytes4 interfaceId) public view virtual override (ERC2981, AccessControlEnumerable) returns (bool) { return ERC2981.supportsInterface(interfaceId) || AccessControlEnumerable.supportsInterface(interfaceId) || type(IERC2981Controlled).interfaceId == interfaceId || super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol) // Note: This implementation is an exact copy with the constructor removed, and pragma and imports updated. pragma solidity ^0.8.19; import "@openzeppelin/contracts/proxy/beacon/IBeacon.sol"; import "@openzeppelin/contracts/proxy/Proxy.sol"; import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol"; /** * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}. * * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't * conflict with the storage layout of the implementation behind the proxy. * * _Available since v3.4._ */ contract BeaconProxy is Proxy, ERC1967Upgrade { /** * @dev Returns the current beacon address. */ function _beacon() internal view virtual returns (address) { return _getBeacon(); } /** * @dev Returns the current implementation address of the associated beacon. */ function _implementation() internal view virtual override returns (address) { return IBeacon(_getBeacon()).implementation(); } /** * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}. * * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. * * Requirements: * * - `beacon` must be a contract. * - The implementation returned by `beacon` must be a contract. */ function _setBeacon(address beacon, bytes memory data) internal virtual { _upgradeBeaconToAndCall(beacon, data, false); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/transparent/TransparentUpgradeableProxy.sol) /// @notice This implementation is a copy of OpenZeppelin's with the following changes: /// - Pragma updated /// - Imports updated /// - Constructor removed /// - Allows admin to call implementation pragma solidity ^0.8.19; import "./ERC1967Proxy.sol"; /** * @dev Interface for {TransparentUpgradeableProxy}. In order to implement transparency, {TransparentUpgradeableProxy} * does not implement this interface directly, and some of its functions are implemented by an internal dispatch * mechanism. The compiler is unaware that these functions are implemented by {TransparentUpgradeableProxy} and will not * include them in the ABI so this interface must be used to interact with it. */ interface ITransparentUpgradeableProxy is IERC1967 { function admin() external view returns (address); function implementation() external view returns (address); function changeAdmin(address) external; function upgradeTo(address) external; function upgradeToAndCall(address, bytes memory) external payable; } /** * @dev This contract implements a proxy that is upgradeable by an admin. * * Unlike the original OpenZeppelin implementation, this contract does not prevent the admin from calling the implementation. * This potentially exposes the admin to a proxy selector attack. See * https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing]. * When using this contract, you must ensure that the implementation function selectors do not clash with the proxy selectors. * The proxy selectors are: * - 0x3659cfe6: upgradeTo * - 0x4f1ef286: upgradeToAndCall * - 0x8f283970: changeAdmin * - 0xf851a440: admin * - 0x5c60da1b: implementation * * NOTE: The real interface of this proxy is that defined in `ITransparentUpgradeableProxy`. This contract does not * inherit from that interface, and instead the admin functions are implicitly implemented using a custom dispatch * mechanism in `_fallback`. Consequently, the compiler will not produce an ABI for this contract. This is necessary to * fully implement transparency without decoding reverts caused by selector clashes between the proxy and the * implementation. * * WARNING: It is not recommended to extend this contract to add additional external functions. If you do so, the compiler * will not check that there are no selector conflicts, due to the note above. A selector clash between any new function * and the functions declared in {ITransparentUpgradeableProxy} will be resolved in favor of the new one. This could * render the admin operations inaccessible, which could prevent upgradeability. Transparency may also be compromised. */ contract TransparentUpgradeableProxy is ERC1967Proxy { /** * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin. * * CAUTION: This modifier is deprecated, as it could cause issues if the modified function has arguments, and the * implementation provides a function with the same selector. */ modifier ifAdmin() { if (msg.sender == _getAdmin()) { _; } else { _fallback(); } } /** * @dev If caller is the admin process the call internally, otherwise transparently fallback to the proxy behavior */ function _fallback() internal virtual override { if (msg.sender == _getAdmin()) { bytes memory ret; bytes4 selector = msg.sig; if (selector == ITransparentUpgradeableProxy.upgradeTo.selector) { ret = _dispatchUpgradeTo(); } else if (selector == ITransparentUpgradeableProxy.upgradeToAndCall.selector) { ret = _dispatchUpgradeToAndCall(); } else if (selector == ITransparentUpgradeableProxy.changeAdmin.selector) { ret = _dispatchChangeAdmin(); } else if (selector == ITransparentUpgradeableProxy.admin.selector) { ret = _dispatchAdmin(); } else if (selector == ITransparentUpgradeableProxy.implementation.selector) { ret = _dispatchImplementation(); } else { // Call implementation return super._fallback(); } assembly { return(add(ret, 0x20), mload(ret)) } } else { super._fallback(); } } /** * @dev Returns the current admin. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function _dispatchAdmin() private returns (bytes memory) { _requireZeroValue(); address admin = _getAdmin(); return abi.encode(admin); } /** * @dev Returns the current implementation. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` */ function _dispatchImplementation() private returns (bytes memory) { _requireZeroValue(); address implementation = _implementation(); return abi.encode(implementation); } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _dispatchChangeAdmin() private returns (bytes memory) { _requireZeroValue(); address newAdmin = abi.decode(msg.data[4:], (address)); _changeAdmin(newAdmin); return ""; } /** * @dev Upgrade the implementation of the proxy. */ function _dispatchUpgradeTo() private returns (bytes memory) { _requireZeroValue(); address newImplementation = abi.decode(msg.data[4:], (address)); _upgradeToAndCall(newImplementation, bytes(""), false); return ""; } /** * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the * proxied contract. */ function _dispatchUpgradeToAndCall() private returns (bytes memory) { (address newImplementation, bytes memory data) = abi.decode(msg.data[4:], (address, bytes)); _upgradeToAndCall(newImplementation, data, true); return ""; } /** * @dev Returns the current admin. * * CAUTION: This function is deprecated. Use {ERC1967Upgrade-_getAdmin} instead. */ function _admin() internal view virtual returns (address) { return _getAdmin(); } /** * @dev To keep this contract fully transparent, all `ifAdmin` functions must be payable. This helper is here to * emulate some proxy functions being non-payable while still allowing value to pass through. */ function _requireZeroValue() internal { require(msg.value == 0); } }
// 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 v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [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://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.19; import {ERC1155} from "@0xsequence/erc-1155/contracts/tokens/ERC1155/ERC1155.sol"; import { IERC1155Supply, IERC1155SupplyFunctions } from "@0xsequence/contracts-library/tokens/ERC1155/extensions/supply/IERC1155Supply.sol"; /** * An ERC-1155 extension that tracks token supply. */ abstract contract ERC1155Supply is ERC1155, IERC1155Supply { // Current supply uint256 public totalSupply; mapping(uint256 => uint256) public tokenSupply; /** * Mint _amount of tokens of a given id * @param _to The address to mint tokens to * @param _id Token id to mint * @param _amount The amount to be minted * @param _data Data to pass if receiver is contract */ function _mint(address _to, uint256 _id, uint256 _amount, bytes memory _data) internal virtual { totalSupply += _amount; tokenSupply[_id] += _amount; balances[_to][_id] += _amount; emit TransferSingle(msg.sender, address(0x0), _to, _id, _amount); _callonERC1155Received(address(0x0), _to, _id, _amount, gasleft(), _data); } /** * Mint tokens for each ids in _ids * @param _to The address to mint tokens to * @param _ids Array of ids to mint * @param _amounts Array of amount of tokens to mint per id * @param _data Data to pass if receiver is contract */ function _batchMint(address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data) internal virtual { uint256 nMint = _ids.length; if (nMint != _amounts.length) { revert InvalidArrayLength(); } // Executing all minting uint256 totalAmount = 0; for (uint256 i = 0; i < nMint; i++) { // Update storage balance balances[_to][_ids[i]] += _amounts[i]; tokenSupply[_ids[i]] += _amounts[i]; totalAmount += _amounts[i]; } totalSupply += totalAmount; emit TransferBatch(msg.sender, address(0x0), _to, _ids, _amounts); // Calling onReceive method if recipient is contract _callonERC1155BatchReceived(address(0x0), _to, _ids, _amounts, gasleft(), _data); } /** * Burn _amount of tokens of a given token id * @param _from The address to burn tokens from * @param _id Token id to burn * @param _amount The amount to be burned */ function _burn(address _from, uint256 _id, uint256 _amount) internal virtual { // Supply totalSupply -= _amount; tokenSupply[_id] -= _amount; // Balances balances[_from][_id] -= _amount; // Emit event emit TransferSingle(msg.sender, _from, address(0x0), _id, _amount); } /** * Burn tokens of given token id for each (_ids[i], _amounts[i]) pair * @param _from The address to burn tokens from * @param _ids Array of token ids to burn * @param _amounts Array of the amount to be burned */ function _batchBurn(address _from, uint256[] memory _ids, uint256[] memory _amounts) internal virtual { uint256 nBurn = _ids.length; if (nBurn != _amounts.length) { revert InvalidArrayLength(); } uint256 totalAmount = 0; for (uint256 i = 0; i < nBurn; i++) { // Update balances balances[_from][_ids[i]] -= _amounts[i]; tokenSupply[_ids[i]] -= _amounts[i]; totalAmount += _amounts[i]; } totalSupply -= totalAmount; // Emit batch mint event emit TransferBatch(msg.sender, _from, address(0x0), _ids, _amounts); } // // Views // /** * Check interface support. * @param interfaceId Interface id * @return True if supported */ function supportsInterface(bytes4 interfaceId) public view virtual override (ERC1155) returns (bool) { return type(IERC1155SupplyFunctions).interfaceId == interfaceId || super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import '../../interfaces/IERC1155Metadata.sol'; import '../../utils/ERC165.sol'; /** * @notice Contract that handles metadata related methods. * @dev Methods assume a deterministic generation of URI based on token IDs. * Methods also assume that URI uses hex representation of token IDs. */ contract ERC1155Metadata is IERC1155Metadata, ERC165 { // URI's default URI prefix string public baseURI; string public name; // set the initial name and base URI constructor(string memory _name, string memory _baseURI) { name = _name; baseURI = _baseURI; } /***********************************| | Metadata Public Functions | |__________________________________*/ /** * @notice A distinct Uniform Resource Identifier (URI) for a given token. * @dev URIs are defined in RFC 3986. * URIs are assumed to be deterministically generated based on token ID * @return URI string */ function uri(uint256 _id) public view virtual override returns (string memory) { return string(abi.encodePacked(baseURI, _uint2str(_id), ".json")); } /***********************************| | Metadata Internal Functions | |__________________________________*/ /** * @notice Will emit default URI log event for corresponding token _id * @param _tokenIDs Array of IDs of tokens to log default URI */ function _logURIs(uint256[] memory _tokenIDs) internal virtual { string memory baseURL = baseURI; string memory tokenURI; for (uint256 i = 0; i < _tokenIDs.length; i++) { tokenURI = string(abi.encodePacked(baseURL, _uint2str(_tokenIDs[i]), ".json")); emit URI(tokenURI, _tokenIDs[i]); } } /** * @notice Will update the base URL of token's URI * @param _newBaseMetadataURI New base URL of token's URI */ function _setBaseMetadataURI(string memory _newBaseMetadataURI) internal { baseURI = _newBaseMetadataURI; } /** * @notice Will update the name of the contract * @param _newName New contract name */ function _setContractName(string memory _newName) internal { name = _newName; } /** * @notice Query if a contract implements an interface * @param _interfaceID The interface identifier, as specified in ERC-165 * @return `true` if the contract implements `_interfaceID` and */ function supportsInterface(bytes4 _interfaceID) public view virtual override returns (bool) { if (_interfaceID == type(IERC1155Metadata).interfaceId) { return true; } return super.supportsInterface(_interfaceID); } /***********************************| | Utility Internal Functions | |__________________________________*/ function _uint2str(uint _i) internal pure returns (string memory _uintAsString) { if (_i == 0) { return '0'; } uint j = _i; uint len; while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); uint k = len; while (_i != 0) { k = k - 1; uint8 temp = (48 + uint8(_i - (_i / 10) * 10)); bytes1 b1 = bytes1(temp); bstr[k] = b1; _i /= 10; } return string(bstr); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.19; interface IERC2981ControlledFunctions { /** * Sets the royalty information that all ids in this contract will default to. * @param receiver Address of who should be sent the royalty payment * @param feeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500) */ function setDefaultRoyalty(address receiver, uint96 feeNumerator) external; /** * Sets the royalty information that a given token id in this contract will use. * @param tokenId The token id to set the royalty information for * @param receiver Address of who should be sent the royalty payment * @param feeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500) * @notice This overrides the default royalty information for this token id */ function setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) external; } interface IERC2981Controlled is IERC2981ControlledFunctions {}
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../utils/introspection/ERC165.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 ERC2981 is IERC2981, ERC165 { 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(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ 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]; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerable.sol"; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol) pragma solidity ^0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internal call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internal call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive() external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overridden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeacon.sol"; import "../../interfaces/IERC1967.sol"; import "../../interfaces/draft-IERC1822.sol"; import "../../utils/Address.sol"; import "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ */ abstract contract ERC1967Upgrade is IERC1967 { // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( Address.isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol) // Note: This implementation is an exact copy with the constructor removed, and pragma and imports updated. pragma solidity ^0.8.19; import "@openzeppelin/contracts/proxy/Proxy.sol"; import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol"; /** * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an * implementation address that can be changed. This address is stored in storage in the location specified by * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the * implementation behind the proxy. */ contract ERC1967Proxy is Proxy, ERC1967Upgrade { /** * @dev Returns the current implementation address. */ function _implementation() internal view virtual override returns (address impl) { return ERC1967Upgrade._getImplementation(); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "../../interfaces/IERC1155TokenReceiver.sol"; import "../../interfaces/IERC1155.sol"; import "../../utils/Address.sol"; import "../../utils/ERC165.sol"; /** * @dev Implementation of Multi-Token Standard contract */ contract ERC1155 is IERC1155, ERC165 { using Address for address; /***********************************| | Variables and Events | |__________________________________*/ // onReceive function signatures bytes4 constant internal ERC1155_RECEIVED_VALUE = 0xf23a6e61; bytes4 constant internal ERC1155_BATCH_RECEIVED_VALUE = 0xbc197c81; // Objects balances mapping (address => mapping(uint256 => uint256)) internal balances; // Operator Functions mapping (address => mapping(address => bool)) internal operators; /***********************************| | Public Transfer Functions | |__________________________________*/ /** * @notice Transfers amount amount of an _id from the _from address to the _to address specified * @param _from Source address * @param _to Target address * @param _id ID of the token type * @param _amount Transfered amount * @param _data Additional data with no specified format, sent in call to `_to` */ function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes memory _data) public virtual override { require((msg.sender == _from) || isApprovedForAll(_from, msg.sender), "ERC1155#safeTransferFrom: INVALID_OPERATOR"); require(_to != address(0),"ERC1155#safeTransferFrom: INVALID_RECIPIENT"); _safeTransferFrom(_from, _to, _id, _amount); _callonERC1155Received(_from, _to, _id, _amount, gasleft(), _data); } /** * @notice Send multiple types of Tokens from the _from address to the _to address (with safety call) * @param _from Source addresses * @param _to Target addresses * @param _ids IDs of each token type * @param _amounts Transfer amounts per token type * @param _data Additional data with no specified format, sent in call to `_to` */ function safeBatchTransferFrom(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data) public virtual override { // Requirements require((msg.sender == _from) || isApprovedForAll(_from, msg.sender), "ERC1155#safeBatchTransferFrom: INVALID_OPERATOR"); require(_to != address(0), "ERC1155#safeBatchTransferFrom: INVALID_RECIPIENT"); _safeBatchTransferFrom(_from, _to, _ids, _amounts); _callonERC1155BatchReceived(_from, _to, _ids, _amounts, gasleft(), _data); } /***********************************| | Internal Transfer Functions | |__________________________________*/ /** * @notice Transfers amount amount of an _id from the _from address to the _to address specified * @param _from Source address * @param _to Target address * @param _id ID of the token type * @param _amount Transfered amount */ function _safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount) internal virtual { // Update balances balances[_from][_id] -= _amount; balances[_to][_id] += _amount; // Emit event emit TransferSingle(msg.sender, _from, _to, _id, _amount); } /** * @notice Verifies if receiver is contract and if so, calls (_to).onERC1155Received(...) */ function _callonERC1155Received(address _from, address _to, uint256 _id, uint256 _amount, uint256 _gasLimit, bytes memory _data) internal virtual { // Check if recipient is contract if (_to.isContract()) { bytes4 retval = IERC1155TokenReceiver(_to).onERC1155Received{gas: _gasLimit}(msg.sender, _from, _id, _amount, _data); require(retval == ERC1155_RECEIVED_VALUE, "ERC1155#_callonERC1155Received: INVALID_ON_RECEIVE_MESSAGE"); } } /** * @notice Send multiple types of Tokens from the _from address to the _to address (with safety call) * @param _from Source addresses * @param _to Target addresses * @param _ids IDs of each token type * @param _amounts Transfer amounts per token type */ function _safeBatchTransferFrom(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts) internal virtual { require(_ids.length == _amounts.length, "ERC1155#_safeBatchTransferFrom: INVALID_ARRAYS_LENGTH"); // Number of transfer to execute uint256 nTransfer = _ids.length; // Executing all transfers for (uint256 i = 0; i < nTransfer; i++) { // Update storage balance of previous bin balances[_from][_ids[i]] -= _amounts[i]; balances[_to][_ids[i]] += _amounts[i]; } // Emit event emit TransferBatch(msg.sender, _from, _to, _ids, _amounts); } /** * @notice Verifies if receiver is contract and if so, calls (_to).onERC1155BatchReceived(...) */ function _callonERC1155BatchReceived(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, uint256 _gasLimit, bytes memory _data) internal virtual { // Pass data if recipient is contract if (_to.isContract()) { bytes4 retval = IERC1155TokenReceiver(_to).onERC1155BatchReceived{gas: _gasLimit}(msg.sender, _from, _ids, _amounts, _data); require(retval == ERC1155_BATCH_RECEIVED_VALUE, "ERC1155#_callonERC1155BatchReceived: INVALID_ON_RECEIVE_MESSAGE"); } } /***********************************| | Operator Functions | |__________________________________*/ /** * @notice Enable or disable approval for a third party ("operator") to manage all of caller's tokens * @param _operator Address to add to the set of authorized operators * @param _approved True if the operator is approved, false to revoke approval */ function setApprovalForAll(address _operator, bool _approved) external virtual override { // Update operator status operators[msg.sender][_operator] = _approved; emit ApprovalForAll(msg.sender, _operator, _approved); } /** * @notice Queries the approval status of an operator for a given owner * @param _owner The owner of the Tokens * @param _operator Address of authorized operator * @return isOperator True if the operator is approved, false if not */ function isApprovedForAll(address _owner, address _operator) public view virtual override returns (bool isOperator) { return operators[_owner][_operator]; } /***********************************| | Balance Functions | |__________________________________*/ /** * @notice Get the balance of an account's Tokens * @param _owner The address of the token holder * @param _id ID of the Token * @return The _owner's balance of the Token type requested */ function balanceOf(address _owner, uint256 _id) public view virtual override returns (uint256) { return balances[_owner][_id]; } /** * @notice Get the balance of multiple account/token pairs * @param _owners The addresses of the token holders * @param _ids ID of the Tokens * @return The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair) */ function balanceOfBatch(address[] memory _owners, uint256[] memory _ids) public view virtual override returns (uint256[] memory) { require(_owners.length == _ids.length, "ERC1155#balanceOfBatch: INVALID_ARRAY_LENGTH"); // Variables uint256[] memory batchBalances = new uint256[](_owners.length); // Iterate over each owner and token ID for (uint256 i = 0; i < _owners.length; i++) { batchBalances[i] = balances[_owners[i]][_ids[i]]; } return batchBalances; } /***********************************| | ERC165 Functions | |__________________________________*/ /** * @notice Query if a contract implements an interface * @param _interfaceID The interface identifier, as specified in ERC-165 * @return `true` if the contract implements `_interfaceID` and */ function supportsInterface(bytes4 _interfaceID) public view virtual override(ERC165, IERC165) returns (bool) { if (_interfaceID == type(IERC1155).interfaceId) { return true; } return super.supportsInterface(_interfaceID); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.19; interface IERC1155SupplyFunctions { /** * Returns the total supply of ERC1155 tokens. */ function totalSupply() external returns (uint256); /** * Returns the total supply of a given ERC1155 token. * @param tokenId The ERC1155 token id. */ function tokenSupply(uint256 tokenId) external returns (uint256); } interface IERC1155SupplySignals { /** * Invalid array input length. */ error InvalidArrayLength(); } interface IERC1155Supply is IERC1155SupplySignals {}
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; interface IERC1155Metadata { event URI(string _uri, uint256 indexed _id); /****************************************| | Functions | |_______________________________________*/ /** * @notice A distinct Uniform Resource Identifier (URI) for a given token. * @dev URIs are defined in RFC 3986. * URIs are assumed to be deterministically generated based on token ID * Token IDs are assumed to be represented in their hex format in URIs * @return URI string */ function uri(uint256 _id) external view returns (string memory); }
pragma solidity ^0.8.0; import "../interfaces/IERC165.sol"; abstract contract ERC165 is IERC165 { /** * @notice Query if a contract implements an interface * @param _interfaceID The interface identifier, as specified in ERC-165 * @return `true` if the contract implements `_interfaceID` */ function supportsInterface(bytes4 _interfaceID) public view virtual override returns (bool) { return _interfaceID == this.supportsInterface.selector; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.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 IERC2981 is IERC165 { /** * @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 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 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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: * * ```solidity * 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}: * * ```solidity * 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. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ 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 (last updated v4.9.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol) pragma solidity ^0.8.0; /** * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC. * * _Available since v4.8.3._ */ interface IERC1967 { /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Emitted when the beacon is changed. */ event BeaconUpgraded(address indexed beacon); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._ * _Available since v4.9 for `string`, `bytes`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /** * @dev ERC-1155 interface for accepting safe transfers. */ interface IERC1155TokenReceiver { /** * @notice Handle the receipt of a single ERC1155 token type * @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeTransferFrom` after the balance has been updated * This function MAY throw to revert and reject the transfer * Return of other amount than the magic value MUST result in the transaction being reverted * Note: The token contract address is always the message sender * @param _operator The address which called the `safeTransferFrom` function * @param _from The address which previously owned the token * @param _id The id of the token being transferred * @param _amount The amount of tokens being transferred * @param _data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` */ function onERC1155Received(address _operator, address _from, uint256 _id, uint256 _amount, bytes calldata _data) external returns(bytes4); /** * @notice Handle the receipt of multiple ERC1155 token types * @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeBatchTransferFrom` after the balances have been updated * This function MAY throw to revert and reject the transfer * Return of other amount than the magic value WILL result in the transaction being reverted * Note: The token contract address is always the message sender * @param _operator The address which called the `safeBatchTransferFrom` function * @param _from The address which previously owned the token * @param _ids An array containing ids of each token being transferred * @param _amounts An array containing amounts of each token being transferred * @param _data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` */ function onERC1155BatchReceived(address _operator, address _from, uint256[] calldata _ids, uint256[] calldata _amounts, bytes calldata _data) external returns(bytes4); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import './IERC165.sol'; interface IERC1155 is IERC165 { /****************************************| | Events | |_______________________________________*/ /** * @dev Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero amount transfers as well as minting or burning * Operator MUST be msg.sender * When minting/creating tokens, the `_from` field MUST be set to `0x0` * When burning/destroying tokens, the `_to` field MUST be set to `0x0` * The total amount transferred from address 0x0 minus the total amount transferred to 0x0 may be used by clients and exchanges to be added to the "circulating supply" for a given token ID * To broadcast the existence of a token ID with no initial balance, the contract SHOULD emit the TransferSingle event from `0x0` to `0x0`, with the token creator as `_operator`, and a `_amount` of 0 */ event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _amount); /** * @dev Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero amount transfers as well as minting or burning * Operator MUST be msg.sender * When minting/creating tokens, the `_from` field MUST be set to `0x0` * When burning/destroying tokens, the `_to` field MUST be set to `0x0` * The total amount transferred from address 0x0 minus the total amount transferred to 0x0 may be used by clients and exchanges to be added to the "circulating supply" for a given token ID * To broadcast the existence of multiple token IDs with no initial balance, this SHOULD emit the TransferBatch event from `0x0` to `0x0`, with the token creator as `_operator`, and a `_amount` of 0 */ event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _amounts); /** * @dev MUST emit when an approval is updated */ event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved); /****************************************| | Functions | |_______________________________________*/ /** * @notice Transfers amount of an _id from the _from address to the _to address specified * @dev MUST emit TransferSingle event on success * Caller must be approved to manage the _from account's tokens (see isApprovedForAll) * MUST throw if `_to` is the zero address * MUST throw if balance of sender for token `_id` is lower than the `_amount` sent * MUST throw on any other error * When transfer is complete, this function MUST check if `_to` is a smart contract (code size > 0). If so, it MUST call `onERC1155Received` on `_to` and revert if the return amount is not `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * @param _from Source address * @param _to Target address * @param _id ID of the token type * @param _amount Transfered amount * @param _data Additional data with no specified format, sent in call to `_to` */ function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes calldata _data) external; /** * @notice Send multiple types of Tokens from the _from address to the _to address (with safety call) * @dev MUST emit TransferBatch event on success * Caller must be approved to manage the _from account's tokens (see isApprovedForAll) * MUST throw if `_to` is the zero address * MUST throw if length of `_ids` is not the same as length of `_amounts` * MUST throw if any of the balance of sender for token `_ids` is lower than the respective `_amounts` sent * MUST throw on any other error * When transfer is complete, this function MUST check if `_to` is a smart contract (code size > 0). If so, it MUST call `onERC1155BatchReceived` on `_to` and revert if the return amount is not `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * Transfers and events MUST occur in the array order they were submitted (_ids[0] before _ids[1], etc) * @param _from Source addresses * @param _to Target addresses * @param _ids IDs of each token type * @param _amounts Transfer amounts per token type * @param _data Additional data with no specified format, sent in call to `_to` */ function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _amounts, bytes calldata _data) external; /** * @notice Get the balance of an account's Tokens * @param _owner The address of the token holder * @param _id ID of the Token * @return The _owner's balance of the Token type requested */ function balanceOf(address _owner, uint256 _id) external view returns (uint256); /** * @notice Get the balance of multiple account/token pairs * @param _owners The addresses of the token holders * @param _ids ID of the Tokens * @return The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair) */ function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory); /** * @notice Enable or disable approval for a third party ("operator") to manage all of caller's tokens * @dev MUST emit the ApprovalForAll event on success * @param _operator Address to add to the set of authorized operators * @param _approved True if the operator is approved, false to revoke approval */ function setApprovalForAll(address _operator, bool _approved) external; /** * @notice Queries the approval status of an operator for a given owner * @param _owner The owner of the Tokens * @param _operator Address of authorized operator * @return isOperator True if the operator is approved, false if not */ function isApprovedForAll(address _owner, address _operator) external view returns (bool isOperator); }
pragma solidity ^0.8.0; /** * Utility library of inline functions on addresses */ library Address { // Default hash for EOA accounts returned by extcodehash bytes32 constant internal ACCOUNT_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; /** * Returns whether the target address is a contract * @dev This function will return false if invoked during the constructor of a contract. * @param _address address of the account to check * @return Whether the target address is a contract */ function isContract(address _address) internal view returns (bool) { bytes32 codehash; // Currently there is no better way to check if there is a contract in an address // than to check the size of the code at that address or if it has a non-zero code hash or account hash assembly { codehash := extcodehash(_address) } return (codehash != 0x0 && codehash != ACCOUNT_HASH); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /** * @title ERC165 * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md */ interface IERC165 { /** * @notice Query if a contract implements an interface * @dev Interface identification is specified in ERC-165. This function * uses less than 30,000 gas * @param _interfaceId The interface identifier, as specified in ERC-165 */ function supportsInterface(bytes4 _interfaceId) external view returns (bool); }
// 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 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.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.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 `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @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); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 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 256, 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 << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
{ "remappings": [ "@0xsequence/contracts-library/=src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "murky/=lib/murky/src/", "@0xsequence/erc20-meta-token/=lib/0xsequence/erc20-meta-token/src/", "@0xsequence/erc-1155/=lib/0xsequence/erc-1155/src/", "erc721a/=lib/chiru-labs/erc721a/", "erc721a-upgradeable/=lib/chiru-labs/erc721a-upgradeable/", "@openzeppelin/=lib/openzeppelin/", "@openzeppelin-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "solady/=lib/solady/src/", "0xsequence/=lib/0xsequence/", "chiru-labs/=lib/chiru-labs/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/murky/lib/openzeppelin-contracts/", "openzeppelin/=lib/openzeppelin/" ], "optimizer": { "enabled": true, "runs": 20000 }, "metadata": { "useLiteralContent": true, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": true, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"factoryOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"proxyAddr","type":"address"}],"name":"ERC1155PackDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"beacon","outputs":[{"internalType":"contract UpgradeableBeacon","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"proxyOwner","type":"address"},{"internalType":"address","name":"tokenOwner","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"string","name":"contractURI","type":"string"},{"internalType":"address","name":"royaltyReceiver","type":"address"},{"internalType":"uint96","name":"royaltyFeeNumerator","type":"uint96"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"uint256","name":"supply","type":"uint256"}],"name":"deploy","outputs":[{"internalType":"address","name":"proxyAddr","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"proxyOwner","type":"address"},{"internalType":"address","name":"tokenOwner","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"string","name":"contractURI","type":"string"},{"internalType":"address","name":"royaltyReceiver","type":"address"},{"internalType":"uint96","name":"royaltyFeeNumerator","type":"uint96"}],"name":"determineAddress","outputs":[{"internalType":"address","name":"proxyAddr","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"upgradeBeacon","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608034610125576001600160401b0390601f6200744338819003918201601f191683019291908484118385101761010f57816020928492604096875283398101031261012557516001600160a01b038082168203610125576100603361012a565b825193614e5394858101958187108388111761010f57620025f0823980600096039086f0908115610105578451916105ee808401928311848410176100f1579184849260209462002002853916815203019085f080156100e4576100d69394501660018060a01b0319600154161760015561012a565b51611e909081620001728239f35b50505051903d90823e3d90fd5b634e487b7160e01b88526041600452602488fd5b84513d87823e3d90fd5b634e487b7160e01b600052604160045260246000fd5b600080fd5b600080546001600160a01b039283166001600160a01b03198216811783559216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a356fe6040608081526004908136101561001557600080fd5b600091823560e01c80631bce45831461086457806359659e90146108115780636dbefeff1461068a578063715018a6146105ed5780638da5cb5b1461059c578063d42d4b0a146101aa5763f2fde38b1461006e57600080fd5b346101a65760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a6576100a5610923565b906100ae610ac1565b73ffffffffffffffffffffffffffffffffffffffff809216928315610123575050600054827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b90602060849251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b8280fd5b50919034610598577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc91610120833601126104a2576101e7610923565b926101f061094b565b9067ffffffffffffffff604435818111610594576102119036908901610a31565b90606435818111610590576102299036908a01610a31565b90608435908111610590578794939291906102479036908b01610a31565b9261025061096e565b93610259610aa6565b9289519b60209c8d8c88838c8a8d8a8a888601966102779588610ba6565b03937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09485810182526102aa90826109f0565b5190209b8d82519485916102bd836109d4565b825273ffffffffffffffffffffffffffffffffffffffff9e8f60015416908551938492888401966102ee9388610c19565b0390810182526102fe90826109f0565b519020916111eb91519080830161031590836109f0565b828252810191610c70833980511561053257518c92918ef5169c8d156104d5576001548b16908e3b156104d157908e8c8f8f94610393869251978896879586947fcf7a1d77000000000000000000000000000000000000000000000000000000008652168b8501526024840152606060448401526064830190610b63565b03925af180156104c757908b916104b3575b50508b3b156104af576104327f1d14ef670000000000000000000000000000000000000000000000000000000096946bffffffffffffffffffffffff946104238d9b9a98958f958e96519e8f9d8e9d8e5216908c015261010060248c0152610413610104998a8d0190610b63565b90848c83030160448d0152610b63565b918983030160648a0152610b63565b941660848601521660a484015260e43560c48401523560e4830152038183885af180156104a55761048e575b50507fe3049ee698743dac343b02bfe6b441269ca8b5f5dd610b74d96c1c02034ee566838251848152a151908152f35b6104988291610991565b6104a2578061045e565b80fd5b83513d84823e3d90fd5b8980fd5b6104bc90610991565b6104af5789386103a5565b8c513d8d823e3d90fd5b8c80fd5b506064828f8e51917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152fd5b5050506064828f808f51927f08c379a000000000000000000000000000000000000000000000000000000000845283015260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152fd5b8580fd5b8480fd5b5080fd5b50503461059857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126105985773ffffffffffffffffffffffffffffffffffffffff60209254169051908152f35b83346104a257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126104a257610624610ac1565b600073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b5091346104a25760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126104a2576106c3610923565b906106cc61094b565b67ffffffffffffffff91906044358381116101a6576106ee9036908801610a31565b9560643584811161080d576107069036908301610a31565b9360843590811161080d5760559492610728600b95936107cd93369101610a31565b9361074f61073461096e565b61073c610aa6565b908b5197889460209e8f87019788610ba6565b03936107817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0958681018352826109f0565b51902092875192610791846109d4565b835273ffffffffffffffffffffffffffffffffffffffff966107c18860015416948a519586938d85019889610c19565b039081018352826109f0565b5190206111eb85516107e1888301826109f0565b81815287810191610c7083395190209085519186830152868201523081520160ff815320915191168152f35b8380fd5b50503461059857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126105985760209073ffffffffffffffffffffffffffffffffffffffff600154169051908152f35b5090346101a65760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a6578261089e610923565b6108a6610ac1565b73ffffffffffffffffffffffffffffffffffffffff90816001541690813b1561080d5783602492865197889586947f3659cfe600000000000000000000000000000000000000000000000000000000865216908401525af190811561091a575061090e575080f35b61091790610991565b80f35b513d84823e3d90fd5b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361094657565b600080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361094657565b60a4359073ffffffffffffffffffffffffffffffffffffffff8216820361094657565b67ffffffffffffffff81116109a557604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6020810190811067ffffffffffffffff8211176109a557604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176109a557604052565b81601f820112156109465780359067ffffffffffffffff82116109a55760405192610a8460207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f86011601856109f0565b8284526020838301011161094657816000926020809301838601378301015290565b60c435906bffffffffffffffffffffffff8216820361094657565b73ffffffffffffffffffffffffffffffffffffffff600054163303610ae257565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60005b838110610b535750506000910152565b8181015183820152602001610b43565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602093610b9f81518092818752878088019101610b40565b0116010190565b9496959160a094610bfe6bffffffffffffffffffffffff95610bf0610c0c9473ffffffffffffffffffffffffffffffffffffffff8097168b5260c060208c015260c08b0190610b63565b9089820360408b0152610b63565b908782036060890152610b63565b9616608085015216910152565b9190926048949383527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000809260601b16602084015260601b166034820152610c6a8251809360208685019101610b40565b01019056fe60808060405234610016576111cf908161001c8239f35b600080fdfe604060808152366103825773ffffffffffffffffffffffffffffffffffffffff807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035416158015610b94576000917fcf7a1d77000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000843516146100c057600484517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b6100c8611192565b60049136831161037e5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261037e578235916101088361067f565b602435926101158461067f565b60443567ffffffffffffffff811161037a57610135839136908801610789565b941692156103525761014791166107e3565b803b156102cf578451907f5c60da1b000000000000000000000000000000000000000000000000000000009384835260209687848381865afa9384156102a657889461019d9189916102b2575b503b1515610926565b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85161790555194827f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e8880a28451158015906102ab575b610242575b8361023c6107d0565b80519101f35b8592839182525afa9182156102a65761026a9392610277575b506102646109b1565b91610a21565b5038808083818080610233565b610298919250843d861161029f575b610290818361070e565b810190610902565b903861025b565b503d610286565b61091a565b508661022e565b6102c99150863d881161029f57610290818361070e565b38610194565b60848360208751917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e60448201527f74726163740000000000000000000000000000000000000000000000000000006064820152fd5b8487517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b8680fd5b8380fd5b73ffffffffffffffffffffffffffffffffffffffff807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035416158015610b94576000907fcf7a1d77000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000833516146104395760046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b610441611192565b60049236841161067b5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261067b5783356104808161067f565b6024359161048d8361067f565b60443567ffffffffffffffff8111610677576104ad829136908901610789565b9316931561064e576104bf91166107e3565b813b156105ca576040517f5c60da1b000000000000000000000000000000000000000000000000000000009283825260209586838281855afa9283156102a65787936105149188916105b357503b1515610926565b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff841617905560405194827f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e8880a28451158015906102ab57610242578361023c6107d0565b6102c99150853d871161029f57610290818361070e565b6084846020604051917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e60448201527f74726163740000000000000000000000000000000000000000000000000000006064820152fd5b856040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b8580fd5b8280fd5b73ffffffffffffffffffffffffffffffffffffffff81160361069d57565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6020810190811067ffffffffffffffff8211176106ed57604052565b6106a2565b6040810190811067ffffffffffffffff8211176106ed57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176106ed57604052565b67ffffffffffffffff81116106ed57601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f8201121561069d578035906107a08261074f565b926107ae604051948561070e565b8284526020838301011161069d57816000926020809301838601378301015290565b604051906107dd826106d1565b60008252565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61039081547f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f604080519373ffffffffffffffffffffffffffffffffffffffff9081851686521693846020820152a1811561087e577fffffffffffffffffffffffff000000000000000000000000000000000000000016179055565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b9081602091031261069d57516109178161067f565b90565b6040513d6000823e3d90fd5b1561092d57565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201527f73206e6f74206120636f6e7472616374000000000000000000000000000000006064820152fd5b604051906060820182811067ffffffffffffffff8211176106ed57604052602782527f206661696c6564000000000000000000000000000000000000000000000000006040837f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c60208201520152565b6000806109179493602081519101845af43d15610a60573d91610a438361074f565b92610a51604051948561070e565b83523d6000602085013e610acd565b606091610acd565b15610a6f57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b91929015610aed5750815115610ae1575090565b610917903b1515610a68565b825190915015610b005750805190602001fd5b604051907f08c379a000000000000000000000000000000000000000000000000000000000825281602080600483015282519283602484015260005b848110610b7d575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f836000604480968601015201168101030190fd5b818101830151868201604401528593508201610b3c565b610bee610bd57fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b3303610d14576000357fffffffff00000000000000000000000000000000000000000000000000000000167f3659cfe6000000000000000000000000000000000000000000000000000000008103610c515750610c49610f0f565b602081519101f35b7f4f1ef286000000000000000000000000000000000000000000000000000000008103610c865750610c81611083565b610c49565b7f8f283970000000000000000000000000000000000000000000000000000000008103610cb65750610c81610ec5565b7ff851a440000000000000000000000000000000000000000000000000000000008103610ce65750610c81610dfd565b7f5c60da1b0000000000000000000000000000000000000000000000000000000003610d1457610c81610e53565b610d1c610d3b565b6000808092368280378136915af43d82803e15610d37573d90f35b3d90fd5b73ffffffffffffffffffffffffffffffffffffffff807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc541680610df8575060206004917fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d505416604051928380927f5c60da1b0000000000000000000000000000000000000000000000000000000082525afa9081156102a657600091610de0575090565b610917915060203d811161029f57610290818361070e565b905090565b610e05611192565b73ffffffffffffffffffffffffffffffffffffffff7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103541660405190602082015260208152610917816106f2565b610e5b611192565b610e63610d3b565b73ffffffffffffffffffffffffffffffffffffffff6040519116602082015260208152610917816106f2565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc602091011261069d576004356109178161067f565b610ecd611192565b3660041161069d57610efc73ffffffffffffffffffffffffffffffffffffffff610ef636610e8f565b166107e3565b604051610f08816106d1565b6000815290565b610f17611192565b3660041161069d5773ffffffffffffffffffffffffffffffffffffffff610f3d36610e8f565b1660405190610f4b826106d1565b60008252803b15610fff577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc817fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055807fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a2815115801590610ff7575b610fe3575b5050604051610f08816106d1565b610fef916102646109b1565b503880610fd5565b506000610fd0565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e7472616374000000000000000000000000000000000000006064820152fd5b3660041161069d5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261069d576004356110c18161067f565b60243567ffffffffffffffff811161069d576110f673ffffffffffffffffffffffffffffffffffffffff913690600401610789565b9116803b15610fff577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc817fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055807fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a281511580159061118a57610fe3575050604051610f08816106d1565b506001610fd0565b3461069d5756fea2646970667358221220b820652d5793497c167e3cfe4d8ae98e5e8a03632e1b489cac5616cd2b77dde864736f6c63430008130033a26469706673582212206042f8485c3720a3843e788e3999900f7d3500f1c8aea0a9042957fc3db6fd1664736f6c6343000813003360803461011a57601f6105ee38819003918201601f19168301916001600160401b0383118484101761011f5780849260209460405283398101031261011a57516001600160a01b03808216919082820361011a576000549160018060a01b0319923384821617600055604051923391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a33b156100b2575060015416176001556040516104b890816101368239f35b62461bcd60e51b815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f60448201527f6e206973206e6f74206120636f6e7472616374000000000000000000000000006064820152608490fd5b600080fd5b634e487b7160e01b600052604160045260246000fdfe6080604052600436101561001257600080fd5b6000803560e01c80633659cfe6146102ce5780635c60da1b1461027c578063715018a6146101e05780638da5cb5b1461018f5763f2fde38b1461005457600080fd5b3461018c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c5760043573ffffffffffffffffffffffffffffffffffffffff808216809203610188576100ad610403565b8115610104578254827fffffffffffffffffffffffff00000000000000000000000000000000000000008216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b8280fd5b80fd5b503461018c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c5773ffffffffffffffffffffffffffffffffffffffff6020915416604051908152f35b503461018c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c57610217610403565b8073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b503461018c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c57602073ffffffffffffffffffffffffffffffffffffffff60015416604051908152f35b503461018c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c5760043573ffffffffffffffffffffffffffffffffffffffff81169081810361018857610328610403565b3b1561037f57807fffffffffffffffffffffffff000000000000000000000000000000000000000060015416176001557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8280a280f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f60448201527f6e206973206e6f74206120636f6e7472616374000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff60005416330361042457565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fdfea26469706673582212201cbd07faafe4f9244190e59ad13104130390b97708c6d97e7a003733063b13b764736f6c6343000813003360a060405234620002ec5762000014620002f1565b6200001e620002f1565b815190916001600160401b0390818311620001ed576005938454916001948584811c9416918215620002e1575b60209283861014620002cb578190601f9586811162000277575b5083908683116001146200020f5760009262000203575b5050600019600383901b1c191690861b1786555b8151938411620001ed576004958654908682811c92168015620001e2575b83831014620001cd5784821162000184575b5050809284116001146200011957509282939183926000946200010d575b50501b916000199060031b1c19161790555b33608052604051614b3d908162000316823960805181613d240152f35b015192503880620000de565b919083601f1981168760005284600020946000905b888383106200016957505050106200014f575b505050811b019055620000f0565b015160001960f88460031b161c1916905538808062000141565b8587015188559096019594850194879350908101906200012e565b87600052826000209085808801821c830193858910620001c3575b01901c019086905b828110620001b65750620000c0565b60008155018690620001a7565b935082936200019f565b602288634e487b7160e01b6000525260246000fd5b91607f1691620000ae565b634e487b7160e01b600052604160045260246000fd5b0151905038806200007c565b90889350601f198316918a600052856000209260005b8782821062000260575050841162000246575b505050811b01865562000090565b015160001960f88460031b161c1916905538808062000238565b8385015186558c9790950194938401930162000225565b9091508860005283600020868085018b1c820192868610620002c1575b918a9186959493018c1c01915b828110620002b157505062000065565b600081558594508a9101620002a1565b9250819262000294565b634e487b7160e01b600052602260045260246000fd5b93607f16936200004b565b600080fd5b60405190602082016001600160401b03811183821017620001ed576040526000825256fe608080604052600436101561001357600080fd5b60003560e01c908162fdd58e14612e145750806301ffc9a714612d4157806304634d8d14612cff578063047fc9aa14612ce157806306fdde0314612c3b5780630b5ee00614612ac25780630e89341c1461297a57806318160ddd1461295c5780631d14ef67146127e957806320ec271b146126b0578063248a9ca3146126815780632693ebf214612655578063275bf183146124285780632a55205a146123745780632eb2c2d614611eb05780632eb4a7ab14611e925780632f2ff15d14611dbc57806336568abe14611cf65780633c7a3aff14611bb75780634e1273f4146119d95780635944c753146118bb5780636c0360eb146118155780636f225bd4146115fd578063731133e9146114ab5780637e518ec8146113315780639010d07c146112e757806391d148541461128c578063938e3d7b14611112578063a206e5e114610c4a578063a217fddf14610c2e578063a22cb46514610b9b578063b390c0ab14610b0c578063b48ab8b6146107fa578063bd93f5a0146107cd578063ca15c873146107a1578063d547741f14610762578063da0239a614610744578063e8a3d4851461065e578063e985e9c5146105fa578063f242432a1461026e5763f8954818146101e157600080fd5b346102695760c0600319360112610269576101fa612e64565b67ffffffffffffffff906024358281116102695761021c90369060040161301b565b6044358381116102695761023490369060040161301b565b6064359384116102695761024f61026794369060040161301b565b90610258612e87565b92610261612eee565b94613d04565b005b600080fd5b346102695760a060031936011261026957610287612e64565b61028f612eaa565b906044356064359260843567ffffffffffffffff8111610269576102b790369060040161301b565b73ffffffffffffffffffffffffffffffffffffffff8094169384331480156105d6575b156105525782169182156104ce5784600052602095600087526040600020856000528752604060002061030e828254613122565b905583600052600087526040600020856000528752604060002061033382825461312f565b90558386604051878152838a8201527fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6260403392a46103725a926132dd565b61037857005b600087946103d596604051978896879586937ff23a6e61000000000000000000000000000000000000000000000000000000009c8d865233600487015260248601526044850152606484015260a0608484015260a4830190612fda565b0393f180156104c2577fffffffff0000000000000000000000000000000000000000000000000000000091600091610495575b50160361041157005b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152603a60248201527f45524331313535235f63616c6c6f6e4552433131353552656365697665643a2060448201527f494e56414c49445f4f4e5f524543454956455f4d4553534147450000000000006064820152fd5b6104b59150843d86116104bb575b6104ad8183612f94565b81019061313c565b84610408565b503d6104a3565b6040513d6000823e3d90fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4552433131353523736166655472616e7366657246726f6d3a20494e56414c4960448201527f445f524543495049454e540000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f4552433131353523736166655472616e7366657246726f6d3a20494e56414c4960448201527f445f4f50455241544f52000000000000000000000000000000000000000000006064820152fd5b5084600052600160205260406000203360005260205260ff604060002054166102da565b3461026957604060031936011261026957610613612e64565b61061b612eaa565b9073ffffffffffffffffffffffffffffffffffffffff809116600052600160205260406000209116600052602052602060ff604060002054166040519015158152f35b34610269576000600319360112610269576040516000600a5461068081612f09565b8084529060019081811690811561071d57506001146106c2575b6106be846106aa81860382612f94565b604051918291602083526020830190612fda565b0390f35b600a600090815292507fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a85b8284106107055750505081016020016106aa8261069a565b805460208587018101919091529093019281016106ed565b60ff191660208087019190915292151560051b850190920192506106aa915083905061069a565b34610269576000600319360112610269576020600e54604051908152f35b3461026957604060031936011261026957610267600435610781612eaa565b9080600052600860205261079c600160406000200154613829565b61393b565b346102695760206003193601126102695760043560005260096020526020604060002054604051908152f35b346102695760206003193601126102695760206107f06107eb612e64565b6146ea565b9050604051908152f35b346102695760031960808136011261026957610814612e64565b9067ffffffffffffffff6024358181116102695761083690369060040161307a565b926044358281116102695761084f90369060040161307a565b916064359081116102695761086890369060040161301b565b906108716136dd565b845183518103610ae25760008073ffffffffffffffffffffffffffffffffffffffff8416925b808310610a4f57506108ac915060025461312f565b6002558060006040517f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb3391806108e48a8d83613197565b0390a46108f15a926132dd565b6108f757005b600061096291602095610971604051988997889687946109527fbc197c81000000000000000000000000000000000000000000000000000000009e8f885233600489015289602489015260a0604489015260a48801906130ee565b90848783030160648801526130ee565b91848303016084850152612fda565b0393f180156104c2577fffffffff0000000000000000000000000000000000000000000000000000000091600091610a31575b5016036109ad57005b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603f60248201527f45524331313535235f63616c6c6f6e455243313135354261746368526563656960448201527f7665643a20494e56414c49445f4f4e5f524543454956455f4d455353414745006064820152fd5b610a49915060203d81116104bb576104ad8183612f94565b836109a4565b90610ad5610adb918a60038a610aad88610aa681610a6d8186613183565b51948d600052602095600087526040600020610a89848b613183565b516000528752610a9f604060002091825461312f565b9055613183565b5194613183565b5160005252610ac2604060002091825461312f565b9055610ace858a613183565b519061312f565b92613174565b9190610897565b60046040517f9d89020a000000000000000000000000000000000000000000000000000000008152fd5b34610269576000610b1c366130d8565b610b2881600254613122565b600255818352600360205260408320610b42828254613122565b9055338352826020526040832082845260205260408320610b64828254613122565b9055604051918252602082015233907fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6260403392a4005b3461026957604060031936011261026957610bb4612e64565b6024358015158091036102695733600052600160205273ffffffffffffffffffffffffffffffffffffffff604060002092169182600052602052604060002060ff1981541660ff83161790556040519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b3461026957600060031936011261026957602060405160008152f35b3461026957606060031936011261026957610c63612e64565b67ffffffffffffffff60243511610269576060600319602435360301126102695767ffffffffffffffff60443511610269573660236044350112156102695767ffffffffffffffff6044356004013511610269573660246044356004013560051b60443501011161026957610cd7816146ea565b6040805160208101929092528181015290919080610cfa60046024350180614588565b6060808401528060c084015260e08301919060005b8181106110d95750505090610d8d610d9b92610d69610d376024803501602435600401614588565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0939184878403016080880152614618565b90610d7e604460243501602435600401614588565b918584030160a0860152614618565b03601f198101835282612f94565b60208151910120600c5491610db560443560040135613062565b91610dc36040519384612f94565b60443560048101358452602401602084015b60246044356004013560051b604435010182106110c9575050936000945b8351861015610e3f57610e068685613183565b519081811015610e2b57600052602052610e2560406000205b95613174565b94610df3565b90600052602052610e256040600020610e1f565b840361109f5773ffffffffffffffffffffffffffffffffffffffff8216600052600f60205260006040812055610e82610e79600e546139d2565b80600e55614817565b90600052601060205260406000205560005b610ea36004602435018061467b565b905081101561105c57610ebb6004602435018061467b565b82101561102d578160051b01359073ffffffffffffffffffffffffffffffffffffffff8216820361026957610f0381610efd602480350160243560040161467b565b906146cf565b92610f1c83610efd60446024350160243560040161467b565b73ffffffffffffffffffffffffffffffffffffffff839293163b1561026957600073ffffffffffffffffffffffffffffffffffffffff6020610fb482968b95610fa2869a6040519d8e9b8c9a7fb48ab8b6000000000000000000000000000000000000000000000000000000008c521660048b0152608060248b015260848a01916145db565b916003198884030160448901526145db565b838582039160031983016064880152520193165af180156104c257610fe3575b610fde9150613174565b610e94565b67ffffffffffffffff8211610ffe57610fde91604052610fd4565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f53c9506e55fc6114c87ee7b6f64d544cf5de7fb4025c4aee19279ed5dd3bf15760208373ffffffffffffffffffffffffffffffffffffffff60405191168152a1005b60046040517f09bde339000000000000000000000000000000000000000000000000000000008152fd5b8135815260209182019101610dd5565b9193509160208060019273ffffffffffffffffffffffffffffffffffffffff61110188612ecd565b168152019401910191849392610d0f565b34610269576020806003193601126102695767ffffffffffffffff6004358181116102695761114590369060040161301b565b9161114e613591565b8251918211610ffe57611162600a54612f09565b601f8111611228575b5080601f83116001146111a75750819260009261119c575b50506000198260011b9260031b1c191617600a55600080f35b015190508280611183565b90601f19831693600a6000527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8926000905b86821061121057505083600195106111f7575b505050811b01600a55005b015160001960f88460031b161c191690558280806111ec565b806001859682949686015181550195019301906111d9565b600a6000527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8601f840160051c810191838510611282575b601f0160051c01905b818110611276575061116b565b60008155600101611269565b9091508190611260565b34610269576040600319360112610269576112a5612eaa565b600435600052600860205273ffffffffffffffffffffffffffffffffffffffff60406000209116600052602052602060ff604060002054166040519015158152f35b3461026957602073ffffffffffffffffffffffffffffffffffffffff61132161130f366130d8565b90600052600984526040600020613b0e565b9190546040519260031b1c168152f35b34610269576020806003193601126102695767ffffffffffffffff6004358181116102695761136490369060040161301b565b9161136d613591565b8251918211610ffe57611381600454612f09565b601f8111611447575b5080601f83116001146113c6575081926000926113bb575b50506000198260011b9260031b1c191617600455600080f35b0151905082806113a2565b90601f1983169360046000527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b926000905b86821061142f5750508360019510611416575b505050811b01600455005b015160001960f88460031b161c1916905582808061140b565b806001859682949686015181550195019301906113f8565b60046000527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b601f840160051c8101918385106114a1575b601f0160051c01905b818110611495575061138a565b60008155600101611488565b909150819061147f565b34610269576080600319360112610269576114c4612e64565b60243560443560643567ffffffffffffffff8111610269576114ea90369060040161301b565b926114f36136dd565b6114ff8260025461312f565b6002558260005260209360038552604060002061151d84825461312f565b905573ffffffffffffffffffffffffffffffffffffffff82169182600052600086526040600020856000528652604060002061155a85825461312f565b905582600060405187815286898201527fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6260403392a461159a5a916132dd565b6115a057005b6103d593600087946040518097819682957ff23a6e61000000000000000000000000000000000000000000000000000000009b8c85523360048601528660248601526044850152606484015260a0608484015260a4830190612fda565b346102695760208060031936011261026957611617612e64565b73ffffffffffffffffffffffffffffffffffffffff811680600052600f8352604060002054156117eb5780600052600f8352604060002054804015908115916117e0575b506117b65780600052600f8352600060408120556040519183830183811067ffffffffffffffff821117610ffe57604052600083526002549260019384810180911161178757600255836000526003855260406000208054908582018092116117875755826000526000855260406000208460005285526040600020805490858201809211611787575582600060405186815286888201527fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6260403392a46117235a926132dd565b61172957005b84916103d59160006040519586809581947ff23a6e61000000000000000000000000000000000000000000000000000000009a8b8452336004850152856024850152806044850152606484015260a0608484015260a4830190612fda565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60046040517f55be410c000000000000000000000000000000000000000000000000000000008152fd5b90504311158461165b565b60046040517ffbd0656a000000000000000000000000000000000000000000000000000000008152fd5b3461026957600060031936011261026957604051600060045461183781612f09565b8084529060019081811690811561071d5750600114611860576106be846106aa81860382612f94565b6004600090815292507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b8284106118a35750505081016020016106aa8261069a565b8054602085870181019190915290930192810161188b565b34610269576060600319360112610269576118d4612eaa565b6044356bffffffffffffffffffffffff8116809103610269576118f5613313565b611903612710821115614425565b73ffffffffffffffffffffffffffffffffffffffff80921691821561197b577fffffffffffffffffffffffff0000000000000000000000000000000000000000906040519361195185612f5c565b84526020840192835260043560005260076020526040600020935116915160a01b16179055600080f35b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f455243323938313a20496e76616c696420706172616d657465727300000000006044820152fd5b346102695760406003193601126102695760043567ffffffffffffffff808211610269573660238301121561026957816004013590611a1782613062565b92611a256040519485612f94565b82845260209260248486019160051b83010191368311610269576024859101915b838310611b9f575050505060243590811161026957611a6990369060040161307a565b8251815103611b1b57825190601f19611a9a611a8484613062565b93611a926040519586612f94565b808552613062565b01368484013760005b8451811015611b08578073ffffffffffffffffffffffffffffffffffffffff611acf611b039388613183565b5116600052600085526040600020611ae78285613183565b516000528552604060002054611afd8286613183565b52613174565b611aa3565b604051848152806106be818701866130ee565b608482604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602c60248201527f455243313135352362616c616e63654f6642617463683a20494e56414c49445f60448201527f41525241595f4c454e47544800000000000000000000000000000000000000006064820152fd5b8190611baa84612ecd565b8152019101908490611a46565b3461026957600060031936011261026957336000526020600f81526040600020546117b6573360005260008152604060002060019081600052825260406000205415611ccc576002546000199081810190811161178757600255816000526003835260406000208054908282019182116117875755336000526000835260406000208260005283526040600020805491820191821161178757556000604051828152828482015233907fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6260403392a4430190814311611787577f5e1dd8c4451717d5ca4ffbefdada35e22e0871220b9ed9dd03a351f0938c5ed79033600052600f8152826040600020556040519283523392a2005b60046040517fc2caa2a6000000000000000000000000000000000000000000000000000000008152fd5b3461026957604060031936011261026957611d0f612eaa565b3373ffffffffffffffffffffffffffffffffffffffff821603611d38576102679060043561393b565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152fd5b34610269576040600319360112610269576102676004356009611ddd612eaa565b918060005260209060088252611dfa600160406000200154613829565b806000526008825273ffffffffffffffffffffffffffffffffffffffff604060002094169384600052825260ff6040600020541615611e42575b600052526040600020613b26565b806000526008825260406000208460005282526040600020600160ff198254161790553384827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a4611e34565b34610269576000600319360112610269576020600c54604051908152f35b346102695760a060031936011261026957611ec9612e64565b611ed1612eaa565b9060449067ffffffffffffffff90823582811161026957611ef690369060040161307a565b606494853584811161026957611f1090369060040161307a565b9360843590811161026957611f2990369060040161301b565b73ffffffffffffffffffffffffffffffffffffffff908185163314801561234e575b156122cb57818316156122485783518651036121c557835160005b81811061213b57505060405182841690838716907f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb339180611fa98c8b83613197565b0390a45a94611fb7846132dd565b611fbd57005b8291604051978896879586947fbc197c810000000000000000000000000000000000000000000000000000000086523360048701521660248501528a840160a0905260a4840161200c916130ee565b838103600319018c850152612020916130ee565b82810360031901608484015261203591612fda565b039216600090602095f19081156104c2577fbc197c8100000000000000000000000000000000000000000000000000000000917fffffffff000000000000000000000000000000000000000000000000000000009160009161211d575b50160361209b57005b7f7665643a20494e56414c49445f4f4e5f524543454956455f4d455353414745006084927f45524331313535235f63616c6c6f6e4552433131353542617463685265636569604051937f08c379a000000000000000000000000000000000000000000000000000000000855260206004860152603f6024860152840152820152fd5b612135915060203d81116104bb576104ad8183612f94565b85612092565b806121496121c0928a613183565b51858916600052602090600082526040600020612166848b613183565b51600052825261217c6040600020918254613122565b9055612188828b613183565b5190868816600052600081526040600020906121a4848b613183565b51600052526121b9604060002091825461312f565b9055613174565b611f66565b6084877f494e56414c49445f4152524159535f4c454e47544800000000000000000000008a7f45524331313535235f7361666542617463685472616e7366657246726f6d3a20604051937f08c379a00000000000000000000000000000000000000000000000000000000085526020600486015260356024860152840152820152fd5b6084877f4e56414c49445f524543495049454e54000000000000000000000000000000008a7f45524331313535237361666542617463685472616e7366657246726f6d3a2049604051937f08c379a00000000000000000000000000000000000000000000000000000000085526020600486015260306024860152840152820152fd5b6084877f4e56414c49445f4f50455241544f5200000000000000000000000000000000008a7f45524331313535237361666542617463685472616e7366657246726f6d3a2049604051937f08c379a000000000000000000000000000000000000000000000000000000000855260206004860152602f6024860152840152820152fd5b50818516600052600160205260406000203360005260205260ff60406000205416611f4b565b3461026957612382366130d8565b9060005260076020526040600020906040519161239e83612f5c565b5473ffffffffffffffffffffffffffffffffffffffff928382169182825260a01c60208201529015612406575b6bffffffffffffffffffffffff6020820151169182810292818404149015171561178757604092612710915116918351928352046020820152f35b5060405161241381612f5c565b600654838116825260a01c60208201526123cb565b3461026957612436366130d8565b907fbaa5ee745de68a3095827d2ee7dd2043afc932834d02cc1b8be3da78577f6c1a80600052602060088152604060002033600052815260ff604060002054161561248a575050600c55600d819055600e55005b612493336139df565b916040516124a081612f78565b6042815282810191606036843781511561102d5760308353815160019081101561102d57607860218401536041905b8082116126055750506125a85761255a93612569926048926040519687937f416363657373436f6e74726f6c3a206163636f756e742000000000000000000088860152612525815180928a603789019101612fb7565b8401917f206973206d697373696e6720726f6c6520000000000000000000000000000000603784015251809386840190612fb7565b01036028810185520183612f94565b6125a46040519283927f08c379a000000000000000000000000000000000000000000000000000000000845260048401526024830190612fda565b0390fd5b606483604051907f08c379a000000000000000000000000000000000000000000000000000000000825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f811690601082101561102d577f303132333435363738396162636465660000000000000000000000000000000061264f921a61264585876131bf565b5360041c926139d2565b906124cf565b346102695760206003193601126102695760043560005260036020526020604060002054604051908152f35b346102695760206003193601126102695760043560005260086020526020600160406000200154604051908152f35b346102695760406003193601126102695767ffffffffffffffff600435818111610269576126e290369060040161307a565b90602435908111610269576126fb90369060040161307a565b81519181518303610ae2576000926000905b80821061275e575050612724600093600254613122565b6002557f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb604051806127593395339583613197565b0390a4005b90936127dd6127e3916127718787613183565b513360005260209060008252604060002061278c8a89613183565b5160005282526127a26040600020918254613122565b905560036127b08989613183565b51916127bc8a89613183565b51600052526127d16040600020918254613122565b9055610ace8787613183565b94613174565b9061270d565b346102695761010060031936011261026957612803612e64565b67ffffffffffffffff906024358281116102695761282590369060040161301b565b6044358381116102695761283d90369060040161301b565b6064359384116102695761285861026794369060040161301b565b90612861612e87565b9261286a612eee565b73ffffffffffffffffffffffffffffffffffffffff861660008181527f8ee3ca74b3f53745dbc2c424ce3194f7fbce295a6334fe2d150b8a25d4e298e2602052604090205491969160e435916128f7917fbaa5ee745de68a3095827d2ee7dd2043afc932834d02cc1b8be3da78577f6c1a9060ff161561290a575b60005260096020526040600020613b26565b5060c435600c5580600d55600e55613d04565b8060005260086020526040600020826000526020526040600020600160ff198254161790553382827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a46128e5565b34610269576000600319360112610269576020600254604051908152f35b3461026957602080600319360112610269576129976004356131d0565b9060405191828260006004546129ac81612f09565b90600190818116908115612aa55750600114612a42575b505090816129dd8560059594612a2e975194859201612fb7565b017f2e6a736f6e0000000000000000000000000000000000000000000000000000008152037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe5810185520183612f94565b6106be604051928284938452830190612fda565b60046000908152949593949192507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b838310612a8d575092949392505082018101836129dd6129c3565b8054838a018701528896508795909201918101612a72565b60ff191686860152505080151502830182019050836129dd6129c3565b34610269576020806003193601126102695767ffffffffffffffff9060043582811161026957612af690369060040161301b565b91612aff613591565b8251908111610ffe57600591612b158354612f09565b601f8111612bda575b5080601f8311600114612b5a5750819293600092612b4f575b50506000198260011b9260031b1c1916179055600080f35b015190508380612b37565b90601f19831694846000527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0926000905b878210612bc2575050836001959610612ba9575b505050811b019055005b015160001960f88460031b161c19169055838080612b9f565b80600185968294968601518155019501930190612b8b565b836000527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0601f8401851c810191838510612c31575b601f01851c01905b818110612c255750612b1e565b60008155600101612c18565b9091508190612c10565b34610269576000600319360112610269576040516000600554612c5d81612f09565b8084529060019081811690811561071d5750600114612c86576106be846106aa81860382612f94565b6005600090815292507f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db05b828410612cc95750505081016020016106aa8261069a565b80546020858701810191909152909301928101612cb1565b34610269576000600319360112610269576020600d54604051908152f35b3461026957604060031936011261026957612d18612e64565b6024356bffffffffffffffffffffffff811681036102695761026791612d3c613313565b6144b0565b34610269576020600319360112610269576004357fffffffff00000000000000000000000000000000000000000000000000000000811680820361026957602091817f76826f8e0000000000000000000000000000000000000000000000000000000014918215612db9575b50506040519015158152f35b7fc79b8b5f000000000000000000000000000000000000000000000000000000001491508115612e03575b8115612df3575b508280612dad565b612dfd9150614838565b82612deb565b9050612e0e81614838565b90612de4565b346102695760406003193601126102695760209073ffffffffffffffffffffffffffffffffffffffff612e45612e64565b1660005260008252604060002060243560005282526040600020548152f35b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361026957565b6084359073ffffffffffffffffffffffffffffffffffffffff8216820361026957565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361026957565b359073ffffffffffffffffffffffffffffffffffffffff8216820361026957565b60a435906bffffffffffffffffffffffff8216820361026957565b90600182811c92168015612f52575b6020831014612f2357565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f1691612f18565b6040810190811067ffffffffffffffff821117610ffe57604052565b6080810190811067ffffffffffffffff821117610ffe57604052565b90601f601f19910116810190811067ffffffffffffffff821117610ffe57604052565b60005b838110612fca5750506000910152565b8181015183820152602001612fba565b90601f19601f602093612ff881518092818752878088019101612fb7565b0116010190565b67ffffffffffffffff8111610ffe57601f01601f191660200190565b81601f820112156102695780359061303282612fff565b926130406040519485612f94565b8284526020838301011161026957816000926020809301838601378301015290565b67ffffffffffffffff8111610ffe5760051b60200190565b81601f820112156102695780359161309183613062565b9261309f6040519485612f94565b808452602092838086019260051b820101928311610269578301905b8282106130c9575050505090565b813581529083019083016130bb565b6003196040910112610269576004359060243590565b90815180825260208080930193019160005b82811061310e575050505090565b835185529381019392810192600101613100565b9190820391821161178757565b9190820180921161178757565b9081602091031261026957517fffffffff00000000000000000000000000000000000000000000000000000000811681036102695790565b60001981146117875760010190565b805182101561102d5760209160051b010190565b90916131ae6131bc936040845260408401906130ee565b9160208184039101526130ee565b90565b90815181101561102d570160200190565b80156132a35780816000925b61328f5750806131eb83612fff565b926131f96040519485612f94565b808452601f1961320882612fff565b01366020860137915b61321a57505090565b60001982019182116117875781600a808304928184029184830414841517156117875761324a60ff928392613122565b16603001908111611787577fff000000000000000000000000000000000000000000000000000000000000006132889160f81b1660001a91856131bf565b5380613211565b9161329b600a91613174565b9204806131dc565b506040516132b081612f5c565b600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b3f80151590816132eb575090565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709150141590565b3360009081527fa9ced9fdc45cded6d4b7a90e36d1ee82b957a500cc22704c465e9bdf275406fd602090815260408083205490927f6db4061a20ca83a3be756ee172bd37a029093ac5afe4ce968c6d5435b43cb0119160ff16156133775750505050565b613380336139df565b9184519061338d82612f78565b60428252848201926060368537825115613564576030845382516001908110156135375790607860218501536041915b8083116134b85750505061345c5760486125a49386936134269361341798519889937f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a860152612525815180928c603789019101612fb7565b01036028810187520185612f94565b519283927f08c379a000000000000000000000000000000000000000000000000000000000845260048401526024830190612fda565b6064848651907f08c379a000000000000000000000000000000000000000000000000000000000825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f8116601081101561350a57907f3031323334353637383961626364656600000000000000000000000000000000613503921a6134f986886131bf565b5360041c936139d2565b91906133bd565b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b807f4e487b7100000000000000000000000000000000000000000000000000000000602492526032600452fd5b3360009081527f95f185554aba264de8ed412af70e5aba6acb0e648f258c912ad29ed85d11ca18602090815260408083205490927fe02a0315b383857ac496e9d2b2546a699afaeb4e5e83a1fdef64376d0b74e5a59160ff16156135f55750505050565b6135fe336139df565b9184519061360b82612f78565b60428252848201926060368537825115613564576030845382516001908110156135375790607860218501536041915b8083116136955750505061345c5760486125a49386936134269361341798519889937f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a860152612525815180928c603789019101612fb7565b909192600f8116601081101561350a57907f30313233343536373839616263646566000000000000000000000000000000006136d6921a6134f986886131bf565b919061363b565b3360009081527f51a495916474fe1a0c0fcfb65a8a97682b84a054118858cdd1f5dfd7fc0919eb602090815260408083205490927f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a69160ff16156137415750505050565b61374a336139df565b9184519061375782612f78565b60428252848201926060368537825115613564576030845382516001908110156135375790607860218501536041915b8083116137e15750505061345c5760486125a49386936134269361341798519889937f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a860152612525815180928c603789019101612fb7565b909192600f8116601081101561350a57907f3031323334353637383961626364656600000000000000000000000000000000613822921a6134f986886131bf565b9190613787565b60009080825260209060088252604092838120338252835260ff8482205416156138535750505050565b61385c336139df565b9184519061386982612f78565b60428252848201926060368537825115613564576030845382516001908110156135375790607860218501536041915b8083116138f35750505061345c5760486125a49386936134269361341798519889937f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a860152612525815180928c603789019101612fb7565b909192600f8116601081101561350a57907f3031323334353637383961626364656600000000000000000000000000000000613934921a6134f986886131bf565b9190613899565b90604061398792600090808252600860205273ffffffffffffffffffffffffffffffffffffffff83832094169384835260205260ff838320541661398a575b8152600960205220613bc9565b50565b808252600860205282822084835260205282822060ff1981541690553384827ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b8580a461397a565b8015611787576000190190565b604051906060820182811067ffffffffffffffff821117610ffe57604052602a825260208201604036823782511561102d5760309053815160019081101561102d57607860218401536029905b808211613a9a575050613a3c5790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f8116906010821015613ae0577f3031323334353637383961626364656600000000000000000000000000000000613ada921a61264585876131bf565b90613a2c565b602460007f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b805482101561102d5760005260206000200190600090565b91906001830160009082825280602052604082205415600014613bc35784549468010000000000000000861015613b965783613b86613b6f886001604098999a01855584613b0e565b81939154906000199060031b92831b921b19161790565b9055549382526020522055600190565b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b50925050565b90600182019060009281845282602052604084205490811515600014613cfd5760001991828101818111613cd057825490848201918211613ca357808203613c6e575b50505080548015613c4157820191613c248383613b0e565b909182549160031b1b191690555582526020526040812055600190565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526031600452fd5b613c8e613c7e613b6f9386613b0e565b90549060031b1c92839286613b0e565b90558652846020526040862055388080613c0c565b6024887f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024877f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b5050505090565b9391959490929573ffffffffffffffffffffffffffffffffffffffff93847f0000000000000000000000000000000000000000000000000000000000000000163314801590614419575b6143ef57805167ffffffffffffffff92838211610ffe5760059180613d738454612f09565b94601f95868111614382575b50602090868311600114614301576000926142f6575b50506000198260011b9260031b1c19161782555b8051848111610ffe5780600492613dc08454612f09565b86811161428b575b5060209086831160011461420a576000926141ff575b50506000198260011b9260031b1c19161781555b89519384116141d15750613e07600a54612f09565b90828211614175575b505060209082116001146140e8579080613f3d9392613f9198996000926140dd575b50506000198260011b9260031b1c191617600a555b6000805260089283602052604094856000209616958660005260205260ff8560002054161561408e575b600080526009602052613e878686600020613b26565b507f6db4061a20ca83a3be756ee172bd37a029093ac5afe4ce968c6d5435b43cb0118060005284602052856000208760005260205260ff8660002054161561403f575b6000526009602052613edf8686600020613b26565b507fe02a0315b383857ac496e9d2b2546a699afaeb4e5e83a1fdef64376d0b74e5a58060005284602052856000208760005260205260ff86600020541615613ff0575b6000526009602052613f378686600020613b26565b506144b0565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6908160005280602052826000208460005260205260ff83600020541615613fa1575b506000526009602052600020613b26565b50600160ff19600b541617600b55565b81600052602052816000208360005260205281600020600160ff198254161790553383827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a438613f80565b8060005284602052856000208760005260205285600020600160ff198254161790553387827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a4613f22565b8060005284602052856000208760005260205285600020600160ff198254161790553387827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a4613eca565b6000805283602052846000208660005260205284600020600160ff19825416179055338660007f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4613e71565b015190503880613e32565b601f19821697600a6000527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a89860005b81811061415d5750986001928492613f3d9695613f919b9c10614144575b505050811b01600a55613e47565b015160001960f88460031b161c19169055388080614136565b838301518b556001909a019960209384019301614118565b600a6000527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a89083808601821c830193602087106141c8575b01901c01905b81811015613e1057600081556001016141b4565b935082936141ae565b6041907f4e487b71000000000000000000000000000000000000000000000000000000006000525260246000fd5b015190503880613dde565b60008581527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b93601f1916905b818110614273575090846001959493921061425a575b505050811b018155613df2565b015160001960f88460031b161c1916905538808061424d565b92936020600181928786015181550195019301614237565b909150836000527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b86808501871c820192602086106142ed575b90859493929101871c01905b8181106142de5750613dc8565b600081558493506001016142d1565b925081926142c5565b015190503880613d95565b60008681527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db093601f1916905b81811061436a5750908460019594939210614351575b505050811b018255613da9565b015160001960f88460031b161c19169055388080614344565b9293602060018192878601518155019501930161432e565b90915060008581527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db087808601881c820193602087106143e6575b9086959493929101881c01915b8281106143d8575050613d7f565b8181558594506001016143ca565b935081936143bd565b60046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b5060ff600b5416613d4e565b1561442c57565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c2065786365656460448201527f2073616c655072696365000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff6bffffffffffffffffffffffff8316916144e3612710841115614425565b1691821561452a577fffffffffffffffffffffffff000000000000000000000000000000000000000091602060405161451b81612f5c565b858152015260a01b1617600655565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152fd5b90357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18236030181121561026957016020813591019167ffffffffffffffff8211610269578160051b3603831361026957565b90918281527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83116102695760209260051b809284830137010190565b9082818152602080910193818360051b82010194846000925b858410614642575050505050505090565b90919293949596858061466a83601f1986600196030188526146648c88614588565b906145db565b990194019401929594939190614631565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215610269570180359067ffffffffffffffff821161026957602001918160051b3603831361026957565b9082101561102d576146e69160051b81019061467b565b9091565b600e549081156147ed5773ffffffffffffffffffffffffffffffffffffffff16600090808252600f60205260409182812054409283156147c457828252600f602052808220541561479b578051926020840194855281840152808352606083019183831067ffffffffffffffff84111761476e57505251902006906131bc82614817565b807f4e487b7100000000000000000000000000000000000000000000000000000000602492526041600452fd5b600490517ffbd0656a000000000000000000000000000000000000000000000000000000008152fd5b600490517fb7b33787000000000000000000000000000000000000000000000000000000008152fd5b60046040517f5ab64158000000000000000000000000000000000000000000000000000000008152fd5b8060005260106020526040600020548015600014614833575090565b905090565b614841816148de565b908115614875575b8115614864575b811561485a575090565b6131bc91506149a1565b905061486f816149a1565b90614850565b905061488081614886565b90614849565b7f0e89341c000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008216146148d8576131bc906148de565b50600190565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f3e85e62f000000000000000000000000000000000000000000000000000000001490811561492e575090565b6131bc91507fffffffff00000000000000000000000000000000000000000000000000000000167fd9b67a260000000000000000000000000000000000000000000000000000000081146148d8577f01ffc9a7000000000000000000000000000000000000000000000000000000001490565b6149aa81614a90565b9081156149f8575b81156149cd575b81156149c3575090565b6131bc9150614a09565b7fffffffff0000000000000000000000000000000000000000000000000000000081161591506149b9565b9050614a0381614a09565b906149b2565b7fffffffff000000000000000000000000000000000000000000000000000000008116907f5a05180f000000000000000000000000000000000000000000000000000000008214918215614a5c57505090565b7f7965db0b000000000000000000000000000000000000000000000000000000001491508115614a8a575090565b6131bc91505b7fffffffff00000000000000000000000000000000000000000000000000000000167f2a55205a000000000000000000000000000000000000000000000000000000008114908115614ae0575090565b7f01ffc9a7000000000000000000000000000000000000000000000000000000009150149056fea2646970667358221220eeda6462fade49d46f5714fedf13c64ad717c956b55489eede81ce4d59e31fc364736f6c63430008130033000000000000000000000000007a47e6bf40c1e0ed5c01ae42fdc75879140bc4
Deployed Bytecode
0x6040608081526004908136101561001557600080fd5b600091823560e01c80631bce45831461086457806359659e90146108115780636dbefeff1461068a578063715018a6146105ed5780638da5cb5b1461059c578063d42d4b0a146101aa5763f2fde38b1461006e57600080fd5b346101a65760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a6576100a5610923565b906100ae610ac1565b73ffffffffffffffffffffffffffffffffffffffff809216928315610123575050600054827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b90602060849251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b8280fd5b50919034610598577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc91610120833601126104a2576101e7610923565b926101f061094b565b9067ffffffffffffffff604435818111610594576102119036908901610a31565b90606435818111610590576102299036908a01610a31565b90608435908111610590578794939291906102479036908b01610a31565b9261025061096e565b93610259610aa6565b9289519b60209c8d8c88838c8a8d8a8a888601966102779588610ba6565b03937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09485810182526102aa90826109f0565b5190209b8d82519485916102bd836109d4565b825273ffffffffffffffffffffffffffffffffffffffff9e8f60015416908551938492888401966102ee9388610c19565b0390810182526102fe90826109f0565b519020916111eb91519080830161031590836109f0565b828252810191610c70833980511561053257518c92918ef5169c8d156104d5576001548b16908e3b156104d157908e8c8f8f94610393869251978896879586947fcf7a1d77000000000000000000000000000000000000000000000000000000008652168b8501526024840152606060448401526064830190610b63565b03925af180156104c757908b916104b3575b50508b3b156104af576104327f1d14ef670000000000000000000000000000000000000000000000000000000096946bffffffffffffffffffffffff946104238d9b9a98958f958e96519e8f9d8e9d8e5216908c015261010060248c0152610413610104998a8d0190610b63565b90848c83030160448d0152610b63565b918983030160648a0152610b63565b941660848601521660a484015260e43560c48401523560e4830152038183885af180156104a55761048e575b50507fe3049ee698743dac343b02bfe6b441269ca8b5f5dd610b74d96c1c02034ee566838251848152a151908152f35b6104988291610991565b6104a2578061045e565b80fd5b83513d84823e3d90fd5b8980fd5b6104bc90610991565b6104af5789386103a5565b8c513d8d823e3d90fd5b8c80fd5b506064828f8e51917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152fd5b5050506064828f808f51927f08c379a000000000000000000000000000000000000000000000000000000000845283015260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152fd5b8580fd5b8480fd5b5080fd5b50503461059857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126105985773ffffffffffffffffffffffffffffffffffffffff60209254169051908152f35b83346104a257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126104a257610624610ac1565b600073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b5091346104a25760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126104a2576106c3610923565b906106cc61094b565b67ffffffffffffffff91906044358381116101a6576106ee9036908801610a31565b9560643584811161080d576107069036908301610a31565b9360843590811161080d5760559492610728600b95936107cd93369101610a31565b9361074f61073461096e565b61073c610aa6565b908b5197889460209e8f87019788610ba6565b03936107817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0958681018352826109f0565b51902092875192610791846109d4565b835273ffffffffffffffffffffffffffffffffffffffff966107c18860015416948a519586938d85019889610c19565b039081018352826109f0565b5190206111eb85516107e1888301826109f0565b81815287810191610c7083395190209085519186830152868201523081520160ff815320915191168152f35b8380fd5b50503461059857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126105985760209073ffffffffffffffffffffffffffffffffffffffff600154169051908152f35b5090346101a65760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a6578261089e610923565b6108a6610ac1565b73ffffffffffffffffffffffffffffffffffffffff90816001541690813b1561080d5783602492865197889586947f3659cfe600000000000000000000000000000000000000000000000000000000865216908401525af190811561091a575061090e575080f35b61091790610991565b80f35b513d84823e3d90fd5b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361094657565b600080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361094657565b60a4359073ffffffffffffffffffffffffffffffffffffffff8216820361094657565b67ffffffffffffffff81116109a557604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6020810190811067ffffffffffffffff8211176109a557604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176109a557604052565b81601f820112156109465780359067ffffffffffffffff82116109a55760405192610a8460207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f86011601856109f0565b8284526020838301011161094657816000926020809301838601378301015290565b60c435906bffffffffffffffffffffffff8216820361094657565b73ffffffffffffffffffffffffffffffffffffffff600054163303610ae257565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60005b838110610b535750506000910152565b8181015183820152602001610b43565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602093610b9f81518092818752878088019101610b40565b0116010190565b9496959160a094610bfe6bffffffffffffffffffffffff95610bf0610c0c9473ffffffffffffffffffffffffffffffffffffffff8097168b5260c060208c015260c08b0190610b63565b9089820360408b0152610b63565b908782036060890152610b63565b9616608085015216910152565b9190926048949383527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000809260601b16602084015260601b166034820152610c6a8251809360208685019101610b40565b01019056fe60808060405234610016576111cf908161001c8239f35b600080fdfe604060808152366103825773ffffffffffffffffffffffffffffffffffffffff807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035416158015610b94576000917fcf7a1d77000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000843516146100c057600484517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b6100c8611192565b60049136831161037e5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261037e578235916101088361067f565b602435926101158461067f565b60443567ffffffffffffffff811161037a57610135839136908801610789565b941692156103525761014791166107e3565b803b156102cf578451907f5c60da1b000000000000000000000000000000000000000000000000000000009384835260209687848381865afa9384156102a657889461019d9189916102b2575b503b1515610926565b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85161790555194827f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e8880a28451158015906102ab575b610242575b8361023c6107d0565b80519101f35b8592839182525afa9182156102a65761026a9392610277575b506102646109b1565b91610a21565b5038808083818080610233565b610298919250843d861161029f575b610290818361070e565b810190610902565b903861025b565b503d610286565b61091a565b508661022e565b6102c99150863d881161029f57610290818361070e565b38610194565b60848360208751917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e60448201527f74726163740000000000000000000000000000000000000000000000000000006064820152fd5b8487517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b8680fd5b8380fd5b73ffffffffffffffffffffffffffffffffffffffff807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035416158015610b94576000907fcf7a1d77000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000833516146104395760046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b610441611192565b60049236841161067b5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261067b5783356104808161067f565b6024359161048d8361067f565b60443567ffffffffffffffff8111610677576104ad829136908901610789565b9316931561064e576104bf91166107e3565b813b156105ca576040517f5c60da1b000000000000000000000000000000000000000000000000000000009283825260209586838281855afa9283156102a65787936105149188916105b357503b1515610926565b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff841617905560405194827f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e8880a28451158015906102ab57610242578361023c6107d0565b6102c99150853d871161029f57610290818361070e565b6084846020604051917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e60448201527f74726163740000000000000000000000000000000000000000000000000000006064820152fd5b856040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b8580fd5b8280fd5b73ffffffffffffffffffffffffffffffffffffffff81160361069d57565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6020810190811067ffffffffffffffff8211176106ed57604052565b6106a2565b6040810190811067ffffffffffffffff8211176106ed57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176106ed57604052565b67ffffffffffffffff81116106ed57601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f8201121561069d578035906107a08261074f565b926107ae604051948561070e565b8284526020838301011161069d57816000926020809301838601378301015290565b604051906107dd826106d1565b60008252565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61039081547f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f604080519373ffffffffffffffffffffffffffffffffffffffff9081851686521693846020820152a1811561087e577fffffffffffffffffffffffff000000000000000000000000000000000000000016179055565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b9081602091031261069d57516109178161067f565b90565b6040513d6000823e3d90fd5b1561092d57565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201527f73206e6f74206120636f6e7472616374000000000000000000000000000000006064820152fd5b604051906060820182811067ffffffffffffffff8211176106ed57604052602782527f206661696c6564000000000000000000000000000000000000000000000000006040837f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c60208201520152565b6000806109179493602081519101845af43d15610a60573d91610a438361074f565b92610a51604051948561070e565b83523d6000602085013e610acd565b606091610acd565b15610a6f57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b91929015610aed5750815115610ae1575090565b610917903b1515610a68565b825190915015610b005750805190602001fd5b604051907f08c379a000000000000000000000000000000000000000000000000000000000825281602080600483015282519283602484015260005b848110610b7d575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f836000604480968601015201168101030190fd5b818101830151868201604401528593508201610b3c565b610bee610bd57fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b3303610d14576000357fffffffff00000000000000000000000000000000000000000000000000000000167f3659cfe6000000000000000000000000000000000000000000000000000000008103610c515750610c49610f0f565b602081519101f35b7f4f1ef286000000000000000000000000000000000000000000000000000000008103610c865750610c81611083565b610c49565b7f8f283970000000000000000000000000000000000000000000000000000000008103610cb65750610c81610ec5565b7ff851a440000000000000000000000000000000000000000000000000000000008103610ce65750610c81610dfd565b7f5c60da1b0000000000000000000000000000000000000000000000000000000003610d1457610c81610e53565b610d1c610d3b565b6000808092368280378136915af43d82803e15610d37573d90f35b3d90fd5b73ffffffffffffffffffffffffffffffffffffffff807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc541680610df8575060206004917fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d505416604051928380927f5c60da1b0000000000000000000000000000000000000000000000000000000082525afa9081156102a657600091610de0575090565b610917915060203d811161029f57610290818361070e565b905090565b610e05611192565b73ffffffffffffffffffffffffffffffffffffffff7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103541660405190602082015260208152610917816106f2565b610e5b611192565b610e63610d3b565b73ffffffffffffffffffffffffffffffffffffffff6040519116602082015260208152610917816106f2565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc602091011261069d576004356109178161067f565b610ecd611192565b3660041161069d57610efc73ffffffffffffffffffffffffffffffffffffffff610ef636610e8f565b166107e3565b604051610f08816106d1565b6000815290565b610f17611192565b3660041161069d5773ffffffffffffffffffffffffffffffffffffffff610f3d36610e8f565b1660405190610f4b826106d1565b60008252803b15610fff577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc817fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055807fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a2815115801590610ff7575b610fe3575b5050604051610f08816106d1565b610fef916102646109b1565b503880610fd5565b506000610fd0565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e7472616374000000000000000000000000000000000000006064820152fd5b3660041161069d5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261069d576004356110c18161067f565b60243567ffffffffffffffff811161069d576110f673ffffffffffffffffffffffffffffffffffffffff913690600401610789565b9116803b15610fff577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc817fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055807fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a281511580159061118a57610fe3575050604051610f08816106d1565b506001610fd0565b3461069d5756fea2646970667358221220b820652d5793497c167e3cfe4d8ae98e5e8a03632e1b489cac5616cd2b77dde864736f6c63430008130033a26469706673582212206042f8485c3720a3843e788e3999900f7d3500f1c8aea0a9042957fc3db6fd1664736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000007a47e6bf40c1e0ed5c01ae42fdc75879140bc4
-----Decoded View---------------
Arg [0] : factoryOwner (address): 0x007a47e6BF40C1e0ed5c01aE42fDC75879140bc4
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000007a47e6bf40c1e0ed5c01ae42fdc75879140bc4
Loading...
Loading
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.