diff --git a/.nxignore b/.nxignore index bd6038d948..15eaa698e8 100644 --- a/.nxignore +++ b/.nxignore @@ -7,3 +7,7 @@ secret/ # We don't want the CI to run over all the packages, we decided to ignore it for now yarn.lock .yarn/* + +# We don't do anything with docs right now, specifically we don't want to run over the core package. +/**/documentation +/**/docs diff --git a/README.md b/README.md index 77f84ffa41..119812f8e4 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,68 @@ -# TSB contracts +

-This workspace uses [Nx, a Smart, fast and extensible build system.](https://nx.dev) +

The Sandbox Smart Contracts

-## Understand this workspace +Build Status +![Node Version](https://img.shields.io/badge/node-18.x-green) +[![Discord](https://img.shields.io/discord/497312527093334036.svg?label=Discord&logo=discord)]() +[The Sandbox](https://sandbox.game) is a user-generated content (UGC) gaming platform, that will empower creators through digital ownership and monetization of 3D voxel creations made and shared by users around the world. + +This mono-repo contains The Sandbox smart contracts, underpinning The Sandbox metaverse. Our key token contracts were conceived inside the core package. You can find out more about some of our early blockchain features in [this article](https://medium.com/sandbox-game/blockchain-features-in-the-sandbox-7db91fcc615c). Since core was created, we have added new contracts and updates via new packages - see the below Architecture Overview for more information. + +## Learn more + +- [Website](www.sandbox.game) +- [Discord](https://discordapp.com/invite/vAe4zvY) +- [Telegram](https://t.me/sandboxgame) +- [Medium](https://medium.com/sandbox-game) + +## Prerequisites + +- ⚙️ [NodeJS](https://nodejs.org/) +- 🧰 [Yarn](https://yarnpkg.com/) + +## Tech stack and getting started + +This workspace uses [Nx: a smart, fast and extensible build system.](https://nx.dev) Run `nx graph` to see a diagram of the dependencies of the projects. -To add a package simply add it inside the packages directory, optionally every package can implement -the following targets that will be run by the root `package.json` scripts and on the CI: +To add a package simply add it inside the packages directory. Every package can implement the following targets that will be run by the root `package.json` scripts and on the CI: + +- `test`: run unit tests inside your new package. +- `coverage`: run coverage. Note: CI expects to have at least 80% coverage. +- `lint`: lint your code. +- `format`: format the code with prettier. + +See [`packages/example-hardhat`](./packages/example-hardhat) for an example template package for smart contract development with Hardhat. + +Refer to each package's readme for more information about that package. Note that deployment for all new packages is carried out via `packages/deploy`. +Each package should follow the [audit best practices](./audit-best-practices.md) where applicable. + +### Developer quickstart + +```bash +yarn install +``` + +## Architecture Overview + +- 📦 This mono-repository contains a suite of smart contract packages. +- ⚖️ The mono-repository is released under [MIT license](./LICENSE). Note, that the packages may contain their own licenses. + +| Package | Version | License | Description | +|---------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [`@sandbox-smart-contracts/packages/core`](./packages/core) | [![npm](https://img.shields.io/npm/v/@sandbox-smart-contracts/core)](https://www.npmjs.com/package/@sandbox-smart-contracts/core) | [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://spdx.org/licenses/MIT.html) | 🗝️ Core smart contracts (pre 2023) | +| [`@sandbox-smart-contracts/packages/deploy`](./packages/deploy) | N/A | [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://spdx.org/licenses/MIT.html) | 🚀 Deploy all packages (except core) | +| [`@sandbox-smart-contracts/packages/example-hardhat`](./packages/example-hardhat) | N/A | [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://spdx.org/licenses/MIT.html) | 👷 Development template using Hardhat | +| [`@sandbox-smart-contracts/packages/giveaway`](./packages/giveaway) | [![npm](https://img.shields.io/npm/v/@sandbox-smart-contracts/giveaway)](https://www.npmjs.com/package/@sandbox-smart-contracts/giveaway) | [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://spdx.org/licenses/MIT.html) | 🎁 Instant Giveaway smart contract claims | +| [`@sandbox-smart-contracts/packages/dependency-metatx`](./packages/dependency-metatx) | [![npm](https://img.shields.io/npm/v/@sandbox-smart-contracts/dependency-metatx)](https://www.npmjs.com/package/@sandbox-smart-contracts/dependency-metatx) | [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://spdx.org/licenses/MIT.html) | 🌐 Dependency: ERC2771 handler | +| [`@sandbox-smart-contracts/packages/dependency-royalty-management`](./packages/dependency-royalty-management) | [![npm](https://img.shields.io/npm/v/@sandbox-smart-contracts/dependency-royalty-management)](https://www.npmjs.com/package/@sandbox-smart-contracts/royalty-management) | [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://spdx.org/licenses/MIT.html) | 🎨 Dependency: The Sandbox Royalty Implementation in partnership with [Manifold's royalty-registry](https://github.com/manifoldxyz/royalty-registry-solidity/tree/main) | +| [`@sandbox-smart-contracts/packages/dependency-operator-filter`](./packages/dependency-operator-filter) | [![npm](https://img.shields.io/npm/v/@sandbox-smart-contracts/dependency-operator-filter)](https://www.npmjs.com/package/@sandbox-smart-contracts/operator-filter) | [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://spdx.org/licenses/MIT.html) | 🤝 Dependency: The Sandbox's implementation for OpenSea's operator filter | +| [`@sandbox-smart-contracts/packages/asset`](./packages/asset) | [![npm](https://img.shields.io/npm/v/@sandbox-smart-contracts/asset)](https://www.npmjs.com/package/@sandbox-smart-contracts/asset) | [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://spdx.org/licenses/MIT.html) | 🚗 Asset contract upgrade for L2 deployment featuring tiers, abilities, operator-filter and creator royalties | -- test -- coverage: run coverate, CI expect to have at least 80% coverage on packages. -- lint -- format: format the code with prettier. -- deploy: to test hardhat deployments. +## Contributing -## Further help +### Bug bounties -Visit the [Nx Documentation](https://nx.dev) to learn more. +Submit a bug at [Immunefi](https://immunefi.com/bounty/thesandbox/) to help secure our smart contracts! diff --git a/brand-assets/tsb_3d.jpeg b/brand-assets/tsb_3d.jpeg new file mode 100644 index 0000000000..679a998236 Binary files /dev/null and b/brand-assets/tsb_3d.jpeg differ diff --git a/brand-assets/tsb_main.jpeg b/brand-assets/tsb_main.jpeg new file mode 100644 index 0000000000..96b9364dc9 Binary files /dev/null and b/brand-assets/tsb_main.jpeg differ diff --git a/brand-assets/tsb_pride.png b/brand-assets/tsb_pride.png new file mode 100644 index 0000000000..4418b124b9 Binary files /dev/null and b/brand-assets/tsb_pride.png differ diff --git a/packages/asset/test/Asset.test.ts b/packages/asset/test/Asset.test.ts index 0d66ee4d29..79197938a8 100644 --- a/packages/asset/test/Asset.test.ts +++ b/packages/asset/test/Asset.test.ts @@ -12,6 +12,7 @@ import { RoyaltyMultiRecipientsInterfaceId, RoyaltyUGCInterfaceId, } from './utils/interfaceIds'; +import {BigNumber} from 'ethers'; const zeroAddress = '0x0000000000000000000000000000000000000000'; describe('Base Asset Contract (/packages/asset/contracts/Asset.sol)', function () { @@ -1002,7 +1003,7 @@ describe('Base Asset Contract (/packages/asset/contracts/Asset.sol)', function ( const { operatorFilterRegistry, assetAdmin, - trustedForwarder, + TrustedForwarder, filterOperatorSubscription, RoyaltyManagerContract, } = await setupOperatorFilter(); @@ -1010,7 +1011,7 @@ describe('Base Asset Contract (/packages/asset/contracts/Asset.sol)', function ( const Asset = await upgrades.deployProxy( AssetFactory, [ - trustedForwarder.address, + TrustedForwarder.address, assetAdmin.address, 'ipfs://', filterOperatorSubscription.address, @@ -1045,7 +1046,7 @@ describe('Base Asset Contract (/packages/asset/contracts/Asset.sol)', function ( it('should revert when registry is set zero and subscription is set zero', async function () { const { assetAdmin, - trustedForwarder, + TrustedForwarder, filterOperatorSubscription, RoyaltyManagerContract, } = await setupOperatorFilter(); @@ -1053,7 +1054,7 @@ describe('Base Asset Contract (/packages/asset/contracts/Asset.sol)', function ( const Asset = await upgrades.deployProxy( AssetFactory, [ - trustedForwarder.address, + TrustedForwarder.address, assetAdmin.address, 'ipfs://', filterOperatorSubscription.address, @@ -1076,7 +1077,7 @@ describe('Base Asset Contract (/packages/asset/contracts/Asset.sol)', function ( it('should revert when registry is set and subscription is set by non-admin', async function () { const { assetAdmin, - trustedForwarder, + TrustedForwarder, filterOperatorSubscription, RoyaltyManagerContract, operatorFilterRegistry, @@ -1087,7 +1088,49 @@ describe('Base Asset Contract (/packages/asset/contracts/Asset.sol)', function ( const Asset = await upgrades.deployProxy( AssetFactory, [ - trustedForwarder.address, + TrustedForwarder.address, + assetAdmin.address, + 'ipfs://', + filterOperatorSubscription.address, + RoyaltyManagerContract.address, + ], + { + initializer: 'initialize', + } + ); + + await expect( + Asset.connect(user1).setOperatorRegistry( + operatorFilterRegistry.address + ) + ).to.be.revertedWith( + `AccessControl: account ${user1.address.toLocaleLowerCase()} is missing role ${defaultAdminRole}` + ); + + await expect( + Asset.connect(user1).registerAndSubscribe( + filterOperatorSubscription.address, + true + ) + ).to.be.revertedWith( + `AccessControl: account ${user1.address.toLocaleLowerCase()} is missing role ${defaultAdminRole}` + ); + }); + it('should not revert when registry is set and subscription is set by admin through trusted forwarder', async function () { + const { + assetAdmin, + TrustedForwarder, + filterOperatorSubscription, + RoyaltyManagerContract, + operatorFilterRegistry, + defaultAdminRole, + user1, + } = await setupOperatorFilter(); + const AssetFactory = await ethers.getContractFactory('Asset'); + const Asset = await upgrades.deployProxy( + AssetFactory, + [ + TrustedForwarder.address, assetAdmin.address, 'ipfs://', filterOperatorSubscription.address, @@ -1651,6 +1694,30 @@ describe('Base Asset Contract (/packages/asset/contracts/Asset.sol)', function ( ).to.be.revertedWith; }); + it('it should not be able to setApprovalForAll trusted forwarder if black listed', async function () { + const { + operatorFilterRegistryAsSubscription, + filterOperatorSubscription, + users, + TrustedForwarder, + } = await setupOperatorFilter(); + + const TrustedForwarderCodeHash = + await operatorFilterRegistryAsSubscription.codeHashOf( + TrustedForwarder.address + ); + + await operatorFilterRegistryAsSubscription.updateCodeHash( + filterOperatorSubscription.address, + TrustedForwarderCodeHash, + true + ); + + await expect( + users[1].Asset.setApprovalForAll(TrustedForwarder.address, true) + ).to.be.revertedWithCustomError; + }); + it('it should be able to setApprovalForAll blacklisted market places after they are removed from the blacklist ', async function () { const { mockMarketPlace1, @@ -1755,6 +1822,54 @@ describe('Base Asset Contract (/packages/asset/contracts/Asset.sol)', function ( ).to.be.revertedWithCustomError; }); + it('it should be able to transfer through trusted forwarder after it is blacklisted', async function () { + const { + Asset, + users, + operatorFilterRegistryAsSubscription, + filterOperatorSubscription, + TrustedForwarder, + } = await setupOperatorFilter(); + await Asset.mintWithoutMinterRole(users[0].address, 1, 2); + + await operatorFilterRegistryAsSubscription.updateOperator( + filterOperatorSubscription.address, + TrustedForwarder.address, + true + ); + + const data = await Asset.connect( + users[0].Asset.signer + ).populateTransaction[ + 'safeTransferFrom(address,address,uint256,uint256,bytes)' + ](users[0].address, users[1].address, 1, 1, '0x'); + + await TrustedForwarder.execute({...data, value: BigNumber.from(0)}); + + expect(await Asset.balanceOf(users[1].address, 1)).to.be.equal(1); + }); + + it('it should not be able to transfer through trusted forwarder after if sender is blacklisted', async function () { + const {Asset, users, TrustedForwarder, mockMarketPlace1} = + await setupOperatorFilter(); + await Asset.mintWithoutMinterRole(users[0].address, 1, 2); + + await users[0].Asset.setApprovalForAllWithoutFilter( + mockMarketPlace1.address, + true + ); + + const data = await Asset.connect( + ethers.provider.getSigner(mockMarketPlace1.address) + ).populateTransaction[ + 'safeTransferFrom(address,address,uint256,uint256,bytes)' + ](users[0].address, users[1].address, 1, 1, '0x'); + + await expect( + TrustedForwarder.execute({...data, value: BigNumber.from(0)}) + ).to.be.revertedWith('Call execution failed'); + }); + it('it should be able to transfer through non blacklisted market places', async function () { const {mockMarketPlace3, Asset, users} = await setupOperatorFilter(); await Asset.mintWithoutMinterRole(users[0].address, 1, 1); @@ -2068,6 +2183,64 @@ describe('Base Asset Contract (/packages/asset/contracts/Asset.sol)', function ( expect(await Asset.balanceOf(users[1].address, 1)).to.be.equal(1); expect(await Asset.balanceOf(users[1].address, 2)).to.be.equal(1); }); + it('should be able to batch transfer through trusted forwarder if it is black listed', async function () { + const { + Asset, + users, + operatorFilterRegistryAsSubscription, + filterOperatorSubscription, + TrustedForwarder, + } = await setupOperatorFilter(); + const TrustedForwarderCodeHash = + await operatorFilterRegistryAsSubscription.codeHashOf( + TrustedForwarder.address + ); + await Asset.mintWithoutMinterRole(users[0].address, 1, 1); + await Asset.mintWithoutMinterRole(users[0].address, 2, 1); + + await operatorFilterRegistryAsSubscription.updateCodeHash( + filterOperatorSubscription.address, + TrustedForwarderCodeHash, + true + ); + + await operatorFilterRegistryAsSubscription.updateOperator( + filterOperatorSubscription.address, + TrustedForwarder.address, + true + ); + const data = await Asset.connect( + users[0].Asset.signer + ).populateTransaction[ + 'safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)' + ](users[0].address, users[1].address, [1, 2], [1, 1], '0x'); + + await TrustedForwarder.execute({...data, value: BigNumber.from(0)}); + expect(await Asset.balanceOf(users[1].address, 1)).to.be.equal(1); + expect(await Asset.balanceOf(users[1].address, 2)).to.be.equal(1); + }); + it('should not be able to batch transfer through trusted forwarder if the sender is black listed', async function () { + const {Asset, users, TrustedForwarder, mockMarketPlace1} = + await setupOperatorFilter(); + + await Asset.mintWithoutMinterRole(users[0].address, 1, 1); + await Asset.mintWithoutMinterRole(users[0].address, 2, 1); + + await users[0].Asset.setApprovalForAllWithoutFilter( + mockMarketPlace1.address, + true + ); + + const data = await Asset.connect( + ethers.provider.getSigner(mockMarketPlace1.address) + ).populateTransaction[ + 'safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)' + ](users[0].address, users[1].address, [1, 2], [1, 1], '0x'); + + await expect( + TrustedForwarder.execute({...data, value: BigNumber.from(0)}) + ).to.be.revertedWith('Call execution failed'); + }); }); }); }); diff --git a/packages/asset/test/AssetRoyalty.test.ts b/packages/asset/test/AssetRoyalty.test.ts index f4aa392d92..4027ddff38 100644 --- a/packages/asset/test/AssetRoyalty.test.ts +++ b/packages/asset/test/AssetRoyalty.test.ts @@ -139,6 +139,84 @@ describe('Asset Royalties', function () { ); }); + it('should revert split ERC20 using EIP2981 using non trusted forwarder', async function () { + const { + Asset, + ERC20, + mockMarketplace, + ERC20AsBuyer, + seller, + buyer, + commonRoyaltyReceiver, + creator, + AssetAsSeller, + RoyaltyManagerContract, + assetAsMinter, + NonTrustedForwarder, + } = await assetRoyaltyDistribution(); + + const id = generateAssetId(creator.address, 1); + await assetAsMinter.mint(seller.address, id, 1, '0x'); + await ERC20.mint(buyer.address, 1000000); + await ERC20AsBuyer.approve(mockMarketplace.address, 1000000); + await AssetAsSeller.setApprovalForAll(mockMarketplace.address, true); + expect(await Asset.balanceOf(seller.address, id)).to.be.equals(1); + await mockMarketplace.distributeRoyaltyEIP2981( + 1000000, + ERC20.address, + Asset.address, + id, + buyer.address, + seller.address, + true + ); + const splitter = await RoyaltyManagerContract._creatorRoyaltiesSplitter( + creator.address + ); + + const assetRoyaltyBPS = await RoyaltyManagerContract.getContractRoyalty( + Asset.address + ); + + const splitterContract = await ethers.getContractAt( + splitterAbi, + splitter + ); + + const balance = await ERC20.balanceOf(splitter); + + expect(balance).to.be.equal(1000000 * (assetRoyaltyBPS / 10000)); + + const data = await splitterContract + .connect(creator.address) + .populateTransaction['splitERC20Tokens(address)'](ERC20.address); + + await expect( + NonTrustedForwarder.execute({...data, value: BigNumber.from(0)}) + ).to.be.revertedWith('Call execution failed'); + + const balanceCreator = await ERC20.balanceOf(creator.address); + const balanceCommonRoyaltyReceiver = await ERC20.balanceOf( + commonRoyaltyReceiver.address + ); + + const newbalance = await ERC20.balanceOf(splitter); + + expect(newbalance).to.be.equal(1000000 * (assetRoyaltyBPS / 10000)); + + expect(balanceCreator).to.be.equal(0); + expect(balanceCommonRoyaltyReceiver).to.be.equal(0); + }); + + it('should get trusted forwarder from Royalty Manager', async function () { + const {RoyaltyManagerContract, TrustedForwarder} = + await assetRoyaltyDistribution(); + + expect(await RoyaltyManagerContract.getTrustedForwarder()).to.be.equal( + TrustedForwarder.address + ); + }); + it('should split ERC20 using RoyaltyEngine', async function () { const { Asset, diff --git a/packages/asset/test/Catalyst.test.ts b/packages/asset/test/Catalyst.test.ts index 67ac6ffdb7..81c14b67aa 100644 --- a/packages/asset/test/Catalyst.test.ts +++ b/packages/asset/test/Catalyst.test.ts @@ -10,6 +10,8 @@ import { ERC165InterfaceId, ERC2981InterfaceId, } from './utils/interfaceIds'; +import {BigNumber} from 'ethers'; + const catalystArray = [0, 1, 2, 3, 4, 5, 6]; const zeroAddress = '0x0000000000000000000000000000000000000000'; @@ -681,7 +683,7 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { it('should set registry and subscribe to common subscription', async function () { const { operatorFilterRegistry, - trustedForwarder, + TrustedForwarder, operatorFilterSubscription, catalystAdmin, catalystMinter, @@ -692,7 +694,7 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { CatalystFactory, [ CATALYST_BASE_URI, - trustedForwarder.address, + TrustedForwarder.address, operatorFilterSubscription.address, catalystAdmin.address, // DEFAULT_ADMIN_ROLE catalystMinter.address, // MINTER_ROLE @@ -726,7 +728,7 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { it('should revert when registry is set zero and subscription is set zero', async function () { const { - trustedForwarder, + TrustedForwarder, operatorFilterSubscription, catalystAdmin, catalystMinter, @@ -737,7 +739,7 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { CatalystFactory, [ CATALYST_BASE_URI, - trustedForwarder.address, + TrustedForwarder.address, operatorFilterSubscription.address, catalystAdmin.address, // DEFAULT_ADMIN_ROLE catalystMinter.address, // MINTER_ROLE @@ -762,7 +764,7 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { it('should revert when registry is set and subscription is set by non-admin', async function () { const { - trustedForwarder, + TrustedForwarder, operatorFilterSubscription, catalystAdmin, catalystMinter, @@ -776,7 +778,7 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { CatalystFactory, [ CATALYST_BASE_URI, - trustedForwarder.address, + TrustedForwarder.address, operatorFilterSubscription.address, catalystAdmin.address, // DEFAULT_ADMIN_ROLE catalystMinter.address, // MINTER_ROLE @@ -1036,7 +1038,7 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { const { operatorFilterRegistry, mockMarketPlace1, - operatorFilterRegistryAsDeployer, + operatorFilterRegistryAsOwner, operatorFilterSubscription, Catalyst, } = await setupOperatorFilter(); @@ -1069,13 +1071,13 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { ) ).to.be.equal(true); - await operatorFilterRegistryAsDeployer.updateOperator( + await operatorFilterRegistryAsOwner.updateOperator( operatorFilterSubscription.address, mockMarketPlace1.address, false ); - await operatorFilterRegistryAsDeployer.updateCodeHash( + await operatorFilterRegistryAsOwner.updateCodeHash( operatorFilterSubscription.address, MockERC1155MarketPlace1CodeHash, false @@ -1114,7 +1116,7 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { const { operatorFilterRegistry, mockMarketPlace3, - operatorFilterRegistryAsDeployer, + operatorFilterRegistryAsOwner, operatorFilterSubscription, Catalyst, } = await setupOperatorFilter(); @@ -1147,13 +1149,13 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { ) ).to.be.equal(false); - await operatorFilterRegistryAsDeployer.updateOperator( + await operatorFilterRegistryAsOwner.updateOperator( operatorFilterSubscription.address, mockMarketPlace3.address, true ); - await operatorFilterRegistryAsDeployer.updateCodeHash( + await operatorFilterRegistryAsOwner.updateCodeHash( operatorFilterSubscription.address, MockERC1155MarketPlace3CodeHash, true @@ -1281,10 +1283,34 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { ).to.be.equal(true); }); + it('it should not be able to setApprovalForAll trusted forwarder if black listed', async function () { + const { + operatorFilterRegistryAsOwner, + operatorFilterSubscription, + users, + TrustedForwarder, + } = await setupOperatorFilter(); + + const TrustedForwarderCodeHash = + await operatorFilterRegistryAsOwner.codeHashOf( + TrustedForwarder.address + ); + + await operatorFilterRegistryAsOwner.updateCodeHash( + operatorFilterSubscription.address, + TrustedForwarderCodeHash, + true + ); + + await expect( + users[1].Catalyst.setApprovalForAll(TrustedForwarder.address, true) + ).to.be.revertedWithCustomError; + }); + it('it should not be able to setApprovalForAll non blacklisted market places after they are blacklisted ', async function () { const { mockMarketPlace3, - operatorFilterRegistryAsDeployer, + operatorFilterRegistryAsOwner, operatorFilterSubscription, Catalyst, users, @@ -1301,7 +1327,7 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { ) ).to.be.equal(true); - await operatorFilterRegistryAsDeployer.updateOperator( + await operatorFilterRegistryAsOwner.updateOperator( operatorFilterSubscription.address, mockMarketPlace3.address, true @@ -1315,14 +1341,14 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { it('it should not be able to setApprovalForAll non blacklisted market places after there codeHashes are blacklisted ', async function () { const { mockMarketPlace3, - operatorFilterRegistryAsDeployer, + operatorFilterRegistryAsOwner, operatorFilterSubscription, Catalyst, users, } = await setupOperatorFilter(); const mockMarketPlace3CodeHash = - await operatorFilterRegistryAsDeployer.codeHashOf( + await operatorFilterRegistryAsOwner.codeHashOf( mockMarketPlace3.address ); @@ -1338,7 +1364,7 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { ) ).to.be.equal(true); - await operatorFilterRegistryAsDeployer.updateCodeHash( + await operatorFilterRegistryAsOwner.updateCodeHash( operatorFilterSubscription.address, mockMarketPlace3CodeHash, true @@ -1352,14 +1378,14 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { it('it should be able to setApprovalForAll blacklisted market places after they are removed from the blacklist ', async function () { const { mockMarketPlace1, - operatorFilterRegistryAsDeployer, + operatorFilterRegistryAsOwner, operatorFilterSubscription, Catalyst, users, } = await setupOperatorFilter(); const mockMarketPlace1CodeHash = - await operatorFilterRegistryAsDeployer.codeHashOf( + await operatorFilterRegistryAsOwner.codeHashOf( mockMarketPlace1.address ); @@ -1367,13 +1393,13 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { users[0].Catalyst.setApprovalForAll(mockMarketPlace1.address, true) ).to.be.revertedWithCustomError; - await operatorFilterRegistryAsDeployer.updateCodeHash( + await operatorFilterRegistryAsOwner.updateCodeHash( operatorFilterSubscription.address, mockMarketPlace1CodeHash, false ); - await operatorFilterRegistryAsDeployer.updateOperator( + await operatorFilterRegistryAsOwner.updateOperator( operatorFilterSubscription.address, mockMarketPlace1.address, false @@ -1417,7 +1443,7 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { mockMarketPlace3, Catalyst, users, - operatorFilterRegistryAsDeployer, + operatorFilterRegistryAsOwner, operatorFilterSubscription, } = await setupOperatorFilter(); await Catalyst.mintWithoutMinterRole(users[0].address, 1, 2); @@ -1438,7 +1464,7 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { expect(await Catalyst.balanceOf(users[1].address, 1)).to.be.equal(1); - await operatorFilterRegistryAsDeployer.updateOperator( + await operatorFilterRegistryAsOwner.updateOperator( operatorFilterSubscription.address, mockMarketPlace3.address, true @@ -1456,6 +1482,54 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { ).to.be.revertedWithCustomError; }); + it('it should be able to transfer through trusted forwarder after it is blacklisted', async function () { + const { + Catalyst, + users, + operatorFilterRegistryAsOwner, + operatorFilterSubscription, + TrustedForwarder, + } = await setupOperatorFilter(); + await Catalyst.mintWithoutMinterRole(users[0].address, 1, 2); + + await operatorFilterRegistryAsOwner.updateOperator( + operatorFilterSubscription.address, + TrustedForwarder.address, + true + ); + + const data = await Catalyst.connect( + users[0].Catalyst.signer + ).populateTransaction[ + 'safeTransferFrom(address,address,uint256,uint256,bytes)' + ](users[0].address, users[1].address, 1, 1, '0x'); + + await TrustedForwarder.execute({...data, value: BigNumber.from(0)}); + + expect(await Catalyst.balanceOf(users[1].address, 1)).to.be.equal(1); + }); + + it('it should not be able to transfer through trusted forwarder after if sender is blacklisted', async function () { + const {Catalyst, users, TrustedForwarder, mockMarketPlace1} = + await setupOperatorFilter(); + await Catalyst.mintWithoutMinterRole(users[0].address, 1, 2); + + await users[0].Catalyst.setApprovalForAllWithoutFilter( + mockMarketPlace1.address, + true + ); + + const data = await Catalyst.connect( + ethers.provider.getSigner(mockMarketPlace1.address) + ).populateTransaction[ + 'safeTransferFrom(address,address,uint256,uint256,bytes)' + ](users[0].address, users[1].address, 1, 1, '0x'); + + await expect( + TrustedForwarder.execute({...data, value: BigNumber.from(0)}) + ).to.be.revertedWith('Call execution failed'); + }); + it('it should be able to transfer through non blacklisted market places', async function () { const {mockMarketPlace3, Catalyst, users} = await setupOperatorFilter(); await Catalyst.mintWithoutMinterRole(users[0].address, 1, 1); @@ -1481,7 +1555,7 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { mockMarketPlace3, Catalyst, users, - operatorFilterRegistryAsDeployer, + operatorFilterRegistryAsOwner, operatorFilterSubscription, } = await setupOperatorFilter(); await Catalyst.mintWithoutMinterRole(users[0].address, 1, 2); @@ -1502,10 +1576,10 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { expect(await Catalyst.balanceOf(users[1].address, 1)).to.be.equal(1); const mockMarketPlace3CodeHash = - await operatorFilterRegistryAsDeployer.codeHashOf( + await operatorFilterRegistryAsOwner.codeHashOf( mockMarketPlace3.address ); - await operatorFilterRegistryAsDeployer.updateCodeHash( + await operatorFilterRegistryAsOwner.updateCodeHash( operatorFilterSubscription.address, mockMarketPlace3CodeHash, true @@ -1528,11 +1602,11 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { mockMarketPlace1, Catalyst, users, - operatorFilterRegistryAsDeployer, + operatorFilterRegistryAsOwner, operatorFilterSubscription, } = await setupOperatorFilter(); const mockMarketPlace1CodeHash = - await operatorFilterRegistryAsDeployer.codeHashOf( + await operatorFilterRegistryAsOwner.codeHashOf( mockMarketPlace1.address ); await Catalyst.mintWithoutMinterRole(users[0].address, 1, 1); @@ -1553,13 +1627,13 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { ) ).to.be.revertedWithCustomError; - await operatorFilterRegistryAsDeployer.updateCodeHash( + await operatorFilterRegistryAsOwner.updateCodeHash( operatorFilterSubscription.address, mockMarketPlace1CodeHash, false ); - await operatorFilterRegistryAsDeployer.updateOperator( + await operatorFilterRegistryAsOwner.updateOperator( operatorFilterSubscription.address, mockMarketPlace1.address, false @@ -1602,7 +1676,7 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { mockMarketPlace3, Catalyst, users, - operatorFilterRegistryAsDeployer, + operatorFilterRegistryAsOwner, operatorFilterSubscription, } = await setupOperatorFilter(); await Catalyst.mintWithoutMinterRole(users[0].address, 1, 2); @@ -1626,7 +1700,7 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { expect(await Catalyst.balanceOf(users[1].address, 2)).to.be.equal(1); - await operatorFilterRegistryAsDeployer.updateOperator( + await operatorFilterRegistryAsOwner.updateOperator( operatorFilterSubscription.address, mockMarketPlace3.address, true @@ -1671,7 +1745,7 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { mockMarketPlace3, Catalyst, users, - operatorFilterRegistryAsDeployer, + operatorFilterRegistryAsOwner, operatorFilterSubscription, } = await setupOperatorFilter(); await Catalyst.mintWithoutMinterRole(users[0].address, 1, 2); @@ -1694,10 +1768,10 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { expect(await Catalyst.balanceOf(users[1].address, 2)).to.be.equal(1); const mockMarketPlace3CodeHash = - await operatorFilterRegistryAsDeployer.codeHashOf( + await operatorFilterRegistryAsOwner.codeHashOf( mockMarketPlace3.address ); - await operatorFilterRegistryAsDeployer.updateCodeHash( + await operatorFilterRegistryAsOwner.updateCodeHash( operatorFilterSubscription.address, mockMarketPlace3CodeHash, true @@ -1720,11 +1794,11 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { mockMarketPlace1, Catalyst, users, - operatorFilterRegistryAsDeployer, + operatorFilterRegistryAsOwner, operatorFilterSubscription, } = await setupOperatorFilter(); const mockMarketPlace1CodeHash = - await operatorFilterRegistryAsDeployer.codeHashOf( + await operatorFilterRegistryAsOwner.codeHashOf( mockMarketPlace1.address ); await Catalyst.mintWithoutMinterRole(users[0].address, 1, 1); @@ -1746,13 +1820,13 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { ) ).to.be.revertedWithCustomError; - await operatorFilterRegistryAsDeployer.updateCodeHash( + await operatorFilterRegistryAsOwner.updateCodeHash( operatorFilterSubscription.address, mockMarketPlace1CodeHash, false ); - await operatorFilterRegistryAsDeployer.updateOperator( + await operatorFilterRegistryAsOwner.updateOperator( operatorFilterSubscription.address, mockMarketPlace1.address, false @@ -1769,6 +1843,66 @@ describe('Catalyst (/packages/asset/contracts/Catalyst.sol)', function () { expect(await Catalyst.balanceOf(users[1].address, 1)).to.be.equal(1); expect(await Catalyst.balanceOf(users[1].address, 2)).to.be.equal(1); }); + + it('should be able to batch transfer through trusted forwarder if it is black listed', async function () { + const { + Catalyst, + users, + operatorFilterRegistryAsOwner, + operatorFilterSubscription, + TrustedForwarder, + } = await setupOperatorFilter(); + const TrustedForwarderCodeHash = + await operatorFilterRegistryAsOwner.codeHashOf( + TrustedForwarder.address + ); + await Catalyst.mintWithoutMinterRole(users[0].address, 1, 1); + await Catalyst.mintWithoutMinterRole(users[0].address, 2, 1); + + await operatorFilterRegistryAsOwner.updateCodeHash( + operatorFilterSubscription.address, + TrustedForwarderCodeHash, + true + ); + + await operatorFilterRegistryAsOwner.updateOperator( + operatorFilterSubscription.address, + TrustedForwarder.address, + true + ); + + const data = await Catalyst.connect( + users[0].Catalyst.signer + ).populateTransaction[ + 'safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)' + ](users[0].address, users[1].address, [1, 2], [1, 1], '0x'); + + await TrustedForwarder.execute({...data, value: BigNumber.from(0)}); + expect(await Catalyst.balanceOf(users[1].address, 1)).to.be.equal(1); + expect(await Catalyst.balanceOf(users[1].address, 2)).to.be.equal(1); + }); + it('should not be able to batch transfer through trusted forwarder if the sender is black listed', async function () { + const {Catalyst, users, TrustedForwarder, mockMarketPlace1} = + await setupOperatorFilter(); + + await Catalyst.mintWithoutMinterRole(users[0].address, 1, 1); + await Catalyst.mintWithoutMinterRole(users[0].address, 2, 1); + + await users[0].Catalyst.setApprovalForAllWithoutFilter( + mockMarketPlace1.address, + true + ); + + const data = await Catalyst.connect( + ethers.provider.getSigner(mockMarketPlace1.address) + ).populateTransaction[ + 'safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)' + ](users[0].address, users[1].address, [1, 2], [1, 1], '0x'); + + await expect( + TrustedForwarder.execute({...data, value: BigNumber.from(0)}) + ).to.be.revertedWith('Call execution failed'); + }); }); }); }); diff --git a/packages/asset/test/fixtures/asset/assetRoyaltyFixture.ts b/packages/asset/test/fixtures/asset/assetRoyaltyFixture.ts index 0fe474f959..0430492181 100644 --- a/packages/asset/test/fixtures/asset/assetRoyaltyFixture.ts +++ b/packages/asset/test/fixtures/asset/assetRoyaltyFixture.ts @@ -40,6 +40,8 @@ export async function assetRoyaltyDistribution() { ); const TrustedForwarder = await TrustedForwarderFactory.deploy(); + const NonTrustedForwarder = await TrustedForwarderFactory.deploy(); + const MockOperatorFilterRegistryFactory = await ethers.getContractFactory( 'MockOperatorFilterRegistry' ); @@ -181,5 +183,6 @@ export async function assetRoyaltyDistribution() { RoyaltyManagerAsRoyaltySetter, assetAsMinter, TrustedForwarder, + NonTrustedForwarder, }; } diff --git a/packages/asset/test/fixtures/operatorFilterFixture.ts b/packages/asset/test/fixtures/operatorFilterFixture.ts index 47f4904bf9..3811bb4eed 100644 --- a/packages/asset/test/fixtures/operatorFilterFixture.ts +++ b/packages/asset/test/fixtures/operatorFilterFixture.ts @@ -13,7 +13,6 @@ export async function setupOperatorFilter() { deployer, upgradeAdmin, filterOperatorSubscription, - trustedForwarder, catalystAdmin, catalystMinter, assetAdmin, @@ -26,6 +25,11 @@ export async function setupOperatorFilter() { contractRoyaltySetter, ] = await ethers.getSigners(); + const TrustedForwarderFactory = await ethers.getContractFactory( + 'MockTrustedForwarder' + ); + const TrustedForwarder = await TrustedForwarderFactory.deploy(); + const MockERC1155MarketPlace1Factory = await ethers.getContractFactory( 'MockERC1155MarketPlace1' ); @@ -86,7 +90,7 @@ export async function setupOperatorFilter() { RoyaltySplitter.address, managerAdmin.address, contractRoyaltySetter.address, - trustedForwarder.address, + TrustedForwarder.address, ], { initializer: 'initialize', @@ -98,7 +102,7 @@ export async function setupOperatorFilter() { const Asset = await upgrades.deployProxy( AssetFactory, [ - trustedForwarder.address, + TrustedForwarder.address, assetAdmin.address, 'ipfs://', filterOperatorSubscription.address, @@ -124,7 +128,7 @@ export async function setupOperatorFilter() { operatorFilterRegistry.address ); - const operatorFilterRegistryAsDeployer = await operatorFilterRegistry.connect( + const operatorFilterRegistryAsOwner = await operatorFilterRegistry.connect( deployer ); @@ -133,7 +137,7 @@ export async function setupOperatorFilter() { CatalystFactory, [ CATALYST_BASE_URI, - trustedForwarder.address, + TrustedForwarder.address, operatorFilterSubscription.address, catalystAdmin.address, // DEFAULT_ADMIN_ROLE catalystMinter.address, // MINTER_ROLE @@ -178,10 +182,10 @@ export async function setupOperatorFilter() { upgradeAdmin, Asset, DEFAULT_SUBSCRIPTION, - operatorFilterRegistryAsDeployer, + operatorFilterRegistryAsOwner, operatorFilterSubscription, Catalyst, - trustedForwarder, + TrustedForwarder, assetAdmin, commonRoyaltyReceiver, DEFAULT_BPS, diff --git a/packages/core/deployments/mainnet/Land.json b/packages/core/deployments/mainnet/Land.json index 187c9c4749..e674ef4ffe 100644 --- a/packages/core/deployments/mainnet/Land.json +++ b/packages/core/deployments/mainnet/Land.json @@ -182,7 +182,7 @@ "type": "function" }, { - "constant": false, + "constant": true, "inputs": [], "name": "height", "outputs": [ @@ -192,7 +192,7 @@ } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "pure", "type": "function" }, { @@ -325,25 +325,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "name": "id", - "type": "uint256" - } - ], - "name": "x", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -402,19 +383,57 @@ "constant": false, "inputs": [ { - "name": "id", + "name": "to", + "type": "address" + }, + { + "name": "size", + "type": "uint256" + }, + { + "name": "x", + "type": "uint256" + }, + { + "name": "y", "type": "uint256" + }, + { + "name": "data", + "type": "bytes" } ], - "name": "y", + "name": "mintAndTransferQuad", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "size", + "type": "uint256" + }, + { + "name": "x", + "type": "uint256" + }, + { + "name": "y", + "type": "uint256" + } + ], + "name": "exists", "outputs": [ { "name": "", - "type": "uint256" + "type": "bool" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { @@ -536,6 +555,25 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [ + { + "name": "id", + "type": "uint256" + } + ], + "name": "getY", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, { "constant": true, "inputs": [ @@ -573,6 +611,25 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [ + { + "name": "id", + "type": "uint256" + } + ], + "name": "getX", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, { "constant": true, "inputs": [], @@ -606,6 +663,20 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "name": "registry", + "type": "address" + } + ], + "name": "setOperatorRegistry", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [ @@ -630,7 +701,7 @@ "type": "function" }, { - "constant": false, + "constant": true, "inputs": [], "name": "width", "outputs": [ @@ -640,7 +711,7 @@ } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "pure", "type": "function" }, { @@ -680,6 +751,24 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "name": "subscriptionOrRegistrantToCopy", + "type": "address" + }, + { + "name": "subscribe", + "type": "bool" + } + ], + "name": "register", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -698,6 +787,20 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "operatorFilterRegistry", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -814,7 +917,7 @@ "name": "isApprovedForAll", "outputs": [ { - "name": "isOperator", + "name": "", "type": "bool" } ], @@ -881,8 +984,37 @@ { "anonymous": false, "inputs": [ + { + "indexed": true, + "name": "registry", + "type": "address" + } + ], + "name": "OperatorRegistrySet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "subscriptionOrRegistrant", + "type": "address" + }, { "indexed": false, + "name": "subscribe", + "type": "bool" + } + ], + "name": "ContractRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, "name": "superOperator", "type": "address" }, @@ -899,7 +1031,7 @@ "anonymous": false, "inputs": [ { - "indexed": false, + "indexed": true, "name": "metaTransactionProcessor", "type": "address" }, @@ -916,7 +1048,7 @@ "anonymous": false, "inputs": [ { - "indexed": false, + "indexed": true, "name": "superOperator", "type": "address" }, @@ -1051,12 +1183,12 @@ "0x46Ac83D74091Dd54B503D89fa92b5C788Bcd3886", "0x485cc9550000000000000000000000003845badade8e6dff049820680d1f14bd3903a5d0000000000000000000000000e19ae8f9b36ca43d12741288d0e311396140df6f" ], - "numDeployments": 2, + "numDeployments": 3, "solcInputHash": "1635d55d57a0a2552952c0d22586ed23", "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialLogic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAdmin\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\",\"events\":{\"AdminChanged(address,address)\":{\"details\":\"Emitted when the admin account has changed.\"}},\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"stateVariables\":{\"_ADMIN_SLOT\":{\"details\":\"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.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.7/openzeppelin/proxy/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.7/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n * \\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n * \\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal virtual view returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n * \\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {\\n }\\n}\\n\",\"keccak256\":\"0xc33f9858a67e34c77831163d5611d21fc627dfd2c303806a98a6c9db5a01b034\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./UpgradeableProxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n * \\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n * \\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n * \\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n * \\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is UpgradeableProxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\\n */\\n constructor(address initialLogic, address initialAdmin, bytes memory _data) payable UpgradeableProxy(initialLogic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _setAdmin(initialAdmin);\\n }\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _admin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n * \\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address) {\\n return _admin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n * \\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address) {\\n return _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n * \\n * Emits an {AdminChanged} event.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external ifAdmin {\\n require(newAdmin != address(0), \\\"TransparentUpgradeableProxy: new admin is the zero address\\\");\\n emit AdminChanged(_admin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeTo(newImplementation);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeTo(newImplementation);\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = newImplementation.delegatecall(data);\\n require(success);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view returns (address adm) {\\n bytes32 slot = _ADMIN_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n adm := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n bytes32 slot = _ADMIN_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newAdmin)\\n }\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal override virtual {\\n require(msg.sender != _admin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xd6cecbe00dc78355aff1a16d83487bb73c54701004d61a2e48cdb81e2bcacc26\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/UpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Proxy.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n * \\n * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see\\n * {TransparentUpgradeableProxy}.\\n */\\ncontract UpgradeableProxy is Proxy {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n * \\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _setImplementation(_logic);\\n if(_data.length > 0) {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = _logic.delegatecall(_data);\\n require(success);\\n }\\n }\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal override view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Upgrades the proxy to a new implementation.\\n * \\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"UpgradeableProxy: new implementation is not a contract\\\");\\n\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newImplementation)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd68f4c11941712db79a61b9dca81a5db663cfacec3d7bb19f8d2c23bb1ab8afe\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\\n // for accounts without code, i.e. `keccak256('')`\\n bytes32 codehash;\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { codehash := extcodehash(account) }\\n return (codehash != accountHash && codehash != 0x0);\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return _functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n return _functionCallWithValue(target, data, value, errorMessage);\\n }\\n\\n function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x698f929f1097637d051976b322a2d532c27df022b09010e8d091e2888a5ebdf8\",\"license\":\"MIT\"}},\"version\":1}", "bytecode": "0x6080604052604051610aaa380380610aaa8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101bf565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b6101b782610231565b505050610291565b6101d28161025560201b6104bb1760201c565b61020d5760405162461bcd60e51b8152600401808060200182810382526036815260200180610a746036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061028957508115155b949350505050565b6107d4806102a06000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104f7565b6101ed6101e861058b565b6105b0565b565b6101f76105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105f9565b610240565b6102406101d5565b50565b61024b6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105f9565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b60006103216105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61058b565b905061036b565b61036b6101d5565b90565b6103766105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806106ed603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e6105d4565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610646565b60006104806105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c6105d4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104ef57508115155b949350505050565b6104ff6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061075d6042913960600191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105cf573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106028161066a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610673816104bb565b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806107276036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a2646970667358221220b141ef72de179b8b56cef31601d40ff2875391088197e73cac39eba1ddcd0fdd64736f6c634300070600335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374", "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104f7565b6101ed6101e861058b565b6105b0565b565b6101f76105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105f9565b610240565b6102406101d5565b50565b61024b6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105f9565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b60006103216105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61058b565b905061036b565b61036b6101d5565b90565b6103766105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806106ed603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e6105d4565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610646565b60006104806105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c6105d4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104ef57508115155b949350505050565b6104ff6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061075d6042913960600191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105cf573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106028161066a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610673816104bb565b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806107276036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a2646970667358221220b141ef72de179b8b56cef31601d40ff2875391088197e73cac39eba1ddcd0fdd64736f6c63430007060033", - "implementation": "0xf859e17efbcdf60ee9b951198aecd03b1cdd231c", + "implementation": "0x976f91d5E0a1eBA30eC778965Ef4701904Fe28cA", "devdoc": { "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.", "events": { diff --git a/packages/core/deployments/mainnet/LandTunnelMigration.json b/packages/core/deployments/mainnet/LandTunnelMigration.json new file mode 100644 index 0000000000..8932c8aa47 --- /dev/null +++ b/packages/core/deployments/mainnet/LandTunnelMigration.json @@ -0,0 +1,308 @@ +{ + "address": "0x75F6f370020ECAc802a860eaA9f600cbAb94D08a", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_landToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_newLandTunnel", + "type": "address" + }, + { + "internalType": "address", + "name": "_oldLandTunnel", + "type": "address" + }, + { + "internalType": "address", + "name": "_admin", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldLandTunnel", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newLandTunnel", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + } + ], + "name": "TunnelLandsMigrated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldLandTunnel", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newLandTunnel", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "sizes", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "x", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "y", + "type": "uint256[]" + } + ], + "name": "TunnelQuadsMigrated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "landToken", + "outputs": [ + { + "internalType": "contract ILandToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + } + ], + "name": "migrateLandsToTunnel", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "sizes", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "x", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "y", + "type": "uint256[]" + } + ], + "name": "migrateQuadsToTunnel", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "newLandTunnel", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oldLandTunnel", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x652aa4cec4f26348916db12e07115681c002335f79b0e8ea18e5398666b203d1", + "receipt": { + "to": null, + "from": "0xe19ae8F9B36Ca43D12741288D0e311396140DF6F", + "contractAddress": "0x75F6f370020ECAc802a860eaA9f600cbAb94D08a", + "transactionIndex": 8, + "gasUsed": "603522", + "logsBloom": "0x00000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000004000002000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000040000000000000000", + "blockHash": "0x7dd77b001ff9c1b87b02d0a5e6f681b639adf69be078567c8eecd412905a406f", + "transactionHash": "0x652aa4cec4f26348916db12e07115681c002335f79b0e8ea18e5398666b203d1", + "logs": [ + { + "transactionIndex": 8, + "blockNumber": 17835500, + "transactionHash": "0x652aa4cec4f26348916db12e07115681c002335f79b0e8ea18e5398666b203d1", + "address": "0x75F6f370020ECAc802a860eaA9f600cbAb94D08a", + "topics": [ + "0x7ce7ec0b50378fb6c0186ffb5f48325f6593fcb4ca4386f21861af3129188f5c", + "0x0000000000000000000000000073e6eb087019bdb7bede02d23aeb068b74af99" + ], + "data": "0x", + "logIndex": 52, + "blockHash": "0x7dd77b001ff9c1b87b02d0a5e6f681b639adf69be078567c8eecd412905a406f" + } + ], + "blockNumber": 17835500, + "cumulativeGasUsed": "1986896", + "status": 1, + "byzantium": true + }, + "args": [ + "0x5CC5B05a8A13E3fBDB0BB9FcCd98D38e50F90c38", + "0x6cE82874EAf6E7602fD21Cf8bBDEd82705680A99", + "0x03c545163bd114D756c65DDA1D97D37b89dA2236", + "0x0073e6eb087019bdB7bEDe02d23aEb068b74Af99" + ], + "numDeployments": 1, + "solcInputHash": "e1aa5651f7645b1641ef34120369a942", + "metadata": "{\"compiler\":{\"version\":\"0.8.2+commit.661d1103\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_landToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newLandTunnel\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_oldLandTunnel\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldLandTunnel\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newLandTunnel\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"TunnelLandsMigrated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldLandTunnel\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newLandTunnel\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"sizes\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"x\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"y\",\"type\":\"uint256[]\"}],\"name\":\"TunnelQuadsMigrated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"landToken\",\"outputs\":[{\"internalType\":\"contract ILandToken\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"migrateLandsToTunnel\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"sizes\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"x\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"y\",\"type\":\"uint256[]\"}],\"name\":\"migrateQuadsToTunnel\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"newLandTunnel\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oldLandTunnel\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"The Sandbox\",\"kind\":\"dev\",\"methods\":{\"changeAdmin(address)\":{\"params\":{\"_newAdmin\":\"the new admin to be set\"}},\"constructor\":{\"params\":{\"_admin\":\"admin of the contract\",\"_landToken\":\"LAND token address\",\"_newLandTunnel\":\"the tunnel address to migrate to\",\"_oldLandTunnel\":\"the tunnel address to migrate from\"}},\"migrateLandsToTunnel(uint256[])\":{\"details\":\"Transfers all the passed land ids from the old land tunnel to the new land tunnel\",\"params\":{\"ids\":\"of land tokens to be migrated\"}},\"migrateQuadsToTunnel(uint256[],uint256[],uint256[])\":{\"details\":\"Transfers all the passed quads from the old land tunnel to the new land tunnel\",\"params\":{\"sizes\":\"of land quads to be migrated\",\"x\":\"coordinate of land quads to be migrated\",\"y\":\"coordinate of land quads to be migrated\"}}},\"title\":\"Tunnel migration on L1\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"changeAdmin(address)\":{\"notice\":\"changes admin to new admin\"},\"constructor\":{\"notice\":\"Constructor of the tunnel migration contract\"},\"migrateLandsToTunnel(uint256[])\":{\"notice\":\"This method needs super operator role to execute\"},\"migrateQuadsToTunnel(uint256[],uint256[],uint256[])\":{\"notice\":\"This method needs super operator role to execute\"}},\"notice\":\"Contract handling the migration of LAND tokens from a tunnel to a new one\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/solc_0.8/polygon/root/land/LandTunnelMigration.sol\":\"LandTunnelMigration\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"src/solc_0.8/common/interfaces/ILandToken.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\n/// @title ILandToken\\n/// @author The Sandbox\\n/// @notice Interface of the LAND token including quad methods\\ninterface ILandToken {\\n /// @notice transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\\n /// @param from current owner of the quad\\n /// @param to destination\\n /// @param sizes list of sizes for each quad\\n /// @param xs list of bottom left x coordinates for each quad\\n /// @param ys list of bottom left y coordinates for each quad\\n /// @param data additional data\\n function batchTransferQuad(\\n address from,\\n address to,\\n uint256[] calldata sizes,\\n uint256[] calldata xs,\\n uint256[] calldata ys,\\n bytes calldata data\\n ) external;\\n\\n /// @notice transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\\n /// @param from current owner of the quad\\n /// @param to destination\\n /// @param size size of the quad\\n /// @param x The top left x coordinate of the quad\\n /// @param y The top left y coordinate of the quad\\n /// @param data additional data\\n function transferQuad(\\n address from,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes calldata data\\n ) external;\\n\\n /// @notice Transfer many tokens between 2 addresses.\\n /// @param from The sender of the token.\\n /// @param to The recipient of the token.\\n /// @param ids The ids of the tokens.\\n /// @param data Additional data.\\n function batchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x5df895e3442904d5f6a6ad3b4b34a2ec61d4a97a4b3feea57d5bb611d14a7e3e\",\"license\":\"MIT\"},\"src/solc_0.8/polygon/root/land/LandTunnelMigration.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\nimport {ILandToken} from \\\"../../../common/interfaces/ILandToken.sol\\\";\\n\\n/// @title Tunnel migration on L1\\n/// @author The Sandbox\\n/// @notice Contract handling the migration of LAND tokens from a tunnel to a new one\\ncontract LandTunnelMigration {\\n ILandToken public immutable landToken;\\n address public immutable newLandTunnel;\\n address public immutable oldLandTunnel;\\n address private admin;\\n\\n event TunnelLandsMigrated(address indexed oldLandTunnel, address indexed newLandTunnel, uint256[] ids);\\n event TunnelQuadsMigrated(\\n address indexed oldLandTunnel,\\n address indexed newLandTunnel,\\n uint256[] sizes,\\n uint256[] x,\\n uint256[] y\\n );\\n event AdminChanged(address indexed _newAdmin);\\n\\n modifier isAdmin() {\\n require(admin == msg.sender, \\\"LandTunnelMigration: !AUTHORISED\\\");\\n _;\\n }\\n\\n /// @notice Constructor of the tunnel migration contract\\n /// @param _landToken LAND token address\\n /// @param _newLandTunnel the tunnel address to migrate to\\n /// @param _oldLandTunnel the tunnel address to migrate from\\n /// @param _admin admin of the contract\\n constructor(\\n address _landToken,\\n address _newLandTunnel,\\n address _oldLandTunnel,\\n address _admin\\n ) {\\n require(_admin != address(0), \\\"LandTunnelMigration: admin can't be zero address\\\");\\n require(_landToken != address(0), \\\"LandTunnelMigration: landToken can't be zero address\\\");\\n require(_newLandTunnel != address(0), \\\"LandTunnelMigration: new Tunnel can't be zero address\\\");\\n require(_oldLandTunnel != address(0), \\\"LandTunnelMigration: old Tunnel can't be zero address\\\");\\n\\n admin = _admin;\\n landToken = ILandToken(_landToken);\\n newLandTunnel = _newLandTunnel;\\n oldLandTunnel = _oldLandTunnel;\\n\\n emit AdminChanged(_admin);\\n }\\n\\n /// @dev Transfers all the passed land ids from the old land tunnel to the new land tunnel\\n /// @notice This method needs super operator role to execute\\n /// @param ids of land tokens to be migrated\\n function migrateLandsToTunnel(uint256[] memory ids) external isAdmin {\\n landToken.batchTransferFrom(oldLandTunnel, newLandTunnel, ids, \\\"\\\");\\n emit TunnelLandsMigrated(oldLandTunnel, newLandTunnel, ids);\\n }\\n\\n /// @dev Transfers all the passed quads from the old land tunnel to the new land tunnel\\n /// @notice This method needs super operator role to execute\\n /// @param sizes of land quads to be migrated\\n /// @param x coordinate of land quads to be migrated\\n /// @param y coordinate of land quads to be migrated\\n function migrateQuadsToTunnel(\\n uint256[] memory sizes,\\n uint256[] memory x,\\n uint256[] memory y\\n ) external isAdmin {\\n landToken.batchTransferQuad(oldLandTunnel, newLandTunnel, sizes, x, y, \\\"\\\");\\n emit TunnelQuadsMigrated(oldLandTunnel, newLandTunnel, sizes, x, y);\\n }\\n\\n /// @notice changes admin to new admin\\n /// @param _newAdmin the new admin to be set\\n function changeAdmin(address _newAdmin) external isAdmin {\\n require(_newAdmin != address(0), \\\"LandTunnelMigration: admin can't be zero address\\\");\\n admin = _newAdmin;\\n emit AdminChanged(_newAdmin);\\n }\\n}\\n\",\"keccak256\":\"0x87633351811815925d65fe01c66b6d9fd2886048131e0008e4959c3f2f7952a7\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60e060405234801561001057600080fd5b50604051610ccf380380610ccf83398101604081905261002f916102a4565b6001600160a01b0381166100a35760405162461bcd60e51b815260206004820152603060248201527f4c616e6454756e6e656c4d6967726174696f6e3a2061646d696e2063616e277460448201526f206265207a65726f206164647265737360801b60648201526084015b60405180910390fd5b6001600160a01b03841661011f5760405162461bcd60e51b815260206004820152603460248201527f4c616e6454756e6e656c4d6967726174696f6e3a206c616e64546f6b656e206360448201527f616e2774206265207a65726f2061646472657373000000000000000000000000606482015260840161009a565b6001600160a01b03831661019b5760405162461bcd60e51b815260206004820152603560248201527f4c616e6454756e6e656c4d6967726174696f6e3a206e65772054756e6e656c2060448201527f63616e2774206265207a65726f20616464726573730000000000000000000000606482015260840161009a565b6001600160a01b0382166102175760405162461bcd60e51b815260206004820152603560248201527f4c616e6454756e6e656c4d6967726174696f6e3a206f6c642054756e6e656c2060448201527f63616e2774206265207a65726f20616464726573730000000000000000000000606482015260840161009a565b600080546001600160a01b0383166001600160a01b0319909116811782556001600160601b0319606087811b821660805286811b821660a05285901b1660c05260405190917f7ce7ec0b50378fb6c0186ffb5f48325f6593fcb4ca4386f21861af3129188f5c91a2505050506102f7565b80516001600160a01b038116811461029f57600080fd5b919050565b600080600080608085870312156102b9578384fd5b6102c285610288565b93506102d060208601610288565b92506102de60408601610288565b91506102ec60608601610288565b905092959194509250565b60805160601c60a05160601c60c05160601c61095c6103736000396000818160d4015281816101ff015281816102a9015281816104f801526105a6015260008181607c015281816102210152818161027f0152818161051a015261057c01526000818161010e015281816101d201526104cb015261095c6000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c80638f283970116100505780638f283970146100f6578063b44468fb14610109578063ebe948341461013057610072565b80633b2fd4581461007757806376926076146100ba57806386f47792146100cf575b600080fd5b61009e7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b6100cd6100c83660046106f7565b610143565b005b61009e7f000000000000000000000000000000000000000000000000000000000000000081565b6100cd6101043660046106c9565b61030b565b61009e7f000000000000000000000000000000000000000000000000000000000000000081565b6100cd61013e366004610732565b610441565b6000546001600160a01b031633146101a25760405162461bcd60e51b815260206004820181905260248201527f4c616e6454756e6e656c4d6967726174696f6e3a2021415554484f524953454460448201526064015b60405180910390fd5b6040517f15ddc5350000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906315ddc5359061024b907f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090869060040161085d565b600060405180830381600087803b15801561026557600080fd5b505af1158015610279573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167ff3c8a06d9bf1d976109b76dbbd7e869f76aa4af071573fe465e2b3b8f5b421f48360405161030091906108a1565b60405180910390a350565b6000546001600160a01b031633146103655760405162461bcd60e51b815260206004820181905260248201527f4c616e6454756e6e656c4d6967726174696f6e3a2021415554484f52495345446044820152606401610199565b6001600160a01b0381166103e15760405162461bcd60e51b815260206004820152603060248201527f4c616e6454756e6e656c4d6967726174696f6e3a2061646d696e2063616e277460448201527f206265207a65726f2061646472657373000000000000000000000000000000006064820152608401610199565b600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038316908117825560405190917f7ce7ec0b50378fb6c0186ffb5f48325f6593fcb4ca4386f21861af3129188f5c91a250565b6000546001600160a01b0316331461049b5760405162461bcd60e51b815260206004820181905260248201527f4c616e6454756e6e656c4d6967726174696f6e3a2021415554484f52495345446044820152606401610199565b6040517feaa5e0670000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063eaa5e06790610548907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000908890889088906004016107f0565b600060405180830381600087803b15801561056257600080fd5b505af1158015610576573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f5925ea9cd1b8a825a990df684ca7e1da5ce4c4dfbc2271a8470b8f2a31dcc127858585604051610601939291906108b4565b60405180910390a3505050565b600082601f83011261061e578081fd5b8135602067ffffffffffffffff8083111561063b5761063b6108f7565b8183026040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f8301168101818110848211171561067d5761067d6108f7565b6040528481528381019250868401828801850189101561069b578687fd5b8692505b858310156106bd57803584529284019260019290920191840161069f565b50979650505050505050565b6000602082840312156106da578081fd5b81356001600160a01b03811681146106f0578182fd5b9392505050565b600060208284031215610708578081fd5b813567ffffffffffffffff81111561071e578182fd5b61072a8482850161060e565b949350505050565b600080600060608486031215610746578182fd5b833567ffffffffffffffff8082111561075d578384fd5b6107698783880161060e565b9450602086013591508082111561077e578384fd5b61078a8783880161060e565b9350604086013591508082111561079f578283fd5b506107ac8682870161060e565b9150509250925092565b6000815180845260208085019450808401835b838110156107e5578151875295820195908201906001016107c9565b509495945050505050565b60006001600160a01b03808816835280871660208401525060c0604083015261081c60c08301866107b6565b828103606084015261082e81866107b6565b9050828103608084015261084281856107b6565b83810360a09094019390935250815260200195945050505050565b60006001600160a01b0380861683528085166020840152506080604083015261088960808301846107b6565b82810360609093019290925281526020019392505050565b6000602082526106f060208301846107b6565b6000606082526108c760608301866107b6565b82810360208401526108d981866107b6565b905082810360408401526108ed81856107b6565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea26469706673582212205aacfbc904a44478b3e4dc1b1324810ce542610ffa777ec80e1aa73cc1aa30ee64736f6c63430008020033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100725760003560e01c80638f283970116100505780638f283970146100f6578063b44468fb14610109578063ebe948341461013057610072565b80633b2fd4581461007757806376926076146100ba57806386f47792146100cf575b600080fd5b61009e7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b6100cd6100c83660046106f7565b610143565b005b61009e7f000000000000000000000000000000000000000000000000000000000000000081565b6100cd6101043660046106c9565b61030b565b61009e7f000000000000000000000000000000000000000000000000000000000000000081565b6100cd61013e366004610732565b610441565b6000546001600160a01b031633146101a25760405162461bcd60e51b815260206004820181905260248201527f4c616e6454756e6e656c4d6967726174696f6e3a2021415554484f524953454460448201526064015b60405180910390fd5b6040517f15ddc5350000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906315ddc5359061024b907f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090869060040161085d565b600060405180830381600087803b15801561026557600080fd5b505af1158015610279573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167ff3c8a06d9bf1d976109b76dbbd7e869f76aa4af071573fe465e2b3b8f5b421f48360405161030091906108a1565b60405180910390a350565b6000546001600160a01b031633146103655760405162461bcd60e51b815260206004820181905260248201527f4c616e6454756e6e656c4d6967726174696f6e3a2021415554484f52495345446044820152606401610199565b6001600160a01b0381166103e15760405162461bcd60e51b815260206004820152603060248201527f4c616e6454756e6e656c4d6967726174696f6e3a2061646d696e2063616e277460448201527f206265207a65726f2061646472657373000000000000000000000000000000006064820152608401610199565b600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038316908117825560405190917f7ce7ec0b50378fb6c0186ffb5f48325f6593fcb4ca4386f21861af3129188f5c91a250565b6000546001600160a01b0316331461049b5760405162461bcd60e51b815260206004820181905260248201527f4c616e6454756e6e656c4d6967726174696f6e3a2021415554484f52495345446044820152606401610199565b6040517feaa5e0670000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063eaa5e06790610548907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000908890889088906004016107f0565b600060405180830381600087803b15801561056257600080fd5b505af1158015610576573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f5925ea9cd1b8a825a990df684ca7e1da5ce4c4dfbc2271a8470b8f2a31dcc127858585604051610601939291906108b4565b60405180910390a3505050565b600082601f83011261061e578081fd5b8135602067ffffffffffffffff8083111561063b5761063b6108f7565b8183026040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f8301168101818110848211171561067d5761067d6108f7565b6040528481528381019250868401828801850189101561069b578687fd5b8692505b858310156106bd57803584529284019260019290920191840161069f565b50979650505050505050565b6000602082840312156106da578081fd5b81356001600160a01b03811681146106f0578182fd5b9392505050565b600060208284031215610708578081fd5b813567ffffffffffffffff81111561071e578182fd5b61072a8482850161060e565b949350505050565b600080600060608486031215610746578182fd5b833567ffffffffffffffff8082111561075d578384fd5b6107698783880161060e565b9450602086013591508082111561077e578384fd5b61078a8783880161060e565b9350604086013591508082111561079f578283fd5b506107ac8682870161060e565b9150509250925092565b6000815180845260208085019450808401835b838110156107e5578151875295820195908201906001016107c9565b509495945050505050565b60006001600160a01b03808816835280871660208401525060c0604083015261081c60c08301866107b6565b828103606084015261082e81866107b6565b9050828103608084015261084281856107b6565b83810360a09094019390935250815260200195945050505050565b60006001600160a01b0380861683528085166020840152506080604083015261088960808301846107b6565b82810360609093019290925281526020019392505050565b6000602082526106f060208301846107b6565b6000606082526108c760608301866107b6565b82810360208401526108d981866107b6565b905082810360408401526108ed81856107b6565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea26469706673582212205aacfbc904a44478b3e4dc1b1324810ce542610ffa777ec80e1aa73cc1aa30ee64736f6c63430008020033", + "devdoc": { + "author": "The Sandbox", + "kind": "dev", + "methods": { + "changeAdmin(address)": { + "params": { + "_newAdmin": "the new admin to be set" + } + }, + "constructor": { + "params": { + "_admin": "admin of the contract", + "_landToken": "LAND token address", + "_newLandTunnel": "the tunnel address to migrate to", + "_oldLandTunnel": "the tunnel address to migrate from" + } + }, + "migrateLandsToTunnel(uint256[])": { + "details": "Transfers all the passed land ids from the old land tunnel to the new land tunnel", + "params": { + "ids": "of land tokens to be migrated" + } + }, + "migrateQuadsToTunnel(uint256[],uint256[],uint256[])": { + "details": "Transfers all the passed quads from the old land tunnel to the new land tunnel", + "params": { + "sizes": "of land quads to be migrated", + "x": "coordinate of land quads to be migrated", + "y": "coordinate of land quads to be migrated" + } + } + }, + "title": "Tunnel migration on L1", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "changeAdmin(address)": { + "notice": "changes admin to new admin" + }, + "constructor": { + "notice": "Constructor of the tunnel migration contract" + }, + "migrateLandsToTunnel(uint256[])": { + "notice": "This method needs super operator role to execute" + }, + "migrateQuadsToTunnel(uint256[],uint256[],uint256[])": { + "notice": "This method needs super operator role to execute" + } + }, + "notice": "Contract handling the migration of LAND tokens from a tunnel to a new one", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 68091, + "contract": "src/solc_0.8/polygon/root/land/LandTunnelMigration.sol:LandTunnelMigration", + "label": "admin", + "offset": 0, + "slot": "0", + "type": "t_address" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/packages/core/deployments/mainnet/LandTunnelV2.json b/packages/core/deployments/mainnet/LandTunnelV2.json new file mode 100644 index 0000000000..dd01f25abb --- /dev/null +++ b/packages/core/deployments/mainnet/LandTunnelV2.json @@ -0,0 +1,699 @@ +{ + "address": "0x6cE82874EAf6E7602fD21Cf8bBDEd82705680A99", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "size", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "x", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "y", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newForwarder", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "size", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "x", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "y", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "SEND_MESSAGE_EVENT_SIG", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "sizes", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "xs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "ys", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "batchTransferQuadToL2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "checkpointManager", + "outputs": [ + { + "internalType": "contract ICheckpointManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fxChildTunnel", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fxRoot", + "outputs": [ + { + "internalType": "contract IFxStateSender", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTrustedForwarder", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_checkpointManager", + "type": "address" + }, + { + "internalType": "address", + "name": "_fxRoot", + "type": "address" + }, + { + "internalType": "contract ILandTokenV2", + "name": "_rootToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_trustedForwarder", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "forwarder", + "type": "address" + } + ], + "name": "isTrustedForwarder", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721BatchReceived", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "processedExits", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "inputData", + "type": "bytes" + } + ], + "name": "receiveMessage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rootToken", + "outputs": [ + { + "internalType": "contract ILandTokenV2", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_fxChildTunnel", + "type": "address" + } + ], + "name": "setFxChildTunnel", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "trustedForwarder", + "type": "address" + } + ], + "name": "setTrustedForwarder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "initialLogic", + "type": "address" + }, + { + "internalType": "address", + "name": "initialAdmin", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x91663dc990440e693b4fa27b5aa2e0ba2f0565dab46d537b0e06c925f6e14474", + "receipt": { + "to": null, + "from": "0xe19ae8F9B36Ca43D12741288D0e311396140DF6F", + "contractAddress": "0x6cE82874EAf6E7602fD21Cf8bBDEd82705680A99", + "transactionIndex": 105, + "gasUsed": "568949", + "logsBloom": "0x00000000800000000000000000000000000000000000000000800000000000020000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000080001000001000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000002000000000000400000000000000000000008000000000000000000000000000000000000000000000000000000000000100000000000000020000000000000000000000000000040000000020000000002000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x611502039e140beba8064744b20f596438d5895e1e54622184647d5be692e19e", + "transactionHash": "0x91663dc990440e693b4fa27b5aa2e0ba2f0565dab46d537b0e06c925f6e14474", + "logs": [ + { + "transactionIndex": 105, + "blockNumber": 17835108, + "transactionHash": "0x91663dc990440e693b4fa27b5aa2e0ba2f0565dab46d537b0e06c925f6e14474", + "address": "0x6cE82874EAf6E7602fD21Cf8bBDEd82705680A99", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000e19ae8f9b36ca43d12741288d0e311396140df6f" + ], + "data": "0x", + "logIndex": 295, + "blockHash": "0x611502039e140beba8064744b20f596438d5895e1e54622184647d5be692e19e" + }, + { + "transactionIndex": 105, + "blockNumber": 17835108, + "transactionHash": "0x91663dc990440e693b4fa27b5aa2e0ba2f0565dab46d537b0e06c925f6e14474", + "address": "0x6cE82874EAf6E7602fD21Cf8bBDEd82705680A99", + "topics": [ + "0xd91237492a9e30cd2faf361fc103998a382ff0ec2b1b07dc1cbebb76ae2f1ea2", + "0x00000000000000000000000084a0856b038eaad1cc7e297cf34a7e72685a8693" + ], + "data": "0x", + "logIndex": 296, + "blockHash": "0x611502039e140beba8064744b20f596438d5895e1e54622184647d5be692e19e" + } + ], + "blockNumber": 17835108, + "cumulativeGasUsed": "10856568", + "status": 1, + "byzantium": true + }, + "args": [ + "0xE9b6cc2598975B75E869Ca7775B66844311C5DDB", + "0x46Ac83D74091Dd54B503D89fa92b5C788Bcd3886", + "0xf8c8765e00000000000000000000000086e4dc95c7fbdbf52e33d563bbdb00823894c287000000000000000000000000fe5e5d361b2ad62c541bab87c45a0b9b018389a20000000000000000000000005cc5b05a8a13e3fbdb0bb9fccd98d38e50f90c3800000000000000000000000084a0856b038eaad1cc7e297cf34a7e72685a8693" + ], + "numDeployments": 1, + "solcInputHash": "1635d55d57a0a2552952c0d22586ed23", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialLogic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAdmin\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"stateVariables\":{\"_ADMIN_SLOT\":{\"details\":\"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.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.7/proxy/OptimizedTransparentUpgradeableProxy.sol\":\"OptimizedTransparentUpgradeableProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.7/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n * \\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n * \\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal virtual view returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n * \\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {\\n }\\n}\\n\",\"keccak256\":\"0xc33f9858a67e34c77831163d5611d21fc627dfd2c303806a98a6c9db5a01b034\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/UpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Proxy.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n * \\n * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see\\n * {TransparentUpgradeableProxy}.\\n */\\ncontract UpgradeableProxy is Proxy {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n * \\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _setImplementation(_logic);\\n if(_data.length > 0) {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = _logic.delegatecall(_data);\\n require(success);\\n }\\n }\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal override view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Upgrades the proxy to a new implementation.\\n * \\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"UpgradeableProxy: new implementation is not a contract\\\");\\n\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newImplementation)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd68f4c11941712db79a61b9dca81a5db663cfacec3d7bb19f8d2c23bb1ab8afe\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\\n // for accounts without code, i.e. `keccak256('')`\\n bytes32 codehash;\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { codehash := extcodehash(account) }\\n return (codehash != accountHash && codehash != 0x0);\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return _functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n return _functionCallWithValue(target, data, value, errorMessage);\\n }\\n\\n function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x698f929f1097637d051976b322a2d532c27df022b09010e8d091e2888a5ebdf8\",\"license\":\"MIT\"},\"solc_0.7/proxy/OptimizedTransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.7.0;\\n\\nimport \\\"../openzeppelin/proxy/UpgradeableProxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\\n */\\ncontract OptimizedTransparentUpgradeableProxy is UpgradeableProxy {\\n address internal immutable _ADMIN;\\n\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\\n */\\n constructor(\\n address initialLogic,\\n address initialAdmin,\\n bytes memory _data\\n ) payable UpgradeableProxy(initialLogic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 slot = _ADMIN_SLOT;\\n\\n _ADMIN = initialAdmin;\\n\\n // still store it to work with EIP-1967\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, initialAdmin)\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _admin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address) {\\n return _admin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address) {\\n return _implementation();\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeTo(newImplementation);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeTo(newImplementation);\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, ) = newImplementation.delegatecall(data);\\n require(success);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view returns (address adm) {\\n return _ADMIN;\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _admin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x076456d71495e22183c672db71d719bd2dc7cb3b35e5bba21ce37eea1ec30347\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040526040516108fc3803806108fc8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101e9565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b506001600160601b0319606082901b166080527fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035550610297565b6101fc8161025b60201b6103581760201c565b6102375760405162461bcd60e51b81526004018080602001828103825260368152602001806108c66036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061028f57508115155b949350505050565b60805160601c6106126102b46000398061047352506106126000f3fe6080604052600436106100435760003560e01c80633659cfe61461005a5780634f1ef2861461009a5780635c60da1b14610127578063f851a4401461016557610052565b366100525761005061017a565b005b61005061017a565b34801561006657600080fd5b506100506004803603602081101561007d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610194565b610050600480360360408110156100b057600080fd5b73ffffffffffffffffffffffffffffffffffffffff82351691908101906040810160208201356401000000008111156100e857600080fd5b8201836020820111156100fa57600080fd5b8035906020019184600183028401116401000000008311171561011c57600080fd5b5090925090506101e8565b34801561013357600080fd5b5061013c6102bc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561017157600080fd5b5061013c610313565b610182610394565b61019261018d610428565b61044d565b565b61019c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101dd576101d881610495565b6101e5565b6101e561017a565b50565b6101f0610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102af5761022c83610495565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610296576040519150601f19603f3d011682016040523d82523d6000602084013e61029b565b606091505b50509050806102a957600080fd5b506102b7565b6102b761017a565b505050565b60006102c6610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610428565b9050610310565b61031061017a565b90565b600061031d610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610471565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061038c57508115155b949350505050565b61039c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061059b6042913960600191505060405180910390fd5b610192610192565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561046c573d6000f35b3d6000fd5b7f000000000000000000000000000000000000000000000000000000000000000090565b61049e816104e2565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6104eb81610358565b610540576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806105656036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200f42fc9d1f991236ae26e240c8505def958528031655d7dd335d3988cc0c88f564736f6c634300070600335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374", + "deployedBytecode": "0x6080604052600436106100435760003560e01c80633659cfe61461005a5780634f1ef2861461009a5780635c60da1b14610127578063f851a4401461016557610052565b366100525761005061017a565b005b61005061017a565b34801561006657600080fd5b506100506004803603602081101561007d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610194565b610050600480360360408110156100b057600080fd5b73ffffffffffffffffffffffffffffffffffffffff82351691908101906040810160208201356401000000008111156100e857600080fd5b8201836020820111156100fa57600080fd5b8035906020019184600183028401116401000000008311171561011c57600080fd5b5090925090506101e8565b34801561013357600080fd5b5061013c6102bc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561017157600080fd5b5061013c610313565b610182610394565b61019261018d610428565b61044d565b565b61019c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101dd576101d881610495565b6101e5565b6101e561017a565b50565b6101f0610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102af5761022c83610495565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610296576040519150601f19603f3d011682016040523d82523d6000602084013e61029b565b606091505b50509050806102a957600080fd5b506102b7565b6102b761017a565b505050565b60006102c6610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610428565b9050610310565b61031061017a565b90565b600061031d610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610471565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061038c57508115155b949350505050565b61039c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061059b6042913960600191505060405180910390fd5b610192610192565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561046c573d6000f35b3d6000fd5b7f000000000000000000000000000000000000000000000000000000000000000090565b61049e816104e2565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6104eb81610358565b610540576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806105656036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200f42fc9d1f991236ae26e240c8505def958528031655d7dd335d3988cc0c88f564736f6c63430007060033", + "execute": { + "methodName": "initialize", + "args": [ + "0x86E4Dc95c7FBdBf52e33D563BbDB00823894C287", + "0xfe5e5D361b2ad62c541bAb87C45a0B9B018389a2", + "0x5CC5B05a8A13E3fBDB0BB9FcCd98D38e50F90c38", + "0x84a0856b038eaAd1cC7E297cF34A7e72685A8693" + ] + }, + "implementation": "0xE9b6cc2598975B75E869Ca7775B66844311C5DDB", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`" + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "stateVariables": { + "_ADMIN_SLOT": { + "details": "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." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/core/deployments/mainnet/LandTunnelV2_Implementation.json b/packages/core/deployments/mainnet/LandTunnelV2_Implementation.json new file mode 100644 index 0000000000..9cafd203b9 --- /dev/null +++ b/packages/core/deployments/mainnet/LandTunnelV2_Implementation.json @@ -0,0 +1,836 @@ +{ + "address": "0xE9b6cc2598975B75E869Ca7775B66844311C5DDB", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "size", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "x", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "y", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newForwarder", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "size", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "x", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "y", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "SEND_MESSAGE_EVENT_SIG", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "sizes", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "xs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "ys", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "batchTransferQuadToL2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "checkpointManager", + "outputs": [ + { + "internalType": "contract ICheckpointManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fxChildTunnel", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fxRoot", + "outputs": [ + { + "internalType": "contract IFxStateSender", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTrustedForwarder", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_checkpointManager", + "type": "address" + }, + { + "internalType": "address", + "name": "_fxRoot", + "type": "address" + }, + { + "internalType": "contract ILandTokenV2", + "name": "_rootToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_trustedForwarder", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "forwarder", + "type": "address" + } + ], + "name": "isTrustedForwarder", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721BatchReceived", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "processedExits", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "inputData", + "type": "bytes" + } + ], + "name": "receiveMessage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rootToken", + "outputs": [ + { + "internalType": "contract ILandTokenV2", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_fxChildTunnel", + "type": "address" + } + ], + "name": "setFxChildTunnel", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "trustedForwarder", + "type": "address" + } + ], + "name": "setTrustedForwarder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x95f175d6d4419148ce13b7b9608c3c0abf1a04443cfe047b9a8469d89e038f57", + "receipt": { + "to": null, + "from": "0xe19ae8F9B36Ca43D12741288D0e311396140DF6F", + "contractAddress": "0xE9b6cc2598975B75E869Ca7775B66844311C5DDB", + "transactionIndex": 110, + "gasUsed": "3306485", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x87572502cbbb6b7bbd999fd60424a65084c5d4a399ca3b2eacdad2af55bc81c5", + "transactionHash": "0x95f175d6d4419148ce13b7b9608c3c0abf1a04443cfe047b9a8469d89e038f57", + "logs": [], + "blockNumber": 17835107, + "cumulativeGasUsed": "16293427", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e1aa5651f7645b1641ef34120369a942", + "metadata": "{\"compiler\":{\"version\":\"0.8.2+commit.661d1103\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"size\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newForwarder\",\"type\":\"address\"}],\"name\":\"TrustedForwarderSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"size\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"SEND_MESSAGE_EVENT_SIG\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"sizes\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"xs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"ys\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"batchTransferQuadToL2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"checkpointManager\",\"outputs\":[{\"internalType\":\"contract ICheckpointManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fxChildTunnel\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fxRoot\",\"outputs\":[{\"internalType\":\"contract IFxStateSender\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTrustedForwarder\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_checkpointManager\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_fxRoot\",\"type\":\"address\"},{\"internalType\":\"contract ILandTokenV2\",\"name\":\"_rootToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_trustedForwarder\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"}],\"name\":\"isTrustedForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC721BatchReceived\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC721Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"processedExits\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"inputData\",\"type\":\"bytes\"}],\"name\":\"receiveMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rootToken\",\"outputs\":[{\"internalType\":\"contract ILandTokenV2\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fxChildTunnel\",\"type\":\"address\"}],\"name\":\"setFxChildTunnel\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"name\":\"setTrustedForwarder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"The Sandbox\",\"kind\":\"dev\",\"methods\":{\"batchTransferQuadToL2(address,uint256[],uint256[],uint256[],bytes)\":{\"params\":{\"data\":\"data send to the receiver onERC721BatchReceived on L1\",\"sizes\":\"sizes of quad\",\"to\":\"address of the receiver on L2\",\"xs\":\"x coordinates of quads\",\"ys\":\"y coordinates of quads\"}},\"getTrustedForwarder()\":{\"returns\":{\"_0\":\"trustedForwarder address of the trusted forwarder\"}},\"initialize(address,address,address,address)\":{\"params\":{\"_checkpointManager\":\"checkpoint manager address\",\"_fxRoot\":\"state sender contract\",\"_rootToken\":\"LAND token on the root chain\",\"_trustedForwarder\":\"trusted forwarder for meta-tx\"}},\"isTrustedForwarder(address)\":{\"params\":{\"forwarder\":\"address to check\"},\"returns\":{\"_0\":\"is trusted\"}},\"onERC721BatchReceived(address,address,uint256[],bytes)\":{\"details\":\"called on ERC721 batch transfer to this contract\",\"params\":{\"operator\":\"address of the one sending the ERC721 Token\"},\"returns\":{\"_0\":\"onERC721BatchReceived function selector\"}},\"onERC721Received(address,address,uint256,bytes)\":{\"details\":\"called on ERC721 transfer to this contract\",\"params\":{\"operator\":\"address of the one sending the ERC721 Token\"},\"returns\":{\"_0\":\"onERC721Received function selector\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pause()\":{\"details\":\"Pauses all token transfers across bridge\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"receiveMessage(bytes)\":{\"details\":\"This function verifies if the transaction actually happened on child chain\",\"params\":{\"inputData\":\"RLP encoded data of the reference tx containing following list of fields 0 - headerNumber - Checkpoint header block number containing the reference tx 1 - blockProof - Proof that the block header (in the child chain) is a leaf in the submitted merkle root 2 - blockNumber - Block number containing the reference tx on child chain 3 - blockTime - Reference tx block time 4 - txRoot - Transactions root of block 5 - receiptRoot - Receipts root of block 6 - receipt - Receipt of the reference transaction 7 - receiptProof - Merkle proof of the reference receipt 8 - branchMask - 32 bits denoting the path of receipt in merkle tree 9 - receiptLogIndex - Log Index to read from the receipt\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setFxChildTunnel(address)\":{\"details\":\"only owner can call this funtion\",\"params\":{\"_fxChildTunnel\":\"address of the fx-child tunnel\"}},\"setTrustedForwarder(address)\":{\"details\":\"Change the address of the trusted forwarder for meta-TX\",\"params\":{\"trustedForwarder\":\"The new trustedForwarder\"}},\"supportsInterface(bytes4)\":{\"details\":\"to be called by external contact to check if this contract supports ERC721 token and batch token receive\",\"params\":{\"interfaceId\":\"the interface to be checked if supported by the contract\"},\"returns\":{\"_0\":\"0x5e8bf644 is the interface of IERC721MandatoryTokenReceiver and 0x01ffc9a7 for the Eip 165 supports interface's interface id\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"unpause()\":{\"details\":\"Unpauses all token transfers across bridge\"}},\"title\":\"LandTunnelV2\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"batchTransferQuadToL2(address,uint256[],uint256[],uint256[],bytes)\":{\"notice\":\"Send a batch of quads to L2\"},\"getTrustedForwarder()\":{\"notice\":\"Get the current trusted forwarder\"},\"initialize(address,address,address,address)\":{\"notice\":\"Initializes the contract\"},\"isTrustedForwarder(address)\":{\"notice\":\"Checks if an address is a trusted forwarder\"},\"receiveMessage(bytes)\":{\"notice\":\"receive message from L2 to L1, validated by proof\"},\"setFxChildTunnel(address)\":{\"notice\":\"sets the fx-child tunnel\"}},\"notice\":\"LAND tunnel on the root chain\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/solc_0.8/polygon/root/land/LandTunnelV2.sol\":\"LandTunnelV2\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@maticnetwork/fx-portal/contracts/lib/ExitPayloadReader.sol\":{\"content\":\"pragma solidity ^0.8.0;\\n\\nimport {RLPReader} from \\\"./RLPReader.sol\\\";\\n\\nlibrary ExitPayloadReader {\\n using RLPReader for bytes;\\n using RLPReader for RLPReader.RLPItem;\\n\\n uint8 constant WORD_SIZE = 32;\\n\\n struct ExitPayload {\\n RLPReader.RLPItem[] data;\\n }\\n\\n struct Receipt {\\n RLPReader.RLPItem[] data;\\n bytes raw;\\n uint256 logIndex;\\n }\\n\\n struct Log {\\n RLPReader.RLPItem data;\\n RLPReader.RLPItem[] list;\\n }\\n\\n struct LogTopics {\\n RLPReader.RLPItem[] data;\\n }\\n\\n // copy paste of private copy() from RLPReader to avoid changing of existing contracts\\n function copy(\\n uint256 src,\\n uint256 dest,\\n uint256 len\\n ) private pure {\\n if (len == 0) return;\\n\\n // copy as many word sizes as possible\\n for (; len >= WORD_SIZE; len -= WORD_SIZE) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += WORD_SIZE;\\n dest += WORD_SIZE;\\n }\\n \\n if (len == 0) return;\\n\\n // left over bytes. Mask is used to remove unwanted bytes from the word\\n uint256 mask = 256**(WORD_SIZE - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask)) // zero out src\\n let destpart := and(mload(dest), mask) // retrieve the bytes\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n function toExitPayload(bytes memory data) internal pure returns (ExitPayload memory) {\\n RLPReader.RLPItem[] memory payloadData = data.toRlpItem().toList();\\n\\n return ExitPayload(payloadData);\\n }\\n\\n function getHeaderNumber(ExitPayload memory payload) internal pure returns (uint256) {\\n return payload.data[0].toUint();\\n }\\n\\n function getBlockProof(ExitPayload memory payload) internal pure returns (bytes memory) {\\n return payload.data[1].toBytes();\\n }\\n\\n function getBlockNumber(ExitPayload memory payload) internal pure returns (uint256) {\\n return payload.data[2].toUint();\\n }\\n\\n function getBlockTime(ExitPayload memory payload) internal pure returns (uint256) {\\n return payload.data[3].toUint();\\n }\\n\\n function getTxRoot(ExitPayload memory payload) internal pure returns (bytes32) {\\n return bytes32(payload.data[4].toUint());\\n }\\n\\n function getReceiptRoot(ExitPayload memory payload) internal pure returns (bytes32) {\\n return bytes32(payload.data[5].toUint());\\n }\\n\\n function getReceipt(ExitPayload memory payload) internal pure returns (Receipt memory receipt) {\\n receipt.raw = payload.data[6].toBytes();\\n RLPReader.RLPItem memory receiptItem = receipt.raw.toRlpItem();\\n\\n if (receiptItem.isList()) {\\n // legacy tx\\n receipt.data = receiptItem.toList();\\n } else {\\n // pop first byte before parsting receipt\\n bytes memory typedBytes = receipt.raw;\\n bytes memory result = new bytes(typedBytes.length - 1);\\n uint256 srcPtr;\\n uint256 destPtr;\\n assembly {\\n srcPtr := add(33, typedBytes)\\n destPtr := add(0x20, result)\\n }\\n\\n copy(srcPtr, destPtr, result.length);\\n receipt.data = result.toRlpItem().toList();\\n }\\n\\n receipt.logIndex = getReceiptLogIndex(payload);\\n return receipt;\\n }\\n\\n function getReceiptProof(ExitPayload memory payload) internal pure returns (bytes memory) {\\n return payload.data[7].toBytes();\\n }\\n\\n function getBranchMaskAsBytes(ExitPayload memory payload) internal pure returns (bytes memory) {\\n return payload.data[8].toBytes();\\n }\\n\\n function getBranchMaskAsUint(ExitPayload memory payload) internal pure returns (uint256) {\\n return payload.data[8].toUint();\\n }\\n\\n function getReceiptLogIndex(ExitPayload memory payload) internal pure returns (uint256) {\\n return payload.data[9].toUint();\\n }\\n\\n // Receipt methods\\n function toBytes(Receipt memory receipt) internal pure returns (bytes memory) {\\n return receipt.raw;\\n }\\n\\n function getLog(Receipt memory receipt) internal pure returns (Log memory) {\\n RLPReader.RLPItem memory logData = receipt.data[3].toList()[receipt.logIndex];\\n return Log(logData, logData.toList());\\n }\\n\\n // Log methods\\n function getEmitter(Log memory log) internal pure returns (address) {\\n return RLPReader.toAddress(log.list[0]);\\n }\\n\\n function getTopics(Log memory log) internal pure returns (LogTopics memory) {\\n return LogTopics(log.list[1].toList());\\n }\\n\\n function getData(Log memory log) internal pure returns (bytes memory) {\\n return log.list[2].toBytes();\\n }\\n\\n function toRlpBytes(Log memory log) internal pure returns (bytes memory) {\\n return log.data.toRlpBytes();\\n }\\n\\n // LogTopics methods\\n function getField(LogTopics memory topics, uint256 index) internal pure returns (RLPReader.RLPItem memory) {\\n return topics.data[index];\\n }\\n}\\n\",\"keccak256\":\"0xe0a46b1a34ba0564638fb0b8d3c38b969dd6dcf8a84f7de935f18d9abbf3c584\"},\"@maticnetwork/fx-portal/contracts/lib/Merkle.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nlibrary Merkle {\\n function checkMembership(\\n bytes32 leaf,\\n uint256 index,\\n bytes32 rootHash,\\n bytes memory proof\\n ) internal pure returns (bool) {\\n require(proof.length % 32 == 0, \\\"Invalid proof length\\\");\\n uint256 proofHeight = proof.length / 32;\\n // Proof of size n means, height of the tree is n+1.\\n // In a tree of height n+1, max #leafs possible is 2 ^ n\\n require(index < 2**proofHeight, \\\"Leaf index is too big\\\");\\n\\n bytes32 proofElement;\\n bytes32 computedHash = leaf;\\n for (uint256 i = 32; i <= proof.length; i += 32) {\\n assembly {\\n proofElement := mload(add(proof, i))\\n }\\n\\n if (index % 2 == 0) {\\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\\n } else {\\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\\n }\\n\\n index = index / 2;\\n }\\n return computedHash == rootHash;\\n }\\n}\\n\",\"keccak256\":\"0x3efdfa22d02994bddb88a504ec63920018b912768ea1782f8dc09e70237060a8\",\"license\":\"MIT\"},\"@maticnetwork/fx-portal/contracts/lib/MerklePatriciaProof.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {RLPReader} from \\\"./RLPReader.sol\\\";\\n\\nlibrary MerklePatriciaProof {\\n /*\\n * @dev Verifies a merkle patricia proof.\\n * @param value The terminating value in the trie.\\n * @param encodedPath The path in the trie leading to value.\\n * @param rlpParentNodes The rlp encoded stack of nodes.\\n * @param root The root hash of the trie.\\n * @return The boolean validity of the proof.\\n */\\n function verify(\\n bytes memory value,\\n bytes memory encodedPath,\\n bytes memory rlpParentNodes,\\n bytes32 root\\n ) internal pure returns (bool) {\\n RLPReader.RLPItem memory item = RLPReader.toRlpItem(rlpParentNodes);\\n RLPReader.RLPItem[] memory parentNodes = RLPReader.toList(item);\\n\\n bytes memory currentNode;\\n RLPReader.RLPItem[] memory currentNodeList;\\n\\n bytes32 nodeKey = root;\\n uint256 pathPtr = 0;\\n\\n bytes memory path = _getNibbleArray(encodedPath);\\n if (path.length == 0) {\\n return false;\\n }\\n\\n for (uint256 i = 0; i < parentNodes.length; i++) {\\n if (pathPtr > path.length) {\\n return false;\\n }\\n\\n currentNode = RLPReader.toRlpBytes(parentNodes[i]);\\n if (nodeKey != keccak256(currentNode)) {\\n return false;\\n }\\n currentNodeList = RLPReader.toList(parentNodes[i]);\\n\\n if (currentNodeList.length == 17) {\\n if (pathPtr == path.length) {\\n if (keccak256(RLPReader.toBytes(currentNodeList[16])) == keccak256(value)) {\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n uint8 nextPathNibble = uint8(path[pathPtr]);\\n if (nextPathNibble > 16) {\\n return false;\\n }\\n nodeKey = bytes32(RLPReader.toUintStrict(currentNodeList[nextPathNibble]));\\n pathPtr += 1;\\n } else if (currentNodeList.length == 2) {\\n uint256 traversed = _nibblesToTraverse(RLPReader.toBytes(currentNodeList[0]), path, pathPtr);\\n if (pathPtr + traversed == path.length) {\\n //leaf node\\n if (keccak256(RLPReader.toBytes(currentNodeList[1])) == keccak256(value)) {\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n //extension node\\n if (traversed == 0) {\\n return false;\\n }\\n\\n pathPtr += traversed;\\n nodeKey = bytes32(RLPReader.toUintStrict(currentNodeList[1]));\\n } else {\\n return false;\\n }\\n }\\n }\\n\\n function _nibblesToTraverse(\\n bytes memory encodedPartialPath,\\n bytes memory path,\\n uint256 pathPtr\\n ) private pure returns (uint256) {\\n uint256 len = 0;\\n // encodedPartialPath has elements that are each two hex characters (1 byte), but partialPath\\n // and slicedPath have elements that are each one hex character (1 nibble)\\n bytes memory partialPath = _getNibbleArray(encodedPartialPath);\\n bytes memory slicedPath = new bytes(partialPath.length);\\n\\n // pathPtr counts nibbles in path\\n // partialPath.length is a number of nibbles\\n for (uint256 i = pathPtr; i < pathPtr + partialPath.length; i++) {\\n bytes1 pathNibble = path[i];\\n slicedPath[i - pathPtr] = pathNibble;\\n }\\n\\n if (keccak256(partialPath) == keccak256(slicedPath)) {\\n len = partialPath.length;\\n } else {\\n len = 0;\\n }\\n return len;\\n }\\n\\n // bytes b must be hp encoded\\n function _getNibbleArray(bytes memory b) internal pure returns (bytes memory) {\\n bytes memory nibbles = \\\"\\\";\\n if (b.length > 0) {\\n uint8 offset;\\n uint8 hpNibble = uint8(_getNthNibbleOfBytes(0, b));\\n if (hpNibble == 1 || hpNibble == 3) {\\n nibbles = new bytes(b.length * 2 - 1);\\n bytes1 oddNibble = _getNthNibbleOfBytes(1, b);\\n nibbles[0] = oddNibble;\\n offset = 1;\\n } else {\\n nibbles = new bytes(b.length * 2 - 2);\\n offset = 0;\\n }\\n\\n for (uint256 i = offset; i < nibbles.length; i++) {\\n nibbles[i] = _getNthNibbleOfBytes(i - offset + 2, b);\\n }\\n }\\n return nibbles;\\n }\\n\\n function _getNthNibbleOfBytes(uint256 n, bytes memory str) private pure returns (bytes1) {\\n return bytes1(n % 2 == 0 ? uint8(str[n / 2]) / 0x10 : uint8(str[n / 2]) % 0x10);\\n }\\n}\\n\",\"keccak256\":\"0xefa98466a4e3c85857cea4772f25f52ed61f2b90662fb6f67fb155455d644ffc\",\"license\":\"MIT\"},\"@maticnetwork/fx-portal/contracts/lib/RLPReader.sol\":{\"content\":\"/*\\n * @author Hamdi Allam hamdi.allam97@gmail.com\\n * Please reach out with any questions or concerns\\n */\\npragma solidity ^0.8.0;\\n\\nlibrary RLPReader {\\n uint8 constant STRING_SHORT_START = 0x80;\\n uint8 constant STRING_LONG_START = 0xb8;\\n uint8 constant LIST_SHORT_START = 0xc0;\\n uint8 constant LIST_LONG_START = 0xf8;\\n uint8 constant WORD_SIZE = 32;\\n\\n struct RLPItem {\\n uint256 len;\\n uint256 memPtr;\\n }\\n\\n struct Iterator {\\n RLPItem item; // Item that's being iterated over.\\n uint256 nextPtr; // Position of the next item in the list.\\n }\\n\\n /*\\n * @dev Returns the next element in the iteration. Reverts if it has not next element.\\n * @param self The iterator.\\n * @return The next element in the iteration.\\n */\\n function next(Iterator memory self) internal pure returns (RLPItem memory) {\\n require(hasNext(self));\\n\\n uint256 ptr = self.nextPtr;\\n uint256 itemLength = _itemLength(ptr);\\n self.nextPtr = ptr + itemLength;\\n\\n return RLPItem(itemLength, ptr);\\n }\\n\\n /*\\n * @dev Returns true if the iteration has more elements.\\n * @param self The iterator.\\n * @return true if the iteration has more elements.\\n */\\n function hasNext(Iterator memory self) internal pure returns (bool) {\\n RLPItem memory item = self.item;\\n return self.nextPtr < item.memPtr + item.len;\\n }\\n\\n /*\\n * @param item RLP encoded bytes\\n */\\n function toRlpItem(bytes memory item) internal pure returns (RLPItem memory) {\\n uint256 memPtr;\\n assembly {\\n memPtr := add(item, 0x20)\\n }\\n\\n return RLPItem(item.length, memPtr);\\n }\\n\\n /*\\n * @dev Create an iterator. Reverts if item is not a list.\\n * @param self The RLP item.\\n * @return An 'Iterator' over the item.\\n */\\n function iterator(RLPItem memory self) internal pure returns (Iterator memory) {\\n require(isList(self));\\n\\n uint256 ptr = self.memPtr + _payloadOffset(self.memPtr);\\n return Iterator(self, ptr);\\n }\\n\\n /*\\n * @param item RLP encoded bytes\\n */\\n function rlpLen(RLPItem memory item) internal pure returns (uint256) {\\n return item.len;\\n }\\n\\n /*\\n * @param item RLP encoded bytes\\n */\\n function payloadLen(RLPItem memory item) internal pure returns (uint256) {\\n return item.len - _payloadOffset(item.memPtr);\\n }\\n\\n /*\\n * @param item RLP encoded list in bytes\\n */\\n function toList(RLPItem memory item) internal pure returns (RLPItem[] memory) {\\n require(isList(item));\\n\\n uint256 items = numItems(item);\\n RLPItem[] memory result = new RLPItem[](items);\\n\\n uint256 memPtr = item.memPtr + _payloadOffset(item.memPtr);\\n uint256 dataLen;\\n for (uint256 i = 0; i < items; i++) {\\n dataLen = _itemLength(memPtr);\\n result[i] = RLPItem(dataLen, memPtr);\\n memPtr = memPtr + dataLen;\\n }\\n\\n return result;\\n }\\n\\n // @return indicator whether encoded payload is a list. negate this function call for isData.\\n function isList(RLPItem memory item) internal pure returns (bool) {\\n if (item.len == 0) return false;\\n\\n uint8 byte0;\\n uint256 memPtr = item.memPtr;\\n assembly {\\n byte0 := byte(0, mload(memPtr))\\n }\\n\\n if (byte0 < LIST_SHORT_START) return false;\\n return true;\\n }\\n\\n /*\\n * @dev A cheaper version of keccak256(toRlpBytes(item)) that avoids copying memory.\\n * @return keccak256 hash of RLP encoded bytes.\\n */\\n function rlpBytesKeccak256(RLPItem memory item) internal pure returns (bytes32) {\\n uint256 ptr = item.memPtr;\\n uint256 len = item.len;\\n bytes32 result;\\n assembly {\\n result := keccak256(ptr, len)\\n }\\n return result;\\n }\\n\\n function payloadLocation(RLPItem memory item) internal pure returns (uint256, uint256) {\\n uint256 offset = _payloadOffset(item.memPtr);\\n uint256 memPtr = item.memPtr + offset;\\n uint256 len = item.len - offset; // data length\\n return (memPtr, len);\\n }\\n\\n /*\\n * @dev A cheaper version of keccak256(toBytes(item)) that avoids copying memory.\\n * @return keccak256 hash of the item payload.\\n */\\n function payloadKeccak256(RLPItem memory item) internal pure returns (bytes32) {\\n (uint256 memPtr, uint256 len) = payloadLocation(item);\\n bytes32 result;\\n assembly {\\n result := keccak256(memPtr, len)\\n }\\n return result;\\n }\\n\\n /** RLPItem conversions into data types **/\\n\\n // @returns raw rlp encoding in bytes\\n function toRlpBytes(RLPItem memory item) internal pure returns (bytes memory) {\\n bytes memory result = new bytes(item.len);\\n if (result.length == 0) return result;\\n\\n uint256 ptr;\\n assembly {\\n ptr := add(0x20, result)\\n }\\n\\n copy(item.memPtr, ptr, item.len);\\n return result;\\n }\\n\\n // any non-zero byte is considered true\\n function toBoolean(RLPItem memory item) internal pure returns (bool) {\\n require(item.len == 1);\\n uint256 result;\\n uint256 memPtr = item.memPtr;\\n assembly {\\n result := byte(0, mload(memPtr))\\n }\\n\\n return result == 0 ? false : true;\\n }\\n\\n function toAddress(RLPItem memory item) internal pure returns (address) {\\n // 1 byte for the length prefix\\n require(item.len == 21);\\n\\n return address(uint160(toUint(item)));\\n }\\n\\n function toUint(RLPItem memory item) internal pure returns (uint256) {\\n require(item.len > 0 && item.len <= 33);\\n\\n uint256 offset = _payloadOffset(item.memPtr);\\n uint256 len = item.len - offset;\\n\\n uint256 result;\\n uint256 memPtr = item.memPtr + offset;\\n assembly {\\n result := mload(memPtr)\\n\\n // shfit to the correct location if neccesary\\n if lt(len, 32) {\\n result := div(result, exp(256, sub(32, len)))\\n }\\n }\\n\\n return result;\\n }\\n\\n // enforces 32 byte length\\n function toUintStrict(RLPItem memory item) internal pure returns (uint256) {\\n // one byte prefix\\n require(item.len == 33);\\n\\n uint256 result;\\n uint256 memPtr = item.memPtr + 1;\\n assembly {\\n result := mload(memPtr)\\n }\\n\\n return result;\\n }\\n\\n function toBytes(RLPItem memory item) internal pure returns (bytes memory) {\\n require(item.len > 0);\\n\\n uint256 offset = _payloadOffset(item.memPtr);\\n uint256 len = item.len - offset; // data length\\n bytes memory result = new bytes(len);\\n\\n uint256 destPtr;\\n assembly {\\n destPtr := add(0x20, result)\\n }\\n\\n copy(item.memPtr + offset, destPtr, len);\\n return result;\\n }\\n\\n /*\\n * Private Helpers\\n */\\n\\n // @return number of payload items inside an encoded list.\\n function numItems(RLPItem memory item) private pure returns (uint256) {\\n if (item.len == 0) return 0;\\n\\n uint256 count = 0;\\n uint256 currPtr = item.memPtr + _payloadOffset(item.memPtr);\\n uint256 endPtr = item.memPtr + item.len;\\n while (currPtr < endPtr) {\\n currPtr = currPtr + _itemLength(currPtr); // skip over an item\\n count++;\\n }\\n\\n return count;\\n }\\n\\n // @return entire rlp item byte length\\n function _itemLength(uint256 memPtr) private pure returns (uint256) {\\n uint256 itemLen;\\n uint256 byte0;\\n assembly {\\n byte0 := byte(0, mload(memPtr))\\n }\\n\\n if (byte0 < STRING_SHORT_START) itemLen = 1;\\n else if (byte0 < STRING_LONG_START) itemLen = byte0 - STRING_SHORT_START + 1;\\n else if (byte0 < LIST_SHORT_START) {\\n assembly {\\n let byteLen := sub(byte0, 0xb7) // # of bytes the actual length is\\n memPtr := add(memPtr, 1) // skip over the first byte\\n /* 32 byte word size */\\n let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to get the len\\n itemLen := add(dataLen, add(byteLen, 1))\\n }\\n } else if (byte0 < LIST_LONG_START) {\\n itemLen = byte0 - LIST_SHORT_START + 1;\\n } else {\\n assembly {\\n let byteLen := sub(byte0, 0xf7)\\n memPtr := add(memPtr, 1)\\n\\n let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to the correct length\\n itemLen := add(dataLen, add(byteLen, 1))\\n }\\n }\\n\\n return itemLen;\\n }\\n\\n // @return number of bytes until the data\\n function _payloadOffset(uint256 memPtr) private pure returns (uint256) {\\n uint256 byte0;\\n assembly {\\n byte0 := byte(0, mload(memPtr))\\n }\\n\\n if (byte0 < STRING_SHORT_START) return 0;\\n else if (byte0 < STRING_LONG_START || (byte0 >= LIST_SHORT_START && byte0 < LIST_LONG_START)) return 1;\\n else if (byte0 < LIST_SHORT_START)\\n // being explicit\\n return byte0 - (STRING_LONG_START - 1) + 1;\\n else return byte0 - (LIST_LONG_START - 1) + 1;\\n }\\n\\n /*\\n * @param src Pointer to source\\n * @param dest Pointer to destination\\n * @param len Amount of memory to copy from the source\\n */\\n function copy(\\n uint256 src,\\n uint256 dest,\\n uint256 len\\n ) private pure {\\n if (len == 0) return;\\n\\n // copy as many word sizes as possible\\n for (; len >= WORD_SIZE; len -= WORD_SIZE) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += WORD_SIZE;\\n dest += WORD_SIZE;\\n }\\n\\n if (len == 0) return;\\n\\n // left over bytes. Mask is used to remove unwanted bytes from the word\\n uint256 mask = 256**(WORD_SIZE - len) - 1;\\n\\n assembly {\\n let srcpart := and(mload(src), not(mask)) // zero out src\\n let destpart := and(mload(dest), mask) // retrieve the bytes\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x16e8cbf7c2a240044182576be529be0fa666ce0cdec46be3ff76d40491362a80\"},\"@maticnetwork/fx-portal/contracts/tunnel/FxBaseRootTunnel.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {RLPReader} from \\\"../lib/RLPReader.sol\\\";\\nimport {MerklePatriciaProof} from \\\"../lib/MerklePatriciaProof.sol\\\";\\nimport {Merkle} from \\\"../lib/Merkle.sol\\\";\\nimport \\\"../lib/ExitPayloadReader.sol\\\";\\n\\ninterface IFxStateSender {\\n function sendMessageToChild(address _receiver, bytes calldata _data) external;\\n}\\n\\ncontract ICheckpointManager {\\n struct HeaderBlock {\\n bytes32 root;\\n uint256 start;\\n uint256 end;\\n uint256 createdAt;\\n address proposer;\\n }\\n\\n /**\\n * @notice mapping of checkpoint header numbers to block details\\n * @dev These checkpoints are submited by plasma contracts\\n */\\n mapping(uint256 => HeaderBlock) public headerBlocks;\\n}\\n\\nabstract contract FxBaseRootTunnel {\\n using RLPReader for RLPReader.RLPItem;\\n using Merkle for bytes32;\\n using ExitPayloadReader for bytes;\\n using ExitPayloadReader for ExitPayloadReader.ExitPayload;\\n using ExitPayloadReader for ExitPayloadReader.Log;\\n using ExitPayloadReader for ExitPayloadReader.LogTopics;\\n using ExitPayloadReader for ExitPayloadReader.Receipt;\\n\\n // keccak256(MessageSent(bytes))\\n bytes32 public constant SEND_MESSAGE_EVENT_SIG = 0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036;\\n\\n // state sender contract\\n IFxStateSender public fxRoot;\\n // root chain manager\\n ICheckpointManager public checkpointManager;\\n // child tunnel contract which receives and sends messages\\n address public fxChildTunnel;\\n\\n // storage to avoid duplicate exits\\n mapping(bytes32 => bool) public processedExits;\\n\\n constructor(address _checkpointManager, address _fxRoot) {\\n checkpointManager = ICheckpointManager(_checkpointManager);\\n fxRoot = IFxStateSender(_fxRoot);\\n }\\n\\n // set fxChildTunnel if not set already\\n function setFxChildTunnel(address _fxChildTunnel) public virtual {\\n require(fxChildTunnel == address(0x0), \\\"FxBaseRootTunnel: CHILD_TUNNEL_ALREADY_SET\\\");\\n fxChildTunnel = _fxChildTunnel;\\n }\\n\\n /**\\n * @notice Send bytes message to Child Tunnel\\n * @param message bytes message that will be sent to Child Tunnel\\n * some message examples -\\n * abi.encode(tokenId);\\n * abi.encode(tokenId, tokenMetadata);\\n * abi.encode(messageType, messageData);\\n */\\n function _sendMessageToChild(bytes memory message) internal {\\n fxRoot.sendMessageToChild(fxChildTunnel, message);\\n }\\n\\n function _validateAndExtractMessage(bytes memory inputData) internal returns (bytes memory) {\\n ExitPayloadReader.ExitPayload memory payload = inputData.toExitPayload();\\n\\n bytes memory branchMaskBytes = payload.getBranchMaskAsBytes();\\n uint256 blockNumber = payload.getBlockNumber();\\n // checking if exit has already been processed\\n // unique exit is identified using hash of (blockNumber, branchMask, receiptLogIndex)\\n bytes32 exitHash = keccak256(\\n abi.encodePacked(\\n blockNumber,\\n // first 2 nibbles are dropped while generating nibble array\\n // this allows branch masks that are valid but bypass exitHash check (changing first 2 nibbles only)\\n // so converting to nibble array and then hashing it\\n MerklePatriciaProof._getNibbleArray(branchMaskBytes),\\n payload.getReceiptLogIndex()\\n )\\n );\\n require(processedExits[exitHash] == false, \\\"FxRootTunnel: EXIT_ALREADY_PROCESSED\\\");\\n processedExits[exitHash] = true;\\n\\n ExitPayloadReader.Receipt memory receipt = payload.getReceipt();\\n ExitPayloadReader.Log memory log = receipt.getLog();\\n\\n // check child tunnel\\n require(fxChildTunnel == log.getEmitter(), \\\"FxRootTunnel: INVALID_FX_CHILD_TUNNEL\\\");\\n\\n bytes32 receiptRoot = payload.getReceiptRoot();\\n // verify receipt inclusion\\n require(\\n MerklePatriciaProof.verify(receipt.toBytes(), branchMaskBytes, payload.getReceiptProof(), receiptRoot),\\n \\\"FxRootTunnel: INVALID_RECEIPT_PROOF\\\"\\n );\\n\\n // verify checkpoint inclusion\\n _checkBlockMembershipInCheckpoint(\\n blockNumber,\\n payload.getBlockTime(),\\n payload.getTxRoot(),\\n receiptRoot,\\n payload.getHeaderNumber(),\\n payload.getBlockProof()\\n );\\n\\n ExitPayloadReader.LogTopics memory topics = log.getTopics();\\n\\n require(\\n bytes32(topics.getField(0).toUint()) == SEND_MESSAGE_EVENT_SIG, // topic0 is event sig\\n \\\"FxRootTunnel: INVALID_SIGNATURE\\\"\\n );\\n\\n // received message data\\n bytes memory message = abi.decode(log.getData(), (bytes)); // event decodes params again, so decoding bytes to get message\\n return message;\\n }\\n\\n function _checkBlockMembershipInCheckpoint(\\n uint256 blockNumber,\\n uint256 blockTime,\\n bytes32 txRoot,\\n bytes32 receiptRoot,\\n uint256 headerNumber,\\n bytes memory blockProof\\n ) private view returns (uint256) {\\n (bytes32 headerRoot, uint256 startBlock, , uint256 createdAt, ) = checkpointManager.headerBlocks(headerNumber);\\n\\n require(\\n keccak256(abi.encodePacked(blockNumber, blockTime, txRoot, receiptRoot)).checkMembership(\\n blockNumber - startBlock,\\n headerRoot,\\n blockProof\\n ),\\n \\\"FxRootTunnel: INVALID_HEADER\\\"\\n );\\n return createdAt;\\n }\\n\\n /**\\n * @notice receive message from L2 to L1, validated by proof\\n * @dev This function verifies if the transaction actually happened on child chain\\n *\\n * @param inputData RLP encoded data of the reference tx containing following list of fields\\n * 0 - headerNumber - Checkpoint header block number containing the reference tx\\n * 1 - blockProof - Proof that the block header (in the child chain) is a leaf in the submitted merkle root\\n * 2 - blockNumber - Block number containing the reference tx on child chain\\n * 3 - blockTime - Reference tx block time\\n * 4 - txRoot - Transactions root of block\\n * 5 - receiptRoot - Receipts root of block\\n * 6 - receipt - Receipt of the reference transaction\\n * 7 - receiptProof - Merkle proof of the reference receipt\\n * 8 - branchMask - 32 bits denoting the path of receipt in merkle tree\\n * 9 - receiptLogIndex - Log Index to read from the receipt\\n */\\n function receiveMessage(bytes memory inputData) public virtual {\\n bytes memory message = _validateAndExtractMessage(inputData);\\n _processMessageFromChild(message);\\n }\\n\\n /**\\n * @notice Process message received from Child Tunnel\\n * @dev function needs to be implemented to handle message as per requirement\\n * This is called by onStateReceive function.\\n * Since it is called via a system call, any event will not be emitted during its execution.\\n * @param message bytes message that was sent from Child Tunnel\\n */\\n function _processMessageFromChild(bytes memory message) internal virtual;\\n}\\n\",\"keccak256\":\"0xd9ddea51d758d6406e10c35f10a150495cfcc90f9334e34755ce5de31b27d447\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Context_init_unchained();\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x9ffedb33e192f8821cbaead72596c79ea87fb28a73f8d3a9f5004449799f8e1b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the\\n * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() initializer {}\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n bool private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Modifier to protect an initializer function from being invoked twice.\\n */\\n modifier initializer() {\\n // If the contract is initializing we ignore whether _initialized is set in order to support multiple\\n // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the\\n // contract may have been reentered.\\n require(_initializing ? _isConstructor() : !_initialized, \\\"Initializable: contract is already initialized\\\");\\n\\n bool isTopLevelCall = !_initializing;\\n if (isTopLevelCall) {\\n _initializing = true;\\n _initialized = true;\\n }\\n\\n _;\\n\\n if (isTopLevelCall) {\\n _initializing = false;\\n }\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} modifier, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n function _isConstructor() private view returns (bool) {\\n return !AddressUpgradeable.isContract(address(this));\\n }\\n}\\n\",\"keccak256\":\"0x68861bcc80cacbd498efde75aab6c74a486cc48262660d326c8d7530d9752097\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n function __Pausable_init() internal onlyInitializing {\\n __Context_init_unchained();\\n __Pausable_init_unchained();\\n }\\n\\n function __Pausable_init_unchained() internal onlyInitializing {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n require(!paused(), \\\"Pausable: paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n require(paused(), \\\"Pausable: not paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xf93da311a3b34a8363a759c404d575746fa38351fb29ecd646c608e27219ebec\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3f0f878c796dfc7feba6d3c4e3e526c14c7deae8b7bfc71088e3f38fab0d77b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n __Context_init_unchained();\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x0b0d548f6381370d394f7a434f994dc678b3ef3e755de106109d61343a685ea7\",\"license\":\"MIT\"},\"src/solc_0.8/common/BaseWithStorage/ERC2771Handler.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// solhint-disable-next-line compiler-version\\npragma solidity 0.8.2;\\n\\n/**\\n * @title ERC2771Handler\\n * @author The Sandbox\\n * @notice Handle meta-transactions\\n * @dev minimal ERC2771 handler to keep bytecode-size down\\n * based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.6.0/contracts/metatx/ERC2771Context.sol\\n * with an initializer for proxies and a mutable forwarder\\n */\\nabstract contract ERC2771Handler {\\n address internal _trustedForwarder;\\n\\n event TrustedForwarderSet(address indexed newForwarder);\\n\\n /**\\n * @dev Initializes the contract\\n * @param forwarder trusted forwarder address\\n */\\n function __ERC2771Handler_initialize(address forwarder) internal {\\n _trustedForwarder = forwarder;\\n emit TrustedForwarderSet(_trustedForwarder);\\n }\\n\\n /**\\n * @notice Checks if an address is a trusted forwarder\\n * @param forwarder address to check\\n * @return is trusted\\n */\\n function isTrustedForwarder(address forwarder) public view returns (bool) {\\n return forwarder == _trustedForwarder;\\n }\\n\\n /**\\n * @notice Get the current trusted forwarder\\n * @return trustedForwarder address of the trusted forwarder\\n */\\n function getTrustedForwarder() external view returns (address) {\\n return _trustedForwarder;\\n }\\n\\n /**\\n * @dev if the call comes from the trusted forwarder, it gets the real sender by checking the encoded address in the data\\n * @return sender address of the real sender\\n */\\n function _msgSender() internal view virtual returns (address sender) {\\n if (isTrustedForwarder(msg.sender)) {\\n // The assembly code is more direct than the Solidity version using `abi.decode`.\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\\n }\\n } else {\\n return msg.sender;\\n }\\n }\\n\\n /**\\n * @dev if the call comes from the trusted forwarder, it substracts the sender address from `msg.data` to get the real `msg.data`\\n * @return the real `msg.data`\\n */\\n function _msgData() internal view virtual returns (bytes calldata) {\\n if (isTrustedForwarder(msg.sender)) {\\n return msg.data[:msg.data.length - 20];\\n } else {\\n return msg.data;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x33482ab5e863b2f5cc22fb9e77f8eff3484e08601326989da02ae1b147245669\",\"license\":\"MIT\"},\"src/solc_0.8/common/fx-portal/FxBaseRootTunnelUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\nimport {\\n FxBaseRootTunnel,\\n ICheckpointManager,\\n IFxStateSender\\n} from \\\"@maticnetwork/fx-portal/contracts/tunnel/FxBaseRootTunnel.sol\\\";\\n\\n/**\\n * @title FxBaseRootTunnelUpgradeable\\n * @author The Sandbox\\n * @dev Upgradeable version of the fx-portal tunnel for the root chain\\n */\\nabstract contract FxBaseRootTunnelUpgradeable is FxBaseRootTunnel {\\n // solhint-disable-next-line no-empty-blocks\\n constructor() FxBaseRootTunnel(address(0), address(0)) {}\\n\\n /**\\n * @dev Initializes the contract\\n * @param _checkpointManager checkpoint manager address\\n * @param _fxRoot state sender contract\\n */\\n function __FxBaseRootTunnelUpgradeable_initialize(address _checkpointManager, address _fxRoot) internal {\\n checkpointManager = ICheckpointManager(_checkpointManager);\\n fxRoot = IFxStateSender(_fxRoot);\\n }\\n\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0xa24cbb7992bf0f3b05463fbdef1c67cd141f12e854250546bbc181ae4cac7f80\",\"license\":\"MIT\"},\"src/solc_0.8/common/interfaces/IERC721MandatoryTokenReceiver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// solhint-disable-next-line compiler-version\\npragma solidity 0.8.2;\\n\\n/**\\n * @title IERC721MandatoryTokenReceiver\\n * @author The Sandbox\\n * @notice Interface for any contract that wants to support safeBatchTransfers\\n * from ERC721 asset contracts.\\n * @dev The ERC-165 identifier for this interface is 0x5e8bf644.\\n */\\ninterface IERC721MandatoryTokenReceiver {\\n /**\\n * @notice Whenever tokens are transferred to this contract via {IERC721-safeBatchTransferFrom}\\n * by `operator` from `from`, this function is called.\\n * @param operator sender\\n * @param from owner of the tokens\\n * @param ids token ids\\n * @param data extra data\\n * @return 0x4b808c46 if the transfer is a success\\n */\\n function onERC721BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) external returns (bytes4); // needs to return 0x4b808c46\\n\\n /**\\n * @notice Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n * @param operator sender\\n * @param from owner of the token\\n * @param tokenId token id\\n * @param data extra data\\n * @return 0x4b808c46 if the transfer is a success\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4); // needs to return 0x150b7a02\\n}\\n\",\"keccak256\":\"0x6e1235c041b7d8747fa458037006e8df72bea62474dd04977e210d19914b7f5d\",\"license\":\"MIT\"},\"src/solc_0.8/common/interfaces/ILandToken.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\n/// @title ILandToken\\n/// @author The Sandbox\\n/// @notice Interface of the LAND token including quad methods\\ninterface ILandToken {\\n /// @notice transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\\n /// @param from current owner of the quad\\n /// @param to destination\\n /// @param sizes list of sizes for each quad\\n /// @param xs list of bottom left x coordinates for each quad\\n /// @param ys list of bottom left y coordinates for each quad\\n /// @param data additional data\\n function batchTransferQuad(\\n address from,\\n address to,\\n uint256[] calldata sizes,\\n uint256[] calldata xs,\\n uint256[] calldata ys,\\n bytes calldata data\\n ) external;\\n\\n /// @notice transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\\n /// @param from current owner of the quad\\n /// @param to destination\\n /// @param size size of the quad\\n /// @param x The top left x coordinate of the quad\\n /// @param y The top left y coordinate of the quad\\n /// @param data additional data\\n function transferQuad(\\n address from,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes calldata data\\n ) external;\\n\\n /// @notice Transfer many tokens between 2 addresses.\\n /// @param from The sender of the token.\\n /// @param to The recipient of the token.\\n /// @param ids The ids of the tokens.\\n /// @param data Additional data.\\n function batchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x5df895e3442904d5f6a6ad3b4b34a2ec61d4a97a4b3feea57d5bb611d14a7e3e\",\"license\":\"MIT\"},\"src/solc_0.8/common/interfaces/ILandTokenV2.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\nimport \\\"./ILandToken.sol\\\";\\n\\n/**\\n * @title ILandTokenV2\\n * @author The Sandbox\\n * @notice Interface of the LAND token including quad methods\\n */\\ninterface ILandTokenV2 is ILandToken {\\n /**\\n * @notice Checks if an address if an operator\\n * @param who address checked\\n * @return is it super operator\\n */\\n function isSuperOperator(address who) external view returns (bool);\\n\\n /**\\n * @notice Checks if a LAND exists by its coordinates\\n * @param size size of the quad\\n * @param x x coordinate\\n * @param y y coordinate\\n * @return does the LAND exist\\n */\\n function exists(\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) external view returns (bool);\\n\\n /**\\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\\n * @param to The recipient of the new quad\\n * @param size The size of the new quad\\n * @param x The top left x coordinate of the new quad\\n * @param y The top left y coordinate of the new quad\\n * @param data extra data to pass to the transfer\\n */\\n function mintQuad(\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @notice Checks if a parent quad has child quads already minted.\\n * Then mints the rest child quads and transfers the parent quad.\\n * Should only be called by the tunnel.\\n * @param to The recipient of the new quad\\n * @param size The size of the new quad\\n * @param x The top left x coordinate of the new quad\\n * @param y The top left y coordinate of the new quad\\n * @param data extra data to pass to the transfer\\n */\\n function mintAndTransferQuad(\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x09348fc27347b208119344c098526fe7d23fb69812cfbbc44294c25230a38e6c\",\"license\":\"MIT\"},\"src/solc_0.8/polygon/root/land/LandTunnelV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\nimport {\\n OwnableUpgradeable,\\n ContextUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {PausableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\\\";\\nimport {FxBaseRootTunnelUpgradeable} from \\\"../../../common/fx-portal/FxBaseRootTunnelUpgradeable.sol\\\";\\nimport {ERC2771Handler} from \\\"../../../common/BaseWithStorage/ERC2771Handler.sol\\\";\\nimport {ILandTokenV2} from \\\"../../../common/interfaces/ILandTokenV2.sol\\\";\\nimport {IERC721MandatoryTokenReceiver} from \\\"../../../common/interfaces/IERC721MandatoryTokenReceiver.sol\\\";\\n\\n/// @title LandTunnelV2\\n/// @author The Sandbox\\n/// @notice LAND tunnel on the root chain\\ncontract LandTunnelV2 is\\n FxBaseRootTunnelUpgradeable,\\n IERC721MandatoryTokenReceiver,\\n ERC2771Handler,\\n OwnableUpgradeable,\\n PausableUpgradeable\\n{\\n ILandTokenV2 public rootToken;\\n bool internal transferringToL2;\\n\\n event Deposit(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\\n event Withdraw(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\\n\\n /// @notice Initializes the contract\\n /// @param _checkpointManager checkpoint manager address\\n /// @param _fxRoot state sender contract\\n /// @param _rootToken LAND token on the root chain\\n /// @param _trustedForwarder trusted forwarder for meta-tx\\n function initialize(\\n address _checkpointManager,\\n address _fxRoot,\\n ILandTokenV2 _rootToken,\\n address _trustedForwarder\\n ) public initializer {\\n rootToken = _rootToken;\\n __Ownable_init();\\n __Pausable_init();\\n __FxBaseRootTunnelUpgradeable_initialize(_checkpointManager, _fxRoot);\\n __ERC2771Handler_initialize(_trustedForwarder);\\n }\\n\\n /// @dev called on ERC721 transfer to this contract\\n /// @param operator address of the one sending the ERC721 Token\\n /// @return onERC721Received function selector\\n function onERC721Received(\\n address operator,\\n address, /* from */\\n uint256, /* tokenId */\\n bytes calldata /* data */\\n ) external view override returns (bytes4) {\\n require(transferringToL2 || rootToken.isSuperOperator(operator), \\\"LandTunnelV2: !BRIDGING\\\");\\n return this.onERC721Received.selector;\\n }\\n\\n /// @dev called on ERC721 batch transfer to this contract\\n /// @param operator address of the one sending the ERC721 Token\\n /// @return onERC721BatchReceived function selector\\n function onERC721BatchReceived(\\n address operator,\\n address, /* from */\\n uint256[] calldata, /* ids */\\n bytes calldata /* data */\\n ) external view override returns (bytes4) {\\n require(transferringToL2 || rootToken.isSuperOperator(operator), \\\"LandTunnelV2: !BRIDGING\\\");\\n return this.onERC721BatchReceived.selector;\\n }\\n\\n /// @dev to be called by external contact to check if this contract supports ERC721 token and batch token receive\\n /// @param interfaceId the interface to be checked if supported by the contract\\n /// @return 0x5e8bf644 is the interface of IERC721MandatoryTokenReceiver and 0x01ffc9a7 for the Eip 165 supports interface's interface id\\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\\n return interfaceId == 0x5e8bf644 || interfaceId == 0x01ffc9a7;\\n }\\n\\n /// @notice Send a batch of quads to L2\\n /// @param to address of the receiver on L2\\n /// @param sizes sizes of quad\\n /// @param xs x coordinates of quads\\n /// @param ys y coordinates of quads\\n /// @param data data send to the receiver onERC721BatchReceived on L1\\n function batchTransferQuadToL2(\\n address to,\\n uint256[] memory sizes,\\n uint256[] memory xs,\\n uint256[] memory ys,\\n bytes memory data\\n ) external whenNotPaused() {\\n require(to != address(0), \\\"LandTunnelV2: can't send to zero address\\\");\\n require(sizes.length == xs.length, \\\"LandTunnelV2: sizes's and x's length are different\\\");\\n require(xs.length == ys.length, \\\"LandTunnelV2: x's and y's length are different\\\");\\n transferringToL2 = true;\\n rootToken.batchTransferQuad(_msgSender(), address(this), sizes, xs, ys, data);\\n transferringToL2 = false;\\n for (uint256 index = 0; index < sizes.length; index++) {\\n bytes memory message = abi.encode(to, sizes[index], xs[index], ys[index], data);\\n _sendMessageToChild(message);\\n emit Deposit(to, sizes[index], xs[index], ys[index], data);\\n }\\n }\\n\\n /// @notice sets the fx-child tunnel\\n /// @dev only owner can call this funtion\\n /// @param _fxChildTunnel address of the fx-child tunnel\\n function setFxChildTunnel(address _fxChildTunnel) public override onlyOwner {\\n super.setFxChildTunnel(_fxChildTunnel);\\n }\\n\\n /// @dev Change the address of the trusted forwarder for meta-TX\\n /// @param trustedForwarder The new trustedForwarder\\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\\n _trustedForwarder = trustedForwarder;\\n\\n emit TrustedForwarderSet(trustedForwarder);\\n }\\n\\n /// @dev Pauses all token transfers across bridge\\n function pause() external onlyOwner {\\n _pause();\\n }\\n\\n /// @dev Unpauses all token transfers across bridge\\n function unpause() external onlyOwner {\\n _unpause();\\n }\\n\\n function _processMessageFromChild(bytes memory message) internal override {\\n (address to, uint256[] memory size, uint256[] memory x, uint256[] memory y, bytes memory data) =\\n abi.decode(message, (address, uint256[], uint256[], uint256[], bytes));\\n for (uint256 index = 0; index < x.length; index++) {\\n rootToken.mintAndTransferQuad(to, size[index], x[index], y[index], data);\\n emit Withdraw(to, size[index], x[index], y[index], data);\\n }\\n }\\n\\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address) {\\n return ERC2771Handler._msgSender();\\n }\\n\\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\\n return ERC2771Handler._msgData();\\n }\\n\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x56214d4ae17ee319559732f605513ef261076689a53eb9b98fab01a04fb25f6a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50600180546001600160a01b0319908116909155600080549091169055613ae28061003c6000396000f3fe608060405234801561001057600080fd5b50600436106101825760003560e01c80638da5cb5b116100d8578063ce1b815f1161008c578063f2fde38b11610066578063f2fde38b14610361578063f8c8765e14610374578063f953cec71461038757610182565b8063ce1b815f1461032a578063da7422281461033b578063de9b771f1461034e57610182565b8063aea4e49e116100bd578063aea4e49e146102f1578063c0857ba014610304578063c4d168d61461031757610182565b80638da5cb5b146102cd578063972c4928146102de57610182565b80634b808c461161013a578063607f2d4211610114578063607f2d421461029a578063715018a6146102bd5780638456cb59146102c557610182565b80634b808c461461025d578063572b6c05146102705780635c975abb1461029257610182565b8063150b7a021161016b578063150b7a02146101e45780631f2d0065146102285780633f4ba83a1461025357610182565b806301ffc9a7146101875780630e387de6146101af575b600080fd5b61019a61019536600461356d565b61039a565b60405190151581526020015b60405180910390f35b6101d67f8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b03681565b6040519081526020016101a6565b6101f76101f23660046133ca565b610435565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016101a6565b60cd5461023b906001600160a01b031681565b6040516001600160a01b0390911681526020016101a6565b61025b61055d565b005b6101f761026b3660046132b0565b6105e0565b61019a61027e3660046131d8565b6036546001600160a01b0390811691161490565b61019a610704565b61019a6102a8366004613509565b60036020526000908152604090205460ff1681565b61025b61070e565b61025b610791565b6069546001600160a01b031661023b565b60025461023b906001600160a01b031681565b61025b6102ff3660046131d8565b610812565b60015461023b906001600160a01b031681565b61025b61032536600461343b565b610897565b6036546001600160a01b031661023b565b61025b6103493660046131d8565b610caa565b60005461023b906001600160a01b031681565b61025b61036f3660046131d8565b610d7a565b61025b61038236600461336f565b610e78565b61025b6103953660046135ad565b611036565b60007f5e8bf644000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316148061042d57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b90505b919050565b60cd54600090600160a01b900460ff16806104e1575060cd546040517f654b748a0000000000000000000000000000000000000000000000000000000081526001600160a01b0388811660048301529091169063654b748a9060240160206040518083038186803b1580156104a957600080fd5b505afa1580156104bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e191906134e9565b6105325760405162461bcd60e51b815260206004820152601760248201527f4c616e6454756e6e656c56323a20214252494447494e4700000000000000000060448201526064015b60405180910390fd5b507f150b7a020000000000000000000000000000000000000000000000000000000095945050505050565b610565611050565b6001600160a01b03166105806069546001600160a01b031690565b6001600160a01b0316146105d65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610529565b6105de61105f565b565b60cd54600090600160a01b900460ff168061068c575060cd546040517f654b748a0000000000000000000000000000000000000000000000000000000081526001600160a01b0389811660048301529091169063654b748a9060240160206040518083038186803b15801561065457600080fd5b505afa158015610668573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068c91906134e9565b6106d85760405162461bcd60e51b815260206004820152601760248201527f4c616e6454756e6e656c56323a20214252494447494e470000000000000000006044820152606401610529565b507f4b808c46000000000000000000000000000000000000000000000000000000009695505050505050565b609b5460ff165b90565b610716611050565b6001600160a01b03166107316069546001600160a01b031690565b6001600160a01b0316146107875760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610529565b6105de6000611103565b610799611050565b6001600160a01b03166107b46069546001600160a01b031690565b6001600160a01b03161461080a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610529565b6105de611162565b61081a611050565b6001600160a01b03166108356069546001600160a01b031690565b6001600160a01b03161461088b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610529565b610894816111ed565b50565b61089f610704565b156108ec5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610529565b6001600160a01b0385166109685760405162461bcd60e51b815260206004820152602860248201527f4c616e6454756e6e656c56323a2063616e27742073656e6420746f207a65726f60448201527f20616464726573730000000000000000000000000000000000000000000000006064820152608401610529565b82518451146109df5760405162461bcd60e51b815260206004820152603260248201527f4c616e6454756e6e656c56323a2073697a6573277320616e6420782773206c6560448201527f6e6774682061726520646966666572656e7400000000000000000000000000006064820152608401610529565b8151835114610a565760405162461bcd60e51b815260206004820152602e60248201527f4c616e6454756e6e656c56323a2078277320616e6420792773206c656e67746860448201527f2061726520646966666572656e740000000000000000000000000000000000006064820152608401610529565b60cd80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b17908190556001600160a01b031663eaa5e067610a9c611050565b30878787876040518763ffffffff1660e01b8152600401610ac2969594939291906136a6565b600060405180830381600087803b158015610adc57600080fd5b505af1158015610af0573d6000803e3d6000fd5b505060cd80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16905550600090505b8451811015610ca257600086868381518110610b4c57634e487b7160e01b600052603260045260246000fd5b6020026020010151868481518110610b7457634e487b7160e01b600052603260045260246000fd5b6020026020010151868581518110610b9c57634e487b7160e01b600052603260045260246000fd5b602002602001015186604051602001610bb995949392919061372e565b6040516020818303038152906040529050610bd38161129b565b866001600160a01b03167f86beac9ed9e1aa4efb77b948567a4c352c177bb58b134f4c9d0d92c2c8ffbfb1878481518110610c1e57634e487b7160e01b600052603260045260246000fd5b6020026020010151878581518110610c4657634e487b7160e01b600052603260045260246000fd5b6020026020010151878681518110610c6e57634e487b7160e01b600052603260045260246000fd5b602002602001015187604051610c87949392919061376d565b60405180910390a25080610c9a81613a04565b915050610b20565b505050505050565b610cb2611050565b6001600160a01b0316610ccd6069546001600160a01b031690565b6001600160a01b031614610d235760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610529565b6036805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517fd91237492a9e30cd2faf361fc103998a382ff0ec2b1b07dc1cbebb76ae2f1ea290600090a250565b610d82611050565b6001600160a01b0316610d9d6069546001600160a01b031690565b6001600160a01b031614610df35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610529565b6001600160a01b038116610e6f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610529565b61089481611103565b603654600160a81b900460ff16610e9c57603654600160a01b900460ff1615610ea0565b303b155b610f125760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610529565b603654600160a81b900460ff16158015610f7f57603680547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff909116600160a81b1716600160a01b1790555b60cd805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038516179055610faf611318565b610fb7611395565b610ff78585600180546001600160a01b0393841673ffffffffffffffffffffffffffffffffffffffff199182161790915560008054929093169116179055565b61100082611412565b801561102f57603680547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff1690555b5050505050565b60006110418261146f565b905061104c816117a0565b5050565b600061105a61198d565b905090565b611067610704565b6110b35760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610529565b609b805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6110e6611050565b6040516001600160a01b03909116815260200160405180910390a1565b606980546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61116a610704565b156111b75760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610529565b609b805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586110e6611050565b6002546001600160a01b03161561126c5760405162461bcd60e51b815260206004820152602a60248201527f467842617365526f6f7454756e6e656c3a204348494c445f54554e4e454c5f4160448201527f4c52454144595f534554000000000000000000000000000000000000000000006064820152608401610529565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546002546040517fb47204770000000000000000000000000000000000000000000000000000000081526001600160a01b039283169263b4720477926112ea92911690859060040161370c565b600060405180830381600087803b15801561130457600080fd5b505af115801561102f573d6000803e3d6000fd5b603654600160a81b900460ff166113855760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610529565b61138d6119d7565b6105de611a44565b603654600160a81b900460ff166114025760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610529565b61140a6119d7565b6105de611ac1565b6036805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383811691909117918290556040519116907fd91237492a9e30cd2faf361fc103998a382ff0ec2b1b07dc1cbebb76ae2f1ea290600090a250565b6060600061147c83611b3a565b9050600061148982611b99565b9050600061149683611bd0565b90506000816114a484611c07565b6114ad86611e2d565b6040516020016114bf93929190613679565b60408051601f1981840301815291815281516020928301206000818152600390935291205490915060ff161561155c5760405162461bcd60e51b8152602060048201526024808201527f4678526f6f7454756e6e656c3a20455849545f414c52454144595f50524f434560448201527f53534544000000000000000000000000000000000000000000000000000000006064820152608401610529565b6000818152600360205260408120805460ff1916600117905561157e85611e57565b9050600061158b82611fbd565b905061159681612069565b6002546001600160a01b039081169116146116195760405162461bcd60e51b815260206004820152602560248201527f4678526f6f7454756e6e656c3a20494e56414c49445f46585f4348494c445f5460448201527f554e4e454c0000000000000000000000000000000000000000000000000000006064820152608401610529565b6000611624876120a0565b9050611644611634846020015190565b8761163e8a6120ca565b846120f4565b6116b65760405162461bcd60e51b815260206004820152602360248201527f4678526f6f7454756e6e656c3a20494e56414c49445f524543454950545f505260448201527f4f4f4600000000000000000000000000000000000000000000000000000000006064820152608401610529565b6116e4856116c38961241b565b6116cc8a612445565b846116d68c61246f565b6116df8d612499565b6124c3565b5060006116f083612611565b90507f8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b03661172661172183600061265b565b6126a1565b146117735760405162461bcd60e51b815260206004820152601f60248201527f4678526f6f7454756e6e656c3a20494e56414c49445f5349474e4154555245006044820152606401610529565b600061177e8461271c565b80602001905181019061179191906135e0565b9b9a5050505050505050505050565b6000806000806000858060200190518101906117bc91906131f4565b9450945094509450945060005b83518110156119845760cd5485516001600160a01b0390911690634e6a0f4490889088908590811061180b57634e487b7160e01b600052603260045260246000fd5b602002602001015187858151811061183357634e487b7160e01b600052603260045260246000fd5b602002602001015187868151811061185b57634e487b7160e01b600052603260045260246000fd5b6020026020010151876040518663ffffffff1660e01b815260040161188495949392919061372e565b600060405180830381600087803b15801561189e57600080fd5b505af11580156118b2573d6000803e3d6000fd5b50505050856001600160a01b03167f91ee42a3ae048785d7370790775b6bf02c58c5d7bfb5de80f6d7cb27e46a207e86838151811061190157634e487b7160e01b600052603260045260246000fd5b602002602001015186848151811061192957634e487b7160e01b600052603260045260246000fd5b602002602001015186858151811061195157634e487b7160e01b600052603260045260246000fd5b60200260200101518660405161196a949392919061376d565b60405180910390a28061197c81613a04565b9150506117c9565b50505050505050565b6036546000906001600160a01b03163314156119d057507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c61070b565b503361070b565b603654600160a81b900460ff166105de5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610529565b603654600160a81b900460ff16611ab15760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610529565b6105de611abc611050565b611103565b603654600160a81b900460ff16611b2e5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610529565b609b805460ff19169055565b6040805160208101909152606081526000611b84611b7f8460408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b612746565b60408051602081019091529081529392505050565b606061042d8260000151600881518110611bc357634e487b7160e01b600052603260045260246000fd5b6020026020010151612878565b600061042d8260000151600281518110611bfa57634e487b7160e01b600052603260045260246000fd5b60200260200101516126a1565b6040805160208101909152600081528151606091901561042d57600080611c2f600086612923565b60f81c90506001811480611c4657508060ff166003145b15611d2257600185516002611c5b919061397b565b611c65919061399a565b67ffffffffffffffff811115611c8b57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611cb5576020820181803683370190505b5092506000611cc5600187612923565b90508084600081518110611ce957634e487b7160e01b600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506001925050611d94565b600285516002611d32919061397b565b611d3c919061399a565b67ffffffffffffffff811115611d6257634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611d8c576020820181803683370190505b509250600091505b60ff82165b8351811015611e2457611dc3611db260ff85168361399a565b611dbd906002613819565b87612923565b848281518110611de357634e487b7160e01b600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080611e1c81613a04565b915050611d99565b50505092915050565b600061042d8260000151600981518110611bfa57634e487b7160e01b600052603260045260246000fd5b611e7b60405180606001604052806060815260200160608152602001600081525090565b611ea38260000151600681518110611bc357634e487b7160e01b600052603260045260246000fd5b602082810182905260408051808201825260008082529083015280518082019091528251815291810190820152611ed9816129c0565b15611eee57611ee781612746565b8252611fa9565b60208201518051600090611f049060019061399a565b67ffffffffffffffff811115611f2a57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611f54576020820181803683370190505b509050600080836021019150826020019050611f72828285516129fa565b604080518082018252600080825260209182015281518083019092528451825280850190820152611fa290611b7f565b8652505050505b611fb283611e2d565b604083015250919050565b604080516080810182526000918101828152606080830193909352815260208101919091526000612019836000015160038151811061200c57634e487b7160e01b600052603260045260246000fd5b6020026020010151612746565b83604001518151811061203c57634e487b7160e01b600052603260045260246000fd5b60200260200101519050604051806040016040528082815260200161206083612746565b90529392505050565b600061042d826020015160008151811061209357634e487b7160e01b600052603260045260246000fd5b6020026020010151612a7e565b600061042d8260000151600581518110611bfa57634e487b7160e01b600052603260045260246000fd5b606061042d8260000151600781518110611bc357634e487b7160e01b600052603260045260246000fd5b6000806121288460408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b9050600061213582612746565b9050606080856000806121478b611c07565b9050805160001415612163576000975050505050505050612413565b60005b865181101561240a57815183111561218957600098505050505050505050612413565b6121b98782815181106121ac57634e487b7160e01b600052603260045260246000fd5b6020026020010151612a98565b9550858051906020012084146121da57600098505050505050505050612413565b6121fd87828151811061200c57634e487b7160e01b600052603260045260246000fd5b94508451601114156122fc57815183141561226d578c8051906020012061223e86601081518110611bc357634e487b7160e01b600052603260045260246000fd5b80519060200120141561225c57600198505050505050505050612413565b600098505050505050505050612413565b600082848151811061228f57634e487b7160e01b600052603260045260246000fd5b016020015160f81c905060108111156122b45760009950505050505050505050612413565b6122e7868260ff16815181106122da57634e487b7160e01b600052603260045260246000fd5b6020026020010151612b27565b94506122f4600185613819565b9350506123f8565b84516002141561225c57600061233661232f87600081518110611bc357634e487b7160e01b600052603260045260246000fd5b8486612b55565b83519091506123458286613819565b14156123a8578d8051906020012061237787600181518110611bc357634e487b7160e01b600052603260045260246000fd5b8051906020012014156123965760019950505050505050505050612413565b60009950505050505050505050612413565b806123bf5760009950505050505050505050612413565b6123c98185613819565b93506123ef866001815181106122da57634e487b7160e01b600052603260045260246000fd5b94506123f89050565b8061240281613a04565b915050612166565b50505050505050505b949350505050565b600061042d8260000151600381518110611bfa57634e487b7160e01b600052603260045260246000fd5b600061042d8260000151600481518110611bfa57634e487b7160e01b600052603260045260246000fd5b600061042d8260000151600081518110611bfa57634e487b7160e01b600052603260045260246000fd5b606061042d8260000151600181518110611bc357634e487b7160e01b600052603260045260246000fd5b6001546040517f41539d4a000000000000000000000000000000000000000000000000000000008152600481018490526000918291829182916001600160a01b03909116906341539d4a9060240160a06040518083038186803b15801561252957600080fd5b505afa15801561253d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125619190613521565b50935050925092506125b8828b612578919061399a565b6040805160208082018f90528183018e9052606082018d905260808083018d90528351808403909101815260a09092019092528051910120908588612cba565b6126045760405162461bcd60e51b815260206004820152601c60248201527f4678526f6f7454756e6e656c3a20494e56414c49445f484541444552000000006044820152606401610529565b9998505050505050505050565b6040805160208101909152606081526040518060200160405280612653846020015160018151811061200c57634e487b7160e01b600052603260045260246000fd5b905292915050565b6040805180820190915260008082526020820152825180518390811061269157634e487b7160e01b600052603260045260246000fd5b6020026020010151905092915050565b8051600090158015906126b657508151602110155b6126bf57600080fd5b60006126ce8360200151612e30565b905060008184600001516126e2919061399a565b90506000808386602001516126f79190613819565b905080519150602083101561271357826020036101000a820491505b50949350505050565b606061042d8260200151600281518110611bc357634e487b7160e01b600052603260045260246000fd5b6060612751826129c0565b61275a57600080fd5b600061276583612eb5565b905060008167ffffffffffffffff81111561279057634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156127d557816020015b60408051808201909152600080825260208201528152602001906001900390816127ae5790505b50905060006127e78560200151612e30565b85602001516127f69190613819565b90506000805b8481101561286d5761280d83612f38565b915060405180604001604052808381526020018481525084828151811061284457634e487b7160e01b600052603260045260246000fd5b60209081029190910101526128598284613819565b92508061286581613a04565b9150506127fc565b509195945050505050565b805160609061288657600080fd5b60006128958360200151612e30565b905060008184600001516128a9919061399a565b905060008167ffffffffffffffff8111156128d457634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156128fe576020820181803683370190505b509050600081602001905061271384876020015161291c9190613819565b8285612ffa565b6000612930600284613a1f565b1561297857601082612943600286613831565b8151811061296157634e487b7160e01b600052603260045260246000fd5b0160200151612973919060f81c613a33565b6129b6565b601082612986600286613831565b815181106129a457634e487b7160e01b600052603260045260246000fd5b01602001516129b6919060f81c613845565b60f81b9392505050565b80516000906129d157506000610430565b6020820151805160001a9060c08210156129f057600092505050610430565b5060019392505050565b80612a0457612a79565b60208110612a3c5782518252612a1b602084613819565b9250612a28602083613819565b9150612a3560208261399a565b9050612a04565b80612a4657612a79565b60006001612a5583602061399a565b612a61906101006138ad565b612a6b919061399a565b845184518216911916178352505b505050565b8051600090601514612a8f57600080fd5b61042d826126a1565b60606000826000015167ffffffffffffffff811115612ac757634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612af1576020820181803683370190505b509050805160001415612b05579050610430565b6000816020019050612b208460200151828660000151612ffa565b5092915050565b8051600090602114612b3857600080fd5b60008083602001516001612b4c9190613819565b51949350505050565b60008080612b6286611c07565b90506000815167ffffffffffffffff811115612b8e57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612bb8576020820181803683370190505b509050845b8251612bc99087613819565b811015612c88576000878281518110612bf257634e487b7160e01b600052603260045260246000fd5b01602001517fff000000000000000000000000000000000000000000000000000000000000001690508083612c27898561399a565b81518110612c4557634e487b7160e01b600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350508080612c8090613a04565b915050612bbd565b50808051906020012082805190602001201415612ca85781519250612cad565b600092505b50909150505b9392505050565b600060208251612cca9190613a1f565b15612d175760405162461bcd60e51b815260206004820152601460248201527f496e76616c69642070726f6f66206c656e6774680000000000000000000000006044820152606401610529565b600060208351612d279190613831565b9050612d348160026138ad565b8510612d825760405162461bcd60e51b815260206004820152601560248201527f4c65616620696e64657820697320746f6f2062696700000000000000000000006044820152606401610529565b60008660205b85518111612e2257858101519250612da1600289613a1f565b612dd6576040805160208101849052908101849052606001604051602081830303815290604052805190602001209150612e03565b60408051602081018590529081018390526060016040516020818303038152906040528051906020012091505b612e0e600289613831565b9750612e1b602082613819565b9050612d88565b509094149695505050505050565b8051600090811a6080811015612e4a576000915050610430565b60b8811080612e65575060c08110801590612e65575060f881105b15612e74576001915050610430565b60c0811015612ea957612e89600160b86139b1565b612e969060ff168261399a565b612ea1906001613819565b915050610430565b612e89600160f86139b1565b8051600090612ec657506000610430565b600080612ed68460200151612e30565b8460200151612ee59190613819565b9050600084600001518560200151612efd9190613819565b90505b80821015612f2f57612f1182612f38565b612f1b9083613819565b915082612f2781613a04565b935050612f00565b50909392505050565b80516000908190811a6080811015612f535760019150612b20565b60b8811015612f7957612f6760808261399a565b612f72906001613819565b9150612b20565b60c0811015612fa65760b78103600185019450806020036101000a85510460018201810193505050612b20565b60f8811015612fba57612f6760c08261399a565b60019390930151602084900360f7016101000a90049092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0a0192915050565b8061300457612a79565b60208110612a3c578251825261301b602084613819565b9250613028602083613819565b915061303560208261399a565b9050613004565b600082601f83011261304c578081fd5b8135602061306161305c836137cd565b61379c565b828152818101908583018385028701840188101561307d578586fd5b855b8581101561309b5781358452928401929084019060010161307f565b5090979650505050505050565b600082601f8301126130b8578081fd5b815160206130c861305c836137cd565b82815281810190858301838502870184018810156130e4578586fd5b855b8581101561309b578151845292840192908401906001016130e6565b60008083601f840112613113578182fd5b50813567ffffffffffffffff81111561312a578182fd5b60208301915083602082850101111561314257600080fd5b9250929050565b600082601f830112613159578081fd5b813561316761305c826137f1565b81815284602083860101111561317b578283fd5b816020850160208301379081016020019190915292915050565b600082601f8301126131a5578081fd5b81516131b361305c826137f1565b8181528460208386010111156131c7578283fd5b6124138260208301602087016139d4565b6000602082840312156131e9578081fd5b8135612cb381613a97565b600080600080600060a0868803121561320b578081fd5b855161321681613a97565b602087015190955067ffffffffffffffff80821115613233578283fd5b61323f89838a016130a8565b95506040880151915080821115613254578283fd5b61326089838a016130a8565b94506060880151915080821115613275578283fd5b61328189838a016130a8565b93506080880151915080821115613296578283fd5b506132a388828901613195565b9150509295509295909350565b600080600080600080608087890312156132c8578081fd5b86356132d381613a97565b955060208701356132e381613a97565b9450604087013567ffffffffffffffff808211156132ff578283fd5b818901915089601f830112613312578283fd5b813581811115613320578384fd5b8a60208083028501011115613333578384fd5b602083019650809550506060890135915080821115613350578283fd5b5061335d89828a01613102565b979a9699509497509295939492505050565b60008060008060808587031215613384578384fd5b843561338f81613a97565b9350602085013561339f81613a97565b925060408501356133af81613a97565b915060608501356133bf81613a97565b939692955090935050565b6000806000806000608086880312156133e1578283fd5b85356133ec81613a97565b945060208601356133fc81613a97565b935060408601359250606086013567ffffffffffffffff81111561341e578182fd5b61342a88828901613102565b969995985093965092949392505050565b600080600080600060a08688031215613452578283fd5b853561345d81613a97565b9450602086013567ffffffffffffffff80821115613479578485fd5b61348589838a0161303c565b9550604088013591508082111561349a578485fd5b6134a689838a0161303c565b945060608801359150808211156134bb578283fd5b6134c789838a0161303c565b935060808801359150808211156134dc578283fd5b506132a388828901613149565b6000602082840312156134fa578081fd5b81518015158114612cb3578182fd5b60006020828403121561351a578081fd5b5035919050565b600080600080600060a08688031215613538578283fd5b85519450602086015193506040860151925060608601519150608086015161355f81613a97565b809150509295509295909350565b60006020828403121561357e578081fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114612cb3578182fd5b6000602082840312156135be578081fd5b813567ffffffffffffffff8111156135d4578182fd5b61241384828501613149565b6000602082840312156135f1578081fd5b815167ffffffffffffffff811115613607578182fd5b61241384828501613195565b6000815180845260208085019450808401835b8381101561364257815187529582019590820190600101613626565b509495945050505050565b600081518084526136658160208601602086016139d4565b601f01601f19169290920160200192915050565b600084825283516136918160208501602088016139d4565b60209201918201929092526040019392505050565b60006001600160a01b03808916835280881660208401525060c060408301526136d260c0830187613613565b82810360608401526136e48187613613565b905082810360808401526136f88186613613565b905082810360a0840152612604818561364d565b60006001600160a01b038416825260406020830152612413604083018461364d565b60006001600160a01b038716825285602083015284604083015283606083015260a0608083015261376260a083018461364d565b979650505050505050565b600085825284602083015283604083015260806060830152613792608083018461364d565b9695505050505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156137c5576137c5613a81565b604052919050565b600067ffffffffffffffff8211156137e7576137e7613a81565b5060209081020190565b600067ffffffffffffffff82111561380b5761380b613a81565b50601f01601f191660200190565b6000821982111561382c5761382c613a55565b500190565b60008261384057613840613a6b565b500490565b600060ff83168061385857613858613a6b565b8060ff84160491505092915050565b80825b600180861161387957506138a4565b81870482111561388b5761388b613a55565b8086161561389857918102915b9490941c93800261386a565b94509492505050565b6000612cb360001984846000826138c657506001612cb3565b816138d357506000612cb3565b81600181146138e957600281146138f357613920565b6001915050612cb3565b60ff84111561390457613904613a55565b6001841b91508482111561391a5761391a613a55565b50612cb3565b5060208310610133831016604e8410600b8410161715613953575081810a8381111561394e5761394e613a55565b612cb3565b6139608484846001613867565b80860482111561397257613972613a55565b02949350505050565b600081600019048311821515161561399557613995613a55565b500290565b6000828210156139ac576139ac613a55565b500390565b600060ff821660ff8416808210156139cb576139cb613a55565b90039392505050565b60005b838110156139ef5781810151838201526020016139d7565b838111156139fe576000848401525b50505050565b6000600019821415613a1857613a18613a55565b5060010190565b600082613a2e57613a2e613a6b565b500690565b600060ff831680613a4657613a46613a6b565b8060ff84160691505092915050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461089457600080fdfea26469706673582212201a50b3ec82ad745a26b9fa6be3510b7eab219b8084fa8bea1bf869dc8a01ec0164736f6c63430008020033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101825760003560e01c80638da5cb5b116100d8578063ce1b815f1161008c578063f2fde38b11610066578063f2fde38b14610361578063f8c8765e14610374578063f953cec71461038757610182565b8063ce1b815f1461032a578063da7422281461033b578063de9b771f1461034e57610182565b8063aea4e49e116100bd578063aea4e49e146102f1578063c0857ba014610304578063c4d168d61461031757610182565b80638da5cb5b146102cd578063972c4928146102de57610182565b80634b808c461161013a578063607f2d4211610114578063607f2d421461029a578063715018a6146102bd5780638456cb59146102c557610182565b80634b808c461461025d578063572b6c05146102705780635c975abb1461029257610182565b8063150b7a021161016b578063150b7a02146101e45780631f2d0065146102285780633f4ba83a1461025357610182565b806301ffc9a7146101875780630e387de6146101af575b600080fd5b61019a61019536600461356d565b61039a565b60405190151581526020015b60405180910390f35b6101d67f8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b03681565b6040519081526020016101a6565b6101f76101f23660046133ca565b610435565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016101a6565b60cd5461023b906001600160a01b031681565b6040516001600160a01b0390911681526020016101a6565b61025b61055d565b005b6101f761026b3660046132b0565b6105e0565b61019a61027e3660046131d8565b6036546001600160a01b0390811691161490565b61019a610704565b61019a6102a8366004613509565b60036020526000908152604090205460ff1681565b61025b61070e565b61025b610791565b6069546001600160a01b031661023b565b60025461023b906001600160a01b031681565b61025b6102ff3660046131d8565b610812565b60015461023b906001600160a01b031681565b61025b61032536600461343b565b610897565b6036546001600160a01b031661023b565b61025b6103493660046131d8565b610caa565b60005461023b906001600160a01b031681565b61025b61036f3660046131d8565b610d7a565b61025b61038236600461336f565b610e78565b61025b6103953660046135ad565b611036565b60007f5e8bf644000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316148061042d57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b90505b919050565b60cd54600090600160a01b900460ff16806104e1575060cd546040517f654b748a0000000000000000000000000000000000000000000000000000000081526001600160a01b0388811660048301529091169063654b748a9060240160206040518083038186803b1580156104a957600080fd5b505afa1580156104bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e191906134e9565b6105325760405162461bcd60e51b815260206004820152601760248201527f4c616e6454756e6e656c56323a20214252494447494e4700000000000000000060448201526064015b60405180910390fd5b507f150b7a020000000000000000000000000000000000000000000000000000000095945050505050565b610565611050565b6001600160a01b03166105806069546001600160a01b031690565b6001600160a01b0316146105d65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610529565b6105de61105f565b565b60cd54600090600160a01b900460ff168061068c575060cd546040517f654b748a0000000000000000000000000000000000000000000000000000000081526001600160a01b0389811660048301529091169063654b748a9060240160206040518083038186803b15801561065457600080fd5b505afa158015610668573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068c91906134e9565b6106d85760405162461bcd60e51b815260206004820152601760248201527f4c616e6454756e6e656c56323a20214252494447494e470000000000000000006044820152606401610529565b507f4b808c46000000000000000000000000000000000000000000000000000000009695505050505050565b609b5460ff165b90565b610716611050565b6001600160a01b03166107316069546001600160a01b031690565b6001600160a01b0316146107875760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610529565b6105de6000611103565b610799611050565b6001600160a01b03166107b46069546001600160a01b031690565b6001600160a01b03161461080a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610529565b6105de611162565b61081a611050565b6001600160a01b03166108356069546001600160a01b031690565b6001600160a01b03161461088b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610529565b610894816111ed565b50565b61089f610704565b156108ec5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610529565b6001600160a01b0385166109685760405162461bcd60e51b815260206004820152602860248201527f4c616e6454756e6e656c56323a2063616e27742073656e6420746f207a65726f60448201527f20616464726573730000000000000000000000000000000000000000000000006064820152608401610529565b82518451146109df5760405162461bcd60e51b815260206004820152603260248201527f4c616e6454756e6e656c56323a2073697a6573277320616e6420782773206c6560448201527f6e6774682061726520646966666572656e7400000000000000000000000000006064820152608401610529565b8151835114610a565760405162461bcd60e51b815260206004820152602e60248201527f4c616e6454756e6e656c56323a2078277320616e6420792773206c656e67746860448201527f2061726520646966666572656e740000000000000000000000000000000000006064820152608401610529565b60cd80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b17908190556001600160a01b031663eaa5e067610a9c611050565b30878787876040518763ffffffff1660e01b8152600401610ac2969594939291906136a6565b600060405180830381600087803b158015610adc57600080fd5b505af1158015610af0573d6000803e3d6000fd5b505060cd80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16905550600090505b8451811015610ca257600086868381518110610b4c57634e487b7160e01b600052603260045260246000fd5b6020026020010151868481518110610b7457634e487b7160e01b600052603260045260246000fd5b6020026020010151868581518110610b9c57634e487b7160e01b600052603260045260246000fd5b602002602001015186604051602001610bb995949392919061372e565b6040516020818303038152906040529050610bd38161129b565b866001600160a01b03167f86beac9ed9e1aa4efb77b948567a4c352c177bb58b134f4c9d0d92c2c8ffbfb1878481518110610c1e57634e487b7160e01b600052603260045260246000fd5b6020026020010151878581518110610c4657634e487b7160e01b600052603260045260246000fd5b6020026020010151878681518110610c6e57634e487b7160e01b600052603260045260246000fd5b602002602001015187604051610c87949392919061376d565b60405180910390a25080610c9a81613a04565b915050610b20565b505050505050565b610cb2611050565b6001600160a01b0316610ccd6069546001600160a01b031690565b6001600160a01b031614610d235760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610529565b6036805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517fd91237492a9e30cd2faf361fc103998a382ff0ec2b1b07dc1cbebb76ae2f1ea290600090a250565b610d82611050565b6001600160a01b0316610d9d6069546001600160a01b031690565b6001600160a01b031614610df35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610529565b6001600160a01b038116610e6f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610529565b61089481611103565b603654600160a81b900460ff16610e9c57603654600160a01b900460ff1615610ea0565b303b155b610f125760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610529565b603654600160a81b900460ff16158015610f7f57603680547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff909116600160a81b1716600160a01b1790555b60cd805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038516179055610faf611318565b610fb7611395565b610ff78585600180546001600160a01b0393841673ffffffffffffffffffffffffffffffffffffffff199182161790915560008054929093169116179055565b61100082611412565b801561102f57603680547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff1690555b5050505050565b60006110418261146f565b905061104c816117a0565b5050565b600061105a61198d565b905090565b611067610704565b6110b35760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610529565b609b805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6110e6611050565b6040516001600160a01b03909116815260200160405180910390a1565b606980546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61116a610704565b156111b75760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610529565b609b805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586110e6611050565b6002546001600160a01b03161561126c5760405162461bcd60e51b815260206004820152602a60248201527f467842617365526f6f7454756e6e656c3a204348494c445f54554e4e454c5f4160448201527f4c52454144595f534554000000000000000000000000000000000000000000006064820152608401610529565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546002546040517fb47204770000000000000000000000000000000000000000000000000000000081526001600160a01b039283169263b4720477926112ea92911690859060040161370c565b600060405180830381600087803b15801561130457600080fd5b505af115801561102f573d6000803e3d6000fd5b603654600160a81b900460ff166113855760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610529565b61138d6119d7565b6105de611a44565b603654600160a81b900460ff166114025760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610529565b61140a6119d7565b6105de611ac1565b6036805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383811691909117918290556040519116907fd91237492a9e30cd2faf361fc103998a382ff0ec2b1b07dc1cbebb76ae2f1ea290600090a250565b6060600061147c83611b3a565b9050600061148982611b99565b9050600061149683611bd0565b90506000816114a484611c07565b6114ad86611e2d565b6040516020016114bf93929190613679565b60408051601f1981840301815291815281516020928301206000818152600390935291205490915060ff161561155c5760405162461bcd60e51b8152602060048201526024808201527f4678526f6f7454756e6e656c3a20455849545f414c52454144595f50524f434560448201527f53534544000000000000000000000000000000000000000000000000000000006064820152608401610529565b6000818152600360205260408120805460ff1916600117905561157e85611e57565b9050600061158b82611fbd565b905061159681612069565b6002546001600160a01b039081169116146116195760405162461bcd60e51b815260206004820152602560248201527f4678526f6f7454756e6e656c3a20494e56414c49445f46585f4348494c445f5460448201527f554e4e454c0000000000000000000000000000000000000000000000000000006064820152608401610529565b6000611624876120a0565b9050611644611634846020015190565b8761163e8a6120ca565b846120f4565b6116b65760405162461bcd60e51b815260206004820152602360248201527f4678526f6f7454756e6e656c3a20494e56414c49445f524543454950545f505260448201527f4f4f4600000000000000000000000000000000000000000000000000000000006064820152608401610529565b6116e4856116c38961241b565b6116cc8a612445565b846116d68c61246f565b6116df8d612499565b6124c3565b5060006116f083612611565b90507f8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b03661172661172183600061265b565b6126a1565b146117735760405162461bcd60e51b815260206004820152601f60248201527f4678526f6f7454756e6e656c3a20494e56414c49445f5349474e4154555245006044820152606401610529565b600061177e8461271c565b80602001905181019061179191906135e0565b9b9a5050505050505050505050565b6000806000806000858060200190518101906117bc91906131f4565b9450945094509450945060005b83518110156119845760cd5485516001600160a01b0390911690634e6a0f4490889088908590811061180b57634e487b7160e01b600052603260045260246000fd5b602002602001015187858151811061183357634e487b7160e01b600052603260045260246000fd5b602002602001015187868151811061185b57634e487b7160e01b600052603260045260246000fd5b6020026020010151876040518663ffffffff1660e01b815260040161188495949392919061372e565b600060405180830381600087803b15801561189e57600080fd5b505af11580156118b2573d6000803e3d6000fd5b50505050856001600160a01b03167f91ee42a3ae048785d7370790775b6bf02c58c5d7bfb5de80f6d7cb27e46a207e86838151811061190157634e487b7160e01b600052603260045260246000fd5b602002602001015186848151811061192957634e487b7160e01b600052603260045260246000fd5b602002602001015186858151811061195157634e487b7160e01b600052603260045260246000fd5b60200260200101518660405161196a949392919061376d565b60405180910390a28061197c81613a04565b9150506117c9565b50505050505050565b6036546000906001600160a01b03163314156119d057507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c61070b565b503361070b565b603654600160a81b900460ff166105de5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610529565b603654600160a81b900460ff16611ab15760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610529565b6105de611abc611050565b611103565b603654600160a81b900460ff16611b2e5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610529565b609b805460ff19169055565b6040805160208101909152606081526000611b84611b7f8460408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b612746565b60408051602081019091529081529392505050565b606061042d8260000151600881518110611bc357634e487b7160e01b600052603260045260246000fd5b6020026020010151612878565b600061042d8260000151600281518110611bfa57634e487b7160e01b600052603260045260246000fd5b60200260200101516126a1565b6040805160208101909152600081528151606091901561042d57600080611c2f600086612923565b60f81c90506001811480611c4657508060ff166003145b15611d2257600185516002611c5b919061397b565b611c65919061399a565b67ffffffffffffffff811115611c8b57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611cb5576020820181803683370190505b5092506000611cc5600187612923565b90508084600081518110611ce957634e487b7160e01b600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506001925050611d94565b600285516002611d32919061397b565b611d3c919061399a565b67ffffffffffffffff811115611d6257634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611d8c576020820181803683370190505b509250600091505b60ff82165b8351811015611e2457611dc3611db260ff85168361399a565b611dbd906002613819565b87612923565b848281518110611de357634e487b7160e01b600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080611e1c81613a04565b915050611d99565b50505092915050565b600061042d8260000151600981518110611bfa57634e487b7160e01b600052603260045260246000fd5b611e7b60405180606001604052806060815260200160608152602001600081525090565b611ea38260000151600681518110611bc357634e487b7160e01b600052603260045260246000fd5b602082810182905260408051808201825260008082529083015280518082019091528251815291810190820152611ed9816129c0565b15611eee57611ee781612746565b8252611fa9565b60208201518051600090611f049060019061399a565b67ffffffffffffffff811115611f2a57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611f54576020820181803683370190505b509050600080836021019150826020019050611f72828285516129fa565b604080518082018252600080825260209182015281518083019092528451825280850190820152611fa290611b7f565b8652505050505b611fb283611e2d565b604083015250919050565b604080516080810182526000918101828152606080830193909352815260208101919091526000612019836000015160038151811061200c57634e487b7160e01b600052603260045260246000fd5b6020026020010151612746565b83604001518151811061203c57634e487b7160e01b600052603260045260246000fd5b60200260200101519050604051806040016040528082815260200161206083612746565b90529392505050565b600061042d826020015160008151811061209357634e487b7160e01b600052603260045260246000fd5b6020026020010151612a7e565b600061042d8260000151600581518110611bfa57634e487b7160e01b600052603260045260246000fd5b606061042d8260000151600781518110611bc357634e487b7160e01b600052603260045260246000fd5b6000806121288460408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b9050600061213582612746565b9050606080856000806121478b611c07565b9050805160001415612163576000975050505050505050612413565b60005b865181101561240a57815183111561218957600098505050505050505050612413565b6121b98782815181106121ac57634e487b7160e01b600052603260045260246000fd5b6020026020010151612a98565b9550858051906020012084146121da57600098505050505050505050612413565b6121fd87828151811061200c57634e487b7160e01b600052603260045260246000fd5b94508451601114156122fc57815183141561226d578c8051906020012061223e86601081518110611bc357634e487b7160e01b600052603260045260246000fd5b80519060200120141561225c57600198505050505050505050612413565b600098505050505050505050612413565b600082848151811061228f57634e487b7160e01b600052603260045260246000fd5b016020015160f81c905060108111156122b45760009950505050505050505050612413565b6122e7868260ff16815181106122da57634e487b7160e01b600052603260045260246000fd5b6020026020010151612b27565b94506122f4600185613819565b9350506123f8565b84516002141561225c57600061233661232f87600081518110611bc357634e487b7160e01b600052603260045260246000fd5b8486612b55565b83519091506123458286613819565b14156123a8578d8051906020012061237787600181518110611bc357634e487b7160e01b600052603260045260246000fd5b8051906020012014156123965760019950505050505050505050612413565b60009950505050505050505050612413565b806123bf5760009950505050505050505050612413565b6123c98185613819565b93506123ef866001815181106122da57634e487b7160e01b600052603260045260246000fd5b94506123f89050565b8061240281613a04565b915050612166565b50505050505050505b949350505050565b600061042d8260000151600381518110611bfa57634e487b7160e01b600052603260045260246000fd5b600061042d8260000151600481518110611bfa57634e487b7160e01b600052603260045260246000fd5b600061042d8260000151600081518110611bfa57634e487b7160e01b600052603260045260246000fd5b606061042d8260000151600181518110611bc357634e487b7160e01b600052603260045260246000fd5b6001546040517f41539d4a000000000000000000000000000000000000000000000000000000008152600481018490526000918291829182916001600160a01b03909116906341539d4a9060240160a06040518083038186803b15801561252957600080fd5b505afa15801561253d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125619190613521565b50935050925092506125b8828b612578919061399a565b6040805160208082018f90528183018e9052606082018d905260808083018d90528351808403909101815260a09092019092528051910120908588612cba565b6126045760405162461bcd60e51b815260206004820152601c60248201527f4678526f6f7454756e6e656c3a20494e56414c49445f484541444552000000006044820152606401610529565b9998505050505050505050565b6040805160208101909152606081526040518060200160405280612653846020015160018151811061200c57634e487b7160e01b600052603260045260246000fd5b905292915050565b6040805180820190915260008082526020820152825180518390811061269157634e487b7160e01b600052603260045260246000fd5b6020026020010151905092915050565b8051600090158015906126b657508151602110155b6126bf57600080fd5b60006126ce8360200151612e30565b905060008184600001516126e2919061399a565b90506000808386602001516126f79190613819565b905080519150602083101561271357826020036101000a820491505b50949350505050565b606061042d8260200151600281518110611bc357634e487b7160e01b600052603260045260246000fd5b6060612751826129c0565b61275a57600080fd5b600061276583612eb5565b905060008167ffffffffffffffff81111561279057634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156127d557816020015b60408051808201909152600080825260208201528152602001906001900390816127ae5790505b50905060006127e78560200151612e30565b85602001516127f69190613819565b90506000805b8481101561286d5761280d83612f38565b915060405180604001604052808381526020018481525084828151811061284457634e487b7160e01b600052603260045260246000fd5b60209081029190910101526128598284613819565b92508061286581613a04565b9150506127fc565b509195945050505050565b805160609061288657600080fd5b60006128958360200151612e30565b905060008184600001516128a9919061399a565b905060008167ffffffffffffffff8111156128d457634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156128fe576020820181803683370190505b509050600081602001905061271384876020015161291c9190613819565b8285612ffa565b6000612930600284613a1f565b1561297857601082612943600286613831565b8151811061296157634e487b7160e01b600052603260045260246000fd5b0160200151612973919060f81c613a33565b6129b6565b601082612986600286613831565b815181106129a457634e487b7160e01b600052603260045260246000fd5b01602001516129b6919060f81c613845565b60f81b9392505050565b80516000906129d157506000610430565b6020820151805160001a9060c08210156129f057600092505050610430565b5060019392505050565b80612a0457612a79565b60208110612a3c5782518252612a1b602084613819565b9250612a28602083613819565b9150612a3560208261399a565b9050612a04565b80612a4657612a79565b60006001612a5583602061399a565b612a61906101006138ad565b612a6b919061399a565b845184518216911916178352505b505050565b8051600090601514612a8f57600080fd5b61042d826126a1565b60606000826000015167ffffffffffffffff811115612ac757634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612af1576020820181803683370190505b509050805160001415612b05579050610430565b6000816020019050612b208460200151828660000151612ffa565b5092915050565b8051600090602114612b3857600080fd5b60008083602001516001612b4c9190613819565b51949350505050565b60008080612b6286611c07565b90506000815167ffffffffffffffff811115612b8e57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612bb8576020820181803683370190505b509050845b8251612bc99087613819565b811015612c88576000878281518110612bf257634e487b7160e01b600052603260045260246000fd5b01602001517fff000000000000000000000000000000000000000000000000000000000000001690508083612c27898561399a565b81518110612c4557634e487b7160e01b600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350508080612c8090613a04565b915050612bbd565b50808051906020012082805190602001201415612ca85781519250612cad565b600092505b50909150505b9392505050565b600060208251612cca9190613a1f565b15612d175760405162461bcd60e51b815260206004820152601460248201527f496e76616c69642070726f6f66206c656e6774680000000000000000000000006044820152606401610529565b600060208351612d279190613831565b9050612d348160026138ad565b8510612d825760405162461bcd60e51b815260206004820152601560248201527f4c65616620696e64657820697320746f6f2062696700000000000000000000006044820152606401610529565b60008660205b85518111612e2257858101519250612da1600289613a1f565b612dd6576040805160208101849052908101849052606001604051602081830303815290604052805190602001209150612e03565b60408051602081018590529081018390526060016040516020818303038152906040528051906020012091505b612e0e600289613831565b9750612e1b602082613819565b9050612d88565b509094149695505050505050565b8051600090811a6080811015612e4a576000915050610430565b60b8811080612e65575060c08110801590612e65575060f881105b15612e74576001915050610430565b60c0811015612ea957612e89600160b86139b1565b612e969060ff168261399a565b612ea1906001613819565b915050610430565b612e89600160f86139b1565b8051600090612ec657506000610430565b600080612ed68460200151612e30565b8460200151612ee59190613819565b9050600084600001518560200151612efd9190613819565b90505b80821015612f2f57612f1182612f38565b612f1b9083613819565b915082612f2781613a04565b935050612f00565b50909392505050565b80516000908190811a6080811015612f535760019150612b20565b60b8811015612f7957612f6760808261399a565b612f72906001613819565b9150612b20565b60c0811015612fa65760b78103600185019450806020036101000a85510460018201810193505050612b20565b60f8811015612fba57612f6760c08261399a565b60019390930151602084900360f7016101000a90049092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0a0192915050565b8061300457612a79565b60208110612a3c578251825261301b602084613819565b9250613028602083613819565b915061303560208261399a565b9050613004565b600082601f83011261304c578081fd5b8135602061306161305c836137cd565b61379c565b828152818101908583018385028701840188101561307d578586fd5b855b8581101561309b5781358452928401929084019060010161307f565b5090979650505050505050565b600082601f8301126130b8578081fd5b815160206130c861305c836137cd565b82815281810190858301838502870184018810156130e4578586fd5b855b8581101561309b578151845292840192908401906001016130e6565b60008083601f840112613113578182fd5b50813567ffffffffffffffff81111561312a578182fd5b60208301915083602082850101111561314257600080fd5b9250929050565b600082601f830112613159578081fd5b813561316761305c826137f1565b81815284602083860101111561317b578283fd5b816020850160208301379081016020019190915292915050565b600082601f8301126131a5578081fd5b81516131b361305c826137f1565b8181528460208386010111156131c7578283fd5b6124138260208301602087016139d4565b6000602082840312156131e9578081fd5b8135612cb381613a97565b600080600080600060a0868803121561320b578081fd5b855161321681613a97565b602087015190955067ffffffffffffffff80821115613233578283fd5b61323f89838a016130a8565b95506040880151915080821115613254578283fd5b61326089838a016130a8565b94506060880151915080821115613275578283fd5b61328189838a016130a8565b93506080880151915080821115613296578283fd5b506132a388828901613195565b9150509295509295909350565b600080600080600080608087890312156132c8578081fd5b86356132d381613a97565b955060208701356132e381613a97565b9450604087013567ffffffffffffffff808211156132ff578283fd5b818901915089601f830112613312578283fd5b813581811115613320578384fd5b8a60208083028501011115613333578384fd5b602083019650809550506060890135915080821115613350578283fd5b5061335d89828a01613102565b979a9699509497509295939492505050565b60008060008060808587031215613384578384fd5b843561338f81613a97565b9350602085013561339f81613a97565b925060408501356133af81613a97565b915060608501356133bf81613a97565b939692955090935050565b6000806000806000608086880312156133e1578283fd5b85356133ec81613a97565b945060208601356133fc81613a97565b935060408601359250606086013567ffffffffffffffff81111561341e578182fd5b61342a88828901613102565b969995985093965092949392505050565b600080600080600060a08688031215613452578283fd5b853561345d81613a97565b9450602086013567ffffffffffffffff80821115613479578485fd5b61348589838a0161303c565b9550604088013591508082111561349a578485fd5b6134a689838a0161303c565b945060608801359150808211156134bb578283fd5b6134c789838a0161303c565b935060808801359150808211156134dc578283fd5b506132a388828901613149565b6000602082840312156134fa578081fd5b81518015158114612cb3578182fd5b60006020828403121561351a578081fd5b5035919050565b600080600080600060a08688031215613538578283fd5b85519450602086015193506040860151925060608601519150608086015161355f81613a97565b809150509295509295909350565b60006020828403121561357e578081fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114612cb3578182fd5b6000602082840312156135be578081fd5b813567ffffffffffffffff8111156135d4578182fd5b61241384828501613149565b6000602082840312156135f1578081fd5b815167ffffffffffffffff811115613607578182fd5b61241384828501613195565b6000815180845260208085019450808401835b8381101561364257815187529582019590820190600101613626565b509495945050505050565b600081518084526136658160208601602086016139d4565b601f01601f19169290920160200192915050565b600084825283516136918160208501602088016139d4565b60209201918201929092526040019392505050565b60006001600160a01b03808916835280881660208401525060c060408301526136d260c0830187613613565b82810360608401526136e48187613613565b905082810360808401526136f88186613613565b905082810360a0840152612604818561364d565b60006001600160a01b038416825260406020830152612413604083018461364d565b60006001600160a01b038716825285602083015284604083015283606083015260a0608083015261376260a083018461364d565b979650505050505050565b600085825284602083015283604083015260806060830152613792608083018461364d565b9695505050505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156137c5576137c5613a81565b604052919050565b600067ffffffffffffffff8211156137e7576137e7613a81565b5060209081020190565b600067ffffffffffffffff82111561380b5761380b613a81565b50601f01601f191660200190565b6000821982111561382c5761382c613a55565b500190565b60008261384057613840613a6b565b500490565b600060ff83168061385857613858613a6b565b8060ff84160491505092915050565b80825b600180861161387957506138a4565b81870482111561388b5761388b613a55565b8086161561389857918102915b9490941c93800261386a565b94509492505050565b6000612cb360001984846000826138c657506001612cb3565b816138d357506000612cb3565b81600181146138e957600281146138f357613920565b6001915050612cb3565b60ff84111561390457613904613a55565b6001841b91508482111561391a5761391a613a55565b50612cb3565b5060208310610133831016604e8410600b8410161715613953575081810a8381111561394e5761394e613a55565b612cb3565b6139608484846001613867565b80860482111561397257613972613a55565b02949350505050565b600081600019048311821515161561399557613995613a55565b500290565b6000828210156139ac576139ac613a55565b500390565b600060ff821660ff8416808210156139cb576139cb613a55565b90039392505050565b60005b838110156139ef5781810151838201526020016139d7565b838111156139fe576000848401525b50505050565b6000600019821415613a1857613a18613a55565b5060010190565b600082613a2e57613a2e613a6b565b500690565b600060ff831680613a4657613a46613a6b565b8060ff84160691505092915050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461089457600080fdfea26469706673582212201a50b3ec82ad745a26b9fa6be3510b7eab219b8084fa8bea1bf869dc8a01ec0164736f6c63430008020033", + "devdoc": { + "author": "The Sandbox", + "kind": "dev", + "methods": { + "batchTransferQuadToL2(address,uint256[],uint256[],uint256[],bytes)": { + "params": { + "data": "data send to the receiver onERC721BatchReceived on L1", + "sizes": "sizes of quad", + "to": "address of the receiver on L2", + "xs": "x coordinates of quads", + "ys": "y coordinates of quads" + } + }, + "getTrustedForwarder()": { + "returns": { + "_0": "trustedForwarder address of the trusted forwarder" + } + }, + "initialize(address,address,address,address)": { + "params": { + "_checkpointManager": "checkpoint manager address", + "_fxRoot": "state sender contract", + "_rootToken": "LAND token on the root chain", + "_trustedForwarder": "trusted forwarder for meta-tx" + } + }, + "isTrustedForwarder(address)": { + "params": { + "forwarder": "address to check" + }, + "returns": { + "_0": "is trusted" + } + }, + "onERC721BatchReceived(address,address,uint256[],bytes)": { + "details": "called on ERC721 batch transfer to this contract", + "params": { + "operator": "address of the one sending the ERC721 Token" + }, + "returns": { + "_0": "onERC721BatchReceived function selector" + } + }, + "onERC721Received(address,address,uint256,bytes)": { + "details": "called on ERC721 transfer to this contract", + "params": { + "operator": "address of the one sending the ERC721 Token" + }, + "returns": { + "_0": "onERC721Received function selector" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pause()": { + "details": "Pauses all token transfers across bridge" + }, + "paused()": { + "details": "Returns true if the contract is paused, and false otherwise." + }, + "receiveMessage(bytes)": { + "details": "This function verifies if the transaction actually happened on child chain", + "params": { + "inputData": "RLP encoded data of the reference tx containing following list of fields 0 - headerNumber - Checkpoint header block number containing the reference tx 1 - blockProof - Proof that the block header (in the child chain) is a leaf in the submitted merkle root 2 - blockNumber - Block number containing the reference tx on child chain 3 - blockTime - Reference tx block time 4 - txRoot - Transactions root of block 5 - receiptRoot - Receipts root of block 6 - receipt - Receipt of the reference transaction 7 - receiptProof - Merkle proof of the reference receipt 8 - branchMask - 32 bits denoting the path of receipt in merkle tree 9 - receiptLogIndex - Log Index to read from the receipt" + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "setFxChildTunnel(address)": { + "details": "only owner can call this funtion", + "params": { + "_fxChildTunnel": "address of the fx-child tunnel" + } + }, + "setTrustedForwarder(address)": { + "details": "Change the address of the trusted forwarder for meta-TX", + "params": { + "trustedForwarder": "The new trustedForwarder" + } + }, + "supportsInterface(bytes4)": { + "details": "to be called by external contact to check if this contract supports ERC721 token and batch token receive", + "params": { + "interfaceId": "the interface to be checked if supported by the contract" + }, + "returns": { + "_0": "0x5e8bf644 is the interface of IERC721MandatoryTokenReceiver and 0x01ffc9a7 for the Eip 165 supports interface's interface id" + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "unpause()": { + "details": "Unpauses all token transfers across bridge" + } + }, + "title": "LandTunnelV2", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "batchTransferQuadToL2(address,uint256[],uint256[],uint256[],bytes)": { + "notice": "Send a batch of quads to L2" + }, + "getTrustedForwarder()": { + "notice": "Get the current trusted forwarder" + }, + "initialize(address,address,address,address)": { + "notice": "Initializes the contract" + }, + "isTrustedForwarder(address)": { + "notice": "Checks if an address is a trusted forwarder" + }, + "receiveMessage(bytes)": { + "notice": "receive message from L2 to L1, validated by proof" + }, + "setFxChildTunnel(address)": { + "notice": "sets the fx-child tunnel" + } + }, + "notice": "LAND tunnel on the root chain", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 2092, + "contract": "src/solc_0.8/polygon/root/land/LandTunnelV2.sol:LandTunnelV2", + "label": "fxRoot", + "offset": 0, + "slot": "0", + "type": "t_contract(IFxStateSender)2042" + }, + { + "astId": 2095, + "contract": "src/solc_0.8/polygon/root/land/LandTunnelV2.sol:LandTunnelV2", + "label": "checkpointManager", + "offset": 0, + "slot": "1", + "type": "t_contract(ICheckpointManager)2060" + }, + { + "astId": 2097, + "contract": "src/solc_0.8/polygon/root/land/LandTunnelV2.sol:LandTunnelV2", + "label": "fxChildTunnel", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 2101, + "contract": "src/solc_0.8/polygon/root/land/LandTunnelV2.sol:LandTunnelV2", + "label": "processedExits", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_bytes32,t_bool)" + }, + { + "astId": 40372, + "contract": "src/solc_0.8/polygon/root/land/LandTunnelV2.sol:LandTunnelV2", + "label": "__gap", + "offset": 0, + "slot": "4", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 35420, + "contract": "src/solc_0.8/polygon/root/land/LandTunnelV2.sol:LandTunnelV2", + "label": "_trustedForwarder", + "offset": 0, + "slot": "54", + "type": "t_address" + }, + { + "astId": 10217, + "contract": "src/solc_0.8/polygon/root/land/LandTunnelV2.sol:LandTunnelV2", + "label": "_initialized", + "offset": 20, + "slot": "54", + "type": "t_bool" + }, + { + "astId": 10220, + "contract": "src/solc_0.8/polygon/root/land/LandTunnelV2.sol:LandTunnelV2", + "label": "_initializing", + "offset": 21, + "slot": "54", + "type": "t_bool" + }, + { + "astId": 12276, + "contract": "src/solc_0.8/polygon/root/land/LandTunnelV2.sol:LandTunnelV2", + "label": "__gap", + "offset": 0, + "slot": "55", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 9994, + "contract": "src/solc_0.8/polygon/root/land/LandTunnelV2.sol:LandTunnelV2", + "label": "_owner", + "offset": 0, + "slot": "105", + "type": "t_address" + }, + { + "astId": 10108, + "contract": "src/solc_0.8/polygon/root/land/LandTunnelV2.sol:LandTunnelV2", + "label": "__gap", + "offset": 0, + "slot": "106", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 10305, + "contract": "src/solc_0.8/polygon/root/land/LandTunnelV2.sol:LandTunnelV2", + "label": "_paused", + "offset": 0, + "slot": "155", + "type": "t_bool" + }, + { + "astId": 10396, + "contract": "src/solc_0.8/polygon/root/land/LandTunnelV2.sol:LandTunnelV2", + "label": "__gap", + "offset": 0, + "slot": "156", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 68323, + "contract": "src/solc_0.8/polygon/root/land/LandTunnelV2.sol:LandTunnelV2", + "label": "rootToken", + "offset": 0, + "slot": "205", + "type": "t_contract(ILandTokenV2)42268" + }, + { + "astId": 68325, + "contract": "src/solc_0.8/polygon/root/land/LandTunnelV2.sol:LandTunnelV2", + "label": "transferringToL2", + "offset": 20, + "slot": "205", + "type": "t_bool" + }, + { + "astId": 68746, + "contract": "src/solc_0.8/polygon/root/land/LandTunnelV2.sol:LandTunnelV2", + "label": "__gap", + "offset": 0, + "slot": "206", + "type": "t_array(t_uint256)50_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(ICheckpointManager)2060": { + "encoding": "inplace", + "label": "contract ICheckpointManager", + "numberOfBytes": "20" + }, + "t_contract(IFxStateSender)2042": { + "encoding": "inplace", + "label": "contract IFxStateSender", + "numberOfBytes": "20" + }, + "t_contract(ILandTokenV2)42268": { + "encoding": "inplace", + "label": "contract ILandTokenV2", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes32,t_bool)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/packages/core/deployments/mainnet/LandTunnelV2_Proxy.json b/packages/core/deployments/mainnet/LandTunnelV2_Proxy.json new file mode 100644 index 0000000000..790456a1df --- /dev/null +++ b/packages/core/deployments/mainnet/LandTunnelV2_Proxy.json @@ -0,0 +1,194 @@ +{ + "address": "0x6cE82874EAf6E7602fD21Cf8bBDEd82705680A99", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "initialLogic", + "type": "address" + }, + { + "internalType": "address", + "name": "initialAdmin", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x91663dc990440e693b4fa27b5aa2e0ba2f0565dab46d537b0e06c925f6e14474", + "receipt": { + "to": null, + "from": "0xe19ae8F9B36Ca43D12741288D0e311396140DF6F", + "contractAddress": "0x6cE82874EAf6E7602fD21Cf8bBDEd82705680A99", + "transactionIndex": 105, + "gasUsed": "568949", + "logsBloom": "0x00000000800000000000000000000000000000000000000000800000000000020000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000080001000001000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000002000000000000400000000000000000000008000000000000000000000000000000000000000000000000000000000000100000000000000020000000000000000000000000000040000000020000000002000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x611502039e140beba8064744b20f596438d5895e1e54622184647d5be692e19e", + "transactionHash": "0x91663dc990440e693b4fa27b5aa2e0ba2f0565dab46d537b0e06c925f6e14474", + "logs": [ + { + "transactionIndex": 105, + "blockNumber": 17835108, + "transactionHash": "0x91663dc990440e693b4fa27b5aa2e0ba2f0565dab46d537b0e06c925f6e14474", + "address": "0x6cE82874EAf6E7602fD21Cf8bBDEd82705680A99", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000e19ae8f9b36ca43d12741288d0e311396140df6f" + ], + "data": "0x", + "logIndex": 295, + "blockHash": "0x611502039e140beba8064744b20f596438d5895e1e54622184647d5be692e19e" + }, + { + "transactionIndex": 105, + "blockNumber": 17835108, + "transactionHash": "0x91663dc990440e693b4fa27b5aa2e0ba2f0565dab46d537b0e06c925f6e14474", + "address": "0x6cE82874EAf6E7602fD21Cf8bBDEd82705680A99", + "topics": [ + "0xd91237492a9e30cd2faf361fc103998a382ff0ec2b1b07dc1cbebb76ae2f1ea2", + "0x00000000000000000000000084a0856b038eaad1cc7e297cf34a7e72685a8693" + ], + "data": "0x", + "logIndex": 296, + "blockHash": "0x611502039e140beba8064744b20f596438d5895e1e54622184647d5be692e19e" + } + ], + "blockNumber": 17835108, + "cumulativeGasUsed": "10856568", + "status": 1, + "byzantium": true + }, + "args": [ + "0xE9b6cc2598975B75E869Ca7775B66844311C5DDB", + "0x46Ac83D74091Dd54B503D89fa92b5C788Bcd3886", + "0xf8c8765e00000000000000000000000086e4dc95c7fbdbf52e33d563bbdb00823894c287000000000000000000000000fe5e5d361b2ad62c541bab87c45a0b9b018389a20000000000000000000000005cc5b05a8a13e3fbdb0bb9fccd98d38e50f90c3800000000000000000000000084a0856b038eaad1cc7e297cf34a7e72685a8693" + ], + "numDeployments": 1, + "solcInputHash": "1635d55d57a0a2552952c0d22586ed23", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialLogic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAdmin\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"stateVariables\":{\"_ADMIN_SLOT\":{\"details\":\"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.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.7/proxy/OptimizedTransparentUpgradeableProxy.sol\":\"OptimizedTransparentUpgradeableProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.7/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n * \\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n * \\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal virtual view returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n * \\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {\\n }\\n}\\n\",\"keccak256\":\"0xc33f9858a67e34c77831163d5611d21fc627dfd2c303806a98a6c9db5a01b034\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/UpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Proxy.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n * \\n * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see\\n * {TransparentUpgradeableProxy}.\\n */\\ncontract UpgradeableProxy is Proxy {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n * \\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _setImplementation(_logic);\\n if(_data.length > 0) {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = _logic.delegatecall(_data);\\n require(success);\\n }\\n }\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal override view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Upgrades the proxy to a new implementation.\\n * \\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"UpgradeableProxy: new implementation is not a contract\\\");\\n\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newImplementation)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd68f4c11941712db79a61b9dca81a5db663cfacec3d7bb19f8d2c23bb1ab8afe\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\\n // for accounts without code, i.e. `keccak256('')`\\n bytes32 codehash;\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { codehash := extcodehash(account) }\\n return (codehash != accountHash && codehash != 0x0);\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return _functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n return _functionCallWithValue(target, data, value, errorMessage);\\n }\\n\\n function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x698f929f1097637d051976b322a2d532c27df022b09010e8d091e2888a5ebdf8\",\"license\":\"MIT\"},\"solc_0.7/proxy/OptimizedTransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.7.0;\\n\\nimport \\\"../openzeppelin/proxy/UpgradeableProxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\\n */\\ncontract OptimizedTransparentUpgradeableProxy is UpgradeableProxy {\\n address internal immutable _ADMIN;\\n\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\\n */\\n constructor(\\n address initialLogic,\\n address initialAdmin,\\n bytes memory _data\\n ) payable UpgradeableProxy(initialLogic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 slot = _ADMIN_SLOT;\\n\\n _ADMIN = initialAdmin;\\n\\n // still store it to work with EIP-1967\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, initialAdmin)\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _admin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address) {\\n return _admin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address) {\\n return _implementation();\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeTo(newImplementation);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeTo(newImplementation);\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, ) = newImplementation.delegatecall(data);\\n require(success);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view returns (address adm) {\\n return _ADMIN;\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _admin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x076456d71495e22183c672db71d719bd2dc7cb3b35e5bba21ce37eea1ec30347\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040526040516108fc3803806108fc8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101e9565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b506001600160601b0319606082901b166080527fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035550610297565b6101fc8161025b60201b6103581760201c565b6102375760405162461bcd60e51b81526004018080602001828103825260368152602001806108c66036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061028f57508115155b949350505050565b60805160601c6106126102b46000398061047352506106126000f3fe6080604052600436106100435760003560e01c80633659cfe61461005a5780634f1ef2861461009a5780635c60da1b14610127578063f851a4401461016557610052565b366100525761005061017a565b005b61005061017a565b34801561006657600080fd5b506100506004803603602081101561007d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610194565b610050600480360360408110156100b057600080fd5b73ffffffffffffffffffffffffffffffffffffffff82351691908101906040810160208201356401000000008111156100e857600080fd5b8201836020820111156100fa57600080fd5b8035906020019184600183028401116401000000008311171561011c57600080fd5b5090925090506101e8565b34801561013357600080fd5b5061013c6102bc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561017157600080fd5b5061013c610313565b610182610394565b61019261018d610428565b61044d565b565b61019c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101dd576101d881610495565b6101e5565b6101e561017a565b50565b6101f0610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102af5761022c83610495565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610296576040519150601f19603f3d011682016040523d82523d6000602084013e61029b565b606091505b50509050806102a957600080fd5b506102b7565b6102b761017a565b505050565b60006102c6610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610428565b9050610310565b61031061017a565b90565b600061031d610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610471565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061038c57508115155b949350505050565b61039c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061059b6042913960600191505060405180910390fd5b610192610192565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561046c573d6000f35b3d6000fd5b7f000000000000000000000000000000000000000000000000000000000000000090565b61049e816104e2565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6104eb81610358565b610540576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806105656036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200f42fc9d1f991236ae26e240c8505def958528031655d7dd335d3988cc0c88f564736f6c634300070600335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374", + "deployedBytecode": "0x6080604052600436106100435760003560e01c80633659cfe61461005a5780634f1ef2861461009a5780635c60da1b14610127578063f851a4401461016557610052565b366100525761005061017a565b005b61005061017a565b34801561006657600080fd5b506100506004803603602081101561007d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610194565b610050600480360360408110156100b057600080fd5b73ffffffffffffffffffffffffffffffffffffffff82351691908101906040810160208201356401000000008111156100e857600080fd5b8201836020820111156100fa57600080fd5b8035906020019184600183028401116401000000008311171561011c57600080fd5b5090925090506101e8565b34801561013357600080fd5b5061013c6102bc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561017157600080fd5b5061013c610313565b610182610394565b61019261018d610428565b61044d565b565b61019c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101dd576101d881610495565b6101e5565b6101e561017a565b50565b6101f0610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102af5761022c83610495565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610296576040519150601f19603f3d011682016040523d82523d6000602084013e61029b565b606091505b50509050806102a957600080fd5b506102b7565b6102b761017a565b505050565b60006102c6610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610428565b9050610310565b61031061017a565b90565b600061031d610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610471565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061038c57508115155b949350505050565b61039c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061059b6042913960600191505060405180910390fd5b610192610192565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561046c573d6000f35b3d6000fd5b7f000000000000000000000000000000000000000000000000000000000000000090565b61049e816104e2565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6104eb81610358565b610540576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806105656036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200f42fc9d1f991236ae26e240c8505def958528031655d7dd335d3988cc0c88f564736f6c63430007060033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`" + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "stateVariables": { + "_ADMIN_SLOT": { + "details": "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." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/core/deployments/mainnet/Land_Implementation.json b/packages/core/deployments/mainnet/Land_Implementation.json index ef212be7cf..7b1270cbc7 100644 --- a/packages/core/deployments/mainnet/Land_Implementation.json +++ b/packages/core/deployments/mainnet/Land_Implementation.json @@ -1,5 +1,5 @@ { - "address": "0xf859e17efbcdf60ee9b951198aecd03b1cdd231c", + "address": "0x976f91d5E0a1eBA30eC778965Ef4701904Fe28cA", "abi": [ { "constant": true, @@ -72,7 +72,7 @@ "type": "function" }, { - "constant": false, + "constant": true, "inputs": [], "name": "height", "outputs": [ @@ -82,7 +82,7 @@ } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "pure", "type": "function" }, { @@ -215,25 +215,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "name": "id", - "type": "uint256" - } - ], - "name": "x", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -292,19 +273,57 @@ "constant": false, "inputs": [ { - "name": "id", + "name": "to", + "type": "address" + }, + { + "name": "size", + "type": "uint256" + }, + { + "name": "x", + "type": "uint256" + }, + { + "name": "y", + "type": "uint256" + }, + { + "name": "data", + "type": "bytes" + } + ], + "name": "mintAndTransferQuad", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "size", + "type": "uint256" + }, + { + "name": "x", + "type": "uint256" + }, + { + "name": "y", "type": "uint256" } ], - "name": "y", + "name": "exists", "outputs": [ { "name": "", - "type": "uint256" + "type": "bool" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { @@ -426,6 +445,25 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [ + { + "name": "id", + "type": "uint256" + } + ], + "name": "getY", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, { "constant": true, "inputs": [ @@ -463,6 +501,25 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [ + { + "name": "id", + "type": "uint256" + } + ], + "name": "getX", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, { "constant": false, "inputs": [ @@ -510,6 +567,20 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "name": "registry", + "type": "address" + } + ], + "name": "setOperatorRegistry", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [ @@ -534,7 +605,7 @@ "type": "function" }, { - "constant": false, + "constant": true, "inputs": [], "name": "width", "outputs": [ @@ -544,7 +615,7 @@ } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "pure", "type": "function" }, { @@ -584,6 +655,24 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "name": "subscriptionOrRegistrantToCopy", + "type": "address" + }, + { + "name": "subscribe", + "type": "bool" + } + ], + "name": "register", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -602,6 +691,20 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "operatorFilterRegistry", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -718,7 +821,7 @@ "name": "isApprovedForAll", "outputs": [ { - "name": "isOperator", + "name": "", "type": "bool" } ], @@ -785,8 +888,37 @@ { "anonymous": false, "inputs": [ + { + "indexed": true, + "name": "registry", + "type": "address" + } + ], + "name": "OperatorRegistrySet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "subscriptionOrRegistrant", + "type": "address" + }, { "indexed": false, + "name": "subscribe", + "type": "bool" + } + ], + "name": "ContractRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, "name": "superOperator", "type": "address" }, @@ -803,7 +935,7 @@ "anonymous": false, "inputs": [ { - "indexed": false, + "indexed": true, "name": "metaTransactionProcessor", "type": "address" }, @@ -820,7 +952,7 @@ "anonymous": false, "inputs": [ { - "indexed": false, + "indexed": true, "name": "superOperator", "type": "address" }, @@ -917,28 +1049,31 @@ "type": "event" } ], - "transactionHash": "0xd970a2fa6d3bfb5c7a58acb94b7994fab4ab5af6c99048b7afe6b594de11cb05", + "transactionHash": "0x4d03705d0fe0ce414401eea9c5baf3f8136af70867285f74b21249d47c64fd59", "receipt": { "to": null, - "from": "0xe19ae8f9b36ca43d12741288d0e311396140df6f", - "contractAddress": "0xf859e17efbcdf60ee9b951198aecd03b1cdd231c", - "transactionIndex": "0xe9", - "gasUsed": "0x40f639", + "from": "0xe19ae8F9B36Ca43D12741288D0e311396140DF6F", + "contractAddress": "0x976f91d5E0a1eBA30eC778965Ef4701904Fe28cA", + "transactionIndex": 56, + "gasUsed": "5152926", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x3c61df52130cf5b0531784995ab400eef99b164cc6174f876f04a7d9a9c96fb1", - "transactionHash": "0xd970a2fa6d3bfb5c7a58acb94b7994fab4ab5af6c99048b7afe6b594de11cb05", + "blockHash": "0x28853843cac681fd517bed904d9d0450bfc24c1086620bdbbd5f2b0234b61134", + "transactionHash": "0x4d03705d0fe0ce414401eea9c5baf3f8136af70867285f74b21249d47c64fd59", "logs": [], - "blockNumber": "0xe43b94", - "cumulativeGasUsed": "0x1460731", - "status": "0x1" + "blockNumber": 17834806, + "cumulativeGasUsed": "8371557", + "status": 1, + "byzantium": true }, "args": [], - "numDeployments": 2, - "solcInputHash": "685f2214f4e62e57fe1f31578c1618a0", - "metadata": "{\"compiler\":{\"version\":\"0.5.9+commit.c68bc34e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[{\"name\":\"id\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"operator\",\"type\":\"address\"},{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"height\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"ids\",\"type\":\"uint256[]\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"batchTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"ids\",\"type\":\"uint256[]\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeBatchTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"sender\",\"type\":\"address\"},{\"name\":\"operator\",\"type\":\"address\"},{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"approveFor\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"size\",\"type\":\"uint256\"},{\"name\":\"x\",\"type\":\"uint256\"},{\"name\":\"y\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"transferQuad\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"x\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"metaTransactionContract\",\"type\":\"address\"},{\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"y\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"who\",\"type\":\"address\"}],\"name\":\"isSuperOperator\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"size\",\"type\":\"uint256\"},{\"name\":\"x\",\"type\":\"uint256\"},{\"name\":\"y\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"mintQuad\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getAdmin\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"burnFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"_numNFTPerAddress\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"metaTransactionProcessor\",\"type\":\"address\"},{\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setMetaTransactionProcessor\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"_owners\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"},{\"name\":\"\",\"type\":\"address\"}],\"name\":\"_operatorsForAll\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"width\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"operator\",\"type\":\"address\"},{\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"who\",\"type\":\"address\"}],\"name\":\"isMinter\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"superOperator\",\"type\":\"address\"},{\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setSuperOperator\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"id\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"_operators\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"minter\",\"type\":\"address\"},{\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setMinter\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"who\",\"type\":\"address\"}],\"name\":\"isMetaTransactionProcessor\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"name\":\"isOperator\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"sizes\",\"type\":\"uint256[]\"},{\"name\":\"xs\",\"type\":\"uint256[]\"},{\"name\":\"ys\",\"type\":\"uint256[]\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"batchTransferQuad\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"sender\",\"type\":\"address\"},{\"name\":\"operator\",\"type\":\"address\"},{\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAllFor\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"superOperator\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"Minter\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"metaTransactionProcessor\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"MetaTransactionProcessor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"superOperator\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"SuperOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"oldAdmin\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_approved\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_operator\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"}],\"devdoc\":{\"methods\":{\"approve(address,uint256)\":{\"params\":{\"id\":\"The id of the token\",\"operator\":\"The address receiving the approval\"}},\"approveFor(address,address,uint256)\":{\"params\":{\"id\":\"The id of the token\",\"operator\":\"The address receiving the approval\",\"sender\":\"The address giving the approval\"}},\"balanceOf(address)\":{\"params\":{\"owner\":\"The address to look for\"},\"return\":\"The number of Land token owned by the address\"},\"batchTransferFrom(address,address,uint256[],bytes)\":{\"params\":{\"data\":\"additional data\",\"from\":\"The sender of the token\",\"ids\":\"The ids of the tokens\",\"to\":\"The recipient of the token\"}},\"batchTransferQuad(address,address,uint256[],uint256[],uint256[],bytes)\":{\"params\":{\"data\":\"additional data\",\"from\":\"current owner of the quad\",\"sizes\":\"list of sizes for each quad\",\"to\":\"destination\",\"xs\":\"list of top left x coordinates for each quad\",\"ys\":\"list of top left y coordinates for each quad\"}},\"burn(uint256)\":{\"params\":{\"id\":\"token which will be burnt.\"}},\"burnFrom(address,uint256)\":{\"params\":{\"from\":\"address whose token is to be burnt.\",\"id\":\"token which will be burnt.\"}},\"changeAdmin(address)\":{\"params\":{\"newAdmin\":\"address of the new administrator.\"}},\"getAdmin()\":{\"return\":\"the current administrator of this contract.\"},\"getApproved(uint256)\":{\"params\":{\"id\":\"The id of the token\"},\"return\":\"The address of the operator\"},\"height()\":{\"return\":\"height\"},\"isApprovedForAll(address,address)\":{\"params\":{\"operator\":\"The address of the operator\",\"owner\":\"The address of the owner\"},\"return\":\"The status of the approval\"},\"isMetaTransactionProcessor(address)\":{\"params\":{\"who\":\"The address to query.\"},\"return\":\"whether the address has meta-transaction execution rights.\"},\"isMinter(address)\":{\"params\":{\"who\":\"The address to query.\"},\"return\":\"whether the address has minter rights.\"},\"isSuperOperator(address)\":{\"params\":{\"who\":\"The address to query.\"},\"return\":\"whether the address has superOperator rights.\"},\"mintQuad(address,uint256,uint256,uint256,bytes)\":{\"params\":{\"data\":\"extra data to pass to the transfer\",\"size\":\"The size of the new quad\",\"to\":\"The recipient of the new quad\",\"x\":\"The top left x coordinate of the new quad\",\"y\":\"The top left y coordinate of the new quad\"}},\"name()\":{\"return\":\"The name of the token contract\"},\"ownerOf(uint256)\":{\"params\":{\"id\":\"The id of the Land\"},\"return\":\"The address of the owner\"},\"safeBatchTransferFrom(address,address,uint256[],bytes)\":{\"params\":{\"data\":\"additional data\",\"from\":\"The sender of the token\",\"ids\":\"The ids of the tokens\",\"to\":\"The recipient of the token\"}},\"safeTransferFrom(address,address,uint256)\":{\"params\":{\"from\":\"The send of the token\",\"id\":\"The id of the token\",\"to\":\"The recipient of the token\"}},\"safeTransferFrom(address,address,uint256,bytes)\":{\"params\":{\"data\":\"Additional data\",\"from\":\"The sender of the token\",\"id\":\"The id of the token\",\"to\":\"The recipient of the token\"}},\"setApprovalForAll(address,bool)\":{\"params\":{\"approved\":\"The determination of the approval\",\"operator\":\"The address receiving the approval\"}},\"setApprovalForAllFor(address,address,bool)\":{\"params\":{\"approved\":\"The determination of the approval\",\"operator\":\"The address receiving the approval\",\"sender\":\"The address giving the approval\"}},\"setMetaTransactionProcessor(address,bool)\":{\"params\":{\"enabled\":\"set whether the metaTransactionProcessor is enabled or disabled.\",\"metaTransactionProcessor\":\"address that will be given/removed metaTransactionProcessor rights.\"}},\"setMinter(address,bool)\":{\"params\":{\"enabled\":\"set whether the minter is enabled or disabled.\",\"minter\":\"address that will be given/removed minter right.\"}},\"setSuperOperator(address,bool)\":{\"params\":{\"enabled\":\"set whether the superOperator is enabled or disabled.\",\"superOperator\":\"address that will be given/removed superOperator right.\"}},\"supportsInterface(bytes4)\":{\"params\":{\"id\":\"The id of the interface\"},\"return\":\"True if the interface is supported\"},\"symbol()\":{\"return\":\"The symbol of the token contract\"},\"tokenURI(uint256)\":{\"params\":{\"id\":\"The id of the token\"},\"return\":\"The URI of the token\"},\"transferFrom(address,address,uint256)\":{\"params\":{\"from\":\"The sender of the token\",\"id\":\"The id of the token\",\"to\":\"The recipient of the token\"}},\"transferQuad(address,address,uint256,uint256,uint256,bytes)\":{\"params\":{\"data\":\"additional data\",\"from\":\"current owner of the quad\",\"size\":\"size of the quad\",\"to\":\"destination\",\"x\":\"The top left x coordinate of the quad\",\"y\":\"The top left y coordinate of the quad\"}},\"width()\":{\"return\":\"width\"},\"x(uint256)\":{\"params\":{\"id\":\"tokenId\"},\"return\":\"the x coordinates\"},\"y(uint256)\":{\"params\":{\"id\":\"tokenId\"},\"return\":\"the y coordinates\"}}},\"userdoc\":{\"methods\":{\"approve(address,uint256)\":{\"notice\":\"Approve an operator to spend tokens on the sender behalf\"},\"approveFor(address,address,uint256)\":{\"notice\":\"Approve an operator to spend tokens on the sender behalf\"},\"balanceOf(address)\":{\"notice\":\"Return the number of Land owned by an address\"},\"batchTransferFrom(address,address,uint256[],bytes)\":{\"notice\":\"Transfer many tokens between 2 addresses\"},\"batchTransferQuad(address,address,uint256[],uint256[],uint256[],bytes)\":{\"notice\":\"transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\"},\"burn(uint256)\":{\"notice\":\"Burns token `id`.\"},\"burnFrom(address,uint256)\":{\"notice\":\"Burn token`id` from `from`.\"},\"changeAdmin(address)\":{\"notice\":\"change the administrator to be `newAdmin`.\"},\"getAdmin()\":{\"notice\":\"gives the current administrator of this contract.\"},\"getApproved(uint256)\":{\"notice\":\"Get the approved operator for a specific token\"},\"height()\":{\"notice\":\"total height of the map\"},\"isApprovedForAll(address,address)\":{\"notice\":\"Check if the sender approved the operator\"},\"isMetaTransactionProcessor(address)\":{\"notice\":\"check whether address `who` is given meta-transaction execution rights.\"},\"isMinter(address)\":{\"notice\":\"check whether address `who` is given minter rights.\"},\"isSuperOperator(address)\":{\"notice\":\"check whether address `who` is given superOperator rights.\"},\"mintQuad(address,uint256,uint256,uint256,bytes)\":{\"notice\":\"Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\"},\"name()\":{\"notice\":\"Return the name of the token contract\"},\"ownerOf(uint256)\":{\"notice\":\"Return the owner of a Land\"},\"safeBatchTransferFrom(address,address,uint256[],bytes)\":{\"notice\":\"Transfer many tokens between 2 addresses ensuring the receiving contract has a receiver method\"},\"safeTransferFrom(address,address,uint256)\":{\"notice\":\"Transfer a token between 2 addresses letting the receiver knows of the transfer\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"notice\":\"Transfer a token between 2 addresses letting the receiver knows of the transfer\"},\"setApprovalForAll(address,bool)\":{\"notice\":\"Set the approval for an operator to manage all the tokens of the sender\"},\"setApprovalForAllFor(address,address,bool)\":{\"notice\":\"Set the approval for an operator to manage all the tokens of the sender\"},\"setMetaTransactionProcessor(address,bool)\":{\"notice\":\"Enable or disable the ability of `metaTransactionProcessor` to perform meta-tx (metaTransactionProcessor rights).\"},\"setMinter(address,bool)\":{\"notice\":\"Enable or disable the ability of `minter` to mint tokens\"},\"setSuperOperator(address,bool)\":{\"notice\":\"Enable or disable the ability of `superOperator` to transfer tokens of all (superOperator rights).\"},\"supportsInterface(bytes4)\":{\"notice\":\"Check if the contract supports an interface 0x01ffc9a7 is ERC-165 0x80ac58cd is ERC-721 0x5b5e139f is ERC-721 metadata\"},\"symbol()\":{\"notice\":\"Return the symbol of the token contract\"},\"tokenURI(uint256)\":{\"notice\":\"Return the URI of a specific token\"},\"transferFrom(address,address,uint256)\":{\"notice\":\"Transfer a token between 2 addresses\"},\"transferQuad(address,address,uint256,uint256,uint256,bytes)\":{\"notice\":\"transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\"},\"width()\":{\"notice\":\"total width of the map\"},\"x(uint256)\":{\"notice\":\"x coordinate of Land token\"},\"y(uint256)\":{\"notice\":\"y coordinate of Land token\"}}}},\"settings\":{\"compilationTarget\":{\"src/solc_0.5/LandV2.sol\":\"LandV2\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"metadata\":{\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"src/solc_0.5/Land/erc721/ERC721BaseTokenV2.sol\":{\"content\":\"/* solhint-disable func-order, code-complexity */\\npragma solidity 0.5.9;\\n\\nimport \\\"../../contracts_common/Libraries/AddressUtils.sol\\\";\\nimport \\\"../../contracts_common/Interfaces/ERC721TokenReceiver.sol\\\";\\nimport \\\"../../contracts_common/Interfaces/ERC721Events.sol\\\";\\nimport \\\"../../contracts_common/BaseWithStorage/SuperOperatorsV2.sol\\\";\\nimport \\\"../../contracts_common/BaseWithStorage/MetaTransactionReceiverV2.sol\\\";\\nimport \\\"../../contracts_common/Interfaces/ERC721MandatoryTokenReceiver.sol\\\";\\n\\ncontract ERC721BaseTokenV2 is ERC721Events, SuperOperatorsV2, MetaTransactionReceiverV2 {\\n using AddressUtils for address;\\n\\n bytes4 internal constant _ERC721_RECEIVED = 0x150b7a02;\\n bytes4 internal constant _ERC721_BATCH_RECEIVED = 0x4b808c46;\\n\\n bytes4 internal constant ERC165ID = 0x01ffc9a7;\\n bytes4 internal constant ERC721_MANDATORY_RECEIVER = 0x5e8bf644;\\n\\n mapping (address => uint256) public _numNFTPerAddress;\\n mapping (uint256 => uint256) public _owners;\\n mapping (address => mapping(address => bool)) public _operatorsForAll;\\n mapping (uint256 => address) public _operators;\\n\\n bool internal _initialized;\\n\\n modifier initializer() {\\n require(!_initialized, \\\"ERC721BaseToken: Contract already initialized\\\");\\n _;\\n }\\n\\n function initialize (\\n address metaTransactionContract,\\n address admin\\n ) public initializer {\\n _admin = admin;\\n _setMetaTransactionProcessor(metaTransactionContract, true);\\n _initialized = true;\\n }\\n\\n function _transferFrom(address from, address to, uint256 id) internal {\\n _numNFTPerAddress[from]--;\\n _numNFTPerAddress[to]++;\\n _owners[id] = uint256(to);\\n emit Transfer(from, to, id);\\n }\\n\\n /**\\n * @notice Return the number of Land owned by an address\\n * @param owner The address to look for\\n * @return The number of Land token owned by the address\\n */\\n function balanceOf(address owner) external view returns (uint256) {\\n require(owner != address(0), \\\"owner is zero address\\\");\\n return _numNFTPerAddress[owner];\\n }\\n\\n\\n function _ownerOf(uint256 id) internal view returns (address) {\\n return address(_owners[id]);\\n }\\n\\n function _ownerAndOperatorEnabledOf(uint256 id) internal view returns (address owner, bool operatorEnabled) {\\n uint256 data = _owners[id];\\n owner = address(data);\\n operatorEnabled = (data / 2**255) == 1;\\n }\\n\\n /**\\n * @notice Return the owner of a Land\\n * @param id The id of the Land\\n * @return The address of the owner\\n */\\n function ownerOf(uint256 id) external view returns (address owner) {\\n owner = _ownerOf(id);\\n require(owner != address(0), \\\"token does not exist\\\");\\n }\\n\\n function _approveFor(address owner, address operator, uint256 id) internal {\\n if(operator == address(0)) {\\n _owners[id] = uint256(owner); // no need to resset the operator, it will be overriden next time\\n } else {\\n _owners[id] = uint256(owner) + 2**255;\\n _operators[id] = operator;\\n }\\n emit Approval(owner, operator, id);\\n }\\n\\n /**\\n * @notice Approve an operator to spend tokens on the sender behalf\\n * @param sender The address giving the approval\\n * @param operator The address receiving the approval\\n * @param id The id of the token\\n */\\n function approveFor(\\n address sender,\\n address operator,\\n uint256 id\\n ) external {\\n address owner = _ownerOf(id);\\n require(sender != address(0), \\\"sender is zero address\\\");\\n require(\\n msg.sender == sender ||\\n _metaTransactionContracts[msg.sender] ||\\n _operatorsForAll[sender][msg.sender] ||\\n _superOperators[msg.sender],\\n \\\"not authorized to approve\\\"\\n );\\n require(owner == sender, \\\"owner != sender\\\");\\n _approveFor(owner, operator, id);\\n }\\n\\n /**\\n * @notice Approve an operator to spend tokens on the sender behalf\\n * @param operator The address receiving the approval\\n * @param id The id of the token\\n */\\n function approve(address operator, uint256 id) external {\\n address owner = _ownerOf(id);\\n require(owner != address(0), \\\"token does not exist\\\");\\n require(\\n owner == msg.sender ||\\n _operatorsForAll[owner][msg.sender] ||\\n _superOperators[msg.sender],\\n \\\"not authorized to approve\\\"\\n );\\n _approveFor(owner, operator, id);\\n }\\n\\n /**\\n * @notice Get the approved operator for a specific token\\n * @param id The id of the token\\n * @return The address of the operator\\n */\\n function getApproved(uint256 id) external view returns (address) {\\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\\n require(owner != address(0), \\\"token does not exist\\\");\\n if (operatorEnabled) {\\n return _operators[id];\\n } else {\\n return address(0);\\n }\\n }\\n\\n function _checkTransfer(address from, address to, uint256 id) internal view returns (bool isMetaTx) {\\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\\n require(owner != address(0), \\\"token does not exist\\\");\\n require(owner == from, \\\"not owner in _checkTransfer\\\");\\n require(to != address(0), \\\"can't send to zero address\\\");\\n isMetaTx = msg.sender != from && _metaTransactionContracts[msg.sender];\\n if (msg.sender != from && !isMetaTx) {\\n require(\\n _operatorsForAll[from][msg.sender] ||\\n (operatorEnabled && _operators[id] == msg.sender) ||\\n _superOperators[msg.sender],\\n \\\"not approved to transfer\\\"\\n );\\n }\\n }\\n\\n function _checkInterfaceWith10000Gas(address _contract, bytes4 interfaceId)\\n internal\\n view\\n returns (bool)\\n {\\n bool success;\\n bool result;\\n bytes memory call_data = abi.encodeWithSelector(\\n ERC165ID,\\n interfaceId\\n );\\n // solium-disable-next-line security/no-inline-assembly\\n assembly {\\n let call_ptr := add(0x20, call_data)\\n let call_size := mload(call_data)\\n let output := mload(0x40) // Find empty storage location using \\\"free memory pointer\\\"\\n mstore(output, 0x0)\\n success := staticcall(\\n 10000,\\n _contract,\\n call_ptr,\\n call_size,\\n output,\\n 0x20\\n ) // 32 bytes\\n result := mload(output)\\n }\\n // (10000 / 63) \\\"not enough for supportsInterface(...)\\\" // consume all gas, so caller can potentially know that there was not enough gas\\n assert(gasleft() > 158);\\n return success && result;\\n }\\n\\n /**\\n * @notice Transfer a token between 2 addresses\\n * @param from The sender of the token\\n * @param to The recipient of the token\\n * @param id The id of the token\\n */\\n function transferFrom(address from, address to, uint256 id) external {\\n bool metaTx = _checkTransfer(from, to, id);\\n _transferFrom(from, to, id);\\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\\n require(\\n _checkOnERC721Received(metaTx ? from : msg.sender, from, to, id, \\\"\\\"),\\n \\\"erc721 transfer rejected by to\\\"\\n );\\n }\\n }\\n\\n /**\\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\\n * @param from The sender of the token\\n * @param to The recipient of the token\\n * @param id The id of the token\\n * @param data Additional data\\n */\\n function safeTransferFrom(address from, address to, uint256 id, bytes memory data) public {\\n bool metaTx = _checkTransfer(from, to, id);\\n _transferFrom(from, to, id);\\n if (to.isContract()) {\\n require(\\n _checkOnERC721Received(metaTx ? from : msg.sender, from, to, id, data),\\n \\\"ERC721: transfer rejected by to\\\"\\n );\\n }\\n }\\n\\n /**\\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\\n * @param from The send of the token\\n * @param to The recipient of the token\\n * @param id The id of the token\\n */\\n function safeTransferFrom(address from, address to, uint256 id) external {\\n safeTransferFrom(from, to, id, \\\"\\\");\\n }\\n\\n /**\\n * @notice Transfer many tokens between 2 addresses\\n * @param from The sender of the token\\n * @param to The recipient of the token\\n * @param ids The ids of the tokens\\n * @param data additional data\\n */\\n function batchTransferFrom(address from, address to, uint256[] calldata ids, bytes calldata data) external {\\n _batchTransferFrom(from, to, ids, data, false);\\n }\\n\\n function _batchTransferFrom(address from, address to, uint256[] memory ids, bytes memory data, bool safe) internal {\\n bool metaTx = msg.sender != from && _metaTransactionContracts[msg.sender];\\n bool authorized = msg.sender == from ||\\n metaTx ||\\n _operatorsForAll[from][msg.sender] ||\\n _superOperators[msg.sender];\\n\\n require(from != address(0), \\\"from is zero address\\\");\\n require(to != address(0), \\\"can't send to zero address\\\");\\n\\n uint256 numTokens = ids.length;\\n for(uint256 i = 0; i < numTokens; i ++) {\\n uint256 id = ids[i];\\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\\n require(owner == from, \\\"not owner in batchTransferFrom\\\");\\n require(authorized || (operatorEnabled && _operators[id] == msg.sender), \\\"not authorized\\\");\\n _owners[id] = uint256(to);\\n emit Transfer(from, to, id);\\n }\\n if (from != to) {\\n _numNFTPerAddress[from] -= numTokens;\\n _numNFTPerAddress[to] += numTokens;\\n }\\n\\n if (to.isContract()) {\\n if (_checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\\n require(\\n _checkOnERC721BatchReceived(metaTx ? from : msg.sender, from, to, ids, data),\\n \\\"erc721 batch transfer rejected by to\\\"\\n );\\n } else if (safe) {\\n for (uint256 i = 0; i < numTokens; i ++) {\\n require(\\n _checkOnERC721Received(metaTx ? from : msg.sender, from, to, ids[i], \\\"\\\"),\\n \\\"erc721 transfer rejected by to\\\"\\n );\\n }\\n }\\n }\\n }\\n\\n /**\\n * @notice Transfer many tokens between 2 addresses ensuring the receiving contract has a receiver method\\n * @param from The sender of the token\\n * @param to The recipient of the token\\n * @param ids The ids of the tokens\\n * @param data additional data\\n */\\n function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, bytes calldata data) external {\\n _batchTransferFrom(from, to, ids, data, true);\\n }\\n\\n /**\\n * @notice Check if the contract supports an interface\\n * 0x01ffc9a7 is ERC-165\\n * 0x80ac58cd is ERC-721\\n * @param id The id of the interface\\n * @return True if the interface is supported\\n */\\n function supportsInterface(bytes4 id) external pure returns (bool) {\\n return id == 0x01ffc9a7 || id == 0x80ac58cd;\\n }\\n\\n /**\\n * @notice Set the approval for an operator to manage all the tokens of the sender\\n * @param sender The address giving the approval\\n * @param operator The address receiving the approval\\n * @param approved The determination of the approval\\n */\\n function setApprovalForAllFor(\\n address sender,\\n address operator,\\n bool approved\\n ) external {\\n require(sender != address(0), \\\"Invalid sender address\\\");\\n require(\\n msg.sender == sender ||\\n _metaTransactionContracts[msg.sender] ||\\n _superOperators[msg.sender],\\n \\\"not authorized to approve for all\\\"\\n );\\n\\n _setApprovalForAll(sender, operator, approved);\\n }\\n\\n /**\\n * @notice Set the approval for an operator to manage all the tokens of the sender\\n * @param operator The address receiving the approval\\n * @param approved The determination of the approval\\n */\\n function setApprovalForAll(address operator, bool approved) external {\\n _setApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n\\n function _setApprovalForAll(\\n address sender,\\n address operator,\\n bool approved\\n ) internal {\\n require(\\n !_superOperators[operator],\\n \\\"super operator can't have their approvalForAll changed\\\"\\n );\\n _operatorsForAll[sender][operator] = approved;\\n\\n emit ApprovalForAll(sender, operator, approved);\\n }\\n\\n /**\\n * @notice Check if the sender approved the operator\\n * @param owner The address of the owner\\n * @param operator The address of the operator\\n * @return The status of the approval\\n */\\n function isApprovedForAll(address owner, address operator)\\n external\\n view\\n returns (bool isOperator)\\n {\\n return _operatorsForAll[owner][operator] || _superOperators[operator];\\n }\\n\\n function _burn(address from, address owner, uint256 id) internal {\\n require(from == owner, \\\"not owner\\\");\\n _owners[id] = 2**160; // cannot mint it again\\n _numNFTPerAddress[from]--;\\n emit Transfer(from, address(0), id);\\n }\\n\\n /// @notice Burns token `id`.\\n /// @param id token which will be burnt.\\n function burn(uint256 id) external {\\n _burn(msg.sender, _ownerOf(id), id);\\n }\\n\\n /// @notice Burn token`id` from `from`.\\n /// @param from address whose token is to be burnt.\\n /// @param id token which will be burnt.\\n function burnFrom(address from, uint256 id) external {\\n require(from != address(0), \\\"Invalid sender address\\\");\\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\\n require(\\n msg.sender == from ||\\n _metaTransactionContracts[msg.sender] ||\\n (operatorEnabled && _operators[id] == msg.sender) ||\\n _operatorsForAll[from][msg.sender] ||\\n _superOperators[msg.sender],\\n \\\"not authorized to burn\\\"\\n );\\n _burn(from, owner, id);\\n }\\n\\n function _checkOnERC721Received(address operator, address from, address to, uint256 tokenId, bytes memory _data)\\n internal returns (bool)\\n {\\n bytes4 retval = ERC721TokenReceiver(to).onERC721Received(operator, from, tokenId, _data);\\n return (retval == _ERC721_RECEIVED);\\n }\\n\\n function _checkOnERC721BatchReceived(address operator, address from, address to, uint256[] memory ids, bytes memory _data)\\n internal returns (bool)\\n {\\n bytes4 retval = ERC721MandatoryTokenReceiver(to).onERC721BatchReceived(operator, from, ids, _data);\\n return (retval == _ERC721_BATCH_RECEIVED);\\n }\\n\\n // Empty storage space in contracts for future enhancements\\n // ref: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/issues/13)\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xa440571ade6d41ae691fe8f8d840aa35768b60ef0d04901a038d709baf4625ce\"},\"src/solc_0.5/Land/erc721/LandBaseTokenV2.sol\":{\"content\":\"/* solhint-disable func-order, code-complexity */\\npragma solidity 0.5.9;\\n\\nimport \\\"./ERC721BaseTokenV2.sol\\\";\\n\\ncontract LandBaseTokenV2 is ERC721BaseTokenV2 {\\n // Our grid is 408 x 408 lands\\n uint256 internal constant GRID_SIZE = 408;\\n\\n uint256 internal constant LAYER = 0xFF00000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_1x1 = 0x0000000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_3x3 = 0x0100000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_6x6 = 0x0200000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_12x12 = 0x0300000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_24x24 = 0x0400000000000000000000000000000000000000000000000000000000000000;\\n\\n mapping(address => bool) internal _minters;\\n event Minter(address superOperator, bool enabled);\\n\\n /// @notice Enable or disable the ability of `minter` to mint tokens\\n /// @param minter address that will be given/removed minter right.\\n /// @param enabled set whether the minter is enabled or disabled.\\n function setMinter(address minter, bool enabled) external onlyAdmin {\\n require(\\n minter != address(0),\\n \\\"address 0 is not allowed as minter\\\"\\n );\\n require(\\n enabled != _minters[minter],\\n \\\"the status should be different than the current one\\\"\\n );\\n _minters[minter] = enabled;\\n emit Minter(minter, enabled);\\n }\\n\\n /// @notice check whether address `who` is given minter rights.\\n /// @param who The address to query.\\n /// @return whether the address has minter rights.\\n function isMinter(address who) public view returns (bool) {\\n return _minters[who];\\n }\\n\\n /// @notice total width of the map\\n /// @return width\\n function width() external returns(uint256) {\\n return GRID_SIZE;\\n }\\n\\n /// @notice total height of the map\\n /// @return height\\n function height() external returns(uint256) {\\n return GRID_SIZE;\\n }\\n\\n /// @notice x coordinate of Land token\\n /// @param id tokenId\\n /// @return the x coordinates\\n function x(uint256 id) external returns(uint256) {\\n require(_ownerOf(id) != address(0), \\\"token does not exist\\\");\\n return id % GRID_SIZE;\\n }\\n\\n /// @notice y coordinate of Land token\\n /// @param id tokenId\\n /// @return the y coordinates\\n function y(uint256 id) external returns(uint256) {\\n require(_ownerOf(id) != address(0), \\\"token does not exist\\\");\\n return id / GRID_SIZE;\\n }\\n\\n /**\\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\\n * @param to The recipient of the new quad\\n * @param size The size of the new quad\\n * @param x The top left x coordinate of the new quad\\n * @param y The top left y coordinate of the new quad\\n * @param data extra data to pass to the transfer\\n */\\n function mintQuad(address to, uint256 size, uint256 x, uint256 y, bytes calldata data) external {\\n require(to != address(0), \\\"to is zero address\\\");\\n require(\\n isMinter(msg.sender),\\n \\\"Only a minter can mint\\\"\\n );\\n require(x % size == 0 && y % size == 0, \\\"Invalid coordinates\\\");\\n require(x <= GRID_SIZE - size && y <= GRID_SIZE - size, \\\"Out of bounds\\\");\\n\\n uint256 quadId;\\n uint256 id = x + y * GRID_SIZE;\\n\\n if (size == 1) {\\n quadId = id;\\n } else if (size == 3) {\\n quadId = LAYER_3x3 + id;\\n } else if (size == 6) {\\n quadId = LAYER_6x6 + id;\\n } else if (size == 12) {\\n quadId = LAYER_12x12 + id;\\n } else if (size == 24) {\\n quadId = LAYER_24x24 + id;\\n } else {\\n require(false, \\\"Invalid size\\\");\\n }\\n\\n require(_owners[LAYER_24x24 + (x/24) * 24 + ((y/24) * 24) * GRID_SIZE] == 0, \\\"Already minted as 24x24\\\");\\n\\n uint256 toX = x+size;\\n uint256 toY = y+size;\\n if (size <= 12) {\\n require(\\n _owners[LAYER_12x12 + (x/12) * 12 + ((y/12) * 12) * GRID_SIZE] == 0,\\n \\\"Already minted as 12x12\\\"\\n );\\n } else {\\n for (uint256 x12i = x; x12i < toX; x12i += 12) {\\n for (uint256 y12i = y; y12i < toY; y12i += 12) {\\n uint256 id12x12 = LAYER_12x12 + x12i + y12i * GRID_SIZE;\\n require(_owners[id12x12] == 0, \\\"Already minted as 12x12\\\");\\n }\\n }\\n }\\n\\n if (size <= 6) {\\n require(_owners[LAYER_6x6 + (x/6) * 6 + ((y/6) * 6) * GRID_SIZE] == 0, \\\"Already minted as 6x6\\\");\\n } else {\\n for (uint256 x6i = x; x6i < toX; x6i += 6) {\\n for (uint256 y6i = y; y6i < toY; y6i += 6) {\\n uint256 id6x6 = LAYER_6x6 + x6i + y6i * GRID_SIZE;\\n require(_owners[id6x6] == 0, \\\"Already minted as 6x6\\\");\\n }\\n }\\n }\\n\\n if (size <= 3) {\\n require(_owners[LAYER_3x3 + (x/3) * 3 + ((y/3) * 3) * GRID_SIZE] == 0, \\\"Already minted as 3x3\\\");\\n } else {\\n for (uint256 x3i = x; x3i < toX; x3i += 3) {\\n for (uint256 y3i = y; y3i < toY; y3i += 3) {\\n uint256 id3x3 = LAYER_3x3 + x3i + y3i * GRID_SIZE;\\n require(_owners[id3x3] == 0, \\\"Already minted as 3x3\\\");\\n }\\n }\\n }\\n\\n for (uint256 i = 0; i < size*size; i++) {\\n uint256 id = _idInPath(i, size, x, y);\\n require(_owners[id] == 0, \\\"Already minted\\\");\\n emit Transfer(address(0), to, id);\\n }\\n\\n _owners[quadId] = uint256(to);\\n _numNFTPerAddress[to] += size * size;\\n\\n _checkBatchReceiverAcceptQuad(msg.sender, address(0), to, size, x, y, data);\\n }\\n\\n function _idInPath(uint256 i, uint256 size, uint256 x, uint256 y) internal pure returns(uint256) {\\n uint256 row = i / size;\\n if(row % 2 == 0) { // allow ids to follow a path in a quad\\n return (x + (i%size)) + ((y + row) * GRID_SIZE);\\n } else {\\n return ((x + size) - (1 + i%size)) + ((y + row) * GRID_SIZE);\\n }\\n }\\n\\n /// @notice transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\\n /// @param from current owner of the quad\\n /// @param to destination\\n /// @param size size of the quad\\n /// @param x The top left x coordinate of the quad\\n /// @param y The top left y coordinate of the quad\\n /// @param data additional data\\n function transferQuad(address from, address to, uint256 size, uint256 x, uint256 y, bytes calldata data) external {\\n require(from != address(0), \\\"from is zero address\\\");\\n require(to != address(0), \\\"can't send to zero address\\\");\\n bool metaTx = msg.sender != from && _metaTransactionContracts[msg.sender];\\n if (msg.sender != from && !metaTx) {\\n require(\\n _operatorsForAll[from][msg.sender] ||\\n _superOperators[msg.sender],\\n \\\"not authorized to transferQuad\\\"\\n );\\n }\\n _transferQuad(from, to, size, x, y);\\n _numNFTPerAddress[from] -= size * size;\\n _numNFTPerAddress[to] += size * size;\\n\\n _checkBatchReceiverAcceptQuad(metaTx ? from : msg.sender, from, to, size, x, y, data);\\n }\\n\\n function _checkBatchReceiverAcceptQuad(\\n address operator,\\n address from,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes memory data\\n ) internal {\\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\\n uint256[] memory ids = new uint256[](size*size);\\n for (uint256 i = 0; i < size*size; i++) {\\n ids[i] = _idInPath(i, size, x, y);\\n }\\n require(\\n _checkOnERC721BatchReceived(operator, from, to, ids, data),\\n \\\"erc721 batch transfer rejected by to\\\"\\n );\\n }\\n }\\n\\n /// @notice transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\\n /// @param from current owner of the quad\\n /// @param to destination\\n /// @param sizes list of sizes for each quad\\n /// @param xs list of top left x coordinates for each quad\\n /// @param ys list of top left y coordinates for each quad\\n /// @param data additional data\\n function batchTransferQuad(\\n address from,\\n address to,\\n uint256[] calldata sizes,\\n uint256[] calldata xs,\\n uint256[] calldata ys,\\n bytes calldata data\\n ) external {\\n require(from != address(0), \\\"from is zero address\\\");\\n require(to != address(0), \\\"can't send to zero address\\\");\\n require(sizes.length == xs.length && xs.length == ys.length, \\\"invalid data\\\");\\n bool metaTx = msg.sender != from && _metaTransactionContracts[msg.sender];\\n if (msg.sender != from && !metaTx) {\\n require(\\n _operatorsForAll[from][msg.sender] ||\\n _superOperators[msg.sender],\\n \\\"not authorized to transferMultiQuads\\\"\\n );\\n }\\n uint256 numTokensTransfered = 0;\\n for (uint256 i = 0; i < sizes.length; i++) {\\n uint256 size = sizes[i];\\n _transferQuad(from, to, size, xs[i], ys[i]);\\n numTokensTransfered += size * size;\\n }\\n _numNFTPerAddress[from] -= numTokensTransfered;\\n _numNFTPerAddress[to] += numTokensTransfered;\\n\\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\\n uint256[] memory ids = new uint256[](numTokensTransfered);\\n uint256 counter = 0;\\n for (uint256 j = 0; j < sizes.length; j++) {\\n uint256 size = sizes[j];\\n for (uint256 i = 0; i < size*size; i++) {\\n ids[counter] = _idInPath(i, size, xs[j], ys[j]);\\n counter++;\\n }\\n }\\n require(\\n _checkOnERC721BatchReceived(metaTx ? from : msg.sender, from, to, ids, data),\\n \\\"erc721 batch transfer rejected by to\\\"\\n );\\n }\\n }\\n\\n function _transferQuad(address from, address to, uint256 size, uint256 x, uint256 y) internal {\\n if (size == 1) {\\n uint256 id1x1 = x + y * GRID_SIZE;\\n address owner = _ownerOf(id1x1);\\n require(owner != address(0), \\\"token does not exist\\\");\\n require(owner == from, \\\"not owner in _transferQuad\\\");\\n _owners[id1x1] = uint256(to);\\n } else {\\n _regroup(from, to, size, x, y);\\n }\\n for (uint256 i = 0; i < size*size; i++) {\\n emit Transfer(from, to, _idInPath(i, size, x, y));\\n }\\n }\\n\\n function _checkAndClear(address from, uint256 id) internal returns(bool) {\\n uint256 owner = _owners[id];\\n if (owner != 0) {\\n require(address(owner) == from, \\\"not owner\\\");\\n _owners[id] = 0;\\n return true;\\n }\\n return false;\\n }\\n\\n function _regroup(address from, address to, uint256 size, uint256 x, uint256 y) internal {\\n require(x % size == 0 && y % size == 0, \\\"Invalid coordinates\\\");\\n require(x <= GRID_SIZE - size && y <= GRID_SIZE - size, \\\"Out of bounds\\\");\\n\\n if (size == 3) {\\n _regroup3x3(from, to, x, y, true);\\n } else if (size == 6) {\\n _regroup6x6(from, to, x, y, true);\\n } else if (size == 12) {\\n _regroup12x12(from, to, x, y, true);\\n } else if (size == 24) {\\n _regroup24x24(from, to, x, y, true);\\n } else {\\n require(false, \\\"Invalid size\\\");\\n }\\n }\\n\\n function _regroup3x3(address from, address to, uint256 x, uint256 y, bool set) internal returns (bool) {\\n uint256 id = x + y * GRID_SIZE;\\n uint256 quadId = LAYER_3x3 + id;\\n bool ownerOfAll = true;\\n for (uint256 xi = x; xi < x+3; xi++) {\\n for (uint256 yi = y; yi < y+3; yi++) {\\n ownerOfAll = _checkAndClear(from, xi + yi * GRID_SIZE) && ownerOfAll;\\n }\\n }\\n if(set) {\\n if(!ownerOfAll) {\\n require(\\n _ownerOfQuad(3, x, y) == from,\\n \\\"not owner of all sub quads nor parent quads\\\"\\n );\\n }\\n _owners[quadId] = uint256(to);\\n return true;\\n }\\n return ownerOfAll;\\n }\\n\\n function _ownerOfQuad(uint256 size, uint256 x, uint256 y) internal returns (address) {\\n uint256 layer;\\n uint256 parentSize = size * 2;\\n if (size == 3) {\\n layer = LAYER_3x3;\\n } else if (size == 6) {\\n layer = LAYER_6x6;\\n } else if (size == 12) {\\n layer = LAYER_12x12;\\n } else if (size == 24) {\\n layer = LAYER_24x24;\\n } else {\\n require(false, \\\"Invalid size\\\");\\n }\\n address owner = address(_owners[layer + (x/size) * size + ((y/size) * size) * GRID_SIZE]);\\n if (owner != address(0)) {\\n return owner;\\n } else if(size < 24) {\\n return _ownerOfQuad(parentSize, x, y);\\n }\\n return address(0);\\n }\\n function _regroup6x6(address from, address to, uint256 x, uint256 y, bool set) internal returns (bool) {\\n uint256 id = x + y * GRID_SIZE;\\n uint256 quadId = LAYER_6x6 + id;\\n bool ownerOfAll = true;\\n for (uint256 xi = x; xi < x+6; xi += 3) {\\n for (uint256 yi = y; yi < y+6; yi += 3) {\\n bool ownAllIndividual = _regroup3x3(from, to, xi, yi, false);\\n uint256 id3x3 = LAYER_3x3 + xi + yi * GRID_SIZE;\\n uint256 owner3x3 = _owners[id3x3];\\n if (owner3x3 != 0) {\\n if(!ownAllIndividual) {\\n require(owner3x3 == uint256(from), \\\"not owner of 3x3 quad\\\");\\n }\\n _owners[id3x3] = 0;\\n }\\n ownerOfAll = (ownAllIndividual || owner3x3 != 0) && ownerOfAll;\\n }\\n }\\n if(set) {\\n if(!ownerOfAll) {\\n require(\\n _ownerOfQuad(6, x, y) == from,\\n \\\"not owner of all sub quads nor parent quads\\\"\\n );\\n }\\n _owners[quadId] = uint256(to);\\n return true;\\n }\\n return ownerOfAll;\\n }\\n function _regroup12x12(address from, address to, uint256 x, uint256 y, bool set) internal returns (bool) {\\n uint256 id = x + y * GRID_SIZE;\\n uint256 quadId = LAYER_12x12 + id;\\n bool ownerOfAll = true;\\n for (uint256 xi = x; xi < x+12; xi += 6) {\\n for (uint256 yi = y; yi < y+12; yi += 6) {\\n bool ownAllIndividual = _regroup6x6(from, to, xi, yi, false);\\n uint256 id6x6 = LAYER_6x6 + xi + yi * GRID_SIZE;\\n uint256 owner6x6 = _owners[id6x6];\\n if (owner6x6 != 0) {\\n if(!ownAllIndividual) {\\n require(owner6x6 == uint256(from), \\\"not owner of 6x6 quad\\\");\\n }\\n _owners[id6x6] = 0;\\n }\\n ownerOfAll = (ownAllIndividual || owner6x6 != 0) && ownerOfAll;\\n }\\n }\\n if(set) {\\n if(!ownerOfAll) {\\n require(\\n _ownerOfQuad(12, x, y) == from,\\n \\\"not owner of all sub quads nor parent quads\\\"\\n );\\n }\\n _owners[quadId] = uint256(to);\\n return true;\\n }\\n return ownerOfAll;\\n }\\n function _regroup24x24(address from, address to, uint256 x, uint256 y, bool set) internal returns (bool) {\\n uint256 id = x + y * GRID_SIZE;\\n uint256 quadId = LAYER_24x24 + id;\\n bool ownerOfAll = true;\\n for (uint256 xi = x; xi < x+24; xi += 12) {\\n for (uint256 yi = y; yi < y+24; yi += 12) {\\n bool ownAllIndividual = _regroup12x12(from, to, xi, yi, false);\\n uint256 id12x12 = LAYER_12x12 + xi + yi * GRID_SIZE;\\n uint256 owner12x12 = _owners[id12x12];\\n if (owner12x12 != 0) {\\n if(!ownAllIndividual) {\\n require(owner12x12 == uint256(from), \\\"not owner of 12x12 quad\\\");\\n }\\n _owners[id12x12] = 0;\\n }\\n ownerOfAll = (ownAllIndividual || owner12x12 != 0) && ownerOfAll;\\n }\\n }\\n if(set) {\\n if(!ownerOfAll) {\\n require(\\n _ownerOfQuad(24, x, y) == from,\\n \\\"not owner of all sub quads not parent quad\\\"\\n );\\n }\\n _owners[quadId] = uint256(to);\\n return true;\\n }\\n return ownerOfAll || _owners[quadId] == uint256(from);\\n }\\n\\n function _ownerOf(uint256 id) internal view returns (address) {\\n require(id & LAYER == 0, \\\"Invalid token id\\\");\\n uint256 x = id % GRID_SIZE;\\n uint256 y = id / GRID_SIZE;\\n uint256 owner1x1 = _owners[id];\\n\\n if (owner1x1 != 0) {\\n return address(owner1x1); // cast to zero\\n } else {\\n address owner3x3 = address(_owners[LAYER_3x3 + (x/3) * 3 + ((y/3) * 3) * GRID_SIZE]);\\n if (owner3x3 != address(0)) {\\n return owner3x3;\\n } else {\\n address owner6x6 = address(_owners[LAYER_6x6 + (x/6) * 6 + ((y/6) * 6) * GRID_SIZE]);\\n if (owner6x6 != address(0)) {\\n return owner6x6;\\n } else {\\n address owner12x12 = address(_owners[LAYER_12x12 + (x/12) * 12 + ((y/12) * 12) * GRID_SIZE]);\\n if (owner12x12 != address(0)) {\\n return owner12x12;\\n } else {\\n return address(_owners[LAYER_24x24 + (x/24) * 24 + ((y/24) * 24) * GRID_SIZE]);\\n }\\n }\\n }\\n }\\n }\\n\\n function _ownerAndOperatorEnabledOf(uint256 id) internal view returns (address owner, bool operatorEnabled) {\\n require(id & LAYER == 0, \\\"Invalid token id\\\");\\n uint256 x = id % GRID_SIZE;\\n uint256 y = id / GRID_SIZE;\\n uint256 owner1x1 = _owners[id];\\n\\n if (owner1x1 != 0) {\\n owner = address(owner1x1);\\n operatorEnabled = (owner1x1 / 2**255) == 1;\\n } else {\\n address owner3x3 = address(_owners[LAYER_3x3 + (x/3) * 3 + ((y/3) * 3) * GRID_SIZE]);\\n if (owner3x3 != address(0)) {\\n owner = owner3x3;\\n operatorEnabled = false;\\n } else {\\n address owner6x6 = address(_owners[LAYER_6x6 + (x/6) * 6 + ((y/6) * 6) * GRID_SIZE]);\\n if (owner6x6 != address(0)) {\\n owner = owner6x6;\\n operatorEnabled = false;\\n } else {\\n address owner12x12 = address(_owners[LAYER_12x12 + (x/12) * 12 + ((y/12) * 12) * GRID_SIZE]);\\n if (owner12x12 != address(0)) {\\n owner = owner12x12;\\n operatorEnabled = false;\\n } else {\\n owner = address(_owners[LAYER_24x24 + (x/24) * 24 + ((y/24) * 24) * GRID_SIZE]);\\n operatorEnabled = false;\\n }\\n }\\n }\\n }\\n }\\n\\n}\\n\",\"keccak256\":\"0xaef06450e14dbea3def47f61339549d762c29a225251cf39c27e2f7e3c587627\"},\"src/solc_0.5/LandV2.sol\":{\"content\":\"/* solhint-disable no-empty-blocks */\\n\\npragma solidity 0.5.9;\\n\\nimport \\\"./Land/erc721/LandBaseTokenV2.sol\\\";\\n\\ncontract LandV2 is LandBaseTokenV2 {\\n /**\\n * @notice Return the name of the token contract\\n * @return The name of the token contract\\n */\\n function name() external pure returns (string memory) {\\n return \\\"Sandbox's LANDs\\\";\\n }\\n\\n /**\\n * @notice Return the symbol of the token contract\\n * @return The symbol of the token contract\\n */\\n function symbol() external pure returns (string memory) {\\n return \\\"LAND\\\";\\n }\\n\\n // solium-disable-next-line security/no-assign-params\\n function uint2str(uint _i) internal pure returns (string memory) {\\n if (_i == 0) {\\n return \\\"0\\\";\\n }\\n uint j = _i;\\n uint len;\\n while (j != 0) {\\n len++;\\n j /= 10;\\n }\\n bytes memory bstr = new bytes(len);\\n uint k = len - 1;\\n while (_i != 0) {\\n bstr[k--] = byte(uint8(48 + _i % 10));\\n _i /= 10;\\n }\\n return string(bstr);\\n }\\n\\n /**\\n * @notice Return the URI of a specific token\\n * @param id The id of the token\\n * @return The URI of the token\\n */\\n function tokenURI(uint256 id) public view returns (string memory) {\\n require(_ownerOf(id) != address(0), \\\"Id does not exist\\\");\\n return\\n string(\\n abi.encodePacked(\\n \\\"https://api.sandbox.game/lands/\\\",\\n uint2str(id),\\n \\\"/metadata.json\\\"\\n )\\n );\\n }\\n\\n /**\\n * @notice Check if the contract supports an interface\\n * 0x01ffc9a7 is ERC-165\\n * 0x80ac58cd is ERC-721\\n * 0x5b5e139f is ERC-721 metadata\\n * @param id The id of the interface\\n * @return True if the interface is supported\\n */\\n function supportsInterface(bytes4 id) external pure returns (bool) {\\n return id == 0x01ffc9a7 || id == 0x80ac58cd || id == 0x5b5e139f;\\n }\\n}\\n\",\"keccak256\":\"0xb13cd40c43dbecd61dc9b27336edf35081f3c147a995dc0d9fd63a89c0ba177e\"},\"src/solc_0.5/contracts_common/BaseWithStorage/AdminV2.sol\":{\"content\":\"pragma solidity 0.5.9;\\n\\ncontract AdminV2 {\\n\\n address internal _admin;\\n\\n event AdminChanged(address oldAdmin, address newAdmin);\\n\\n /// @notice gives the current administrator of this contract.\\n /// @return the current administrator of this contract.\\n function getAdmin() external view returns (address) {\\n return _admin;\\n }\\n\\n /// @notice change the administrator to be `newAdmin`.\\n /// @param newAdmin address of the new administrator.\\n function changeAdmin(address newAdmin) external {\\n address admin = _admin;\\n require(msg.sender == admin, \\\"only admin can change admin\\\");\\n require(newAdmin != admin, \\\"it can be only changed to a new admin\\\");\\n emit AdminChanged(admin, newAdmin);\\n _admin = newAdmin;\\n }\\n\\n modifier onlyAdmin() {\\n require (msg.sender == _admin, \\\"only admin allowed\\\");\\n _;\\n }\\n\\n}\\n\",\"keccak256\":\"0xb209accdc816ab4eadc81d6b14e5b218353c7c0e90866c59625f69ee6ba74575\"},\"src/solc_0.5/contracts_common/BaseWithStorage/MetaTransactionReceiverV2.sol\":{\"content\":\"pragma solidity 0.5.9;\\n\\nimport \\\"./AdminV2.sol\\\";\\nimport \\\"../../contracts_common/Libraries/AddressUtils.sol\\\";\\n\\ncontract MetaTransactionReceiverV2 is AdminV2 {\\n using AddressUtils for address;\\n\\n mapping(address => bool) internal _metaTransactionContracts;\\n event MetaTransactionProcessor(address metaTransactionProcessor, bool enabled);\\n\\n /// @notice Enable or disable the ability of `metaTransactionProcessor` to perform meta-tx (metaTransactionProcessor rights).\\n /// @param metaTransactionProcessor address that will be given/removed metaTransactionProcessor rights.\\n /// @param enabled set whether the metaTransactionProcessor is enabled or disabled.\\n function setMetaTransactionProcessor(address metaTransactionProcessor, bool enabled) public onlyAdmin {\\n require(\\n metaTransactionProcessor.isContract(),\\n \\\"only contracts can be meta transaction processor\\\"\\n );\\n _setMetaTransactionProcessor(metaTransactionProcessor, enabled);\\n }\\n\\n function _setMetaTransactionProcessor(address metaTransactionProcessor, bool enabled) internal {\\n _metaTransactionContracts[metaTransactionProcessor] = enabled;\\n emit MetaTransactionProcessor(metaTransactionProcessor, enabled);\\n }\\n\\n /// @notice check whether address `who` is given meta-transaction execution rights.\\n /// @param who The address to query.\\n /// @return whether the address has meta-transaction execution rights.\\n function isMetaTransactionProcessor(address who) external view returns(bool) {\\n return _metaTransactionContracts[who];\\n }\\n}\\n\",\"keccak256\":\"0x72640ea5298b5abf5b3abe136cb5aa4032fa54f861df6c297d21f62b95dffa3a\"},\"src/solc_0.5/contracts_common/BaseWithStorage/SuperOperatorsV2.sol\":{\"content\":\"pragma solidity 0.5.9;\\n\\nimport \\\"./AdminV2.sol\\\";\\n\\ncontract SuperOperatorsV2 is AdminV2 {\\n\\n mapping(address => bool) internal _superOperators;\\n\\n event SuperOperator(address superOperator, bool enabled);\\n\\n /// @notice Enable or disable the ability of `superOperator` to transfer tokens of all (superOperator rights).\\n /// @param superOperator address that will be given/removed superOperator right.\\n /// @param enabled set whether the superOperator is enabled or disabled.\\n function setSuperOperator(address superOperator, bool enabled) external onlyAdmin {\\n require(\\n superOperator != address(0),\\n \\\"address 0 is not allowed as super operator\\\"\\n );\\n require(\\n enabled != _superOperators[superOperator],\\n \\\"the status should be different than the current one\\\"\\n );\\n _superOperators[superOperator] = enabled;\\n emit SuperOperator(superOperator, enabled);\\n }\\n\\n /// @notice check whether address `who` is given superOperator rights.\\n /// @param who The address to query.\\n /// @return whether the address has superOperator rights.\\n function isSuperOperator(address who) public view returns (bool) {\\n return _superOperators[who];\\n }\\n}\\n\",\"keccak256\":\"0x6108d6cdf0ee9c276ee60b2e894bc382780d8d703a0317a7bbe2411c12bc157e\"},\"src/solc_0.5/contracts_common/Interfaces/ERC721Events.sol\":{\"content\":\"pragma solidity 0.5.9;\\n\\n/**\\n * @title ERC721 Non-Fungible Token Standard basic interface\\n * @dev see https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface ERC721Events {\\n event Transfer(\\n address indexed _from,\\n address indexed _to,\\n uint256 indexed _tokenId\\n );\\n event Approval(\\n address indexed _owner,\\n address indexed _approved,\\n uint256 indexed _tokenId\\n );\\n event ApprovalForAll(\\n address indexed _owner,\\n address indexed _operator,\\n bool _approved\\n );\\n}\\n\",\"keccak256\":\"0x4e501d6f4c603c6ee704782e51c06fd339ac52c3894c12d03ae482dc92e3dd98\"},\"src/solc_0.5/contracts_common/Interfaces/ERC721MandatoryTokenReceiver.sol\":{\"content\":\"pragma solidity 0.5.9;\\n\\n/**\\n Note: The ERC-165 identifier for this interface is 0x5e8bf644.\\n*/\\ninterface ERC721MandatoryTokenReceiver {\\n function onERC721BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) external returns (bytes4); // needs to return 0x4b808c46\\n\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4); // needs to return 0x150b7a02\\n}\\n\",\"keccak256\":\"0xc394b6d1f8d6587d7cdc8de1bf9d2286ce8ff9d8b3252576d5119e86be1554c7\"},\"src/solc_0.5/contracts_common/Interfaces/ERC721TokenReceiver.sol\":{\"content\":\"/* This Source Code Form is subject to the terms of the Mozilla Public\\n * License, v. 2.0. If a copy of the MPL was not distributed with this\\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\\n *\\n * This code has not been reviewed.\\n * Do not use or deploy this code before reviewing it personally first.\\n */\\n// solhint-disable-next-line compiler-fixed\\npragma solidity 0.5.9;\\n\\ninterface ERC721TokenReceiver {\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0x5c8433ead82be7c65620246f9f8baa686ecf7c5702c091a41b5243edf46259c9\"},\"src/solc_0.5/contracts_common/Libraries/AddressUtils.sol\":{\"content\":\"pragma solidity 0.5.9;\\n\\nlibrary AddressUtils {\\n\\n function toPayable(address _address) internal pure returns (address payable _payable) {\\n return address(uint160(_address));\\n }\\n\\n function isContract(address addr) internal view returns (bool) {\\n // for accounts without code, i.e. `keccak256('')`:\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n\\n bytes32 codehash;\\n // solium-disable-next-line security/no-inline-assembly\\n assembly {\\n codehash := extcodehash(addr)\\n }\\n return (codehash != 0x0 && codehash != accountHash);\\n }\\n}\\n\",\"keccak256\":\"0xdab32da611ddf9f10c9d866e8d5b7293507001b57041461ebd3af4dc0cf43c98\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50614c3e806100206000396000f3fe608060405234801561001057600080fd5b50600436106102ad5760003560e01c806370a082311161017b578063aa271e1a116100d8578063cf456ae71161008c578063e985e9c511610071578063e985e9c514610b35578063eaa5e06714610b63578063eeb5a5d114610ce2576102ad565b8063cf456ae714610ae1578063dc5074af14610b0f576102ad565b8063b88d4fde116100bd578063b88d4fde146109e1578063b9b710e914610aa7578063c87b56dd14610ac4576102ad565b8063aa271e1a1461098d578063ac9fe421146109b3576102ad565b806395d89b411161012f5780639d786bbc116101145780639d786bbc146109315780639ededf77146103d1578063a22cb4651461095f576102ad565b806395d89b411461090c578063992924a614610914576102ad565b8063878267641161016057806387826764146108925780638a04af6a146108b85780638f283970146108e6576102ad565b806370a082311461084057806379cc679014610866576102ad565b806338bb305a116102295780636259e7e1116101dd578063654b748a116101c2578063654b748a146107815780636e1e3bbf146107a75780636e9960c314610838576102ad565b80636259e7e1146107475780636352211e14610764576102ad565b806342842e0e1161020e57806342842e0e146106c657806342966c68146106fc578063485cc95514610719576102ad565b806338bb305a1461060d5780633f4263ef146106a9576102ad565b80630ef267431161028057806323b872dd1161026557806323b872dd146104c657806328cfbd46146104fc5780632b991746146105d7576102ad565b80630ef26743146103d157806315ddc535146103eb576102ad565b806301ffc9a7146102b257806306fdde03146102ed578063081812fc1461036a578063095ea7b3146103a3575b600080fd5b6102d9600480360360208110156102c857600080fd5b50356001600160e01b031916610d1a565b604080519115158252519081900360200190f35b6102f5610db9565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561032f578181015183820152602001610317565b50505050905090810190601f16801561035c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103876004803603602081101561038057600080fd5b5035610df0565b604080516001600160a01b039092168252519081900360200190f35b6103cf600480360360408110156103b957600080fd5b506001600160a01b038135169060200135610e86565b005b6103d9610f9a565b60408051918252519081900360200190f35b6103cf6004803603608081101561040157600080fd5b6001600160a01b03823581169260208101359091169181019060608101604082013564010000000081111561043557600080fd5b82018360208201111561044757600080fd5b8035906020019184602083028401116401000000008311171561046957600080fd5b91939092909160208101903564010000000081111561048757600080fd5b82018360208201111561049957600080fd5b803590602001918460018302840111640100000000831117156104bb57600080fd5b509092509050610fa0565b6103cf600480360360608110156104dc57600080fd5b506001600160a01b0381358116916020810135909116906040013561101a565b6103cf6004803603608081101561051257600080fd5b6001600160a01b03823581169260208101359091169181019060608101604082013564010000000081111561054657600080fd5b82018360208201111561055857600080fd5b8035906020019184602083028401116401000000008311171561057a57600080fd5b91939092909160208101903564010000000081111561059857600080fd5b8201836020820111156105aa57600080fd5b803590602001918460018302840111640100000000831117156105cc57600080fd5b5090925090506110e2565b6103cf600480360360608110156105ed57600080fd5b506001600160a01b03813581169160208101359091169060400135611157565b6103cf600480360360c081101561062357600080fd5b6001600160a01b0382358116926020810135909116916040820135916060810135916080820135919081019060c0810160a082013564010000000081111561066a57600080fd5b82018360208201111561067c57600080fd5b8035906020019184600183028401116401000000008311171561069e57600080fd5b5090925090506112ef565b6103d9600480360360208110156106bf57600080fd5b503561151b565b6103cf600480360360608110156106dc57600080fd5b506001600160a01b03813581169160208101359091169060400135611583565b6103cf6004803603602081101561071257600080fd5b503561159e565b6103cf6004803603604081101561072f57600080fd5b506001600160a01b03813581169160200135166115b4565b6103d96004803603602081101561075d57600080fd5b503561163a565b6103876004803603602081101561077a57600080fd5b50356116a2565b6102d96004803603602081101561079757600080fd5b50356001600160a01b0316611701565b6103cf600480360360a08110156107bd57600080fd5b6001600160a01b038235169160208101359160408201359160608101359181019060a0810160808201356401000000008111156107f957600080fd5b82018360208201111561080b57600080fd5b8035906020019184600183028401116401000000008311171561082d57600080fd5b50909250905061171f565b610387611ebd565b6103d96004803603602081101561085657600080fd5b50356001600160a01b0316611ecc565b6103cf6004803603604081101561087c57600080fd5b506001600160a01b038135169060200135611f45565b6103d9600480360360208110156108a857600080fd5b50356001600160a01b03166120a4565b6103cf600480360360408110156108ce57600080fd5b506001600160a01b03813516906020013515156120b6565b6103cf600480360360208110156108fc57600080fd5b50356001600160a01b0316612170565b6102f5612296565b6103d96004803603602081101561092a57600080fd5b50356122cd565b6102d96004803603604081101561094757600080fd5b506001600160a01b03813581169160200135166122df565b6103cf6004803603604081101561097557600080fd5b506001600160a01b03813516906020013515156122ff565b6102d9600480360360208110156109a357600080fd5b50356001600160a01b031661230a565b6103cf600480360360408110156109c957600080fd5b506001600160a01b0381351690602001351515612328565b6103cf600480360360808110156109f757600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135640100000000811115610a3257600080fd5b820183602082011115610a4457600080fd5b80359060200191846001830284011164010000000083111715610a6657600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061248e945050505050565b61038760048036036020811015610abd57600080fd5b5035612530565b6102f560048036036020811015610ada57600080fd5b503561254b565b6103cf60048036036040811015610af757600080fd5b506001600160a01b03813516906020013515156126b4565b6102d960048036036020811015610b2557600080fd5b50356001600160a01b031661281a565b6102d960048036036040811015610b4b57600080fd5b506001600160a01b0381358116916020013516612838565b6103cf600480360360c0811015610b7957600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135640100000000811115610bad57600080fd5b820183602082011115610bbf57600080fd5b80359060200191846020830284011164010000000083111715610be157600080fd5b919390929091602081019035640100000000811115610bff57600080fd5b820183602082011115610c1157600080fd5b80359060200191846020830284011164010000000083111715610c3357600080fd5b919390929091602081019035640100000000811115610c5157600080fd5b820183602082011115610c6357600080fd5b80359060200191846020830284011164010000000083111715610c8557600080fd5b919390929091602081019035640100000000811115610ca357600080fd5b820183602082011115610cb557600080fd5b80359060200191846001830284011164010000000083111715610cd757600080fd5b50909250905061288f565b6103cf60048036036060811015610cf857600080fd5b506001600160a01b038135811691602081013590911690604001351515612c7d565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161480610d7d57507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b80610db157507f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b90505b919050565b60408051808201909152600f81527f53616e64626f782773204c414e44730000000000000000000000000000000000602082015290565b6000806000610dfe84612d5e565b90925090506001600160a01b038216610e55576040805162461bcd60e51b81526020600482015260146024820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b8015610e7b575050506000818152600660205260409020546001600160a01b0316610db4565b600092505050610db4565b6000610e9182612f82565b90506001600160a01b038116610ee5576040805162461bcd60e51b81526020600482015260146024820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b6001600160a01b038116331480610f1f57506001600160a01b038116600090815260056020908152604080832033845290915290205460ff165b80610f3957503360009081526001602052604090205460ff165b610f8a576040805162461bcd60e51b815260206004820152601960248201527f6e6f7420617574686f72697a656420746f20617070726f766500000000000000604482015290519081900360640190fd5b610f95818484613177565b505050565b61019890565b611012868686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8a01819004810282018101909252888152925088915087908190840183828082843760009201829052509250613256915050565b505050505050565b6000611027848484613699565b90506110348484846138c9565b611046836001600160a01b0316613939565b801561105e575061105e836317a2fd9160e21b613975565b156110dc5761108b816110715733611073565b845b85858560405180602001604052806000815250613a28565b6110dc576040805162461bcd60e51b815260206004820152601e60248201527f657263373231207472616e736665722072656a656374656420627920746f0000604482015290519081900360640190fd5b50505050565b611012868686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8a01819004810282018101909252888152925088915087908190840183828082843760009201919091525060019250613256915050565b600061116282612f82565b90506001600160a01b0384166111bf576040805162461bcd60e51b815260206004820152601660248201527f73656e646572206973207a65726f206164647265737300000000000000000000604482015290519081900360640190fd5b336001600160a01b03851614806111e557503360009081526002602052604090205460ff165b8061121357506001600160a01b038416600090815260056020908152604080832033845290915290205460ff165b8061122d57503360009081526001602052604090205460ff165b61127e576040805162461bcd60e51b815260206004820152601960248201527f6e6f7420617574686f72697a656420746f20617070726f766500000000000000604482015290519081900360640190fd5b836001600160a01b0316816001600160a01b0316146112e4576040805162461bcd60e51b815260206004820152600f60248201527f6f776e657220213d2073656e6465720000000000000000000000000000000000604482015290519081900360640190fd5b6110dc818484613177565b6001600160a01b03871661134a576040805162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f2061646472657373000000000000000000000000604482015290519081900360640190fd5b6001600160a01b0386166113a5576040805162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015290519081900360640190fd5b6000336001600160a01b038916148015906113cf57503360009081526002602052604090205460ff165b9050336001600160a01b038916148015906113e8575080155b1561147f576001600160a01b038816600090815260056020908152604080832033845290915290205460ff168061142e57503360009081526001602052604090205460ff165b61147f576040805162461bcd60e51b815260206004820152601e60248201527f6e6f7420617574686f72697a656420746f207472616e73666572517561640000604482015290519081900360640190fd5b61148c8888888888613b74565b6001600160a01b0380891660009081526003602052604080822080548a800290819003909155928a168252902080549091019055611511816114ce57336114d0565b885b898989898989898080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613cd792505050565b5050505050505050565b60008061152783612f82565b6001600160a01b0316141561157a576040805162461bcd60e51b81526020600482015260146024820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b50610198900690565b610f958383836040518060200160405280600081525061248e565b6115b1336115ab83612f82565b83613dc1565b50565b60075460ff16156115f65760405162461bcd60e51b815260040180806020018281038252602d815260200180614a15602d913960400191505060405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316179055611629826001613e9c565b50506007805460ff19166001179055565b60008061164683612f82565b6001600160a01b03161415611699576040805162461bcd60e51b81526020600482015260146024820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b50610198900490565b60006116ad82612f82565b90506001600160a01b038116610db4576040805162461bcd60e51b81526020600482015260146024820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b6001600160a01b031660009081526001602052604090205460ff1690565b6001600160a01b03861661177a576040805162461bcd60e51b815260206004820152601260248201527f746f206973207a65726f20616464726573730000000000000000000000000000604482015290519081900360640190fd5b6117833361230a565b6117d4576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792061206d696e7465722063616e206d696e7400000000000000000000604482015290519081900360640190fd5b8484816117dd57fe5b061580156117f257508483816117ef57fe5b06155b611843576040805162461bcd60e51b815260206004820152601360248201527f496e76616c696420636f6f7264696e6174657300000000000000000000000000604482015290519081900360640190fd5b8461019803841115801561185b575084610198038311155b6118ac576040805162461bcd60e51b815260206004820152600d60248201527f4f7574206f6620626f756e647300000000000000000000000000000000000000604482015290519081900360640190fd5b60006101988402850160018714156118c65780915061196f565b86600314156118dd5780600160f81b01915061196f565b86600614156118f45780600160f91b01915061196f565b86600c141561190b5780600360f81b01915061196f565b86601814156119225780600160fa1b01915061196f565b6040805162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a650000000000000000000000000000000000000000604482015290519081900360640190fd5b6004600061019860188804601802026018898161198857fe5b04601802600160fa1b01018152602001908152602001600020546000146119f6576040805162461bcd60e51b815260206004820152601760248201527f416c7265616479206d696e746564206173203234783234000000000000000000604482015290519081900360640190fd5b858701858801600c8911611a905760046000610198600c8a04600c0202600c8b81611a1d57fe5b04600c02600360f81b0101815260200190815260200160002054600014611a8b576040805162461bcd60e51b815260206004820152601760248201527f416c7265616479206d696e746564206173203132783132000000000000000000604482015290519081900360640190fd5b611b26565b875b82811015611b2457875b82811015611b1b5761019881028201600360f81b0160008181526004602052604090205415611b12576040805162461bcd60e51b815260206004820152601760248201527f416c7265616479206d696e746564206173203132783132000000000000000000604482015290519081900360640190fd5b50600c01611a9c565b50600c01611a92565b505b60068911611bba576004600061019860068a046006020260068b81611b4757fe5b04600602600160f91b0101815260200190815260200160002054600014611bb5576040805162461bcd60e51b815260206004820152601560248201527f416c7265616479206d696e746564206173203678360000000000000000000000604482015290519081900360640190fd5b611c50565b875b82811015611c4e57875b82811015611c455761019881028201600160f91b0160008181526004602052604090205415611c3c576040805162461bcd60e51b815260206004820152601560248201527f416c7265616479206d696e746564206173203678360000000000000000000000604482015290519081900360640190fd5b50600601611bc6565b50600601611bbc565b505b60038911611ce4576004600061019860038a046003020260038b81611c7157fe5b04600302600160f81b0101815260200190815260200160002054600014611cdf576040805162461bcd60e51b815260206004820152601560248201527f416c7265616479206d696e746564206173203378330000000000000000000000604482015290519081900360640190fd5b611d7a565b875b82811015611d7857875b82811015611d6f5761019881028201600160f81b0160008181526004602052604090205415611d66576040805162461bcd60e51b815260206004820152601560248201527f416c7265616479206d696e746564206173203378330000000000000000000000604482015290519081900360640190fd5b50600301611cf0565b50600301611ce6565b505b60005b898a02811015611e3a576000611d95828c8c8c613f00565b60008181526004602052604090205490915015611df9576040805162461bcd60e51b815260206004820152600e60248201527f416c7265616479206d696e746564000000000000000000000000000000000000604482015290519081900360640190fd5b60405181906001600160a01b038e16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a450600101611d7d565b5060008481526004602090815260408083206001600160a01b038e169081905583526003825280832080548d80020190558051601f8901839004830281018301909152878152611eb192339290918e918e918e918e91908e908e9081908401838280828437600092019190915250613cd792505050565b50505050505050505050565b6000546001600160a01b031690565b60006001600160a01b038216611f29576040805162461bcd60e51b815260206004820152601560248201527f6f776e6572206973207a65726f20616464726573730000000000000000000000604482015290519081900360640190fd5b506001600160a01b031660009081526003602052604090205490565b6001600160a01b038216611fa0576040805162461bcd60e51b815260206004820152601660248201527f496e76616c69642073656e646572206164647265737300000000000000000000604482015290519081900360640190fd5b600080611fac83612d5e565b9092509050336001600160a01b0385161480611fd757503360009081526002602052604090205460ff165b80612000575080801561200057506000838152600660205260409020546001600160a01b031633145b8061202e57506001600160a01b038416600090815260056020908152604080832033845290915290205460ff165b8061204857503360009081526001602052604090205460ff165b612099576040805162461bcd60e51b815260206004820152601660248201527f6e6f7420617574686f72697a656420746f206275726e00000000000000000000604482015290519081900360640190fd5b6110dc848385613dc1565b60036020526000908152604090205481565b6000546001600160a01b03163314612115576040805162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e20616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b612127826001600160a01b0316613939565b6121625760405162461bcd60e51b8152600401808060200182810382526030815260200180614ae56030913960400191505060405180910390fd5b61216c8282613e9c565b5050565b6000546001600160a01b03163381146121d0576040805162461bcd60e51b815260206004820152601b60248201527f6f6e6c792061646d696e2063616e206368616e67652061646d696e0000000000604482015290519081900360640190fd5b806001600160a01b0316826001600160a01b031614156122215760405162461bcd60e51b8152600401808060200182810382526025815260200180614b996025913960400191505060405180910390fd5b604080516001600160a01b0380841682528416602082015281517f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f929181900390910190a1506000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60408051808201909152600481527f4c414e4400000000000000000000000000000000000000000000000000000000602082015290565b60046020526000908152604090205481565b600560209081526000928352604080842090915290825290205460ff1681565b61216c338383613f57565b6001600160a01b031660009081526039602052604090205460ff1690565b6000546001600160a01b03163314612387576040805162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e20616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b6001600160a01b0382166123cc5760405162461bcd60e51b815260040180806020018281038252602a815260200180614a42602a913960400191505060405180910390fd5b6001600160a01b03821660009081526001602052604090205460ff161515811515141561242a5760405162461bcd60e51b8152600401808060200182810382526033815260200180614a6c6033913960400191505060405180910390fd5b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915582519384529083015280517f44f92d27abdf4cfb6a7d712c3af68f3be086d4ca747ab802c36f67d6790060d89281900390910190a15050565b600061249b858585613699565b90506124a88585856138c9565b6124ba846001600160a01b0316613939565b15612529576124d8816124cd57336124cf565b855b86868686613a28565b612529576040805162461bcd60e51b815260206004820152601f60248201527f4552433732313a207472616e736665722072656a656374656420627920746f00604482015290519081900360640190fd5b5050505050565b6006602052600090815260409020546001600160a01b031681565b6060600061255883612f82565b6001600160a01b031614156125b4576040805162461bcd60e51b815260206004820152601160248201527f496420646f6573206e6f74206578697374000000000000000000000000000000604482015290519081900360640190fd5b6125bd8261401d565b60405160200180807f68747470733a2f2f6170692e73616e64626f782e67616d652f6c616e64732f00815250601f0182805190602001908083835b6020831061263557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016125f8565b5181516020939093036101000a60001901801990911692169190911790527f2f6d657461646174612e6a736f6e000000000000000000000000000000000000920191825250604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee018152600e9092019052949350505050565b6000546001600160a01b03163314612713576040805162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e20616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b6001600160a01b0382166127585760405162461bcd60e51b8152600401808060200182810382526022815260200180614ac36022913960400191505060405180910390fd5b6001600160a01b03821660009081526039602052604090205460ff16151581151514156127b65760405162461bcd60e51b8152600401808060200182810382526033815260200180614a6c6033913960400191505060405180910390fd5b6001600160a01b038216600081815260396020908152604091829020805460ff191685151590811790915582519384529083015280517fff452b3b9159b024a9098f0058c63eccd90d36b3584608202800d662f962bb609281900390910190a15050565b6001600160a01b031660009081526002602052604090205460ff1690565b6001600160a01b03808316600090815260056020908152604080832093851683529290529081205460ff168061288657506001600160a01b03821660009081526001602052604090205460ff165b90505b92915050565b6001600160a01b038a166128ea576040805162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f2061646472657373000000000000000000000000604482015290519081900360640190fd5b6001600160a01b038916612945576040805162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015290519081900360640190fd5b868514801561295357508483145b6129a4576040805162461bcd60e51b815260206004820152600c60248201527f696e76616c696420646174610000000000000000000000000000000000000000604482015290519081900360640190fd5b6000336001600160a01b038c16148015906129ce57503360009081526002602052604090205460ff165b9050336001600160a01b038c16148015906129e7575080155b15612a68576001600160a01b038b16600090815260056020908152604080832033845290915290205460ff1680612a2d57503360009081526001602052604090205460ff165b612a685760405162461bcd60e51b8152600401808060200182810382526024815260200180614b4b6024913960400191505060405180910390fd5b6000805b89811015612acb5760008b8b83818110612a8257fe5b905060200201359050612abc8e8e838d8d87818110612a9d57fe5b905060200201358c8c88818110612ab057fe5b90506020020135613b74565b80029190910190600101612a6c565b506001600160a01b03808d1660009081526003602052604080822080548590039055918d16808252919020805483019055612b0590613939565b8015612b1d5750612b1d8b6317a2fd9160e21b613975565b15612c6f57606081604051908082528060200260200182016040528015612b4e578160200160208202803883390190505b5090506000805b8b811015612be15760008d8d83818110612b6b57fe5b90506020020135905060008090505b818202811015612bd757612bb481838f8f87818110612b9557fe5b905060200201358e8e88818110612ba857fe5b90506020020135613f00565b858581518110612bc057fe5b602090810291909101015260019384019301612b7a565b5050600101612b55565b50612c3184612bf05733612bf2565b8e5b8f8f858a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061411292505050565b612c6c5760405162461bcd60e51b8152600401808060200182810382526024815260200180614a9f6024913960400191505060405180910390fd5b50505b505050505050505050505050565b6001600160a01b038316612cd8576040805162461bcd60e51b815260206004820152601660248201527f496e76616c69642073656e646572206164647265737300000000000000000000604482015290519081900360640190fd5b336001600160a01b0384161480612cfe57503360009081526002602052604090205460ff165b80612d1857503360009081526001602052604090205460ff165b612d535760405162461bcd60e51b8152600401808060200182810382526021815260200180614bbe6021913960400191505060405180910390fd5b610f95838383613f57565b6000807fff00000000000000000000000000000000000000000000000000000000000000831615612dd6576040805162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e20696400000000000000000000000000000000604482015290519081900360640190fd5b60008381526004602052604090205461019880850691908504908015612e26579350837f800000000000000000000000000000000000000000000000000000000000000081046001149350612f7a565b6000600481610198600386046003020260038781612e4057fe5b04600302600160f81b0101815260200190815260200160002054905060006001600160a01b0316816001600160a01b031614612e825780955060009450612f78565b6000600481610198600687046006020260068881612e9c57fe5b04600602600160f91b0101815260200190815260200160002054905060006001600160a01b0316816001600160a01b031614612ede5780965060009550612f76565b6000600481610198600c8804600c0202600c8981612ef857fe5b04600c02600360f81b0101815260200190815260200160002054905060006001600160a01b0316816001600160a01b031614612f3a5780975060009650612f74565b60046000610198601888046018020260188981612f5357fe5b04601802600160fa1b01018152602001908152602001600020549750600096505b505b505b505b505050915091565b60007fff00000000000000000000000000000000000000000000000000000000000000821615612ff9576040805162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e20696400000000000000000000000000000000604482015290519081900360640190fd5b60008281526004602052604090205461019880840691908404908015613023579250610db4915050565b600060048161019860038604600302026003878161303d57fe5b04600302600160f81b0101815260200190815260200160002054905060006001600160a01b0316816001600160a01b03161461307e579350610db492505050565b600060048161019860068704600602026006888161309857fe5b04600602600160f91b0101815260200190815260200160002054905060006001600160a01b0316816001600160a01b0316146130da579450610db49350505050565b6000600481610198600c8804600c0202600c89816130f457fe5b04600c02600360f81b0101815260200190815260200160002054905060006001600160a01b0316816001600160a01b031614613137579550610db4945050505050565b6004600061019860188804601802026018898161315057fe5b04601802600160fa1b01018152602001908152602001600020549650505050505050610db4565b6001600160a01b0382166131a45760008181526004602052604090206001600160a01b0384169055613210565b60008181526004602090815260408083206001600160a01b038781167f8000000000000000000000000000000000000000000000000000000000000000019091556006909252909120805473ffffffffffffffffffffffffffffffffffffffff19169184169190911790555b80826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b6000336001600160a01b0387161480159061328057503360009081526002602052604090205460ff165b90506000336001600160a01b03881614806132985750815b806132c657506001600160a01b038716600090815260056020908152604080832033845290915290205460ff165b806132e057503360009081526001602052604090205460ff165b90506001600160a01b03871661333d576040805162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f2061646472657373000000000000000000000000604482015290519081900360640190fd5b6001600160a01b038616613398576040805162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015290519081900360640190fd5b845160005b8181101561351b5760008782815181106133b357fe5b602002602001015190506000806133c983612d5e565b915091508b6001600160a01b0316826001600160a01b031614613433576040805162461bcd60e51b815260206004820152601e60248201527f6e6f74206f776e657220696e2062617463685472616e7366657246726f6d0000604482015290519081900360640190fd5b858061345d575080801561345d57506000838152600660205260409020546001600160a01b031633145b6134ae576040805162461bcd60e51b815260206004820152600e60248201527f6e6f7420617574686f72697a6564000000000000000000000000000000000000604482015290519081900360640190fd5b8a6001600160a01b03166004600085815260200190815260200160002081905550828b6001600160a01b03168d6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a450505060010161339d565b50866001600160a01b0316886001600160a01b031614613563576001600160a01b03808916600090815260036020526040808220805485900390559189168152208054820190555b613575876001600160a01b0316613939565b156115115761358b876317a2fd9160e21b613975565b156135e9576135a98361359e57336135a0565b885b89898989614112565b6135e45760405162461bcd60e51b8152600401808060200182810382526024815260200180614a9f6024913960400191505060405180910390fd5b611511565b83156115115760005b8181101561368e5761363584613608573361360a565b895b8a8a8a858151811061361857fe5b602002602001015160405180602001604052806000815250613a28565b613686576040805162461bcd60e51b815260206004820152601e60248201527f657263373231207472616e736665722072656a656374656420627920746f0000604482015290519081900360640190fd5b6001016135f2565b505050505050505050565b60008060006136a784612d5e565b90925090506001600160a01b0382166136fe576040805162461bcd60e51b81526020600482015260146024820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b856001600160a01b0316826001600160a01b031614613764576040805162461bcd60e51b815260206004820152601b60248201527f6e6f74206f776e657220696e205f636865636b5472616e736665720000000000604482015290519081900360640190fd5b6001600160a01b0385166137bf576040805162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015290519081900360640190fd5b336001600160a01b038716148015906137e757503360009081526002602052604090205460ff165b9250336001600160a01b03871614801590613800575082155b156138c0576001600160a01b038616600090815260056020908152604080832033845290915290205460ff1680613855575080801561385557506000848152600660205260409020546001600160a01b031633145b8061386f57503360009081526001602052604090205460ff165b6138c0576040805162461bcd60e51b815260206004820152601860248201527f6e6f7420617070726f76656420746f207472616e736665720000000000000000604482015290519081900360640190fd5b50509392505050565b6001600160a01b03808416600081815260036020908152604080832080546000190190559386168083528483208054600101905585835260049091528382208190559251849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470823f801580159061396d5750818114155b949350505050565b604080516001600160e01b031983166024808301919091528251808303909101815260449091018252602081810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001781528251935160008082529485948594909392908183858c612710fa955080519450505050609e5a11613a1457fe5b828015613a1e5750815b9695505050505050565b600080846001600160a01b031663150b7a02888887876040518563ffffffff1660e01b815260040180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015613ac0578181015183820152602001613aa8565b50505050905090810190601f168015613aed5780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015613b0f57600080fd5b505af1158015613b23573d6000803e3d6000fd5b505050506040513d6020811015613b3957600080fd5b50516001600160e01b0319167f150b7a0200000000000000000000000000000000000000000000000000000000149150505b95945050505050565b8260011415613c6957610198810282016000613b8f82612f82565b90506001600160a01b038116613be3576040805162461bcd60e51b81526020600482015260146024820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b866001600160a01b0316816001600160a01b031614613c49576040805162461bcd60e51b815260206004820152601a60248201527f6e6f74206f776e657220696e205f7472616e7366657251756164000000000000604482015290519081900360640190fd5b5060009081526004602052604090206001600160a01b0385169055613c76565b613c76858585858561429b565b60005b83840281101561101257613c8f81858585613f00565b856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4600101613c79565b613ce9856001600160a01b0316613939565b8015613d015750613d01856317a2fd9160e21b613975565b15613db8576060848502604051908082528060200260200182016040528015613d34578160200160208202803883390190505b50905060005b858602811015613d6f57613d5081878787613f00565b828281518110613d5c57fe5b6020908102919091010152600101613d3a565b50613d7d8888888486614112565b6115115760405162461bcd60e51b8152600401808060200182810382526024815260200180614a9f6024913960400191505060405180910390fd5b50505050505050565b816001600160a01b0316836001600160a01b031614613e27576040805162461bcd60e51b815260206004820152600960248201527f6e6f74206f776e65720000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60008181526004602090815260408083207401000000000000000000000000000000000000000090556001600160a01b0386168084526003909252808320805460001901905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a4505050565b6001600160a01b038216600081815260026020908152604091829020805460ff191685151590811790915582519384529083015280517fb21eb88b4e33b3f1281830a7178d74d8aa73220416215726b68ae23d539515cb9281900390910190a15050565b600080848681613f0c57fe5b04905060028106613f335761019881840102858781613f2757fe5b0685010191505061396d565b61019881840102858781613f4357fe5b066001018686010301915050949350505050565b6001600160a01b03821660009081526001602052604090205460ff1615613faf5760405162461bcd60e51b8152600401808060200182810382526036815260200180614b156036913960400191505060405180910390fd5b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff1916861515908117909155825190815291517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319281900390910190a3505050565b60608161405e575060408051808201909152600181527f30000000000000000000000000000000000000000000000000000000000000006020820152610db4565b8160005b811561407657600101600a82049150614062565b6060816040519080825280601f01601f1916602001820160405280156140a3576020820181803883390190505b50905060001982015b851561410957600a860660300160f81b828280600190039350815181106140cf57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a860495506140ac565b50949350505050565b600080846001600160a01b0316634b808c46888887876040518563ffffffff1660e01b815260040180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b031681526020018060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156141ab578181015183820152602001614193565b50505050905001838103825284818151815260200191508051906020019080838360005b838110156141e75781810151838201526020016141cf565b50505050905090810190601f1680156142145780820380516001836020036101000a031916815260200191505b509650505050505050602060405180830381600087803b15801561423757600080fd5b505af115801561424b573d6000803e3d6000fd5b505050506040513d602081101561426157600080fd5b50516001600160e01b0319167f4b808c46000000000000000000000000000000000000000000000000000000001491505095945050505050565b8282816142a457fe5b061580156142b957508281816142b657fe5b06155b61430a576040805162461bcd60e51b815260206004820152601360248201527f496e76616c696420636f6f7264696e6174657300000000000000000000000000604482015290519081900360640190fd5b82610198038211158015614322575082610198038111155b614373576040805162461bcd60e51b815260206004820152600d60248201527f4f7574206f6620626f756e647300000000000000000000000000000000000000604482015290519081900360640190fd5b82600314156143905761438a8585848460016143d5565b50612529565b82600614156143a75761438a8585848460016144c5565b82600c14156143be5761438a8585848460016145e8565b82601814156119225761438a85858484600161470b565b600061019883028401600160f81b81016001865b8760030181101561442d57865b87600301811015614424576144118b610198830284016148a2565b801561441a5750825b92506001016143f6565b506001016143e9565b5084156144b9578061449457886001600160a01b031661444f6003898961493f565b6001600160a01b0316146144945760405162461bcd60e51b815260040180806020018281038252602b815260200180614bdf602b913960400191505060405180910390fd5b5060009081526004602052604090206001600160a01b03871690555060019050613b6b565b98975050505050505050565b600061019883028401600160f91b81016001865b876006018110156145c657865b876006018110156145bd5760006145018c8c858560006143d5565b61019883028401600160f81b016000818152600460205260409020549192509080156145995782614589578d6001600160a01b03168114614589576040805162461bcd60e51b815260206004820152601560248201527f6e6f74206f776e6572206f662033783320717561640000000000000000000000604482015290519081900360640190fd5b6000828152600460205260408120555b82806145a457508015155b80156145ad5750855b95505050506003810190506144e6565b506003016144d9565b5084156144b9578061449457886001600160a01b031661444f6006898961493f565b600061019883028401600360f81b81016001865b87600c018110156146e957865b87600c018110156146e05760006146248c8c858560006144c5565b61019883028401600160f91b016000818152600460205260409020549192509080156146bc57826146ac578d6001600160a01b031681146146ac576040805162461bcd60e51b815260206004820152601560248201527f6e6f74206f776e6572206f662036783620717561640000000000000000000000604482015290519081900360640190fd5b6000828152600460205260408120555b82806146c757508015155b80156146d05750855b9550505050600681019050614609565b506006016145fc565b5084156144b9578061449457886001600160a01b031661444f600c898961493f565b600061019883028401600160fa1b81016001865b8760180181101561480c57865b876018018110156148035760006147478c8c858560006145e8565b61019883028401600360f81b016000818152600460205260409020549192509080156147df57826147cf578d6001600160a01b031681146147cf576040805162461bcd60e51b815260206004820152601760248201527f6e6f74206f776e6572206f662031327831322071756164000000000000000000604482015290519081900360640190fd5b6000828152600460205260408120555b82806147ea57508015155b80156147f35750855b9550505050600c8101905061472c565b50600c0161471f565b508415614873578061449457886001600160a01b031661482e6018898961493f565b6001600160a01b0316146144945760405162461bcd60e51b815260040180806020018281038252602a815260200180614b6f602a913960400191505060405180910390fd5b808061489557506000828152600460205260409020546001600160a01b038a16145b9998505050505050505050565b600081815260046020526040812054801561493557836001600160a01b0316816001600160a01b03161461491d576040805162461bcd60e51b815260206004820152600960248201527f6e6f74206f776e65720000000000000000000000000000000000000000000000604482015290519081900360640190fd5b50506000818152600460205260408120556001612889565b5060009392505050565b60008060028502600386141561495b57600160f81b9150614996565b856006141561497057600160f91b9150614996565b85600c141561498557600360f81b9150614996565b856018141561192257600160fa1b91505b600060046000610198898a89816149a957fe5b040202898a8a816149b657fe5b0402860101815260208101919091526040016000205490506001600160a01b038116156149e7579250614a0d915050565b6018871015614a05576149fb82878761493f565b9350505050614a0d565b600093505050505b939250505056fe45524337323142617365546f6b656e3a20436f6e747261637420616c726561647920696e697469616c697a6564616464726573732030206973206e6f7420616c6c6f776564206173207375706572206f70657261746f72746865207374617475732073686f756c6420626520646966666572656e74207468616e207468652063757272656e74206f6e65657263373231206261746368207472616e736665722072656a656374656420627920746f616464726573732030206973206e6f7420616c6c6f776564206173206d696e7465726f6e6c7920636f6e7472616374732063616e206265206d657461207472616e73616374696f6e2070726f636573736f727375706572206f70657261746f722063616e2774206861766520746865697220617070726f76616c466f72416c6c206368616e6765646e6f7420617574686f72697a656420746f207472616e736665724d756c746951756164736e6f74206f776e6572206f6620616c6c20737562207175616473206e6f7420706172656e74207175616469742063616e206265206f6e6c79206368616e67656420746f2061206e65772061646d696e6e6f7420617574686f72697a656420746f20617070726f766520666f7220616c6c6e6f74206f776e6572206f6620616c6c20737562207175616473206e6f7220706172656e74207175616473a265627a7a72305820965d8c3acfe90289d8c5c8bb3109bf3fa9782dcb3cc82a18ddfa9241e18f17ba64736f6c63430005090032", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102ad5760003560e01c806370a082311161017b578063aa271e1a116100d8578063cf456ae71161008c578063e985e9c511610071578063e985e9c514610b35578063eaa5e06714610b63578063eeb5a5d114610ce2576102ad565b8063cf456ae714610ae1578063dc5074af14610b0f576102ad565b8063b88d4fde116100bd578063b88d4fde146109e1578063b9b710e914610aa7578063c87b56dd14610ac4576102ad565b8063aa271e1a1461098d578063ac9fe421146109b3576102ad565b806395d89b411161012f5780639d786bbc116101145780639d786bbc146109315780639ededf77146103d1578063a22cb4651461095f576102ad565b806395d89b411461090c578063992924a614610914576102ad565b8063878267641161016057806387826764146108925780638a04af6a146108b85780638f283970146108e6576102ad565b806370a082311461084057806379cc679014610866576102ad565b806338bb305a116102295780636259e7e1116101dd578063654b748a116101c2578063654b748a146107815780636e1e3bbf146107a75780636e9960c314610838576102ad565b80636259e7e1146107475780636352211e14610764576102ad565b806342842e0e1161020e57806342842e0e146106c657806342966c68146106fc578063485cc95514610719576102ad565b806338bb305a1461060d5780633f4263ef146106a9576102ad565b80630ef267431161028057806323b872dd1161026557806323b872dd146104c657806328cfbd46146104fc5780632b991746146105d7576102ad565b80630ef26743146103d157806315ddc535146103eb576102ad565b806301ffc9a7146102b257806306fdde03146102ed578063081812fc1461036a578063095ea7b3146103a3575b600080fd5b6102d9600480360360208110156102c857600080fd5b50356001600160e01b031916610d1a565b604080519115158252519081900360200190f35b6102f5610db9565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561032f578181015183820152602001610317565b50505050905090810190601f16801561035c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103876004803603602081101561038057600080fd5b5035610df0565b604080516001600160a01b039092168252519081900360200190f35b6103cf600480360360408110156103b957600080fd5b506001600160a01b038135169060200135610e86565b005b6103d9610f9a565b60408051918252519081900360200190f35b6103cf6004803603608081101561040157600080fd5b6001600160a01b03823581169260208101359091169181019060608101604082013564010000000081111561043557600080fd5b82018360208201111561044757600080fd5b8035906020019184602083028401116401000000008311171561046957600080fd5b91939092909160208101903564010000000081111561048757600080fd5b82018360208201111561049957600080fd5b803590602001918460018302840111640100000000831117156104bb57600080fd5b509092509050610fa0565b6103cf600480360360608110156104dc57600080fd5b506001600160a01b0381358116916020810135909116906040013561101a565b6103cf6004803603608081101561051257600080fd5b6001600160a01b03823581169260208101359091169181019060608101604082013564010000000081111561054657600080fd5b82018360208201111561055857600080fd5b8035906020019184602083028401116401000000008311171561057a57600080fd5b91939092909160208101903564010000000081111561059857600080fd5b8201836020820111156105aa57600080fd5b803590602001918460018302840111640100000000831117156105cc57600080fd5b5090925090506110e2565b6103cf600480360360608110156105ed57600080fd5b506001600160a01b03813581169160208101359091169060400135611157565b6103cf600480360360c081101561062357600080fd5b6001600160a01b0382358116926020810135909116916040820135916060810135916080820135919081019060c0810160a082013564010000000081111561066a57600080fd5b82018360208201111561067c57600080fd5b8035906020019184600183028401116401000000008311171561069e57600080fd5b5090925090506112ef565b6103d9600480360360208110156106bf57600080fd5b503561151b565b6103cf600480360360608110156106dc57600080fd5b506001600160a01b03813581169160208101359091169060400135611583565b6103cf6004803603602081101561071257600080fd5b503561159e565b6103cf6004803603604081101561072f57600080fd5b506001600160a01b03813581169160200135166115b4565b6103d96004803603602081101561075d57600080fd5b503561163a565b6103876004803603602081101561077a57600080fd5b50356116a2565b6102d96004803603602081101561079757600080fd5b50356001600160a01b0316611701565b6103cf600480360360a08110156107bd57600080fd5b6001600160a01b038235169160208101359160408201359160608101359181019060a0810160808201356401000000008111156107f957600080fd5b82018360208201111561080b57600080fd5b8035906020019184600183028401116401000000008311171561082d57600080fd5b50909250905061171f565b610387611ebd565b6103d96004803603602081101561085657600080fd5b50356001600160a01b0316611ecc565b6103cf6004803603604081101561087c57600080fd5b506001600160a01b038135169060200135611f45565b6103d9600480360360208110156108a857600080fd5b50356001600160a01b03166120a4565b6103cf600480360360408110156108ce57600080fd5b506001600160a01b03813516906020013515156120b6565b6103cf600480360360208110156108fc57600080fd5b50356001600160a01b0316612170565b6102f5612296565b6103d96004803603602081101561092a57600080fd5b50356122cd565b6102d96004803603604081101561094757600080fd5b506001600160a01b03813581169160200135166122df565b6103cf6004803603604081101561097557600080fd5b506001600160a01b03813516906020013515156122ff565b6102d9600480360360208110156109a357600080fd5b50356001600160a01b031661230a565b6103cf600480360360408110156109c957600080fd5b506001600160a01b0381351690602001351515612328565b6103cf600480360360808110156109f757600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135640100000000811115610a3257600080fd5b820183602082011115610a4457600080fd5b80359060200191846001830284011164010000000083111715610a6657600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061248e945050505050565b61038760048036036020811015610abd57600080fd5b5035612530565b6102f560048036036020811015610ada57600080fd5b503561254b565b6103cf60048036036040811015610af757600080fd5b506001600160a01b03813516906020013515156126b4565b6102d960048036036020811015610b2557600080fd5b50356001600160a01b031661281a565b6102d960048036036040811015610b4b57600080fd5b506001600160a01b0381358116916020013516612838565b6103cf600480360360c0811015610b7957600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135640100000000811115610bad57600080fd5b820183602082011115610bbf57600080fd5b80359060200191846020830284011164010000000083111715610be157600080fd5b919390929091602081019035640100000000811115610bff57600080fd5b820183602082011115610c1157600080fd5b80359060200191846020830284011164010000000083111715610c3357600080fd5b919390929091602081019035640100000000811115610c5157600080fd5b820183602082011115610c6357600080fd5b80359060200191846020830284011164010000000083111715610c8557600080fd5b919390929091602081019035640100000000811115610ca357600080fd5b820183602082011115610cb557600080fd5b80359060200191846001830284011164010000000083111715610cd757600080fd5b50909250905061288f565b6103cf60048036036060811015610cf857600080fd5b506001600160a01b038135811691602081013590911690604001351515612c7d565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161480610d7d57507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b80610db157507f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b90505b919050565b60408051808201909152600f81527f53616e64626f782773204c414e44730000000000000000000000000000000000602082015290565b6000806000610dfe84612d5e565b90925090506001600160a01b038216610e55576040805162461bcd60e51b81526020600482015260146024820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b8015610e7b575050506000818152600660205260409020546001600160a01b0316610db4565b600092505050610db4565b6000610e9182612f82565b90506001600160a01b038116610ee5576040805162461bcd60e51b81526020600482015260146024820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b6001600160a01b038116331480610f1f57506001600160a01b038116600090815260056020908152604080832033845290915290205460ff165b80610f3957503360009081526001602052604090205460ff165b610f8a576040805162461bcd60e51b815260206004820152601960248201527f6e6f7420617574686f72697a656420746f20617070726f766500000000000000604482015290519081900360640190fd5b610f95818484613177565b505050565b61019890565b611012868686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8a01819004810282018101909252888152925088915087908190840183828082843760009201829052509250613256915050565b505050505050565b6000611027848484613699565b90506110348484846138c9565b611046836001600160a01b0316613939565b801561105e575061105e836317a2fd9160e21b613975565b156110dc5761108b816110715733611073565b845b85858560405180602001604052806000815250613a28565b6110dc576040805162461bcd60e51b815260206004820152601e60248201527f657263373231207472616e736665722072656a656374656420627920746f0000604482015290519081900360640190fd5b50505050565b611012868686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8a01819004810282018101909252888152925088915087908190840183828082843760009201919091525060019250613256915050565b600061116282612f82565b90506001600160a01b0384166111bf576040805162461bcd60e51b815260206004820152601660248201527f73656e646572206973207a65726f206164647265737300000000000000000000604482015290519081900360640190fd5b336001600160a01b03851614806111e557503360009081526002602052604090205460ff165b8061121357506001600160a01b038416600090815260056020908152604080832033845290915290205460ff165b8061122d57503360009081526001602052604090205460ff165b61127e576040805162461bcd60e51b815260206004820152601960248201527f6e6f7420617574686f72697a656420746f20617070726f766500000000000000604482015290519081900360640190fd5b836001600160a01b0316816001600160a01b0316146112e4576040805162461bcd60e51b815260206004820152600f60248201527f6f776e657220213d2073656e6465720000000000000000000000000000000000604482015290519081900360640190fd5b6110dc818484613177565b6001600160a01b03871661134a576040805162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f2061646472657373000000000000000000000000604482015290519081900360640190fd5b6001600160a01b0386166113a5576040805162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015290519081900360640190fd5b6000336001600160a01b038916148015906113cf57503360009081526002602052604090205460ff165b9050336001600160a01b038916148015906113e8575080155b1561147f576001600160a01b038816600090815260056020908152604080832033845290915290205460ff168061142e57503360009081526001602052604090205460ff165b61147f576040805162461bcd60e51b815260206004820152601e60248201527f6e6f7420617574686f72697a656420746f207472616e73666572517561640000604482015290519081900360640190fd5b61148c8888888888613b74565b6001600160a01b0380891660009081526003602052604080822080548a800290819003909155928a168252902080549091019055611511816114ce57336114d0565b885b898989898989898080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613cd792505050565b5050505050505050565b60008061152783612f82565b6001600160a01b0316141561157a576040805162461bcd60e51b81526020600482015260146024820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b50610198900690565b610f958383836040518060200160405280600081525061248e565b6115b1336115ab83612f82565b83613dc1565b50565b60075460ff16156115f65760405162461bcd60e51b815260040180806020018281038252602d815260200180614a15602d913960400191505060405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316179055611629826001613e9c565b50506007805460ff19166001179055565b60008061164683612f82565b6001600160a01b03161415611699576040805162461bcd60e51b81526020600482015260146024820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b50610198900490565b60006116ad82612f82565b90506001600160a01b038116610db4576040805162461bcd60e51b81526020600482015260146024820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b6001600160a01b031660009081526001602052604090205460ff1690565b6001600160a01b03861661177a576040805162461bcd60e51b815260206004820152601260248201527f746f206973207a65726f20616464726573730000000000000000000000000000604482015290519081900360640190fd5b6117833361230a565b6117d4576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792061206d696e7465722063616e206d696e7400000000000000000000604482015290519081900360640190fd5b8484816117dd57fe5b061580156117f257508483816117ef57fe5b06155b611843576040805162461bcd60e51b815260206004820152601360248201527f496e76616c696420636f6f7264696e6174657300000000000000000000000000604482015290519081900360640190fd5b8461019803841115801561185b575084610198038311155b6118ac576040805162461bcd60e51b815260206004820152600d60248201527f4f7574206f6620626f756e647300000000000000000000000000000000000000604482015290519081900360640190fd5b60006101988402850160018714156118c65780915061196f565b86600314156118dd5780600160f81b01915061196f565b86600614156118f45780600160f91b01915061196f565b86600c141561190b5780600360f81b01915061196f565b86601814156119225780600160fa1b01915061196f565b6040805162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a650000000000000000000000000000000000000000604482015290519081900360640190fd5b6004600061019860188804601802026018898161198857fe5b04601802600160fa1b01018152602001908152602001600020546000146119f6576040805162461bcd60e51b815260206004820152601760248201527f416c7265616479206d696e746564206173203234783234000000000000000000604482015290519081900360640190fd5b858701858801600c8911611a905760046000610198600c8a04600c0202600c8b81611a1d57fe5b04600c02600360f81b0101815260200190815260200160002054600014611a8b576040805162461bcd60e51b815260206004820152601760248201527f416c7265616479206d696e746564206173203132783132000000000000000000604482015290519081900360640190fd5b611b26565b875b82811015611b2457875b82811015611b1b5761019881028201600360f81b0160008181526004602052604090205415611b12576040805162461bcd60e51b815260206004820152601760248201527f416c7265616479206d696e746564206173203132783132000000000000000000604482015290519081900360640190fd5b50600c01611a9c565b50600c01611a92565b505b60068911611bba576004600061019860068a046006020260068b81611b4757fe5b04600602600160f91b0101815260200190815260200160002054600014611bb5576040805162461bcd60e51b815260206004820152601560248201527f416c7265616479206d696e746564206173203678360000000000000000000000604482015290519081900360640190fd5b611c50565b875b82811015611c4e57875b82811015611c455761019881028201600160f91b0160008181526004602052604090205415611c3c576040805162461bcd60e51b815260206004820152601560248201527f416c7265616479206d696e746564206173203678360000000000000000000000604482015290519081900360640190fd5b50600601611bc6565b50600601611bbc565b505b60038911611ce4576004600061019860038a046003020260038b81611c7157fe5b04600302600160f81b0101815260200190815260200160002054600014611cdf576040805162461bcd60e51b815260206004820152601560248201527f416c7265616479206d696e746564206173203378330000000000000000000000604482015290519081900360640190fd5b611d7a565b875b82811015611d7857875b82811015611d6f5761019881028201600160f81b0160008181526004602052604090205415611d66576040805162461bcd60e51b815260206004820152601560248201527f416c7265616479206d696e746564206173203378330000000000000000000000604482015290519081900360640190fd5b50600301611cf0565b50600301611ce6565b505b60005b898a02811015611e3a576000611d95828c8c8c613f00565b60008181526004602052604090205490915015611df9576040805162461bcd60e51b815260206004820152600e60248201527f416c7265616479206d696e746564000000000000000000000000000000000000604482015290519081900360640190fd5b60405181906001600160a01b038e16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a450600101611d7d565b5060008481526004602090815260408083206001600160a01b038e169081905583526003825280832080548d80020190558051601f8901839004830281018301909152878152611eb192339290918e918e918e918e91908e908e9081908401838280828437600092019190915250613cd792505050565b50505050505050505050565b6000546001600160a01b031690565b60006001600160a01b038216611f29576040805162461bcd60e51b815260206004820152601560248201527f6f776e6572206973207a65726f20616464726573730000000000000000000000604482015290519081900360640190fd5b506001600160a01b031660009081526003602052604090205490565b6001600160a01b038216611fa0576040805162461bcd60e51b815260206004820152601660248201527f496e76616c69642073656e646572206164647265737300000000000000000000604482015290519081900360640190fd5b600080611fac83612d5e565b9092509050336001600160a01b0385161480611fd757503360009081526002602052604090205460ff165b80612000575080801561200057506000838152600660205260409020546001600160a01b031633145b8061202e57506001600160a01b038416600090815260056020908152604080832033845290915290205460ff165b8061204857503360009081526001602052604090205460ff165b612099576040805162461bcd60e51b815260206004820152601660248201527f6e6f7420617574686f72697a656420746f206275726e00000000000000000000604482015290519081900360640190fd5b6110dc848385613dc1565b60036020526000908152604090205481565b6000546001600160a01b03163314612115576040805162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e20616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b612127826001600160a01b0316613939565b6121625760405162461bcd60e51b8152600401808060200182810382526030815260200180614ae56030913960400191505060405180910390fd5b61216c8282613e9c565b5050565b6000546001600160a01b03163381146121d0576040805162461bcd60e51b815260206004820152601b60248201527f6f6e6c792061646d696e2063616e206368616e67652061646d696e0000000000604482015290519081900360640190fd5b806001600160a01b0316826001600160a01b031614156122215760405162461bcd60e51b8152600401808060200182810382526025815260200180614b996025913960400191505060405180910390fd5b604080516001600160a01b0380841682528416602082015281517f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f929181900390910190a1506000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60408051808201909152600481527f4c414e4400000000000000000000000000000000000000000000000000000000602082015290565b60046020526000908152604090205481565b600560209081526000928352604080842090915290825290205460ff1681565b61216c338383613f57565b6001600160a01b031660009081526039602052604090205460ff1690565b6000546001600160a01b03163314612387576040805162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e20616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b6001600160a01b0382166123cc5760405162461bcd60e51b815260040180806020018281038252602a815260200180614a42602a913960400191505060405180910390fd5b6001600160a01b03821660009081526001602052604090205460ff161515811515141561242a5760405162461bcd60e51b8152600401808060200182810382526033815260200180614a6c6033913960400191505060405180910390fd5b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915582519384529083015280517f44f92d27abdf4cfb6a7d712c3af68f3be086d4ca747ab802c36f67d6790060d89281900390910190a15050565b600061249b858585613699565b90506124a88585856138c9565b6124ba846001600160a01b0316613939565b15612529576124d8816124cd57336124cf565b855b86868686613a28565b612529576040805162461bcd60e51b815260206004820152601f60248201527f4552433732313a207472616e736665722072656a656374656420627920746f00604482015290519081900360640190fd5b5050505050565b6006602052600090815260409020546001600160a01b031681565b6060600061255883612f82565b6001600160a01b031614156125b4576040805162461bcd60e51b815260206004820152601160248201527f496420646f6573206e6f74206578697374000000000000000000000000000000604482015290519081900360640190fd5b6125bd8261401d565b60405160200180807f68747470733a2f2f6170692e73616e64626f782e67616d652f6c616e64732f00815250601f0182805190602001908083835b6020831061263557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016125f8565b5181516020939093036101000a60001901801990911692169190911790527f2f6d657461646174612e6a736f6e000000000000000000000000000000000000920191825250604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee018152600e9092019052949350505050565b6000546001600160a01b03163314612713576040805162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e20616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b6001600160a01b0382166127585760405162461bcd60e51b8152600401808060200182810382526022815260200180614ac36022913960400191505060405180910390fd5b6001600160a01b03821660009081526039602052604090205460ff16151581151514156127b65760405162461bcd60e51b8152600401808060200182810382526033815260200180614a6c6033913960400191505060405180910390fd5b6001600160a01b038216600081815260396020908152604091829020805460ff191685151590811790915582519384529083015280517fff452b3b9159b024a9098f0058c63eccd90d36b3584608202800d662f962bb609281900390910190a15050565b6001600160a01b031660009081526002602052604090205460ff1690565b6001600160a01b03808316600090815260056020908152604080832093851683529290529081205460ff168061288657506001600160a01b03821660009081526001602052604090205460ff165b90505b92915050565b6001600160a01b038a166128ea576040805162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f2061646472657373000000000000000000000000604482015290519081900360640190fd5b6001600160a01b038916612945576040805162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015290519081900360640190fd5b868514801561295357508483145b6129a4576040805162461bcd60e51b815260206004820152600c60248201527f696e76616c696420646174610000000000000000000000000000000000000000604482015290519081900360640190fd5b6000336001600160a01b038c16148015906129ce57503360009081526002602052604090205460ff165b9050336001600160a01b038c16148015906129e7575080155b15612a68576001600160a01b038b16600090815260056020908152604080832033845290915290205460ff1680612a2d57503360009081526001602052604090205460ff165b612a685760405162461bcd60e51b8152600401808060200182810382526024815260200180614b4b6024913960400191505060405180910390fd5b6000805b89811015612acb5760008b8b83818110612a8257fe5b905060200201359050612abc8e8e838d8d87818110612a9d57fe5b905060200201358c8c88818110612ab057fe5b90506020020135613b74565b80029190910190600101612a6c565b506001600160a01b03808d1660009081526003602052604080822080548590039055918d16808252919020805483019055612b0590613939565b8015612b1d5750612b1d8b6317a2fd9160e21b613975565b15612c6f57606081604051908082528060200260200182016040528015612b4e578160200160208202803883390190505b5090506000805b8b811015612be15760008d8d83818110612b6b57fe5b90506020020135905060008090505b818202811015612bd757612bb481838f8f87818110612b9557fe5b905060200201358e8e88818110612ba857fe5b90506020020135613f00565b858581518110612bc057fe5b602090810291909101015260019384019301612b7a565b5050600101612b55565b50612c3184612bf05733612bf2565b8e5b8f8f858a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061411292505050565b612c6c5760405162461bcd60e51b8152600401808060200182810382526024815260200180614a9f6024913960400191505060405180910390fd5b50505b505050505050505050505050565b6001600160a01b038316612cd8576040805162461bcd60e51b815260206004820152601660248201527f496e76616c69642073656e646572206164647265737300000000000000000000604482015290519081900360640190fd5b336001600160a01b0384161480612cfe57503360009081526002602052604090205460ff165b80612d1857503360009081526001602052604090205460ff165b612d535760405162461bcd60e51b8152600401808060200182810382526021815260200180614bbe6021913960400191505060405180910390fd5b610f95838383613f57565b6000807fff00000000000000000000000000000000000000000000000000000000000000831615612dd6576040805162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e20696400000000000000000000000000000000604482015290519081900360640190fd5b60008381526004602052604090205461019880850691908504908015612e26579350837f800000000000000000000000000000000000000000000000000000000000000081046001149350612f7a565b6000600481610198600386046003020260038781612e4057fe5b04600302600160f81b0101815260200190815260200160002054905060006001600160a01b0316816001600160a01b031614612e825780955060009450612f78565b6000600481610198600687046006020260068881612e9c57fe5b04600602600160f91b0101815260200190815260200160002054905060006001600160a01b0316816001600160a01b031614612ede5780965060009550612f76565b6000600481610198600c8804600c0202600c8981612ef857fe5b04600c02600360f81b0101815260200190815260200160002054905060006001600160a01b0316816001600160a01b031614612f3a5780975060009650612f74565b60046000610198601888046018020260188981612f5357fe5b04601802600160fa1b01018152602001908152602001600020549750600096505b505b505b505b505050915091565b60007fff00000000000000000000000000000000000000000000000000000000000000821615612ff9576040805162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e20696400000000000000000000000000000000604482015290519081900360640190fd5b60008281526004602052604090205461019880840691908404908015613023579250610db4915050565b600060048161019860038604600302026003878161303d57fe5b04600302600160f81b0101815260200190815260200160002054905060006001600160a01b0316816001600160a01b03161461307e579350610db492505050565b600060048161019860068704600602026006888161309857fe5b04600602600160f91b0101815260200190815260200160002054905060006001600160a01b0316816001600160a01b0316146130da579450610db49350505050565b6000600481610198600c8804600c0202600c89816130f457fe5b04600c02600360f81b0101815260200190815260200160002054905060006001600160a01b0316816001600160a01b031614613137579550610db4945050505050565b6004600061019860188804601802026018898161315057fe5b04601802600160fa1b01018152602001908152602001600020549650505050505050610db4565b6001600160a01b0382166131a45760008181526004602052604090206001600160a01b0384169055613210565b60008181526004602090815260408083206001600160a01b038781167f8000000000000000000000000000000000000000000000000000000000000000019091556006909252909120805473ffffffffffffffffffffffffffffffffffffffff19169184169190911790555b80826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b6000336001600160a01b0387161480159061328057503360009081526002602052604090205460ff165b90506000336001600160a01b03881614806132985750815b806132c657506001600160a01b038716600090815260056020908152604080832033845290915290205460ff165b806132e057503360009081526001602052604090205460ff165b90506001600160a01b03871661333d576040805162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f2061646472657373000000000000000000000000604482015290519081900360640190fd5b6001600160a01b038616613398576040805162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015290519081900360640190fd5b845160005b8181101561351b5760008782815181106133b357fe5b602002602001015190506000806133c983612d5e565b915091508b6001600160a01b0316826001600160a01b031614613433576040805162461bcd60e51b815260206004820152601e60248201527f6e6f74206f776e657220696e2062617463685472616e7366657246726f6d0000604482015290519081900360640190fd5b858061345d575080801561345d57506000838152600660205260409020546001600160a01b031633145b6134ae576040805162461bcd60e51b815260206004820152600e60248201527f6e6f7420617574686f72697a6564000000000000000000000000000000000000604482015290519081900360640190fd5b8a6001600160a01b03166004600085815260200190815260200160002081905550828b6001600160a01b03168d6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a450505060010161339d565b50866001600160a01b0316886001600160a01b031614613563576001600160a01b03808916600090815260036020526040808220805485900390559189168152208054820190555b613575876001600160a01b0316613939565b156115115761358b876317a2fd9160e21b613975565b156135e9576135a98361359e57336135a0565b885b89898989614112565b6135e45760405162461bcd60e51b8152600401808060200182810382526024815260200180614a9f6024913960400191505060405180910390fd5b611511565b83156115115760005b8181101561368e5761363584613608573361360a565b895b8a8a8a858151811061361857fe5b602002602001015160405180602001604052806000815250613a28565b613686576040805162461bcd60e51b815260206004820152601e60248201527f657263373231207472616e736665722072656a656374656420627920746f0000604482015290519081900360640190fd5b6001016135f2565b505050505050505050565b60008060006136a784612d5e565b90925090506001600160a01b0382166136fe576040805162461bcd60e51b81526020600482015260146024820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b856001600160a01b0316826001600160a01b031614613764576040805162461bcd60e51b815260206004820152601b60248201527f6e6f74206f776e657220696e205f636865636b5472616e736665720000000000604482015290519081900360640190fd5b6001600160a01b0385166137bf576040805162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015290519081900360640190fd5b336001600160a01b038716148015906137e757503360009081526002602052604090205460ff165b9250336001600160a01b03871614801590613800575082155b156138c0576001600160a01b038616600090815260056020908152604080832033845290915290205460ff1680613855575080801561385557506000848152600660205260409020546001600160a01b031633145b8061386f57503360009081526001602052604090205460ff165b6138c0576040805162461bcd60e51b815260206004820152601860248201527f6e6f7420617070726f76656420746f207472616e736665720000000000000000604482015290519081900360640190fd5b50509392505050565b6001600160a01b03808416600081815260036020908152604080832080546000190190559386168083528483208054600101905585835260049091528382208190559251849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470823f801580159061396d5750818114155b949350505050565b604080516001600160e01b031983166024808301919091528251808303909101815260449091018252602081810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001781528251935160008082529485948594909392908183858c612710fa955080519450505050609e5a11613a1457fe5b828015613a1e5750815b9695505050505050565b600080846001600160a01b031663150b7a02888887876040518563ffffffff1660e01b815260040180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015613ac0578181015183820152602001613aa8565b50505050905090810190601f168015613aed5780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015613b0f57600080fd5b505af1158015613b23573d6000803e3d6000fd5b505050506040513d6020811015613b3957600080fd5b50516001600160e01b0319167f150b7a0200000000000000000000000000000000000000000000000000000000149150505b95945050505050565b8260011415613c6957610198810282016000613b8f82612f82565b90506001600160a01b038116613be3576040805162461bcd60e51b81526020600482015260146024820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b866001600160a01b0316816001600160a01b031614613c49576040805162461bcd60e51b815260206004820152601a60248201527f6e6f74206f776e657220696e205f7472616e7366657251756164000000000000604482015290519081900360640190fd5b5060009081526004602052604090206001600160a01b0385169055613c76565b613c76858585858561429b565b60005b83840281101561101257613c8f81858585613f00565b856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4600101613c79565b613ce9856001600160a01b0316613939565b8015613d015750613d01856317a2fd9160e21b613975565b15613db8576060848502604051908082528060200260200182016040528015613d34578160200160208202803883390190505b50905060005b858602811015613d6f57613d5081878787613f00565b828281518110613d5c57fe5b6020908102919091010152600101613d3a565b50613d7d8888888486614112565b6115115760405162461bcd60e51b8152600401808060200182810382526024815260200180614a9f6024913960400191505060405180910390fd5b50505050505050565b816001600160a01b0316836001600160a01b031614613e27576040805162461bcd60e51b815260206004820152600960248201527f6e6f74206f776e65720000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60008181526004602090815260408083207401000000000000000000000000000000000000000090556001600160a01b0386168084526003909252808320805460001901905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a4505050565b6001600160a01b038216600081815260026020908152604091829020805460ff191685151590811790915582519384529083015280517fb21eb88b4e33b3f1281830a7178d74d8aa73220416215726b68ae23d539515cb9281900390910190a15050565b600080848681613f0c57fe5b04905060028106613f335761019881840102858781613f2757fe5b0685010191505061396d565b61019881840102858781613f4357fe5b066001018686010301915050949350505050565b6001600160a01b03821660009081526001602052604090205460ff1615613faf5760405162461bcd60e51b8152600401808060200182810382526036815260200180614b156036913960400191505060405180910390fd5b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff1916861515908117909155825190815291517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319281900390910190a3505050565b60608161405e575060408051808201909152600181527f30000000000000000000000000000000000000000000000000000000000000006020820152610db4565b8160005b811561407657600101600a82049150614062565b6060816040519080825280601f01601f1916602001820160405280156140a3576020820181803883390190505b50905060001982015b851561410957600a860660300160f81b828280600190039350815181106140cf57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a860495506140ac565b50949350505050565b600080846001600160a01b0316634b808c46888887876040518563ffffffff1660e01b815260040180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b031681526020018060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156141ab578181015183820152602001614193565b50505050905001838103825284818151815260200191508051906020019080838360005b838110156141e75781810151838201526020016141cf565b50505050905090810190601f1680156142145780820380516001836020036101000a031916815260200191505b509650505050505050602060405180830381600087803b15801561423757600080fd5b505af115801561424b573d6000803e3d6000fd5b505050506040513d602081101561426157600080fd5b50516001600160e01b0319167f4b808c46000000000000000000000000000000000000000000000000000000001491505095945050505050565b8282816142a457fe5b061580156142b957508281816142b657fe5b06155b61430a576040805162461bcd60e51b815260206004820152601360248201527f496e76616c696420636f6f7264696e6174657300000000000000000000000000604482015290519081900360640190fd5b82610198038211158015614322575082610198038111155b614373576040805162461bcd60e51b815260206004820152600d60248201527f4f7574206f6620626f756e647300000000000000000000000000000000000000604482015290519081900360640190fd5b82600314156143905761438a8585848460016143d5565b50612529565b82600614156143a75761438a8585848460016144c5565b82600c14156143be5761438a8585848460016145e8565b82601814156119225761438a85858484600161470b565b600061019883028401600160f81b81016001865b8760030181101561442d57865b87600301811015614424576144118b610198830284016148a2565b801561441a5750825b92506001016143f6565b506001016143e9565b5084156144b9578061449457886001600160a01b031661444f6003898961493f565b6001600160a01b0316146144945760405162461bcd60e51b815260040180806020018281038252602b815260200180614bdf602b913960400191505060405180910390fd5b5060009081526004602052604090206001600160a01b03871690555060019050613b6b565b98975050505050505050565b600061019883028401600160f91b81016001865b876006018110156145c657865b876006018110156145bd5760006145018c8c858560006143d5565b61019883028401600160f81b016000818152600460205260409020549192509080156145995782614589578d6001600160a01b03168114614589576040805162461bcd60e51b815260206004820152601560248201527f6e6f74206f776e6572206f662033783320717561640000000000000000000000604482015290519081900360640190fd5b6000828152600460205260408120555b82806145a457508015155b80156145ad5750855b95505050506003810190506144e6565b506003016144d9565b5084156144b9578061449457886001600160a01b031661444f6006898961493f565b600061019883028401600360f81b81016001865b87600c018110156146e957865b87600c018110156146e05760006146248c8c858560006144c5565b61019883028401600160f91b016000818152600460205260409020549192509080156146bc57826146ac578d6001600160a01b031681146146ac576040805162461bcd60e51b815260206004820152601560248201527f6e6f74206f776e6572206f662036783620717561640000000000000000000000604482015290519081900360640190fd5b6000828152600460205260408120555b82806146c757508015155b80156146d05750855b9550505050600681019050614609565b506006016145fc565b5084156144b9578061449457886001600160a01b031661444f600c898961493f565b600061019883028401600160fa1b81016001865b8760180181101561480c57865b876018018110156148035760006147478c8c858560006145e8565b61019883028401600360f81b016000818152600460205260409020549192509080156147df57826147cf578d6001600160a01b031681146147cf576040805162461bcd60e51b815260206004820152601760248201527f6e6f74206f776e6572206f662031327831322071756164000000000000000000604482015290519081900360640190fd5b6000828152600460205260408120555b82806147ea57508015155b80156147f35750855b9550505050600c8101905061472c565b50600c0161471f565b508415614873578061449457886001600160a01b031661482e6018898961493f565b6001600160a01b0316146144945760405162461bcd60e51b815260040180806020018281038252602a815260200180614b6f602a913960400191505060405180910390fd5b808061489557506000828152600460205260409020546001600160a01b038a16145b9998505050505050505050565b600081815260046020526040812054801561493557836001600160a01b0316816001600160a01b03161461491d576040805162461bcd60e51b815260206004820152600960248201527f6e6f74206f776e65720000000000000000000000000000000000000000000000604482015290519081900360640190fd5b50506000818152600460205260408120556001612889565b5060009392505050565b60008060028502600386141561495b57600160f81b9150614996565b856006141561497057600160f91b9150614996565b85600c141561498557600360f81b9150614996565b856018141561192257600160fa1b91505b600060046000610198898a89816149a957fe5b040202898a8a816149b657fe5b0402860101815260208101919091526040016000205490506001600160a01b038116156149e7579250614a0d915050565b6018871015614a05576149fb82878761493f565b9350505050614a0d565b600093505050505b939250505056fe45524337323142617365546f6b656e3a20436f6e747261637420616c726561647920696e697469616c697a6564616464726573732030206973206e6f7420616c6c6f776564206173207375706572206f70657261746f72746865207374617475732073686f756c6420626520646966666572656e74207468616e207468652063757272656e74206f6e65657263373231206261746368207472616e736665722072656a656374656420627920746f616464726573732030206973206e6f7420616c6c6f776564206173206d696e7465726f6e6c7920636f6e7472616374732063616e206265206d657461207472616e73616374696f6e2070726f636573736f727375706572206f70657261746f722063616e2774206861766520746865697220617070726f76616c466f72416c6c206368616e6765646e6f7420617574686f72697a656420746f207472616e736665724d756c746951756164736e6f74206f776e6572206f6620616c6c20737562207175616473206e6f7420706172656e74207175616469742063616e206265206f6e6c79206368616e67656420746f2061206e65772061646d696e6e6f7420617574686f72697a656420746f20617070726f766520666f7220616c6c6e6f74206f776e6572206f6620616c6c20737562207175616473206e6f7220706172656e74207175616473a265627a7a72305820965d8c3acfe90289d8c5c8bb3109bf3fa9782dcb3cc82a18ddfa9241e18f17ba64736f6c63430005090032", + "numDeployments": 3, + "solcInputHash": "fcd35bfc0b4ed9a8e53dfc2c10882b4b", + "metadata": "{\"compiler\":{\"version\":\"0.5.9+commit.c68bc34e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[{\"name\":\"id\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"operator\",\"type\":\"address\"},{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"height\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"ids\",\"type\":\"uint256[]\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"batchTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"ids\",\"type\":\"uint256[]\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeBatchTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"sender\",\"type\":\"address\"},{\"name\":\"operator\",\"type\":\"address\"},{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"approveFor\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"size\",\"type\":\"uint256\"},{\"name\":\"x\",\"type\":\"uint256\"},{\"name\":\"y\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"transferQuad\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"metaTransactionContract\",\"type\":\"address\"},{\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"size\",\"type\":\"uint256\"},{\"name\":\"x\",\"type\":\"uint256\"},{\"name\":\"y\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"mintAndTransferQuad\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"size\",\"type\":\"uint256\"},{\"name\":\"x\",\"type\":\"uint256\"},{\"name\":\"y\",\"type\":\"uint256\"}],\"name\":\"exists\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"who\",\"type\":\"address\"}],\"name\":\"isSuperOperator\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"size\",\"type\":\"uint256\"},{\"name\":\"x\",\"type\":\"uint256\"},{\"name\":\"y\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"mintQuad\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getAdmin\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"burnFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getY\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"_numNFTPerAddress\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"metaTransactionProcessor\",\"type\":\"address\"},{\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setMetaTransactionProcessor\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getX\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"_owners\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"registry\",\"type\":\"address\"}],\"name\":\"setOperatorRegistry\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"},{\"name\":\"\",\"type\":\"address\"}],\"name\":\"_operatorsForAll\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"width\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"operator\",\"type\":\"address\"},{\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"who\",\"type\":\"address\"}],\"name\":\"isMinter\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"subscriptionOrRegistrantToCopy\",\"type\":\"address\"},{\"name\":\"subscribe\",\"type\":\"bool\"}],\"name\":\"register\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"superOperator\",\"type\":\"address\"},{\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setSuperOperator\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"operatorFilterRegistry\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"id\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"_operators\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"minter\",\"type\":\"address\"},{\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setMinter\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"who\",\"type\":\"address\"}],\"name\":\"isMetaTransactionProcessor\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"sizes\",\"type\":\"uint256[]\"},{\"name\":\"xs\",\"type\":\"uint256[]\"},{\"name\":\"ys\",\"type\":\"uint256[]\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"batchTransferQuad\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"sender\",\"type\":\"address\"},{\"name\":\"operator\",\"type\":\"address\"},{\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAllFor\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"registry\",\"type\":\"address\"}],\"name\":\"OperatorRegistrySet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"subscriptionOrRegistrant\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"subscribe\",\"type\":\"bool\"}],\"name\":\"ContractRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"superOperator\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"Minter\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"metaTransactionProcessor\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"MetaTransactionProcessor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"superOperator\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"SuperOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"oldAdmin\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_approved\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_operator\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"}],\"devdoc\":{\"author\":\"The Sandbox\",\"details\":\"LAND contract implements ERC721, quad and marketplace filtering functionalities\",\"methods\":{\"approve(address,uint256)\":{\"params\":{\"id\":\"The id of the token\",\"operator\":\"The address receiving the approval\"}},\"approveFor(address,address,uint256)\":{\"params\":{\"id\":\"The id of the token\",\"operator\":\"The address receiving the approval\",\"sender\":\"The address giving the approval\"}},\"balanceOf(address)\":{\"params\":{\"owner\":\"The address to look for\"},\"return\":\"The number of Land token owned by the address\"},\"batchTransferFrom(address,address,uint256[],bytes)\":{\"params\":{\"data\":\"additional data\",\"from\":\"The sender of the token\",\"ids\":\"The ids of the tokens\",\"to\":\"The recipient of the token\"}},\"batchTransferQuad(address,address,uint256[],uint256[],uint256[],bytes)\":{\"params\":{\"data\":\"additional data\",\"from\":\"current owner of the quad\",\"sizes\":\"list of sizes for each quad\",\"to\":\"destination\",\"xs\":\"list of top left x coordinates for each quad\",\"ys\":\"list of top left y coordinates for each quad\"}},\"burn(uint256)\":{\"params\":{\"id\":\"token which will be burnt.\"}},\"burnFrom(address,uint256)\":{\"params\":{\"from\":\"address whose token is to be burnt.\",\"id\":\"token which will be burnt.\"}},\"changeAdmin(address)\":{\"params\":{\"newAdmin\":\"address of the new administrator.\"}},\"exists(uint256,uint256,uint256)\":{\"params\":{\"size\":\"size of the quad\",\"x\":\"x coordinate of the quad\",\"y\":\"y coordinate of the quad\"},\"return\":\"bool for if Land has been minted or not\"},\"getAdmin()\":{\"return\":\"the current administrator of this contract.\"},\"getApproved(uint256)\":{\"params\":{\"id\":\"The id of the token\"},\"return\":\"The address of the operator\"},\"getX(uint256)\":{\"params\":{\"id\":\"tokenId\"},\"return\":\"the x coordinates\"},\"getY(uint256)\":{\"params\":{\"id\":\"tokenId\"},\"return\":\"the y coordinates\"},\"height()\":{\"return\":\"height\"},\"initialize(address,address)\":{\"params\":{\"admin\":\"Admin of the contract\",\"metaTransactionContract\":\"Authorized contract for meta-transactions\"}},\"isApprovedForAll(address,address)\":{\"params\":{\"operator\":\"The address of the operator\",\"owner\":\"The address of the owner\"},\"return\":\"The status of the approval\"},\"isMetaTransactionProcessor(address)\":{\"params\":{\"who\":\"The address to query.\"},\"return\":\"whether the address has meta-transaction execution rights.\"},\"isMinter(address)\":{\"params\":{\"who\":\"The address to query.\"},\"return\":\"whether the address has minter rights.\"},\"isSuperOperator(address)\":{\"params\":{\"who\":\"The address to query.\"},\"return\":\"whether the address has superOperator rights.\"},\"mintAndTransferQuad(address,uint256,uint256,uint256,bytes)\":{\"params\":{\"data\":\"extra data to pass to the transfer\",\"size\":\"The size of the new quad\",\"to\":\"The recipient of the new quad\",\"x\":\"The top left x coordinate of the new quad\",\"y\":\"The top left y coordinate of the new quad\"}},\"mintQuad(address,uint256,uint256,uint256,bytes)\":{\"params\":{\"data\":\"extra data to pass to the transfer\",\"size\":\"The size of the new quad\",\"to\":\"The recipient of the new quad\",\"x\":\"The top left x coordinate of the new quad\",\"y\":\"The top left y coordinate of the new quad\"}},\"name()\":{\"return\":\"The name of the token contract\"},\"ownerOf(uint256)\":{\"params\":{\"id\":\"The id of the Land\"},\"return\":\"The address of the owner\"},\"register(address,bool)\":{\"details\":\"used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.\",\"params\":{\"subscribe\":\"bool to signify subscription \\\"true\\\"\\\" or to copy the list \\\"false\\\".\",\"subscriptionOrRegistrantToCopy\":\"registration address of the list to subscribe.\"}},\"safeBatchTransferFrom(address,address,uint256[],bytes)\":{\"params\":{\"data\":\"additional data\",\"from\":\"The sender of the token\",\"ids\":\"The ids of the tokens\",\"to\":\"The recipient of the token\"}},\"safeTransferFrom(address,address,uint256)\":{\"params\":{\"from\":\"The send of the token\",\"id\":\"The id of the token\",\"to\":\"The recipient of the token\"}},\"safeTransferFrom(address,address,uint256,bytes)\":{\"params\":{\"data\":\"Additional data\",\"from\":\"The sender of the token\",\"id\":\"The id of the token\",\"to\":\"The recipient of the token\"}},\"setApprovalForAll(address,bool)\":{\"params\":{\"approved\":\"The determination of the approval\",\"operator\":\"The address receiving the approval\"}},\"setApprovalForAllFor(address,address,bool)\":{\"params\":{\"approved\":\"The determination of the approval\",\"operator\":\"The address receiving the approval\",\"sender\":\"The address giving the approval\"}},\"setMetaTransactionProcessor(address,bool)\":{\"params\":{\"enabled\":\"set whether the metaTransactionProcessor is enabled or disabled.\",\"metaTransactionProcessor\":\"address that will be given/removed metaTransactionProcessor rights.\"}},\"setMinter(address,bool)\":{\"params\":{\"enabled\":\"set whether the minter is enabled or disabled.\",\"minter\":\"address that will be given/removed minter right.\"}},\"setOperatorRegistry(address)\":{\"params\":{\"registry\":\"the address of the registry\"}},\"setSuperOperator(address,bool)\":{\"params\":{\"enabled\":\"set whether the superOperator is enabled or disabled.\",\"superOperator\":\"address that will be given/removed superOperator right.\"}},\"supportsInterface(bytes4)\":{\"params\":{\"id\":\"The id of the interface\"},\"return\":\"True if the interface is supported\"},\"symbol()\":{\"return\":\"The symbol of the token contract\"},\"tokenURI(uint256)\":{\"params\":{\"id\":\"The id of the token\"},\"return\":\"The URI of the token\"},\"transferFrom(address,address,uint256)\":{\"params\":{\"from\":\"The sender of the token\",\"id\":\"The id of the token\",\"to\":\"The recipient of the token\"}},\"transferQuad(address,address,uint256,uint256,uint256,bytes)\":{\"params\":{\"data\":\"additional data\",\"from\":\"current owner of the quad\",\"size\":\"size of the quad\",\"to\":\"destination\",\"x\":\"The top left x coordinate of the quad\",\"y\":\"The top left y coordinate of the quad\"}},\"width()\":{\"return\":\"width\"}},\"title\":\"LandV3\"},\"userdoc\":{\"methods\":{\"approve(address,uint256)\":{\"notice\":\"Approve an operator to spend tokens on the sender behalf\"},\"approveFor(address,address,uint256)\":{\"notice\":\"Approve an operator to spend tokens on the sender behalf\"},\"balanceOf(address)\":{\"notice\":\"Return the number of Land owned by an address\"},\"batchTransferFrom(address,address,uint256[],bytes)\":{\"notice\":\"Transfer many tokens between 2 addresses\"},\"batchTransferQuad(address,address,uint256[],uint256[],uint256[],bytes)\":{\"notice\":\"transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\"},\"burn(uint256)\":{\"notice\":\"Burns token `id`.\"},\"burnFrom(address,uint256)\":{\"notice\":\"Burn token`id` from `from`.\"},\"changeAdmin(address)\":{\"notice\":\"change the administrator to be `newAdmin`.\"},\"exists(uint256,uint256,uint256)\":{\"notice\":\"checks if Land has been minted or not\"},\"getAdmin()\":{\"notice\":\"gives the current administrator of this contract.\"},\"getApproved(uint256)\":{\"notice\":\"Get the approved operator for a specific token\"},\"getX(uint256)\":{\"notice\":\"x coordinate of Land token\"},\"getY(uint256)\":{\"notice\":\"y coordinate of Land token\"},\"height()\":{\"notice\":\"total height of the map\"},\"initialize(address,address)\":{\"notice\":\"Initializes the contract with the meta-transaction contract & admin\"},\"isApprovedForAll(address,address)\":{\"notice\":\"Check if the sender approved the operator\"},\"isMetaTransactionProcessor(address)\":{\"notice\":\"check whether address `who` is given meta-transaction execution rights.\"},\"isMinter(address)\":{\"notice\":\"check whether address `who` is given minter rights.\"},\"isSuperOperator(address)\":{\"notice\":\"check whether address `who` is given superOperator rights.\"},\"mintAndTransferQuad(address,uint256,uint256,uint256,bytes)\":{\"notice\":\"Checks if a parent quad has child quads already minted. Then mints the rest child quads and transfers the parent quad. Should only be called by the tunnel.\"},\"mintQuad(address,uint256,uint256,uint256,bytes)\":{\"notice\":\"Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\"},\"name()\":{\"notice\":\"Return the name of the token contract\"},\"ownerOf(uint256)\":{\"notice\":\"Return the owner of a Land\"},\"register(address,bool)\":{\"notice\":\"This function is used to register Land contract on the Operator Filterer Registry of Opensea.can only be called by admin.\"},\"safeBatchTransferFrom(address,address,uint256[],bytes)\":{\"notice\":\"Transfer many tokens between 2 addresses ensuring the receiving contract has a receiver method\"},\"safeTransferFrom(address,address,uint256)\":{\"notice\":\"Transfer a token between 2 addresses letting the receiver knows of the transfer\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"notice\":\"Transfer a token between 2 addresses letting the receiver knows of the transfer\"},\"setApprovalForAll(address,bool)\":{\"notice\":\"Set the approval for an operator to manage all the tokens of the sender\"},\"setApprovalForAllFor(address,address,bool)\":{\"notice\":\"Set the approval for an operator to manage all the tokens of the sender\"},\"setMetaTransactionProcessor(address,bool)\":{\"notice\":\"Enable or disable the ability of `metaTransactionProcessor` to perform meta-tx (metaTransactionProcessor rights).\"},\"setMinter(address,bool)\":{\"notice\":\"Enable or disable the ability of `minter` to mint tokens\"},\"setOperatorRegistry(address)\":{\"notice\":\"sets filter registry address deployed in test\"},\"setSuperOperator(address,bool)\":{\"notice\":\"Enable or disable the ability of `superOperator` to transfer tokens of all (superOperator rights).\"},\"supportsInterface(bytes4)\":{\"notice\":\"Check if the contract supports an interface 0x01ffc9a7 is ERC-165 0x80ac58cd is ERC-721 0x5b5e139f is ERC-721 metadata\"},\"symbol()\":{\"notice\":\"Return the symbol of the token contract\"},\"tokenURI(uint256)\":{\"notice\":\"Return the URI of a specific token\"},\"transferFrom(address,address,uint256)\":{\"notice\":\"Transfer a token between 2 addresses\"},\"transferQuad(address,address,uint256,uint256,uint256,bytes)\":{\"notice\":\"transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\"},\"width()\":{\"notice\":\"total width of the map\"}},\"notice\":\"LAND contract\"}},\"settings\":{\"compilationTarget\":{\"src/solc_0.5/LandV3.sol\":\"LandV3\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"metadata\":{\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"src/solc_0.5/Land/erc721/ERC721BaseTokenV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n/* solhint-disable func-order, code-complexity */\\npragma solidity 0.5.9;\\n\\nimport {AddressUtils} from \\\"../../contracts_common/Libraries/AddressUtils.sol\\\";\\nimport {ERC721TokenReceiver} from \\\"../../contracts_common/Interfaces/ERC721TokenReceiver.sol\\\";\\nimport {ERC721Events} from \\\"../../contracts_common/Interfaces/ERC721Events.sol\\\";\\nimport {SuperOperatorsV2} from \\\"../../contracts_common/BaseWithStorage/SuperOperatorsV2.sol\\\";\\nimport {MetaTransactionReceiverV2} from \\\"../../contracts_common/BaseWithStorage/MetaTransactionReceiverV2.sol\\\";\\nimport {ERC721MandatoryTokenReceiver} from \\\"../../contracts_common/Interfaces/ERC721MandatoryTokenReceiver.sol\\\";\\n\\n/**\\n * @title ERC721BaseTokenV2\\n * @author The Sandbox\\n * @notice Basic functionalities of a NFT\\n * @dev ERC721 implementation that supports meta-transactions and super operators\\n */\\ncontract ERC721BaseTokenV2 is ERC721Events, SuperOperatorsV2, MetaTransactionReceiverV2 {\\n using AddressUtils for address;\\n\\n bytes4 internal constant _ERC721_RECEIVED = 0x150b7a02;\\n bytes4 internal constant _ERC721_BATCH_RECEIVED = 0x4b808c46;\\n\\n bytes4 internal constant ERC165ID = 0x01ffc9a7;\\n bytes4 internal constant ERC721_MANDATORY_RECEIVER = 0x5e8bf644;\\n\\n /// @notice Number of NFT an address own\\n mapping (address => uint256) public _numNFTPerAddress;\\n\\n /// @notice Token ids per address\\n mapping (uint256 => uint256) public _owners;\\n\\n /// @notice Operators for each owner address for all tokens\\n mapping (address => mapping(address => bool)) public _operatorsForAll;\\n\\n /// @notice Operator for each token id\\n mapping (uint256 => address) public _operators;\\n\\n bool internal _initialized;\\n\\n modifier initializer() {\\n require(!_initialized, \\\"ERC721BaseToken: Contract already initialized\\\");\\n _;\\n }\\n\\n /**\\n * @notice Initializes the contract with the meta-transaction contract & admin\\n * @param metaTransactionContract Authorized contract for meta-transactions\\n * @param admin Admin of the contract\\n */\\n function initialize (\\n address metaTransactionContract,\\n address admin\\n ) public initializer {\\n _admin = admin;\\n _setMetaTransactionProcessor(metaTransactionContract, true);\\n _initialized = true;\\n emit AdminChanged(address(0), _admin);\\n }\\n\\n /**\\n * @param from Sender address\\n * @param to Recipient address\\n * @param id Token id to transfer\\n */\\n function _transferFrom(\\n address from,\\n address to,\\n uint256 id\\n ) internal {\\n _numNFTPerAddress[from]--;\\n _numNFTPerAddress[to]++;\\n _owners[id] = uint256(to);\\n emit Transfer(from, to, id);\\n }\\n\\n /**\\n * @notice Return the number of Land owned by an address\\n * @param owner The address to look for\\n * @return The number of Land token owned by the address\\n */\\n function balanceOf(address owner) external view returns (uint256) {\\n require(owner != address(0), \\\"owner is zero address\\\");\\n return _numNFTPerAddress[owner];\\n }\\n\\n /**\\n * @param id token id\\n * @return address of the owner\\n */\\n function _ownerOf(uint256 id) internal view returns (address) {\\n return address(_owners[id]);\\n }\\n\\n /**\\n * @param id Token id\\n * @return owner Address of the token's owner\\n * @return operatorEnabled Is he an operator\\n */\\n function _ownerAndOperatorEnabledOf(uint256 id) internal view returns (address owner, bool operatorEnabled) {\\n uint256 data = _owners[id];\\n owner = address(data);\\n operatorEnabled = (data / 2**255) == 1;\\n }\\n\\n /**\\n * @notice Return the owner of a Land\\n * @param id The id of the Land\\n * @return The address of the owner\\n */\\n function ownerOf(uint256 id) external view returns (address owner) {\\n owner = _ownerOf(id);\\n require(owner != address(0), \\\"token does not exist\\\");\\n }\\n\\n /**\\n * @param owner The address giving the approval\\n * @param operator The address receiving the approval\\n * @param id The id of the token\\n */\\n function _approveFor(\\n address owner,\\n address operator,\\n uint256 id\\n ) internal {\\n if (operator == address(0)) {\\n _owners[id] = uint256(owner); // no need to resset the operator, it will be overriden next time\\n } else {\\n _owners[id] = uint256(owner) + 2**255;\\n _operators[id] = operator;\\n }\\n emit Approval(owner, operator, id);\\n }\\n\\n /**\\n * @notice Approve an operator to spend tokens on the sender behalf\\n * @param sender The address giving the approval\\n * @param operator The address receiving the approval\\n * @param id The id of the token\\n */\\n function approveFor(\\n address sender,\\n address operator,\\n uint256 id\\n ) public {\\n address owner = _ownerOf(id);\\n require(sender != address(0), \\\"sender is zero address\\\");\\n require(\\n msg.sender == sender ||\\n _metaTransactionContracts[msg.sender] ||\\n _operatorsForAll[sender][msg.sender] ||\\n _superOperators[msg.sender],\\n \\\"not authorized to approve\\\"\\n );\\n require(owner == sender, \\\"owner != sender\\\");\\n _approveFor(owner, operator, id);\\n }\\n\\n /**\\n * @notice Approve an operator to spend tokens on the sender behalf\\n * @param operator The address receiving the approval\\n * @param id The id of the token\\n */\\n function approve(address operator, uint256 id) public {\\n address owner = _ownerOf(id);\\n require(owner != address(0), \\\"token does not exist\\\");\\n require(\\n owner == msg.sender || _operatorsForAll[owner][msg.sender] || _superOperators[msg.sender],\\n \\\"not authorized to approve\\\"\\n );\\n _approveFor(owner, operator, id);\\n }\\n\\n /**\\n * @notice Get the approved operator for a specific token\\n * @param id The id of the token\\n * @return The address of the operator\\n */\\n function getApproved(uint256 id) external view returns (address) {\\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\\n require(owner != address(0), \\\"token does not exist\\\");\\n if (operatorEnabled) {\\n return _operators[id];\\n } else {\\n return address(0);\\n }\\n }\\n\\n /**\\n * @param from The sender of the token\\n * @param to The recipient of the token\\n * @param id The id of the token\\n * @return is it a meta-tx\\n */\\n function _checkTransfer(\\n address from,\\n address to,\\n uint256 id\\n ) internal view returns (bool isMetaTx) {\\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\\n require(owner != address(0), \\\"token does not exist\\\");\\n require(owner == from, \\\"not owner in _checkTransfer\\\");\\n require(to != address(0), \\\"can't send to zero address\\\");\\n if (msg.sender != from) {\\n if(_metaTransactionContracts[msg.sender]) {\\n return true;\\n }\\n require(\\n _operatorsForAll[from][msg.sender] ||\\n (operatorEnabled && _operators[id] == msg.sender) ||\\n _superOperators[msg.sender],\\n \\\"not approved to transfer\\\"\\n );\\n }\\n }\\n\\n /**\\n * @dev Checks if the target contract supports the given interface & doesn't exceed 10000 gas\\n * @param _contract The target contract\\n * @param interfaceId The interface id\\n * @return if the call is a success\\n */\\n function _checkInterfaceWith10000Gas(address _contract, bytes4 interfaceId)\\n internal\\n view\\n returns (bool)\\n {\\n bool success;\\n bool result;\\n bytes memory call_data = abi.encodeWithSelector(ERC165ID, interfaceId);\\n // solium-disable-next-line security/no-inline-assembly\\n assembly {\\n let call_ptr := add(0x20, call_data)\\n let call_size := mload(call_data)\\n let output := mload(0x40) // Find empty storage location using \\\"free memory pointer\\\"\\n mstore(output, 0x0)\\n success := staticcall(10000, _contract, call_ptr, call_size, output, 0x20) // 32 bytes\\n result := mload(output)\\n }\\n // (10000 / 63) \\\"not enough for supportsInterface(...)\\\" // consume all gas, so caller can potentially know that there was not enough gas\\n assert(gasleft() > 158);\\n return success && result;\\n }\\n\\n /**\\n * @notice Transfer a token between 2 addresses\\n * @param from The sender of the token\\n * @param to The recipient of the token\\n * @param id The id of the token\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 id\\n ) public {\\n bool metaTx = _checkTransfer(from, to, id);\\n _transferFrom(from, to, id);\\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\\n require(\\n _checkOnERC721Received(metaTx ? from : msg.sender, from, to, id, \\\"\\\"),\\n \\\"erc721 transfer rejected by to\\\"\\n );\\n }\\n }\\n\\n /**\\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\\n * @param from The sender of the token\\n * @param to The recipient of the token\\n * @param id The id of the token\\n * @param data Additional data\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n bytes memory data\\n ) public {\\n bool metaTx = _checkTransfer(from, to, id);\\n _transferFrom(from, to, id);\\n if (to.isContract()) {\\n require(\\n _checkOnERC721Received(metaTx ? from : msg.sender, from, to, id, data),\\n \\\"ERC721: transfer rejected by to\\\"\\n );\\n }\\n }\\n\\n /**\\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\\n * @param from The send of the token\\n * @param to The recipient of the token\\n * @param id The id of the token\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id\\n ) external {\\n safeTransferFrom(from, to, id, \\\"\\\");\\n }\\n\\n /**\\n * @notice Transfer many tokens between 2 addresses\\n * @param from The sender of the token\\n * @param to The recipient of the token\\n * @param ids The ids of the tokens\\n * @param data additional data\\n */\\n function batchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) external {\\n _batchTransferFrom(from, to, ids, data, false);\\n }\\n\\n /**\\n * @param from The sender of the token\\n * @param to The recipient of the token\\n * @param ids The ids of the tokens\\n * @param data additional data\\n * @param safe checks the target contract\\n */\\n function _batchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n bytes memory data,\\n bool safe\\n ) internal {\\n bool metaTx = msg.sender != from && _metaTransactionContracts[msg.sender];\\n bool authorized =\\n msg.sender == from || metaTx || _operatorsForAll[from][msg.sender] || _superOperators[msg.sender];\\n\\n require(from != address(0), \\\"from is zero address\\\");\\n require(to != address(0), \\\"can't send to zero address\\\");\\n\\n uint256 numTokens = ids.length;\\n for (uint256 i = 0; i < numTokens; i++) {\\n uint256 id = ids[i];\\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\\n require(owner == from, \\\"not owner in batchTransferFrom\\\");\\n require(authorized || (operatorEnabled && _operators[id] == msg.sender), \\\"not authorized\\\");\\n _owners[id] = uint256(to);\\n emit Transfer(from, to, id);\\n }\\n if (from != to) {\\n _numNFTPerAddress[from] -= numTokens;\\n _numNFTPerAddress[to] += numTokens;\\n }\\n\\n if (to.isContract()) {\\n if (_checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\\n require(\\n _checkOnERC721BatchReceived(metaTx ? from : msg.sender, from, to, ids, data),\\n \\\"erc721 batch transfer rejected by to\\\"\\n );\\n } else if (safe) {\\n for (uint256 i = 0; i < numTokens; i++) {\\n require(\\n _checkOnERC721Received(metaTx ? from : msg.sender, from, to, ids[i], \\\"\\\"),\\n \\\"erc721 transfer rejected by to\\\"\\n );\\n }\\n }\\n }\\n }\\n\\n /**\\n * @notice Transfer many tokens between 2 addresses ensuring the receiving contract has a receiver method\\n * @param from The sender of the token\\n * @param to The recipient of the token\\n * @param ids The ids of the tokens\\n * @param data additional data\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) external {\\n _batchTransferFrom(from, to, ids, data, true);\\n }\\n\\n /**\\n * @notice Check if the contract supports an interface\\n * 0x01ffc9a7 is ERC-165\\n * 0x80ac58cd is ERC-721\\n * @param id The id of the interface\\n * @return True if the interface is supported\\n */\\n function supportsInterface(bytes4 id) external pure returns (bool) {\\n return id == 0x01ffc9a7 || id == 0x80ac58cd;\\n }\\n\\n /**\\n * @notice Set the approval for an operator to manage all the tokens of the sender\\n * @param sender The address giving the approval\\n * @param operator The address receiving the approval\\n * @param approved The determination of the approval\\n */\\n function setApprovalForAllFor(\\n address sender,\\n address operator,\\n bool approved\\n ) public {\\n require(sender != address(0), \\\"Invalid sender address\\\");\\n require(\\n msg.sender == sender || _metaTransactionContracts[msg.sender] || _superOperators[msg.sender],\\n \\\"not authorized to approve for all\\\"\\n );\\n\\n _setApprovalForAll(sender, operator, approved);\\n }\\n\\n /**\\n * @notice Set the approval for an operator to manage all the tokens of the sender\\n * @param operator The address receiving the approval\\n * @param approved The determination of the approval\\n */\\n function setApprovalForAll(address operator, bool approved) public {\\n _setApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @param sender Sender address\\n * @param operator The address receiving the approval\\n * @param approved The determination of the approval\\n */\\n function _setApprovalForAll(\\n address sender,\\n address operator,\\n bool approved\\n ) internal {\\n require(!_superOperators[operator], \\\"super operator can't have their approvalForAll changed\\\");\\n _operatorsForAll[sender][operator] = approved;\\n\\n emit ApprovalForAll(sender, operator, approved);\\n }\\n\\n /**\\n * @notice Check if the sender approved the operator\\n * @param owner The address of the owner\\n * @param operator The address of the operator\\n * @return The status of the approval\\n */\\n function isApprovedForAll(address owner, address operator)\\n external\\n view\\n returns (bool)\\n {\\n return _operatorsForAll[owner][operator] || _superOperators[operator];\\n }\\n\\n /**\\n * @param from sender address\\n * @param owner owner address of the token\\n * @param id token id to burn\\n */\\n function _burn(\\n address from,\\n address owner,\\n uint256 id\\n ) internal {\\n require(from == owner, \\\"not owner\\\");\\n _owners[id] = 2**160; // cannot mint it again\\n _numNFTPerAddress[from]--;\\n emit Transfer(from, address(0), id);\\n }\\n\\n /// @notice Burns token `id`.\\n /// @param id token which will be burnt.\\n function burn(uint256 id) external {\\n _burn(msg.sender, _ownerOf(id), id);\\n }\\n\\n /// @notice Burn token`id` from `from`.\\n /// @param from address whose token is to be burnt.\\n /// @param id token which will be burnt.\\n function burnFrom(address from, uint256 id) external {\\n require(from != address(0), \\\"Invalid sender address\\\");\\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\\n require(\\n msg.sender == from ||\\n _metaTransactionContracts[msg.sender] ||\\n (operatorEnabled && _operators[id] == msg.sender) ||\\n _operatorsForAll[from][msg.sender] ||\\n _superOperators[msg.sender],\\n \\\"not authorized to burn\\\"\\n );\\n _burn(from, owner, id);\\n }\\n\\n /**\\n * @param operator Sender of the tx\\n * @param from Owner of the token\\n * @param to Recipient\\n * @param tokenId Token id\\n * @param _data extra data\\n */\\n function _checkOnERC721Received(\\n address operator,\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory _data\\n ) internal returns (bool) {\\n bytes4 retval = ERC721TokenReceiver(to).onERC721Received(operator, from, tokenId, _data);\\n return (retval == _ERC721_RECEIVED);\\n }\\n\\n /**\\n * @dev Check if receiving contract accepts erc721 batch transfers.\\n * @param operator Sender of the tx\\n * @param from Owner of the token\\n * @param to Recipient\\n * @param ids Token ids\\n * @param _data extra data\\n * @return Whether the expected value of 0x4b808c46 is returned.\\n */\\n function _checkOnERC721BatchReceived(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n bytes memory _data\\n ) internal returns (bool) {\\n bytes4 retval = ERC721MandatoryTokenReceiver(to).onERC721BatchReceived(operator, from, ids, _data);\\n return (retval == _ERC721_BATCH_RECEIVED);\\n }\\n\\n // Empty storage space in contracts for future enhancements\\n // ref: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/issues/13)\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xc9e34dddf1c202d890356e97b45e7df480cd96b546230822c1f09de1c4787c50\"},\"src/solc_0.5/Land/erc721/LandBaseTokenV3.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n/* solhint-disable func-order, code-complexity */\\npragma solidity 0.5.9;\\n\\nimport {ERC721BaseTokenV2} from \\\"./ERC721BaseTokenV2.sol\\\";\\n\\n/**\\n * @title LandBaseTokenV3\\n * @author The Sandbox\\n * @notice Implement LAND and quad functionalities on top of an ERC721 token\\n * @dev This contract implements a quad tree structure to handle groups of ERC721 tokens at once\\n */\\ncontract LandBaseTokenV3 is ERC721BaseTokenV2 {\\n // Our grid is 408 x 408 lands\\n uint256 internal constant GRID_SIZE = 408;\\n\\n uint256 internal constant LAYER = 0xFF00000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_1x1 = 0x0000000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_3x3 = 0x0100000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_6x6 = 0x0200000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_12x12 = 0x0300000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_24x24 = 0x0400000000000000000000000000000000000000000000000000000000000000;\\n\\n mapping(address => bool) internal _minters;\\n event Minter(address indexed superOperator, bool enabled);\\n\\n struct Land {\\n uint256 x;\\n uint256 y;\\n uint256 size;\\n }\\n\\n /**\\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\\n * @param to The recipient of the new quad\\n * @param size The size of the new quad\\n * @param x The top left x coordinate of the new quad\\n * @param y The top left y coordinate of the new quad\\n * @param data extra data to pass to the transfer\\n */\\n function mintQuad(\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes calldata data\\n ) external {\\n require(to != address(0), \\\"to is zero address\\\");\\n require(size != 0, \\\"size cannot be zero\\\");\\n require(isMinter(msg.sender), \\\"Only a minter can mint\\\");\\n\\n _isValidQuad(size, x, y);\\n\\n (uint256 layer, , ) = _getQuadLayer(size);\\n uint256 quadId = _getQuadId(layer, x, y);\\n\\n _checkOwner(size, x, y, 24);\\n for (uint256 i = 0; i < size * size; i++) {\\n uint256 _id = _idInPath(i, size, x, y);\\n require(_owners[_id] == 0, \\\"Already minted\\\");\\n emit Transfer(address(0), to, _id);\\n }\\n\\n _owners[quadId] = uint256(to);\\n _numNFTPerAddress[to] += size * size;\\n\\n _checkBatchReceiverAcceptQuad(msg.sender, address(0), to, size, x, y, data);\\n }\\n\\n /**\\n * @notice Checks if a parent quad has child quads already minted.\\n * Then mints the rest child quads and transfers the parent quad.\\n * Should only be called by the tunnel.\\n * @param to The recipient of the new quad\\n * @param size The size of the new quad\\n * @param x The top left x coordinate of the new quad\\n * @param y The top left y coordinate of the new quad\\n * @param data extra data to pass to the transfer\\n */\\n function mintAndTransferQuad(\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes calldata data\\n ) external {\\n require(to != address(0), \\\"to is zero address\\\");\\n require(isMinter(msg.sender), \\\"Only a minter can mint\\\");\\n\\n if (exists(size, x, y) == true) {\\n _transferQuad(msg.sender, to, size, x, y);\\n _numNFTPerAddress[msg.sender] -= size * size;\\n _numNFTPerAddress[to] += size * size;\\n _checkBatchReceiverAcceptQuad(msg.sender, msg.sender, to, size, x, y, data);\\n } else {\\n _mintAndTransferQuad(to, size, x, y, data);\\n }\\n }\\n\\n /// @notice transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\\n /// @param from current owner of the quad\\n /// @param to destination\\n /// @param size size of the quad\\n /// @param x The top left x coordinate of the quad\\n /// @param y The top left y coordinate of the quad\\n /// @param data additional data\\n function transferQuad(\\n address from,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes calldata data\\n ) external {\\n require(from != address(0), \\\"from is zero address\\\");\\n require(to != address(0), \\\"can't send to zero address\\\");\\n bool metaTx = msg.sender != from && _metaTransactionContracts[msg.sender];\\n if (msg.sender != from && !metaTx) {\\n require(\\n _operatorsForAll[from][msg.sender] || _superOperators[msg.sender],\\n \\\"not authorized to transferQuad\\\"\\n );\\n }\\n _transferQuad(from, to, size, x, y);\\n _numNFTPerAddress[from] -= size * size;\\n _numNFTPerAddress[to] += size * size;\\n\\n _checkBatchReceiverAcceptQuad(metaTx ? from : msg.sender, from, to, size, x, y, data);\\n }\\n\\n /// @notice transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\\n /// @param from current owner of the quad\\n /// @param to destination\\n /// @param sizes list of sizes for each quad\\n /// @param xs list of top left x coordinates for each quad\\n /// @param ys list of top left y coordinates for each quad\\n /// @param data additional data\\n function batchTransferQuad(\\n address from,\\n address to,\\n uint256[] calldata sizes,\\n uint256[] calldata xs,\\n uint256[] calldata ys,\\n bytes calldata data\\n ) external {\\n require(from != address(0), \\\"from is zero address\\\");\\n require(to != address(0), \\\"can't send to zero address\\\");\\n require(sizes.length == xs.length, \\\"LandBaseTokenV3: sizes's and x's length are different\\\");\\n require(xs.length == ys.length, \\\"LandBaseTokenV3: x's and y's length are different\\\");\\n bool metaTx = msg.sender != from && _metaTransactionContracts[msg.sender];\\n if (msg.sender != from && !metaTx) {\\n require(\\n _operatorsForAll[from][msg.sender] || _superOperators[msg.sender],\\n \\\"not authorized to transferMultiQuads\\\"\\n );\\n }\\n uint256 numTokensTransfered = 0;\\n for (uint256 i = 0; i < sizes.length; i++) {\\n uint256 size = sizes[i];\\n _transferQuad(from, to, size, xs[i], ys[i]);\\n numTokensTransfered += size * size;\\n }\\n _numNFTPerAddress[from] -= numTokensTransfered;\\n _numNFTPerAddress[to] += numTokensTransfered;\\n\\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\\n uint256[] memory ids = new uint256[](numTokensTransfered);\\n uint256 counter = 0;\\n for (uint256 j = 0; j < sizes.length; j++) {\\n uint256 size = sizes[j];\\n for (uint256 i = 0; i < size * size; i++) {\\n ids[counter] = _idInPath(i, size, xs[j], ys[j]);\\n counter++;\\n }\\n }\\n require(\\n _checkOnERC721BatchReceived(metaTx ? from : msg.sender, from, to, ids, data),\\n \\\"erc721 batch transfer rejected by to\\\"\\n );\\n }\\n }\\n\\n /// @notice Enable or disable the ability of `minter` to mint tokens\\n /// @param minter address that will be given/removed minter right.\\n /// @param enabled set whether the minter is enabled or disabled.\\n function setMinter(address minter, bool enabled) external onlyAdmin {\\n require(minter != address(0), \\\"address 0 is not allowed as minter\\\");\\n require(enabled != _minters[minter], \\\"the status should be different than the current one\\\");\\n _minters[minter] = enabled;\\n emit Minter(minter, enabled);\\n }\\n\\n /// @notice total width of the map\\n /// @return width\\n function width() external pure returns (uint256) {\\n return GRID_SIZE;\\n }\\n\\n /// @notice total height of the map\\n /// @return height\\n function height() external pure returns (uint256) {\\n return GRID_SIZE;\\n }\\n\\n /// @notice x coordinate of Land token\\n /// @param id tokenId\\n /// @return the x coordinates\\n function getX(uint256 id) external pure returns (uint256) {\\n return _getX(id);\\n }\\n\\n /// @notice y coordinate of Land token\\n /// @param id tokenId\\n /// @return the y coordinates\\n function getY(uint256 id) external pure returns (uint256) {\\n return _getY(id);\\n }\\n\\n /// @notice check whether address `who` is given minter rights.\\n /// @param who The address to query.\\n /// @return whether the address has minter rights.\\n function isMinter(address who) public view returns (bool) {\\n return _minters[who];\\n }\\n\\n /// @notice checks if Land has been minted or not\\n /// @param size size of the quad\\n /// @param x x coordinate of the quad\\n /// @param y y coordinate of the quad\\n /// @return bool for if Land has been minted or not\\n function exists(\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) public view returns (bool) {\\n _isValidQuad(size, x, y);\\n return _ownerOfQuad(size, x, y) != address(0);\\n }\\n\\n function _isValidQuad(uint256 size, uint256 x, uint256 y) internal pure {\\n require(size == 1 || size == 3 || size == 6 || size == 12 || size == 24, \\\"Invalid size\\\");\\n require(x % size == 0, \\\"Invalid x coordinate\\\");\\n require(y % size == 0, \\\"Invalid y coordinate\\\");\\n require(x <= GRID_SIZE - size, \\\"x out of bounds\\\");\\n require(y <= GRID_SIZE - size, \\\"y out of bounds\\\");\\n }\\n\\n /**\\n * @dev checks if the child quads in the parent quad (size, x, y) are owned by msg.sender.\\n * It recursively checks child quad of every size(exculding Lands of 1x1 size) are minted or not.\\n * Quad which are minted are pushed into quadMinted to also check if every Land of size 1x1 in the parent quad is minted or not.\\n * While checking if the every child Quad and Land is minted it also checks and clear the owner for quads which are minted.\\n * Finally it checks if the new owner if is a contract can handle ERC721 tokens or not and transfers the parent quad to new owner.\\n * @param to The address to which the ownership of the quad will be transferred\\n * @param size The size of the quad being minted and transfered\\n * @param x The x-coordinate of the top-left corner of the quad being minted.\\n * @param y The y-coordinate of the top-left corner of the quad being minted.\\n * @param data extra data to pass to the transfer\\n */\\n function _mintAndTransferQuad(\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes memory data\\n ) internal {\\n (uint256 layer, , ) = _getQuadLayer(size);\\n uint256 quadId = _getQuadId(layer, x, y);\\n\\n // Length of array is equal to number of 3x3 child quad a 24x24 quad can have. Would be used to push the minted Quads.\\n Land[] memory quadMinted = new Land[](64);\\n // index of last minted quad pushed on quadMinted Array\\n uint256 index;\\n uint256 numLandMinted;\\n\\n // if size of the Quad in land struct to be transfered is greater than 3 we check recursivly if the child quads are minted or not.\\n if (size > 3) {\\n (index, numLandMinted) = _checkAndClearOwner(\\n Land({x: x, y: y, size: size}),\\n quadMinted,\\n numLandMinted,\\n index,\\n size / 2\\n );\\n }\\n\\n // Lopping around the Quad in land struct to generate ids of 1x1 land token and checking if they are owned by msg.sender\\n {\\n for (uint256 i = 0; i < size * size; i++) {\\n uint256 _id = _idInPath(i, size, x, y);\\n // checking land with token id \\\"_id\\\" is in the quadMinted array.\\n bool isAlreadyMinted = _isQuadMinted(quadMinted, Land({x: _getX(_id), y: _getY(_id), size: 1}), index);\\n if (isAlreadyMinted) {\\n // if land is in the quadMinted array there just emitting transfer event.\\n emit Transfer(msg.sender, to, _id);\\n } else {\\n if (address(uint160(_owners[_id])) == msg.sender) {\\n if (_operators[_id] != address(0)) _operators[_id] = address(0);\\n numLandMinted += 1;\\n emit Transfer(msg.sender, to, _id);\\n } else {\\n // else is checked if owned by the msg.sender or not. If it is not owned by msg.sender it should not have an owner.\\n require(_owners[_id] == 0, \\\"Already minted\\\");\\n\\n emit Transfer(address(0), to, _id);\\n }\\n }\\n }\\n }\\n\\n // checking if the new owner \\\"to\\\" is a contract. If yes, checking if it could handle ERC721 tokens.\\n _checkBatchReceiverAcceptQuadAndClearOwner(quadMinted, index, numLandMinted, to, size, x, y, data);\\n\\n _owners[quadId] = uint256(to);\\n _numNFTPerAddress[to] += size * size;\\n _numNFTPerAddress[msg.sender] -= numLandMinted;\\n }\\n\\n /// @param operator sender of the tx\\n /// @param from owner of the token\\n /// @param to recipient\\n /// @param size The size of the new quad\\n /// @param x The top left x coordinate of the new quad\\n /// @param y The top left y coordinate of the new quad\\n /// @param data extra data\\n function _checkBatchReceiverAcceptQuad(\\n address operator,\\n address from,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes memory data\\n ) internal {\\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\\n uint256[] memory ids = new uint256[](size * size);\\n for (uint256 i = 0; i < size * size; i++) {\\n ids[i] = _idInPath(i, size, x, y);\\n }\\n require(_checkOnERC721BatchReceived(operator, from, to, ids, data), \\\"erc721 batch transfer rejected by to\\\");\\n }\\n }\\n\\n /// @dev checks if the receiver of the quad(size, x, y) is a contact. If yes can it handle ERC721 tokens.\\n /// It also clears owner of 1x1 land's owned by msg.sender.\\n /// @param quadMinted array of lands\\n /// @param index array size\\n /// @param numLandMinted number of lands transferred\\n /// @param to recipient\\n /// @param size The size of the new quad\\n /// @param x The top left x coordinate of the new quad\\n /// @param y The top left y coordinate of the new quad\\n /// @param data extra data\\n function _checkBatchReceiverAcceptQuadAndClearOwner(\\n Land[] memory quadMinted,\\n uint256 index,\\n uint256 numLandMinted,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes memory data\\n ) internal {\\n // checks if to is a contract and supports ERC721_MANDATORY_RECEIVER interfaces.\\n // if it doesn't it just clears the owner of 1x1 lands in quad(size, x, y)\\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\\n // array to push minted 1x1 land\\n uint256[] memory idsToTransfer = new uint256[](numLandMinted);\\n // index of last land pushed in idsToTransfer array\\n uint256 transferIndex;\\n // array to push ids to be minted\\n uint256[] memory idsToMint = new uint256[]((size * size) - numLandMinted);\\n // index of last land pushed in idsToMint array\\n uint256 mintIndex;\\n // iterating over every 1x1 land in the quad to be pushed in the above arrays\\n for (uint256 i = 0; i < size * size; i++) {\\n uint256 id = _idInPath(i, size, x, y);\\n\\n if (_isQuadMinted(quadMinted, Land({x: _getX(id), y: _getY(id), size: 1}), index)) {\\n // if land is in the quads already minted it just pushed in to the idsToTransfer array\\n idsToTransfer[transferIndex] = id;\\n transferIndex++;\\n } else if (address(uint160(_owners[id])) == msg.sender) {\\n _owners[id] = 0;\\n idsToTransfer[transferIndex] = id;\\n transferIndex++;\\n } else {\\n // else it is not owned by any one and and pushed in teh idsToMint array\\n idsToMint[mintIndex] = id;\\n mintIndex++;\\n }\\n }\\n\\n // checking if \\\"to\\\" contact can handle ERC721 tokens\\n require(\\n _checkOnERC721BatchReceived(msg.sender, address(0), to, idsToMint, data),\\n \\\"erc721 batch transfer rejected by to\\\"\\n );\\n require(\\n _checkOnERC721BatchReceived(msg.sender, msg.sender, to, idsToTransfer, data),\\n \\\"erc721 batch transfer rejected by to\\\"\\n );\\n } else {\\n for (uint256 i = 0; i < size * size; i++) {\\n uint256 id = _idInPath(i, size, x, y);\\n if (address(uint160(_owners[id])) == msg.sender) _owners[id] = 0;\\n }\\n }\\n }\\n\\n /// @param from current owner of the quad\\n /// @param to destination\\n /// @param size size of the quad\\n /// @param x The top left x coordinate of the quad\\n /// @param y The top left y coordinate of the quad\\n function _transferQuad(\\n address from,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) internal {\\n _isValidQuad(size, x, y);\\n if (size == 1) {\\n uint256 id1x1 = _getQuadId(LAYER_1x1, x, y);\\n address owner = _ownerOf(id1x1);\\n require(owner != address(0), \\\"token does not exist\\\");\\n require(owner == from, \\\"not owner in _transferQuad\\\");\\n _owners[id1x1] = uint256(to);\\n } else {\\n _regroupQuad(from, to, Land({x: x, y: y, size: size}), true, size / 2);\\n }\\n for (uint256 i = 0; i < size * size; i++) {\\n emit Transfer(from, to, _idInPath(i, size, x, y));\\n }\\n }\\n\\n /// @dev checks if the quad is already minted compared to another quad size\\n /// @param size size of the quad\\n /// @param x The top left x coordinate of the quad\\n /// @param y The top left y coordinate of the quad\\n /// @param quadCompareSize size to compare with\\n function _checkOwner(\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n uint256 quadCompareSize\\n ) internal view {\\n (uint256 layer, , ) = _getQuadLayer(quadCompareSize);\\n\\n if (size <= quadCompareSize) {\\n // when the size of the quad is smaller than the quadCompareSize(size to be compared with),\\n // then it is checked if the bigger quad which encapsulates the quad to be minted\\n // of with size equals the quadCompareSize has been minted or not\\n require(\\n _owners[\\n _getQuadId(layer, (x / quadCompareSize) * quadCompareSize, (y / quadCompareSize) * quadCompareSize)\\n ] == 0,\\n \\\"Already minted\\\"\\n );\\n } else {\\n // when the size is bigger than the quadCompare size the owner of all the smaller quads with size\\n // quadCompare size in the quad to be minted are checked if they are minted or not\\n uint256 toX = x + size;\\n uint256 toY = y + size;\\n for (uint256 xi = x; xi < toX; xi += quadCompareSize) {\\n for (uint256 yi = y; yi < toY; yi += quadCompareSize) {\\n require(_owners[_getQuadId(layer, xi, yi)] == 0, \\\"Already minted\\\");\\n }\\n }\\n }\\n\\n quadCompareSize = quadCompareSize / 2;\\n if (quadCompareSize >= 3) _checkOwner(size, x, y, quadCompareSize);\\n }\\n\\n /// @dev checks the owner of land of token id 'id' to be 'from' and clears it\\n /// @param from owner of the token\\n /// @param tokenId token id\\n /// @return if the address is the owner of the token\\n function _checkAndClearLandOwner(address from, uint256 tokenId) internal returns (bool) {\\n uint256 currentOwner = _owners[tokenId];\\n if (currentOwner != 0) {\\n require(address(currentOwner) == from, \\\"not owner\\\");\\n _owners[tokenId] = 0;\\n return true;\\n }\\n return false;\\n }\\n\\n /** @dev recursivly checks if the child quads are minted in land and push them to the quadMinted array.\\n * if a child quad is minted in land such quads child quads will be skipped such that there is no\\n * overlapping in quads which are minted. it clears the minted child quads owners.\\n * @param land the stuct which has the size x and y co-ordinate of Quad to be checked\\n * @param quadMinted array in which the minted child quad would be pushed\\n * @param numLandMinted number of lands transferred\\n * @param index index of last element of quadMinted array\\n * @param quadCompareSize the size of the child quads to be checked.\\n * @return the index of last quad pushed in quadMinted array and the total land already minted\\n * @return the number of lands minted\\n */\\n function _checkAndClearOwner(\\n Land memory land,\\n Land[] memory quadMinted,\\n uint256 numLandMinted,\\n uint256 index,\\n uint256 quadCompareSize\\n ) internal returns (uint256, uint256) {\\n (uint256 layer, , ) = _getQuadLayer(quadCompareSize);\\n uint256 toX = land.x + land.size;\\n uint256 toY = land.y + land.size;\\n\\n //Lopping around the Quad in land struct to check if the child quad are minted or not\\n for (uint256 xi = land.x; xi < toX; xi += quadCompareSize) {\\n for (uint256 yi = land.y; yi < toY; yi += quadCompareSize) {\\n //checking if the child Quad is minted or not. i.e Checks if the quad is in the quadMinted array.\\n bool isQuadChecked = _isQuadMinted(quadMinted, Land({x: xi, y: yi, size: quadCompareSize}), index);\\n // if child quad is not already in the quadMinted array.\\n if (!isQuadChecked) {\\n uint256 id = _getQuadId(layer, xi, yi);\\n address owner = address(uint160(_owners[id]));\\n // owner of the child quad is checked to be owned by msg.sender else should not be owned by anyone.\\n if (owner == msg.sender) {\\n // if child quad is minted it would be pushed in quadMinted array.\\n quadMinted[index] = Land({x: xi, y: yi, size: quadCompareSize});\\n // index of quadMinted is increased\\n index++;\\n // total land minted is increase by the number if land of 1x1 in child quad\\n numLandMinted += quadCompareSize * quadCompareSize;\\n //owner is cleared\\n _owners[id] = 0;\\n } else {\\n require(owner == address(0), \\\"Already minted\\\");\\n }\\n }\\n }\\n }\\n\\n // size of the child quad is set to be the next smaller child quad size (12 => 6 => 3)\\n quadCompareSize = quadCompareSize / 2;\\n // if child quad size is greater than 3 _checkAndClearOwner is checked for new child quads in the quad in land struct.\\n if (quadCompareSize >= 3)\\n (index, numLandMinted) = _checkAndClearOwner(land, quadMinted, numLandMinted, index, quadCompareSize);\\n return (index, numLandMinted);\\n }\\n\\n /// @dev checks if the Land's child quads are owned by the from address and clears all the previous owners\\n /// if all the child quads are not owned by the \\\"from\\\" address then the owner of parent quad to the land\\n /// is checked if owned by the \\\"from\\\" address. If from is the owner then land owner is set to \\\"to\\\" address\\n /// @param from address of the previous owner\\n /// @param to address of the new owner\\n /// @param land the quad to be regrouped and transferred\\n /// @param set for setting the new owner\\n /// @param childQuadSize size of the child quad to be checked for owner in the regrouping\\n function _regroupQuad(\\n address from,\\n address to,\\n Land memory land,\\n bool set,\\n uint256 childQuadSize\\n ) internal returns (bool) {\\n (uint256 layer, , uint256 childLayer) = _getQuadLayer(land.size);\\n uint256 quadId = _getQuadId(layer, land.x, land.y);\\n bool ownerOfAll = true;\\n\\n {\\n // double for loop iterates and checks owner of all the smaller quads in land\\n for (uint256 xi = land.x; xi < land.x + land.size; xi += childQuadSize) {\\n for (uint256 yi = land.y; yi < land.y + land.size; yi += childQuadSize) {\\n uint256 ownerChild;\\n bool ownAllIndividual;\\n if (childQuadSize < 3) {\\n // case when the smaller quad is 1x1,\\n ownAllIndividual = _checkAndClearLandOwner(from, _getQuadId(LAYER_1x1, xi, yi)) && ownerOfAll;\\n } else {\\n // recursively calling the _regroupQuad function to check the owner of child quads.\\n ownAllIndividual = _regroupQuad(\\n from,\\n to,\\n Land({x: xi, y: yi, size: childQuadSize}),\\n false,\\n childQuadSize / 2\\n );\\n uint256 idChild = _getQuadId(childLayer, xi, yi);\\n ownerChild = _owners[idChild];\\n if (ownerChild != 0) {\\n if (!ownAllIndividual) {\\n // checking the owner of child quad\\n require(ownerChild == uint256(from), \\\"not owner of child Quad\\\");\\n }\\n // clearing owner of child quad\\n _owners[idChild] = 0;\\n }\\n }\\n // ownerOfAll should be true if \\\"from\\\" is owner of all the child quads iterated over\\n ownerOfAll = (ownAllIndividual || ownerChild != 0) && ownerOfAll;\\n }\\n }\\n }\\n\\n // if set is true it check if the \\\"from\\\" is owner of all else checks for the owner of parent quad is\\n // owned by \\\"from\\\" and sets the owner for the id of land to \\\"to\\\" address.\\n if (set) {\\n if (!ownerOfAll) {\\n require(_ownerOfQuad(land.size, land.x, land.y) == from, \\\"not owner of all sub quads nor parent quads\\\");\\n }\\n _owners[quadId] = uint256(to);\\n return true;\\n }\\n\\n return ownerOfAll;\\n }\\n\\n /// @notice Goes through every token id of a quad id\\n /// @param i ith token of the quad\\n /// @param size size of the quad\\n /// @param x The top left x coordinate of the quad\\n /// @param y The top left y coordinate of the quad\\n /// @return the \\\"ith\\\" token id of the quad\\n function _idInPath(\\n uint256 i,\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) internal pure returns (uint256) {\\n uint256 row = i / size;\\n if (row % 2 == 0) {\\n // allow ids to follow a path in a quad\\n return _getQuadId(LAYER_1x1, (x + (i % size)), (y + row));\\n } else {\\n return _getQuadId(LAYER_1x1, (x + size) - (1 + (i % size)), (y + row));\\n }\\n }\\n\\n /// @param mintedLand array of lands\\n /// @param quad quad to check\\n /// @param index size of the array\\n /// @return is the quad minted\\n function _isQuadMinted(\\n Land[] memory mintedLand,\\n Land memory quad,\\n uint256 index\\n ) internal pure returns (bool) {\\n for (uint256 i = 0; i < index; i++) {\\n Land memory land = mintedLand[i];\\n if (\\n land.size > quad.size &&\\n quad.x >= land.x &&\\n quad.x < land.x + land.size &&\\n quad.y >= land.y &&\\n quad.y < land.y + land.size\\n ) {\\n return true;\\n }\\n }\\n return false;\\n }\\n\\n /// @param id token id\\n /// @return the x coordinate\\n function _getX(uint256 id) internal pure returns (uint256) {\\n return (id & ~LAYER) % GRID_SIZE;\\n }\\n\\n /// @param id token id\\n /// @return the y coordinate\\n function _getY(uint256 id) internal pure returns (uint256) {\\n return (id & ~LAYER) / GRID_SIZE;\\n }\\n\\n /// @param size of the quad\\n /// @return layer the layer associated to that quad size\\n /// @return parentSize size of the parent quad\\n /// @return childLayer layer of the child quad size\\n function _getQuadLayer(uint256 size)\\n internal\\n pure\\n returns (\\n uint256 layer,\\n uint256 parentSize,\\n uint256 childLayer\\n )\\n {\\n if (size == 1) {\\n layer = LAYER_1x1;\\n parentSize = 3;\\n } else if (size == 3) {\\n layer = LAYER_3x3;\\n parentSize = 6;\\n } else if (size == 6) {\\n layer = LAYER_6x6;\\n parentSize = 12;\\n childLayer = LAYER_3x3;\\n } else if (size == 12) {\\n layer = LAYER_12x12;\\n parentSize = 24;\\n childLayer = LAYER_6x6;\\n } else if (size == 24) {\\n layer = LAYER_24x24;\\n childLayer = LAYER_12x12;\\n } else {\\n require(false, \\\"Invalid size\\\");\\n }\\n }\\n\\n /// @param layer of the quad size\\n /// @param x coordinate of the quad\\n /// @param y coordinate of the quad\\n /// @return the quad id\\n function _getQuadId(\\n uint256 layer,\\n uint256 x,\\n uint256 y\\n ) internal pure returns (uint256) {\\n return layer + x + y * GRID_SIZE;\\n }\\n\\n /// @param size of the quad\\n /// @param x coordinate of the quad\\n /// @param y coordinate of the quad\\n /// @return address of the owner of the quad\\n function _ownerOfQuad(\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) internal view returns (address) {\\n (uint256 layer, uint256 parentSize, ) = _getQuadLayer(size);\\n address owner = address(_owners[_getQuadId(layer, (x / size) * size, (y / size) * size)]);\\n if (owner != address(0)) {\\n return owner;\\n } else if (size < 24) {\\n return _ownerOfQuad(parentSize, x, y);\\n }\\n return address(0);\\n }\\n\\n /// @param id quad id\\n /// @return size of the quad\\n /// @return x coordinate\\n /// @return y coordinate\\n function _getQuadById(uint256 id)\\n internal\\n pure\\n returns (\\n uint256 size,\\n uint256 x,\\n uint256 y\\n )\\n {\\n x = _getX(id);\\n y = _getY(id);\\n uint256 layer = id & LAYER;\\n if (layer == LAYER_1x1) {\\n size = 1;\\n } else if (layer == LAYER_3x3) {\\n size = 3;\\n } else if (layer == LAYER_6x6) {\\n size = 6;\\n } else if (layer == LAYER_12x12) {\\n size = 12;\\n } else if (layer == LAYER_24x24) {\\n size = 24;\\n } else {\\n require(false, \\\"Invalid token id\\\");\\n }\\n }\\n\\n /// @param id quad id\\n /// @return address of the owner\\n function _ownerOf(uint256 id) internal view returns (address) {\\n require(id & LAYER == 0, \\\"Invalid token id\\\");\\n (uint256 size, uint256 x, uint256 y) = _getQuadById(id);\\n require(x % size == 0, \\\"x coordinate: Invalid token id\\\");\\n require(y % size == 0, \\\"y coordinate: Invalid token id\\\");\\n return _ownerOfQuad(size, x, y);\\n }\\n\\n /// @param id token id\\n /// @return owner owner of the token\\n /// @return operatorEnabled is operator enabled\\n function _ownerAndOperatorEnabledOf(uint256 id) internal view returns (address owner, bool operatorEnabled) {\\n require(id & LAYER == 0, \\\"Invalid token id\\\");\\n uint256 x = _getX(id);\\n uint256 y = _getY(id);\\n uint256 owner1x1 = _owners[id];\\n\\n if (owner1x1 != 0) {\\n owner = address(owner1x1);\\n operatorEnabled = (owner1x1 / 2**255) == 1;\\n } else {\\n owner = _ownerOfQuad(3, (x * 3) / 3, (y * 3) / 3);\\n operatorEnabled = false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa0b9fb7d2d2be1a32fbe1b81dc2b18d45eea8b976c949d91a2f18e3c6e6cd92d\"},\"src/solc_0.5/LandV3.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n/* solhint-disable no-empty-blocks */\\npragma solidity 0.5.9;\\n\\nimport {LandBaseTokenV3} from \\\"./Land/erc721/LandBaseTokenV3.sol\\\";\\nimport {OperatorFiltererUpgradeable, IOperatorFilterRegistry} from \\\"./OperatorFilterer/contracts/upgradeable/OperatorFiltererUpgradeable.sol\\\";\\n\\n/**\\n * @title LandV3\\n * @author The Sandbox\\n * @notice LAND contract\\n * @dev LAND contract implements ERC721, quad and marketplace filtering functionalities\\n */\\ncontract LandV3 is LandBaseTokenV3, OperatorFiltererUpgradeable {\\n event OperatorRegistrySet(address indexed registry);\\n\\n /**\\n * @notice Return the name of the token contract\\n * @return The name of the token contract\\n */\\n function name() external pure returns (string memory) {\\n return \\\"Sandbox's LANDs\\\";\\n }\\n\\n /**\\n * @notice Return the symbol of the token contract\\n * @return The symbol of the token contract\\n */\\n function symbol() external pure returns (string memory) {\\n return \\\"LAND\\\";\\n }\\n\\n // solium-disable-next-line security/no-assign-params\\n function uint2str(uint256 _i) internal pure returns (string memory) {\\n if (_i == 0) {\\n return \\\"0\\\";\\n }\\n uint256 j = _i;\\n uint256 len;\\n while (j != 0) {\\n len++;\\n j /= 10;\\n }\\n bytes memory bstr = new bytes(len);\\n uint256 k = len - 1;\\n while (_i != 0) {\\n bstr[k--] = byte(uint8(48 + (_i % 10)));\\n _i /= 10;\\n }\\n return string(bstr);\\n }\\n\\n /**\\n * @notice Return the URI of a specific token\\n * @param id The id of the token\\n * @return The URI of the token\\n */\\n function tokenURI(uint256 id) public view returns (string memory) {\\n require(_ownerOf(id) != address(0), \\\"LandV3: Id does not exist\\\");\\n return string(abi.encodePacked(\\\"https://api.sandbox.game/lands/\\\", uint2str(id), \\\"/metadata.json\\\"));\\n }\\n\\n /**\\n * @notice Check if the contract supports an interface\\n * 0x01ffc9a7 is ERC-165\\n * 0x80ac58cd is ERC-721\\n * 0x5b5e139f is ERC-721 metadata\\n * @param id The id of the interface\\n * @return True if the interface is supported\\n */\\n function supportsInterface(bytes4 id) external pure returns (bool) {\\n return id == 0x01ffc9a7 || id == 0x80ac58cd || id == 0x5b5e139f;\\n }\\n\\n /// @notice This function is used to register Land contract on the Operator Filterer Registry of Opensea.can only be called by admin.\\n /// @dev used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.\\n /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe.\\n /// @param subscribe bool to signify subscription \\\"true\\\"\\\" or to copy the list \\\"false\\\".\\n function register(address subscriptionOrRegistrantToCopy, bool subscribe) external onlyAdmin {\\n require(subscriptionOrRegistrantToCopy != address(0), \\\"LandV3: subscription can't be zero address\\\");\\n _register(subscriptionOrRegistrantToCopy, subscribe);\\n }\\n\\n /// @notice sets filter registry address deployed in test\\n /// @param registry the address of the registry\\n function setOperatorRegistry(address registry) external onlyAdmin {\\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\\n emit OperatorRegistrySet(registry);\\n }\\n\\n /**\\n * @notice Approve an operator to spend tokens on the sender behalf\\n * @param sender The address giving the approval\\n * @param operator The address receiving the approval\\n * @param id The id of the token\\n */\\n function approveFor(\\n address sender,\\n address operator,\\n uint256 id\\n ) public onlyAllowedOperatorApproval(operator) {\\n super.approveFor(sender, operator, id);\\n }\\n\\n /**\\n * @notice Set the approval for an operator to manage all the tokens of the sender\\n * @param operator The address receiving the approval\\n * @param approved The determination of the approval\\n */\\n function setApprovalForAll(address operator, bool approved) public onlyAllowedOperatorApproval(operator) {\\n super.setApprovalForAll(operator, approved);\\n }\\n\\n /**\\n * @notice Set the approval for an operator to manage all the tokens of the sender\\n * @param sender The address giving the approval\\n * @param operator The address receiving the approval\\n * @param approved The determination of the approval\\n */\\n function setApprovalForAllFor(\\n address sender,\\n address operator,\\n bool approved\\n ) public onlyAllowedOperatorApproval(operator) {\\n super.setApprovalForAllFor(sender, operator, approved);\\n }\\n\\n /**\\n * @notice Approve an operator to spend tokens on the sender behalf\\n * @param operator The address receiving the approval\\n * @param id The id of the token\\n */\\n function approve(address operator, uint256 id) public onlyAllowedOperatorApproval(operator) {\\n super.approve(operator, id);\\n }\\n\\n /**\\n * @notice Transfer a token between 2 addresses\\n * @param from The sender of the token\\n * @param to The recipient of the token\\n * @param id The id of the token\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 id\\n ) public onlyAllowedOperator(from) {\\n super.transferFrom(from, to, id);\\n }\\n\\n /**\\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\\n * @param from The sender of the token\\n * @param to The recipient of the token\\n * @param id The id of the token\\n * @param data Additional data\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n bytes memory data\\n ) public onlyAllowedOperator(from) {\\n super.safeTransferFrom(from, to, id, data);\\n }\\n\\n /**\\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\\n * @param from The send of the token\\n * @param to The recipient of the token\\n * @param id The id of the token\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id\\n ) external onlyAllowedOperator(from) {\\n super.safeTransferFrom(from, to, id, \\\"\\\");\\n }\\n}\\n\",\"keccak256\":\"0x197a35aee13cfc6168f478fe949236bc134959d51c5fcbfbf4494ec920fddc64\"},\"src/solc_0.5/OperatorFilterer/contracts/upgradeable/OperatorFiltererUpgradeable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.5.9;\\n\\nimport {IOperatorFilterRegistry} from \\\"../../interfaces/IOperatorFilterRegistry.sol\\\";\\nimport {AddressUtils} from \\\"../../../contracts_common/Libraries/AddressUtils.sol\\\";\\n\\n/// @title OperatorFiltererUpgradeable\\n/// @author The Sandbox\\n/// @notice This contract would subscibe or copy or just to the subscription provided or just register to default subscription list\\n/// @dev This contract is the upgradeable version of the OpenSea implementation https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/OperatorFilterer.sol and adapted to the 0.5.9 solidity version\\ncontract OperatorFiltererUpgradeable {\\n using AddressUtils for address;\\n IOperatorFilterRegistry public operatorFilterRegistry;\\n\\n event ContractRegistered(address indexed subscriptionOrRegistrant, bool subscribe);\\n\\n /**\\n * @notice Register this contract into the registry\\n * @param subscriptionOrRegistrantToCopy address to subscribe or copy entries from\\n * @param subscribe should it subscribe\\n */\\n function _register(address subscriptionOrRegistrantToCopy, bool subscribe) internal {\\n // If an inheriting token contract is deployed to a network without the registry deployed, the modifier\\n // will not revert, but the contract will need to be registered with the registry once it is deployed in\\n // order for the modifier to filter addresses.\\n if (address(operatorFilterRegistry).isContract()) {\\n if (!operatorFilterRegistry.isRegistered(address(this))) {\\n if (subscribe) {\\n operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);\\n } else {\\n if (subscriptionOrRegistrantToCopy != address(0)) {\\n operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);\\n } else {\\n operatorFilterRegistry.register(address(this));\\n }\\n }\\n }\\n }\\n emit ContractRegistered(subscriptionOrRegistrantToCopy, subscribe);\\n }\\n\\n modifier onlyAllowedOperator(address from) {\\n // Check registry code length to facilitate testing in environments without a deployed registry.\\n if (address(operatorFilterRegistry).isContract()) {\\n // Allow spending tokens from addresses with balance\\n // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred\\n // from an EOA.\\n if (from == msg.sender) {\\n _;\\n return;\\n }\\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), msg.sender)) {\\n revert(\\\"Operator Not Allowed\\\");\\n }\\n }\\n _;\\n }\\n\\n modifier onlyAllowedOperatorApproval(address operator) {\\n // Check registry code length to facilitate testing in environments without a deployed registry.\\n if (address(operatorFilterRegistry).isContract()) {\\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), operator)) {\\n revert(\\\"Operator Not Allowed\\\");\\n }\\n }\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x99de28325e89069ad4e3bdfb5d93943e314dcb0d700ee46ce9a0449a75d54f63\"},\"src/solc_0.5/OperatorFilterer/interfaces/IOperatorFilterRegistry.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.5.9;\\n\\n/**\\n * @title IOperatorFilterRegistry\\n * @author OpenSea\\n * @notice Interface of the operator filter registry\\n * @dev This interface comes from OpenSea https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/IOperatorFilterRegistry.sol and adapted to the 0.5.9 solidity version\\n */\\ninterface IOperatorFilterRegistry {\\n /**\\n * @notice Check if the operator is allowed for the given registrant\\n * @param registrant address of the registrant\\n * @param operator operator address to check\\n * @return is the operator allowed\\n */\\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\\n\\n /**\\n * @notice Register a new address\\n * @param registrant address to register\\n */\\n function register(address registrant) external;\\n\\n /**\\n * @notice Register a new address & subscribe to an address\\n * @param registrant address of the registrant\\n * @param subscription address where the registrant is subscribed to\\n */\\n function registerAndSubscribe(address registrant, address subscription) external;\\n\\n /**\\n * @notice Register and copy entries of another registrant\\n * @param registrant address of the registrant\\n * @param registrantToCopy address to copy from\\n */\\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\\n\\n /**\\n * @notice update the operator for a registrant\\n * @param registrant address of the registrant\\n * @param operator operator to be updated\\n * @param filtered is it filtered\\n */\\n function updateOperator(\\n address registrant,\\n address operator,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update operators for a registrant\\n * @param registrant address of the registrant\\n * @param operators addresses of the operators\\n * @param filtered is it filtered\\n */\\n function updateOperators(\\n address registrant,\\n address[] calldata operators,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update code hash\\n * @param registrant address of the registrant\\n * @param codehash code hash\\n * @param filtered is it filtered\\n */\\n function updateCodeHash(\\n address registrant,\\n bytes32 codehash,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update code hashes\\n * @param registrant address of the registrant\\n * @param codeHashes code hashes\\n * @param filtered is it filtered\\n */\\n function updateCodeHashes(\\n address registrant,\\n bytes32[] calldata codeHashes,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Subscribe a registrant\\n * @param registrant address of the registrant\\n * @param registrantToSubscribe address to subscribe with\\n */\\n function subscribe(address registrant, address registrantToSubscribe) external;\\n\\n /**\\n * @notice Unsubscribe a registrant\\n * @param registrant address of the registrant\\n * @param copyExistingEntries copy existing entries\\n */\\n function unsubscribe(address registrant, bool copyExistingEntries) external;\\n\\n /**\\n * @notice Get the subscription of an address\\n * @param addr address to check\\n * @return the registrant address\\n */\\n function subscriptionOf(address addr) external returns (address registrant);\\n\\n /**\\n * @notice Get the subscribers of the registrant\\n * @param registrant address of the registrant\\n * @return the subscribers addresses\\n */\\n function subscribers(address registrant) external returns (address[] memory);\\n\\n /**\\n * @notice Get a specific subscriber\\n * @param registrant address of the registrant\\n * @param index index to check\\n * @return the ith subscriber of the registrant\\n */\\n function subscriberAt(address registrant, uint256 index) external returns (address);\\n\\n /**\\n * @notice Copy the entries of a registrant\\n * @param registrant address of the registrant\\n * @param registrantToCopy address to copy\\n */\\n function copyEntriesOf(address registrant, address registrantToCopy) external;\\n\\n /**\\n * @notice Is a registrant filtered\\n * @param registrant address of the registrant\\n * @param operator operator address to check\\n * @return is it filtered\\n */\\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\\n\\n /**\\n * @notice Is the code hash of an operator filtered\\n * @param registrant address of the registrant\\n * @param operatorWithCode operator address to check\\n * @return is it filtered\\n */\\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\\n\\n /**\\n * @notice Is the code hash filtered\\n * @param registrant address of the registrant\\n * @param codeHash code hash\\n * @return is it filtered\\n */\\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\\n\\n /**\\n * @notice Get the filtered operators\\n * @param addr address to check\\n * @return filtered operators\\n */\\n function filteredOperators(address addr) external returns (address[] memory);\\n\\n /**\\n * @notice Get the filtered code hashes\\n * @param addr address to check\\n * @return filtered code hashes\\n */\\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\\n\\n /**\\n * @notice Get a specific operator\\n * @param registrant address of the registrant\\n * @param index index to check\\n * @return address of the operator\\n */\\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\\n\\n /**\\n * @notice Get the ith filtered code hash\\n * @param registrant address of the registrant\\n * @param index index to check\\n * @return the code hash\\n */\\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\\n\\n /**\\n * @notice Is the address registered\\n * @param addr address to check\\n * @return is it registered\\n */\\n function isRegistered(address addr) external returns (bool);\\n\\n /**\\n * @notice Get the code hash for this address\\n * @param addr address to check\\n * @return the code hash\\n */\\n function codeHashOf(address addr) external returns (bytes32);\\n}\\n\",\"keccak256\":\"0x6c561fe9bb5203df2af2f8332737946ff1df8314b4e992603617db97754bbaf7\"},\"src/solc_0.5/contracts_common/BaseWithStorage/AdminV2.sol\":{\"content\":\"pragma solidity 0.5.9;\\n\\ncontract AdminV2 {\\n\\n address internal _admin;\\n\\n event AdminChanged(address oldAdmin, address newAdmin);\\n\\n /// @notice gives the current administrator of this contract.\\n /// @return the current administrator of this contract.\\n function getAdmin() external view returns (address) {\\n return _admin;\\n }\\n\\n /// @notice change the administrator to be `newAdmin`.\\n /// @param newAdmin address of the new administrator.\\n function changeAdmin(address newAdmin) external {\\n address admin = _admin;\\n require(msg.sender == admin, \\\"only admin can change admin\\\");\\n require(newAdmin != admin, \\\"it can be only changed to a new admin\\\");\\n emit AdminChanged(admin, newAdmin);\\n _admin = newAdmin;\\n }\\n\\n modifier onlyAdmin() {\\n require (msg.sender == _admin, \\\"only admin allowed\\\");\\n _;\\n }\\n\\n}\\n\",\"keccak256\":\"0xb209accdc816ab4eadc81d6b14e5b218353c7c0e90866c59625f69ee6ba74575\"},\"src/solc_0.5/contracts_common/BaseWithStorage/MetaTransactionReceiverV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.5.9;\\n\\nimport {AdminV2} from \\\"./AdminV2.sol\\\";\\nimport {AddressUtils} from \\\"../../contracts_common/Libraries/AddressUtils.sol\\\";\\n\\n/// @title MetaTransactionReceiverV2\\n/// @author The Sandbox\\n/// @notice Implements meta-transactions\\n/// @dev This contract permits to give an address the capacity to perform meta-transactions on behalf of any address\\ncontract MetaTransactionReceiverV2 is AdminV2 {\\n using AddressUtils for address;\\n\\n mapping(address => bool) internal _metaTransactionContracts;\\n event MetaTransactionProcessor(address indexed metaTransactionProcessor, bool enabled);\\n\\n /// @notice Enable or disable the ability of `metaTransactionProcessor` to perform meta-tx (metaTransactionProcessor rights).\\n /// @param metaTransactionProcessor address that will be given/removed metaTransactionProcessor rights.\\n /// @param enabled set whether the metaTransactionProcessor is enabled or disabled.\\n function setMetaTransactionProcessor(address metaTransactionProcessor, bool enabled) public onlyAdmin {\\n require(\\n metaTransactionProcessor.isContract(),\\n \\\"only contracts can be meta transaction processor\\\"\\n );\\n _setMetaTransactionProcessor(metaTransactionProcessor, enabled);\\n }\\n\\n /// @param metaTransactionProcessor address of the operator\\n /// @param enabled is it enabled\\n function _setMetaTransactionProcessor(address metaTransactionProcessor, bool enabled) internal {\\n _metaTransactionContracts[metaTransactionProcessor] = enabled;\\n emit MetaTransactionProcessor(metaTransactionProcessor, enabled);\\n }\\n\\n /// @notice check whether address `who` is given meta-transaction execution rights.\\n /// @param who The address to query.\\n /// @return whether the address has meta-transaction execution rights.\\n function isMetaTransactionProcessor(address who) external view returns(bool) {\\n return _metaTransactionContracts[who];\\n }\\n}\\n\",\"keccak256\":\"0x9a163be573bfa151a263703af827bc27ca8fbb25f1d3c386109675a4771ac189\"},\"src/solc_0.5/contracts_common/BaseWithStorage/SuperOperatorsV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.5.9;\\n\\nimport {AdminV2} from \\\"./AdminV2.sol\\\";\\n\\n/// @title SuperOperatorsV2\\n/// @author The Sandbox\\n/// @notice Implements a super operator role on the contract\\n/// @dev The contract inheriting SuperOperatorsV2 is able to use a super operator role\\ncontract SuperOperatorsV2 is AdminV2 {\\n\\n mapping(address => bool) internal _superOperators;\\n\\n event SuperOperator(address indexed superOperator, bool enabled);\\n\\n /// @notice Enable or disable the ability of `superOperator` to transfer tokens of all (superOperator rights).\\n /// @param superOperator address that will be given/removed superOperator right.\\n /// @param enabled set whether the superOperator is enabled or disabled.\\n function setSuperOperator(address superOperator, bool enabled) external onlyAdmin {\\n require(\\n superOperator != address(0),\\n \\\"address 0 is not allowed as super operator\\\"\\n );\\n require(\\n enabled != _superOperators[superOperator],\\n \\\"the status should be different than the current one\\\"\\n );\\n _superOperators[superOperator] = enabled;\\n emit SuperOperator(superOperator, enabled);\\n }\\n\\n /// @notice check whether address `who` is given superOperator rights.\\n /// @param who The address to query.\\n /// @return whether the address has superOperator rights.\\n function isSuperOperator(address who) public view returns (bool) {\\n return _superOperators[who];\\n }\\n}\\n\",\"keccak256\":\"0x3992a8c3dab57551e760ca3145fe7e8b91a85ac7f75995f12e8d010e983e7b16\"},\"src/solc_0.5/contracts_common/Interfaces/ERC721Events.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.5.9;\\n\\n/**\\n * @title ERC721 Non-Fungible Token Standard basic interface\\n * @dev see https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface ERC721Events {\\n event Transfer(\\n address indexed _from,\\n address indexed _to,\\n uint256 indexed _tokenId\\n );\\n event Approval(\\n address indexed _owner,\\n address indexed _approved,\\n uint256 indexed _tokenId\\n );\\n event ApprovalForAll(\\n address indexed _owner,\\n address indexed _operator,\\n bool _approved\\n );\\n}\\n\",\"keccak256\":\"0xd3b7c555cecf947ff0ad9395f995ec7f3ecf9300e1c84b47e382f680018caebe\"},\"src/solc_0.5/contracts_common/Interfaces/ERC721MandatoryTokenReceiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.5.9;\\n\\n/**\\n * @title ERC721MandatoryTokenReceiver\\n * @author The Sandbox\\n * @notice Interface for any contract that wants to support safeBatchTransfers\\n * from ERC721 asset contracts.\\n * @dev The ERC-165 identifier for this interface is 0x5e8bf644.\\n */\\ninterface ERC721MandatoryTokenReceiver {\\n /**\\n * @notice Whenever tokens are transferred to this contract via {IERC721-safeBatchTransferFrom}\\n * by `operator` from `from`, this function is called.\\n * @param operator sender\\n * @param from owner of the tokens\\n * @param ids token ids\\n * @param data extra data\\n * @return 0x4b808c46 if the transfer is a success\\n */\\n function onERC721BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) external returns (bytes4); // needs to return 0x4b808c46\\n\\n /**\\n * @notice Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n * @param operator sender\\n * @param from owner of the token\\n * @param tokenId token id\\n * @param data extra data\\n * @return 0x150b7a02 if the transfer is a success\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4); // needs to return 0x150b7a02\\n}\\n\",\"keccak256\":\"0xe2e343784b6600770da228caab069fd5f2d0c18c58dfee42abafcbf63b9fc159\"},\"src/solc_0.5/contracts_common/Interfaces/ERC721TokenReceiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// solhint-disable-next-line compiler-fixed\\npragma solidity 0.5.9;\\n\\n/**\\n * @title ERC721TokenReceiver\\n * @author The Sandbox\\n * @notice Handle the receipt of an NFT\\n */\\ninterface ERC721TokenReceiver {\\n /**\\n * @notice Handle the receipt of an NFT\\n * @dev The ERC721 smart contract calls this function on the recipient\\n * after a `transfer`. This function MAY throw to revert and reject the\\n * transfer. Return of other than the magic value MUST result in the\\n * transaction being reverted.\\n * Note: the contract address is always the message sender.\\n * @param operator The address which called `safeTransferFrom` function\\n * @param from The address which previously owned the token\\n * @param tokenId The NFT identifier which is being transferred\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC721Received(address,address,uint256,bytes)\\\"))` unless throwing\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xf409294dc72ef440bf7619f2be75f1e674e253186addbcfe99d0699b12c465aa\"},\"src/solc_0.5/contracts_common/Libraries/AddressUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.5.9;\\n\\n/**\\n * @title AddressUtils\\n * @author The Sandbox\\n * @notice Helper to manipulate addresses\\n */\\nlibrary AddressUtils {\\n\\n /**\\n * @dev Cast the address to be payable\\n * @param _address target address\\n * @return a payable address\\n */\\n function toPayable(address _address) internal pure returns (address payable) {\\n return address(uint160(_address));\\n }\\n\\n /**\\n * @dev Check if the address is a contract\\n * @param addr target address\\n * @return is it a contract\\n */\\n function isContract(address addr) internal view returns (bool) {\\n // for accounts without code, i.e. `keccak256('')`:\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n\\n bytes32 codehash;\\n // solium-disable-next-line security/no-inline-assembly\\n assembly {\\n codehash := extcodehash(addr)\\n }\\n return (codehash != 0x0 && codehash != accountHash);\\n }\\n}\\n\",\"keccak256\":\"0xf2a0c9d986e8c43771847789a7bdf09a2fb96ea27bd0de81a4e94b61f764cd02\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50615c7580620000216000396000f3fe608060405234801561001057600080fd5b50600436106102f45760003560e01c80638782676411610191578063ab01b469116100e3578063c87b56dd11610097578063e985e9c511610071578063e985e9c514610c92578063eaa5e06714610cc0578063eeb5a5d114610e3f576102f4565b8063c87b56dd14610c21578063cf456ae714610c3e578063dc5074af14610c6c576102f4565b8063b0ccc31e116100c8578063b0ccc31e14610b36578063b88d4fde14610b3e578063b9b710e914610c04576102f4565b8063ab01b46914610ada578063ac9fe42114610b08576102f4565b8063992924a6116101455780639ededf771161011f5780639ededf7714610418578063a22cb46514610a86578063aa271e1a14610ab4576102f4565b8063992924a614610a155780639d28fb8614610a325780639d786bbc14610a58576102f4565b80638e5cb5f6116101765780638e5cb5f6146109ca5780638f283970146109e757806395d89b4114610a0d576102f4565b806387826764146109765780638a04af6a1461099c576102f4565b806342966c681161024a578063654b748a116101fe57806370a08231116101d857806370a082311461090757806379cc67901461092d578063845a469714610959576102f4565b8063654b748a146108485780636e1e3bbf1461086e5780636e9960c3146108ff576102f4565b80634e6a0f441161022f5780634e6a0f441461077157806355064d85146108025780636352211e1461082b576102f4565b806342966c6814610726578063485cc95514610743576102f4565b806315ddc535116102ac5780632b991746116102865780632b9917461461061e57806338bb305a1461065457806342842e0e146106f0576102f4565b806315ddc5351461043257806323b872dd1461050d57806328cfbd4614610543576102f4565b8063081812fc116102dd578063081812fc146103b1578063095ea7b3146103ea5780630ef2674314610418576102f4565b806301ffc9a7146102f957806306fdde0314610334575b600080fd5b6103206004803603602081101561030f57600080fd5b50356001600160e01b031916610e77565b604080519115158252519081900360200190f35b61033c610f16565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561037657818101518382015260200161035e565b50505050905090810190601f1680156103a35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103ce600480360360208110156103c757600080fd5b5035610f4d565b604080516001600160a01b039092168252519081900360200190f35b6104166004803603604081101561040057600080fd5b506001600160a01b038135169060200135610fec565b005b6104206110de565b60408051918252519081900360200190f35b6104166004803603608081101561044857600080fd5b6001600160a01b03823581169260208101359091169181019060608101604082013564010000000081111561047c57600080fd5b82018360208201111561048e57600080fd5b803590602001918460208302840111640100000000831117156104b057600080fd5b9193909290916020810190356401000000008111156104ce57600080fd5b8201836020820111156104e057600080fd5b8035906020019184600183028401116401000000008311171561050257600080fd5b5090925090506110e4565b6104166004803603606081101561052357600080fd5b506001600160a01b0381358116916020810135909116906040013561115e565b6104166004803603608081101561055957600080fd5b6001600160a01b03823581169260208101359091169181019060608101604082013564010000000081111561058d57600080fd5b82018360208201111561059f57600080fd5b803590602001918460208302840111640100000000831117156105c157600080fd5b9193909290916020810190356401000000008111156105df57600080fd5b8201836020820111156105f157600080fd5b8035906020019184600183028401116401000000008311171561061357600080fd5b509092509050611271565b6104166004803603606081101561063457600080fd5b506001600160a01b038135811691602081013590911690604001356112e6565b610416600480360360c081101561066a57600080fd5b6001600160a01b0382358116926020810135909116916040820135916060810135916080820135919081019060c0810160a08201356401000000008111156106b157600080fd5b8201836020820111156106c357600080fd5b803590602001918460018302840111640100000000831117156106e557600080fd5b5090925090506113d4565b6104166004803603606081101561070657600080fd5b506001600160a01b03813581169160208101359091169060400135611600565b6104166004803603602081101561073c57600080fd5b5035611728565b6104166004803603604081101561075957600080fd5b506001600160a01b038135811691602001351661173e565b610416600480360360a081101561078757600080fd5b6001600160a01b038235169160208101359160408201359160608101359181019060a0810160808201356401000000008111156107c357600080fd5b8201836020820111156107d557600080fd5b803590602001918460018302840111640100000000831117156107f757600080fd5b50909250905061180b565b6103206004803603606081101561081857600080fd5b50803590602081013590604001356119a4565b6103ce6004803603602081101561084157600080fd5b50356119d3565b6103206004803603602081101561085e57600080fd5b50356001600160a01b0316611a3b565b610416600480360360a081101561088457600080fd5b6001600160a01b038235169160208101359160408201359160608101359181019060a0810160808201356401000000008111156108c057600080fd5b8201836020820111156108d257600080fd5b803590602001918460018302840111640100000000831117156108f457600080fd5b509092509050611a59565b6103ce611cbe565b6104206004803603602081101561091d57600080fd5b50356001600160a01b0316611ccd565b6104166004803603604081101561094357600080fd5b506001600160a01b038135169060200135611d46565b6104206004803603602081101561096f57600080fd5b5035611ea5565b6104206004803603602081101561098c57600080fd5b50356001600160a01b0316611eb0565b610416600480360360408110156109b257600080fd5b506001600160a01b0381351690602001351515611ec2565b610420600480360360208110156109e057600080fd5b5035611f7c565b610416600480360360208110156109fd57600080fd5b50356001600160a01b0316611f87565b61033c6120ad565b61042060048036036020811015610a2b57600080fd5b50356120e4565b61041660048036036020811015610a4857600080fd5b50356001600160a01b03166120f6565b61032060048036036040811015610a6e57600080fd5b506001600160a01b03813581169160200135166121ac565b61041660048036036040811015610a9c57600080fd5b506001600160a01b03813516906020013515156121cc565b61032060048036036020811015610aca57600080fd5b50356001600160a01b03166122b9565b61041660048036036040811015610af057600080fd5b506001600160a01b03813516906020013515156122d7565b61041660048036036040811015610b1e57600080fd5b506001600160a01b0381351690602001351515612385565b6103ce6124e7565b61041660048036036080811015610b5457600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135640100000000811115610b8f57600080fd5b820183602082011115610ba157600080fd5b80359060200191846001830284011164010000000083111715610bc357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506124f6945050505050565b6103ce60048036036020811015610c1a57600080fd5b503561260c565b61033c60048036036020811015610c3757600080fd5b5035612627565b61041660048036036040811015610c5457600080fd5b506001600160a01b0381351690602001351515612790565b61032060048036036020811015610c8257600080fd5b50356001600160a01b03166128f2565b61032060048036036040811015610ca857600080fd5b506001600160a01b0381358116916020013516612910565b610416600480360360c0811015610cd657600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135640100000000811115610d0a57600080fd5b820183602082011115610d1c57600080fd5b80359060200191846020830284011164010000000083111715610d3e57600080fd5b919390929091602081019035640100000000811115610d5c57600080fd5b820183602082011115610d6e57600080fd5b80359060200191846020830284011164010000000083111715610d9057600080fd5b919390929091602081019035640100000000811115610dae57600080fd5b820183602082011115610dc057600080fd5b80359060200191846020830284011164010000000083111715610de257600080fd5b919390929091602081019035640100000000811115610e0057600080fd5b820183602082011115610e1257600080fd5b80359060200191846001830284011164010000000083111715610e3457600080fd5b509092509050612967565b61041660048036036060811015610e5557600080fd5b506001600160a01b038135811691602081013590911690604001351515612d72565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161480610eda57507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b80610f0e57507f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b90505b919050565b60408051808201909152600f81527f53616e64626f782773204c414e44730000000000000000000000000000000000602082015290565b6000806000610f5b84612e60565b90925090506001600160a01b038216610fbb576040805162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f74206578697374000000000000000000000000604482015290519081900360640190fd5b8015610fe1575050506000818152600660205260409020546001600160a01b0316610f11565b600092505050610f11565b603a548290611003906001600160a01b0316612f5c565b156110cf57603a5460408051633185c44d60e21b81523060048201526001600160a01b0384811660248301529151919092169163c6171134916044808301926020929190829003018186803b15801561105b57600080fd5b505afa15801561106f573d6000803e3d6000fd5b505050506040513d602081101561108557600080fd5b50516110cf576040805162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015290519081900360640190fd5b6110d98383612f98565b505050565b61019890565b611156868686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8a018190048102820181019092528881529250889150879081908401838280828437600092018290525092506130b0915050565b505050505050565b603a548390611175906001600160a01b0316612f5c565b15611260576001600160a01b03811633141561119b576111968484846134f3565b61126b565b603a5460408051633185c44d60e21b815230600482015233602482015290516001600160a01b039092169163c617113491604480820192602092909190829003018186803b1580156111ec57600080fd5b505afa158015611200573d6000803e3d6000fd5b505050506040513d602081101561121657600080fd5b5051611260576040805162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015290519081900360640190fd5b61126b8484846134f3565b50505050565b611156868686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8a018190048102820181019092528881529250889150879081908401838280828437600092019190915250600192506130b0915050565b603a5482906112fd906001600160a01b0316612f5c565b156113c957603a5460408051633185c44d60e21b81523060048201526001600160a01b0384811660248301529151919092169163c6171134916044808301926020929190829003018186803b15801561135557600080fd5b505afa158015611369573d6000803e3d6000fd5b505050506040513d602081101561137f57600080fd5b50516113c9576040805162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015290519081900360640190fd5b61126b8484846135b5565b6001600160a01b03871661142f576040805162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f2061646472657373000000000000000000000000604482015290519081900360640190fd5b6001600160a01b03861661148a576040805162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015290519081900360640190fd5b6000336001600160a01b038916148015906114b457503360009081526002602052604090205460ff165b9050336001600160a01b038916148015906114cd575080155b15611564576001600160a01b038816600090815260056020908152604080832033845290915290205460ff168061151357503360009081526001602052604090205460ff165b611564576040805162461bcd60e51b815260206004820152601e60248201527f6e6f7420617574686f72697a656420746f207472616e73666572517561640000604482015290519081900360640190fd5b611571888888888861374d565b6001600160a01b0380891660009081526003602052604080822080548a800290819003909155928a1682529020805490910190556115f6816115b357336115b5565b885b898989898989898080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506138f492505050565b5050505050505050565b603a548390611617906001600160a01b0316612f5c565b1561170d576001600160a01b03811633141561164857611196848484604051806020016040528060008152506139de565b603a5460408051633185c44d60e21b815230600482015233602482015290516001600160a01b039092169163c617113491604480820192602092909190829003018186803b15801561169957600080fd5b505afa1580156116ad573d6000803e3d6000fd5b505050506040513d60208110156116c357600080fd5b505161170d576040805162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015290519081900360640190fd5b61126b848484604051806020016040528060008152506139de565b61173b3361173583613a79565b83613bd0565b50565b60075460ff16156117805760405162461bcd60e51b815260040180806020018281038252602d8152602001806159e6602d913960400191505060405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383161790556117b3826001613cab565b6007805460ff1916600117905560008054604080519283526001600160a01b03909116602083015280517f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f9281900390910190a15050565b6001600160a01b038616611866576040805162461bcd60e51b815260206004820152601260248201527f746f206973207a65726f20616464726573730000000000000000000000000000604482015290519081900360640190fd5b61186f336122b9565b6118c0576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792061206d696e7465722063616e206d696e7400000000000000000000604482015290519081900360640190fd5b6118cb8585856119a4565b151560011415611961576118e2338787878761374d565b33600081815260036020908152604080832080548a8002908190039091556001600160a01b038b1684529281902080549093019092558151601f850182900482028101820190925283825261195c929182918a918a918a918a918a908a90819084018382808284376000920191909152506138f492505050565b611156565b6111568686868686868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613d0b92505050565b60006119b1848484613fd9565b60006119be8585856141c4565b6001600160a01b0316141590505b9392505050565b60006119de82613a79565b90506001600160a01b038116610f11576040805162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f74206578697374000000000000000000000000604482015290519081900360640190fd5b6001600160a01b031660009081526001602052604090205460ff1690565b6001600160a01b038616611ab4576040805162461bcd60e51b815260206004820152601260248201527f746f206973207a65726f20616464726573730000000000000000000000000000604482015290519081900360640190fd5b84611b06576040805162461bcd60e51b815260206004820152601360248201527f73697a652063616e6e6f74206265207a65726f00000000000000000000000000604482015290519081900360640190fd5b611b0f336122b9565b611b60576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792061206d696e7465722063616e206d696e7400000000000000000000604482015290519081900360640190fd5b611b6b858585613fd9565b6000611b7686614255565b505090506000611b87828787614352565b9050611b96878787601861435c565b60005b878802811015611c47576000611bb1828a8a8a614493565b60008181526004602052604090205490915015611c06576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015290519081900360640190fd5b60405181906001600160a01b038c16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a450600101611b99565b5060008181526004602090815260408083206001600160a01b038c169081905583526003825280832080548b80020190558051601f87018390048302810183019091528581526115f692339290918c918c918c918c91908c908c90819084018382808284376000920191909152506138f492505050565b6000546001600160a01b031690565b60006001600160a01b038216611d2a576040805162461bcd60e51b815260206004820152601560248201527f6f776e6572206973207a65726f20616464726573730000000000000000000000604482015290519081900360640190fd5b506001600160a01b031660009081526003602052604090205490565b6001600160a01b038216611da1576040805162461bcd60e51b815260206004820152601660248201527f496e76616c69642073656e646572206164647265737300000000000000000000604482015290519081900360640190fd5b600080611dad83612e60565b9092509050336001600160a01b0385161480611dd857503360009081526002602052604090205460ff165b80611e015750808015611e0157506000838152600660205260409020546001600160a01b031633145b80611e2f57506001600160a01b038416600090815260056020908152604080832033845290915290205460ff165b80611e4957503360009081526001602052604090205460ff165b611e9a576040805162461bcd60e51b815260206004820152601660248201527f6e6f7420617574686f72697a656420746f206275726e00000000000000000000604482015290519081900360640190fd5b61126b848385613bd0565b6000610f0e826144e9565b60036020526000908152604090205481565b6000546001600160a01b03163314611f21576040805162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e20616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b611f33826001600160a01b0316612f5c565b611f6e5760405162461bcd60e51b8152600401808060200182810382526030815260200180615ab66030913960400191505060405180910390fd5b611f788282613cab565b5050565b6000610f0e82614514565b6000546001600160a01b0316338114611fe7576040805162461bcd60e51b815260206004820152601b60248201527f6f6e6c792061646d696e2063616e206368616e67652061646d696e0000000000604482015290519081900360640190fd5b806001600160a01b0316826001600160a01b031614156120385760405162461bcd60e51b8152600401808060200182810382526025815260200180615ba66025913960400191505060405180910390fd5b604080516001600160a01b0380841682528416602082015281517f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f929181900390910190a1506000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60408051808201909152600481527f4c414e4400000000000000000000000000000000000000000000000000000000602082015290565b60046020526000908152604090205481565b6000546001600160a01b03163314612155576040805162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e20616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b603a805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517fc6df119c56c99171b170652a3c4750ba46dcaacbdb3b7ab4847a9fa339659bd490600090a250565b600560209081526000928352604080842090915290825290205460ff1681565b603a5482906121e3906001600160a01b0316612f5c565b156122af57603a5460408051633185c44d60e21b81523060048201526001600160a01b0384811660248301529151919092169163c6171134916044808301926020929190829003018186803b15801561223b57600080fd5b505afa15801561224f573d6000803e3d6000fd5b505050506040513d602081101561226557600080fd5b50516122af576040805162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015290519081900360640190fd5b6110d9838361453f565b6001600160a01b031660009081526039602052604090205460ff1690565b6000546001600160a01b03163314612336576040805162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e20616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b6001600160a01b03821661237b5760405162461bcd60e51b815260040180806020018281038252602a815260200180615bec602a913960400191505060405180910390fd5b611f78828261454a565b6000546001600160a01b031633146123e4576040805162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e20616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b6001600160a01b0382166124295760405162461bcd60e51b815260040180806020018281038252602a815260200180615a13602a913960400191505060405180910390fd5b6001600160a01b03821660009081526001602052604090205460ff16151581151514156124875760405162461bcd60e51b8152600401808060200182810382526033815260200180615a3d6033913960400191505060405180910390fd5b6001600160a01b038216600081815260016020908152604091829020805460ff1916851515908117909155825190815291517f44f92d27abdf4cfb6a7d712c3af68f3be086d4ca747ab802c36f67d6790060d89281900390910190a25050565b603a546001600160a01b031681565b603a54849061250d906001600160a01b0316612f5c565b156125f9576001600160a01b0381163314156125345761252f858585856139de565b612605565b603a5460408051633185c44d60e21b815230600482015233602482015290516001600160a01b039092169163c617113491604480820192602092909190829003018186803b15801561258557600080fd5b505afa158015612599573d6000803e3d6000fd5b505050506040513d60208110156125af57600080fd5b50516125f9576040805162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015290519081900360640190fd5b612605858585856139de565b5050505050565b6006602052600090815260409020546001600160a01b031681565b6060600061263483613a79565b6001600160a01b03161415612690576040805162461bcd60e51b815260206004820152601960248201527f4c616e6456333a20496420646f6573206e6f7420657869737400000000000000604482015290519081900360640190fd5b612699826147c9565b60405160200180807f68747470733a2f2f6170692e73616e64626f782e67616d652f6c616e64732f00815250601f0182805190602001908083835b6020831061271157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016126d4565b5181516020939093036101000a60001901801990911692169190911790527f2f6d657461646174612e6a736f6e000000000000000000000000000000000000920191825250604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee018152600e9092019052949350505050565b6000546001600160a01b031633146127ef576040805162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e20616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b6001600160a01b0382166128345760405162461bcd60e51b8152600401808060200182810382526022815260200180615a946022913960400191505060405180910390fd5b6001600160a01b03821660009081526039602052604090205460ff16151581151514156128925760405162461bcd60e51b8152600401808060200182810382526033815260200180615a3d6033913960400191505060405180910390fd5b6001600160a01b038216600081815260396020908152604091829020805460ff1916851515908117909155825190815291517fff452b3b9159b024a9098f0058c63eccd90d36b3584608202800d662f962bb609281900390910190a25050565b6001600160a01b031660009081526002602052604090205460ff1690565b6001600160a01b03808316600090815260056020908152604080832093851683529290529081205460ff168061295e57506001600160a01b03821660009081526001602052604090205460ff165b90505b92915050565b6001600160a01b038a166129c2576040805162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f2061646472657373000000000000000000000000604482015290519081900360640190fd5b6001600160a01b038916612a1d576040805162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015290519081900360640190fd5b868514612a5b5760405162461bcd60e51b8152600401808060200182810382526035815260200180615b4d6035913960400191505060405180910390fd5b848314612a995760405162461bcd60e51b8152600401808060200182810382526031815260200180615ae66031913960400191505060405180910390fd5b6000336001600160a01b038c1614801590612ac357503360009081526002602052604090205460ff165b9050336001600160a01b038c1614801590612adc575080155b15612b5d576001600160a01b038b16600090815260056020908152604080832033845290915290205460ff1680612b2257503360009081526001602052604090205460ff165b612b5d5760405162461bcd60e51b8152600401808060200182810382526024815260200180615b826024913960400191505060405180910390fd5b6000805b89811015612bc05760008b8b83818110612b7757fe5b905060200201359050612bb18e8e838d8d87818110612b9257fe5b905060200201358c8c88818110612ba557fe5b9050602002013561374d565b80029190910190600101612b61565b506001600160a01b03808d1660009081526003602052604080822080548590039055918d16808252919020805483019055612bfa90612f5c565b8015612c125750612c128b6317a2fd9160e21b6148be565b15612d6457606081604051908082528060200260200182016040528015612c43578160200160208202803883390190505b5090506000805b8b811015612cd65760008d8d83818110612c6057fe5b90506020020135905060008090505b818202811015612ccc57612ca981838f8f87818110612c8a57fe5b905060200201358e8e88818110612c9d57fe5b90506020020135614493565b858581518110612cb557fe5b602090810291909101015260019384019301612c6f565b5050600101612c4a565b50612d2684612ce55733612ce7565b8e5b8f8f858a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061497192505050565b612d615760405162461bcd60e51b8152600401808060200182810382526024815260200180615a706024913960400191505060405180910390fd5b50505b505050505050505050505050565b603a548290612d89906001600160a01b0316612f5c565b15612e5557603a5460408051633185c44d60e21b81523060048201526001600160a01b0384811660248301529151919092169163c6171134916044808301926020929190829003018186803b158015612de157600080fd5b505afa158015612df5573d6000803e3d6000fd5b505050506040513d6020811015612e0b57600080fd5b5051612e55576040805162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015290519081900360640190fd5b61126b848484614afa565b6000807fff00000000000000000000000000000000000000000000000000000000000000831615612ed8576040805162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e20696400000000000000000000000000000000604482015290519081900360640190fd5b6000612ee384614514565b90506000612ef0856144e9565b6000868152600460205260409020549091508015612f38579350837f800000000000000000000000000000000000000000000000000000000000000081046001149350612f54565b612f4d600380858102046003858102046141c4565b9450600093505b505050915091565b60007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470823f8015801590612f905750818114155b949350505050565b6000612fa382613a79565b90506001600160a01b038116613000576040805162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f74206578697374000000000000000000000000604482015290519081900360640190fd5b6001600160a01b03811633148061303a57506001600160a01b038116600090815260056020908152604080832033845290915290205460ff165b8061305457503360009081526001602052604090205460ff165b6130a5576040805162461bcd60e51b815260206004820152601960248201527f6e6f7420617574686f72697a656420746f20617070726f766500000000000000604482015290519081900360640190fd5b6110d9818484614bdb565b6000336001600160a01b038716148015906130da57503360009081526002602052604090205460ff165b90506000336001600160a01b03881614806130f25750815b8061312057506001600160a01b038716600090815260056020908152604080832033845290915290205460ff165b8061313a57503360009081526001602052604090205460ff165b90506001600160a01b038716613197576040805162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f2061646472657373000000000000000000000000604482015290519081900360640190fd5b6001600160a01b0386166131f2576040805162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015290519081900360640190fd5b845160005b8181101561337557600087828151811061320d57fe5b6020026020010151905060008061322383612e60565b915091508b6001600160a01b0316826001600160a01b03161461328d576040805162461bcd60e51b815260206004820152601e60248201527f6e6f74206f776e657220696e2062617463685472616e7366657246726f6d0000604482015290519081900360640190fd5b85806132b757508080156132b757506000838152600660205260409020546001600160a01b031633145b613308576040805162461bcd60e51b815260206004820152600e60248201527f6e6f7420617574686f72697a6564000000000000000000000000000000000000604482015290519081900360640190fd5b8a6001600160a01b03166004600085815260200190815260200160002081905550828b6001600160a01b03168d6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050506001016131f7565b50866001600160a01b0316886001600160a01b0316146133bd576001600160a01b03808916600090815260036020526040808220805485900390559189168152208054820190555b6133cf876001600160a01b0316612f5c565b156115f6576133e5876317a2fd9160e21b6148be565b1561344357613403836133f857336133fa565b885b89898989614971565b61343e5760405162461bcd60e51b8152600401808060200182810382526024815260200180615a706024913960400191505060405180910390fd5b6115f6565b83156115f65760005b818110156134e85761348f846134625733613464565b895b8a8a8a858151811061347257fe5b602002602001015160405180602001604052806000815250614cba565b6134e0576040805162461bcd60e51b815260206004820152601e60248201527f657263373231207472616e736665722072656a656374656420627920746f0000604482015290519081900360640190fd5b60010161344c565b505050505050505050565b6000613500848484614e05565b905061350d84848461502b565b61351f836001600160a01b0316612f5c565b80156135375750613537836317a2fd9160e21b6148be565b1561126b576135648161354a573361354c565b845b85858560405180602001604052806000815250614cba565b61126b576040805162461bcd60e51b815260206004820152601e60248201527f657263373231207472616e736665722072656a656374656420627920746f0000604482015290519081900360640190fd5b60006135c082613a79565b90506001600160a01b03841661361d576040805162461bcd60e51b815260206004820152601660248201527f73656e646572206973207a65726f206164647265737300000000000000000000604482015290519081900360640190fd5b336001600160a01b038516148061364357503360009081526002602052604090205460ff165b8061367157506001600160a01b038416600090815260056020908152604080832033845290915290205460ff165b8061368b57503360009081526001602052604090205460ff165b6136dc576040805162461bcd60e51b815260206004820152601960248201527f6e6f7420617574686f72697a656420746f20617070726f766500000000000000604482015290519081900360640190fd5b836001600160a01b0316816001600160a01b031614613742576040805162461bcd60e51b815260206004820152600f60248201527f6f776e657220213d2073656e6465720000000000000000000000000000000000604482015290519081900360640190fd5b61126b818484614bdb565b613758838383613fd9565b826001141561385f57600061376f60008484614352565b9050600061377c82613a79565b90506001600160a01b0381166137d9576040805162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f74206578697374000000000000000000000000604482015290519081900360640190fd5b866001600160a01b0316816001600160a01b03161461383f576040805162461bcd60e51b815260206004820152601a60248201527f6e6f74206f776e657220696e205f7472616e7366657251756164000000000000604482015290519081900360640190fd5b5060009081526004602052604090206001600160a01b0385169055613893565b613891858560405180606001604052808681526020018581526020018781525060016002888161388b57fe5b0461509b565b505b60005b838402811015611156576138ac81858585614493565b856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4600101613896565b613906856001600160a01b0316612f5c565b801561391e575061391e856317a2fd9160e21b6148be565b156139d5576060848502604051908082528060200260200182016040528015613951578160200160208202803883390190505b50905060005b85860281101561398c5761396d81878787614493565b82828151811061397957fe5b6020908102919091010152600101613957565b5061399a8888888486614971565b6115f65760405162461bcd60e51b8152600401808060200182810382526024815260200180615a706024913960400191505060405180910390fd5b50505050505050565b60006139eb858585614e05565b90506139f885858561502b565b613a0a846001600160a01b0316612f5c565b1561260557613a2881613a1d5733613a1f565b855b86868686614cba565b612605576040805162461bcd60e51b815260206004820152601f60248201527f4552433732313a207472616e736665722072656a656374656420627920746f00604482015290519081900360640190fd5b60007fff00000000000000000000000000000000000000000000000000000000000000821615613af0576040805162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e20696400000000000000000000000000000000604482015290519081900360640190fd5b6000806000613afe856152bd565b925092509250828281613b0d57fe5b0615613b60576040805162461bcd60e51b815260206004820152601e60248201527f7820636f6f7264696e6174653a20496e76616c696420746f6b656e2069640000604482015290519081900360640190fd5b828181613b6957fe5b0615613bbc576040805162461bcd60e51b815260206004820152601e60248201527f7920636f6f7264696e6174653a20496e76616c696420746f6b656e2069640000604482015290519081900360640190fd5b613bc78383836141c4565b95945050505050565b816001600160a01b0316836001600160a01b031614613c36576040805162461bcd60e51b815260206004820152600960248201527f6e6f74206f776e65720000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60008181526004602090815260408083207401000000000000000000000000000000000000000090556001600160a01b0386168084526003909252808320805460001901905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a4505050565b6001600160a01b038216600081815260026020908152604091829020805460ff1916851515908117909155825190815291517fb21eb88b4e33b3f1281830a7178d74d8aa73220416215726b68ae23d539515cb9281900390910190a25050565b6000613d1685614255565b505090506000613d27828686614352565b604080518181526108208101825291925060609190816020015b613d496159c4565b815260200190600190039081613d415790505090506000806003891115613da157613d9b60405180606001604052808a81526020018981526020018b81525084838560028e81613d9557fe5b046153ce565b90925090505b60005b898a02811015613f7a576000613dbc828c8c8c614493565b90506000613df6866040518060600160405280613dd886614514565b8152602001613de6866144e9565b8152602001600181525087615553565b90508015613e3b5760405182906001600160a01b038f169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90600090a4613f70565b6000828152600460205260409020546001600160a01b0316331415613ee5576000828152600660205260409020546001600160a01b031615613ea1576000828152600660205260409020805473ffffffffffffffffffffffffffffffffffffffff191690555b6040516001949094019382906001600160a01b038f169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90600090a4613f70565b60008281526004602052604090205415613f37576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015290519081900360640190fd5b60405182906001600160a01b038f16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45b5050600101613da4565b50613f8b8383838d8d8d8d8d6155fb565b60009384526004602090815260408086206001600160a01b03909c169b8c90559a85526003905289842080549980029990990190985550503381529590952080549490940390935550505050565b8260011480613fe85750826003145b80613ff35750826006145b80613ffe575082600c145b806140095750826018145b61405a576040805162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a650000000000000000000000000000000000000000604482015290519081900360640190fd5b82828161406357fe5b06156140b6576040805162461bcd60e51b815260206004820152601460248201527f496e76616c6964207820636f6f7264696e617465000000000000000000000000604482015290519081900360640190fd5b8281816140bf57fe5b0615614112576040805162461bcd60e51b815260206004820152601460248201527f496e76616c6964207920636f6f7264696e617465000000000000000000000000604482015290519081900360640190fd5b826101980382111561416b576040805162461bcd60e51b815260206004820152600f60248201527f78206f7574206f6620626f756e64730000000000000000000000000000000000604482015290519081900360640190fd5b82610198038111156110d9576040805162461bcd60e51b815260206004820152600f60248201527f79206f7574206f6620626f756e64730000000000000000000000000000000000604482015290519081900360640190fd5b60008060006141d286614255565b50915091506000600460006141fe858a8b8b816141eb57fe5b04028b8c8b816141f757fe5b0402614352565b815260208101919091526040016000205490506001600160a01b0381161561422a5792506119cc915050565b60188710156142485761423e8287876141c4565b93505050506119cc565b5060009695505050505050565b6000806000836001141561427057600092506003915061434b565b836003141561428957600160f81b92506006915061434b565b83600614156142a85750600160f91b9150600c9050600160f81b61434b565b83600c14156142c75750600360f81b915060189050600160f91b61434b565b83601814156142fe57507f04000000000000000000000000000000000000000000000000000000000000009150600360f81b61434b565b6040805162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a650000000000000000000000000000000000000000604482015290519081900360640190fd5b9193909250565b6101980291010190565b600061436782614255565b505090508185116143e95760046000614390838586898161438457fe5b0402868789816141f757fe5b8152602001908152602001600020546000146143e4576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015290519081900360640190fd5b614479565b838501838601855b8281101561447557855b8281101561446d5760046000614412878585614352565b815260200190815260200160002054600014614466576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015290519081900360640190fd5b85016143fb565b5084016143f1565b5050505b60028204915060038210612605576126058585858561435c565b60008084868161449f57fe5b049050600281066144cb576144c360008688816144b857fe5b068601838601614352565b915050612f90565b6144c360008688816144d957fe5b0660010187870103838601614352565b6101987effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff919091160490565b6101987effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff919091160690565b611f78338383615861565b603a5461455f906001600160a01b0316612f5c565b1561478457603a54604080517fc3c5a54700000000000000000000000000000000000000000000000000000000815230600482015290516001600160a01b039092169163c3c5a547916024808201926020929091908290030181600087803b1580156145ca57600080fd5b505af11580156145de573d6000803e3d6000fd5b505050506040513d60208110156145f457600080fd5b505161478457801561468a57603a54604080517f7d3e3dbe0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03858116602483015291519190921691637d3e3dbe91604480830192600092919082900301818387803b15801561466d57600080fd5b505af1158015614681573d6000803e3d6000fd5b50505050614784565b6001600160a01b0382161561470657603a54604080517fa0af29030000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0385811660248301529151919092169163a0af290391604480830192600092919082900301818387803b15801561466d57600080fd5b603a54604080517f4420e48600000000000000000000000000000000000000000000000000000000815230600482015290516001600160a01b0390921691634420e4869160248082019260009290919082900301818387803b15801561476b57600080fd5b505af115801561477f573d6000803e3d6000fd5b505050505b60408051821515815290516001600160a01b038416917f3c7a9c847c035e45b84027e44ad55724873d5921b3a6abb8c0926b415d9241b1919081900360200190a25050565b60608161480a575060408051808201909152600181527f30000000000000000000000000000000000000000000000000000000000000006020820152610f11565b8160005b811561482257600101600a8204915061480e565b6060816040519080825280601f01601f19166020018201604052801561484f576020820181803883390190505b50905060001982015b85156148b557600a860660300160f81b8282806001900393508151811061487b57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a86049550614858565b50949350505050565b604080516001600160e01b031983166024808301919091528251808303909101815260449091018252602081810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001781528251935160008082529485948594909392908183858c612710fa955080519450505050609e5a1161495d57fe5b8280156149675750815b9695505050505050565b600080846001600160a01b0316634b808c46888887876040518563ffffffff1660e01b815260040180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b031681526020018060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015614a0a5781810151838201526020016149f2565b50505050905001838103825284818151815260200191508051906020019080838360005b83811015614a46578181015183820152602001614a2e565b50505050905090810190601f168015614a735780820380516001836020036101000a031916815260200191505b509650505050505050602060405180830381600087803b158015614a9657600080fd5b505af1158015614aaa573d6000803e3d6000fd5b505050506040513d6020811015614ac057600080fd5b50516001600160e01b0319167f4b808c46000000000000000000000000000000000000000000000000000000001491505095945050505050565b6001600160a01b038316614b55576040805162461bcd60e51b815260206004820152601660248201527f496e76616c69642073656e646572206164647265737300000000000000000000604482015290519081900360640190fd5b336001600160a01b0384161480614b7b57503360009081526002602052604090205460ff165b80614b9557503360009081526001602052604090205460ff165b614bd05760405162461bcd60e51b8152600401808060200182810382526021815260200180615bcb6021913960400191505060405180910390fd5b6110d9838383615861565b6001600160a01b038216614c085760008181526004602052604090206001600160a01b0384169055614c74565b60008181526004602090815260408083206001600160a01b038781167f8000000000000000000000000000000000000000000000000000000000000000019091556006909252909120805473ffffffffffffffffffffffffffffffffffffffff19169184169190911790555b80826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b600080846001600160a01b031663150b7a02888887876040518563ffffffff1660e01b815260040180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015614d52578181015183820152602001614d3a565b50505050905090810190601f168015614d7f5780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015614da157600080fd5b505af1158015614db5573d6000803e3d6000fd5b505050506040513d6020811015614dcb57600080fd5b50516001600160e01b0319167f150b7a02000000000000000000000000000000000000000000000000000000001491505095945050505050565b6000806000614e1384612e60565b90925090506001600160a01b038216614e73576040805162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f74206578697374000000000000000000000000604482015290519081900360640190fd5b856001600160a01b0316826001600160a01b031614614ed9576040805162461bcd60e51b815260206004820152601b60248201527f6e6f74206f776e657220696e205f636865636b5472616e736665720000000000604482015290519081900360640190fd5b6001600160a01b038516614f34576040805162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015290519081900360640190fd5b336001600160a01b03871614615022573360009081526002602052604090205460ff1615614f67576001925050506119cc565b6001600160a01b038616600090815260056020908152604080832033845290915290205460ff1680614fb75750808015614fb757506000848152600660205260409020546001600160a01b031633145b80614fd157503360009081526001602052604090205460ff165b615022576040805162461bcd60e51b815260206004820152601860248201527f6e6f7420617070726f76656420746f207472616e736665720000000000000000604482015290519081900360640190fd5b50509392505050565b6001600160a01b03808416600081815260036020908152604080832080546000190190559386168083528483208054600101905585835260049091528382208190559251849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60008060006150ad8660400151614255565b925050915060006150c78388600001518960200151614352565b87519091506001905b60408901518951018110156152175760208901515b89604001518a602001510181101561520f5760008060038a1015615128576151188e61511360008787614352565b615927565b80156151215750845b90506151f0565b6151548e8e60405180606001604052808881526020018781526020018e815250600060028f8161388b57fe5b90506000615163888686614352565b6000818152600460205260409020549350905082156151ee57816151de578e6001600160a01b031683146151de576040805162461bcd60e51b815260206004820152601760248201527f6e6f74206f776e6572206f66206368696c642051756164000000000000000000604482015290519081900360640190fd5b6000818152600460205260408120555b505b80806151fb57508115155b80156152045750845b9450505087016150e5565b5086016150d0565b5086156152b0578061528957896001600160a01b031661524489604001518a600001518b602001516141c4565b6001600160a01b0316146152895760405162461bcd60e51b815260040180806020018281038252602b815260200180615c16602b913960400191505060405180910390fd5b5060009081526004602052604090206001600160a01b03881690555060019150613bc79050565b9998505050505050505050565b60008060006152cb84614514565b91506152d6846144e9565b90507fff0000000000000000000000000000000000000000000000000000000000000084168061530957600193506153c6565b600160f81b81141561531e57600393506153c6565b600160f91b81141561533357600693506153c6565b600360f81b81141561534857600c93506153c6565b7f040000000000000000000000000000000000000000000000000000000000000081141561537957601893506153c6565b6040805162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e20696400000000000000000000000000000000604482015290519081900360640190fd5b509193909250565b60008060006153dc84614255565b50506040890151895160208b015192935080820192909101905b828110156155225760208b01515b8281101561551a5760006154338c60405180606001604052808681526020018581526020018c8152508c615553565b905080615512576000615447878585614352565b6000818152600460205260409020549091506001600160a01b0381163314156154c25760405180606001604052808681526020018581526020018c8152508e8d8151811061549157fe5b6020908102919091018101919091526000838152600490915260408120558a80029c909c019b6001909b019a61550f565b6001600160a01b0381161561550f576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015290519081900360640190fd5b50505b508701615404565b5086016153f6565b50600286049550600386106155435761553e8a8a8a8a8a6153ce565b985096505b5094989597509495505050505050565b6000805b828110156155f0576155676159c4565b85828151811061557357fe5b602002602001015190508460400151816040015111801561559657508051855110155b80156155aa57506040810151815186519101115b80156155be57508060200151856020015110155b80156155d7575080604001518160200151018560200151105b156155e7576001925050506119cc565b50600101615557565b506000949350505050565b61560d856001600160a01b0316612f5c565b80156156255750615625856317a2fd9160e21b6148be565b1561580b57606086604051908082528060200260200182016040528015615656578160200160208202803883390190505b50905060006060888788020360405190808252806020026020018201604052801561568b578160200160208202803883390190505b5090506000805b8889028110156157705760006156aa828b8b8b614493565b90506156e28e60405180606001604052806156c485614514565b81526020016156d2856144e9565b815260200160018152508f615553565b1561570a57808686815181106156f457fe5b6020908102919091010152600190940193615767565b6000818152600460205260409020546001600160a01b031633141561574857600081815260046020526040812055855181908790879081106156f457fe5b8084848151811061575557fe5b60209081029190910101526001909201915b50600101615692565b5061577f3360008b8589614971565b6157ba5760405162461bcd60e51b8152600401808060200182810382526024815260200180615a706024913960400191505060405180910390fd5b6157c733338b8789614971565b6158025760405162461bcd60e51b8152600401808060200182810382526024815260200180615a706024913960400191505060405180910390fd5b505050506115f6565b60005b8485028110156134e857600061582682878787614493565b6000818152600460205260409020549091506001600160a01b0316331415615858576000818152600460205260408120555b5060010161580e565b6001600160a01b03821660009081526001602052604090205460ff16156158b95760405162461bcd60e51b8152600401808060200182810382526036815260200180615b176036913960400191505060405180910390fd5b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff1916861515908117909155825190815291517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319281900390910190a3505050565b60008181526004602052604081205480156159ba57836001600160a01b0316816001600160a01b0316146159a2576040805162461bcd60e51b815260206004820152600960248201527f6e6f74206f776e65720000000000000000000000000000000000000000000000604482015290519081900360640190fd5b50506000818152600460205260408120556001612961565b5060009392505050565b6040518060600160405280600081526020016000815260200160008152509056fe45524337323142617365546f6b656e3a20436f6e747261637420616c726561647920696e697469616c697a6564616464726573732030206973206e6f7420616c6c6f776564206173207375706572206f70657261746f72746865207374617475732073686f756c6420626520646966666572656e74207468616e207468652063757272656e74206f6e65657263373231206261746368207472616e736665722072656a656374656420627920746f616464726573732030206973206e6f7420616c6c6f776564206173206d696e7465726f6e6c7920636f6e7472616374732063616e206265206d657461207472616e73616374696f6e2070726f636573736f724c616e6442617365546f6b656e56333a2078277320616e6420792773206c656e6774682061726520646966666572656e747375706572206f70657261746f722063616e2774206861766520746865697220617070726f76616c466f72416c6c206368616e6765644c616e6442617365546f6b656e56333a2073697a6573277320616e6420782773206c656e6774682061726520646966666572656e746e6f7420617574686f72697a656420746f207472616e736665724d756c7469517561647369742063616e206265206f6e6c79206368616e67656420746f2061206e65772061646d696e6e6f7420617574686f72697a656420746f20617070726f766520666f7220616c6c4c616e6456333a20737562736372697074696f6e2063616e2774206265207a65726f20616464726573736e6f74206f776e6572206f6620616c6c20737562207175616473206e6f7220706172656e74207175616473a265627a7a7230582035c25998d9f59a036b0e292bbb5b9d7acce392cc82912042d6b9870fa500b5a864736f6c63430005090032", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102f45760003560e01c80638782676411610191578063ab01b469116100e3578063c87b56dd11610097578063e985e9c511610071578063e985e9c514610c92578063eaa5e06714610cc0578063eeb5a5d114610e3f576102f4565b8063c87b56dd14610c21578063cf456ae714610c3e578063dc5074af14610c6c576102f4565b8063b0ccc31e116100c8578063b0ccc31e14610b36578063b88d4fde14610b3e578063b9b710e914610c04576102f4565b8063ab01b46914610ada578063ac9fe42114610b08576102f4565b8063992924a6116101455780639ededf771161011f5780639ededf7714610418578063a22cb46514610a86578063aa271e1a14610ab4576102f4565b8063992924a614610a155780639d28fb8614610a325780639d786bbc14610a58576102f4565b80638e5cb5f6116101765780638e5cb5f6146109ca5780638f283970146109e757806395d89b4114610a0d576102f4565b806387826764146109765780638a04af6a1461099c576102f4565b806342966c681161024a578063654b748a116101fe57806370a08231116101d857806370a082311461090757806379cc67901461092d578063845a469714610959576102f4565b8063654b748a146108485780636e1e3bbf1461086e5780636e9960c3146108ff576102f4565b80634e6a0f441161022f5780634e6a0f441461077157806355064d85146108025780636352211e1461082b576102f4565b806342966c6814610726578063485cc95514610743576102f4565b806315ddc535116102ac5780632b991746116102865780632b9917461461061e57806338bb305a1461065457806342842e0e146106f0576102f4565b806315ddc5351461043257806323b872dd1461050d57806328cfbd4614610543576102f4565b8063081812fc116102dd578063081812fc146103b1578063095ea7b3146103ea5780630ef2674314610418576102f4565b806301ffc9a7146102f957806306fdde0314610334575b600080fd5b6103206004803603602081101561030f57600080fd5b50356001600160e01b031916610e77565b604080519115158252519081900360200190f35b61033c610f16565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561037657818101518382015260200161035e565b50505050905090810190601f1680156103a35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103ce600480360360208110156103c757600080fd5b5035610f4d565b604080516001600160a01b039092168252519081900360200190f35b6104166004803603604081101561040057600080fd5b506001600160a01b038135169060200135610fec565b005b6104206110de565b60408051918252519081900360200190f35b6104166004803603608081101561044857600080fd5b6001600160a01b03823581169260208101359091169181019060608101604082013564010000000081111561047c57600080fd5b82018360208201111561048e57600080fd5b803590602001918460208302840111640100000000831117156104b057600080fd5b9193909290916020810190356401000000008111156104ce57600080fd5b8201836020820111156104e057600080fd5b8035906020019184600183028401116401000000008311171561050257600080fd5b5090925090506110e4565b6104166004803603606081101561052357600080fd5b506001600160a01b0381358116916020810135909116906040013561115e565b6104166004803603608081101561055957600080fd5b6001600160a01b03823581169260208101359091169181019060608101604082013564010000000081111561058d57600080fd5b82018360208201111561059f57600080fd5b803590602001918460208302840111640100000000831117156105c157600080fd5b9193909290916020810190356401000000008111156105df57600080fd5b8201836020820111156105f157600080fd5b8035906020019184600183028401116401000000008311171561061357600080fd5b509092509050611271565b6104166004803603606081101561063457600080fd5b506001600160a01b038135811691602081013590911690604001356112e6565b610416600480360360c081101561066a57600080fd5b6001600160a01b0382358116926020810135909116916040820135916060810135916080820135919081019060c0810160a08201356401000000008111156106b157600080fd5b8201836020820111156106c357600080fd5b803590602001918460018302840111640100000000831117156106e557600080fd5b5090925090506113d4565b6104166004803603606081101561070657600080fd5b506001600160a01b03813581169160208101359091169060400135611600565b6104166004803603602081101561073c57600080fd5b5035611728565b6104166004803603604081101561075957600080fd5b506001600160a01b038135811691602001351661173e565b610416600480360360a081101561078757600080fd5b6001600160a01b038235169160208101359160408201359160608101359181019060a0810160808201356401000000008111156107c357600080fd5b8201836020820111156107d557600080fd5b803590602001918460018302840111640100000000831117156107f757600080fd5b50909250905061180b565b6103206004803603606081101561081857600080fd5b50803590602081013590604001356119a4565b6103ce6004803603602081101561084157600080fd5b50356119d3565b6103206004803603602081101561085e57600080fd5b50356001600160a01b0316611a3b565b610416600480360360a081101561088457600080fd5b6001600160a01b038235169160208101359160408201359160608101359181019060a0810160808201356401000000008111156108c057600080fd5b8201836020820111156108d257600080fd5b803590602001918460018302840111640100000000831117156108f457600080fd5b509092509050611a59565b6103ce611cbe565b6104206004803603602081101561091d57600080fd5b50356001600160a01b0316611ccd565b6104166004803603604081101561094357600080fd5b506001600160a01b038135169060200135611d46565b6104206004803603602081101561096f57600080fd5b5035611ea5565b6104206004803603602081101561098c57600080fd5b50356001600160a01b0316611eb0565b610416600480360360408110156109b257600080fd5b506001600160a01b0381351690602001351515611ec2565b610420600480360360208110156109e057600080fd5b5035611f7c565b610416600480360360208110156109fd57600080fd5b50356001600160a01b0316611f87565b61033c6120ad565b61042060048036036020811015610a2b57600080fd5b50356120e4565b61041660048036036020811015610a4857600080fd5b50356001600160a01b03166120f6565b61032060048036036040811015610a6e57600080fd5b506001600160a01b03813581169160200135166121ac565b61041660048036036040811015610a9c57600080fd5b506001600160a01b03813516906020013515156121cc565b61032060048036036020811015610aca57600080fd5b50356001600160a01b03166122b9565b61041660048036036040811015610af057600080fd5b506001600160a01b03813516906020013515156122d7565b61041660048036036040811015610b1e57600080fd5b506001600160a01b0381351690602001351515612385565b6103ce6124e7565b61041660048036036080811015610b5457600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135640100000000811115610b8f57600080fd5b820183602082011115610ba157600080fd5b80359060200191846001830284011164010000000083111715610bc357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506124f6945050505050565b6103ce60048036036020811015610c1a57600080fd5b503561260c565b61033c60048036036020811015610c3757600080fd5b5035612627565b61041660048036036040811015610c5457600080fd5b506001600160a01b0381351690602001351515612790565b61032060048036036020811015610c8257600080fd5b50356001600160a01b03166128f2565b61032060048036036040811015610ca857600080fd5b506001600160a01b0381358116916020013516612910565b610416600480360360c0811015610cd657600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135640100000000811115610d0a57600080fd5b820183602082011115610d1c57600080fd5b80359060200191846020830284011164010000000083111715610d3e57600080fd5b919390929091602081019035640100000000811115610d5c57600080fd5b820183602082011115610d6e57600080fd5b80359060200191846020830284011164010000000083111715610d9057600080fd5b919390929091602081019035640100000000811115610dae57600080fd5b820183602082011115610dc057600080fd5b80359060200191846020830284011164010000000083111715610de257600080fd5b919390929091602081019035640100000000811115610e0057600080fd5b820183602082011115610e1257600080fd5b80359060200191846001830284011164010000000083111715610e3457600080fd5b509092509050612967565b61041660048036036060811015610e5557600080fd5b506001600160a01b038135811691602081013590911690604001351515612d72565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161480610eda57507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b80610f0e57507f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b90505b919050565b60408051808201909152600f81527f53616e64626f782773204c414e44730000000000000000000000000000000000602082015290565b6000806000610f5b84612e60565b90925090506001600160a01b038216610fbb576040805162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f74206578697374000000000000000000000000604482015290519081900360640190fd5b8015610fe1575050506000818152600660205260409020546001600160a01b0316610f11565b600092505050610f11565b603a548290611003906001600160a01b0316612f5c565b156110cf57603a5460408051633185c44d60e21b81523060048201526001600160a01b0384811660248301529151919092169163c6171134916044808301926020929190829003018186803b15801561105b57600080fd5b505afa15801561106f573d6000803e3d6000fd5b505050506040513d602081101561108557600080fd5b50516110cf576040805162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015290519081900360640190fd5b6110d98383612f98565b505050565b61019890565b611156868686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8a018190048102820181019092528881529250889150879081908401838280828437600092018290525092506130b0915050565b505050505050565b603a548390611175906001600160a01b0316612f5c565b15611260576001600160a01b03811633141561119b576111968484846134f3565b61126b565b603a5460408051633185c44d60e21b815230600482015233602482015290516001600160a01b039092169163c617113491604480820192602092909190829003018186803b1580156111ec57600080fd5b505afa158015611200573d6000803e3d6000fd5b505050506040513d602081101561121657600080fd5b5051611260576040805162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015290519081900360640190fd5b61126b8484846134f3565b50505050565b611156868686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8a018190048102820181019092528881529250889150879081908401838280828437600092019190915250600192506130b0915050565b603a5482906112fd906001600160a01b0316612f5c565b156113c957603a5460408051633185c44d60e21b81523060048201526001600160a01b0384811660248301529151919092169163c6171134916044808301926020929190829003018186803b15801561135557600080fd5b505afa158015611369573d6000803e3d6000fd5b505050506040513d602081101561137f57600080fd5b50516113c9576040805162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015290519081900360640190fd5b61126b8484846135b5565b6001600160a01b03871661142f576040805162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f2061646472657373000000000000000000000000604482015290519081900360640190fd5b6001600160a01b03861661148a576040805162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015290519081900360640190fd5b6000336001600160a01b038916148015906114b457503360009081526002602052604090205460ff165b9050336001600160a01b038916148015906114cd575080155b15611564576001600160a01b038816600090815260056020908152604080832033845290915290205460ff168061151357503360009081526001602052604090205460ff165b611564576040805162461bcd60e51b815260206004820152601e60248201527f6e6f7420617574686f72697a656420746f207472616e73666572517561640000604482015290519081900360640190fd5b611571888888888861374d565b6001600160a01b0380891660009081526003602052604080822080548a800290819003909155928a1682529020805490910190556115f6816115b357336115b5565b885b898989898989898080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506138f492505050565b5050505050505050565b603a548390611617906001600160a01b0316612f5c565b1561170d576001600160a01b03811633141561164857611196848484604051806020016040528060008152506139de565b603a5460408051633185c44d60e21b815230600482015233602482015290516001600160a01b039092169163c617113491604480820192602092909190829003018186803b15801561169957600080fd5b505afa1580156116ad573d6000803e3d6000fd5b505050506040513d60208110156116c357600080fd5b505161170d576040805162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015290519081900360640190fd5b61126b848484604051806020016040528060008152506139de565b61173b3361173583613a79565b83613bd0565b50565b60075460ff16156117805760405162461bcd60e51b815260040180806020018281038252602d8152602001806159e6602d913960400191505060405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383161790556117b3826001613cab565b6007805460ff1916600117905560008054604080519283526001600160a01b03909116602083015280517f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f9281900390910190a15050565b6001600160a01b038616611866576040805162461bcd60e51b815260206004820152601260248201527f746f206973207a65726f20616464726573730000000000000000000000000000604482015290519081900360640190fd5b61186f336122b9565b6118c0576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792061206d696e7465722063616e206d696e7400000000000000000000604482015290519081900360640190fd5b6118cb8585856119a4565b151560011415611961576118e2338787878761374d565b33600081815260036020908152604080832080548a8002908190039091556001600160a01b038b1684529281902080549093019092558151601f850182900482028101820190925283825261195c929182918a918a918a918a918a908a90819084018382808284376000920191909152506138f492505050565b611156565b6111568686868686868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613d0b92505050565b60006119b1848484613fd9565b60006119be8585856141c4565b6001600160a01b0316141590505b9392505050565b60006119de82613a79565b90506001600160a01b038116610f11576040805162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f74206578697374000000000000000000000000604482015290519081900360640190fd5b6001600160a01b031660009081526001602052604090205460ff1690565b6001600160a01b038616611ab4576040805162461bcd60e51b815260206004820152601260248201527f746f206973207a65726f20616464726573730000000000000000000000000000604482015290519081900360640190fd5b84611b06576040805162461bcd60e51b815260206004820152601360248201527f73697a652063616e6e6f74206265207a65726f00000000000000000000000000604482015290519081900360640190fd5b611b0f336122b9565b611b60576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792061206d696e7465722063616e206d696e7400000000000000000000604482015290519081900360640190fd5b611b6b858585613fd9565b6000611b7686614255565b505090506000611b87828787614352565b9050611b96878787601861435c565b60005b878802811015611c47576000611bb1828a8a8a614493565b60008181526004602052604090205490915015611c06576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015290519081900360640190fd5b60405181906001600160a01b038c16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a450600101611b99565b5060008181526004602090815260408083206001600160a01b038c169081905583526003825280832080548b80020190558051601f87018390048302810183019091528581526115f692339290918c918c918c918c91908c908c90819084018382808284376000920191909152506138f492505050565b6000546001600160a01b031690565b60006001600160a01b038216611d2a576040805162461bcd60e51b815260206004820152601560248201527f6f776e6572206973207a65726f20616464726573730000000000000000000000604482015290519081900360640190fd5b506001600160a01b031660009081526003602052604090205490565b6001600160a01b038216611da1576040805162461bcd60e51b815260206004820152601660248201527f496e76616c69642073656e646572206164647265737300000000000000000000604482015290519081900360640190fd5b600080611dad83612e60565b9092509050336001600160a01b0385161480611dd857503360009081526002602052604090205460ff165b80611e015750808015611e0157506000838152600660205260409020546001600160a01b031633145b80611e2f57506001600160a01b038416600090815260056020908152604080832033845290915290205460ff165b80611e4957503360009081526001602052604090205460ff165b611e9a576040805162461bcd60e51b815260206004820152601660248201527f6e6f7420617574686f72697a656420746f206275726e00000000000000000000604482015290519081900360640190fd5b61126b848385613bd0565b6000610f0e826144e9565b60036020526000908152604090205481565b6000546001600160a01b03163314611f21576040805162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e20616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b611f33826001600160a01b0316612f5c565b611f6e5760405162461bcd60e51b8152600401808060200182810382526030815260200180615ab66030913960400191505060405180910390fd5b611f788282613cab565b5050565b6000610f0e82614514565b6000546001600160a01b0316338114611fe7576040805162461bcd60e51b815260206004820152601b60248201527f6f6e6c792061646d696e2063616e206368616e67652061646d696e0000000000604482015290519081900360640190fd5b806001600160a01b0316826001600160a01b031614156120385760405162461bcd60e51b8152600401808060200182810382526025815260200180615ba66025913960400191505060405180910390fd5b604080516001600160a01b0380841682528416602082015281517f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f929181900390910190a1506000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60408051808201909152600481527f4c414e4400000000000000000000000000000000000000000000000000000000602082015290565b60046020526000908152604090205481565b6000546001600160a01b03163314612155576040805162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e20616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b603a805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517fc6df119c56c99171b170652a3c4750ba46dcaacbdb3b7ab4847a9fa339659bd490600090a250565b600560209081526000928352604080842090915290825290205460ff1681565b603a5482906121e3906001600160a01b0316612f5c565b156122af57603a5460408051633185c44d60e21b81523060048201526001600160a01b0384811660248301529151919092169163c6171134916044808301926020929190829003018186803b15801561223b57600080fd5b505afa15801561224f573d6000803e3d6000fd5b505050506040513d602081101561226557600080fd5b50516122af576040805162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015290519081900360640190fd5b6110d9838361453f565b6001600160a01b031660009081526039602052604090205460ff1690565b6000546001600160a01b03163314612336576040805162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e20616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b6001600160a01b03821661237b5760405162461bcd60e51b815260040180806020018281038252602a815260200180615bec602a913960400191505060405180910390fd5b611f78828261454a565b6000546001600160a01b031633146123e4576040805162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e20616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b6001600160a01b0382166124295760405162461bcd60e51b815260040180806020018281038252602a815260200180615a13602a913960400191505060405180910390fd5b6001600160a01b03821660009081526001602052604090205460ff16151581151514156124875760405162461bcd60e51b8152600401808060200182810382526033815260200180615a3d6033913960400191505060405180910390fd5b6001600160a01b038216600081815260016020908152604091829020805460ff1916851515908117909155825190815291517f44f92d27abdf4cfb6a7d712c3af68f3be086d4ca747ab802c36f67d6790060d89281900390910190a25050565b603a546001600160a01b031681565b603a54849061250d906001600160a01b0316612f5c565b156125f9576001600160a01b0381163314156125345761252f858585856139de565b612605565b603a5460408051633185c44d60e21b815230600482015233602482015290516001600160a01b039092169163c617113491604480820192602092909190829003018186803b15801561258557600080fd5b505afa158015612599573d6000803e3d6000fd5b505050506040513d60208110156125af57600080fd5b50516125f9576040805162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015290519081900360640190fd5b612605858585856139de565b5050505050565b6006602052600090815260409020546001600160a01b031681565b6060600061263483613a79565b6001600160a01b03161415612690576040805162461bcd60e51b815260206004820152601960248201527f4c616e6456333a20496420646f6573206e6f7420657869737400000000000000604482015290519081900360640190fd5b612699826147c9565b60405160200180807f68747470733a2f2f6170692e73616e64626f782e67616d652f6c616e64732f00815250601f0182805190602001908083835b6020831061271157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016126d4565b5181516020939093036101000a60001901801990911692169190911790527f2f6d657461646174612e6a736f6e000000000000000000000000000000000000920191825250604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee018152600e9092019052949350505050565b6000546001600160a01b031633146127ef576040805162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e20616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b6001600160a01b0382166128345760405162461bcd60e51b8152600401808060200182810382526022815260200180615a946022913960400191505060405180910390fd5b6001600160a01b03821660009081526039602052604090205460ff16151581151514156128925760405162461bcd60e51b8152600401808060200182810382526033815260200180615a3d6033913960400191505060405180910390fd5b6001600160a01b038216600081815260396020908152604091829020805460ff1916851515908117909155825190815291517fff452b3b9159b024a9098f0058c63eccd90d36b3584608202800d662f962bb609281900390910190a25050565b6001600160a01b031660009081526002602052604090205460ff1690565b6001600160a01b03808316600090815260056020908152604080832093851683529290529081205460ff168061295e57506001600160a01b03821660009081526001602052604090205460ff165b90505b92915050565b6001600160a01b038a166129c2576040805162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f2061646472657373000000000000000000000000604482015290519081900360640190fd5b6001600160a01b038916612a1d576040805162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015290519081900360640190fd5b868514612a5b5760405162461bcd60e51b8152600401808060200182810382526035815260200180615b4d6035913960400191505060405180910390fd5b848314612a995760405162461bcd60e51b8152600401808060200182810382526031815260200180615ae66031913960400191505060405180910390fd5b6000336001600160a01b038c1614801590612ac357503360009081526002602052604090205460ff165b9050336001600160a01b038c1614801590612adc575080155b15612b5d576001600160a01b038b16600090815260056020908152604080832033845290915290205460ff1680612b2257503360009081526001602052604090205460ff165b612b5d5760405162461bcd60e51b8152600401808060200182810382526024815260200180615b826024913960400191505060405180910390fd5b6000805b89811015612bc05760008b8b83818110612b7757fe5b905060200201359050612bb18e8e838d8d87818110612b9257fe5b905060200201358c8c88818110612ba557fe5b9050602002013561374d565b80029190910190600101612b61565b506001600160a01b03808d1660009081526003602052604080822080548590039055918d16808252919020805483019055612bfa90612f5c565b8015612c125750612c128b6317a2fd9160e21b6148be565b15612d6457606081604051908082528060200260200182016040528015612c43578160200160208202803883390190505b5090506000805b8b811015612cd65760008d8d83818110612c6057fe5b90506020020135905060008090505b818202811015612ccc57612ca981838f8f87818110612c8a57fe5b905060200201358e8e88818110612c9d57fe5b90506020020135614493565b858581518110612cb557fe5b602090810291909101015260019384019301612c6f565b5050600101612c4a565b50612d2684612ce55733612ce7565b8e5b8f8f858a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061497192505050565b612d615760405162461bcd60e51b8152600401808060200182810382526024815260200180615a706024913960400191505060405180910390fd5b50505b505050505050505050505050565b603a548290612d89906001600160a01b0316612f5c565b15612e5557603a5460408051633185c44d60e21b81523060048201526001600160a01b0384811660248301529151919092169163c6171134916044808301926020929190829003018186803b158015612de157600080fd5b505afa158015612df5573d6000803e3d6000fd5b505050506040513d6020811015612e0b57600080fd5b5051612e55576040805162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015290519081900360640190fd5b61126b848484614afa565b6000807fff00000000000000000000000000000000000000000000000000000000000000831615612ed8576040805162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e20696400000000000000000000000000000000604482015290519081900360640190fd5b6000612ee384614514565b90506000612ef0856144e9565b6000868152600460205260409020549091508015612f38579350837f800000000000000000000000000000000000000000000000000000000000000081046001149350612f54565b612f4d600380858102046003858102046141c4565b9450600093505b505050915091565b60007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470823f8015801590612f905750818114155b949350505050565b6000612fa382613a79565b90506001600160a01b038116613000576040805162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f74206578697374000000000000000000000000604482015290519081900360640190fd5b6001600160a01b03811633148061303a57506001600160a01b038116600090815260056020908152604080832033845290915290205460ff165b8061305457503360009081526001602052604090205460ff165b6130a5576040805162461bcd60e51b815260206004820152601960248201527f6e6f7420617574686f72697a656420746f20617070726f766500000000000000604482015290519081900360640190fd5b6110d9818484614bdb565b6000336001600160a01b038716148015906130da57503360009081526002602052604090205460ff165b90506000336001600160a01b03881614806130f25750815b8061312057506001600160a01b038716600090815260056020908152604080832033845290915290205460ff165b8061313a57503360009081526001602052604090205460ff165b90506001600160a01b038716613197576040805162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f2061646472657373000000000000000000000000604482015290519081900360640190fd5b6001600160a01b0386166131f2576040805162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015290519081900360640190fd5b845160005b8181101561337557600087828151811061320d57fe5b6020026020010151905060008061322383612e60565b915091508b6001600160a01b0316826001600160a01b03161461328d576040805162461bcd60e51b815260206004820152601e60248201527f6e6f74206f776e657220696e2062617463685472616e7366657246726f6d0000604482015290519081900360640190fd5b85806132b757508080156132b757506000838152600660205260409020546001600160a01b031633145b613308576040805162461bcd60e51b815260206004820152600e60248201527f6e6f7420617574686f72697a6564000000000000000000000000000000000000604482015290519081900360640190fd5b8a6001600160a01b03166004600085815260200190815260200160002081905550828b6001600160a01b03168d6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050506001016131f7565b50866001600160a01b0316886001600160a01b0316146133bd576001600160a01b03808916600090815260036020526040808220805485900390559189168152208054820190555b6133cf876001600160a01b0316612f5c565b156115f6576133e5876317a2fd9160e21b6148be565b1561344357613403836133f857336133fa565b885b89898989614971565b61343e5760405162461bcd60e51b8152600401808060200182810382526024815260200180615a706024913960400191505060405180910390fd5b6115f6565b83156115f65760005b818110156134e85761348f846134625733613464565b895b8a8a8a858151811061347257fe5b602002602001015160405180602001604052806000815250614cba565b6134e0576040805162461bcd60e51b815260206004820152601e60248201527f657263373231207472616e736665722072656a656374656420627920746f0000604482015290519081900360640190fd5b60010161344c565b505050505050505050565b6000613500848484614e05565b905061350d84848461502b565b61351f836001600160a01b0316612f5c565b80156135375750613537836317a2fd9160e21b6148be565b1561126b576135648161354a573361354c565b845b85858560405180602001604052806000815250614cba565b61126b576040805162461bcd60e51b815260206004820152601e60248201527f657263373231207472616e736665722072656a656374656420627920746f0000604482015290519081900360640190fd5b60006135c082613a79565b90506001600160a01b03841661361d576040805162461bcd60e51b815260206004820152601660248201527f73656e646572206973207a65726f206164647265737300000000000000000000604482015290519081900360640190fd5b336001600160a01b038516148061364357503360009081526002602052604090205460ff165b8061367157506001600160a01b038416600090815260056020908152604080832033845290915290205460ff165b8061368b57503360009081526001602052604090205460ff165b6136dc576040805162461bcd60e51b815260206004820152601960248201527f6e6f7420617574686f72697a656420746f20617070726f766500000000000000604482015290519081900360640190fd5b836001600160a01b0316816001600160a01b031614613742576040805162461bcd60e51b815260206004820152600f60248201527f6f776e657220213d2073656e6465720000000000000000000000000000000000604482015290519081900360640190fd5b61126b818484614bdb565b613758838383613fd9565b826001141561385f57600061376f60008484614352565b9050600061377c82613a79565b90506001600160a01b0381166137d9576040805162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f74206578697374000000000000000000000000604482015290519081900360640190fd5b866001600160a01b0316816001600160a01b03161461383f576040805162461bcd60e51b815260206004820152601a60248201527f6e6f74206f776e657220696e205f7472616e7366657251756164000000000000604482015290519081900360640190fd5b5060009081526004602052604090206001600160a01b0385169055613893565b613891858560405180606001604052808681526020018581526020018781525060016002888161388b57fe5b0461509b565b505b60005b838402811015611156576138ac81858585614493565b856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4600101613896565b613906856001600160a01b0316612f5c565b801561391e575061391e856317a2fd9160e21b6148be565b156139d5576060848502604051908082528060200260200182016040528015613951578160200160208202803883390190505b50905060005b85860281101561398c5761396d81878787614493565b82828151811061397957fe5b6020908102919091010152600101613957565b5061399a8888888486614971565b6115f65760405162461bcd60e51b8152600401808060200182810382526024815260200180615a706024913960400191505060405180910390fd5b50505050505050565b60006139eb858585614e05565b90506139f885858561502b565b613a0a846001600160a01b0316612f5c565b1561260557613a2881613a1d5733613a1f565b855b86868686614cba565b612605576040805162461bcd60e51b815260206004820152601f60248201527f4552433732313a207472616e736665722072656a656374656420627920746f00604482015290519081900360640190fd5b60007fff00000000000000000000000000000000000000000000000000000000000000821615613af0576040805162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e20696400000000000000000000000000000000604482015290519081900360640190fd5b6000806000613afe856152bd565b925092509250828281613b0d57fe5b0615613b60576040805162461bcd60e51b815260206004820152601e60248201527f7820636f6f7264696e6174653a20496e76616c696420746f6b656e2069640000604482015290519081900360640190fd5b828181613b6957fe5b0615613bbc576040805162461bcd60e51b815260206004820152601e60248201527f7920636f6f7264696e6174653a20496e76616c696420746f6b656e2069640000604482015290519081900360640190fd5b613bc78383836141c4565b95945050505050565b816001600160a01b0316836001600160a01b031614613c36576040805162461bcd60e51b815260206004820152600960248201527f6e6f74206f776e65720000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60008181526004602090815260408083207401000000000000000000000000000000000000000090556001600160a01b0386168084526003909252808320805460001901905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a4505050565b6001600160a01b038216600081815260026020908152604091829020805460ff1916851515908117909155825190815291517fb21eb88b4e33b3f1281830a7178d74d8aa73220416215726b68ae23d539515cb9281900390910190a25050565b6000613d1685614255565b505090506000613d27828686614352565b604080518181526108208101825291925060609190816020015b613d496159c4565b815260200190600190039081613d415790505090506000806003891115613da157613d9b60405180606001604052808a81526020018981526020018b81525084838560028e81613d9557fe5b046153ce565b90925090505b60005b898a02811015613f7a576000613dbc828c8c8c614493565b90506000613df6866040518060600160405280613dd886614514565b8152602001613de6866144e9565b8152602001600181525087615553565b90508015613e3b5760405182906001600160a01b038f169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90600090a4613f70565b6000828152600460205260409020546001600160a01b0316331415613ee5576000828152600660205260409020546001600160a01b031615613ea1576000828152600660205260409020805473ffffffffffffffffffffffffffffffffffffffff191690555b6040516001949094019382906001600160a01b038f169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90600090a4613f70565b60008281526004602052604090205415613f37576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015290519081900360640190fd5b60405182906001600160a01b038f16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45b5050600101613da4565b50613f8b8383838d8d8d8d8d6155fb565b60009384526004602090815260408086206001600160a01b03909c169b8c90559a85526003905289842080549980029990990190985550503381529590952080549490940390935550505050565b8260011480613fe85750826003145b80613ff35750826006145b80613ffe575082600c145b806140095750826018145b61405a576040805162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a650000000000000000000000000000000000000000604482015290519081900360640190fd5b82828161406357fe5b06156140b6576040805162461bcd60e51b815260206004820152601460248201527f496e76616c6964207820636f6f7264696e617465000000000000000000000000604482015290519081900360640190fd5b8281816140bf57fe5b0615614112576040805162461bcd60e51b815260206004820152601460248201527f496e76616c6964207920636f6f7264696e617465000000000000000000000000604482015290519081900360640190fd5b826101980382111561416b576040805162461bcd60e51b815260206004820152600f60248201527f78206f7574206f6620626f756e64730000000000000000000000000000000000604482015290519081900360640190fd5b82610198038111156110d9576040805162461bcd60e51b815260206004820152600f60248201527f79206f7574206f6620626f756e64730000000000000000000000000000000000604482015290519081900360640190fd5b60008060006141d286614255565b50915091506000600460006141fe858a8b8b816141eb57fe5b04028b8c8b816141f757fe5b0402614352565b815260208101919091526040016000205490506001600160a01b0381161561422a5792506119cc915050565b60188710156142485761423e8287876141c4565b93505050506119cc565b5060009695505050505050565b6000806000836001141561427057600092506003915061434b565b836003141561428957600160f81b92506006915061434b565b83600614156142a85750600160f91b9150600c9050600160f81b61434b565b83600c14156142c75750600360f81b915060189050600160f91b61434b565b83601814156142fe57507f04000000000000000000000000000000000000000000000000000000000000009150600360f81b61434b565b6040805162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a650000000000000000000000000000000000000000604482015290519081900360640190fd5b9193909250565b6101980291010190565b600061436782614255565b505090508185116143e95760046000614390838586898161438457fe5b0402868789816141f757fe5b8152602001908152602001600020546000146143e4576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015290519081900360640190fd5b614479565b838501838601855b8281101561447557855b8281101561446d5760046000614412878585614352565b815260200190815260200160002054600014614466576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015290519081900360640190fd5b85016143fb565b5084016143f1565b5050505b60028204915060038210612605576126058585858561435c565b60008084868161449f57fe5b049050600281066144cb576144c360008688816144b857fe5b068601838601614352565b915050612f90565b6144c360008688816144d957fe5b0660010187870103838601614352565b6101987effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff919091160490565b6101987effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff919091160690565b611f78338383615861565b603a5461455f906001600160a01b0316612f5c565b1561478457603a54604080517fc3c5a54700000000000000000000000000000000000000000000000000000000815230600482015290516001600160a01b039092169163c3c5a547916024808201926020929091908290030181600087803b1580156145ca57600080fd5b505af11580156145de573d6000803e3d6000fd5b505050506040513d60208110156145f457600080fd5b505161478457801561468a57603a54604080517f7d3e3dbe0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03858116602483015291519190921691637d3e3dbe91604480830192600092919082900301818387803b15801561466d57600080fd5b505af1158015614681573d6000803e3d6000fd5b50505050614784565b6001600160a01b0382161561470657603a54604080517fa0af29030000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0385811660248301529151919092169163a0af290391604480830192600092919082900301818387803b15801561466d57600080fd5b603a54604080517f4420e48600000000000000000000000000000000000000000000000000000000815230600482015290516001600160a01b0390921691634420e4869160248082019260009290919082900301818387803b15801561476b57600080fd5b505af115801561477f573d6000803e3d6000fd5b505050505b60408051821515815290516001600160a01b038416917f3c7a9c847c035e45b84027e44ad55724873d5921b3a6abb8c0926b415d9241b1919081900360200190a25050565b60608161480a575060408051808201909152600181527f30000000000000000000000000000000000000000000000000000000000000006020820152610f11565b8160005b811561482257600101600a8204915061480e565b6060816040519080825280601f01601f19166020018201604052801561484f576020820181803883390190505b50905060001982015b85156148b557600a860660300160f81b8282806001900393508151811061487b57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a86049550614858565b50949350505050565b604080516001600160e01b031983166024808301919091528251808303909101815260449091018252602081810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001781528251935160008082529485948594909392908183858c612710fa955080519450505050609e5a1161495d57fe5b8280156149675750815b9695505050505050565b600080846001600160a01b0316634b808c46888887876040518563ffffffff1660e01b815260040180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b031681526020018060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015614a0a5781810151838201526020016149f2565b50505050905001838103825284818151815260200191508051906020019080838360005b83811015614a46578181015183820152602001614a2e565b50505050905090810190601f168015614a735780820380516001836020036101000a031916815260200191505b509650505050505050602060405180830381600087803b158015614a9657600080fd5b505af1158015614aaa573d6000803e3d6000fd5b505050506040513d6020811015614ac057600080fd5b50516001600160e01b0319167f4b808c46000000000000000000000000000000000000000000000000000000001491505095945050505050565b6001600160a01b038316614b55576040805162461bcd60e51b815260206004820152601660248201527f496e76616c69642073656e646572206164647265737300000000000000000000604482015290519081900360640190fd5b336001600160a01b0384161480614b7b57503360009081526002602052604090205460ff165b80614b9557503360009081526001602052604090205460ff165b614bd05760405162461bcd60e51b8152600401808060200182810382526021815260200180615bcb6021913960400191505060405180910390fd5b6110d9838383615861565b6001600160a01b038216614c085760008181526004602052604090206001600160a01b0384169055614c74565b60008181526004602090815260408083206001600160a01b038781167f8000000000000000000000000000000000000000000000000000000000000000019091556006909252909120805473ffffffffffffffffffffffffffffffffffffffff19169184169190911790555b80826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b600080846001600160a01b031663150b7a02888887876040518563ffffffff1660e01b815260040180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015614d52578181015183820152602001614d3a565b50505050905090810190601f168015614d7f5780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015614da157600080fd5b505af1158015614db5573d6000803e3d6000fd5b505050506040513d6020811015614dcb57600080fd5b50516001600160e01b0319167f150b7a02000000000000000000000000000000000000000000000000000000001491505095945050505050565b6000806000614e1384612e60565b90925090506001600160a01b038216614e73576040805162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f74206578697374000000000000000000000000604482015290519081900360640190fd5b856001600160a01b0316826001600160a01b031614614ed9576040805162461bcd60e51b815260206004820152601b60248201527f6e6f74206f776e657220696e205f636865636b5472616e736665720000000000604482015290519081900360640190fd5b6001600160a01b038516614f34576040805162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015290519081900360640190fd5b336001600160a01b03871614615022573360009081526002602052604090205460ff1615614f67576001925050506119cc565b6001600160a01b038616600090815260056020908152604080832033845290915290205460ff1680614fb75750808015614fb757506000848152600660205260409020546001600160a01b031633145b80614fd157503360009081526001602052604090205460ff165b615022576040805162461bcd60e51b815260206004820152601860248201527f6e6f7420617070726f76656420746f207472616e736665720000000000000000604482015290519081900360640190fd5b50509392505050565b6001600160a01b03808416600081815260036020908152604080832080546000190190559386168083528483208054600101905585835260049091528382208190559251849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60008060006150ad8660400151614255565b925050915060006150c78388600001518960200151614352565b87519091506001905b60408901518951018110156152175760208901515b89604001518a602001510181101561520f5760008060038a1015615128576151188e61511360008787614352565b615927565b80156151215750845b90506151f0565b6151548e8e60405180606001604052808881526020018781526020018e815250600060028f8161388b57fe5b90506000615163888686614352565b6000818152600460205260409020549350905082156151ee57816151de578e6001600160a01b031683146151de576040805162461bcd60e51b815260206004820152601760248201527f6e6f74206f776e6572206f66206368696c642051756164000000000000000000604482015290519081900360640190fd5b6000818152600460205260408120555b505b80806151fb57508115155b80156152045750845b9450505087016150e5565b5086016150d0565b5086156152b0578061528957896001600160a01b031661524489604001518a600001518b602001516141c4565b6001600160a01b0316146152895760405162461bcd60e51b815260040180806020018281038252602b815260200180615c16602b913960400191505060405180910390fd5b5060009081526004602052604090206001600160a01b03881690555060019150613bc79050565b9998505050505050505050565b60008060006152cb84614514565b91506152d6846144e9565b90507fff0000000000000000000000000000000000000000000000000000000000000084168061530957600193506153c6565b600160f81b81141561531e57600393506153c6565b600160f91b81141561533357600693506153c6565b600360f81b81141561534857600c93506153c6565b7f040000000000000000000000000000000000000000000000000000000000000081141561537957601893506153c6565b6040805162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e20696400000000000000000000000000000000604482015290519081900360640190fd5b509193909250565b60008060006153dc84614255565b50506040890151895160208b015192935080820192909101905b828110156155225760208b01515b8281101561551a5760006154338c60405180606001604052808681526020018581526020018c8152508c615553565b905080615512576000615447878585614352565b6000818152600460205260409020549091506001600160a01b0381163314156154c25760405180606001604052808681526020018581526020018c8152508e8d8151811061549157fe5b6020908102919091018101919091526000838152600490915260408120558a80029c909c019b6001909b019a61550f565b6001600160a01b0381161561550f576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015290519081900360640190fd5b50505b508701615404565b5086016153f6565b50600286049550600386106155435761553e8a8a8a8a8a6153ce565b985096505b5094989597509495505050505050565b6000805b828110156155f0576155676159c4565b85828151811061557357fe5b602002602001015190508460400151816040015111801561559657508051855110155b80156155aa57506040810151815186519101115b80156155be57508060200151856020015110155b80156155d7575080604001518160200151018560200151105b156155e7576001925050506119cc565b50600101615557565b506000949350505050565b61560d856001600160a01b0316612f5c565b80156156255750615625856317a2fd9160e21b6148be565b1561580b57606086604051908082528060200260200182016040528015615656578160200160208202803883390190505b50905060006060888788020360405190808252806020026020018201604052801561568b578160200160208202803883390190505b5090506000805b8889028110156157705760006156aa828b8b8b614493565b90506156e28e60405180606001604052806156c485614514565b81526020016156d2856144e9565b815260200160018152508f615553565b1561570a57808686815181106156f457fe5b6020908102919091010152600190940193615767565b6000818152600460205260409020546001600160a01b031633141561574857600081815260046020526040812055855181908790879081106156f457fe5b8084848151811061575557fe5b60209081029190910101526001909201915b50600101615692565b5061577f3360008b8589614971565b6157ba5760405162461bcd60e51b8152600401808060200182810382526024815260200180615a706024913960400191505060405180910390fd5b6157c733338b8789614971565b6158025760405162461bcd60e51b8152600401808060200182810382526024815260200180615a706024913960400191505060405180910390fd5b505050506115f6565b60005b8485028110156134e857600061582682878787614493565b6000818152600460205260409020549091506001600160a01b0316331415615858576000818152600460205260408120555b5060010161580e565b6001600160a01b03821660009081526001602052604090205460ff16156158b95760405162461bcd60e51b8152600401808060200182810382526036815260200180615b176036913960400191505060405180910390fd5b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff1916861515908117909155825190815291517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319281900390910190a3505050565b60008181526004602052604081205480156159ba57836001600160a01b0316816001600160a01b0316146159a2576040805162461bcd60e51b815260206004820152600960248201527f6e6f74206f776e65720000000000000000000000000000000000000000000000604482015290519081900360640190fd5b50506000818152600460205260408120556001612961565b5060009392505050565b6040518060600160405280600081526020016000815260200160008152509056fe45524337323142617365546f6b656e3a20436f6e747261637420616c726561647920696e697469616c697a6564616464726573732030206973206e6f7420616c6c6f776564206173207375706572206f70657261746f72746865207374617475732073686f756c6420626520646966666572656e74207468616e207468652063757272656e74206f6e65657263373231206261746368207472616e736665722072656a656374656420627920746f616464726573732030206973206e6f7420616c6c6f776564206173206d696e7465726f6e6c7920636f6e7472616374732063616e206265206d657461207472616e73616374696f6e2070726f636573736f724c616e6442617365546f6b656e56333a2078277320616e6420792773206c656e6774682061726520646966666572656e747375706572206f70657261746f722063616e2774206861766520746865697220617070726f76616c466f72416c6c206368616e6765644c616e6442617365546f6b656e56333a2073697a6573277320616e6420782773206c656e6774682061726520646966666572656e746e6f7420617574686f72697a656420746f207472616e736665724d756c7469517561647369742063616e206265206f6e6c79206368616e67656420746f2061206e65772061646d696e6e6f7420617574686f72697a656420746f20617070726f766520666f7220616c6c4c616e6456333a20737562736372697074696f6e2063616e2774206265207a65726f20616464726573736e6f74206f776e6572206f6620616c6c20737562207175616473206e6f7220706172656e74207175616473a265627a7a7230582035c25998d9f59a036b0e292bbb5b9d7acce392cc82912042d6b9870fa500b5a864736f6c63430005090032", "devdoc": { + "author": "The Sandbox", + "details": "LAND contract implements ERC721, quad and marketplace filtering functionalities", "methods": { "approve(address,uint256)": { "params": { @@ -993,6 +1128,14 @@ "newAdmin": "address of the new administrator." } }, + "exists(uint256,uint256,uint256)": { + "params": { + "size": "size of the quad", + "x": "x coordinate of the quad", + "y": "y coordinate of the quad" + }, + "return": "bool for if Land has been minted or not" + }, "getAdmin()": { "return": "the current administrator of this contract." }, @@ -1002,9 +1145,27 @@ }, "return": "The address of the operator" }, + "getX(uint256)": { + "params": { + "id": "tokenId" + }, + "return": "the x coordinates" + }, + "getY(uint256)": { + "params": { + "id": "tokenId" + }, + "return": "the y coordinates" + }, "height()": { "return": "height" }, + "initialize(address,address)": { + "params": { + "admin": "Admin of the contract", + "metaTransactionContract": "Authorized contract for meta-transactions" + } + }, "isApprovedForAll(address,address)": { "params": { "operator": "The address of the operator", @@ -1030,6 +1191,15 @@ }, "return": "whether the address has superOperator rights." }, + "mintAndTransferQuad(address,uint256,uint256,uint256,bytes)": { + "params": { + "data": "extra data to pass to the transfer", + "size": "The size of the new quad", + "to": "The recipient of the new quad", + "x": "The top left x coordinate of the new quad", + "y": "The top left y coordinate of the new quad" + } + }, "mintQuad(address,uint256,uint256,uint256,bytes)": { "params": { "data": "extra data to pass to the transfer", @@ -1048,6 +1218,13 @@ }, "return": "The address of the owner" }, + "register(address,bool)": { + "details": "used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.", + "params": { + "subscribe": "bool to signify subscription \"true\"\" or to copy the list \"false\".", + "subscriptionOrRegistrantToCopy": "registration address of the list to subscribe." + } + }, "safeBatchTransferFrom(address,address,uint256[],bytes)": { "params": { "data": "additional data", @@ -1096,6 +1273,11 @@ "minter": "address that will be given/removed minter right." } }, + "setOperatorRegistry(address)": { + "params": { + "registry": "the address of the registry" + } + }, "setSuperOperator(address,bool)": { "params": { "enabled": "set whether the superOperator is enabled or disabled.", @@ -1136,20 +1318,9 @@ }, "width()": { "return": "width" - }, - "x(uint256)": { - "params": { - "id": "tokenId" - }, - "return": "the x coordinates" - }, - "y(uint256)": { - "params": { - "id": "tokenId" - }, - "return": "the y coordinates" } - } + }, + "title": "LandV3" }, "userdoc": { "methods": { @@ -1177,15 +1348,27 @@ "changeAdmin(address)": { "notice": "change the administrator to be `newAdmin`." }, + "exists(uint256,uint256,uint256)": { + "notice": "checks if Land has been minted or not" + }, "getAdmin()": { "notice": "gives the current administrator of this contract." }, "getApproved(uint256)": { "notice": "Get the approved operator for a specific token" }, + "getX(uint256)": { + "notice": "x coordinate of Land token" + }, + "getY(uint256)": { + "notice": "y coordinate of Land token" + }, "height()": { "notice": "total height of the map" }, + "initialize(address,address)": { + "notice": "Initializes the contract with the meta-transaction contract & admin" + }, "isApprovedForAll(address,address)": { "notice": "Check if the sender approved the operator" }, @@ -1198,6 +1381,9 @@ "isSuperOperator(address)": { "notice": "check whether address `who` is given superOperator rights." }, + "mintAndTransferQuad(address,uint256,uint256,uint256,bytes)": { + "notice": "Checks if a parent quad has child quads already minted. Then mints the rest child quads and transfers the parent quad. Should only be called by the tunnel." + }, "mintQuad(address,uint256,uint256,uint256,bytes)": { "notice": "Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)" }, @@ -1207,6 +1393,9 @@ "ownerOf(uint256)": { "notice": "Return the owner of a Land" }, + "register(address,bool)": { + "notice": "This function is used to register Land contract on the Operator Filterer Registry of Opensea.can only be called by admin." + }, "safeBatchTransferFrom(address,address,uint256[],bytes)": { "notice": "Transfer many tokens between 2 addresses ensuring the receiving contract has a receiver method" }, @@ -1228,6 +1417,9 @@ "setMinter(address,bool)": { "notice": "Enable or disable the ability of `minter` to mint tokens" }, + "setOperatorRegistry(address)": { + "notice": "sets filter registry address deployed in test" + }, "setSuperOperator(address,bool)": { "notice": "Enable or disable the ability of `superOperator` to transfer tokens of all (superOperator rights)." }, @@ -1248,13 +1440,8 @@ }, "width()": { "notice": "total width of the map" - }, - "x(uint256)": { - "notice": "x coordinate of Land token" - }, - "y(uint256)": { - "notice": "y coordinate of Land token" } - } + }, + "notice": "LAND contract" } } \ No newline at end of file diff --git a/packages/core/deployments/mainnet/Land_V1.json b/packages/core/deployments/mainnet/Land_V1.json new file mode 100644 index 0000000000..7a1a468e9d --- /dev/null +++ b/packages/core/deployments/mainnet/Land_V1.json @@ -0,0 +1,1110 @@ +{ + "address": "0x5CC5B05a8A13E3fBDB0BB9FcCd98D38e50F90c38", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "constant": true, + "inputs": [ + { + "name": "id", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "id", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "operator", + "type": "address" + }, + { + "name": "id", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "height", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "ids", + "type": "uint256[]" + }, + { + "name": "data", + "type": "bytes" + } + ], + "name": "batchTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "id", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "ids", + "type": "uint256[]" + }, + { + "name": "data", + "type": "bytes" + } + ], + "name": "safeBatchTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "sender", + "type": "address" + }, + { + "name": "operator", + "type": "address" + }, + { + "name": "id", + "type": "uint256" + } + ], + "name": "approveFor", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "size", + "type": "uint256" + }, + { + "name": "x", + "type": "uint256" + }, + { + "name": "y", + "type": "uint256" + }, + { + "name": "data", + "type": "bytes" + } + ], + "name": "transferQuad", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "id", + "type": "uint256" + } + ], + "name": "x", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "id", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "id", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "metaTransactionContract", + "type": "address" + }, + { + "name": "admin", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "id", + "type": "uint256" + } + ], + "name": "y", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "id", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "name": "owner", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "who", + "type": "address" + } + ], + "name": "isSuperOperator", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "to", + "type": "address" + }, + { + "name": "size", + "type": "uint256" + }, + { + "name": "x", + "type": "uint256" + }, + { + "name": "y", + "type": "uint256" + }, + { + "name": "data", + "type": "bytes" + } + ], + "name": "mintQuad", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAdmin", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "from", + "type": "address" + }, + { + "name": "id", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "_numNFTPerAddress", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "metaTransactionProcessor", + "type": "address" + }, + { + "name": "enabled", + "type": "bool" + } + ], + "name": "setMetaTransactionProcessor", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "_owners", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "address" + } + ], + "name": "_operatorsForAll", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "width", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "operator", + "type": "address" + }, + { + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "who", + "type": "address" + } + ], + "name": "isMinter", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "superOperator", + "type": "address" + }, + { + "name": "enabled", + "type": "bool" + } + ], + "name": "setSuperOperator", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "id", + "type": "uint256" + }, + { + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "_operators", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "id", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "minter", + "type": "address" + }, + { + "name": "enabled", + "type": "bool" + } + ], + "name": "setMinter", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "who", + "type": "address" + } + ], + "name": "isMetaTransactionProcessor", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "owner", + "type": "address" + }, + { + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "name": "isOperator", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "sizes", + "type": "uint256[]" + }, + { + "name": "xs", + "type": "uint256[]" + }, + { + "name": "ys", + "type": "uint256[]" + }, + { + "name": "data", + "type": "bytes" + } + ], + "name": "batchTransferQuad", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "sender", + "type": "address" + }, + { + "name": "operator", + "type": "address" + }, + { + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAllFor", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "superOperator", + "type": "address" + }, + { + "indexed": false, + "name": "enabled", + "type": "bool" + } + ], + "name": "Minter", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "metaTransactionProcessor", + "type": "address" + }, + { + "indexed": false, + "name": "enabled", + "type": "bool" + } + ], + "name": "MetaTransactionProcessor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "superOperator", + "type": "address" + }, + { + "indexed": false, + "name": "enabled", + "type": "bool" + } + ], + "name": "SuperOperator", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "name": "_to", + "type": "address" + }, + { + "indexed": true, + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_approved", + "type": "address" + }, + { + "indexed": true, + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_operator", + "type": "address" + }, + { + "indexed": false, + "name": "_approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "initialLogic", + "type": "address" + }, + { + "internalType": "address", + "name": "initialAdmin", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x933d6f66aa2e7e756a6a52bd5c4a65fbebbba667fcd38155341465eb2cdaf449", + "receipt": { + "to": null, + "from": "0xe19ae8F9B36Ca43D12741288D0e311396140DF6F", + "contractAddress": "0x5CC5B05a8A13E3fBDB0BB9FcCd98D38e50F90c38", + "transactionIndex": 120, + "gasUsed": "614526", + "logsBloom": "0x00000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x01b8cc7fcea63d65e5b15b0db208f11ecb3733de1d3922d902bb30789e9ecdd2", + "transactionHash": "0x933d6f66aa2e7e756a6a52bd5c4a65fbebbba667fcd38155341465eb2cdaf449", + "logs": [ + { + "transactionIndex": 120, + "blockNumber": 14090801, + "transactionHash": "0x933d6f66aa2e7e756a6a52bd5c4a65fbebbba667fcd38155341465eb2cdaf449", + "address": "0x5CC5B05a8A13E3fBDB0BB9FcCd98D38e50F90c38", + "topics": [ + "0xb21eb88b4e33b3f1281830a7178d74d8aa73220416215726b68ae23d539515cb" + ], + "data": "0x0000000000000000000000003845badade8e6dff049820680d1f14bd3903a5d00000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 275, + "blockHash": "0x01b8cc7fcea63d65e5b15b0db208f11ecb3733de1d3922d902bb30789e9ecdd2" + } + ], + "blockNumber": 14090801, + "cumulativeGasUsed": "13493453", + "status": 1, + "byzantium": true + }, + "args": [ + "0x1fC6479Bdc7511C6803aFF2f477E0fD3171606E0", + "0x46Ac83D74091Dd54B503D89fa92b5C788Bcd3886", + "0x485cc9550000000000000000000000003845badade8e6dff049820680d1f14bd3903a5d0000000000000000000000000e19ae8f9b36ca43d12741288d0e311396140df6f" + ], + "solcInputHash": "1635d55d57a0a2552952c0d22586ed23", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialLogic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAdmin\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\",\"events\":{\"AdminChanged(address,address)\":{\"details\":\"Emitted when the admin account has changed.\"}},\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"stateVariables\":{\"_ADMIN_SLOT\":{\"details\":\"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.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.7/openzeppelin/proxy/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.7/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n * \\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n * \\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal virtual view returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n * \\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {\\n }\\n}\\n\",\"keccak256\":\"0xc33f9858a67e34c77831163d5611d21fc627dfd2c303806a98a6c9db5a01b034\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./UpgradeableProxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n * \\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n * \\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n * \\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n * \\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is UpgradeableProxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\\n */\\n constructor(address initialLogic, address initialAdmin, bytes memory _data) payable UpgradeableProxy(initialLogic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _setAdmin(initialAdmin);\\n }\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _admin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n * \\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address) {\\n return _admin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n * \\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address) {\\n return _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n * \\n * Emits an {AdminChanged} event.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external ifAdmin {\\n require(newAdmin != address(0), \\\"TransparentUpgradeableProxy: new admin is the zero address\\\");\\n emit AdminChanged(_admin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeTo(newImplementation);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeTo(newImplementation);\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = newImplementation.delegatecall(data);\\n require(success);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view returns (address adm) {\\n bytes32 slot = _ADMIN_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n adm := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n bytes32 slot = _ADMIN_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newAdmin)\\n }\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal override virtual {\\n require(msg.sender != _admin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xd6cecbe00dc78355aff1a16d83487bb73c54701004d61a2e48cdb81e2bcacc26\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/UpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Proxy.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n * \\n * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see\\n * {TransparentUpgradeableProxy}.\\n */\\ncontract UpgradeableProxy is Proxy {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n * \\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _setImplementation(_logic);\\n if(_data.length > 0) {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = _logic.delegatecall(_data);\\n require(success);\\n }\\n }\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal override view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Upgrades the proxy to a new implementation.\\n * \\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"UpgradeableProxy: new implementation is not a contract\\\");\\n\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newImplementation)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd68f4c11941712db79a61b9dca81a5db663cfacec3d7bb19f8d2c23bb1ab8afe\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\\n // for accounts without code, i.e. `keccak256('')`\\n bytes32 codehash;\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { codehash := extcodehash(account) }\\n return (codehash != accountHash && codehash != 0x0);\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return _functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n return _functionCallWithValue(target, data, value, errorMessage);\\n }\\n\\n function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x698f929f1097637d051976b322a2d532c27df022b09010e8d091e2888a5ebdf8\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051610aaa380380610aaa8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101bf565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b6101b782610231565b505050610291565b6101d28161025560201b6104bb1760201c565b61020d5760405162461bcd60e51b8152600401808060200182810382526036815260200180610a746036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061028957508115155b949350505050565b6107d4806102a06000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104f7565b6101ed6101e861058b565b6105b0565b565b6101f76105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105f9565b610240565b6102406101d5565b50565b61024b6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105f9565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b60006103216105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61058b565b905061036b565b61036b6101d5565b90565b6103766105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806106ed603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e6105d4565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610646565b60006104806105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c6105d4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104ef57508115155b949350505050565b6104ff6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061075d6042913960600191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105cf573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106028161066a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610673816104bb565b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806107276036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a2646970667358221220b141ef72de179b8b56cef31601d40ff2875391088197e73cac39eba1ddcd0fdd64736f6c634300070600335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104f7565b6101ed6101e861058b565b6105b0565b565b6101f76105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105f9565b610240565b6102406101d5565b50565b61024b6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105f9565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b60006103216105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61058b565b905061036b565b61036b6101d5565b90565b6103766105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806106ed603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e6105d4565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610646565b60006104806105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c6105d4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104ef57508115155b949350505050565b6104ff6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061075d6042913960600191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105cf573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106028161066a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610673816104bb565b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806107276036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a2646970667358221220b141ef72de179b8b56cef31601d40ff2875391088197e73cac39eba1ddcd0fdd64736f6c63430007060033", + "execute": { + "methodName": "initialize", + "args": [ + "0x3845badAde8e6dFF049820680d1F14bD3903a5d0", + "0xe19ae8F9B36Ca43D12741288D0e311396140DF6F" + ] + }, + "implementation": "0x1fC6479Bdc7511C6803aFF2f477E0fD3171606E0", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.", + "events": { + "AdminChanged(address,address)": { + "details": "Emitted when the admin account has changed." + } + }, + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "stateVariables": { + "_ADMIN_SLOT": { + "details": "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." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/core/deployments/mainnet/Land_V2.json b/packages/core/deployments/mainnet/Land_V2.json new file mode 100644 index 0000000000..187c9c4749 --- /dev/null +++ b/packages/core/deployments/mainnet/Land_V2.json @@ -0,0 +1,1104 @@ +{ + "address": "0x5CC5B05a8A13E3fBDB0BB9FcCd98D38e50F90c38", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "constant": true, + "inputs": [ + { + "name": "id", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "id", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "operator", + "type": "address" + }, + { + "name": "id", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "height", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "ids", + "type": "uint256[]" + }, + { + "name": "data", + "type": "bytes" + } + ], + "name": "batchTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "id", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "ids", + "type": "uint256[]" + }, + { + "name": "data", + "type": "bytes" + } + ], + "name": "safeBatchTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "sender", + "type": "address" + }, + { + "name": "operator", + "type": "address" + }, + { + "name": "id", + "type": "uint256" + } + ], + "name": "approveFor", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "size", + "type": "uint256" + }, + { + "name": "x", + "type": "uint256" + }, + { + "name": "y", + "type": "uint256" + }, + { + "name": "data", + "type": "bytes" + } + ], + "name": "transferQuad", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "id", + "type": "uint256" + } + ], + "name": "x", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "id", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "id", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "metaTransactionContract", + "type": "address" + }, + { + "name": "admin", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "id", + "type": "uint256" + } + ], + "name": "y", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "id", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "name": "owner", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "who", + "type": "address" + } + ], + "name": "isSuperOperator", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "to", + "type": "address" + }, + { + "name": "size", + "type": "uint256" + }, + { + "name": "x", + "type": "uint256" + }, + { + "name": "y", + "type": "uint256" + }, + { + "name": "data", + "type": "bytes" + } + ], + "name": "mintQuad", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAdmin", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "from", + "type": "address" + }, + { + "name": "id", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "_numNFTPerAddress", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "metaTransactionProcessor", + "type": "address" + }, + { + "name": "enabled", + "type": "bool" + } + ], + "name": "setMetaTransactionProcessor", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "_owners", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "address" + } + ], + "name": "_operatorsForAll", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "width", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "operator", + "type": "address" + }, + { + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "who", + "type": "address" + } + ], + "name": "isMinter", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "superOperator", + "type": "address" + }, + { + "name": "enabled", + "type": "bool" + } + ], + "name": "setSuperOperator", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "id", + "type": "uint256" + }, + { + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "_operators", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "id", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "minter", + "type": "address" + }, + { + "name": "enabled", + "type": "bool" + } + ], + "name": "setMinter", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "who", + "type": "address" + } + ], + "name": "isMetaTransactionProcessor", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "owner", + "type": "address" + }, + { + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "name": "isOperator", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "sizes", + "type": "uint256[]" + }, + { + "name": "xs", + "type": "uint256[]" + }, + { + "name": "ys", + "type": "uint256[]" + }, + { + "name": "data", + "type": "bytes" + } + ], + "name": "batchTransferQuad", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "sender", + "type": "address" + }, + { + "name": "operator", + "type": "address" + }, + { + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAllFor", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "superOperator", + "type": "address" + }, + { + "indexed": false, + "name": "enabled", + "type": "bool" + } + ], + "name": "Minter", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "metaTransactionProcessor", + "type": "address" + }, + { + "indexed": false, + "name": "enabled", + "type": "bool" + } + ], + "name": "MetaTransactionProcessor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "superOperator", + "type": "address" + }, + { + "indexed": false, + "name": "enabled", + "type": "bool" + } + ], + "name": "SuperOperator", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "name": "_to", + "type": "address" + }, + { + "indexed": true, + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_approved", + "type": "address" + }, + { + "indexed": true, + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_operator", + "type": "address" + }, + { + "indexed": false, + "name": "_approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "initialLogic", + "type": "address" + }, + { + "internalType": "address", + "name": "initialAdmin", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x933d6f66aa2e7e756a6a52bd5c4a65fbebbba667fcd38155341465eb2cdaf449", + "receipt": { + "to": null, + "from": "0xe19ae8F9B36Ca43D12741288D0e311396140DF6F", + "contractAddress": "0x5CC5B05a8A13E3fBDB0BB9FcCd98D38e50F90c38", + "transactionIndex": 120, + "gasUsed": "614526", + "logsBloom": "0x00000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x01b8cc7fcea63d65e5b15b0db208f11ecb3733de1d3922d902bb30789e9ecdd2", + "transactionHash": "0x933d6f66aa2e7e756a6a52bd5c4a65fbebbba667fcd38155341465eb2cdaf449", + "logs": [ + { + "transactionIndex": 120, + "blockNumber": 14090801, + "transactionHash": "0x933d6f66aa2e7e756a6a52bd5c4a65fbebbba667fcd38155341465eb2cdaf449", + "address": "0x5CC5B05a8A13E3fBDB0BB9FcCd98D38e50F90c38", + "topics": [ + "0xb21eb88b4e33b3f1281830a7178d74d8aa73220416215726b68ae23d539515cb" + ], + "data": "0x0000000000000000000000003845badade8e6dff049820680d1f14bd3903a5d00000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 275, + "blockHash": "0x01b8cc7fcea63d65e5b15b0db208f11ecb3733de1d3922d902bb30789e9ecdd2" + } + ], + "blockNumber": 14090801, + "cumulativeGasUsed": "13493453", + "status": 1, + "byzantium": true + }, + "args": [ + "0x1fC6479Bdc7511C6803aFF2f477E0fD3171606E0", + "0x46Ac83D74091Dd54B503D89fa92b5C788Bcd3886", + "0x485cc9550000000000000000000000003845badade8e6dff049820680d1f14bd3903a5d0000000000000000000000000e19ae8f9b36ca43d12741288d0e311396140df6f" + ], + "numDeployments": 2, + "solcInputHash": "1635d55d57a0a2552952c0d22586ed23", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialLogic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAdmin\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\",\"events\":{\"AdminChanged(address,address)\":{\"details\":\"Emitted when the admin account has changed.\"}},\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"stateVariables\":{\"_ADMIN_SLOT\":{\"details\":\"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.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.7/openzeppelin/proxy/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.7/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n * \\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n * \\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal virtual view returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n * \\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {\\n }\\n}\\n\",\"keccak256\":\"0xc33f9858a67e34c77831163d5611d21fc627dfd2c303806a98a6c9db5a01b034\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./UpgradeableProxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n * \\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n * \\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n * \\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n * \\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is UpgradeableProxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\\n */\\n constructor(address initialLogic, address initialAdmin, bytes memory _data) payable UpgradeableProxy(initialLogic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _setAdmin(initialAdmin);\\n }\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _admin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n * \\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address) {\\n return _admin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n * \\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address) {\\n return _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n * \\n * Emits an {AdminChanged} event.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external ifAdmin {\\n require(newAdmin != address(0), \\\"TransparentUpgradeableProxy: new admin is the zero address\\\");\\n emit AdminChanged(_admin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeTo(newImplementation);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeTo(newImplementation);\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = newImplementation.delegatecall(data);\\n require(success);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view returns (address adm) {\\n bytes32 slot = _ADMIN_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n adm := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n bytes32 slot = _ADMIN_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newAdmin)\\n }\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal override virtual {\\n require(msg.sender != _admin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xd6cecbe00dc78355aff1a16d83487bb73c54701004d61a2e48cdb81e2bcacc26\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/UpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Proxy.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n * \\n * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see\\n * {TransparentUpgradeableProxy}.\\n */\\ncontract UpgradeableProxy is Proxy {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n * \\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _setImplementation(_logic);\\n if(_data.length > 0) {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = _logic.delegatecall(_data);\\n require(success);\\n }\\n }\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal override view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Upgrades the proxy to a new implementation.\\n * \\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"UpgradeableProxy: new implementation is not a contract\\\");\\n\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newImplementation)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd68f4c11941712db79a61b9dca81a5db663cfacec3d7bb19f8d2c23bb1ab8afe\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\\n // for accounts without code, i.e. `keccak256('')`\\n bytes32 codehash;\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { codehash := extcodehash(account) }\\n return (codehash != accountHash && codehash != 0x0);\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return _functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n return _functionCallWithValue(target, data, value, errorMessage);\\n }\\n\\n function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x698f929f1097637d051976b322a2d532c27df022b09010e8d091e2888a5ebdf8\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051610aaa380380610aaa8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101bf565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b6101b782610231565b505050610291565b6101d28161025560201b6104bb1760201c565b61020d5760405162461bcd60e51b8152600401808060200182810382526036815260200180610a746036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061028957508115155b949350505050565b6107d4806102a06000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104f7565b6101ed6101e861058b565b6105b0565b565b6101f76105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105f9565b610240565b6102406101d5565b50565b61024b6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105f9565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b60006103216105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61058b565b905061036b565b61036b6101d5565b90565b6103766105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806106ed603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e6105d4565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610646565b60006104806105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c6105d4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104ef57508115155b949350505050565b6104ff6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061075d6042913960600191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105cf573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106028161066a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610673816104bb565b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806107276036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a2646970667358221220b141ef72de179b8b56cef31601d40ff2875391088197e73cac39eba1ddcd0fdd64736f6c634300070600335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104f7565b6101ed6101e861058b565b6105b0565b565b6101f76105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105f9565b610240565b6102406101d5565b50565b61024b6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105f9565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b60006103216105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61058b565b905061036b565b61036b6101d5565b90565b6103766105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806106ed603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e6105d4565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610646565b60006104806105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c6105d4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104ef57508115155b949350505050565b6104ff6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061075d6042913960600191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105cf573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106028161066a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610673816104bb565b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806107276036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a2646970667358221220b141ef72de179b8b56cef31601d40ff2875391088197e73cac39eba1ddcd0fdd64736f6c63430007060033", + "implementation": "0xf859e17efbcdf60ee9b951198aecd03b1cdd231c", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.", + "events": { + "AdminChanged(address,address)": { + "details": "Emitted when the admin account has changed." + } + }, + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "stateVariables": { + "_ADMIN_SLOT": { + "details": "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." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/core/deployments/mainnet/OperatorFilterRegistry.json b/packages/core/deployments/mainnet/OperatorFilterRegistry.json new file mode 100644 index 0000000000..8a54ce6f8a --- /dev/null +++ b/packages/core/deployments/mainnet/OperatorFilterRegistry.json @@ -0,0 +1,668 @@ +{ + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_defaultSubscribtion", + "type": "address" + }, + { + "internalType": "address[]", + "name": "_blacklistedAddresses", + "type": "address[]" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "codeHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bool", + "name": "filtered", + "type": "bool" + } + ], + "name": "CodeHashUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32[]", + "name": "codeHashes", + "type": "bytes32[]" + }, + { + "indexed": true, + "internalType": "bool", + "name": "filtered", + "type": "bool" + } + ], + "name": "CodeHashesUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "bool", + "name": "filtered", + "type": "bool" + } + ], + "name": "OperatorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "operators", + "type": "address[]" + }, + { + "indexed": true, + "internalType": "bool", + "name": "filtered", + "type": "bool" + } + ], + "name": "OperatorsUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "indexed": true, + "internalType": "bool", + "name": "registered", + "type": "bool" + } + ], + "name": "RegistrationUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "subscription", + "type": "address" + }, + { + "indexed": true, + "internalType": "bool", + "name": "subscribed", + "type": "bool" + } + ], + "name": "SubscriptionUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "EOA_CODEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "codeHashOf", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "registrantToCopy", + "type": "address" + } + ], + "name": "copyEntriesOf", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "filteredCodeHashAt", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + } + ], + "name": "filteredCodeHashes", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "", + "type": "bytes32[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "filteredOperatorAt", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + } + ], + "name": "filteredOperators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "codeHash", + "type": "bytes32" + } + ], + "name": "isCodeHashFiltered", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "operatorWithCode", + "type": "address" + } + ], + "name": "isCodeHashOfFiltered", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isOperatorAllowed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isOperatorFiltered", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + } + ], + "name": "isRegistered", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "registrantToCopy", + "type": "address" + } + ], + "name": "registerAndCopyEntries", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "subscription", + "type": "address" + } + ], + "name": "registerAndSubscribe", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "newSubscription", + "type": "address" + } + ], + "name": "subscribe", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "subscriberAt", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + } + ], + "name": "subscribers", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + } + ], + "name": "subscriptionOf", + "outputs": [ + { + "internalType": "address", + "name": "subscription", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + } + ], + "name": "unregister", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "bool", + "name": "copyExistingEntries", + "type": "bool" + } + ], + "name": "unsubscribe", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "codeHash", + "type": "bytes32" + }, + { + "internalType": "bool", + "name": "filtered", + "type": "bool" + } + ], + "name": "updateCodeHash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "bytes32[]", + "name": "codeHashes", + "type": "bytes32[]" + }, + { + "internalType": "bool", + "name": "filtered", + "type": "bool" + } + ], + "name": "updateCodeHashes", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "filtered", + "type": "bool" + } + ], + "name": "updateOperator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address[]", + "name": "operators", + "type": "address[]" + }, + { + "internalType": "bool", + "name": "filtered", + "type": "bool" + } + ], + "name": "updateOperators", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] +} \ No newline at end of file diff --git a/packages/core/deployments/mainnet/OperatorFilterSubscription.json b/packages/core/deployments/mainnet/OperatorFilterSubscription.json new file mode 100644 index 0000000000..ec5d20e4b4 --- /dev/null +++ b/packages/core/deployments/mainnet/OperatorFilterSubscription.json @@ -0,0 +1,460 @@ +{ + "address": "0x1DAe51ce738655CBda07083093e689248a4ee79B", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "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": "DEFAULT_SUBSCRIPTION", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "operatorFilterRegistry", + "outputs": [ + { + "internalType": "contract IOperatorFilterRegistry", + "name": "", + "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": "initialLogic", + "type": "address" + }, + { + "internalType": "address", + "name": "initialAdmin", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "receipt": { + "to": null, + "from": "0xe19ae8F9B36Ca43D12741288D0e311396140DF6F", + "contractAddress": "0x1DAe51ce738655CBda07083093e689248a4ee79B", + "transactionIndex": 62, + "gasUsed": "1092704", + "logsBloom": "0x00000000000000000000000000000002000000000800010000804090100800080800000000000100020000000000000000000000400000000001000100040004000080000000000000000000000000000001000001044000000000010000000000000000030000000000200000000800100080000000000000012000000000400000000000000004000000000000000000000000000010080000000000000000000000000000000210004000100100000000000000000000000000000000000000000100004000000000008000000200000000000000000000040040020060000000080000000000000000000100000000000000002000000200000000000000", + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d", + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "logs": [ + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x86d03f430c7616021073d7a71766f632f1ce19f289aa989534d9f4732253eb59", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 253, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x0000000000000000000000000fc584529a2aefa997697fafacba5831fac0c22d", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 254, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x000000000000000000000000fed24ec7e22f573c2e08aef55aa6797ca2b3a051", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 255, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x000000000000000000000000f42aa99f011a1fa7cda90e5e98b277e306bca83e", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 256, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x000000000000000000000000b16c1342e617a5b6e4b631eb114483fdb289c0a4", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 257, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x000000000000000000000000d42638863462d2f21bb7d4275d7637ee5d5541eb", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 258, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x00000000000000000000000008ce97807a81896e85841d74fb7e7b065ab3ef05", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 259, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x00000000000000000000000092de3a1511ef22abcf3526c302159882a4755b22", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 260, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x000000000000000000000000cd80c916b1194beb48abf007d0b79a7238436d56", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 261, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x000000000000000000000000000000000060c4ca14cfc4325359062ace33fe3d", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 262, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x1DAe51ce738655CBda07083093e689248a4ee79B", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000e19ae8f9b36ca43d12741288d0e311396140df6f" + ], + "data": "0x", + "logIndex": 263, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + } + ], + "blockNumber": 17834789, + "cumulativeGasUsed": "10317232", + "status": 1, + "byzantium": true + }, + "args": [ + "0x4A177bc9F9020EBf668124443a0caFe5A6553Bf3", + "0x46Ac83D74091Dd54B503D89fa92b5C788Bcd3886", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "1635d55d57a0a2552952c0d22586ed23", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialLogic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAdmin\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\",\"events\":{\"AdminChanged(address,address)\":{\"details\":\"Emitted when the admin account has changed.\"}},\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"stateVariables\":{\"_ADMIN_SLOT\":{\"details\":\"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.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.7/openzeppelin/proxy/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.7/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n * \\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n * \\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal virtual view returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n * \\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {\\n }\\n}\\n\",\"keccak256\":\"0xc33f9858a67e34c77831163d5611d21fc627dfd2c303806a98a6c9db5a01b034\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./UpgradeableProxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n * \\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n * \\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n * \\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n * \\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is UpgradeableProxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\\n */\\n constructor(address initialLogic, address initialAdmin, bytes memory _data) payable UpgradeableProxy(initialLogic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _setAdmin(initialAdmin);\\n }\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _admin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n * \\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address) {\\n return _admin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n * \\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address) {\\n return _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n * \\n * Emits an {AdminChanged} event.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external ifAdmin {\\n require(newAdmin != address(0), \\\"TransparentUpgradeableProxy: new admin is the zero address\\\");\\n emit AdminChanged(_admin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeTo(newImplementation);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeTo(newImplementation);\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = newImplementation.delegatecall(data);\\n require(success);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view returns (address adm) {\\n bytes32 slot = _ADMIN_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n adm := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n bytes32 slot = _ADMIN_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newAdmin)\\n }\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal override virtual {\\n require(msg.sender != _admin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xd6cecbe00dc78355aff1a16d83487bb73c54701004d61a2e48cdb81e2bcacc26\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/UpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Proxy.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n * \\n * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see\\n * {TransparentUpgradeableProxy}.\\n */\\ncontract UpgradeableProxy is Proxy {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n * \\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _setImplementation(_logic);\\n if(_data.length > 0) {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = _logic.delegatecall(_data);\\n require(success);\\n }\\n }\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal override view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Upgrades the proxy to a new implementation.\\n * \\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"UpgradeableProxy: new implementation is not a contract\\\");\\n\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newImplementation)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd68f4c11941712db79a61b9dca81a5db663cfacec3d7bb19f8d2c23bb1ab8afe\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\\n // for accounts without code, i.e. `keccak256('')`\\n bytes32 codehash;\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { codehash := extcodehash(account) }\\n return (codehash != accountHash && codehash != 0x0);\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return _functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n return _functionCallWithValue(target, data, value, errorMessage);\\n }\\n\\n function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x698f929f1097637d051976b322a2d532c27df022b09010e8d091e2888a5ebdf8\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051610aaa380380610aaa8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101bf565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b6101b782610231565b505050610291565b6101d28161025560201b6104bb1760201c565b61020d5760405162461bcd60e51b8152600401808060200182810382526036815260200180610a746036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061028957508115155b949350505050565b6107d4806102a06000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104f7565b6101ed6101e861058b565b6105b0565b565b6101f76105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105f9565b610240565b6102406101d5565b50565b61024b6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105f9565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b60006103216105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61058b565b905061036b565b61036b6101d5565b90565b6103766105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806106ed603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e6105d4565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610646565b60006104806105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c6105d4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104ef57508115155b949350505050565b6104ff6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061075d6042913960600191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105cf573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106028161066a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610673816104bb565b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806107276036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a2646970667358221220b141ef72de179b8b56cef31601d40ff2875391088197e73cac39eba1ddcd0fdd64736f6c634300070600335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104f7565b6101ed6101e861058b565b6105b0565b565b6101f76105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105f9565b610240565b6102406101d5565b50565b61024b6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105f9565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b60006103216105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61058b565b905061036b565b61036b6101d5565b90565b6103766105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806106ed603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e6105d4565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610646565b60006104806105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c6105d4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104ef57508115155b949350505050565b6104ff6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061075d6042913960600191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105cf573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106028161066a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610673816104bb565b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806107276036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a2646970667358221220b141ef72de179b8b56cef31601d40ff2875391088197e73cac39eba1ddcd0fdd64736f6c63430007060033", + "execute": { + "methodName": "initialize", + "args": [] + }, + "implementation": "0x4A177bc9F9020EBf668124443a0caFe5A6553Bf3", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.", + "events": { + "AdminChanged(address,address)": { + "details": "Emitted when the admin account has changed." + } + }, + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "stateVariables": { + "_ADMIN_SLOT": { + "details": "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." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/core/deployments/mainnet/OperatorFilterSubscription_Implementation.json b/packages/core/deployments/mainnet/OperatorFilterSubscription_Implementation.json new file mode 100644 index 0000000000..98f7a6d810 --- /dev/null +++ b/packages/core/deployments/mainnet/OperatorFilterSubscription_Implementation.json @@ -0,0 +1,208 @@ +{ + "address": "0x4A177bc9F9020EBf668124443a0caFe5A6553Bf3", + "abi": [ + { + "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": "DEFAULT_SUBSCRIPTION", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "operatorFilterRegistry", + "outputs": [ + { + "internalType": "contract IOperatorFilterRegistry", + "name": "", + "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" + } + ], + "transactionHash": "0x4719b6fbde400e51786e2385bf07d4480a6f8f410bfbcf16f856afb108b4fddb", + "receipt": { + "to": null, + "from": "0xe19ae8F9B36Ca43D12741288D0e311396140DF6F", + "contractAddress": "0x4A177bc9F9020EBf668124443a0caFe5A6553Bf3", + "transactionIndex": 43, + "gasUsed": "414822", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xcdea9725b7728df477c862821ddee9828354630c1e7f88e65190f765fc1b19a4", + "transactionHash": "0x4719b6fbde400e51786e2385bf07d4480a6f8f410bfbcf16f856afb108b4fddb", + "logs": [], + "blockNumber": 17834788, + "cumulativeGasUsed": "4957528", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e1aa5651f7645b1641ef34120369a942", + "metadata": "{\"compiler\":{\"version\":\"0.8.2+commit.661d1103\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"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\":\"DEFAULT_SUBSCRIPTION\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"operatorFilterRegistry\",\"outputs\":[{\"internalType\":\"contract IOperatorFilterRegistry\",\"name\":\"\",\"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\"}],\"devdoc\":{\"custom:experimental\":\"This is an experimental contract. There could be future changes according to the change in the requirements\",\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"OperatorFilterSubription\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"This contract is ment to register and copy the default subscription of the openSea for the operator filter and our Token contract are supposed to subscribe to This contract on openSea operator filter registry\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/solc_0.8/OperatorFilterer/contracts/OperatorFilterRegistrant.sol\":\"OperatorFilterSubscription\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Context_init_unchained();\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x9ffedb33e192f8821cbaead72596c79ea87fb28a73f8d3a9f5004449799f8e1b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the\\n * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() initializer {}\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n bool private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Modifier to protect an initializer function from being invoked twice.\\n */\\n modifier initializer() {\\n // If the contract is initializing we ignore whether _initialized is set in order to support multiple\\n // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the\\n // contract may have been reentered.\\n require(_initializing ? _isConstructor() : !_initialized, \\\"Initializable: contract is already initialized\\\");\\n\\n bool isTopLevelCall = !_initializing;\\n if (isTopLevelCall) {\\n _initializing = true;\\n _initialized = true;\\n }\\n\\n _;\\n\\n if (isTopLevelCall) {\\n _initializing = false;\\n }\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} modifier, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n function _isConstructor() private view returns (bool) {\\n return !AddressUpgradeable.isContract(address(this));\\n }\\n}\\n\",\"keccak256\":\"0x68861bcc80cacbd498efde75aab6c74a486cc48262660d326c8d7530d9752097\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3f0f878c796dfc7feba6d3c4e3e526c14c7deae8b7bfc71088e3f38fab0d77b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n __Context_init_unchained();\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x0b0d548f6381370d394f7a434f994dc678b3ef3e755de106109d61343a685ea7\",\"license\":\"MIT\"},\"src/solc_0.8/OperatorFilterer/contracts/OperatorFilterRegistrant.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// solhint-disable-next-line compiler-version\\npragma solidity 0.8.2;\\n\\nimport {IOperatorFilterRegistry} from \\\"../interfaces/IOperatorFilterRegistry.sol\\\";\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\n\\n/// @title OperatorFilterSubription\\n/// @notice This contract is ment to register and copy the default subscription of the openSea for the operator filter and our Token contract are supposed to subscribe to This contract on openSea operator filter registry\\n/// @custom:experimental This is an experimental contract. There could be future changes according to the change in the requirements\\ncontract OperatorFilterSubscription is OwnableUpgradeable {\\n address public constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);\\n\\n IOperatorFilterRegistry public constant operatorFilterRegistry =\\n IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);\\n\\n function initialize() external initializer {\\n // Subscribe and copy the entries of the Default subscription list of open sea.\\n if (address(operatorFilterRegistry).code.length > 0) {\\n operatorFilterRegistry.registerAndCopyEntries(address(this), DEFAULT_SUBSCRIPTION);\\n }\\n __Ownable_init();\\n }\\n}\\n\",\"keccak256\":\"0x0b41d80857c0190de23ece65a6c2a7affa7c18bd52563cb4cf9841a0457bcb7c\",\"license\":\"MIT\"},\"src/solc_0.8/OperatorFilterer/interfaces/IOperatorFilterRegistry.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\n/**\\n * @title IOperatorFilterRegistry\\n * @author OpenSea\\n * @notice Interface of the operator filter registry\\n * @dev This interface comes from OpenSea https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/IOperatorFilterRegistry.sol and adapted to the 0.5.9 solidity version\\n */\\ninterface IOperatorFilterRegistry {\\n /**\\n * @notice Check if the operator is allowed for the given registrant\\n * @param registrant address of the registrant\\n * @param operator operator address to check\\n * @return is the operator allowed\\n */\\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\\n\\n /**\\n * @notice Register a new address\\n * @param registrant address to register\\n */\\n function register(address registrant) external;\\n\\n /**\\n * @notice Register a new address & subscribe to an address\\n * @param registrant address of the registrant\\n * @param subscription address where the registrant is subscribed to\\n */\\n function registerAndSubscribe(address registrant, address subscription) external;\\n\\n /**\\n * @notice Register and copy entries of another registrant\\n * @param registrant address of the registrant\\n * @param registrantToCopy address to copy from\\n */\\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\\n\\n /**\\n * @notice update the operator for a registrant\\n * @param registrant address of the registrant\\n * @param operator operator to be updated\\n * @param filtered is it filtered\\n */\\n function updateOperator(\\n address registrant,\\n address operator,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update operators for a registrant\\n * @param registrant address of the registrant\\n * @param operators addresses of the operators\\n * @param filtered is it filtered\\n */\\n function updateOperators(\\n address registrant,\\n address[] calldata operators,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update code hash\\n * @param registrant address of the registrant\\n * @param codehash code hash\\n * @param filtered is it filtered\\n */\\n function updateCodeHash(\\n address registrant,\\n bytes32 codehash,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update code hashes\\n * @param registrant address of the registrant\\n * @param codeHashes code hashes\\n * @param filtered is it filtered\\n */\\n function updateCodeHashes(\\n address registrant,\\n bytes32[] calldata codeHashes,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Subscribe a registrant\\n * @param registrant address of the registrant\\n * @param registrantToSubscribe address to subscribe with\\n */\\n function subscribe(address registrant, address registrantToSubscribe) external;\\n\\n /**\\n * @notice Unsubscribe a registrant\\n * @param registrant address of the registrant\\n * @param copyExistingEntries copy existing entries\\n */\\n function unsubscribe(address registrant, bool copyExistingEntries) external;\\n\\n /**\\n * @notice Get the subscription of an address\\n * @param addr address to check\\n * @return registrant the registrant address\\n */\\n function subscriptionOf(address addr) external returns (address registrant);\\n\\n /**\\n * @notice Get the subscribers of the registrant\\n * @param registrant address of the registrant\\n * @return the subscribers addresses\\n */\\n function subscribers(address registrant) external returns (address[] memory);\\n\\n /**\\n * @notice Get a specific subscriber\\n * @param registrant address of the registrant\\n * @param index index to check\\n * @return the ith subscriber of the registrant\\n */\\n function subscriberAt(address registrant, uint256 index) external returns (address);\\n\\n /**\\n * @notice Copy the entries of a registrant\\n * @param registrant address of the registrant\\n * @param registrantToCopy address to copy\\n */\\n function copyEntriesOf(address registrant, address registrantToCopy) external;\\n\\n /**\\n * @notice Is a registrant filtered\\n * @param registrant address of the registrant\\n * @param operator operator address to check\\n * @return is it filtered\\n */\\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\\n\\n /**\\n * @notice Is the code hash of an operator filtered\\n * @param registrant address of the registrant\\n * @param operatorWithCode operator address to check\\n * @return is it filtered\\n */\\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\\n\\n /**\\n * @notice Is the code hash filtered\\n * @param registrant address of the registrant\\n * @param codeHash code hash\\n * @return is it filtered\\n */\\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\\n\\n /**\\n * @notice Get the filtered operators\\n * @param addr address to check\\n * @return filtered operators\\n */\\n function filteredOperators(address addr) external returns (address[] memory);\\n\\n /**\\n * @notice Get the filtered code hashes\\n * @param addr address to check\\n * @return filtered code hashes\\n */\\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\\n\\n /**\\n * @notice Get a specific operator\\n * @param registrant address of the registrant\\n * @param index index to check\\n * @return address of the operator\\n */\\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\\n\\n /**\\n * @notice Get the ith filtered code hash\\n * @param registrant address of the registrant\\n * @param index index to check\\n * @return the code hash\\n */\\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\\n\\n /**\\n * @notice Is the address registered\\n * @param addr address to check\\n * @return is it registered\\n */\\n function isRegistered(address addr) external returns (bool);\\n\\n /**\\n * @notice Get the code hash for this address\\n * @param addr address to check\\n * @return the code hash\\n */\\n function codeHashOf(address addr) external returns (bytes32);\\n}\\n\",\"keccak256\":\"0xe399bf85460967b797bd4d2250b0b6ccbfd1188d3c843e2f29147f8061fc1c8e\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610692806100206000396000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c8063b0ccc31e11610050578063b0ccc31e146100cc578063f2fde38b146100e1578063f9c0611c146100f457610072565b8063715018a6146100775780638129fc1c146100815780638da5cb5b14610089575b600080fd5b61007f61010f565b005b61007f610187565b60335473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6100a36daaeb6d7670e522a718067333cd4e81565b61007f6100ef366004610621565b610325565b6100a3733cc6cdda760b79bafa08df41ecfa224f810dceb681565b60335473ffffffffffffffffffffffffffffffffffffffff16331461017b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b610185600061041a565b565b600054610100900460ff166101a25760005460ff16156101a6565b303b155b6102185760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610172565b600054610100900460ff1615801561026157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0061ff0019909116610100171660011790555b6daaeb6d7670e522a718067333cd4e3b15610308576040517fa0af2903000000000000000000000000000000000000000000000000000000008152306004820152733cc6cdda760b79bafa08df41ecfa224f810dceb660248201526daaeb6d7670e522a718067333cd4e9063a0af290390604401600060405180830381600087803b1580156102ef57600080fd5b505af1158015610303573d6000803e3d6000fd5b505050505b610310610491565b8015610322576000805461ff00191690555b50565b60335473ffffffffffffffffffffffffffffffffffffffff16331461038c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610172565b73ffffffffffffffffffffffffffffffffffffffff81166104155760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610172565b610322815b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661050e5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610172565b61051661051e565b61018561059b565b600054610100900460ff166101855760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610172565b600054610100900460ff166106185760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610172565b6101853361041a565b600060208284031215610632578081fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610655578182fd5b939250505056fea2646970667358221220935c1184430e8217311d76c7de8dec2610b36997ed0e7acc61e8def1405705da64736f6c63430008020033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100725760003560e01c8063b0ccc31e11610050578063b0ccc31e146100cc578063f2fde38b146100e1578063f9c0611c146100f457610072565b8063715018a6146100775780638129fc1c146100815780638da5cb5b14610089575b600080fd5b61007f61010f565b005b61007f610187565b60335473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6100a36daaeb6d7670e522a718067333cd4e81565b61007f6100ef366004610621565b610325565b6100a3733cc6cdda760b79bafa08df41ecfa224f810dceb681565b60335473ffffffffffffffffffffffffffffffffffffffff16331461017b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b610185600061041a565b565b600054610100900460ff166101a25760005460ff16156101a6565b303b155b6102185760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610172565b600054610100900460ff1615801561026157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0061ff0019909116610100171660011790555b6daaeb6d7670e522a718067333cd4e3b15610308576040517fa0af2903000000000000000000000000000000000000000000000000000000008152306004820152733cc6cdda760b79bafa08df41ecfa224f810dceb660248201526daaeb6d7670e522a718067333cd4e9063a0af290390604401600060405180830381600087803b1580156102ef57600080fd5b505af1158015610303573d6000803e3d6000fd5b505050505b610310610491565b8015610322576000805461ff00191690555b50565b60335473ffffffffffffffffffffffffffffffffffffffff16331461038c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610172565b73ffffffffffffffffffffffffffffffffffffffff81166104155760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610172565b610322815b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661050e5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610172565b61051661051e565b61018561059b565b600054610100900460ff166101855760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610172565b600054610100900460ff166106185760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610172565b6101853361041a565b600060208284031215610632578081fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610655578182fd5b939250505056fea2646970667358221220935c1184430e8217311d76c7de8dec2610b36997ed0e7acc61e8def1405705da64736f6c63430008020033", + "devdoc": { + "custom:experimental": "This is an experimental contract. There could be future changes according to the change in the requirements", + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "title": "OperatorFilterSubription", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "notice": "This contract is ment to register and copy the default subscription of the openSea for the operator filter and our Token contract are supposed to subscribe to This contract on openSea operator filter registry", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 10217, + "contract": "src/solc_0.8/OperatorFilterer/contracts/OperatorFilterRegistrant.sol:OperatorFilterSubscription", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 10220, + "contract": "src/solc_0.8/OperatorFilterer/contracts/OperatorFilterRegistrant.sol:OperatorFilterSubscription", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 12276, + "contract": "src/solc_0.8/OperatorFilterer/contracts/OperatorFilterRegistrant.sol:OperatorFilterSubscription", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 9994, + "contract": "src/solc_0.8/OperatorFilterer/contracts/OperatorFilterRegistrant.sol:OperatorFilterSubscription", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 10108, + "contract": "src/solc_0.8/OperatorFilterer/contracts/OperatorFilterRegistrant.sol:OperatorFilterSubscription", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/packages/core/deployments/mainnet/OperatorFilterSubscription_Proxy.json b/packages/core/deployments/mainnet/OperatorFilterSubscription_Proxy.json new file mode 100644 index 0000000000..acd871a3c0 --- /dev/null +++ b/packages/core/deployments/mainnet/OperatorFilterSubscription_Proxy.json @@ -0,0 +1,370 @@ +{ + "address": "0x1DAe51ce738655CBda07083093e689248a4ee79B", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "initialLogic", + "type": "address" + }, + { + "internalType": "address", + "name": "initialAdmin", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "receipt": { + "to": null, + "from": "0xe19ae8F9B36Ca43D12741288D0e311396140DF6F", + "contractAddress": "0x1DAe51ce738655CBda07083093e689248a4ee79B", + "transactionIndex": 62, + "gasUsed": "1092704", + "logsBloom": "0x00000000000000000000000000000002000000000800010000804090100800080800000000000100020000000000000000000000400000000001000100040004000080000000000000000000000000000001000001044000000000010000000000000000030000000000200000000800100080000000000000012000000000400000000000000004000000000000000000000000000010080000000000000000000000000000000210004000100100000000000000000000000000000000000000000100004000000000008000000200000000000000000000040040020060000000080000000000000000000100000000000000002000000200000000000000", + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d", + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "logs": [ + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x86d03f430c7616021073d7a71766f632f1ce19f289aa989534d9f4732253eb59", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 253, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x0000000000000000000000000fc584529a2aefa997697fafacba5831fac0c22d", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 254, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x000000000000000000000000fed24ec7e22f573c2e08aef55aa6797ca2b3a051", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 255, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x000000000000000000000000f42aa99f011a1fa7cda90e5e98b277e306bca83e", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 256, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x000000000000000000000000b16c1342e617a5b6e4b631eb114483fdb289c0a4", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 257, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x000000000000000000000000d42638863462d2f21bb7d4275d7637ee5d5541eb", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 258, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x00000000000000000000000008ce97807a81896e85841d74fb7e7b065ab3ef05", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 259, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x00000000000000000000000092de3a1511ef22abcf3526c302159882a4755b22", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 260, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x000000000000000000000000cd80c916b1194beb48abf007d0b79a7238436d56", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 261, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a", + "0x0000000000000000000000001dae51ce738655cbda07083093e689248a4ee79b", + "0x000000000000000000000000000000000060c4ca14cfc4325359062ace33fe3d", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 262, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + }, + { + "transactionIndex": 62, + "blockNumber": 17834789, + "transactionHash": "0xb3743d7430a167afea2753d827705ee020353c6aa4fa14a9eb0682d2a5836b0f", + "address": "0x1DAe51ce738655CBda07083093e689248a4ee79B", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000e19ae8f9b36ca43d12741288d0e311396140df6f" + ], + "data": "0x", + "logIndex": 263, + "blockHash": "0x27a9a1ba684791ae12c638014b236f1d5f40f1bcb287805fbf178a6c2f09735d" + } + ], + "blockNumber": 17834789, + "cumulativeGasUsed": "10317232", + "status": 1, + "byzantium": true + }, + "args": [ + "0x4A177bc9F9020EBf668124443a0caFe5A6553Bf3", + "0x46Ac83D74091Dd54B503D89fa92b5C788Bcd3886", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "1635d55d57a0a2552952c0d22586ed23", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialLogic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAdmin\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\",\"events\":{\"AdminChanged(address,address)\":{\"details\":\"Emitted when the admin account has changed.\"}},\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"stateVariables\":{\"_ADMIN_SLOT\":{\"details\":\"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.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.7/openzeppelin/proxy/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.7/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n * \\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n * \\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal virtual view returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n * \\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {\\n }\\n}\\n\",\"keccak256\":\"0xc33f9858a67e34c77831163d5611d21fc627dfd2c303806a98a6c9db5a01b034\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./UpgradeableProxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n * \\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n * \\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n * \\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n * \\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is UpgradeableProxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\\n */\\n constructor(address initialLogic, address initialAdmin, bytes memory _data) payable UpgradeableProxy(initialLogic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _setAdmin(initialAdmin);\\n }\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _admin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n * \\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address) {\\n return _admin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n * \\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address) {\\n return _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n * \\n * Emits an {AdminChanged} event.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external ifAdmin {\\n require(newAdmin != address(0), \\\"TransparentUpgradeableProxy: new admin is the zero address\\\");\\n emit AdminChanged(_admin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeTo(newImplementation);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeTo(newImplementation);\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = newImplementation.delegatecall(data);\\n require(success);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view returns (address adm) {\\n bytes32 slot = _ADMIN_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n adm := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n bytes32 slot = _ADMIN_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newAdmin)\\n }\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal override virtual {\\n require(msg.sender != _admin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xd6cecbe00dc78355aff1a16d83487bb73c54701004d61a2e48cdb81e2bcacc26\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/UpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Proxy.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n * \\n * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see\\n * {TransparentUpgradeableProxy}.\\n */\\ncontract UpgradeableProxy is Proxy {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n * \\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _setImplementation(_logic);\\n if(_data.length > 0) {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = _logic.delegatecall(_data);\\n require(success);\\n }\\n }\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal override view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Upgrades the proxy to a new implementation.\\n * \\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"UpgradeableProxy: new implementation is not a contract\\\");\\n\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newImplementation)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd68f4c11941712db79a61b9dca81a5db663cfacec3d7bb19f8d2c23bb1ab8afe\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\\n // for accounts without code, i.e. `keccak256('')`\\n bytes32 codehash;\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { codehash := extcodehash(account) }\\n return (codehash != accountHash && codehash != 0x0);\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return _functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n return _functionCallWithValue(target, data, value, errorMessage);\\n }\\n\\n function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x698f929f1097637d051976b322a2d532c27df022b09010e8d091e2888a5ebdf8\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051610aaa380380610aaa8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101bf565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b6101b782610231565b505050610291565b6101d28161025560201b6104bb1760201c565b61020d5760405162461bcd60e51b8152600401808060200182810382526036815260200180610a746036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061028957508115155b949350505050565b6107d4806102a06000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104f7565b6101ed6101e861058b565b6105b0565b565b6101f76105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105f9565b610240565b6102406101d5565b50565b61024b6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105f9565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b60006103216105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61058b565b905061036b565b61036b6101d5565b90565b6103766105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806106ed603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e6105d4565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610646565b60006104806105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c6105d4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104ef57508115155b949350505050565b6104ff6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061075d6042913960600191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105cf573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106028161066a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610673816104bb565b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806107276036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a2646970667358221220b141ef72de179b8b56cef31601d40ff2875391088197e73cac39eba1ddcd0fdd64736f6c634300070600335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104f7565b6101ed6101e861058b565b6105b0565b565b6101f76105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105f9565b610240565b6102406101d5565b50565b61024b6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105f9565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b60006103216105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61058b565b905061036b565b61036b6101d5565b90565b6103766105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806106ed603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e6105d4565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610646565b60006104806105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c6105d4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104ef57508115155b949350505050565b6104ff6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061075d6042913960600191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105cf573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106028161066a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610673816104bb565b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806107276036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a2646970667358221220b141ef72de179b8b56cef31601d40ff2875391088197e73cac39eba1ddcd0fdd64736f6c63430007060033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.", + "events": { + "AdminChanged(address,address)": { + "details": "Emitted when the admin account has changed." + } + }, + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "stateVariables": { + "_ADMIN_SLOT": { + "details": "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." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/core/deployments/mainnet/solcInputs/e1aa5651f7645b1641ef34120369a942.json b/packages/core/deployments/mainnet/solcInputs/e1aa5651f7645b1641ef34120369a942.json new file mode 100644 index 0000000000..ba21e467b8 --- /dev/null +++ b/packages/core/deployments/mainnet/solcInputs/e1aa5651f7645b1641ef34120369a942.json @@ -0,0 +1,905 @@ +{ + "language": "Solidity", + "sources": { + "@maticnetwork/fx-portal/contracts/lib/ExitPayloadReader.sol": { + "content": "pragma solidity ^0.8.0;\n\nimport {RLPReader} from \"./RLPReader.sol\";\n\nlibrary ExitPayloadReader {\n using RLPReader for bytes;\n using RLPReader for RLPReader.RLPItem;\n\n uint8 constant WORD_SIZE = 32;\n\n struct ExitPayload {\n RLPReader.RLPItem[] data;\n }\n\n struct Receipt {\n RLPReader.RLPItem[] data;\n bytes raw;\n uint256 logIndex;\n }\n\n struct Log {\n RLPReader.RLPItem data;\n RLPReader.RLPItem[] list;\n }\n\n struct LogTopics {\n RLPReader.RLPItem[] data;\n }\n\n // copy paste of private copy() from RLPReader to avoid changing of existing contracts\n function copy(\n uint256 src,\n uint256 dest,\n uint256 len\n ) private pure {\n if (len == 0) return;\n\n // copy as many word sizes as possible\n for (; len >= WORD_SIZE; len -= WORD_SIZE) {\n assembly {\n mstore(dest, mload(src))\n }\n\n src += WORD_SIZE;\n dest += WORD_SIZE;\n }\n \n if (len == 0) return;\n\n // left over bytes. Mask is used to remove unwanted bytes from the word\n uint256 mask = 256**(WORD_SIZE - len) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask)) // zero out src\n let destpart := and(mload(dest), mask) // retrieve the bytes\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n function toExitPayload(bytes memory data) internal pure returns (ExitPayload memory) {\n RLPReader.RLPItem[] memory payloadData = data.toRlpItem().toList();\n\n return ExitPayload(payloadData);\n }\n\n function getHeaderNumber(ExitPayload memory payload) internal pure returns (uint256) {\n return payload.data[0].toUint();\n }\n\n function getBlockProof(ExitPayload memory payload) internal pure returns (bytes memory) {\n return payload.data[1].toBytes();\n }\n\n function getBlockNumber(ExitPayload memory payload) internal pure returns (uint256) {\n return payload.data[2].toUint();\n }\n\n function getBlockTime(ExitPayload memory payload) internal pure returns (uint256) {\n return payload.data[3].toUint();\n }\n\n function getTxRoot(ExitPayload memory payload) internal pure returns (bytes32) {\n return bytes32(payload.data[4].toUint());\n }\n\n function getReceiptRoot(ExitPayload memory payload) internal pure returns (bytes32) {\n return bytes32(payload.data[5].toUint());\n }\n\n function getReceipt(ExitPayload memory payload) internal pure returns (Receipt memory receipt) {\n receipt.raw = payload.data[6].toBytes();\n RLPReader.RLPItem memory receiptItem = receipt.raw.toRlpItem();\n\n if (receiptItem.isList()) {\n // legacy tx\n receipt.data = receiptItem.toList();\n } else {\n // pop first byte before parsting receipt\n bytes memory typedBytes = receipt.raw;\n bytes memory result = new bytes(typedBytes.length - 1);\n uint256 srcPtr;\n uint256 destPtr;\n assembly {\n srcPtr := add(33, typedBytes)\n destPtr := add(0x20, result)\n }\n\n copy(srcPtr, destPtr, result.length);\n receipt.data = result.toRlpItem().toList();\n }\n\n receipt.logIndex = getReceiptLogIndex(payload);\n return receipt;\n }\n\n function getReceiptProof(ExitPayload memory payload) internal pure returns (bytes memory) {\n return payload.data[7].toBytes();\n }\n\n function getBranchMaskAsBytes(ExitPayload memory payload) internal pure returns (bytes memory) {\n return payload.data[8].toBytes();\n }\n\n function getBranchMaskAsUint(ExitPayload memory payload) internal pure returns (uint256) {\n return payload.data[8].toUint();\n }\n\n function getReceiptLogIndex(ExitPayload memory payload) internal pure returns (uint256) {\n return payload.data[9].toUint();\n }\n\n // Receipt methods\n function toBytes(Receipt memory receipt) internal pure returns (bytes memory) {\n return receipt.raw;\n }\n\n function getLog(Receipt memory receipt) internal pure returns (Log memory) {\n RLPReader.RLPItem memory logData = receipt.data[3].toList()[receipt.logIndex];\n return Log(logData, logData.toList());\n }\n\n // Log methods\n function getEmitter(Log memory log) internal pure returns (address) {\n return RLPReader.toAddress(log.list[0]);\n }\n\n function getTopics(Log memory log) internal pure returns (LogTopics memory) {\n return LogTopics(log.list[1].toList());\n }\n\n function getData(Log memory log) internal pure returns (bytes memory) {\n return log.list[2].toBytes();\n }\n\n function toRlpBytes(Log memory log) internal pure returns (bytes memory) {\n return log.data.toRlpBytes();\n }\n\n // LogTopics methods\n function getField(LogTopics memory topics, uint256 index) internal pure returns (RLPReader.RLPItem memory) {\n return topics.data[index];\n }\n}\n" + }, + "@maticnetwork/fx-portal/contracts/lib/Merkle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary Merkle {\n function checkMembership(\n bytes32 leaf,\n uint256 index,\n bytes32 rootHash,\n bytes memory proof\n ) internal pure returns (bool) {\n require(proof.length % 32 == 0, \"Invalid proof length\");\n uint256 proofHeight = proof.length / 32;\n // Proof of size n means, height of the tree is n+1.\n // In a tree of height n+1, max #leafs possible is 2 ^ n\n require(index < 2**proofHeight, \"Leaf index is too big\");\n\n bytes32 proofElement;\n bytes32 computedHash = leaf;\n for (uint256 i = 32; i <= proof.length; i += 32) {\n assembly {\n proofElement := mload(add(proof, i))\n }\n\n if (index % 2 == 0) {\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\n } else {\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\n }\n\n index = index / 2;\n }\n return computedHash == rootHash;\n }\n}\n" + }, + "@maticnetwork/fx-portal/contracts/lib/MerklePatriciaProof.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {RLPReader} from \"./RLPReader.sol\";\n\nlibrary MerklePatriciaProof {\n /*\n * @dev Verifies a merkle patricia proof.\n * @param value The terminating value in the trie.\n * @param encodedPath The path in the trie leading to value.\n * @param rlpParentNodes The rlp encoded stack of nodes.\n * @param root The root hash of the trie.\n * @return The boolean validity of the proof.\n */\n function verify(\n bytes memory value,\n bytes memory encodedPath,\n bytes memory rlpParentNodes,\n bytes32 root\n ) internal pure returns (bool) {\n RLPReader.RLPItem memory item = RLPReader.toRlpItem(rlpParentNodes);\n RLPReader.RLPItem[] memory parentNodes = RLPReader.toList(item);\n\n bytes memory currentNode;\n RLPReader.RLPItem[] memory currentNodeList;\n\n bytes32 nodeKey = root;\n uint256 pathPtr = 0;\n\n bytes memory path = _getNibbleArray(encodedPath);\n if (path.length == 0) {\n return false;\n }\n\n for (uint256 i = 0; i < parentNodes.length; i++) {\n if (pathPtr > path.length) {\n return false;\n }\n\n currentNode = RLPReader.toRlpBytes(parentNodes[i]);\n if (nodeKey != keccak256(currentNode)) {\n return false;\n }\n currentNodeList = RLPReader.toList(parentNodes[i]);\n\n if (currentNodeList.length == 17) {\n if (pathPtr == path.length) {\n if (keccak256(RLPReader.toBytes(currentNodeList[16])) == keccak256(value)) {\n return true;\n } else {\n return false;\n }\n }\n\n uint8 nextPathNibble = uint8(path[pathPtr]);\n if (nextPathNibble > 16) {\n return false;\n }\n nodeKey = bytes32(RLPReader.toUintStrict(currentNodeList[nextPathNibble]));\n pathPtr += 1;\n } else if (currentNodeList.length == 2) {\n uint256 traversed = _nibblesToTraverse(RLPReader.toBytes(currentNodeList[0]), path, pathPtr);\n if (pathPtr + traversed == path.length) {\n //leaf node\n if (keccak256(RLPReader.toBytes(currentNodeList[1])) == keccak256(value)) {\n return true;\n } else {\n return false;\n }\n }\n\n //extension node\n if (traversed == 0) {\n return false;\n }\n\n pathPtr += traversed;\n nodeKey = bytes32(RLPReader.toUintStrict(currentNodeList[1]));\n } else {\n return false;\n }\n }\n }\n\n function _nibblesToTraverse(\n bytes memory encodedPartialPath,\n bytes memory path,\n uint256 pathPtr\n ) private pure returns (uint256) {\n uint256 len = 0;\n // encodedPartialPath has elements that are each two hex characters (1 byte), but partialPath\n // and slicedPath have elements that are each one hex character (1 nibble)\n bytes memory partialPath = _getNibbleArray(encodedPartialPath);\n bytes memory slicedPath = new bytes(partialPath.length);\n\n // pathPtr counts nibbles in path\n // partialPath.length is a number of nibbles\n for (uint256 i = pathPtr; i < pathPtr + partialPath.length; i++) {\n bytes1 pathNibble = path[i];\n slicedPath[i - pathPtr] = pathNibble;\n }\n\n if (keccak256(partialPath) == keccak256(slicedPath)) {\n len = partialPath.length;\n } else {\n len = 0;\n }\n return len;\n }\n\n // bytes b must be hp encoded\n function _getNibbleArray(bytes memory b) internal pure returns (bytes memory) {\n bytes memory nibbles = \"\";\n if (b.length > 0) {\n uint8 offset;\n uint8 hpNibble = uint8(_getNthNibbleOfBytes(0, b));\n if (hpNibble == 1 || hpNibble == 3) {\n nibbles = new bytes(b.length * 2 - 1);\n bytes1 oddNibble = _getNthNibbleOfBytes(1, b);\n nibbles[0] = oddNibble;\n offset = 1;\n } else {\n nibbles = new bytes(b.length * 2 - 2);\n offset = 0;\n }\n\n for (uint256 i = offset; i < nibbles.length; i++) {\n nibbles[i] = _getNthNibbleOfBytes(i - offset + 2, b);\n }\n }\n return nibbles;\n }\n\n function _getNthNibbleOfBytes(uint256 n, bytes memory str) private pure returns (bytes1) {\n return bytes1(n % 2 == 0 ? uint8(str[n / 2]) / 0x10 : uint8(str[n / 2]) % 0x10);\n }\n}\n" + }, + "@maticnetwork/fx-portal/contracts/lib/RLPReader.sol": { + "content": "/*\n * @author Hamdi Allam hamdi.allam97@gmail.com\n * Please reach out with any questions or concerns\n */\npragma solidity ^0.8.0;\n\nlibrary RLPReader {\n uint8 constant STRING_SHORT_START = 0x80;\n uint8 constant STRING_LONG_START = 0xb8;\n uint8 constant LIST_SHORT_START = 0xc0;\n uint8 constant LIST_LONG_START = 0xf8;\n uint8 constant WORD_SIZE = 32;\n\n struct RLPItem {\n uint256 len;\n uint256 memPtr;\n }\n\n struct Iterator {\n RLPItem item; // Item that's being iterated over.\n uint256 nextPtr; // Position of the next item in the list.\n }\n\n /*\n * @dev Returns the next element in the iteration. Reverts if it has not next element.\n * @param self The iterator.\n * @return The next element in the iteration.\n */\n function next(Iterator memory self) internal pure returns (RLPItem memory) {\n require(hasNext(self));\n\n uint256 ptr = self.nextPtr;\n uint256 itemLength = _itemLength(ptr);\n self.nextPtr = ptr + itemLength;\n\n return RLPItem(itemLength, ptr);\n }\n\n /*\n * @dev Returns true if the iteration has more elements.\n * @param self The iterator.\n * @return true if the iteration has more elements.\n */\n function hasNext(Iterator memory self) internal pure returns (bool) {\n RLPItem memory item = self.item;\n return self.nextPtr < item.memPtr + item.len;\n }\n\n /*\n * @param item RLP encoded bytes\n */\n function toRlpItem(bytes memory item) internal pure returns (RLPItem memory) {\n uint256 memPtr;\n assembly {\n memPtr := add(item, 0x20)\n }\n\n return RLPItem(item.length, memPtr);\n }\n\n /*\n * @dev Create an iterator. Reverts if item is not a list.\n * @param self The RLP item.\n * @return An 'Iterator' over the item.\n */\n function iterator(RLPItem memory self) internal pure returns (Iterator memory) {\n require(isList(self));\n\n uint256 ptr = self.memPtr + _payloadOffset(self.memPtr);\n return Iterator(self, ptr);\n }\n\n /*\n * @param item RLP encoded bytes\n */\n function rlpLen(RLPItem memory item) internal pure returns (uint256) {\n return item.len;\n }\n\n /*\n * @param item RLP encoded bytes\n */\n function payloadLen(RLPItem memory item) internal pure returns (uint256) {\n return item.len - _payloadOffset(item.memPtr);\n }\n\n /*\n * @param item RLP encoded list in bytes\n */\n function toList(RLPItem memory item) internal pure returns (RLPItem[] memory) {\n require(isList(item));\n\n uint256 items = numItems(item);\n RLPItem[] memory result = new RLPItem[](items);\n\n uint256 memPtr = item.memPtr + _payloadOffset(item.memPtr);\n uint256 dataLen;\n for (uint256 i = 0; i < items; i++) {\n dataLen = _itemLength(memPtr);\n result[i] = RLPItem(dataLen, memPtr);\n memPtr = memPtr + dataLen;\n }\n\n return result;\n }\n\n // @return indicator whether encoded payload is a list. negate this function call for isData.\n function isList(RLPItem memory item) internal pure returns (bool) {\n if (item.len == 0) return false;\n\n uint8 byte0;\n uint256 memPtr = item.memPtr;\n assembly {\n byte0 := byte(0, mload(memPtr))\n }\n\n if (byte0 < LIST_SHORT_START) return false;\n return true;\n }\n\n /*\n * @dev A cheaper version of keccak256(toRlpBytes(item)) that avoids copying memory.\n * @return keccak256 hash of RLP encoded bytes.\n */\n function rlpBytesKeccak256(RLPItem memory item) internal pure returns (bytes32) {\n uint256 ptr = item.memPtr;\n uint256 len = item.len;\n bytes32 result;\n assembly {\n result := keccak256(ptr, len)\n }\n return result;\n }\n\n function payloadLocation(RLPItem memory item) internal pure returns (uint256, uint256) {\n uint256 offset = _payloadOffset(item.memPtr);\n uint256 memPtr = item.memPtr + offset;\n uint256 len = item.len - offset; // data length\n return (memPtr, len);\n }\n\n /*\n * @dev A cheaper version of keccak256(toBytes(item)) that avoids copying memory.\n * @return keccak256 hash of the item payload.\n */\n function payloadKeccak256(RLPItem memory item) internal pure returns (bytes32) {\n (uint256 memPtr, uint256 len) = payloadLocation(item);\n bytes32 result;\n assembly {\n result := keccak256(memPtr, len)\n }\n return result;\n }\n\n /** RLPItem conversions into data types **/\n\n // @returns raw rlp encoding in bytes\n function toRlpBytes(RLPItem memory item) internal pure returns (bytes memory) {\n bytes memory result = new bytes(item.len);\n if (result.length == 0) return result;\n\n uint256 ptr;\n assembly {\n ptr := add(0x20, result)\n }\n\n copy(item.memPtr, ptr, item.len);\n return result;\n }\n\n // any non-zero byte is considered true\n function toBoolean(RLPItem memory item) internal pure returns (bool) {\n require(item.len == 1);\n uint256 result;\n uint256 memPtr = item.memPtr;\n assembly {\n result := byte(0, mload(memPtr))\n }\n\n return result == 0 ? false : true;\n }\n\n function toAddress(RLPItem memory item) internal pure returns (address) {\n // 1 byte for the length prefix\n require(item.len == 21);\n\n return address(uint160(toUint(item)));\n }\n\n function toUint(RLPItem memory item) internal pure returns (uint256) {\n require(item.len > 0 && item.len <= 33);\n\n uint256 offset = _payloadOffset(item.memPtr);\n uint256 len = item.len - offset;\n\n uint256 result;\n uint256 memPtr = item.memPtr + offset;\n assembly {\n result := mload(memPtr)\n\n // shfit to the correct location if neccesary\n if lt(len, 32) {\n result := div(result, exp(256, sub(32, len)))\n }\n }\n\n return result;\n }\n\n // enforces 32 byte length\n function toUintStrict(RLPItem memory item) internal pure returns (uint256) {\n // one byte prefix\n require(item.len == 33);\n\n uint256 result;\n uint256 memPtr = item.memPtr + 1;\n assembly {\n result := mload(memPtr)\n }\n\n return result;\n }\n\n function toBytes(RLPItem memory item) internal pure returns (bytes memory) {\n require(item.len > 0);\n\n uint256 offset = _payloadOffset(item.memPtr);\n uint256 len = item.len - offset; // data length\n bytes memory result = new bytes(len);\n\n uint256 destPtr;\n assembly {\n destPtr := add(0x20, result)\n }\n\n copy(item.memPtr + offset, destPtr, len);\n return result;\n }\n\n /*\n * Private Helpers\n */\n\n // @return number of payload items inside an encoded list.\n function numItems(RLPItem memory item) private pure returns (uint256) {\n if (item.len == 0) return 0;\n\n uint256 count = 0;\n uint256 currPtr = item.memPtr + _payloadOffset(item.memPtr);\n uint256 endPtr = item.memPtr + item.len;\n while (currPtr < endPtr) {\n currPtr = currPtr + _itemLength(currPtr); // skip over an item\n count++;\n }\n\n return count;\n }\n\n // @return entire rlp item byte length\n function _itemLength(uint256 memPtr) private pure returns (uint256) {\n uint256 itemLen;\n uint256 byte0;\n assembly {\n byte0 := byte(0, mload(memPtr))\n }\n\n if (byte0 < STRING_SHORT_START) itemLen = 1;\n else if (byte0 < STRING_LONG_START) itemLen = byte0 - STRING_SHORT_START + 1;\n else if (byte0 < LIST_SHORT_START) {\n assembly {\n let byteLen := sub(byte0, 0xb7) // # of bytes the actual length is\n memPtr := add(memPtr, 1) // skip over the first byte\n /* 32 byte word size */\n let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to get the len\n itemLen := add(dataLen, add(byteLen, 1))\n }\n } else if (byte0 < LIST_LONG_START) {\n itemLen = byte0 - LIST_SHORT_START + 1;\n } else {\n assembly {\n let byteLen := sub(byte0, 0xf7)\n memPtr := add(memPtr, 1)\n\n let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to the correct length\n itemLen := add(dataLen, add(byteLen, 1))\n }\n }\n\n return itemLen;\n }\n\n // @return number of bytes until the data\n function _payloadOffset(uint256 memPtr) private pure returns (uint256) {\n uint256 byte0;\n assembly {\n byte0 := byte(0, mload(memPtr))\n }\n\n if (byte0 < STRING_SHORT_START) return 0;\n else if (byte0 < STRING_LONG_START || (byte0 >= LIST_SHORT_START && byte0 < LIST_LONG_START)) return 1;\n else if (byte0 < LIST_SHORT_START)\n // being explicit\n return byte0 - (STRING_LONG_START - 1) + 1;\n else return byte0 - (LIST_LONG_START - 1) + 1;\n }\n\n /*\n * @param src Pointer to source\n * @param dest Pointer to destination\n * @param len Amount of memory to copy from the source\n */\n function copy(\n uint256 src,\n uint256 dest,\n uint256 len\n ) private pure {\n if (len == 0) return;\n\n // copy as many word sizes as possible\n for (; len >= WORD_SIZE; len -= WORD_SIZE) {\n assembly {\n mstore(dest, mload(src))\n }\n\n src += WORD_SIZE;\n dest += WORD_SIZE;\n }\n\n if (len == 0) return;\n\n // left over bytes. Mask is used to remove unwanted bytes from the word\n uint256 mask = 256**(WORD_SIZE - len) - 1;\n\n assembly {\n let srcpart := and(mload(src), not(mask)) // zero out src\n let destpart := and(mload(dest), mask) // retrieve the bytes\n mstore(dest, or(destpart, srcpart))\n }\n }\n}\n" + }, + "@maticnetwork/fx-portal/contracts/tunnel/FxBaseChildTunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n// IFxMessageProcessor represents interface to process message\ninterface IFxMessageProcessor {\n function processMessageFromRoot(\n uint256 stateId,\n address rootMessageSender,\n bytes calldata data\n ) external;\n}\n\n/**\n * @notice Mock child tunnel contract to receive and send message from L2\n */\nabstract contract FxBaseChildTunnel is IFxMessageProcessor {\n // MessageTunnel on L1 will get data from this event\n event MessageSent(bytes message);\n\n // fx child\n address public fxChild;\n\n // fx root tunnel\n address public fxRootTunnel;\n\n constructor(address _fxChild) {\n fxChild = _fxChild;\n }\n\n // Sender must be fxRootTunnel in case of ERC20 tunnel\n modifier validateSender(address sender) {\n require(sender == fxRootTunnel, \"FxBaseChildTunnel: INVALID_SENDER_FROM_ROOT\");\n _;\n }\n\n // set fxRootTunnel if not set already\n function setFxRootTunnel(address _fxRootTunnel) external virtual {\n require(fxRootTunnel == address(0x0), \"FxBaseChildTunnel: ROOT_TUNNEL_ALREADY_SET\");\n fxRootTunnel = _fxRootTunnel;\n }\n\n function processMessageFromRoot(\n uint256 stateId,\n address rootMessageSender,\n bytes calldata data\n ) external override {\n require(msg.sender == fxChild, \"FxBaseChildTunnel: INVALID_SENDER\");\n _processMessageFromRoot(stateId, rootMessageSender, data);\n }\n\n /**\n * @notice Emit message that can be received on Root Tunnel\n * @dev Call the internal function when need to emit message\n * @param message bytes message that will be sent to Root Tunnel\n * some message examples -\n * abi.encode(tokenId);\n * abi.encode(tokenId, tokenMetadata);\n * abi.encode(messageType, messageData);\n */\n function _sendMessageToRoot(bytes memory message) internal {\n emit MessageSent(message);\n }\n\n /**\n * @notice Process message received from Root Tunnel\n * @dev function needs to be implemented to handle message as per requirement\n * This is called by onStateReceive function.\n * Since it is called via a system call, any event will not be emitted during its execution.\n * @param stateId unique state id\n * @param sender root message sender\n * @param message bytes message that was sent from Root Tunnel\n */\n function _processMessageFromRoot(\n uint256 stateId,\n address sender,\n bytes memory message\n ) internal virtual;\n}\n" + }, + "@maticnetwork/fx-portal/contracts/tunnel/FxBaseRootTunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {RLPReader} from \"../lib/RLPReader.sol\";\nimport {MerklePatriciaProof} from \"../lib/MerklePatriciaProof.sol\";\nimport {Merkle} from \"../lib/Merkle.sol\";\nimport \"../lib/ExitPayloadReader.sol\";\n\ninterface IFxStateSender {\n function sendMessageToChild(address _receiver, bytes calldata _data) external;\n}\n\ncontract ICheckpointManager {\n struct HeaderBlock {\n bytes32 root;\n uint256 start;\n uint256 end;\n uint256 createdAt;\n address proposer;\n }\n\n /**\n * @notice mapping of checkpoint header numbers to block details\n * @dev These checkpoints are submited by plasma contracts\n */\n mapping(uint256 => HeaderBlock) public headerBlocks;\n}\n\nabstract contract FxBaseRootTunnel {\n using RLPReader for RLPReader.RLPItem;\n using Merkle for bytes32;\n using ExitPayloadReader for bytes;\n using ExitPayloadReader for ExitPayloadReader.ExitPayload;\n using ExitPayloadReader for ExitPayloadReader.Log;\n using ExitPayloadReader for ExitPayloadReader.LogTopics;\n using ExitPayloadReader for ExitPayloadReader.Receipt;\n\n // keccak256(MessageSent(bytes))\n bytes32 public constant SEND_MESSAGE_EVENT_SIG = 0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036;\n\n // state sender contract\n IFxStateSender public fxRoot;\n // root chain manager\n ICheckpointManager public checkpointManager;\n // child tunnel contract which receives and sends messages\n address public fxChildTunnel;\n\n // storage to avoid duplicate exits\n mapping(bytes32 => bool) public processedExits;\n\n constructor(address _checkpointManager, address _fxRoot) {\n checkpointManager = ICheckpointManager(_checkpointManager);\n fxRoot = IFxStateSender(_fxRoot);\n }\n\n // set fxChildTunnel if not set already\n function setFxChildTunnel(address _fxChildTunnel) public virtual {\n require(fxChildTunnel == address(0x0), \"FxBaseRootTunnel: CHILD_TUNNEL_ALREADY_SET\");\n fxChildTunnel = _fxChildTunnel;\n }\n\n /**\n * @notice Send bytes message to Child Tunnel\n * @param message bytes message that will be sent to Child Tunnel\n * some message examples -\n * abi.encode(tokenId);\n * abi.encode(tokenId, tokenMetadata);\n * abi.encode(messageType, messageData);\n */\n function _sendMessageToChild(bytes memory message) internal {\n fxRoot.sendMessageToChild(fxChildTunnel, message);\n }\n\n function _validateAndExtractMessage(bytes memory inputData) internal returns (bytes memory) {\n ExitPayloadReader.ExitPayload memory payload = inputData.toExitPayload();\n\n bytes memory branchMaskBytes = payload.getBranchMaskAsBytes();\n uint256 blockNumber = payload.getBlockNumber();\n // checking if exit has already been processed\n // unique exit is identified using hash of (blockNumber, branchMask, receiptLogIndex)\n bytes32 exitHash = keccak256(\n abi.encodePacked(\n blockNumber,\n // first 2 nibbles are dropped while generating nibble array\n // this allows branch masks that are valid but bypass exitHash check (changing first 2 nibbles only)\n // so converting to nibble array and then hashing it\n MerklePatriciaProof._getNibbleArray(branchMaskBytes),\n payload.getReceiptLogIndex()\n )\n );\n require(processedExits[exitHash] == false, \"FxRootTunnel: EXIT_ALREADY_PROCESSED\");\n processedExits[exitHash] = true;\n\n ExitPayloadReader.Receipt memory receipt = payload.getReceipt();\n ExitPayloadReader.Log memory log = receipt.getLog();\n\n // check child tunnel\n require(fxChildTunnel == log.getEmitter(), \"FxRootTunnel: INVALID_FX_CHILD_TUNNEL\");\n\n bytes32 receiptRoot = payload.getReceiptRoot();\n // verify receipt inclusion\n require(\n MerklePatriciaProof.verify(receipt.toBytes(), branchMaskBytes, payload.getReceiptProof(), receiptRoot),\n \"FxRootTunnel: INVALID_RECEIPT_PROOF\"\n );\n\n // verify checkpoint inclusion\n _checkBlockMembershipInCheckpoint(\n blockNumber,\n payload.getBlockTime(),\n payload.getTxRoot(),\n receiptRoot,\n payload.getHeaderNumber(),\n payload.getBlockProof()\n );\n\n ExitPayloadReader.LogTopics memory topics = log.getTopics();\n\n require(\n bytes32(topics.getField(0).toUint()) == SEND_MESSAGE_EVENT_SIG, // topic0 is event sig\n \"FxRootTunnel: INVALID_SIGNATURE\"\n );\n\n // received message data\n bytes memory message = abi.decode(log.getData(), (bytes)); // event decodes params again, so decoding bytes to get message\n return message;\n }\n\n function _checkBlockMembershipInCheckpoint(\n uint256 blockNumber,\n uint256 blockTime,\n bytes32 txRoot,\n bytes32 receiptRoot,\n uint256 headerNumber,\n bytes memory blockProof\n ) private view returns (uint256) {\n (bytes32 headerRoot, uint256 startBlock, , uint256 createdAt, ) = checkpointManager.headerBlocks(headerNumber);\n\n require(\n keccak256(abi.encodePacked(blockNumber, blockTime, txRoot, receiptRoot)).checkMembership(\n blockNumber - startBlock,\n headerRoot,\n blockProof\n ),\n \"FxRootTunnel: INVALID_HEADER\"\n );\n return createdAt;\n }\n\n /**\n * @notice receive message from L2 to L1, validated by proof\n * @dev This function verifies if the transaction actually happened on child chain\n *\n * @param inputData RLP encoded data of the reference tx containing following list of fields\n * 0 - headerNumber - Checkpoint header block number containing the reference tx\n * 1 - blockProof - Proof that the block header (in the child chain) is a leaf in the submitted merkle root\n * 2 - blockNumber - Block number containing the reference tx on child chain\n * 3 - blockTime - Reference tx block time\n * 4 - txRoot - Transactions root of block\n * 5 - receiptRoot - Receipts root of block\n * 6 - receipt - Receipt of the reference transaction\n * 7 - receiptProof - Merkle proof of the reference receipt\n * 8 - branchMask - 32 bits denoting the path of receipt in merkle tree\n * 9 - receiptLogIndex - Log Index to read from the receipt\n */\n function receiveMessage(bytes memory inputData) public virtual {\n bytes memory message = _validateAndExtractMessage(inputData);\n _processMessageFromChild(message);\n }\n\n /**\n * @notice Process message received from Child Tunnel\n * @dev function needs to be implemented to handle message as per requirement\n * This is called by onStateReceive function.\n * Since it is called via a system call, any event will not be emitted during its execution.\n * @param message bytes message that was sent from Child Tunnel\n */\n function _processMessageFromChild(bytes memory message) internal virtual;\n}\n" + }, + "@openzeppelin/contracts-0.8/access/AccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role, _msgSender());\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(uint160(account), 20),\n \" is missing role \",\n Strings.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/access/AccessControlEnumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/AccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlEnumerable.sol\";\nimport \"./AccessControl.sol\";\nimport \"../utils/structs/EnumerableSet.sol\";\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view override returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view override returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override {\n super._grantRole(role, account);\n _roleMembers[role].add(account);\n }\n\n /**\n * @dev Overload {_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override {\n super._revokeRole(role, account);\n _roleMembers[role].remove(account);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/access/IAccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts-0.8/access/IAccessControlEnumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-0.8/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/security/Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n constructor() {\n _paused = false;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n require(!paused(), \"Pausable: paused\");\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n require(paused(), \"Pausable: not paused\");\n _;\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC1155/ERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC1155.sol\";\nimport \"./IERC1155Receiver.sol\";\nimport \"./extensions/IERC1155MetadataURI.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of the basic standard multi-token.\n * See https://eips.ethereum.org/EIPS/eip-1155\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\n *\n * _Available since v3.1._\n */\ncontract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n\n // Mapping from token ID to account balances\n mapping(uint256 => mapping(address => uint256)) private _balances;\n\n // Mapping from account to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json\n string private _uri;\n\n /**\n * @dev See {_setURI}.\n */\n constructor(string memory uri_) {\n _setURI(uri_);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155MetadataURI-uri}.\n *\n * This implementation returns the same URI for *all* token types. It relies\n * on the token type ID substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * Clients calling this function must replace the `\\{id\\}` substring with the\n * actual token type ID.\n */\n function uri(uint256) public view virtual override returns (string memory) {\n return _uri;\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {\n require(account != address(0), \"ERC1155: balance query for the zero address\");\n return _balances[id][account];\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] memory accounts, uint256[] memory ids)\n public\n view\n virtual\n override\n returns (uint256[] memory)\n {\n require(accounts.length == ids.length, \"ERC1155: accounts and ids length mismatch\");\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not owner nor approved\"\n );\n _safeTransferFrom(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n _safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n\n emit TransferSingle(operator, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n }\n\n emit TransferBatch(operator, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);\n }\n\n /**\n * @dev Sets a new URI for all token types, by relying on the token type ID\n * substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * By this mechanism, any occurrence of the `\\{id\\}` substring in either the\n * URI or any of the amounts in the JSON file at said URI will be replaced by\n * clients with the token type ID.\n *\n * For example, the `https://token-cdn-domain/\\{id\\}.json` URI would be\n * interpreted by clients as\n * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\n * for token type ID 0x4cce0.\n *\n * See {uri}.\n *\n * Because these URIs cannot be meaningfully represented by the {URI} event,\n * this function emits no events.\n */\n function _setURI(string memory newuri) internal virtual {\n _uri = newuri;\n }\n\n /**\n * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _mint(\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data);\n\n _balances[id][to] += amount;\n emit TransferSingle(operator, address(0), to, id, amount);\n\n _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; i++) {\n _balances[ids[i]][to] += amounts[i];\n }\n\n emit TransferBatch(operator, address(0), to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);\n }\n\n /**\n * @dev Destroys `amount` tokens of token type `id` from `from`\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `from` must have at least `amount` tokens of token type `id`.\n */\n function _burn(\n address from,\n uint256 id,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, address(0), _asSingletonArray(id), _asSingletonArray(amount), \"\");\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n\n emit TransferSingle(operator, from, address(0), id, amount);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n */\n function _burnBatch(\n address from,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n for (uint256 i = 0; i < ids.length; i++) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n }\n\n emit TransferBatch(operator, from, address(0), ids, amounts);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits a {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC1155: setting approval status for self\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `id` and `amount` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {\n if (response != IERC1155Receiver.onERC1155Received.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (\n bytes4 response\n ) {\n if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {\n uint256[] memory array = new uint256[](1);\n array[0] = element;\n\n return array;\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC1155/extensions/ERC1155Burnable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155.sol\";\n\n/**\n * @dev Extension of {ERC1155} that allows token holders to destroy both their\n * own tokens and those that they have been approved to use.\n *\n * _Available since v3.1._\n */\nabstract contract ERC1155Burnable is ERC1155 {\n function burn(\n address account,\n uint256 id,\n uint256 value\n ) public virtual {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _burn(account, id, value);\n }\n\n function burnBatch(\n address account,\n uint256[] memory ids,\n uint256[] memory values\n ) public virtual {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _burnBatch(account, ids, values);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC1155/extensions/ERC1155Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155.sol\";\nimport \"../../../security/Pausable.sol\";\n\n/**\n * @dev ERC1155 token with pausable token transfers, minting and burning.\n *\n * Useful for scenarios such as preventing trades until the end of an evaluation\n * period, or having an emergency switch for freezing all token transfers in the\n * event of a large bug.\n *\n * _Available since v3.1._\n */\nabstract contract ERC1155Pausable is ERC1155, Pausable {\n /**\n * @dev See {ERC1155-_beforeTokenTransfer}.\n *\n * Requirements:\n *\n * - the contract must not be paused.\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n require(!paused(), \"ERC1155Pausable: token transfer while paused\");\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n @dev Handles the receipt of a single ERC1155 token type. This function is\n called at the end of a `safeTransferFrom` after the balance has been updated.\n To accept the transfer, this must return\n `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n (i.e. 0xf23a6e61, or its own function selector).\n @param operator The address which initiated the transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param id The ID of the token being transferred\n @param value The amount of tokens being transferred\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n @dev Handles the receipt of a multiple ERC1155 token types. This function\n is called at the end of a `safeBatchTransferFrom` after the balances have\n been updated. To accept the transfer(s), this must return\n `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n (i.e. 0xbc197c81, or its own function selector).\n @param operator The address which initiated the batch transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param ids An array containing ids of each token being transferred (order and length must match values array)\n @param values An array containing amounts of each token being transferred (order and length must match ids array)\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC1155/presets/ERC1155PresetMinterPauser.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/presets/ERC1155PresetMinterPauser.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155.sol\";\nimport \"../extensions/ERC1155Burnable.sol\";\nimport \"../extensions/ERC1155Pausable.sol\";\nimport \"../../../access/AccessControlEnumerable.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @dev {ERC1155} token, including:\n *\n * - ability for holders to burn (destroy) their tokens\n * - a minter role that allows for token minting (creation)\n * - a pauser role that allows to stop all token transfers\n *\n * This contract uses {AccessControl} to lock permissioned functions using the\n * different roles - head to its documentation for details.\n *\n * The account that deploys the contract will be granted the minter and pauser\n * roles, as well as the default admin role, which will let it grant both minter\n * and pauser roles to other accounts.\n */\ncontract ERC1155PresetMinterPauser is Context, AccessControlEnumerable, ERC1155Burnable, ERC1155Pausable {\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant PAUSER_ROLE = keccak256(\"PAUSER_ROLE\");\n\n /**\n * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE`, and `PAUSER_ROLE` to the account that\n * deploys the contract.\n */\n constructor(string memory uri) ERC1155(uri) {\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n\n _setupRole(MINTER_ROLE, _msgSender());\n _setupRole(PAUSER_ROLE, _msgSender());\n }\n\n /**\n * @dev Creates `amount` new tokens for `to`, of token type `id`.\n *\n * See {ERC1155-_mint}.\n *\n * Requirements:\n *\n * - the caller must have the `MINTER_ROLE`.\n */\n function mint(\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual {\n require(hasRole(MINTER_ROLE, _msgSender()), \"ERC1155PresetMinterPauser: must have minter role to mint\");\n\n _mint(to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] variant of {mint}.\n */\n function mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual {\n require(hasRole(MINTER_ROLE, _msgSender()), \"ERC1155PresetMinterPauser: must have minter role to mint\");\n\n _mintBatch(to, ids, amounts, data);\n }\n\n /**\n * @dev Pauses all token transfers.\n *\n * See {ERC1155Pausable} and {Pausable-_pause}.\n *\n * Requirements:\n *\n * - the caller must have the `PAUSER_ROLE`.\n */\n function pause() public virtual {\n require(hasRole(PAUSER_ROLE, _msgSender()), \"ERC1155PresetMinterPauser: must have pauser role to pause\");\n _pause();\n }\n\n /**\n * @dev Unpauses all token transfers.\n *\n * See {ERC1155Pausable} and {Pausable-_unpause}.\n *\n * Requirements:\n *\n * - the caller must have the `PAUSER_ROLE`.\n */\n function unpause() public virtual {\n require(hasRole(PAUSER_ROLE, _msgSender()), \"ERC1155PresetMinterPauser: must have pauser role to unpause\");\n _unpause();\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(AccessControlEnumerable, ERC1155)\n returns (bool)\n {\n return super.supportsInterface(interfaceId);\n }\n\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override(ERC1155, ERC1155Pausable) {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC1155/utils/ERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Receiver.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: balance query for the zero address\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"ERC721: owner query for nonexistent token\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n require(_exists(tokenId), \"ERC721Metadata: URI query for nonexistent token\");\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overriden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n require(_exists(tokenId), \"ERC721: approved query for nonexistent token\");\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n _safeTransfer(from, to, tokenId, _data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `_data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, _data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n require(_exists(tokenId), \"ERC721: operator query for nonexistent token\");\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, _data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Clear approvals\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer of token that is not own\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits a {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits a {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param _data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC721/extensions/ERC721Burnable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @title ERC721 Burnable Token\n * @dev ERC721 Token that can be irreversibly burned (destroyed).\n */\nabstract contract ERC721Burnable is Context, ERC721 {\n /**\n * @dev Burns `tokenId`. See {ERC721-_burn}.\n *\n * Requirements:\n *\n * - The caller must own `tokenId` or be an approved operator.\n */\n function burn(uint256 tokenId) public virtual {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721Burnable: caller is not owner nor approved\");\n _burn(tokenId);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC721/extensions/ERC721Enumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721.sol\";\nimport \"./IERC721Enumerable.sol\";\n\n/**\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\n * enumerability of all the token ids in the contract as well as all token ids owned by each\n * account.\n */\nabstract contract ERC721Enumerable is ERC721, IERC721Enumerable {\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {\n return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721.balanceOf(owner), \"ERC721Enumerable: owner index out of bounds\");\n return _ownedTokens[owner][index];\n }\n\n /**\n * @dev See {IERC721Enumerable-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721Enumerable.totalSupply(), \"ERC721Enumerable: global index out of bounds\");\n return _allTokens[index];\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, tokenId);\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = ERC721.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n }\n\n // This also deletes the contents at the last position of the array\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\n */\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = _allTokens.length - 1;\n uint256 tokenIndex = _allTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\n uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n\n // This also deletes the contents at the last position of the array\n delete _allTokensIndex[tokenId];\n _allTokens.pop();\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC721/extensions/ERC721Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721.sol\";\nimport \"../../../security/Pausable.sol\";\n\n/**\n * @dev ERC721 token with pausable token transfers, minting and burning.\n *\n * Useful for scenarios such as preventing trades until the end of an evaluation\n * period, or having an emergency switch for freezing all token transfers in the\n * event of a large bug.\n */\nabstract contract ERC721Pausable is ERC721, Pausable {\n /**\n * @dev See {ERC721-_beforeTokenTransfer}.\n *\n * Requirements:\n *\n * - the contract must not be paused.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, tokenId);\n\n require(!paused(), \"ERC721Pausable: token transfer while paused\");\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC721/extensions/IERC721Enumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Enumerable is IERC721 {\n /**\n * @dev Returns the total amount of tokens stored by the contract.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);\n\n /**\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n * Use along with {totalSupply} to enumerate all tokens.\n */\n function tokenByIndex(uint256 index) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC721/presets/ERC721PresetMinterPauserAutoId.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/presets/ERC721PresetMinterPauserAutoId.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721.sol\";\nimport \"../extensions/ERC721Enumerable.sol\";\nimport \"../extensions/ERC721Burnable.sol\";\nimport \"../extensions/ERC721Pausable.sol\";\nimport \"../../../access/AccessControlEnumerable.sol\";\nimport \"../../../utils/Context.sol\";\nimport \"../../../utils/Counters.sol\";\n\n/**\n * @dev {ERC721} token, including:\n *\n * - ability for holders to burn (destroy) their tokens\n * - a minter role that allows for token minting (creation)\n * - a pauser role that allows to stop all token transfers\n * - token ID and URI autogeneration\n *\n * This contract uses {AccessControl} to lock permissioned functions using the\n * different roles - head to its documentation for details.\n *\n * The account that deploys the contract will be granted the minter and pauser\n * roles, as well as the default admin role, which will let it grant both minter\n * and pauser roles to other accounts.\n */\ncontract ERC721PresetMinterPauserAutoId is\n Context,\n AccessControlEnumerable,\n ERC721Enumerable,\n ERC721Burnable,\n ERC721Pausable\n{\n using Counters for Counters.Counter;\n\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant PAUSER_ROLE = keccak256(\"PAUSER_ROLE\");\n\n Counters.Counter private _tokenIdTracker;\n\n string private _baseTokenURI;\n\n /**\n * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the\n * account that deploys the contract.\n *\n * Token URIs will be autogenerated based on `baseURI` and their token IDs.\n * See {ERC721-tokenURI}.\n */\n constructor(\n string memory name,\n string memory symbol,\n string memory baseTokenURI\n ) ERC721(name, symbol) {\n _baseTokenURI = baseTokenURI;\n\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n\n _setupRole(MINTER_ROLE, _msgSender());\n _setupRole(PAUSER_ROLE, _msgSender());\n }\n\n function _baseURI() internal view virtual override returns (string memory) {\n return _baseTokenURI;\n }\n\n /**\n * @dev Creates a new token for `to`. Its token ID will be automatically\n * assigned (and available on the emitted {IERC721-Transfer} event), and the token\n * URI autogenerated based on the base URI passed at construction.\n *\n * See {ERC721-_mint}.\n *\n * Requirements:\n *\n * - the caller must have the `MINTER_ROLE`.\n */\n function mint(address to) public virtual {\n require(hasRole(MINTER_ROLE, _msgSender()), \"ERC721PresetMinterPauserAutoId: must have minter role to mint\");\n\n // We cannot just use balanceOf to create the new tokenId because tokens\n // can be burned (destroyed), so we need a separate counter.\n _mint(to, _tokenIdTracker.current());\n _tokenIdTracker.increment();\n }\n\n /**\n * @dev Pauses all token transfers.\n *\n * See {ERC721Pausable} and {Pausable-_pause}.\n *\n * Requirements:\n *\n * - the caller must have the `PAUSER_ROLE`.\n */\n function pause() public virtual {\n require(hasRole(PAUSER_ROLE, _msgSender()), \"ERC721PresetMinterPauserAutoId: must have pauser role to pause\");\n _pause();\n }\n\n /**\n * @dev Unpauses all token transfers.\n *\n * See {ERC721Pausable} and {Pausable-_unpause}.\n *\n * Requirements:\n *\n * - the caller must have the `PAUSER_ROLE`.\n */\n function unpause() public virtual {\n require(hasRole(PAUSER_ROLE, _msgSender()), \"ERC721PresetMinterPauserAutoId: must have pauser role to unpause\");\n _unpause();\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual override(ERC721, ERC721Enumerable, ERC721Pausable) {\n super._beforeTokenTransfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(AccessControlEnumerable, ERC721, ERC721Enumerable)\n returns (bool)\n {\n return super.supportsInterface(interfaceId);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/Counters.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary Counters {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/cryptography/draft-EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712 {\n /* solhint-disable var-name-mixedcase */\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n // invalidate the cached domain separator if the chain id changes.\n bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;\n uint256 private immutable _CACHED_CHAIN_ID;\n address private immutable _CACHED_THIS;\n\n bytes32 private immutable _HASHED_NAME;\n bytes32 private immutable _HASHED_VERSION;\n bytes32 private immutable _TYPE_HASH;\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n constructor(string memory name, string memory version) {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n bytes32 typeHash = keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n );\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n _CACHED_CHAIN_ID = block.chainid;\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n _CACHED_THIS = address(this);\n _TYPE_HASH = typeHash;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\n return _CACHED_DOMAIN_SEPARATOR;\n } else {\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n }\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s;\n uint8 v;\n assembly {\n s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\n v := add(shr(255, vs), 27)\n }\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/cryptography/MerkleProof.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Trees proofs.\n *\n * The proofs can be generated using the JavaScript library\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\n *\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n if (computedHash <= proofElement) {\n // Hash(current computed hash + current element of the proof)\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\n } else {\n // Hash(current element of the proof + current computed hash)\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\n }\n }\n return computedHash;\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n function __AccessControl_init() internal onlyInitializing {\n __Context_init_unchained();\n __ERC165_init_unchained();\n __AccessControl_init_unchained();\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\n }\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role, _msgSender());\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(uint160(account), 20),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Context_init_unchained();\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/metatx/ERC2771ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (metatx/ERC2771Context.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Context variant with ERC2771 support.\n */\nabstract contract ERC2771ContextUpgradeable is Initializable, ContextUpgradeable {\n address private _trustedForwarder;\n\n function __ERC2771Context_init(address trustedForwarder) internal onlyInitializing {\n __Context_init_unchained();\n __ERC2771Context_init_unchained(trustedForwarder);\n }\n\n function __ERC2771Context_init_unchained(address trustedForwarder) internal onlyInitializing {\n _trustedForwarder = trustedForwarder;\n }\n\n function isTrustedForwarder(address forwarder) public view virtual returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n function _msgSender() internal view virtual override returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return super._msgSender();\n }\n }\n\n function _msgData() internal view virtual override returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender)) {\n return msg.data[:msg.data.length - 20];\n } else {\n return super._msgData();\n }\n }\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the\n * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() initializer {}\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n */\n bool private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Modifier to protect an initializer function from being invoked twice.\n */\n modifier initializer() {\n // If the contract is initializing we ignore whether _initialized is set in order to support multiple\n // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the\n // contract may have been reentered.\n require(_initializing ? _isConstructor() : !_initialized, \"Initializable: contract is already initialized\");\n\n bool isTopLevelCall = !_initializing;\n if (isTopLevelCall) {\n _initializing = true;\n _initialized = true;\n }\n\n _;\n\n if (isTopLevelCall) {\n _initializing = false;\n }\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} modifier, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n function _isConstructor() private view returns (bool) {\n return !AddressUpgradeable.isContract(address(this));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal onlyInitializing {\n __Context_init_unchained();\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal onlyInitializing {\n _paused = false;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n require(!paused(), \"Pausable: paused\");\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n require(paused(), \"Pausable: not paused\");\n _;\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __Context_init_unchained();\n __ERC165_init_unchained();\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: balance query for the zero address\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"ERC721: owner query for nonexistent token\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n require(_exists(tokenId), \"ERC721Metadata: URI query for nonexistent token\");\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overriden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n require(_exists(tokenId), \"ERC721: approved query for nonexistent token\");\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n _safeTransfer(from, to, tokenId, _data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `_data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, _data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n require(_exists(tokenId), \"ERC721: operator query for nonexistent token\");\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, _data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Clear approvals\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer of token that is not own\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits a {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits a {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param _data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n uint256[44] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"./IERC721EnumerableUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\n * enumerability of all the token ids in the contract as well as all token ids owned by each\n * account.\n */\nabstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {\n function __ERC721Enumerable_init() internal onlyInitializing {\n __Context_init_unchained();\n __ERC165_init_unchained();\n __ERC721Enumerable_init_unchained();\n }\n\n function __ERC721Enumerable_init_unchained() internal onlyInitializing {\n }\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) {\n return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721Upgradeable.balanceOf(owner), \"ERC721Enumerable: owner index out of bounds\");\n return _ownedTokens[owner][index];\n }\n\n /**\n * @dev See {IERC721Enumerable-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721EnumerableUpgradeable.totalSupply(), \"ERC721Enumerable: global index out of bounds\");\n return _allTokens[index];\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, tokenId);\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = ERC721Upgradeable.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n }\n\n // This also deletes the contents at the last position of the array\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\n */\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = _allTokens.length - 1;\n uint256 tokenIndex = _allTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\n uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n\n // This also deletes the contents at the last position of the array\n delete _allTokensIndex[tokenId];\n _allTokens.pop();\n }\n uint256[46] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721EnumerableUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the total amount of tokens stored by the contract.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);\n\n /**\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n * Use along with {totalSupply} to enumerate all tokens.\n */\n function tokenByIndex(uint256 index) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n __Context_init_unchained();\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712Upgradeable is Initializable {\n /* solhint-disable var-name-mixedcase */\n bytes32 private _HASHED_NAME;\n bytes32 private _HASHED_VERSION;\n bytes32 private constant _TYPE_HASH = keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash());\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712NameHash() internal virtual view returns (bytes32) {\n return _HASHED_NAME;\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712VersionHash() internal virtual view returns (bytes32) {\n return _HASHED_VERSION;\n }\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s;\n uint8 v;\n assembly {\n s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\n v := add(shr(255, vs), 27)\n }\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n __ERC165_init_unchained();\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" + }, + "fx-portal/contracts/lib/ExitPayloadReader.sol": { + "content": "pragma solidity ^0.8.0;\n\nimport { RLPReader } from \"./RLPReader.sol\";\n\nlibrary ExitPayloadReader {\n using RLPReader for bytes;\n using RLPReader for RLPReader.RLPItem;\n\n uint8 constant WORD_SIZE = 32;\n\n struct ExitPayload {\n RLPReader.RLPItem[] data;\n }\n\n struct Receipt {\n RLPReader.RLPItem[] data;\n bytes raw;\n uint256 logIndex;\n }\n\n struct Log {\n RLPReader.RLPItem data;\n RLPReader.RLPItem[] list;\n }\n\n struct LogTopics {\n RLPReader.RLPItem[] data;\n }\n\n // copy paste of private copy() from RLPReader to avoid changing of existing contracts\n function copy(uint src, uint dest, uint len) private pure {\n if (len == 0) return;\n\n // copy as many word sizes as possible\n for (; len >= WORD_SIZE; len -= WORD_SIZE) {\n assembly {\n mstore(dest, mload(src))\n }\n\n src += WORD_SIZE;\n dest += WORD_SIZE;\n }\n\n // left over bytes. Mask is used to remove unwanted bytes from the word\n uint mask = 256 ** (WORD_SIZE - len) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask)) // zero out src\n let destpart := and(mload(dest), mask) // retrieve the bytes\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n function toExitPayload(bytes memory data)\n internal\n pure\n returns (ExitPayload memory)\n {\n RLPReader.RLPItem[] memory payloadData = data\n .toRlpItem()\n .toList();\n\n return ExitPayload(payloadData);\n }\n\n function getHeaderNumber(ExitPayload memory payload) internal pure returns(uint256) {\n return payload.data[0].toUint();\n }\n\n function getBlockProof(ExitPayload memory payload) internal pure returns(bytes memory) {\n return payload.data[1].toBytes();\n }\n\n function getBlockNumber(ExitPayload memory payload) internal pure returns(uint256) {\n return payload.data[2].toUint();\n }\n\n function getBlockTime(ExitPayload memory payload) internal pure returns(uint256) {\n return payload.data[3].toUint();\n }\n\n function getTxRoot(ExitPayload memory payload) internal pure returns(bytes32) {\n return bytes32(payload.data[4].toUint());\n }\n\n function getReceiptRoot(ExitPayload memory payload) internal pure returns(bytes32) {\n return bytes32(payload.data[5].toUint());\n }\n\n function getReceipt(ExitPayload memory payload) internal pure returns(Receipt memory receipt) {\n receipt.raw = payload.data[6].toBytes();\n RLPReader.RLPItem memory receiptItem = receipt.raw.toRlpItem();\n\n if (receiptItem.isList()) {\n // legacy tx\n receipt.data = receiptItem.toList();\n } else {\n // pop first byte before parsting receipt\n bytes memory typedBytes = receipt.raw;\n bytes memory result = new bytes(typedBytes.length - 1);\n uint256 srcPtr;\n uint256 destPtr;\n assembly {\n srcPtr := add(33, typedBytes)\n destPtr := add(0x20, result)\n }\n\n copy(srcPtr, destPtr, result.length);\n receipt.data = result.toRlpItem().toList();\n }\n\n receipt.logIndex = getReceiptLogIndex(payload);\n return receipt;\n }\n\n function getReceiptProof(ExitPayload memory payload) internal pure returns(bytes memory) {\n return payload.data[7].toBytes();\n }\n\n function getBranchMaskAsBytes(ExitPayload memory payload) internal pure returns(bytes memory) {\n return payload.data[8].toBytes();\n }\n\n function getBranchMaskAsUint(ExitPayload memory payload) internal pure returns(uint256) {\n return payload.data[8].toUint();\n }\n\n function getReceiptLogIndex(ExitPayload memory payload) internal pure returns(uint256) {\n return payload.data[9].toUint();\n }\n \n // Receipt methods\n function toBytes(Receipt memory receipt) internal pure returns(bytes memory) {\n return receipt.raw;\n }\n\n function getLog(Receipt memory receipt) internal pure returns(Log memory) {\n RLPReader.RLPItem memory logData = receipt.data[3].toList()[receipt.logIndex];\n return Log(logData, logData.toList());\n }\n\n // Log methods\n function getEmitter(Log memory log) internal pure returns(address) {\n return RLPReader.toAddress(log.list[0]);\n }\n\n function getTopics(Log memory log) internal pure returns(LogTopics memory) {\n return LogTopics(log.list[1].toList());\n }\n\n function getData(Log memory log) internal pure returns(bytes memory) {\n return log.list[2].toBytes();\n }\n\n function toRlpBytes(Log memory log) internal pure returns(bytes memory) {\n return log.data.toRlpBytes();\n }\n\n // LogTopics methods\n function getField(LogTopics memory topics, uint256 index) internal pure returns(RLPReader.RLPItem memory) {\n return topics.data[index];\n }\n}\n" + }, + "fx-portal/contracts/lib/Merkle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary Merkle {\n function checkMembership(\n bytes32 leaf,\n uint256 index,\n bytes32 rootHash,\n bytes memory proof\n ) internal pure returns (bool) {\n require(proof.length % 32 == 0, \"Invalid proof length\");\n uint256 proofHeight = proof.length / 32;\n // Proof of size n means, height of the tree is n+1.\n // In a tree of height n+1, max #leafs possible is 2 ^ n\n require(index < 2 ** proofHeight, \"Leaf index is too big\");\n\n bytes32 proofElement;\n bytes32 computedHash = leaf;\n for (uint256 i = 32; i <= proof.length; i += 32) {\n assembly {\n proofElement := mload(add(proof, i))\n }\n\n if (index % 2 == 0) {\n computedHash = keccak256(\n abi.encodePacked(computedHash, proofElement)\n );\n } else {\n computedHash = keccak256(\n abi.encodePacked(proofElement, computedHash)\n );\n }\n\n index = index / 2;\n }\n return computedHash == rootHash;\n }\n}\n" + }, + "fx-portal/contracts/lib/MerklePatriciaProof.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {RLPReader} from \"./RLPReader.sol\";\n\nlibrary MerklePatriciaProof {\n /*\n * @dev Verifies a merkle patricia proof.\n * @param value The terminating value in the trie.\n * @param encodedPath The path in the trie leading to value.\n * @param rlpParentNodes The rlp encoded stack of nodes.\n * @param root The root hash of the trie.\n * @return The boolean validity of the proof.\n */\n function verify(\n bytes memory value,\n bytes memory encodedPath,\n bytes memory rlpParentNodes,\n bytes32 root\n ) internal pure returns (bool) {\n RLPReader.RLPItem memory item = RLPReader.toRlpItem(rlpParentNodes);\n RLPReader.RLPItem[] memory parentNodes = RLPReader.toList(item);\n\n bytes memory currentNode;\n RLPReader.RLPItem[] memory currentNodeList;\n\n bytes32 nodeKey = root;\n uint256 pathPtr = 0;\n\n bytes memory path = _getNibbleArray(encodedPath);\n if (path.length == 0) {\n return false;\n }\n\n for (uint256 i = 0; i < parentNodes.length; i++) {\n if (pathPtr > path.length) {\n return false;\n }\n\n currentNode = RLPReader.toRlpBytes(parentNodes[i]);\n if (nodeKey != keccak256(currentNode)) {\n return false;\n }\n currentNodeList = RLPReader.toList(parentNodes[i]);\n\n if (currentNodeList.length == 17) {\n if (pathPtr == path.length) {\n if (\n keccak256(RLPReader.toBytes(currentNodeList[16])) ==\n keccak256(value)\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n uint8 nextPathNibble = uint8(path[pathPtr]);\n if (nextPathNibble > 16) {\n return false;\n }\n nodeKey = bytes32(\n RLPReader.toUintStrict(currentNodeList[nextPathNibble])\n );\n pathPtr += 1;\n } else if (currentNodeList.length == 2) {\n uint256 traversed = _nibblesToTraverse(\n RLPReader.toBytes(currentNodeList[0]),\n path,\n pathPtr\n );\n if (pathPtr + traversed == path.length) {\n //leaf node\n if (\n keccak256(RLPReader.toBytes(currentNodeList[1])) ==\n keccak256(value)\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n //extension node\n if (traversed == 0) {\n return false;\n }\n\n pathPtr += traversed;\n nodeKey = bytes32(RLPReader.toUintStrict(currentNodeList[1]));\n } else {\n return false;\n }\n }\n }\n\n function _nibblesToTraverse(\n bytes memory encodedPartialPath,\n bytes memory path,\n uint256 pathPtr\n ) private pure returns (uint256) {\n uint256 len = 0;\n // encodedPartialPath has elements that are each two hex characters (1 byte), but partialPath\n // and slicedPath have elements that are each one hex character (1 nibble)\n bytes memory partialPath = _getNibbleArray(encodedPartialPath);\n bytes memory slicedPath = new bytes(partialPath.length);\n\n // pathPtr counts nibbles in path\n // partialPath.length is a number of nibbles\n for (uint256 i = pathPtr; i < pathPtr + partialPath.length; i++) {\n bytes1 pathNibble = path[i];\n slicedPath[i - pathPtr] = pathNibble;\n }\n\n if (keccak256(partialPath) == keccak256(slicedPath)) {\n len = partialPath.length;\n } else {\n len = 0;\n }\n return len;\n }\n\n // bytes b must be hp encoded\n function _getNibbleArray(bytes memory b)\n internal\n pure\n returns (bytes memory)\n {\n bytes memory nibbles = \"\";\n if (b.length > 0) {\n uint8 offset;\n uint8 hpNibble = uint8(_getNthNibbleOfBytes(0, b));\n if (hpNibble == 1 || hpNibble == 3) {\n nibbles = new bytes(b.length * 2 - 1);\n bytes1 oddNibble = _getNthNibbleOfBytes(1, b);\n nibbles[0] = oddNibble;\n offset = 1;\n } else {\n nibbles = new bytes(b.length * 2 - 2);\n offset = 0;\n }\n\n for (uint256 i = offset; i < nibbles.length; i++) {\n nibbles[i] = _getNthNibbleOfBytes(i - offset + 2, b);\n }\n }\n return nibbles;\n }\n\n function _getNthNibbleOfBytes(uint256 n, bytes memory str)\n private\n pure\n returns (bytes1)\n {\n return\n bytes1(\n n % 2 == 0 ? uint8(str[n / 2]) / 0x10 : uint8(str[n / 2]) % 0x10\n );\n }\n}" + }, + "fx-portal/contracts/lib/RLPReader.sol": { + "content": "/*\n* @author Hamdi Allam hamdi.allam97@gmail.com\n* Please reach out with any questions or concerns\n*/\npragma solidity ^0.8.0;\n\nlibrary RLPReader {\n uint8 constant STRING_SHORT_START = 0x80;\n uint8 constant STRING_LONG_START = 0xb8;\n uint8 constant LIST_SHORT_START = 0xc0;\n uint8 constant LIST_LONG_START = 0xf8;\n uint8 constant WORD_SIZE = 32;\n\n struct RLPItem {\n uint len;\n uint memPtr;\n }\n\n struct Iterator {\n RLPItem item; // Item that's being iterated over.\n uint nextPtr; // Position of the next item in the list.\n }\n\n /*\n * @dev Returns the next element in the iteration. Reverts if it has not next element.\n * @param self The iterator.\n * @return The next element in the iteration.\n */\n function next(Iterator memory self) internal pure returns (RLPItem memory) {\n require(hasNext(self));\n\n uint ptr = self.nextPtr;\n uint itemLength = _itemLength(ptr);\n self.nextPtr = ptr + itemLength;\n\n return RLPItem(itemLength, ptr);\n }\n\n /*\n * @dev Returns true if the iteration has more elements.\n * @param self The iterator.\n * @return true if the iteration has more elements.\n */\n function hasNext(Iterator memory self) internal pure returns (bool) {\n RLPItem memory item = self.item;\n return self.nextPtr < item.memPtr + item.len;\n }\n\n /*\n * @param item RLP encoded bytes\n */\n function toRlpItem(bytes memory item) internal pure returns (RLPItem memory) {\n uint memPtr;\n assembly {\n memPtr := add(item, 0x20)\n }\n\n return RLPItem(item.length, memPtr);\n }\n\n /*\n * @dev Create an iterator. Reverts if item is not a list.\n * @param self The RLP item.\n * @return An 'Iterator' over the item.\n */\n function iterator(RLPItem memory self) internal pure returns (Iterator memory) {\n require(isList(self));\n\n uint ptr = self.memPtr + _payloadOffset(self.memPtr);\n return Iterator(self, ptr);\n }\n\n /*\n * @param item RLP encoded bytes\n */\n function rlpLen(RLPItem memory item) internal pure returns (uint) {\n return item.len;\n }\n\n /*\n * @param item RLP encoded bytes\n */\n function payloadLen(RLPItem memory item) internal pure returns (uint) {\n return item.len - _payloadOffset(item.memPtr);\n }\n\n /*\n * @param item RLP encoded list in bytes\n */\n function toList(RLPItem memory item) internal pure returns (RLPItem[] memory) {\n require(isList(item));\n\n uint items = numItems(item);\n RLPItem[] memory result = new RLPItem[](items);\n\n uint memPtr = item.memPtr + _payloadOffset(item.memPtr);\n uint dataLen;\n for (uint i = 0; i < items; i++) {\n dataLen = _itemLength(memPtr);\n result[i] = RLPItem(dataLen, memPtr); \n memPtr = memPtr + dataLen;\n }\n\n return result;\n }\n\n // @return indicator whether encoded payload is a list. negate this function call for isData.\n function isList(RLPItem memory item) internal pure returns (bool) {\n if (item.len == 0) return false;\n\n uint8 byte0;\n uint memPtr = item.memPtr;\n assembly {\n byte0 := byte(0, mload(memPtr))\n }\n\n if (byte0 < LIST_SHORT_START)\n return false;\n return true;\n }\n\n /*\n * @dev A cheaper version of keccak256(toRlpBytes(item)) that avoids copying memory.\n * @return keccak256 hash of RLP encoded bytes.\n */\n function rlpBytesKeccak256(RLPItem memory item) internal pure returns (bytes32) {\n uint256 ptr = item.memPtr;\n uint256 len = item.len;\n bytes32 result;\n assembly {\n result := keccak256(ptr, len)\n }\n return result;\n }\n\n function payloadLocation(RLPItem memory item) internal pure returns (uint, uint) {\n uint offset = _payloadOffset(item.memPtr);\n uint memPtr = item.memPtr + offset;\n uint len = item.len - offset; // data length\n return (memPtr, len);\n }\n\n /*\n * @dev A cheaper version of keccak256(toBytes(item)) that avoids copying memory.\n * @return keccak256 hash of the item payload.\n */\n function payloadKeccak256(RLPItem memory item) internal pure returns (bytes32) {\n (uint memPtr, uint len) = payloadLocation(item);\n bytes32 result;\n assembly {\n result := keccak256(memPtr, len)\n }\n return result;\n }\n\n /** RLPItem conversions into data types **/\n\n // @returns raw rlp encoding in bytes\n function toRlpBytes(RLPItem memory item) internal pure returns (bytes memory) {\n bytes memory result = new bytes(item.len);\n if (result.length == 0) return result;\n \n uint ptr;\n assembly {\n ptr := add(0x20, result)\n }\n\n copy(item.memPtr, ptr, item.len);\n return result;\n }\n\n // any non-zero byte is considered true\n function toBoolean(RLPItem memory item) internal pure returns (bool) {\n require(item.len == 1);\n uint result;\n uint memPtr = item.memPtr;\n assembly {\n result := byte(0, mload(memPtr))\n }\n\n return result == 0 ? false : true;\n }\n\n function toAddress(RLPItem memory item) internal pure returns (address) {\n // 1 byte for the length prefix\n require(item.len == 21);\n\n return address(uint160(toUint(item)));\n }\n\n function toUint(RLPItem memory item) internal pure returns (uint) {\n require(item.len > 0 && item.len <= 33);\n\n uint offset = _payloadOffset(item.memPtr);\n uint len = item.len - offset;\n\n uint result;\n uint memPtr = item.memPtr + offset;\n assembly {\n result := mload(memPtr)\n\n // shfit to the correct location if neccesary\n if lt(len, 32) {\n result := div(result, exp(256, sub(32, len)))\n }\n }\n\n return result;\n }\n\n // enforces 32 byte length\n function toUintStrict(RLPItem memory item) internal pure returns (uint) {\n // one byte prefix\n require(item.len == 33);\n\n uint result;\n uint memPtr = item.memPtr + 1;\n assembly {\n result := mload(memPtr)\n }\n\n return result;\n }\n\n function toBytes(RLPItem memory item) internal pure returns (bytes memory) {\n require(item.len > 0);\n\n uint offset = _payloadOffset(item.memPtr);\n uint len = item.len - offset; // data length\n bytes memory result = new bytes(len);\n\n uint destPtr;\n assembly {\n destPtr := add(0x20, result)\n }\n\n copy(item.memPtr + offset, destPtr, len);\n return result;\n }\n\n /*\n * Private Helpers\n */\n\n // @return number of payload items inside an encoded list.\n function numItems(RLPItem memory item) private pure returns (uint) {\n if (item.len == 0) return 0;\n\n uint count = 0;\n uint currPtr = item.memPtr + _payloadOffset(item.memPtr);\n uint endPtr = item.memPtr + item.len;\n while (currPtr < endPtr) {\n currPtr = currPtr + _itemLength(currPtr); // skip over an item\n count++;\n }\n\n return count;\n }\n\n // @return entire rlp item byte length\n function _itemLength(uint memPtr) private pure returns (uint) {\n uint itemLen;\n uint byte0;\n assembly {\n byte0 := byte(0, mload(memPtr))\n }\n\n if (byte0 < STRING_SHORT_START)\n itemLen = 1;\n \n else if (byte0 < STRING_LONG_START)\n itemLen = byte0 - STRING_SHORT_START + 1;\n\n else if (byte0 < LIST_SHORT_START) {\n assembly {\n let byteLen := sub(byte0, 0xb7) // # of bytes the actual length is\n memPtr := add(memPtr, 1) // skip over the first byte\n /* 32 byte word size */\n let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to get the len\n itemLen := add(dataLen, add(byteLen, 1))\n }\n }\n\n else if (byte0 < LIST_LONG_START) {\n itemLen = byte0 - LIST_SHORT_START + 1;\n } \n\n else {\n assembly {\n let byteLen := sub(byte0, 0xf7)\n memPtr := add(memPtr, 1)\n\n let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to the correct length\n itemLen := add(dataLen, add(byteLen, 1))\n }\n }\n\n return itemLen;\n }\n\n // @return number of bytes until the data\n function _payloadOffset(uint memPtr) private pure returns (uint) {\n uint byte0;\n assembly {\n byte0 := byte(0, mload(memPtr))\n }\n\n if (byte0 < STRING_SHORT_START) \n return 0;\n else if (byte0 < STRING_LONG_START || (byte0 >= LIST_SHORT_START && byte0 < LIST_LONG_START))\n return 1;\n else if (byte0 < LIST_SHORT_START) // being explicit\n return byte0 - (STRING_LONG_START - 1) + 1;\n else\n return byte0 - (LIST_LONG_START - 1) + 1;\n }\n\n /*\n * @param src Pointer to source\n * @param dest Pointer to destination\n * @param len Amount of memory to copy from the source\n */\n function copy(uint src, uint dest, uint len) private pure {\n if (len == 0) return;\n\n // copy as many word sizes as possible\n for (; len >= WORD_SIZE; len -= WORD_SIZE) {\n assembly {\n mstore(dest, mload(src))\n }\n\n src += WORD_SIZE;\n dest += WORD_SIZE;\n }\n\n if (len == 0) return;\n\n // left over bytes. Mask is used to remove unwanted bytes from the word\n uint mask = 256 ** (WORD_SIZE - len) - 1;\n\n assembly {\n let srcpart := and(mload(src), not(mask)) // zero out src\n let destpart := and(mload(dest), mask) // retrieve the bytes\n mstore(dest, or(destpart, srcpart))\n }\n }\n}\n" + }, + "fx-portal/contracts/tunnel/FxBaseChildTunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n// IFxMessageProcessor represents interface to process message\ninterface IFxMessageProcessor {\n function processMessageFromRoot(uint256 stateId, address rootMessageSender, bytes calldata data) external;\n}\n\n/**\n* @notice Mock child tunnel contract to receive and send message from L2\n*/\nabstract contract FxBaseChildTunnel is IFxMessageProcessor{\n // MessageTunnel on L1 will get data from this event\n event MessageSent(bytes message);\n\n // fx child\n address public fxChild;\n\n // fx root tunnel\n address public fxRootTunnel;\n\n constructor(address _fxChild) {\n fxChild = _fxChild;\n }\n\n // Sender must be fxRootTunnel in case of ERC20 tunnel\n modifier validateSender(address sender) {\n require(sender == fxRootTunnel, \"FxBaseChildTunnel: INVALID_SENDER_FROM_ROOT\");\n _;\n }\n\n // set fxRootTunnel if not set already\n function setFxRootTunnel(address _fxRootTunnel) external {\n require(fxRootTunnel == address(0x0), \"FxBaseChildTunnel: ROOT_TUNNEL_ALREADY_SET\");\n fxRootTunnel = _fxRootTunnel;\n }\n\n function processMessageFromRoot(uint256 stateId, address rootMessageSender, bytes calldata data) external override {\n require(msg.sender == fxChild, \"FxBaseChildTunnel: INVALID_SENDER\");\n _processMessageFromRoot(stateId, rootMessageSender, data);\n }\n\n /**\n * @notice Emit message that can be received on Root Tunnel\n * @dev Call the internal function when need to emit message\n * @param message bytes message that will be sent to Root Tunnel\n * some message examples -\n * abi.encode(tokenId);\n * abi.encode(tokenId, tokenMetadata);\n * abi.encode(messageType, messageData);\n */\n function _sendMessageToRoot(bytes memory message) internal {\n emit MessageSent(message);\n }\n\n /**\n * @notice Process message received from Root Tunnel\n * @dev function needs to be implemented to handle message as per requirement\n * This is called by onStateReceive function.\n * Since it is called via a system call, any event will not be emitted during its execution.\n * @param stateId unique state id\n * @param sender root message sender\n * @param message bytes message that was sent from Root Tunnel\n */\n function _processMessageFromRoot(uint256 stateId, address sender, bytes memory message) virtual internal;\n}\n" + }, + "fx-portal/contracts/tunnel/FxBaseRootTunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n\nimport {RLPReader} from \"../lib/RLPReader.sol\";\nimport {MerklePatriciaProof} from \"../lib/MerklePatriciaProof.sol\";\nimport {Merkle} from \"../lib/Merkle.sol\";\nimport \"../lib/ExitPayloadReader.sol\";\n\n\ninterface IFxStateSender {\n function sendMessageToChild(address _receiver, bytes calldata _data) external;\n}\n\ncontract ICheckpointManager {\n struct HeaderBlock {\n bytes32 root;\n uint256 start;\n uint256 end;\n uint256 createdAt;\n address proposer;\n }\n\n /**\n * @notice mapping of checkpoint header numbers to block details\n * @dev These checkpoints are submited by plasma contracts\n */\n mapping(uint256 => HeaderBlock) public headerBlocks;\n}\n\nabstract contract FxBaseRootTunnel {\n using RLPReader for RLPReader.RLPItem;\n using Merkle for bytes32;\n using ExitPayloadReader for bytes;\n using ExitPayloadReader for ExitPayloadReader.ExitPayload;\n using ExitPayloadReader for ExitPayloadReader.Log;\n using ExitPayloadReader for ExitPayloadReader.LogTopics;\n using ExitPayloadReader for ExitPayloadReader.Receipt;\n\n // keccak256(MessageSent(bytes))\n bytes32 public constant SEND_MESSAGE_EVENT_SIG = 0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036;\n\n // state sender contract\n IFxStateSender public fxRoot;\n // root chain manager\n ICheckpointManager public checkpointManager;\n // child tunnel contract which receives and sends messages \n address public fxChildTunnel;\n\n // storage to avoid duplicate exits\n mapping(bytes32 => bool) public processedExits;\n\n constructor(address _checkpointManager, address _fxRoot) {\n checkpointManager = ICheckpointManager(_checkpointManager);\n fxRoot = IFxStateSender(_fxRoot);\n }\n\n // set fxChildTunnel if not set already\n function setFxChildTunnel(address _fxChildTunnel) public {\n require(fxChildTunnel == address(0x0), \"FxBaseRootTunnel: CHILD_TUNNEL_ALREADY_SET\");\n fxChildTunnel = _fxChildTunnel;\n }\n\n /**\n * @notice Send bytes message to Child Tunnel\n * @param message bytes message that will be sent to Child Tunnel\n * some message examples -\n * abi.encode(tokenId);\n * abi.encode(tokenId, tokenMetadata);\n * abi.encode(messageType, messageData);\n */\n function _sendMessageToChild(bytes memory message) internal {\n fxRoot.sendMessageToChild(fxChildTunnel, message);\n }\n\n function _validateAndExtractMessage(bytes memory inputData) internal returns (bytes memory) {\n ExitPayloadReader.ExitPayload memory payload = inputData.toExitPayload();\n\n bytes memory branchMaskBytes = payload.getBranchMaskAsBytes();\n uint256 blockNumber = payload.getBlockNumber();\n // checking if exit has already been processed\n // unique exit is identified using hash of (blockNumber, branchMask, receiptLogIndex)\n bytes32 exitHash = keccak256(\n abi.encodePacked(\n blockNumber,\n // first 2 nibbles are dropped while generating nibble array\n // this allows branch masks that are valid but bypass exitHash check (changing first 2 nibbles only)\n // so converting to nibble array and then hashing it\n MerklePatriciaProof._getNibbleArray(branchMaskBytes),\n payload.getReceiptLogIndex()\n )\n );\n require(\n processedExits[exitHash] == false,\n \"FxRootTunnel: EXIT_ALREADY_PROCESSED\"\n );\n processedExits[exitHash] = true;\n\n ExitPayloadReader.Receipt memory receipt = payload.getReceipt();\n ExitPayloadReader.Log memory log = receipt.getLog();\n\n // check child tunnel\n require(fxChildTunnel == log.getEmitter(), \"FxRootTunnel: INVALID_FX_CHILD_TUNNEL\");\n\n bytes32 receiptRoot = payload.getReceiptRoot();\n // verify receipt inclusion\n require(\n MerklePatriciaProof.verify(\n receipt.toBytes(), \n branchMaskBytes, \n payload.getReceiptProof(), \n receiptRoot\n ),\n \"FxRootTunnel: INVALID_RECEIPT_PROOF\"\n );\n\n // verify checkpoint inclusion\n _checkBlockMembershipInCheckpoint(\n blockNumber,\n payload.getBlockTime(),\n payload.getTxRoot(),\n receiptRoot,\n payload.getHeaderNumber(),\n payload.getBlockProof()\n );\n\n ExitPayloadReader.LogTopics memory topics = log.getTopics();\n\n require(\n bytes32(topics.getField(0).toUint()) == SEND_MESSAGE_EVENT_SIG, // topic0 is event sig\n \"FxRootTunnel: INVALID_SIGNATURE\"\n );\n\n // received message data\n (bytes memory message) = abi.decode(log.getData(), (bytes)); // event decodes params again, so decoding bytes to get message\n return message;\n }\n\n function _checkBlockMembershipInCheckpoint(\n uint256 blockNumber,\n uint256 blockTime,\n bytes32 txRoot,\n bytes32 receiptRoot,\n uint256 headerNumber,\n bytes memory blockProof\n ) private view returns (uint256) {\n (\n bytes32 headerRoot,\n uint256 startBlock,\n ,\n uint256 createdAt,\n\n ) = checkpointManager.headerBlocks(headerNumber);\n\n require(\n keccak256(\n abi.encodePacked(blockNumber, blockTime, txRoot, receiptRoot)\n )\n .checkMembership(\n blockNumber-startBlock,\n headerRoot,\n blockProof\n ),\n \"FxRootTunnel: INVALID_HEADER\"\n );\n return createdAt;\n }\n\n /**\n * @notice receive message from L2 to L1, validated by proof\n * @dev This function verifies if the transaction actually happened on child chain\n *\n * @param inputData RLP encoded data of the reference tx containing following list of fields\n * 0 - headerNumber - Checkpoint header block number containing the reference tx\n * 1 - blockProof - Proof that the block header (in the child chain) is a leaf in the submitted merkle root\n * 2 - blockNumber - Block number containing the reference tx on child chain\n * 3 - blockTime - Reference tx block time\n * 4 - txRoot - Transactions root of block\n * 5 - receiptRoot - Receipts root of block\n * 6 - receipt - Receipt of the reference transaction\n * 7 - receiptProof - Merkle proof of the reference receipt\n * 8 - branchMask - 32 bits denoting the path of receipt in merkle tree\n * 9 - receiptLogIndex - Log Index to read from the receipt\n */\n function receiveMessage(bytes memory inputData) public virtual {\n bytes memory message = _validateAndExtractMessage(inputData);\n _processMessageFromChild(message);\n }\n\n /**\n * @notice Process message received from Child Tunnel\n * @dev function needs to be implemented to handle message as per requirement\n * This is called by onStateReceive function.\n * Since it is called via a system call, any event will not be emitted during its execution.\n * @param message bytes message that was sent from Child Tunnel\n */\n function _processMessageFromChild(bytes memory message) virtual internal;\n}\n" + }, + "src/solc_0.8/asset/AssetAttributesRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\npragma experimental ABIEncoderV2;\n\nimport \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport \"../catalyst/GemsCatalystsRegistry.sol\";\nimport \"../common/BaseWithStorage/WithAdmin.sol\";\nimport \"../common/BaseWithStorage/WithMinter.sol\";\nimport \"../common/BaseWithStorage/WithUpgrader.sol\";\n\n/// @notice Allows setting the gems and catalysts of an asset\ncontract AssetAttributesRegistry is WithMinter, WithUpgrader, IAssetAttributesRegistry, Context {\n uint256 internal constant MAX_NUM_GEMS = 15;\n uint256 private constant IS_NFT = 0x0000000000000000000000000000000000000000800000000000000000000000;\n uint256 private constant NOT_IS_NFT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFFFFFFFFFFF;\n uint256 private constant NOT_NFT_INDEX = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000007FFFFFFFFFFFFFFF;\n\n GemsCatalystsRegistry internal immutable _gemsCatalystsRegistry;\n mapping(uint256 => Record) internal _records;\n\n // used to allow migration to specify blockNumber when setting catalyst/gems\n address public migrationContract;\n // used to to set catalyst without burning actual ERC20 (cross layer deposit)\n address public overLayerDepositor;\n\n struct Record {\n uint16 catalystId; // start at 1\n uint16[MAX_NUM_GEMS] gemIds;\n }\n\n event CatalystApplied(uint256 indexed assetId, uint16 indexed catalystId, uint16[] gemIds, uint64 blockNumber);\n event GemsAdded(uint256 indexed assetId, uint16[] gemIds, uint64 blockNumber);\n\n /// @notice AssetAttributesRegistry depends on\n /// @param gemsCatalystsRegistry: GemsCatalystsRegistry for fetching attributes\n /// @param admin: for setting the migration contract address\n /// @param minter: allowed to set gems and catalysts for a given asset\n constructor(\n GemsCatalystsRegistry gemsCatalystsRegistry,\n address admin,\n address minter,\n address upgrader\n ) {\n _gemsCatalystsRegistry = gemsCatalystsRegistry;\n _admin = admin;\n _minter = minter;\n _upgrader = upgrader;\n }\n\n function getCatalystRegistry() external view override returns (address) {\n return address(_gemsCatalystsRegistry);\n }\n\n /// @notice get the record data (catalyst id, gems ids list) for an asset id\n /// @param assetId id of the asset\n function getRecord(uint256 assetId)\n external\n view\n override\n returns (\n bool exists,\n uint16 catalystId,\n uint16[] memory gemIds\n )\n {\n catalystId = _records[assetId].catalystId;\n if (catalystId == 0 && assetId & IS_NFT != 0) {\n // fallback on collection catalyst\n assetId = _getCollectionId(assetId);\n catalystId = _records[assetId].catalystId;\n }\n uint16[MAX_NUM_GEMS] memory fixedGemIds = _records[assetId].gemIds;\n exists = catalystId != 0;\n gemIds = new uint16[](MAX_NUM_GEMS);\n uint8 i = 0;\n while (fixedGemIds[i] != 0) {\n gemIds[i] = (fixedGemIds[i]);\n i++;\n }\n }\n\n /// @notice getAttributes\n /// @param assetId id of the asset\n /// @return values The array of values(256) requested.\n function getAttributes(uint256 assetId, GemEvent[] calldata events)\n external\n view\n override\n returns (uint32[] memory values)\n {\n return _gemsCatalystsRegistry.getAttributes(_records[assetId].catalystId, assetId, events);\n }\n\n /// @notice sets the catalyst and gems when an asset goes over layers\n /// @param assetId id of the asset\n /// @param catalystId id of the catalyst to set\n /// @param gemIds list of gems ids to set\n function setCatalystWhenDepositOnOtherLayer(\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds\n ) external override {\n require(\n _msgSender() == overLayerDepositor || _msgSender() == _admin,\n \"AssetAttributesRegistry: not overLayerDepositor\"\n );\n // We have to ignore all 0 gemid in case of L2 to L1 deposit\n // In this case we get gems data in a form of an array of MAX_NUM_GEMS padded with 0\n if (gemIds.length == MAX_NUM_GEMS) {\n uint256 firstZeroIndex;\n for (firstZeroIndex = 0; firstZeroIndex < gemIds.length; firstZeroIndex++) {\n if (gemIds[firstZeroIndex] == 0) {\n break;\n }\n }\n uint16[] memory gemIdsWithoutZero = new uint16[](firstZeroIndex);\n // find first 0\n for (uint256 i = 0; i < firstZeroIndex; i++) {\n gemIdsWithoutZero[i] = gemIds[i];\n }\n _setCatalyst(assetId, catalystId, gemIdsWithoutZero, _getBlockNumber(), false);\n } else {\n _setCatalyst(assetId, catalystId, gemIds, _getBlockNumber(), false);\n }\n }\n\n /// @notice sets the catalyst and gems for an asset, minter only\n /// @param assetId id of the asset\n /// @param catalystId id of the catalyst to set\n /// @param gemIds list of gems ids to set\n function setCatalyst(\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds\n ) external virtual override {\n require(_msgSender() == _minter || _msgSender() == _upgrader, \"NOT_AUTHORIZED_MINTER\");\n _setCatalyst(assetId, catalystId, gemIds, _getBlockNumber(), true);\n }\n\n /// @notice sets the catalyst and gems for an asset for a given block number, migration contract only\n /// @param assetId id of the asset\n /// @param catalystId id of the catalyst to set\n /// @param gemIds list of gems ids to set\n /// @param blockNumber block number\n function setCatalystWithBlockNumber(\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds,\n uint64 blockNumber\n ) external override {\n require(_msgSender() == migrationContract, \"NOT_AUTHORIZED_MIGRATION\");\n _setCatalyst(assetId, catalystId, gemIds, blockNumber, true);\n }\n\n /// @notice adds gems to an existing list of gems of an asset, upgrader only\n /// @param assetId id of the asset\n /// @param gemIds list of gems ids to set\n function addGems(uint256 assetId, uint16[] calldata gemIds) external virtual override {\n require(_msgSender() == _upgrader, \"NOT_AUTHORIZED_UPGRADER\");\n require(assetId & IS_NFT != 0, \"INVALID_NOT_NFT\");\n require(gemIds.length != 0, \"INVALID_GEMS_0\");\n\n uint16 catalystId = _records[assetId].catalystId;\n uint16[MAX_NUM_GEMS] memory gemIdsToStore;\n if (catalystId == 0) {\n // fallback on collection catalyst\n uint256 collectionId = _getCollectionId(assetId);\n catalystId = _records[collectionId].catalystId;\n if (catalystId != 0) {\n _records[assetId].catalystId = catalystId;\n gemIdsToStore = _records[collectionId].gemIds;\n }\n } else {\n gemIdsToStore = _records[assetId].gemIds;\n }\n\n require(catalystId != 0, \"NO_CATALYST_SET\");\n uint8 j = 0;\n uint8 i = 0;\n for (i = 0; i < MAX_NUM_GEMS; i++) {\n if (j == gemIds.length) {\n break;\n }\n if (gemIdsToStore[i] == 0) {\n require(gemIds[j] != 0, \"INVALID_GEM_ID\");\n gemIdsToStore[i] = gemIds[j];\n j++;\n }\n }\n uint8 maxGems = _gemsCatalystsRegistry.getMaxGems(catalystId);\n require(i <= maxGems, \"GEMS_TOO_MANY\");\n _records[assetId].gemIds = gemIdsToStore;\n uint64 blockNumber = _getBlockNumber();\n emit GemsAdded(assetId, gemIds, blockNumber);\n }\n\n /// @notice set the migration contract address, admin or migration contract only\n /// @param _migrationContract address of the migration contract\n function setMigrationContract(address _migrationContract) external override {\n address currentMigrationContract = migrationContract;\n if (currentMigrationContract == address(0)) {\n require(_msgSender() == _admin, \"NOT_AUTHORIZED\");\n migrationContract = _migrationContract;\n } else {\n require(_msgSender() == currentMigrationContract, \"NOT_AUTHORIZED_MIGRATION\");\n migrationContract = _migrationContract;\n }\n }\n\n /// @dev Set a catalyst for the given asset.\n /// @param assetId The asset to set a catalyst on.\n /// @param catalystId The catalyst to set.\n /// @param gemIds The gems to embed in the catalyst.\n /// @param blockNumber The blocknumber to emit in the event.\n /// @param hasToEmitEvent boolean to indicate if we want to emit an event\n function _setCatalyst(\n uint256 assetId,\n uint16 catalystId,\n uint16[] memory gemIds,\n uint64 blockNumber,\n bool hasToEmitEvent\n ) internal virtual {\n require(gemIds.length <= MAX_NUM_GEMS, \"GEMS_MAX_REACHED\");\n uint8 maxGems = _gemsCatalystsRegistry.getMaxGems(catalystId);\n require(gemIds.length <= maxGems, \"GEMS_TOO_MANY\");\n uint16[MAX_NUM_GEMS] memory gemIdsToStore;\n for (uint8 i = 0; i < gemIds.length; i++) {\n require(gemIds[i] != 0, \"INVALID_GEM_ID\");\n gemIdsToStore[i] = gemIds[i];\n }\n _records[assetId] = Record(catalystId, gemIdsToStore);\n if (hasToEmitEvent) {\n emit CatalystApplied(assetId, catalystId, gemIds, blockNumber);\n }\n }\n\n /// @dev Get the collection Id for an asset.\n /// @param assetId The asset to get the collection id for.\n /// @return The id of the collection the asset belongs to.\n function _getCollectionId(uint256 assetId) internal pure returns (uint256) {\n return assetId & NOT_NFT_INDEX & NOT_IS_NFT; // compute the same as Asset to get collectionId\n }\n\n /// @dev Get a blocknumber for use when querying attributes.\n /// @return blockNumber The current blocknumber + 1.\n function _getBlockNumber() internal view returns (uint64 blockNumber) {\n blockNumber = uint64(block.number + 1);\n }\n}\n" + }, + "src/solc_0.8/asset/AssetMinter.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport \"../common/BaseWithStorage/ERC2771Handler.sol\";\nimport \"../common/interfaces/IAssetMinter.sol\";\nimport \"../catalyst/GemsCatalystsRegistry.sol\";\nimport \"../common/interfaces/IPolygonAssetERC1155.sol\";\n\n/// @notice Allow to mint Asset with Catalyst, Gems and Sand, giving the assets attributes through AssetAttributeRegistry\ncontract AssetMinter is ERC2771Handler, IAssetMinter, Ownable {\n uint32 public numberOfGemsBurnPerAsset = 1;\n uint32 public numberOfCatalystBurnPerAsset = 1;\n\n IAssetAttributesRegistry internal immutable _registry;\n IPolygonAssetERC1155 internal immutable _assetERC1155;\n GemsCatalystsRegistry internal immutable _gemsCatalystsRegistry;\n\n mapping(uint16 => uint256) public quantitiesByCatalystId;\n mapping(uint16 => uint256) public quantitiesByAssetTypeId; // quantities for asset that don't use catalyst to burn (art, prop...)\n mapping(address => bool) public customMinterAllowance;\n\n event CustomMintingAllowanceChanged(address indexed addressModified, bool indexed isAddressCustomMintingAllowed);\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\n event QuantitiesByCatalystIdChanged(uint256 indexed id, uint256 indexed newValue);\n event QuantitiesByAssetTypeIdChanged(uint256 indexed index, uint256 indexed newValue);\n event NumberOfGemsBurnPerAssetChanged(uint256 indexed newValue);\n event NumberOfCatalystBurnPerAssetChanged(uint256 indexed newValue);\n\n /// @notice AssetMinter depends on\n /// @param registry: AssetAttributesRegistry for recording catalyst and gems used\n /// @param assetERC1155: Asset ERC1155 Token Contract\n /// @param gemsCatalystsRegistry: that track the canonical catalyst and gems and provide batch burning facility\n /// @param trustedForwarder: address of the trusted forwarder (used for metaTX)\n constructor(\n IAssetAttributesRegistry registry,\n IPolygonAssetERC1155 assetERC1155,\n GemsCatalystsRegistry gemsCatalystsRegistry,\n address admin,\n address trustedForwarder,\n uint256[] memory quantitiesByCatalystId_,\n uint256[] memory quantitiesByAssetTypeId_\n ) {\n require(address(registry) != address(0), \"AssetMinter: registry can't be zero\");\n require(address(assetERC1155) != address(0), \"AssetMinter: assetERC1155 can't be zero\");\n require(address(gemsCatalystsRegistry) != address(0), \"AssetMinter: gemsCatalystsRegistry can't be zero\");\n _registry = registry;\n _assetERC1155 = assetERC1155;\n _gemsCatalystsRegistry = gemsCatalystsRegistry;\n transferOwnership(admin);\n __ERC2771Handler_initialize(trustedForwarder);\n\n require(quantitiesByCatalystId_.length > 0, \"AssetMinter: quantitiesByCatalystID length cannot be 0\");\n require(quantitiesByAssetTypeId_.length > 0, \"AssetMinter: quantitiesByAssetTypeId length cannot be 0\");\n\n for (uint16 i = 0; i < quantitiesByCatalystId_.length; i++) {\n quantitiesByCatalystId[i + 1] = quantitiesByCatalystId_[i];\n }\n\n for (uint16 i = 0; i < quantitiesByAssetTypeId_.length; i++) {\n quantitiesByAssetTypeId[i + 1] = quantitiesByAssetTypeId_[i];\n }\n }\n\n function addOrReplaceQuantityByCatalystId(uint16 catalystId, uint256 newQuantity) external override onlyOwner {\n quantitiesByCatalystId[catalystId] = newQuantity;\n emit QuantitiesByCatalystIdChanged(catalystId, newQuantity);\n }\n\n function addOrReplaceAssetTypeQuantity(uint16 index1Based, uint256 newQuantity) external override onlyOwner {\n quantitiesByAssetTypeId[index1Based] = newQuantity;\n emit QuantitiesByAssetTypeIdChanged(index1Based, newQuantity);\n }\n\n function setNumberOfGemsBurnPerAsset(uint32 newQuantity) external override onlyOwner {\n numberOfGemsBurnPerAsset = newQuantity;\n emit NumberOfGemsBurnPerAssetChanged(newQuantity);\n }\n\n function setNumberOfCatalystsBurnPerAsset(uint32 newQuantity) external override onlyOwner {\n numberOfCatalystBurnPerAsset = newQuantity;\n emit NumberOfCatalystBurnPerAssetChanged(newQuantity);\n }\n\n function setCustomMintingAllowance(address addressToModify, bool isAddressAllowed) external override onlyOwner {\n customMinterAllowance[addressToModify] = isAddressAllowed;\n\n emit CustomMintingAllowanceChanged(addressToModify, isAddressAllowed);\n }\n\n /// @notice mint \"quantity\" number of Asset token using one catalyst.\n /// @param mintData (-from address creating the Asset, need to be the tx sender or meta tx signer.\n /// -packId unused packId that will let you predict the resulting tokenId.\n /// - metadataHash cidv1 ipfs hash of the folder where 0.json file contains the metadata.\n /// - to destination address receiving the minted tokens.\n /// - data extra data)\n /// @param catalystId Id of the Catalyst ERC20 token to burn (1, 2, 3 or 4).\n /// @param gemIds list of gem ids to burn in the catalyst.\n /// @param quantity number of token to mint\n /// @return assetId The new token Id.\n function mintCustomNumberWithCatalyst(\n MintData calldata mintData,\n uint16 catalystId,\n uint16[] calldata gemIds,\n uint256 quantity,\n uint256 _numberOfCatalystBurnPerAsset,\n uint256 _numberOfGemsBurnPerAsset\n ) external override returns (uint256 assetId) {\n require(\n customMinterAllowance[_msgSender()] == true || _msgSender() == owner(),\n \"AssetMinter: custom minting unauthorized\"\n );\n require(\n _numberOfCatalystBurnPerAsset == numberOfCatalystBurnPerAsset,\n \"AssetMinter: invalid numberOfCatalystBurnPerAsset value \"\n );\n require(\n _numberOfGemsBurnPerAsset == numberOfGemsBurnPerAsset,\n \"AssetMinter: invalid numberOfGemsBurnPerAsset value\"\n );\n assetId = _burnAndMint(mintData, catalystId, gemIds, quantity);\n }\n\n /// @notice mint \"quantity\" number of Asset token without using a catalyst.\n /// @param mintData (-from address creating the Asset, need to be the tx sender or meta tx signer.\n /// -packId unused packId that will let you predict the resulting tokenId.\n /// - metadataHash cidv1 ipfs hash of the folder where 0.json file contains the metadata.\n /// - to destination address receiving the minted tokens.\n /// - data extra data)\n /// @param quantity number of token to mint\n /// @return assetId The new token Id.\n function mintCustomNumberWithoutCatalyst(MintData calldata mintData, uint256 quantity)\n external\n override\n returns (uint256 assetId)\n {\n require(\n customMinterAllowance[_msgSender()] == true || _msgSender() == owner(),\n \"AssetMinter: custom minting unauthorized\"\n );\n _mintRequirements(mintData.from, quantity, mintData.to);\n assetId = _assetERC1155.mint(\n mintData.from,\n mintData.packId,\n mintData.metadataHash,\n quantity,\n mintData.to,\n mintData.data\n );\n }\n\n /// @notice mint one Asset token with no catalyst.\n /// @param mintData : (-from address creating the Asset, need to be the tx sender or meta tx signer.\n /// -packId unused packId that will let you predict the resulting tokenId.\n /// - metadataHash cidv1 ipfs hash of the folder where 0.json file contains the metadata.\n /// - to destination address receiving the minted tokens.\n /// - data extra data)\n /// @param typeAsset1Based (art, prop...) decide how many asset will be minted (start at 1)\n /// @return assetId The new token Id.\n function mintWithoutCatalyst(\n MintData calldata mintData,\n uint16 typeAsset1Based,\n uint256 quantity\n ) external override returns (uint256 assetId) {\n require(\n quantity == quantitiesByAssetTypeId[typeAsset1Based],\n \"AssetMinter: Invalid quantitiesByAssetType value\"\n );\n\n _mintRequirements(mintData.from, quantity, mintData.to);\n assetId = _assetERC1155.mint(\n mintData.from,\n mintData.packId,\n mintData.metadataHash,\n quantity,\n mintData.to,\n mintData.data\n );\n }\n\n /// @notice mint multiple Asset tokens using one catalyst.\n /// @param mintData : (-from address creating the Asset, need to be the tx sender or meta tx signer.\n /// -packId unused packId that will let you predict the resulting tokenId.\n /// - metadataHash cidv1 ipfs hash of the folder where 0.json file contains the metadata.\n /// - to destination address receiving the minted tokens.\n /// - data extra data)\n /// @param catalystId Id of the Catalyst ERC20 token to burn (1, 2, 3 or 4).\n /// @param gemIds list of gem ids to burn in the catalyst.\n /// @return assetId The new token Id.\n function mintWithCatalyst(\n MintData calldata mintData,\n uint16 catalystId,\n uint16[] calldata gemIds,\n uint256 quantity,\n uint256 _numberOfCatalystBurnPerAsset,\n uint256 _numberOfGemsBurnPerAsset\n ) external override returns (uint256 assetId) {\n require(quantity == quantitiesByCatalystId[catalystId], \"AssetMinter : Invalid quantitiesByCatalyst value\");\n require(\n _numberOfCatalystBurnPerAsset == numberOfCatalystBurnPerAsset,\n \"AssetMinter: invalid numberOfCatalystBurnPerAsset value\"\n );\n require(\n _numberOfGemsBurnPerAsset == numberOfGemsBurnPerAsset,\n \"AssetMinter: invalid numberOfGemsBurnPerAsset value \"\n );\n\n assetId = _burnAndMint(mintData, catalystId, gemIds, quantity);\n }\n\n /// @notice mint multiple Asset tokens.\n /// @param mintData contains (-from address creating the Asset, need to be the tx sender or meta tx signer\n /// -packId unused packId that will let you predict the resulting tokenId\n /// -metadataHash cidv1 ipfs hash of the folder where 0.json file contains the metadata)\n /// @param assets data (gems and catalyst data)\n function mintMultipleWithCatalyst(\n MintData calldata mintData,\n AssetData[] memory assets,\n uint256[] memory supplies,\n uint256 _numberOfCatalystBurnPerAsset,\n uint256 _numberOfGemsBurnPerAsset\n ) external override returns (uint256[] memory assetIds) {\n uint256 assetsLength = assets.length;\n require(assetsLength != 0, \"INVALID_0_ASSETS\");\n require(assetsLength == supplies.length, \"AssetMinter: supplies and assets length mismatch\");\n require(mintData.to != address(0), \"INVALID_TO_ZERO_ADDRESS\");\n require(\n _numberOfCatalystBurnPerAsset == numberOfCatalystBurnPerAsset,\n \"AssetMinter: invalid numberOfCatalystBurnPerAsset value\"\n );\n require(\n _numberOfGemsBurnPerAsset == numberOfGemsBurnPerAsset,\n \"AssetMinter: invalid numberOfGemsBurnPerAsset value\"\n );\n require(_msgSender() == mintData.from, \"AUTH_ACCESS_DENIED\");\n\n _handleMultipleAssetRequirements(mintData.from, assets, supplies);\n assetIds = _assetERC1155.mintMultiple(\n mintData.from,\n mintData.packId,\n mintData.metadataHash,\n supplies,\n \"\",\n mintData.to,\n mintData.data\n );\n for (uint256 i = 0; i < assetIds.length; i++) {\n require(assets[i].catalystId != 0, \"AssetMinter: catalystID can't be 0\");\n _registry.setCatalyst(assetIds[i], assets[i].catalystId, assets[i].gemIds);\n }\n return assetIds;\n }\n\n function mintMultipleWithoutCatalyst(\n MintData calldata mintData,\n uint256[] calldata supplies,\n uint16[] calldata assetTypesIds\n ) external override returns (uint256[] memory assetIds) {\n uint256 suppliesLength = supplies.length;\n require(suppliesLength != 0, \"INVALID_0_ASSETS\");\n require(suppliesLength == assetTypesIds.length, \"AssetMinter: supplies and assets length mismatch\");\n require(mintData.to != address(0), \"INVALID_TO_ZERO_ADDRESS\");\n require(_msgSender() == mintData.from, \"AUTH_ACCESS_DENIED\");\n for (uint256 i = 0; i < suppliesLength; i++) {\n require(\n supplies[i] == quantitiesByAssetTypeId[assetTypesIds[i]],\n \"AssetMinter: Invalid quantitiesByAssetType value\"\n );\n }\n assetIds = _assetERC1155.mintMultiple(\n mintData.from,\n mintData.packId,\n mintData.metadataHash,\n supplies,\n \"\",\n mintData.to,\n mintData.data\n );\n return assetIds;\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n\n emit TrustedForwarderChanged(trustedForwarder);\n }\n\n /// @dev Handler for dealing with assets when minting multiple at once.\n /// @param from The original address that signed the transaction.\n /// @param assets An array of AssetData structs to define how the total gems and catalysts are to be allocated.\n function _handleMultipleAssetRequirements(\n address from,\n AssetData[] memory assets,\n uint256[] memory supplies\n ) internal {\n uint256[] memory catalystsToBurn = new uint256[](_gemsCatalystsRegistry.getNumberOfCatalystContracts());\n uint256[] memory gemsToBurn = new uint256[](_gemsCatalystsRegistry.getNumberOfGemContracts());\n\n for (uint256 i = 0; i < assets.length; i++) {\n require(\n assets[i].catalystId > 0 && assets[i].catalystId <= catalystsToBurn.length,\n \"AssetMinter: catalystID out of bound\"\n );\n catalystsToBurn[assets[i].catalystId - 1]++;\n for (uint256 j = 0; j < assets[i].gemIds.length; j++) {\n require(\n assets[i].gemIds[j] > 0 && assets[i].gemIds[j] <= gemsToBurn.length,\n \"AssetMinter: gemId out of bound\"\n );\n gemsToBurn[assets[i].gemIds[j] - 1]++;\n }\n\n uint16 maxGems = _gemsCatalystsRegistry.getMaxGems(assets[i].catalystId);\n require(assets[i].gemIds.length <= maxGems, \"AssetMinter: too many gems\");\n require(\n supplies[i] == quantitiesByCatalystId[assets[i].catalystId],\n \"AssetMinter: Invalid quantitiesByAssetType value\"\n );\n }\n _batchBurnCatalysts(from, catalystsToBurn);\n _batchBurnGems(from, gemsToBurn);\n }\n\n /// @dev Burn a batch of catalysts in one tx.\n /// @param from The original address that signed the tx.\n /// @param catalystsQuantities An array of quantities for each type of catalyst to burn.\n function _batchBurnCatalysts(address from, uint256[] memory catalystsQuantities) internal {\n uint16[] memory ids = new uint16[](catalystsQuantities.length);\n for (uint16 i = 0; i < ids.length; i++) {\n ids[i] = i + 1;\n }\n _gemsCatalystsRegistry.batchBurnCatalysts(from, ids, _scaleCatalystQuantities(catalystsQuantities));\n }\n\n /// @dev Burn a batch of gems in one tx.\n /// @param from The original address that signed the tx.\n /// @param gemsQuantities An array of quantities for each type of gems to burn.\n function _batchBurnGems(address from, uint256[] memory gemsQuantities) internal {\n uint16[] memory ids = new uint16[](gemsQuantities.length);\n for (uint16 i = 0; i < ids.length; i++) {\n ids[i] = i + 1;\n }\n _gemsCatalystsRegistry.batchBurnGems(from, ids, _scaleGemQuantities(gemsQuantities));\n }\n\n /// @dev Burn an array of gems.\n /// @param from The original signer of the tx.\n /// @param gemIds The array of gems to burn.\n /// @param numTimes Amount of gems to burn.\n function _burnGems(\n address from,\n uint16[] memory gemIds,\n uint32 numTimes\n ) internal {\n uint256[] memory gemFactors = new uint256[](gemIds.length);\n for (uint256 i = 0; i < gemIds.length; i++) {\n gemFactors[i] = 10**(_gemsCatalystsRegistry.getGemDecimals(gemIds[i])) * numTimes;\n }\n _gemsCatalystsRegistry.batchBurnGems(from, gemIds, gemFactors);\n }\n\n /// @dev Burn a single type of catalyst.\n /// @param from The original signer of the tx.\n /// @param catalystId The type of catalyst to burn.\n /// @param numTimes Amount of catalysts of this type to burn.\n function _burnCatalyst(\n address from,\n uint16 catalystId,\n uint32 numTimes\n ) internal {\n _gemsCatalystsRegistry.burnCatalyst(\n from,\n catalystId,\n numTimes * 10**(_gemsCatalystsRegistry.getCatalystDecimals(catalystId))\n );\n }\n\n /// @dev Scale up each number in an array of quantities by a factor of gemsUnits.\n /// @param quantities The array of numbers to scale.\n /// @return scaledQuantities The scaled-up values.\n function _scaleGemQuantities(uint256[] memory quantities)\n internal\n view\n returns (uint256[] memory scaledQuantities)\n {\n scaledQuantities = new uint256[](quantities.length);\n for (uint256 i = 0; i < quantities.length; i++) {\n uint256 gemFactor = 10**_gemsCatalystsRegistry.getGemDecimals(uint16(i + 1));\n scaledQuantities[i] = quantities[i] * gemFactor * numberOfGemsBurnPerAsset;\n }\n }\n\n /// @dev Scale up each number in an array of quantities by a factor of gemsUnits.\n /// @param quantities The array of numbers to scale.\n /// @return scaledQuantities The scaled-up values.\n function _scaleCatalystQuantities(uint256[] memory quantities)\n internal\n view\n returns (uint256[] memory scaledQuantities)\n {\n scaledQuantities = new uint256[](quantities.length);\n for (uint256 i = 0; i < quantities.length; i++) {\n uint256 catalystFactor = 10**_gemsCatalystsRegistry.getCatalystDecimals(uint16(i + 1));\n scaledQuantities[i] = quantities[i] * catalystFactor * numberOfCatalystBurnPerAsset;\n }\n }\n\n function _msgSender() internal view override(Context, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n\n function _mintRequirements(\n address from,\n uint256 quantity,\n address to\n ) internal view {\n require(to != address(0), \"INVALID_TO_ZERO_ADDRESS\");\n require(_msgSender() == from, \"AUTH_ACCESS_DENIED\");\n require(quantity != 0, \"AssetMinter: quantity cannot be 0\");\n }\n\n function _burnAndMint(\n MintData calldata mintData,\n uint16 catalystId,\n uint16[] calldata gemIds,\n uint256 quantity\n ) internal returns (uint256 assetId) {\n _mintRequirements(mintData.from, quantity, mintData.to);\n\n _burnCatalyst(mintData.from, catalystId, numberOfCatalystBurnPerAsset);\n _burnGems(mintData.from, gemIds, numberOfGemsBurnPerAsset);\n\n assetId = _assetERC1155.mint(\n mintData.from,\n mintData.packId,\n mintData.metadataHash,\n quantity,\n mintData.to,\n mintData.data\n );\n _registry.setCatalyst(assetId, catalystId, gemIds);\n }\n}\n" + }, + "src/solc_0.8/asset/AssetSignedAuctionWithAuth.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {IERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts-0.8/security/ReentrancyGuard.sol\";\nimport {SigUtil} from \"../common/Libraries/SigUtil.sol\";\nimport {PriceUtil} from \"../common/Libraries/PriceUtil.sol\";\nimport {TheSandbox712} from \"../common/Base/TheSandbox712.sol\";\nimport {MetaTransactionReceiver} from \"../common/BaseWithStorage/MetaTransactionReceiver.sol\";\nimport {ERC1271} from \"../common/interfaces/ERC1271.sol\";\nimport {ERC1271Constants} from \"../common/interfaces/ERC1271Constants.sol\";\nimport {ERC1654} from \"../common/interfaces/ERC1654.sol\";\nimport {ERC1654Constants} from \"../common/interfaces/ERC1654Constants.sol\";\nimport {IAuthValidator} from \"../common/interfaces/IAuthValidator.sol\";\nimport {IERC1155} from \"../common/interfaces/IERC1155.sol\";\n\ncontract AssetSignedAuctionWithAuth is\n ReentrancyGuard,\n ERC1654Constants,\n ERC1271Constants,\n TheSandbox712,\n MetaTransactionReceiver\n{\n struct ClaimSellerOfferRequest {\n address buyer;\n address payable seller;\n address token;\n uint256[] purchase;\n uint256[] auctionData;\n uint256[] ids;\n uint256[] amounts;\n bytes signature;\n bytes backendSignature;\n }\n\n enum SignatureType {DIRECT, EIP1654, EIP1271}\n\n bytes32 public constant BACKEND_TYPEHASH =\n keccak256(\n \"Auction(address to,address from,address token,bytes auctionData,bytes ids,bytes amounts,bytes purchase)\"\n );\n\n bytes32 public constant AUCTION_TYPEHASH =\n keccak256(\"Auction(address from,address token,bytes auctionData,bytes ids,bytes amounts)\");\n\n event OfferClaimed(\n address indexed seller,\n address indexed buyer,\n uint256 indexed offerId,\n uint256 amount,\n uint256 pricePaid,\n uint256 feePaid\n );\n event OfferCancelled(address indexed seller, uint256 indexed offerId);\n event NewFeeLimit(uint256 feeLimit);\n\n uint256 public constant MAX_UINT256 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;\n\n // Stack too deep, grouping parameters\n // AuctionData:\n uint256 public constant AuctionData_OfferId = 0;\n uint256 public constant AuctionData_StartingPrice = 1;\n uint256 public constant AuctionData_EndingPrice = 2;\n uint256 public constant AuctionData_StartedAt = 3;\n uint256 public constant AuctionData_Duration = 4;\n uint256 public constant AuctionData_Packs = 5;\n\n mapping(address => mapping(uint256 => uint256)) public claimed;\n\n IAuthValidator public _authValidator;\n IERC1155 public _asset;\n uint256 public _fee10000th = 0;\n uint256 public _feeLimit = 500;\n uint256 public _maxfeeLimit = 500; // 5%\n address payable public _feeCollector;\n\n event FeeSetup(address feeCollector, uint256 fee10000th);\n\n constructor(\n IERC1155 asset,\n address admin,\n address initialMetaTx,\n address payable feeCollector,\n uint256 fee10000th,\n address authValidator\n ) TheSandbox712() {\n require(fee10000th <= _feeLimit, \"Fee above the limit\");\n _asset = asset;\n _feeCollector = feeCollector;\n _fee10000th = fee10000th;\n emit FeeSetup(feeCollector, fee10000th);\n _admin = admin;\n _setMetaTransactionProcessor(initialMetaTx, true);\n _authValidator = IAuthValidator(authValidator);\n }\n\n // check backend signature to avoid front-running\n modifier isAuthValid(bytes memory signature, bytes32 hashedData) {\n require(_authValidator.isAuthValid(signature, hashedData), \"INVALID_AUTH\");\n _;\n }\n\n /// @notice set fee parameters\n /// @param feeCollector address receiving the fee\n /// @param fee10000th fee in 10,000th\n function setFee(address payable feeCollector, uint256 fee10000th) external {\n require(feeCollector != address(0), \"feeCollector cannot be Zero address\");\n require(msg.sender == _admin, \"only admin can change fee\");\n require(fee10000th <= _feeLimit, \"Fee above the limit\");\n _feeCollector = feeCollector;\n _fee10000th = fee10000th;\n emit FeeSetup(feeCollector, fee10000th);\n }\n\n /// @notice setFeeLimit parameters\n /// @param newFeeLimit new fee limit\n function setFeeLimit(uint256 newFeeLimit) external {\n require(msg.sender == _admin, \"only admin can change fee limit\");\n require(newFeeLimit <= _maxfeeLimit, \"new limit above max limit\");\n\n _feeLimit = newFeeLimit;\n\n emit NewFeeLimit(newFeeLimit);\n }\n\n /// @notice claim offer using EIP712\n /// @param input Claim Seller Offer Request\n function claimSellerOffer(ClaimSellerOfferRequest memory input)\n external\n payable\n isAuthValid(\n input.backendSignature,\n _hashBackendSig(\n input.buyer,\n input.seller,\n input.token,\n input.auctionData,\n input.ids,\n input.amounts,\n input.purchase\n )\n )\n {\n _verifyParameters(\n input.buyer,\n input.seller,\n input.token,\n input.purchase[0],\n input.auctionData,\n input.ids,\n input.amounts\n );\n _ensureCorrectSigner(\n input.seller,\n input.token,\n input.auctionData,\n input.ids,\n input.amounts,\n input.signature,\n SignatureType.DIRECT\n );\n _executeDeal(\n input.token,\n input.purchase,\n input.buyer,\n input.seller,\n input.auctionData,\n input.ids,\n input.amounts\n );\n }\n\n /// @notice claim offer using EIP712 and EIP1271 signature verification scheme\n /// @param input Claim Seller Offer Request\n function claimSellerOfferViaEIP1271(ClaimSellerOfferRequest memory input)\n external\n payable\n isAuthValid(\n input.backendSignature,\n _hashBackendSig(\n input.buyer,\n input.seller,\n input.token,\n input.auctionData,\n input.ids,\n input.amounts,\n input.purchase\n )\n )\n {\n _verifyParameters(\n input.buyer,\n input.seller,\n input.token,\n input.purchase[0],\n input.auctionData,\n input.ids,\n input.amounts\n );\n _ensureCorrectSigner(\n input.seller,\n input.token,\n input.auctionData,\n input.ids,\n input.amounts,\n input.signature,\n SignatureType.EIP1271\n );\n _executeDeal(\n input.token,\n input.purchase,\n input.buyer,\n input.seller,\n input.auctionData,\n input.ids,\n input.amounts\n );\n }\n\n /// @notice claim offer using EIP712 and EIP1654 signature verification scheme\n /// @param input Claim Seller Offer Request\n function claimSellerOfferViaEIP1654(ClaimSellerOfferRequest memory input)\n external\n payable\n isAuthValid(\n input.backendSignature,\n _hashBackendSig(\n input.buyer,\n input.seller,\n input.token,\n input.auctionData,\n input.ids,\n input.amounts,\n input.purchase\n )\n )\n {\n _verifyParameters(\n input.buyer,\n input.seller,\n input.token,\n input.purchase[0],\n input.auctionData,\n input.ids,\n input.amounts\n );\n _ensureCorrectSigner(\n input.seller,\n input.token,\n input.auctionData,\n input.ids,\n input.amounts,\n input.signature,\n SignatureType.EIP1654\n );\n _executeDeal(\n input.token,\n input.purchase,\n input.buyer,\n input.seller,\n input.auctionData,\n input.ids,\n input.amounts\n );\n }\n\n /// @notice cancel a offer previously signed, new offer need to use a id not used yet\n /// @param offerId offer to cancel\n function cancelSellerOffer(uint256 offerId) external {\n require(claimed[msg.sender][offerId] != MAX_UINT256, \"Sell offer was already cancelled\");\n claimed[msg.sender][offerId] = MAX_UINT256;\n emit OfferCancelled(msg.sender, offerId);\n }\n\n function _executeDeal(\n address token,\n uint256[] memory purchase,\n address buyer,\n address payable seller,\n uint256[] memory auctionData,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal nonReentrant {\n uint256 offer =\n PriceUtil.calculateCurrentPrice(\n auctionData[AuctionData_StartingPrice],\n auctionData[AuctionData_EndingPrice],\n auctionData[AuctionData_Duration],\n block.timestamp - auctionData[AuctionData_StartedAt]\n ) * purchase[0];\n claimed[seller][auctionData[AuctionData_OfferId]] =\n claimed[seller][auctionData[AuctionData_OfferId]] +\n purchase[0];\n\n uint256 fee = 0;\n if (_fee10000th > 0) {\n fee = PriceUtil.calculateFee(offer, _fee10000th);\n }\n\n uint256 total = offer + fee;\n require(total <= purchase[1], \"offer exceeds max amount to spend\");\n\n if (token != address(0)) {\n require(IERC20(token).transferFrom(buyer, seller, offer), \"failed to transfer token price\");\n if (fee > 0) {\n require(IERC20(token).transferFrom(buyer, _feeCollector, fee), \"failed to collect fee\");\n }\n } else {\n require(msg.value >= total, \"ETH < total\");\n if (msg.value > total) {\n Address.sendValue(payable(msg.sender), msg.value - total);\n }\n Address.sendValue(seller, offer);\n if (fee > 0) {\n Address.sendValue(_feeCollector, fee);\n }\n }\n\n uint256[] memory packAmounts = new uint256[](amounts.length);\n for (uint256 i = 0; i < packAmounts.length; i++) {\n packAmounts[i] = amounts[i] * purchase[0];\n }\n _asset.safeBatchTransferFrom(seller, buyer, ids, packAmounts, \"\");\n emit OfferClaimed(seller, buyer, auctionData[AuctionData_OfferId], purchase[0], offer, fee);\n }\n\n function _ensureCorrectSigner(\n address from,\n address token,\n uint256[] memory auctionData,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory signature,\n SignatureType signatureType\n ) internal view {\n bytes memory dataToHash;\n\n dataToHash = abi.encodePacked(\n \"\\x19\\x01\",\n _DOMAIN_SEPARATOR,\n _hashAuction(from, token, auctionData, ids, amounts)\n );\n\n if (signatureType == SignatureType.EIP1271) {\n require(\n ERC1271(from).isValidSignature(dataToHash, signature) == ERC1271_MAGICVALUE,\n \"invalid 1271 signature\"\n );\n } else if (signatureType == SignatureType.EIP1654) {\n require(\n ERC1654(from).isValidSignature(keccak256(dataToHash), signature) == ERC1654_MAGICVALUE,\n \"invalid 1654 signature\"\n );\n } else {\n address signer = SigUtil.recover(keccak256(dataToHash), signature);\n require(signer == from, \"signer != from\");\n }\n }\n\n function _verifyParameters(\n address buyer,\n address payable seller,\n address token,\n uint256 buyAmount,\n uint256[] memory auctionData,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal view {\n require(ids.length == amounts.length, \"ids and amounts length not matching\");\n require(\n buyer == msg.sender || (token != address(0) && _metaTransactionContracts[msg.sender]),\n \"not authorized\"\n );\n uint256 amountAlreadyClaimed = claimed[seller][auctionData[AuctionData_OfferId]];\n require(amountAlreadyClaimed != MAX_UINT256, \"Auction cancelled\");\n\n uint256 total = amountAlreadyClaimed + buyAmount;\n require(total <= auctionData[AuctionData_Packs], \"Buy amount exceeds sell amount\");\n\n require(auctionData[AuctionData_StartedAt] <= block.timestamp, \"Auction didn't start yet\");\n require(\n auctionData[AuctionData_StartedAt] + auctionData[AuctionData_Duration] > block.timestamp,\n \"Auction finished\"\n );\n }\n\n function _hashAuction(\n address from,\n address token,\n uint256[] memory auctionData,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encode(\n AUCTION_TYPEHASH,\n from,\n token,\n keccak256(abi.encodePacked(auctionData)),\n keccak256(abi.encodePacked(ids)),\n keccak256(abi.encodePacked(amounts))\n )\n );\n }\n\n function _hashBackendSig(\n address to,\n address from,\n address token,\n uint256[] memory auctionData,\n uint256[] memory ids,\n uint256[] memory amounts,\n uint256[] memory purchase\n ) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encode(\n BACKEND_TYPEHASH,\n to,\n from,\n token,\n keccak256(abi.encodePacked(auctionData)),\n keccak256(abi.encodePacked(ids)),\n keccak256(abi.encodePacked(amounts)),\n keccak256(abi.encodePacked(purchase))\n )\n );\n }\n}\n" + }, + "src/solc_0.8/asset/AssetUpgrader.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\nimport \"@openzeppelin/contracts-0.8/utils/math/SafeMath.sol\";\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport \"../common/BaseWithStorage/ERC2771Handler.sol\";\nimport \"../common/interfaces/IAssetAttributesRegistry.sol\";\nimport \"../common/interfaces/IAssetUpgrader.sol\";\nimport \"../catalyst/GemsCatalystsRegistry.sol\";\nimport \"../common/interfaces/IERC20Extended.sol\";\nimport \"../common/interfaces/IPolygonAssetERC721.sol\";\nimport \"../common/interfaces/IPolygonAssetERC1155.sol\";\n\n/// @notice Allow to upgrade Asset with Catalyst, Gems and Sand, giving the assets attributes through AssetAttributeRegistry\ncontract AssetUpgrader is Ownable, ERC2771Handler, IAssetUpgrader {\n using SafeMath for uint256;\n\n address public immutable feeRecipient;\n uint256 public immutable upgradeFee;\n uint256 public immutable gemAdditionFee;\n uint256 private constant IS_NFT = 0x0000000000000000000000000000000000000000800000000000000000000000;\n address private constant BURN_ADDRESS = 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF;\n\n IERC20Extended internal immutable _sand;\n IAssetAttributesRegistry internal immutable _registry;\n IPolygonAssetERC721 internal immutable _assetERC721;\n IPolygonAssetERC1155 internal immutable _assetERC1155;\n GemsCatalystsRegistry internal immutable _gemsCatalystsRegistry;\n\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\n\n /// @notice AssetUpgrader depends on\n /// @param registry: AssetAttributesRegistry for recording catalyst and gems used\n /// @param sand: ERC20 for fee payment\n /// @param assetERC1155: ERC1155 Asset Token Contract\n /// @param gemsCatalystsRegistry: that track the canonical catalyst and gems and provide batch burning facility\n /// @param _upgradeFee: the fee in Sand paid for an upgrade (setting or replacing a catalyst)\n /// @param _gemAdditionFee: the fee in Sand paid for adding gems\n /// @param _feeRecipient: address receiving the Sand fee\n /// @param trustedForwarder: address of the trusted forwarder (used for metaTX)\n constructor(\n IAssetAttributesRegistry registry,\n IERC20Extended sand,\n IPolygonAssetERC721 assetERC721,\n IPolygonAssetERC1155 assetERC1155,\n GemsCatalystsRegistry gemsCatalystsRegistry,\n uint256 _upgradeFee,\n uint256 _gemAdditionFee,\n address _feeRecipient,\n address trustedForwarder\n ) {\n _registry = registry;\n _sand = sand;\n _assetERC721 = assetERC721;\n _assetERC1155 = assetERC1155;\n _gemsCatalystsRegistry = gemsCatalystsRegistry;\n upgradeFee = _upgradeFee;\n gemAdditionFee = _gemAdditionFee;\n feeRecipient = _feeRecipient;\n __ERC2771Handler_initialize(trustedForwarder);\n }\n\n /// @notice associate a catalyst to a fungible Asset token by extracting it as ERC721 first.\n /// @param from address from which the Asset token belongs to.\n /// @param assetId tokenId of the Asset being extracted.\n /// @param catalystId address of the catalyst token to use and burn.\n /// @param gemIds list of gems to socket into the catalyst (burned).\n /// @param to destination address receiving the extracted and upgraded ERC721 Asset token.\n /// @return tokenId The Id of the extracted token.\n function extractAndSetCatalyst(\n address from,\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds,\n address to\n ) external override returns (uint256 tokenId) {\n require(to != address(0), \"INVALID_TO_ZERO_ADDRESS\");\n require(_msgSender() == from, \"AUTH_ACCESS_DENIED\");\n tokenId = _assetERC1155.extractERC721From(from, assetId, from);\n _changeCatalyst(from, tokenId, catalystId, gemIds, to, false);\n }\n\n /// @notice associate a new catalyst to a non-fungible Asset token.\n /// @param from address from which the Asset token belongs to.\n /// @param assetId tokenId of the Asset being updated.\n /// @param catalystId address of the catalyst token to use and burn.\n /// @param gemIds list of gems to socket into the catalyst (burned).\n /// @param to destination address receiving the Asset token.\n /// @return tokenId The id of the asset.\n function changeCatalyst(\n address from,\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds,\n address to\n ) external override returns (uint256 tokenId) {\n require(to != address(0), \"INVALID_TO_ZERO_ADDRESS\");\n require(_msgSender() == from, \"AUTH_ACCESS_DENIED\");\n _changeCatalyst(from, assetId, catalystId, gemIds, to, true);\n return assetId;\n }\n\n /// @notice add gems to a non-fungible Asset token.\n /// @param from address from which the Asset token belongs to.\n /// @param assetId tokenId of the Asset to which the gems will be added to.\n /// @param gemIds list of gems to socket into the existing catalyst (burned).\n /// @param to destination address receiving the extracted and upgraded ERC721 Asset token.\n function addGems(\n address from,\n uint256 assetId,\n uint16[] calldata gemIds,\n address to\n ) external override {\n require(to != address(0), \"INVALID_TO_ZERO_ADDRESS\");\n require(_msgSender() == from, \"AUTH_ACCESS_DENIED\");\n _addGems(from, assetId, gemIds, to);\n }\n\n /// @dev Collect a fee in SAND tokens\n /// @param from The address paying the fee.\n /// @param sandFee The fee amount.\n function _chargeSand(address from, uint256 sandFee) internal {\n if (feeRecipient != address(0) && sandFee != 0) {\n if (feeRecipient == address(BURN_ADDRESS)) {\n // special address for burn\n _sand.burnFor(from, sandFee);\n } else {\n require(\n _sand.transferFrom(from, feeRecipient, sandFee),\n \"AssetUpgrader: ERC20 operation did not succeed\"\n );\n }\n }\n }\n\n /// @dev Change the catalyst for an asset.\n /// @param from The current owner of the asset.\n /// @param assetId The id of the asset to change.\n /// @param catalystId The id of the new catalyst to set.\n /// @param gemIds An array of gemIds to embed.\n /// @param to The address to transfer the asset to after the catalyst is changed.\n function _changeCatalyst(\n address from,\n uint256 assetId,\n uint16 catalystId,\n uint16[] memory gemIds,\n address to,\n bool isERC1155\n ) internal {\n require(assetId & IS_NFT != 0, \"INVALID_NOT_NFT\"); // Asset (ERC1155ERC721.sol) ensure NFT will return true here and non-NFT will return false\n _burnCatalyst(from, catalystId);\n _burnGems(from, gemIds);\n _chargeSand(from, upgradeFee);\n _registry.setCatalyst(assetId, catalystId, gemIds);\n _transfer(from, to, assetId, isERC1155);\n }\n\n /// @dev Add gems to an existing asset.\n /// @param from The current owner of the asset.\n /// @param assetId The asset to add gems to.\n /// @param gemIds An array of gemIds to add to the asset.\n /// @param to The address to transfer the asset to after adding gems.\n function _addGems(\n address from,\n uint256 assetId,\n uint16[] memory gemIds,\n address to\n ) internal {\n require(assetId & IS_NFT != 0, \"INVALID_NOT_NFT\"); // Asset (ERC1155ERC721.sol) ensure NFT will return true here and non-NFT will return false\n _burnGems(from, gemIds);\n _chargeSand(from, gemAdditionFee);\n _registry.addGems(assetId, gemIds);\n _transfer(from, to, assetId, true);\n }\n\n /// @dev transfer an asset if from != to.\n /// @param from The address to transfer the asset from.\n /// @param to The address to transfer the asset to.\n /// @param assetId The asset to transfer.\n function _transfer(\n address from,\n address to,\n uint256 assetId,\n bool isERC1155\n ) internal {\n if (isERC1155) {\n if (from != to) {\n _assetERC1155.safeTransferFrom(from, to, assetId, 1, \"\");\n } else {\n require(_assetERC1155.balanceOf(from, assetId) > 0, \"NOT_AUTHORIZED_ASSET_OWNER\");\n }\n } else {\n if (from != to) {\n _assetERC721.safeTransferFrom(from, to, assetId);\n } else {\n require(_assetERC721.ownerOf(assetId) == from, \"NOT_AUTHORIZED_ASSET_OWNER\");\n }\n }\n }\n\n /// @dev Burn gems.\n /// @param from The owner of the gems.\n /// @param gemIds The gem types to burn.\n function _burnGems(address from, uint16[] memory gemIds) internal {\n uint256[] memory gemFactors = new uint256[](gemIds.length);\n for (uint256 i = 0; i < gemIds.length; i++) {\n gemFactors[i] = 10**_gemsCatalystsRegistry.getGemDecimals(gemIds[i]);\n }\n _gemsCatalystsRegistry.batchBurnGems(from, gemIds, gemFactors);\n }\n\n /// @dev Burn a catalyst.\n /// @param from The owner of the catalyst.\n /// @param catalystId The catalyst type to burn.\n function _burnCatalyst(address from, uint16 catalystId) internal {\n uint256 catalystFactor = 10**_gemsCatalystsRegistry.getCatalystDecimals(catalystId);\n _gemsCatalystsRegistry.burnCatalyst(from, catalystId, catalystFactor);\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n\n emit TrustedForwarderChanged(trustedForwarder);\n }\n\n function _msgSender() internal view override(Context, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n}\n" + }, + "src/solc_0.8/asset/libraries/AssetHelper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../common/interfaces/IAssetAttributesRegistry.sol\";\n\n// used to reduce PolygonAssetV2 contract code size\nlibrary AssetHelper {\n struct AssetRegistryData {\n IAssetAttributesRegistry assetRegistry;\n }\n\n function setCatalystDatas(\n AssetRegistryData storage self,\n IAssetAttributesRegistry.AssetGemsCatalystData[] memory assetGemsCatalystData\n ) public {\n for (uint256 i = 0; i < assetGemsCatalystData.length; i++) {\n require(assetGemsCatalystData[i].catalystContractId > 0, \"WRONG_catalystContractId\");\n require(assetGemsCatalystData[i].assetId != 0, \"WRONG_assetId\");\n self.assetRegistry.setCatalystWhenDepositOnOtherLayer(\n assetGemsCatalystData[i].assetId,\n assetGemsCatalystData[i].catalystContractId,\n assetGemsCatalystData[i].gemContractIds\n );\n }\n }\n\n function decodeAndSetCatalystDataL1toL2(AssetRegistryData storage self, bytes calldata depositData)\n public\n returns (\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes32[] memory hashes\n )\n {\n bytes memory data;\n IAssetAttributesRegistry.AssetGemsCatalystData[] memory catalystDatas;\n (ids, amounts, data) = abi.decode(depositData, (uint256[], uint256[], bytes));\n (hashes, catalystDatas) = abi.decode(data, (bytes32[], IAssetAttributesRegistry.AssetGemsCatalystData[]));\n\n setCatalystDatas(self, catalystDatas);\n }\n\n function decodeAndSetCatalystDataL2toL1(AssetRegistryData storage self, bytes calldata data)\n public\n returns (bytes32[] memory hashes)\n {\n IAssetAttributesRegistry.AssetGemsCatalystData[] memory catalystDatas;\n\n (hashes, catalystDatas) = abi.decode(data, (bytes32[], IAssetAttributesRegistry.AssetGemsCatalystData[]));\n\n setCatalystDatas(self, catalystDatas);\n }\n\n function getGemsAndCatalystData(AssetRegistryData storage self, uint256[] calldata assetIds)\n public\n view\n returns (IAssetAttributesRegistry.AssetGemsCatalystData[] memory)\n {\n uint256 count = getGemsCatalystDataCount(self, assetIds);\n uint256 indexInCatalystArray;\n\n IAssetAttributesRegistry.AssetGemsCatalystData[] memory gemsCatalystDatas =\n new IAssetAttributesRegistry.AssetGemsCatalystData[](count);\n\n for (uint256 i = 0; i < assetIds.length; i++) {\n (bool isDataFound, uint16 catalystId, uint16[] memory gemIds) = self.assetRegistry.getRecord(assetIds[i]);\n if (isDataFound) {\n IAssetAttributesRegistry.AssetGemsCatalystData memory data;\n data.assetId = assetIds[i];\n data.catalystContractId = catalystId;\n data.gemContractIds = gemIds;\n require(indexInCatalystArray < count, \"indexInCatalystArray out of bound\");\n gemsCatalystDatas[indexInCatalystArray] = data;\n indexInCatalystArray++;\n }\n }\n\n return gemsCatalystDatas;\n }\n\n function getGemsCatalystDataCount(AssetRegistryData storage self, uint256[] calldata assetIds)\n internal\n view\n returns (uint256)\n {\n uint256 count;\n\n for (uint256 i = 0; i < assetIds.length; i++) {\n (bool isDataFound, , ) = self.assetRegistry.getRecord(assetIds[i]);\n if (isDataFound) {\n count++;\n }\n }\n return count;\n }\n}\n" + }, + "src/solc_0.8/asset/libraries/ERC1155ERC721Helper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nlibrary ERC1155ERC721Helper {\n bytes32 private constant base32Alphabet = 0x6162636465666768696A6B6C6D6E6F707172737475767778797A323334353637;\n\n uint256 public constant CREATOR_OFFSET_MULTIPLIER = uint256(2)**(256 - 160);\n uint256 public constant IS_NFT_OFFSET_MULTIPLIER = uint256(2)**(256 - 160 - 1);\n uint256 public constant CHAIN_INDEX_OFFSET_MULTIPLIER = uint256(2)**(256 - 160 - 1 - 8);\n uint256 public constant PACK_ID_OFFSET_MULTIPLIER = uint256(2)**(256 - 160 - 1 - 32 - 40);\n uint256 public constant PACK_NUM_FT_TYPES_OFFSET_MULTIPLIER = uint256(2)**(256 - 160 - 1 - 32 - 40 - 12);\n uint256 public constant NFT_INDEX_OFFSET = 63;\n\n uint256 public constant IS_NFT = 0x0000000000000000000000000000000000000000800000000000000000000000;\n uint256 public constant NOT_IS_NFT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFFFFFFFFFFF;\n uint256 public constant NFT_INDEX = 0x0000000000000000000000000000000000000000007FFFFF8000000000000000;\n uint256 public constant NOT_NFT_INDEX = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000007FFFFFFFFFFFFFFF;\n uint256 public constant URI_ID = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000007FFFFFFFFFFFF800;\n uint256 public constant PACK_ID = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000007FFFFFFFFF800000;\n uint256 public constant PACK_INDEX = 0x00000000000000000000000000000000000000000000000000000000000007FF;\n uint256 public constant PACK_NUM_FT_TYPES = 0x00000000000000000000000000000000000000000000000000000000007FF800;\n uint256 public constant CHAIN_INDEX = 0x00000000000000000000000000000000000000007F8000000000000000000000;\n uint256 public constant NOT_CHAIN_INDEX = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF807FFFFFFFFFFFFFFFFFFFFF;\n\n uint256 public constant MAX_SUPPLY = uint256(2)**32 - 1;\n uint256 public constant MAX_PACK_SIZE = uint256(2)**11;\n uint256 public constant MAX_NUM_FT = uint256(2)**12;\n\n function toFullURI(bytes32 hash, uint256 id) external pure returns (string memory) {\n return string(abi.encodePacked(\"ipfs://bafybei\", hash2base32(hash), \"/\", uint2str(id & PACK_INDEX), \".json\"));\n }\n\n // solium-disable-next-line security/no-assign-params\n function hash2base32(bytes32 hash) public pure returns (string memory _uintAsString) {\n uint256 _i = uint256(hash);\n uint256 k = 52;\n bytes memory bstr = new bytes(k);\n bstr[--k] = base32Alphabet[uint8((_i % 8) << 2)]; // uint8 s = uint8((256 - skip) % 5); // (_i % (2**s)) << (5-s)\n _i /= 8;\n while (k > 0) {\n bstr[--k] = base32Alphabet[_i % 32];\n _i /= 32;\n }\n return string(bstr);\n }\n\n // solium-disable-next-line security/no-assign-params\n function uint2str(uint256 _i) public pure returns (string memory _uintAsString) {\n if (_i == 0) {\n return \"0\";\n }\n\n uint256 j = _i;\n uint256 len;\n while (j != 0) {\n len++;\n j /= 10;\n }\n\n bytes memory bstr = new bytes(len);\n uint256 k = len;\n while (_i != 0) {\n bstr[--k] = bytes1(uint8(48 + uint8(_i % 10)));\n _i /= 10;\n }\n\n return string(bstr);\n }\n}\n" + }, + "src/solc_0.8/assetERC1155/AssetBaseERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155Receiver.sol\";\nimport \"../common/interfaces/IAssetERC721.sol\";\nimport \"../common/Libraries/ObjectLib32.sol\";\nimport \"../common/BaseWithStorage/WithSuperOperators.sol\";\nimport \"../asset/libraries/ERC1155ERC721Helper.sol\";\n\n// solhint-disable max-states-count\nabstract contract AssetBaseERC1155 is WithSuperOperators, IERC1155 {\n using Address for address;\n using ObjectLib32 for ObjectLib32.Operations;\n using ObjectLib32 for uint256;\n\n bytes4 private constant ERC1155_IS_RECEIVER = 0x4e2312e0;\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n mapping(address => uint256) private _numNFTPerAddress; // erc721\n mapping(uint256 => uint256) private _owners; // erc721\n mapping(address => mapping(uint256 => uint256)) private _packedTokenBalance; // erc1155\n mapping(address => mapping(address => bool)) private _operatorsForAll; // erc721 and erc1155\n mapping(uint256 => address) private _erc721operators; // erc721\n mapping(uint256 => bytes32) internal _metadataHash; // erc721 and erc1155\n mapping(uint256 => bytes) internal _rarityPacks; // rarity configuration per packs (2 bits per Asset) *DEPRECATED*\n mapping(uint256 => uint32) private _nextCollectionIndex; // extraction\n\n // @note : Deprecated.\n mapping(address => address) private _creatorship; // creatorship transfer // deprecated\n\n mapping(address => bool) private _bouncers; // the contracts allowed to mint\n\n // @note : Deprecated.\n mapping(address => bool) private _metaTransactionContracts;\n\n address private _bouncerAdmin;\n\n bool internal _init;\n\n bytes4 internal constant ERC165ID = 0x01ffc9a7;\n\n uint256 internal _initBits;\n address internal _predicate; // used in place of polygon's `PREDICATE_ROLE`\n\n uint8 internal _chainIndex; // modify this for l2\n\n address internal _trustedForwarder;\n\n IAssetERC721 public _assetERC721;\n\n uint256[20] private __gap;\n // solhint-enable max-states-count\n\n event BouncerAdminChanged(address indexed oldBouncerAdmin, address indexed newBouncerAdmin);\n event Bouncer(address indexed bouncer, bool indexed enabled);\n event Extraction(uint256 indexed id, uint256 indexed newId);\n event AssetERC721Set(IAssetERC721 indexed assetERC721);\n\n function init(\n address trustedForwarder,\n address admin,\n address bouncerAdmin,\n IAssetERC721 assetERC721,\n uint8 chainIndex\n ) public {\n // one-time init of bitfield's previous versions\n _checkInit(1);\n _admin = admin;\n _bouncerAdmin = bouncerAdmin;\n _assetERC721 = assetERC721;\n __ERC2771Handler_initialize(trustedForwarder);\n _chainIndex = chainIndex;\n }\n\n /// @notice Change the minting administrator to be `newBouncerAdmin`.\n /// @param newBouncerAdmin address of the new minting administrator.\n function changeBouncerAdmin(address newBouncerAdmin) external {\n require(_msgSender() == _bouncerAdmin, \"!BOUNCER_ADMIN\");\n require(newBouncerAdmin != address(0), \"AssetBaseERC1155: new bouncer admin can't be zero address\");\n emit BouncerAdminChanged(_bouncerAdmin, newBouncerAdmin);\n _bouncerAdmin = newBouncerAdmin;\n }\n\n /// @notice Enable or disable the ability of `bouncer` to mint tokens (minting bouncer rights).\n /// @param bouncer address that will be given/removed minting bouncer rights.\n /// @param enabled set whether the address is enabled or disabled as a minting bouncer.\n function setBouncer(address bouncer, bool enabled) external {\n require(_msgSender() == _bouncerAdmin, \"!BOUNCER_ADMIN\");\n _bouncers[bouncer] = enabled;\n emit Bouncer(bouncer, enabled);\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param value amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function _safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) internal {\n require(to != address(0), \"TO==0\");\n require(from != address(0), \"FROM==0\");\n bool success = _transferFrom(from, to, id, value);\n if (success) {\n require(_checkOnERC1155Received(_msgSender(), from, to, id, value, data), \"1155_TRANSFER_REJECTED\");\n }\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @dev call data should be optimized to order ids so packedBalance can be used efficiently.\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param values amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function _safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) internal {\n require(ids.length == values.length, \"MISMATCHED_ARR_LEN\");\n require(to != address(0), \"TO==0\");\n require(from != address(0), \"FROM==0\");\n address msgSender = _msgSender();\n bool authorized = from == msgSender || isApprovedForAll(from, msgSender);\n\n _batchTransferFrom(from, to, ids, values, authorized);\n emit TransferBatch(msgSender, from, to, ids, values);\n require(_checkOnERC1155BatchReceived(msgSender, from, to, ids, values, data), \"1155_TRANSFER_REJECTED\");\n }\n\n /// @notice Enable or disable approval for `operator` to manage all `sender`'s tokens.\n /// @dev used for Meta Transaction (from metaTransactionContract).\n /// @param sender address which grant approval.\n /// @param operator address which will be granted rights to transfer all token owned by `sender`.\n /// @param approved whether to approve or revoke.\n function _setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) internal {\n require(sender == _msgSender() || _superOperators[_msgSender()], \"!AUTHORIZED\");\n _setApprovalForAll(sender, operator, approved);\n }\n\n /// @notice Returns the current administrator in charge of minting rights.\n /// @return the current minting administrator in charge of minting rights.\n function getBouncerAdmin() external view returns (address) {\n return _bouncerAdmin;\n }\n\n /// @notice check whether address `who` is given minting bouncer rights.\n /// @param who The address to query.\n /// @return whether the address has minting rights.\n function isBouncer(address who) public view returns (bool) {\n return _bouncers[who];\n }\n\n /// @notice Get the balance of `owners` for each token type `ids`.\n /// @param owners the addresses of the token holders queried.\n /// @param ids ids of each token type to query.\n /// @return the balance of each `owners` for each token type `ids`.\n function balanceOfBatch(address[] calldata owners, uint256[] calldata ids)\n external\n view\n override\n returns (uint256[] memory)\n {\n require(owners.length == ids.length, \"ARG_LENGTH_MISMATCH\");\n uint256[] memory balances = new uint256[](ids.length);\n for (uint256 i = 0; i < ids.length; i++) {\n balances[i] = balanceOf(owners[i], ids[i]);\n }\n return balances;\n }\n\n /// @notice A descriptive name for the collection of tokens in this contract.\n /// @return _name the name of the tokens.\n function name() external pure returns (string memory _name) {\n return \"Sandbox's ASSETs\";\n }\n\n /// @notice An abbreviated name for the collection of tokens in this contract.\n /// @return _symbol the symbol of the tokens.\n function symbol() external pure returns (string memory _symbol) {\n return \"ASSET\";\n }\n\n /// @notice Query if a contract implements interface `id`.\n /// @param id the interface identifier, as specified in ERC-165.\n /// @return `true` if the contract implements `id`.\n function supportsInterface(bytes4 id) external pure override returns (bool) {\n return\n id == 0x01ffc9a7 || //ERC165\n id == 0xd9b67a26 || // ERC1155\n id == 0x0e89341c || // ERC1155 metadata\n id == 0x572b6c05; // ERC2771\n }\n\n /// Collection methods for ERC721s extracted from an ERC1155 -----------------------------------------------------\n\n /// @notice Gives the collection a specific token belongs to.\n /// @param id the token to get the collection of.\n /// @return the collection the NFT is part of.\n function collectionOf(uint256 id) public view returns (uint256) {\n require(doesHashExist(id), \"INVALID_ID\"); // Note: doesHashExist must track ERC721s\n uint256 collectionId = id & ERC1155ERC721Helper.NOT_NFT_INDEX & ERC1155ERC721Helper.NOT_IS_NFT;\n require(doesHashExist(collectionId), \"UNMINTED_COLLECTION\");\n return collectionId;\n }\n\n /// @notice Return wether the id is a collection\n /// @param id collectionId to check.\n /// @return whether the id is a collection.\n function isCollection(uint256 id) external view returns (bool) {\n uint256 collectionId = id & ERC1155ERC721Helper.NOT_NFT_INDEX & ERC1155ERC721Helper.NOT_IS_NFT;\n return doesHashExist(collectionId);\n }\n\n /// @notice Gives the index at which an NFT was minted in a collection : first of a collection get the zero index.\n /// @param id the token to get the index of.\n /// @return the index/order at which the token `id` was minted in a collection.\n function collectionIndexOf(uint256 id) external view returns (uint256) {\n collectionOf(id); // this check if id and collection indeed was ever minted\n return uint24((id & ERC1155ERC721Helper.NFT_INDEX) >> ERC1155ERC721Helper.NFT_INDEX_OFFSET);\n }\n\n /// end collection methods ---------------------------------------------------------------------------------------\n\n /// @notice Whether or not an ERC1155 or ERC721 tokenId has a valid structure and the metadata hash exists.\n /// @param id the token to check.\n /// @return bool whether a given id has a valid structure.\n /// @dev if IS_NFT > 0 then PACK_NUM_FT_TYPES may be 0\n function doesHashExist(uint256 id) public view returns (bool) {\n return (((id & ERC1155ERC721Helper.PACK_INDEX) <=\n ((id & ERC1155ERC721Helper.PACK_NUM_FT_TYPES) / ERC1155ERC721Helper.PACK_NUM_FT_TYPES_OFFSET_MULTIPLIER)) &&\n _metadataHash[id & ERC1155ERC721Helper.URI_ID] != 0);\n }\n\n /// @notice A distinct Uniform Resource Identifier (URI) for a given ERC1155 asset.\n /// @param id ERC1155 token to get the uri of.\n /// @return URI string\n function uri(uint256 id) public view returns (string memory) {\n require(doesHashExist(id), \"INVALID_ID\"); // prevent returning invalid uri\n return ERC1155ERC721Helper.toFullURI(_metadataHash[id & ERC1155ERC721Helper.URI_ID], id);\n }\n\n /// @notice Get the balance of `owner` for the token type `id`.\n /// @param owner The address of the token holder.\n /// @param id the token type of which to get the balance of.\n /// @return the balance of `owner` for the token type `id`.\n function balanceOf(address owner, uint256 id) public view override returns (uint256) {\n require(doesHashExist(id), \"INVALID_ID\");\n (uint256 bin, uint256 index) = id.getTokenBinIndex();\n return _packedTokenBalance[owner][bin].getValueInBin(index);\n }\n\n /// @notice Extracts an EIP-721 Asset from an EIP-1155 Asset.\n /// @dev Extraction is limited to bouncers.\n /// @param sender address which own the token to be extracted.\n /// @param id the token type to extract from.\n /// @param to address which will receive the token.\n /// @return newId the id of the newly minted NFT.\n function extractERC721From(\n address sender,\n uint256 id,\n address to\n ) external returns (uint256) {\n require(sender == _msgSender() || isApprovedForAll(sender, _msgSender()), \"!AUTHORIZED\");\n require(isBouncer(_msgSender()), \"!BOUNCER\");\n require(to != address(0), \"TO==0\");\n require(id & ERC1155ERC721Helper.IS_NFT == 0, \"UNIQUE_ERC1155\");\n uint24 tokenCollectionIndex = uint24(_nextCollectionIndex[id]) + 1;\n _nextCollectionIndex[id] = tokenCollectionIndex;\n string memory metaData = uri(id);\n uint256 newId =\n id +\n ERC1155ERC721Helper.IS_NFT_OFFSET_MULTIPLIER + // newId is always an NFT; IS_NFT is 1\n (tokenCollectionIndex) *\n 2**ERC1155ERC721Helper.NFT_INDEX_OFFSET; // uint24 nft index\n _burnFT(sender, id, 1);\n _assetERC721.mint(to, newId, bytes(abi.encode(metaData)));\n emit Extraction(id, newId);\n return newId;\n }\n\n /// @notice Set the ERC721 contract.\n /// @param assetERC721 the contract address to set the ERC721 contract to.\n /// @return true if the operation completes successfully.\n function setAssetERC721(IAssetERC721 assetERC721) external returns (bool) {\n require(_admin == _msgSender(), \"!AUTHORIZED\");\n _assetERC721 = assetERC721;\n emit AssetERC721Set(assetERC721);\n return true;\n }\n\n /// @notice Queries the approval status of `operator` for owner `owner`.\n /// @param owner the owner of the tokens.\n /// @param operator address of authorized operator.\n /// @return isOperator true if the operator is approved, false if not.\n function isApprovedForAll(address owner, address operator)\n public\n view\n override(IERC1155)\n returns (bool isOperator)\n {\n require(owner != address(0), \"OWNER==0\");\n require(operator != address(0), \"OPERATOR==0\");\n return _operatorsForAll[owner][operator] || _superOperators[operator];\n }\n\n /// @notice Queries the chainIndex that a token was minted on originally.\n /// @param id the token id to query.\n /// @return chainIndex the chainIndex that the token was minted on originally.\n /// @dev take care not to confuse chainIndex with chain ID.\n function getChainIndex(uint256 id) external pure returns (uint256) {\n return uint8((id & ERC1155ERC721Helper.CHAIN_INDEX) / ERC1155ERC721Helper.CHAIN_INDEX_OFFSET_MULTIPLIER);\n }\n\n function __ERC2771Handler_initialize(address forwarder) internal {\n _trustedForwarder = forwarder;\n }\n\n function isTrustedForwarder(address forwarder) public view returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n function getTrustedForwarder() external view returns (address) {\n return _trustedForwarder;\n }\n\n function _msgSender() internal view virtual returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return msg.sender;\n }\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender)) {\n return msg.data[:msg.data.length - 20];\n } else {\n return msg.data;\n }\n }\n\n function _setApprovalForAll(\n address sender,\n address operator,\n bool approved\n ) internal {\n require(sender != address(0), \"SENDER==0\");\n require(sender != operator, \"SENDER==OPERATOR\");\n require(operator != address(0), \"OPERATOR==0\");\n require(!_superOperators[operator], \"APPR_EXISTING_SUPEROPERATOR\");\n _operatorsForAll[sender][operator] = approved;\n emit ApprovalForAll(sender, operator, approved);\n }\n\n /* solhint-disable code-complexity */\n function _batchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory values,\n bool authorized\n ) internal {\n uint256 numItems = ids.length;\n uint256 bin;\n uint256 index;\n uint256 balFrom;\n uint256 balTo;\n\n uint256 lastBin;\n require(authorized, \"OPERATOR_!AUTH\");\n\n for (uint256 i = 0; i < numItems; i++) {\n if (from == to) {\n _checkEnoughBalance(from, ids[i], values[i]);\n } else if (values[i] > 0) {\n (bin, index) = ids[i].getTokenBinIndex();\n if (lastBin == 0) {\n lastBin = bin;\n balFrom = ObjectLib32.updateTokenBalance(\n _packedTokenBalance[from][bin],\n index,\n values[i],\n ObjectLib32.Operations.SUB\n );\n balTo = ObjectLib32.updateTokenBalance(\n _packedTokenBalance[to][bin],\n index,\n values[i],\n ObjectLib32.Operations.ADD\n );\n } else {\n if (bin != lastBin) {\n _packedTokenBalance[from][lastBin] = balFrom;\n _packedTokenBalance[to][lastBin] = balTo;\n balFrom = _packedTokenBalance[from][bin];\n balTo = _packedTokenBalance[to][bin];\n lastBin = bin;\n }\n\n balFrom = balFrom.updateTokenBalance(index, values[i], ObjectLib32.Operations.SUB);\n balTo = balTo.updateTokenBalance(index, values[i], ObjectLib32.Operations.ADD);\n }\n }\n }\n\n if (bin != 0 && from != to) {\n _packedTokenBalance[from][bin] = balFrom;\n _packedTokenBalance[to][bin] = balTo;\n }\n }\n\n function _burn(\n address from,\n uint256 id,\n uint256 amount\n ) internal {\n require(amount > 0 && amount <= ERC1155ERC721Helper.MAX_SUPPLY, \"INVALID_AMOUNT\");\n _burnFT(from, id, uint32(amount));\n emit TransferSingle(_msgSender(), from, address(0), id, amount);\n }\n\n function _burnBatch(\n address from,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal {\n address operator = _msgSender();\n for (uint256 i = 0; i < ids.length; i++) {\n require(amounts[i] > 0 && amounts[i] <= ERC1155ERC721Helper.MAX_SUPPLY, \"INVALID_AMOUNT\");\n _burnFT(from, ids[i], uint32(amounts[i]));\n }\n emit TransferBatch(operator, from, address(0), ids, amounts);\n }\n\n function _burnFT(\n address from,\n uint256 id,\n uint32 amount\n ) internal {\n (uint256 bin, uint256 index) = (id).getTokenBinIndex();\n _packedTokenBalance[from][bin] = _packedTokenBalance[from][bin].updateTokenBalance(\n index,\n amount,\n ObjectLib32.Operations.SUB\n );\n }\n\n function _mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal {\n uint16 offset = 0;\n while (offset < amounts.length) {\n _mintPack(offset, amounts, to, ids);\n offset += 8;\n }\n _completeBatchMint(_msgSender(), to, ids, amounts, data);\n }\n\n function _mintPack(\n uint16 offset,\n uint256[] memory supplies,\n address owner,\n uint256[] memory ids\n ) internal {\n (uint256 bin, uint256 index) = ids[offset].getTokenBinIndex();\n for (uint256 i = 0; i < 8 && offset + i < supplies.length; i++) {\n uint256 j = offset + i;\n if (supplies[j] > 0) {\n _packedTokenBalance[owner][bin] = _packedTokenBalance[owner][bin].updateTokenBalance(\n index + i,\n supplies[j],\n ObjectLib32.Operations.ADD\n );\n }\n }\n }\n\n function _transferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value\n ) internal returns (bool) {\n address sender = _msgSender();\n bool authorized = from == sender || isApprovedForAll(from, sender);\n\n require(authorized, \"OPERATOR_!AUTH\");\n if (value > 0) {\n (uint256 bin, uint256 index) = id.getTokenBinIndex();\n _packedTokenBalance[from][bin] = _packedTokenBalance[from][bin].updateTokenBalance(\n index,\n value,\n ObjectLib32.Operations.SUB\n );\n _packedTokenBalance[to][bin] = _packedTokenBalance[to][bin].updateTokenBalance(\n index,\n value,\n ObjectLib32.Operations.ADD\n );\n }\n\n emit TransferSingle(sender, from, to, id, value);\n return true;\n }\n\n function _mint(\n address operator,\n address account,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (uint256 bin, uint256 index) = id.getTokenBinIndex();\n _packedTokenBalance[account][bin] = _packedTokenBalance[account][bin].updateTokenBalance(\n index,\n amount,\n ObjectLib32.Operations.REPLACE\n );\n\n emit TransferSingle(operator, address(0), account, id, amount);\n require(_checkOnERC1155Received(operator, address(0), account, id, amount, data), \"TRANSFER_REJECTED\");\n }\n\n function _mintBatches(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal {\n for (uint256 i = 0; i < amounts.length; i++) {\n if (amounts[i] > 0) {\n (uint256 bin, uint256 index) = ids[i].getTokenBinIndex();\n _packedTokenBalance[to][bin] = _packedTokenBalance[to][bin].updateTokenBalance(\n index,\n amounts[i],\n ObjectLib32.Operations.REPLACE\n );\n }\n }\n _completeBatchMint(_msgSender(), to, ids, amounts, data);\n }\n\n function _mintDeficit(\n address account,\n uint256 id,\n uint256 amount\n ) internal {\n address sender = _msgSender();\n (uint256 bin, uint256 index) = id.getTokenBinIndex();\n _packedTokenBalance[account][bin] = _packedTokenBalance[account][bin].updateTokenBalance(\n index,\n amount,\n ObjectLib32.Operations.ADD\n );\n\n emit TransferSingle(sender, address(0), account, id, amount);\n require(_checkOnERC1155Received(sender, address(0), account, id, amount, \"\"), \"TRANSFER_REJECTED\");\n }\n\n /// @dev Allows the use of a bitfield to track the initialized status of the version `v` passed in as an arg.\n /// If the bit at the index corresponding to the given version is already set, revert.\n /// Otherwise, set the bit and return.\n /// @param v The version of this contract.\n function _checkInit(uint256 v) internal {\n require((_initBits >> v) & uint256(1) != 1, \"ALREADY_INITIALISED\");\n _initBits = _initBits | (uint256(1) << v);\n }\n\n function _completeBatchMint(\n address operator,\n address owner,\n uint256[] memory ids,\n uint256[] memory supplies,\n bytes memory data\n ) internal {\n emit TransferBatch(operator, address(0), owner, ids, supplies);\n require(_checkOnERC1155BatchReceived(operator, address(0), owner, ids, supplies, data), \"TRANSFER_REJECTED\");\n }\n\n function _checkEnoughBalance(\n address from,\n uint256 id,\n uint256 value\n ) internal view {\n (uint256 bin, uint256 index) = id.getTokenBinIndex();\n require(_packedTokenBalance[from][bin].getValueInBin(index) >= value, \"BALANCE_TOO_LOW\");\n }\n\n function _checkOnERC1155Received(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes memory data\n ) internal returns (bool) {\n if (!to.isContract()) {\n return true;\n }\n\n return IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data) == ERC1155_RECEIVED;\n }\n\n function _checkOnERC1155BatchReceived(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory values,\n bytes memory data\n ) internal returns (bool) {\n if (!to.isContract()) {\n return true;\n }\n bytes4 retval = IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, values, data);\n return (retval == ERC1155_BATCH_RECEIVED);\n }\n}\n" + }, + "src/solc_0.8/assetERC1155/AssetERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./AssetBaseERC1155.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {\n DefaultOperatorFiltererUpgradeable\n} from \"../OperatorFilterer/contracts/upgradeable/DefaultOperatorFiltererUpgradeable.sol\";\nimport {OperatorFiltererUpgradeable} from \"../OperatorFilterer/contracts/upgradeable/OperatorFiltererUpgradeable.sol\";\n\n// solhint-disable-next-line no-empty-blocks\ncontract AssetERC1155 is AssetBaseERC1155, OperatorFiltererUpgradeable {\n event PredicateSet(address predicate);\n\n function initialize(\n address trustedForwarder,\n address admin,\n address bouncerAdmin,\n IAssetERC721 assetERC721,\n uint8 chainIndex,\n address subscription\n ) external initializer {\n init(trustedForwarder, admin, bouncerAdmin, assetERC721, chainIndex);\n __OperatorFilterer_init(subscription, true);\n }\n\n /// @notice Mint a token type for `creator` on slot `packId`.\n /// @dev Function implementation reserved for future use cases on L1.\n /// @dev For this function it is not required to provide data.\n /// @param creator address of the creator of the token.\n /// @param packId unique packId for that token.\n /// @param hash hash of an IPFS cidv1 folder that contains the metadata of the token type in the file 0.json.\n /// @param supply number of tokens minted for that token type.\n /// @param owner address that will receive the tokens.\n /// @param data extra data to accompany the minting call.\n /// @return id the id of the newly minted token type.\n function mint(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256 supply,\n address owner,\n bytes calldata data\n ) external returns (uint256 id) {\n require(hash != 0, \"HASH==0\");\n require(isBouncer(_msgSender()), \"!BOUNCER\");\n require(owner != address(0), \"TO==0\");\n id = _generateTokenId(creator, supply, packId, supply == 1 ? 0 : 1, 0);\n uint256 uriId = id & ERC1155ERC721Helper.URI_ID;\n require(uint256(_metadataHash[uriId]) == 0, \"ID_TAKEN\");\n _metadataHash[uriId] = hash;\n _mint(_msgSender(), owner, id, supply, data);\n }\n\n /// @notice Creates `amount` tokens of token type `id`, and assigns them to `account`.\n /// @dev Should be callable only by AssetERC1155Tunnel.\n /// @dev Encoded bytes32 metadata hash must be provided as data.\n /// Make sure minting is done only by this function.\n /// @param account user address for whom token is being minted.\n /// @param id token which is being minted.\n /// @param amount amount of token being minted.\n /// @param data token metadata.\n function mint(\n address account,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external {\n require(_msgSender() == _predicate, \"!PREDICATE\");\n require(data.length > 0, \"METADATA_MISSING\");\n require(account != address(0), \"TO==0\");\n uint256 uriId = id & ERC1155ERC721Helper.URI_ID;\n require(uint256(_metadataHash[uriId]) == 0, \"ID_TAKEN\");\n _metadataHash[uriId] = abi.decode(data, (bytes32));\n _mint(_msgSender(), account, id, amount, data);\n }\n\n /// @notice Creates `amounts` tokens of token types `ids`, and assigns them to `account`.\n /// @dev Should be callable only by AssetERC1155Tunnel.\n /// @dev Encoded bytes32[] metadata hashes must be provided as data.\n /// @param to address to mint to.\n /// @param ids ids to mint.\n /// @param amounts supply for each token type.\n /// @param data token metadata.\n function mintMultiple(\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external {\n require(ids.length == amounts.length, \"AssetERC1155: ids and amounts length mismatch\");\n require(_msgSender() == _predicate, \"!PREDICATE\");\n require(data.length > 0, \"METADATA_MISSING\");\n require(to != address(0), \"TO==0\");\n bytes32[] memory hashes = abi.decode(data, (bytes32[]));\n for (uint256 i = 0; i < ids.length; i++) {\n uint256 uriId = ids[i] & ERC1155ERC721Helper.URI_ID;\n require(uint256(_metadataHash[uriId]) == 0, \"ID_TAKEN\");\n _metadataHash[uriId] = hashes[i];\n }\n _mintBatches(to, ids, amounts, data);\n }\n\n /// @notice function to be called by tunnel to mint deficit of minted tokens\n /// @dev This mint calls for add instead of replace in packedTokenBalance\n /// @param account address of the ownerof tokens.\n /// @param id id of the token to be minted.\n /// @param amount quantity of the token to be minted.\n function mintDeficit(\n address account,\n uint256 id,\n uint256 amount\n ) external {\n require(_msgSender() == _predicate, \"!PREDICATE\");\n _mintDeficit(account, id, amount);\n }\n\n /// @notice Set the address that will be able to mint on L1 (limited to custom predicate).\n /// @param predicate address that will be given minting rights for L1.\n function setPredicate(address predicate) external {\n require(_msgSender() == _admin, \"!ADMIN\");\n _predicate = predicate;\n emit PredicateSet(predicate);\n }\n\n /// @notice Burns `amount` tokens of type `id`.\n /// @param id token type which will be burnt.\n /// @param amount amount of token to burn.\n function burn(uint256 id, uint256 amount) external {\n _burn(_msgSender(), id, amount);\n }\n\n /// @notice Burns `amount` tokens of type `id` from `from`.\n /// @param from address whose token is to be burnt.\n /// @param id token type which will be burnt.\n /// @param amount amount of token to burn.\n function burnFrom(\n address from,\n uint256 id,\n uint256 amount\n ) external {\n require(from == _msgSender() || isApprovedForAll(from, _msgSender()), \"!AUTHORIZED\");\n _burn(from, id, amount);\n }\n\n /// @notice gets the metadata hash set for the and asset with id \"id\"\n /// @param id the id of the asset whose metadata hash has to be returned\n function metadataHash(uint256 id) external view returns (bytes32) {\n return _metadataHash[id & ERC1155ERC721Helper.URI_ID];\n }\n\n function _generateTokenId(\n address creator,\n uint256 supply,\n uint40 packId,\n uint16 numFTs,\n uint16 packIndex\n ) internal view returns (uint256) {\n require(supply > 0 && supply <= ERC1155ERC721Helper.MAX_SUPPLY, \"SUPPLY_OUT_OF_BOUNDS\");\n require(numFTs >= 0 && numFTs <= ERC1155ERC721Helper.MAX_NUM_FT, \"NUM_FT_OUT_OF_BOUNDS\");\n return\n uint256(uint160(creator)) *\n ERC1155ERC721Helper.CREATOR_OFFSET_MULTIPLIER + // CREATOR uint160\n (supply == 1 ? uint256(1) * ERC1155ERC721Helper.IS_NFT_OFFSET_MULTIPLIER : 0) + // minted as NFT(1)|FT(0), 1 bit\n uint256(_chainIndex) *\n ERC1155ERC721Helper.CHAIN_INDEX_OFFSET_MULTIPLIER + // mainnet = 0, polygon = 1, uint8\n uint256(packId) *\n ERC1155ERC721Helper.PACK_ID_OFFSET_MULTIPLIER + // packId (unique pack), uint40\n numFTs *\n ERC1155ERC721Helper.PACK_NUM_FT_TYPES_OFFSET_MULTIPLIER + // number of fungible token in the pack, 12 bits\n packIndex; // packIndex (position in the pack), 11 bits\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param value amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override onlyAllowedOperator(from) {\n super._safeTransferFrom(from, to, id, value, data);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @dev call data should be optimized to order ids so packedBalance can be used efficiently.\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param values amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override onlyAllowedOperator(from) {\n super._safeBatchTransferFrom(from, to, ids, values, data);\n }\n\n /// @notice Enable or disable approval for `operator` to manage all `sender`'s tokens.\n /// @dev used for Meta Transaction (from metaTransactionContract).\n /// @param sender address which grant approval.\n /// @param operator address which will be granted rights to transfer all token owned by `sender`.\n /// @param approved whether to approve or revoke.\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) external onlyAllowedOperatorApproval(operator) {\n super._setApprovalForAll(sender, operator, approved);\n }\n\n /// @notice Enable or disable approval for `operator` to manage all of the caller's tokens.\n /// @param operator address which will be granted rights to transfer all tokens of the caller.\n /// @param approved whether to approve or revoke\n function setApprovalForAll(address operator, bool approved)\n external\n override(IERC1155)\n onlyAllowedOperatorApproval(operator)\n {\n super._setApprovalForAll(_msgSender(), operator, approved);\n }\n\n function _msgSender()\n internal\n view\n virtual\n override(ContextUpgradeable, AssetBaseERC1155)\n returns (address sender)\n {\n return AssetBaseERC1155._msgSender();\n }\n\n function _msgData() internal view virtual override(ContextUpgradeable, AssetBaseERC1155) returns (bytes calldata) {\n return AssetBaseERC1155._msgData();\n }\n}\n" + }, + "src/solc_0.8/assetERC721/BaseERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport {ERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport {AccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {IMintableERC721} from \"../common/interfaces/IMintableERC721.sol\";\nimport {IERC721Token} from \"../common/interfaces/IERC721Token.sol\";\nimport {IERC721ExtendedToken} from \"../common/interfaces/IERC721ExtendedToken.sol\";\nimport {IERC721Minter} from \"../common/interfaces/IERC721Minter.sol\";\n\nabstract contract BaseERC721 is\n AccessControlUpgradeable,\n ERC721Upgradeable,\n IMintableERC721,\n IERC721Token,\n IERC721ExtendedToken,\n IERC721Minter\n{\n uint256[50] private __gap1; // In case\n\n address internal _trustedForwarder;\n\n string public baseTokenURI;\n\n mapping(uint256 => string) public tokenUris;\n\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant BURNER_ROLE = keccak256(\"BURNER_ROLE\");\n\n /// @notice Mint an ERC721 Asset with the provided id.\n /// @dev Should be callable only by the designated predicate on L1.\n /// @dev Do not use this mint method if you want to retain metadata.\n /// @param to Address that will receive the token.\n /// @param id ERC721 id to be used.\n function mint(address to, uint256 id) public virtual override(IMintableERC721, IERC721Token, IERC721Minter) {\n _safeMint(to, id);\n }\n\n /// @notice Mint an ERC721 Asset with the provided id.\n /// @dev Should be callable only by the designated predicate on L1.\n /// @dev If you want to retain token metadata from L2 to L1 during exit, you must implement this method.\n /// @param to Address that will receive the token.\n /// @param id ERC721 id to be used.\n /// @param data Associated token metadata, which is decoded & used to set the full tokenUri.\n function mint(\n address to,\n uint256 id,\n bytes calldata data\n ) public virtual override(IMintableERC721, IERC721Token, IERC721Minter) {\n require(data.length > 0, \"DATA_MUST_CONTAIN_TOKENURI\");\n _setTokenURI(id, data);\n _safeMint(to, id, data);\n }\n\n /// @notice Approve an operator to operate tokens on the sender's behalf.\n /// @param from The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param id The id of the token.\n function approveFor(\n address from,\n address operator,\n uint256 id\n ) public virtual override(IERC721ExtendedToken) {\n require(from != address(0), \"ZERO_ADDRESS\");\n require(from == _msgSender() || isApprovedForAll(from, _msgSender()), \"!AUTHORIZED\");\n approve(operator, id);\n }\n\n /// @notice Set the approval for an operator to manage all the tokens of the sender.\n /// @param from The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param approved The determination of the approval.\n function setApprovalForAllFor(\n address from,\n address operator,\n bool approved\n ) public virtual override(IERC721ExtendedToken) {\n require(from != address(0), \"ZERO_ADDRESS\");\n require(from == _msgSender() || isApprovedForAll(from, _msgSender()), \"!AUTHORIZED\");\n _setApprovalForAll(from, operator, approved);\n }\n\n /// @notice Burns token with given `id`.\n /// @param from Address whose token is to be burned.\n /// @param id Token id which will be burned.\n function burnFrom(address from, uint256 id) public virtual override(IERC721ExtendedToken, IERC721Token) {\n require(from == _msgSender() || isApprovedForAll(from, _msgSender()), \"!AUTHORIZED\");\n require(from == ERC721Upgradeable.ownerOf(id), \"NOT_OWNER\");\n _burn(id);\n }\n\n /// @notice Burns token with given `id`.\n /// @dev Used by default fx-portal tunnel which burns rather than locks.\n /// @param id The id of the token to be burned.\n function burn(uint256 id) public virtual override(IERC721ExtendedToken) onlyRole(BURNER_ROLE) {\n _burn(id);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param from Address whose token is to be transferred.\n /// @param to Recipient.\n /// @param tokenId The token id to be transferred.\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override(ERC721Upgradeable, IMintableERC721, IERC721Token) {\n ERC721Upgradeable.safeTransferFrom(from, to, tokenId);\n }\n\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids\n ) public virtual override(IERC721ExtendedToken) {\n uint256 numTokens = ids.length;\n for (uint256 i = 0; i < numTokens; i++) {\n uint256 id = ids[i];\n ERC721Upgradeable.transferFrom(from, to, id);\n }\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n /// @param data Additional data.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) public virtual override(IERC721ExtendedToken) {\n uint256 numTokens = ids.length;\n for (uint256 i = 0; i < numTokens; i++) {\n uint256 id = ids[i];\n ERC721Upgradeable.safeTransferFrom(from, to, id, data);\n }\n }\n\n /// @notice Query if a token id exists.\n /// @param tokenId Token id to be queried.\n function exists(uint256 tokenId) public view virtual override(IMintableERC721, IERC721Token) returns (bool) {\n return _exists(tokenId);\n }\n\n /// @notice Query if a contract implements interface `id`.\n /// @param id the interface identifier, as specified in ERC-165.\n /// @return `true` if the contract implements `id`.\n function supportsInterface(bytes4 id)\n public\n view\n virtual\n override(AccessControlUpgradeable, ERC721Upgradeable)\n returns (bool)\n {\n return super.supportsInterface(id);\n }\n\n /// @notice Change the address of the trusted forwarder for meta-transactions\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) public virtual onlyRole(DEFAULT_ADMIN_ROLE) {\n _trustedForwarder = trustedForwarder;\n }\n\n function isTrustedForwarder(address forwarder) public view virtual returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n function getTrustedForwarder() public view virtual returns (address trustedForwarder) {\n return _trustedForwarder;\n }\n\n function _setTokenURI(uint256 id, bytes memory data) internal {\n tokenUris[id] = abi.decode(data, (string));\n }\n\n function _msgSender() internal view virtual override returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return msg.sender;\n }\n }\n\n function _msgData() internal view virtual override returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender)) {\n return msg.data[:msg.data.length - 20];\n } else {\n return msg.data;\n }\n }\n\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n super.tokenURI(tokenId);\n }\n\n function _baseURI() internal view override(ERC721Upgradeable) returns (string memory) {\n return baseTokenURI;\n }\n\n uint256[50] private __gap2; // In case\n}\n" + }, + "src/solc_0.8/bundleSandSale/PolygonBundleSandSale.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../common/interfaces/IERC20.sol\";\nimport \"../common/interfaces/Medianizer.sol\";\nimport \"../common/interfaces/IERC1155TokenReceiver.sol\";\nimport \"../common/BaseWithStorage/WithAdmin.sol\";\nimport \"../common/interfaces/IPolygonAssetERC1155.sol\";\n\n/// @title PolygonBundleSandSale contract.\n/// @notice This contract receives bundles of: Assets (ERC1155) + Sand.\n/// @notice Then those bundles are sold to users. Users can pay BaseCoin (Ethers) or Dais for the bundles.\ncontract PolygonBundleSandSale is WithAdmin, IERC1155TokenReceiver {\n bytes4 public constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 public constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n event BundleSale(\n uint256 indexed saleId,\n uint256[] ids,\n uint256[] amounts,\n uint256 sandAmount,\n uint256 priceUSD,\n uint256 numPacks\n );\n\n event BundleSold(\n uint256 indexed saleId,\n address indexed buyer,\n uint256 numPacks,\n address token,\n uint256 tokenAmount\n );\n\n Medianizer public medianizer;\n IERC20 public dai;\n IERC20 public sand;\n IPolygonAssetERC1155 public asset;\n address payable public receivingWallet;\n\n /*\n This is the main structure representing a pack to be sold.\n Each pack includes some Assets (NFTs or small collection of fungible tokens) plus Sand\n */\n struct Sale {\n uint256[] ids; // ids of the Assets in each pack\n uint256[] amounts; // Amount of each Asset in each pack\n uint256 sandAmount; // Sands sold with each pack\n uint256 priceUSD; // Price in USD for each Pack u$s * 1e18 (aka: 1u$s == 1e18 wei)\n uint256 numPacksLeft; // Number of packs left, used for accounting\n }\n\n Sale[] private sales;\n\n constructor(\n IERC20 sandTokenContractAddress,\n IPolygonAssetERC1155 assetTokenContractAddress,\n Medianizer medianizerContractAddress,\n IERC20 daiTokenContractAddress,\n address admin,\n address payable receivingWallet_\n ) {\n require(receivingWallet_ != address(0), \"need a wallet to receive funds\");\n medianizer = medianizerContractAddress;\n sand = sandTokenContractAddress;\n asset = assetTokenContractAddress;\n dai = daiTokenContractAddress;\n _admin = admin;\n receivingWallet = receivingWallet_;\n }\n\n /// @notice set the wallet receiving the proceeds\n /// @param newWallet address of the new receiving wallet\n function setReceivingWallet(address payable newWallet) external onlyAdmin {\n require(newWallet != address(0), \"receiving wallet cannot be zero address\");\n receivingWallet = newWallet;\n }\n\n /**\n * @notice Buys Sand Bundle with Ether\n * @param saleId id of the bundle\n * @param numPacks the amount of packs to buy\n * @param to The address that will receive the SAND\n */\n function buyBundleWithEther(\n uint256 saleId,\n uint256 numPacks,\n address to\n ) external payable {\n (uint256 saleIndex, uint256 usdRequired) = _getSaleAmount(saleId, numPacks);\n uint256 ethRequired = getEtherAmountWithUSD(usdRequired);\n require(msg.value >= ethRequired, \"not enough ether sent\");\n uint256 leftOver = msg.value - ethRequired;\n if (leftOver > 0) {\n payable(msg.sender).transfer(leftOver);\n // refund extra\n }\n payable(receivingWallet).transfer(ethRequired);\n _transferPack(saleIndex, numPacks, to);\n\n emit BundleSold(saleId, msg.sender, numPacks, address(0), ethRequired);\n }\n\n /**\n * @notice Buys Sand Bundle with DAI\n * @param saleId id of the bundle\n * @param numPacks the amount of packs to buy\n * @param to The address that will receive the SAND\n */\n function buyBundleWithDai(\n uint256 saleId,\n uint256 numPacks,\n address to\n ) external {\n (uint256 saleIndex, uint256 usdRequired) = _getSaleAmount(saleId, numPacks);\n require(dai.transferFrom(msg.sender, receivingWallet, usdRequired), \"failed to transfer dai\");\n _transferPack(saleIndex, numPacks, to);\n\n emit BundleSold(saleId, msg.sender, numPacks, address(dai), usdRequired);\n }\n\n /**\n * @notice get a specific sale information\n * @param saleId id of the bundle\n * @return priceUSD price in USD\n * @return numPacksLeft number of packs left\n */\n function getSaleInfo(uint256 saleId) external view returns (uint256 priceUSD, uint256 numPacksLeft) {\n require(saleId > 0, \"invalid saleId\");\n uint256 saleIndex = saleId - 1;\n priceUSD = sales[saleIndex].priceUSD;\n numPacksLeft = sales[saleIndex].numPacksLeft;\n }\n\n /**\n * @notice Remove a sale returning everything to some address\n * @param saleId id of the bundle\n * @param to The address that will receive the SAND\n */\n function withdrawSale(uint256 saleId, address to) external onlyAdmin {\n require(saleId > 0, \"invalid saleId\");\n uint256 saleIndex = saleId - 1;\n uint256 numPacksLeft = sales[saleIndex].numPacksLeft;\n sales[saleIndex].numPacksLeft = 0;\n\n uint256[] memory ids = sales[saleIndex].ids;\n uint256[] memory amounts = sales[saleIndex].amounts;\n uint256 numIds = ids.length;\n for (uint256 i = 0; i < numIds; i++) {\n amounts[i] = amounts[i] * numPacksLeft;\n }\n require(\n sand.transferFrom(address(this), to, numPacksLeft * sales[saleIndex].sandAmount),\n \"transfer fo Sand failed\"\n );\n asset.safeBatchTransferFrom(address(this), to, ids, amounts, \"\");\n }\n\n /**\n * @notice IERC1155TokenReceiver callback, creates a new Sale\n * @notice OBS: in the case of NFTs (one of a kind) value is one so numPacks must be 1 too to be divisible.\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(address(asset) == msg.sender, \"only accept asset as sender\");\n require(from == operator, \"only self executed transfer allowed\");\n require(value > 0, \"no Asset transfered\");\n require(data.length > 0, \"data need to contains the sale data\");\n\n (uint256 numPacks, uint256 sandAmountPerPack, uint256 priceUSDPerPack) =\n abi.decode(data, (uint256, uint256, uint256));\n\n uint256 amount = value / numPacks;\n require(amount * numPacks == value, \"invalid amounts, not divisible by numPacks\");\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = amount;\n uint256[] memory ids = new uint256[](1);\n ids[0] = id;\n _setupBundle(from, sandAmountPerPack, numPacks, ids, amounts, priceUSDPerPack);\n return ERC1155_RECEIVED;\n }\n\n /**\n * @notice IERC1155TokenReceiver callback, creates a new Sale\n * @notice OBS: in the case of NFTs (one of a kind) value is one so numPacks must be 1 too to be divisible.\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(address(asset) == msg.sender, \"only accept asset as sender\");\n require(from == operator, \"only self executed transfer allowed\");\n require(ids.length > 0, \"need to contains Asset\");\n require(data.length > 0, \"data need to contains the sale data\");\n\n (uint256 numPacks, uint256 sandAmountPerPack, uint256 priceUSDPerPack) =\n abi.decode(data, (uint256, uint256, uint256));\n\n uint256[] memory amounts = new uint256[](ids.length);\n for (uint256 i = 0; i < amounts.length; i++) {\n require(values[i] > 0, \"asset transfer with zero values\");\n uint256 amount = values[i] / numPacks;\n require(amount * numPacks == values[i], \"invalid amounts, not divisible by numPacks\");\n amounts[i] = amount;\n }\n\n _setupBundle(from, sandAmountPerPack, numPacks, ids, amounts, priceUSDPerPack);\n return ERC1155_BATCH_RECEIVED;\n }\n\n /**\n * @notice Returns the amount of ETH for a specific amount\n * @notice This rounds down with a precision of 1wei if usdAmount price is expressed in u$s * 10e18\n * @param usdAmount An amount of USD\n * @return The amount of ETH\n */\n function getEtherAmountWithUSD(uint256 usdAmount) public view returns (uint256) {\n uint256 ethUsdPair = getEthUsdPair();\n return (usdAmount * 1 ether) / ethUsdPair;\n }\n\n /**\n * @notice Gets the ETHUSD pair from the Medianizer contract\n * @return The pair as an uint256\n */\n function getEthUsdPair() internal view returns (uint256) {\n bytes32 pair = medianizer.read();\n return uint256(pair);\n }\n\n function _transferPack(\n uint256 saleIndex,\n uint256 numPacks,\n address to\n ) internal {\n uint256 sandAmountPerPack = sales[saleIndex].sandAmount;\n require(sand.transferFrom(address(this), to, sandAmountPerPack * numPacks), \"Sand Transfer failed\");\n uint256[] memory ids = sales[saleIndex].ids;\n uint256[] memory amounts = sales[saleIndex].amounts;\n uint256 numIds = ids.length;\n for (uint256 i = 0; i < numIds; i++) {\n amounts[i] = amounts[i] * numPacks;\n }\n asset.safeBatchTransferFrom(address(this), to, ids, amounts, \"\");\n }\n\n /**\n * @notice Create a Sale to be sold.\n * @param from seller address\n * @param sandAmountPerPack the sands that will be sell with the Sale\n * @param numPacks number of packs that this sale contains\n * @param ids list of ids to create bundle from\n * @param amounts the corresponding amounts of assets to be bundled for sale\n * @param priceUSDPerPack price in USD per pack\n */\n function _setupBundle(\n address from,\n uint256 sandAmountPerPack,\n uint256 numPacks,\n uint256[] memory ids,\n uint256[] memory amounts,\n uint256 priceUSDPerPack\n ) internal {\n require(sand.transferFrom(from, address(this), sandAmountPerPack * numPacks), \"failed to transfer Sand\");\n sales.push(\n Sale({\n ids: ids,\n amounts: amounts,\n sandAmount: sandAmountPerPack,\n priceUSD: priceUSDPerPack,\n numPacksLeft: numPacks\n })\n );\n uint256 saleId = sales.length;\n emit BundleSale(saleId, ids, amounts, sandAmountPerPack, priceUSDPerPack, numPacks);\n }\n\n function _getSaleAmount(uint256 saleId, uint256 numPacks)\n internal\n returns (uint256 saleIndex, uint256 usdRequired)\n {\n require(saleId > 0, \"PolygonBundleSandSale: invalid saleId\");\n saleIndex = saleId - 1;\n uint256 numPacksLeft = sales[saleIndex].numPacksLeft;\n require(numPacksLeft >= numPacks, \"PolygonBundleSandSale: not enough packs on sale\");\n sales[saleIndex].numPacksLeft = numPacksLeft - numPacks;\n\n usdRequired = numPacks * sales[saleIndex].priceUSD;\n }\n}\n" + }, + "src/solc_0.8/catalyst/CatalystV1.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../common/interfaces/IAssetAttributesRegistry.sol\";\nimport \"../common/BaseWithStorage/ERC20/ERC20TokenUpgradeable.sol\";\nimport \"./interfaces/ICatalyst.sol\";\n\ncontract CatalystV1 is ICatalyst, ERC20TokenUpgradeable {\n uint16 public override catalystId;\n uint8 internal _maxGems;\n bytes32 public constant APPROVER_ROLE = keccak256(\"APPROVER_ROLE\");\n\n IAttributes internal _attributes;\n\n function __CatalystV1_init(\n string memory name,\n string memory symbol,\n address trustedForwarder,\n address admin,\n uint8 maxGems,\n uint16 _catalystId,\n IAttributes attributes,\n address approver\n ) public initializer {\n __ERC20TokenUpgradeable_init(name, symbol, trustedForwarder, admin);\n _maxGems = maxGems;\n catalystId = _catalystId;\n _attributes = attributes;\n _grantRole(APPROVER_ROLE, approver);\n }\n\n /// @notice Used by Admin to update the attributes contract.\n /// @param attributes The new attributes contract.\n function changeAttributes(IAttributes attributes) external override onlyRole(DEFAULT_ADMIN_ROLE) {\n _attributes = attributes;\n }\n\n /// @notice Get the value of _maxGems(the max number of gems that can be embeded in this type of catalyst).\n /// @return The value of _maxGems.\n function getMaxGems() external view override returns (uint8) {\n return _maxGems;\n }\n\n /// @notice Get the attributes for each gem in an asset.\n /// See DefaultAttributes.getAttributes for more.\n /// @return values An array of values representing the \"level\" of each gem. ie: Power=14, speed=45, etc...\n function getAttributes(uint256 assetId, IAssetAttributesRegistry.GemEvent[] calldata events)\n external\n view\n override\n returns (uint32[] memory values)\n {\n return _attributes.getAttributes(assetId, events);\n }\n\n /// @notice Approve `spender` to transfer `amount` tokens from `owner`.\n /// @param owner The address whose token is allowed.\n /// @param spender The address to be given rights to transfer.\n /// @param amount The number of tokens allowed.\n /// @return success Whether or not the call succeeded.\n function approveFor(\n address owner,\n address spender,\n uint256 amount\n ) external override(ERC20BaseTokenUpgradeable, ICatalyst) returns (bool success) {\n require(\n _msgSender() == owner || hasRole(SUPER_OPERATOR_ROLE, _msgSender()) || hasRole(APPROVER_ROLE, _msgSender()),\n \"NOT_AUTHORIZED\"\n );\n _approveFor(owner, spender, amount);\n return true;\n }\n\n function getDecimals() external pure override returns (uint8) {\n return ERC20BaseTokenUpgradeable.decimals();\n }\n}\n" + }, + "src/solc_0.8/catalyst/CollectionCatalystMigrations.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\npragma experimental ABIEncoderV2;\n\nimport \"./interfaces/IOldCatalystRegistry.sol\";\nimport \"../common/interfaces/IAssetAttributesRegistry.sol\";\nimport \"./interfaces/ICollectionCatalystMigrations.sol\";\nimport \"../common/interfaces/IAssetToken.sol\";\nimport \"../common/BaseWithStorage/WithAdmin.sol\";\n\n/// @notice Contract performing migrations for collections, do not require owner approval\ncontract CollectionCatalystMigrations is WithAdmin, ICollectionCatalystMigrations {\n uint256 private constant IS_NFT = 0x0000000000000000000000000000000000000000800000000000000000000000;\n\n IOldCatalystRegistry internal immutable _oldRegistry;\n IAssetAttributesRegistry internal immutable _registry;\n IAssetToken internal immutable _asset;\n\n event BatchCatalystMigrationDone();\n\n /// @notice CollectionCatalystMigrations depends on:\n /// @param asset: Asset Token Contract\n /// @param registry: New AssetAttributesRegistry\n /// @param oldRegistry: Old CatalystRegistry\n /// @param admin: Contract admin\n constructor(\n IAssetToken asset,\n IAssetAttributesRegistry registry,\n IOldCatalystRegistry oldRegistry,\n address admin\n ) {\n _oldRegistry = oldRegistry;\n _asset = asset;\n _registry = registry;\n _admin = admin;\n }\n\n /// @notice Migrate the catalysts for a batch of assets.\n /// @param migrations The data to use for each migration in the batch.\n function batchMigrate(Migration[] calldata migrations) external override {\n require(msg.sender == _admin, \"NOT_AUTHORIZED\");\n for (uint256 i = 0; i < migrations.length; i++) {\n _migrate(migrations[i].assetId, migrations[i].gemIds, migrations[i].blockNumber);\n }\n emit BatchCatalystMigrationDone();\n }\n\n /// @notice Set the registry migration contract\n /// @param migrationContract The migration contract for AssetAttributesRegistry\n function setAssetAttributesRegistryMigrationContract(address migrationContract) external {\n require(msg.sender == _admin, \"NOT_AUTHORIZED\");\n _registry.setMigrationContract(migrationContract);\n }\n\n /// @dev Perform the migration of the catalyst. See `migrate(...)`\n function _migrate(\n uint256 assetId,\n uint16[] memory oldGemIds,\n uint64 blockNumber\n ) internal {\n (bool oldExists, uint256 oldCatalystId) = _oldRegistry.getCatalyst(assetId);\n require(oldExists, \"OLD_CATALYST_NOT_EXIST\");\n (bool exists, , ) = _registry.getRecord(assetId);\n require(!exists, \"ALREADY_MIGRATED\");\n oldCatalystId += 1; // old catalyst start from 0 , new one start with common = 1\n if (assetId & IS_NFT != 0) {\n // ensure this NFT has no collection: original NFT\n // If it has, the collection itself need to be migrated\n try _asset.collectionOf(assetId) returns (uint256 collId) {\n require(collId == 0, \"NOT_ORIGINAL_NFT\");\n // solhint-disable-next-line no-empty-blocks\n } catch {}\n }\n // old gems started from 0, new gems starts with power = 1\n for (uint256 i = 0; i < oldGemIds.length; i++) {\n oldGemIds[i] += 1;\n }\n _registry.setCatalystWithBlockNumber(assetId, uint16(oldCatalystId), oldGemIds, blockNumber);\n }\n}\n" + }, + "src/solc_0.8/catalyst/DefaultAttributes.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../common/interfaces/IAttributes.sol\";\n\ncontract DefaultAttributes is IAttributes {\n uint256 internal constant MAX_NUM_GEMS = 15;\n uint256 internal constant MAX_NUM_GEM_TYPES = 256;\n\n /// @notice Returns the values for each gem included in a given asset.\n /// @param assetId The asset tokenId.\n /// @param events An array of GemEvents. Be aware that only gemEvents from the last CatalystApplied event onwards should be used to populate a query. If gemEvents from multiple CatalystApplied events are included the output values will be incorrect.\n /// @return values An array of values for each gem present in the asset.\n function getAttributes(uint256 assetId, IAssetAttributesRegistry.GemEvent[] calldata events)\n external\n pure\n override\n returns (uint32[] memory values)\n {\n values = new uint32[](MAX_NUM_GEM_TYPES);\n\n uint256 numGems;\n for (uint256 i = 0; i < events.length; i++) {\n numGems += events[i].gemIds.length;\n }\n require(numGems <= MAX_NUM_GEMS, \"TOO_MANY_GEMS\");\n\n uint32 minValue = (uint32(numGems) - 1) * 5 + 1;\n\n uint256 numGemsSoFar = 0;\n for (uint256 i = 0; i < events.length; i++) {\n numGemsSoFar += events[i].gemIds.length;\n for (uint256 j = 0; j < events[i].gemIds.length; j++) {\n uint256 gemId = events[i].gemIds[j];\n uint256 slotIndex = numGemsSoFar - events[i].gemIds.length + j;\n if (values[gemId] == 0) {\n // first gem : value = roll between ((numGemsSoFar-1)*5+1) and 25\n values[gemId] = _computeValue(\n assetId,\n gemId,\n events[i].blockHash,\n slotIndex,\n (uint32(numGemsSoFar) - 1) * 5 + 1\n );\n // bump previous values:\n if (values[gemId] < minValue) {\n values[gemId] = minValue;\n }\n } else {\n // further gem, previous roll are overriden with 25 and new roll between 1 and 25\n uint32 newRoll = _computeValue(assetId, gemId, events[i].blockHash, slotIndex, 1);\n values[gemId] = (((values[gemId] - 1) / 25) + 1) * 25 + newRoll;\n }\n }\n }\n }\n\n /// @dev compute a random value between min to 25.\n /// example: 1-25, 6-25, 11-25, 16-25\n /// @param assetId The id of the asset.\n /// @param gemId The id of the gem.\n /// @param blockHash The blockHash from the gemEvent.\n /// @param slotIndex Index of the current gem.\n /// @param min The minumum value this gem can have.\n /// @return The computed value for the given gem.\n function _computeValue(\n uint256 assetId,\n uint256 gemId,\n bytes32 blockHash,\n uint256 slotIndex,\n uint32 min\n ) internal pure returns (uint32) {\n return min + uint16(uint256(keccak256(abi.encodePacked(gemId, assetId, blockHash, slotIndex))) % (26 - min));\n }\n}\n" + }, + "src/solc_0.8/catalyst/GemsCatalystsRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IGem} from \"./interfaces/IGem.sol\";\nimport {ICatalyst, IAssetAttributesRegistry} from \"./interfaces/ICatalyst.sol\";\nimport {IERC20Extended, IERC20} from \"../common/interfaces/IERC20Extended.sol\";\nimport {IGemsCatalystsRegistry} from \"./interfaces/IGemsCatalystsRegistry.sol\";\nimport {ERC2771HandlerUpgradeable} from \"../common/BaseWithStorage/ERC2771/ERC2771HandlerUpgradeable.sol\";\nimport {\n AccessControlUpgradeable,\n ContextUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\n\n/// @notice Contract managing the Gems and Catalysts\n/// @notice The following privileged roles are used in this contract: DEFAULT_ADMIN_ROLE, SUPER_OPERATOR_ROLE\n/// @dev Each Gems and Catalyst must be registered here.\n/// @dev Each new Gem get assigned a new id (starting at 1)\n/// @dev Each new Catalyst get assigned a new id (starting at 1)\n/// @dev DEFAULT_ADMIN_ROLE is intended for contract setup / emergency, SUPER_OPERATOR_ROLE is provided for business purposes\ncontract GemsCatalystsRegistry is ERC2771HandlerUpgradeable, IGemsCatalystsRegistry, AccessControlUpgradeable {\n uint256 private constant MAX_GEMS_AND_CATALYSTS = 256;\n uint256 internal constant MAX_UINT256 = type(uint256).max;\n bytes32 public constant SUPER_OPERATOR_ROLE = keccak256(\"SUPER_OPERATOR_ROLE\");\n\n IGem[] internal _gems;\n ICatalyst[] internal _catalysts;\n\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\n event AddGemsAndCatalysts(IGem[] gems, ICatalyst[] catalysts);\n event SetGemsAndCatalystsAllowance(address owner, uint256 allowanceValue);\n\n // solhint-disable-next-line no-empty-blocks\n constructor() initializer {}\n\n function initV1(address trustedForwarder, address admin) external initializer {\n require(trustedForwarder != address(0), \"TRUSTED_FORWARDER_ZERO_ADDRESS\");\n require(admin != address(0), \"ADMIN_ZERO_ADDRESS\");\n _grantRole(DEFAULT_ADMIN_ROLE, admin);\n __ERC2771Handler_initialize(trustedForwarder);\n __AccessControl_init();\n }\n\n /// @notice Returns the values for each gem included in a given asset.\n /// @param catalystId The catalyst identifier.\n /// @param assetId The asset tokenId.\n /// @param events An array of GemEvents. Be aware that only gemEvents from the last CatalystApplied event onwards should be used to populate a query. If gemEvents from multiple CatalystApplied events are included the output values will be incorrect.\n /// @return values An array of values for each gem present in the asset.\n function getAttributes(\n uint16 catalystId,\n uint256 assetId,\n IAssetAttributesRegistry.GemEvent[] calldata events\n ) external view override returns (uint32[] memory values) {\n ICatalyst catalyst = getCatalyst(catalystId);\n require(catalyst != ICatalyst(address(0)), \"CATALYST_DOES_NOT_EXIST\");\n return catalyst.getAttributes(assetId, events);\n }\n\n /// @notice Returns the maximum number of gems for a given catalyst\n /// @param catalystId catalyst identifier\n function getMaxGems(uint16 catalystId) external view override returns (uint8) {\n ICatalyst catalyst = getCatalyst(catalystId);\n require(catalyst != ICatalyst(address(0)), \"CATALYST_DOES_NOT_EXIST\");\n return catalyst.getMaxGems();\n }\n\n /// @notice Returns the decimals for a given catalyst\n /// @param catalystId catalyst identifier\n function getCatalystDecimals(uint16 catalystId) external view override returns (uint8) {\n ICatalyst catalyst = getCatalyst(catalystId);\n require(catalyst != ICatalyst(address(0)), \"CATALYST_DOES_NOT_EXIST\");\n return catalyst.getDecimals();\n }\n\n /// @notice Returns the decimals for a given gem\n /// @param gemId gem identifier\n function getGemDecimals(uint16 gemId) external view override returns (uint8) {\n IGem gem = getGem(gemId);\n require(gem != IGem(address(0)), \"GEM_DOES_NOT_EXIST\");\n return gem.getDecimals();\n }\n\n /// @notice Burns few gem units from each gem id on behalf of a beneficiary\n /// @param from address of the beneficiary to burn on behalf of\n /// @param gemIds list of gems to burn gem units from each\n /// @param amounts list of amounts of units to burn\n function batchBurnGems(\n address from,\n uint16[] calldata gemIds,\n uint256[] calldata amounts\n ) external override {\n uint256 gemIdsLength = gemIds.length;\n require(gemIdsLength == amounts.length, \"GemsCatalystsRegistry: gemsIds and amounts length mismatch\");\n for (uint256 i = 0; i < gemIdsLength; i++) {\n if (gemIds[i] != 0 && amounts[i] != 0) {\n burnGem(from, gemIds[i], amounts[i]);\n }\n }\n }\n\n /// @notice Burns few catalyst units from each catalyst id on behalf of a beneficiary\n /// @param from address of the beneficiary to burn on behalf of\n /// @param catalystIds list of catalysts to burn catalyst units from each\n /// @param amounts list of amounts of units to burn\n function batchBurnCatalysts(\n address from,\n uint16[] calldata catalystIds,\n uint256[] calldata amounts\n ) external override {\n uint256 catalystIdsLength = catalystIds.length;\n require(catalystIdsLength == amounts.length, \"GemsCatalystsRegistry: catalystIds and amounts length mismatch\");\n for (uint256 i = 0; i < catalystIdsLength; i++) {\n if (catalystIds[i] != 0 && amounts[i] != 0) {\n burnCatalyst(from, catalystIds[i], amounts[i]);\n }\n }\n }\n\n /// @notice Adds both arrays of gems and catalysts to registry\n /// @param gems array of gems to be added\n /// @param catalysts array of catalysts to be added\n function addGemsAndCatalysts(IGem[] calldata gems, ICatalyst[] calldata catalysts)\n external\n override\n onlyRole(DEFAULT_ADMIN_ROLE)\n {\n require(\n uint256(_gems.length + _catalysts.length + gems.length + catalysts.length) < MAX_GEMS_AND_CATALYSTS,\n \"GemsCatalystsRegistry: Too many gem and catalyst contracts\"\n );\n\n for (uint256 i = 0; i < gems.length; i++) {\n IGem gem = gems[i];\n require(address(gem) != address(0), \"GEM_ZERO_ADDRESS\");\n uint16 gemId = gem.gemId();\n require(gemId == _gems.length + 1, \"GEM_ID_NOT_IN_ORDER\");\n _gems.push(gem);\n }\n\n for (uint256 i = 0; i < catalysts.length; i++) {\n ICatalyst catalyst = catalysts[i];\n require(address(catalyst) != address(0), \"CATALYST_ZERO_ADDRESS\");\n uint16 catalystId = catalyst.catalystId();\n require(catalystId == _catalysts.length + 1, \"CATALYST_ID_NOT_IN_ORDER\");\n _catalysts.push(catalyst);\n }\n emit AddGemsAndCatalysts(gems, catalysts);\n }\n\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(trustedForwarder != address(0), \"ZERO_ADDRESS\");\n _trustedForwarder = trustedForwarder;\n emit TrustedForwarderChanged(trustedForwarder);\n }\n\n /// @notice Query whether a given gem exists.\n /// @param gemId The gem being queried.\n /// @return Whether the gem exists.\n function doesGemExist(uint16 gemId) external view override returns (bool) {\n return getGem(gemId) != IGem(address(0));\n }\n\n /// @notice Query whether a giving catalyst exists.\n /// @param catalystId The catalyst being queried.\n /// @return Whether the catalyst exists.\n function doesCatalystExist(uint16 catalystId) external view returns (bool) {\n return getCatalyst(catalystId) != ICatalyst(address(0));\n }\n\n /// @notice Burn a catalyst.\n /// @param from The signing address for the tx.\n /// @param catalystId The id of the catalyst to burn.\n /// @param amount The number of catalyst tokens to burn.\n function burnCatalyst(\n address from,\n uint16 catalystId,\n uint256 amount\n ) public override checkAuthorization(from) {\n ICatalyst catalyst = getCatalyst(catalystId);\n require(catalyst != ICatalyst(address(0)), \"CATALYST_DOES_NOT_EXIST\");\n catalyst.burnFor(from, amount);\n }\n\n /// @notice Burn a gem.\n /// @param from The signing address for the tx.\n /// @param gemId The id of the gem to burn.\n /// @param amount The number of gem tokens to burn.\n function burnGem(\n address from,\n uint16 gemId,\n uint256 amount\n ) public override checkAuthorization(from) {\n IGem gem = getGem(gemId);\n require(gem != IGem(address(0)), \"GEM_DOES_NOT_EXIST\");\n gem.burnFor(from, amount);\n }\n\n function getNumberOfCatalystContracts() external view returns (uint256 number) {\n number = _catalysts.length;\n }\n\n function getNumberOfGemContracts() external view returns (uint256 number) {\n number = _gems.length;\n }\n\n /// @dev Only the owner, SUPER_OPERATOR_ROLE or APPROVER_ROLE may set the allowance\n function revokeGemsandCatalystsMaxAllowance() external {\n _setGemsAndCatalystsAllowance(0);\n }\n\n /// @dev Only the owner, SUPER_OPERATOR_ROLE or APPROVER_ROLE may set the allowance\n function setGemsAndCatalystsMaxAllowance() external {\n _setGemsAndCatalystsAllowance(MAX_UINT256);\n }\n\n /// @dev Get the catalyst contract corresponding to the id.\n /// @param catalystId The catalyst id to use to retrieve the contract.\n /// @return The requested Catalyst contract.\n function getCatalyst(uint16 catalystId) public view returns (ICatalyst) {\n if (catalystId > 0 && catalystId <= _catalysts.length) {\n return _catalysts[catalystId - 1];\n } else {\n return ICatalyst(address(0));\n }\n }\n\n /// @dev Get the gem contract corresponding to the id.\n /// @param gemId The gem id to use to retrieve the contract.\n /// @return The requested Gem contract.\n function getGem(uint16 gemId) public view returns (IGem) {\n if (gemId > 0 && gemId <= _gems.length) {\n return _gems[gemId - 1];\n } else {\n return IGem(address(0));\n }\n }\n\n /// @dev verify that the caller is authorized for this function call.\n /// @param from The original signer of the transaction.\n modifier checkAuthorization(address from) {\n require(_msgSender() == from || hasRole(SUPER_OPERATOR_ROLE, _msgSender()), \"AUTH_ACCESS_DENIED\");\n _;\n }\n\n function _setGemsAndCatalystsAllowance(uint256 allowanceValue) internal {\n for (uint256 i = 0; i < _gems.length; i++) {\n require(_gems[i].approveFor(_msgSender(), address(this), allowanceValue), \"GEM_ALLOWANCE_NOT_APPROVED\");\n }\n\n for (uint256 i = 0; i < _catalysts.length; i++) {\n require(\n _catalysts[i].approveFor(_msgSender(), address(this), allowanceValue),\n \"CATALYST_ALLOWANCE_NOT_APPROVED\"\n );\n }\n emit SetGemsAndCatalystsAllowance(_msgSender(), allowanceValue);\n }\n\n function _msgSender()\n internal\n view\n override(ContextUpgradeable, ERC2771HandlerUpgradeable)\n returns (address sender)\n {\n return ERC2771HandlerUpgradeable._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771HandlerUpgradeable) returns (bytes calldata) {\n return ERC2771HandlerUpgradeable._msgData();\n }\n}\n" + }, + "src/solc_0.8/catalyst/GemV1.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./interfaces/IGem.sol\";\nimport \"../common/BaseWithStorage/ERC20/ERC20TokenUpgradeable.sol\";\n\ncontract GemV1 is IGem, ERC20TokenUpgradeable {\n uint16 public override gemId;\n bytes32 public constant APPROVER_ROLE = keccak256(\"APPROVER_ROLE\");\n\n function __GemV1_init(\n string memory name,\n string memory symbol,\n address trustedForwarder,\n address admin,\n uint16 _gemId,\n address approver\n ) public initializer {\n __ERC20TokenUpgradeable_init(name, symbol, trustedForwarder, admin);\n gemId = _gemId;\n _grantRole(APPROVER_ROLE, approver);\n }\n\n /// @notice Approve `spender` to transfer `amount` tokens from `owner`.\n /// @param owner The address whose token is allowed.\n /// @param spender The address to be given rights to transfer.\n /// @param amount The number of tokens allowed.\n /// @return success Whether or not the call succeeded.\n function approveFor(\n address owner,\n address spender,\n uint256 amount\n ) external override(ERC20BaseTokenUpgradeable, IGem) returns (bool success) {\n require(\n _msgSender() == owner || hasRole(SUPER_OPERATOR_ROLE, _msgSender()) || hasRole(APPROVER_ROLE, _msgSender()),\n \"NOT_AUTHORIZED\"\n );\n _approveFor(owner, spender, amount);\n return true;\n }\n\n function getDecimals() external pure override returns (uint8) {\n return ERC20BaseTokenUpgradeable.decimals();\n }\n}\n" + }, + "src/solc_0.8/catalyst/interfaces/ICatalyst.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../common/interfaces/IAssetAttributesRegistry.sol\";\nimport \"../../common/interfaces/IAttributes.sol\";\nimport \"../../common/interfaces/IERC20Extended.sol\";\n\ninterface ICatalyst is IERC20Extended, IAttributes {\n function catalystId() external returns (uint16);\n\n function changeAttributes(IAttributes attributes) external;\n\n function getMaxGems() external view returns (uint8);\n\n function approveFor(\n address owner,\n address spender,\n uint256 amount\n ) external override returns (bool success);\n\n function getAttributes(uint256 assetId, IAssetAttributesRegistry.GemEvent[] calldata events)\n external\n view\n override\n returns (uint32[] memory values);\n\n function getDecimals() external pure returns (uint8);\n}\n" + }, + "src/solc_0.8/catalyst/interfaces/ICollectionCatalystMigrations.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\npragma experimental ABIEncoderV2;\n\ninterface ICollectionCatalystMigrations {\n struct Migration {\n uint256 assetId;\n uint16[] gemIds;\n uint64 blockNumber;\n }\n\n function batchMigrate(Migration[] calldata migrations) external;\n}\n" + }, + "src/solc_0.8/catalyst/interfaces/IGem.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../common/interfaces/IERC20Extended.sol\";\n\ninterface IGem is IERC20Extended {\n function gemId() external returns (uint16);\n\n function approveFor(\n address owner,\n address spender,\n uint256 amount\n ) external override returns (bool success);\n\n function getDecimals() external pure returns (uint8);\n}\n" + }, + "src/solc_0.8/catalyst/interfaces/IGemsCatalystsRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../common/interfaces/IAssetAttributesRegistry.sol\";\nimport \"./IGem.sol\";\nimport \"./ICatalyst.sol\";\n\ninterface IGemsCatalystsRegistry {\n function getAttributes(\n uint16 catalystId,\n uint256 assetId,\n IAssetAttributesRegistry.GemEvent[] calldata events\n ) external view returns (uint32[] memory values);\n\n function getMaxGems(uint16 catalystId) external view returns (uint8);\n\n function batchBurnGems(\n address from,\n uint16[] calldata gemIds,\n uint256[] calldata amounts\n ) external;\n\n function batchBurnCatalysts(\n address from,\n uint16[] calldata catalystIds,\n uint256[] calldata amounts\n ) external;\n\n function addGemsAndCatalysts(IGem[] calldata gems, ICatalyst[] calldata catalysts) external;\n\n function doesGemExist(uint16 gemId) external view returns (bool);\n\n function burnCatalyst(\n address from,\n uint16 catalystId,\n uint256 amount\n ) external;\n\n function burnGem(\n address from,\n uint16 gemId,\n uint256 amount\n ) external;\n\n function getCatalystDecimals(uint16 catalystId) external view returns (uint8);\n\n function getGemDecimals(uint16 gemId) external view returns (uint8);\n}\n" + }, + "src/solc_0.8/catalyst/interfaces/IOldCatalystRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface IOldCatalystRegistry {\n function getCatalyst(uint256 assetId) external view returns (bool exists, uint256 catalystId);\n}\n" + }, + "src/solc_0.8/claims/AssetGiveaway/AssetGiveaway.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\nimport \"./ClaimERC1155.sol\";\nimport \"../../common/BaseWithStorage/WithAdmin.sol\";\n\n/// @title AssetGiveaway contract.\n/// @notice This contract manages ERC1155 claims.\ncontract AssetGiveaway is WithAdmin, ClaimERC1155 {\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n uint256 internal immutable _expiryTime;\n mapping(address => bool) public claimed;\n\n constructor(\n address asset,\n address admin,\n bytes32 merkleRoot,\n address assetsHolder,\n uint256 expiryTime\n ) ClaimERC1155(IERC1155(asset), assetsHolder) {\n _admin = admin;\n _merkleRoot = merkleRoot;\n _expiryTime = expiryTime;\n }\n\n /// @notice Function to set the merkle root hash for the asset data, if it is 0.\n /// @param merkleRoot The merkle root hash of the asset data.\n function setMerkleRoot(bytes32 merkleRoot) external onlyAdmin {\n require(_merkleRoot == 0, \"MERKLE_ROOT_ALREADY_SET\");\n _merkleRoot = merkleRoot;\n }\n\n /// @notice Function to permit the claiming of an asset to a reserved address.\n /// @param to The intended recipient (reserved address) of the ERC1155 tokens.\n /// @param assetIds The array of IDs of the asset tokens.\n /// @param assetValues The amounts of each token ID to transfer.\n /// @param proof The proof submitted for verification.\n /// @param salt The salt submitted for verification.\n function claimAssets(\n address to,\n uint256[] calldata assetIds,\n uint256[] calldata assetValues,\n bytes32[] calldata proof,\n bytes32 salt\n ) external {\n require(block.timestamp < _expiryTime, \"CLAIM_PERIOD_IS_OVER\");\n require(to != address(0), \"INVALID_TO_ZERO_ADDRESS\");\n require(claimed[to] == false, \"DESTINATION_ALREADY_CLAIMED\");\n claimed[to] = true;\n _claimERC1155(to, assetIds, assetValues, proof, salt);\n }\n\n function onERC1155Received(\n address, /*operator*/\n address, /*from*/\n uint256, /*id*/\n uint256, /*value*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address, /*operator*/\n address, /*from*/\n uint256[] calldata, /*ids*/\n uint256[] calldata, /*values*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n}\n" + }, + "src/solc_0.8/claims/AssetGiveaway/ClaimERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\n\ncontract ClaimERC1155 {\n bytes32 internal _merkleRoot;\n IERC1155 internal immutable _asset;\n address internal immutable _assetsHolder;\n event ClaimedAssets(address to, uint256[] assetIds, uint256[] assetValues);\n\n constructor(IERC1155 asset, address assetsHolder) {\n _asset = asset;\n if (assetsHolder == address(0)) {\n assetsHolder = address(this);\n }\n _assetsHolder = assetsHolder;\n }\n\n /// @dev See for example AssetGiveaway.sol claimAssets.\n function _claimERC1155(\n address to,\n uint256[] calldata assetIds,\n uint256[] calldata assetValues,\n bytes32[] calldata proof,\n bytes32 salt\n ) internal {\n _checkValidity(to, assetIds, assetValues, proof, salt);\n _sendAssets(to, assetIds, assetValues);\n emit ClaimedAssets(to, assetIds, assetValues);\n }\n\n function _checkValidity(\n address to,\n uint256[] memory assetIds,\n uint256[] memory assetValues,\n bytes32[] memory proof,\n bytes32 salt\n ) internal view {\n require(assetIds.length == assetValues.length, \"INVALID_INPUT\");\n bytes32 leaf = _generateClaimHash(to, assetIds, assetValues, salt);\n require(_verify(proof, leaf), \"INVALID_CLAIM\");\n }\n\n function _generateClaimHash(\n address to,\n uint256[] memory assetIds,\n uint256[] memory assetValues,\n bytes32 salt\n ) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(to, assetIds, assetValues, salt));\n }\n\n function _verify(bytes32[] memory proof, bytes32 computedHash) internal view returns (bool) {\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n\n if (computedHash < proofElement) {\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\n } else {\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\n }\n }\n\n return computedHash == _merkleRoot;\n }\n\n function _sendAssets(\n address to,\n uint256[] memory assetIds,\n uint256[] memory assetValues\n ) internal {\n _asset.safeBatchTransferFrom(_assetsHolder, to, assetIds, assetValues, \"\");\n }\n}\n" + }, + "src/solc_0.8/claims/MultiGiveaway/ClaimERC1155ERC721ERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IERC1155} from \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\nimport {IERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport {MerkleProof} from \"@openzeppelin/contracts-0.8/utils/cryptography/MerkleProof.sol\";\nimport {IERC721Extended} from \"../../common/interfaces/IERC721Extended.sol\";\n\ncontract ClaimERC1155ERC721ERC20 {\n using SafeERC20 for IERC20;\n\n struct Claim {\n address to;\n ERC1155Claim[] erc1155;\n ERC721Claim[] erc721;\n ERC20Claim erc20;\n bytes32 salt;\n }\n\n struct ERC1155Claim {\n uint256[] ids;\n uint256[] values;\n address contractAddress;\n }\n\n struct ERC721Claim {\n uint256[] ids;\n address contractAddress;\n }\n\n struct ERC20Claim {\n uint256[] amounts;\n address[] contractAddresses;\n }\n\n /// @dev Emits when a successful claim occurs.\n /// @param to The destination address for the claimed ERC1155, ERC721 and ERC20 tokens.\n /// @param erc1155 The array of ERC1155Claim structs containing the ids, values and ERC1155 contract address.\n /// @param erc721 The array of ERC721Claim structs containing the ids and ERC721 contract address.\n /// @param erc20 The ERC20Claim struct containing the amounts and ERC20 contract addresses.\n /// @param merkleRoot The merkle root hash for the specific set of items being claimed.\n event ClaimedMultipleTokens(\n address to,\n ERC1155Claim[] erc1155,\n ERC721Claim[] erc721,\n ERC20Claim erc20,\n bytes32 merkleRoot\n );\n\n /// @dev Internal function used to claim multiple token types in one claim.\n /// @param merkleRoot The merkle root hash for the specific set of items being claimed.\n /// @param claim The claim struct containing the destination address, all items to be claimed and optional salt param.\n /// @param proof The proof provided by the user performing the claim function.\n function _claimERC1155ERC721ERC20(\n bytes32 merkleRoot,\n Claim memory claim,\n bytes32[] calldata proof\n ) internal {\n _checkValidity(merkleRoot, claim, proof);\n for (uint256 i = 0; i < claim.erc1155.length; i++) {\n require(claim.erc1155[i].ids.length == claim.erc1155[i].values.length, \"CLAIM_INVALID_INPUT\");\n _transferERC1155(claim.to, claim.erc1155[i].ids, claim.erc1155[i].values, claim.erc1155[i].contractAddress);\n }\n for (uint256 i = 0; i < claim.erc721.length; i++) {\n _transferERC721(claim.to, claim.erc721[i].ids, claim.erc721[i].contractAddress);\n }\n if (claim.erc20.amounts.length != 0) {\n require(claim.erc20.amounts.length == claim.erc20.contractAddresses.length, \"CLAIM_INVALID_INPUT\");\n _transferERC20(claim.to, claim.erc20.amounts, claim.erc20.contractAddresses);\n }\n emit ClaimedMultipleTokens(claim.to, claim.erc1155, claim.erc721, claim.erc20, merkleRoot);\n }\n\n /// @dev Private function used to check the validity of a specific claim.\n /// @param merkleRoot The merkle root hash for the specific set of items being claimed.\n /// @param claim The claim struct containing the destination address, all items to be claimed and optional salt param.\n /// @param proof The proof provided by the user performing the claim function.\n function _checkValidity(\n bytes32 merkleRoot,\n Claim memory claim,\n bytes32[] memory proof\n ) private pure {\n bytes32 leaf = _generateClaimHash(claim);\n require(MerkleProof.verify(proof, merkleRoot, leaf), \"CLAIM_INVALID\");\n }\n\n /// @dev Internal function used to generate a hash from an encoded claim.\n /// @param claim The claim struct.\n function _generateClaimHash(Claim memory claim) internal pure returns (bytes32) {\n return keccak256(abi.encode(claim));\n }\n\n /// @dev Private function used to transfer the ERC1155 tokens specified in a specific claim.\n /// @param to The destination address for the claimed tokens.\n /// @param ids The array of ERC1155 ids.\n /// @param values The amount of ERC1155 tokens of each id to be transferred.\n /// @param contractAddress The ERC1155 token contract address.\n function _transferERC1155(\n address to,\n uint256[] memory ids,\n uint256[] memory values,\n address contractAddress\n ) private {\n require(contractAddress != address(0), \"CLAIM_INVALID_CONTRACT_ZERO_ADDRESS\");\n IERC1155(contractAddress).safeBatchTransferFrom(address(this), to, ids, values, \"\");\n }\n\n /// @dev Private function used to transfer the ERC721tokens specified in a specific claim.\n /// @param to The destination address for the claimed tokens.\n /// @param ids The array of ERC721 ids.\n /// @param contractAddress The ERC721 token contract address.\n function _transferERC721(\n address to,\n uint256[] memory ids,\n address contractAddress\n ) private {\n require(contractAddress != address(0), \"CLAIM_INVALID_CONTRACT_ZERO_ADDRESS\");\n IERC721Extended(contractAddress).safeBatchTransferFrom(address(this), to, ids, \"\");\n }\n\n /// @dev Private function used to transfer the ERC20 tokens specified in a specific claim.\n /// @param to The destination address for the claimed tokens.\n /// @param amounts The array of amounts of ERC20 tokens to be transferred.\n /// @param contractAddresses The array of ERC20 token contract addresses.\n function _transferERC20(\n address to,\n uint256[] memory amounts,\n address[] memory contractAddresses\n ) private {\n for (uint256 i = 0; i < amounts.length; i++) {\n address erc20ContractAddress = contractAddresses[i];\n uint256 erc20Amount = amounts[i];\n require(erc20ContractAddress != address(0), \"CLAIM_INVALID_CONTRACT_ZERO_ADDRESS\");\n IERC20(erc20ContractAddress).safeTransferFrom(address(this), to, erc20Amount);\n }\n }\n}\n" + }, + "src/solc_0.8/claims/MultiGiveaway/MultiGiveaway.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {Context} from \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport {ClaimERC1155ERC721ERC20} from \"./ClaimERC1155ERC721ERC20.sol\";\nimport {AccessControl} from \"@openzeppelin/contracts-0.8/access/AccessControl.sol\";\nimport {Pausable} from \"@openzeppelin/contracts-0.8/security/Pausable.sol\";\nimport {ERC2771Handler} from \"../../common/BaseWithStorage/ERC2771Handler.sol\";\n\n/// @title A Multi Claim contract that enables claims of user rewards in the form of ERC1155, ERC721 and / or ERC20 tokens\n/// @notice This contract manages claims for multiple token types\n/// @dev The contract implements ERC2771 to ensure that users do not pay gas\ncontract MultiGiveaway is AccessControl, ClaimERC1155ERC721ERC20, ERC2771Handler, Pausable {\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n bytes4 internal constant ERC721_RECEIVED = 0x150b7a02;\n bytes4 internal constant ERC721_BATCH_RECEIVED = 0x4b808c46;\n\n mapping(address => mapping(bytes32 => bool)) public claimed;\n mapping(bytes32 => uint256) internal _expiryTime;\n\n event NewGiveaway(bytes32 merkleRoot, uint256 expiryTime);\n event NewTrustedForwarder(address trustedForwarder);\n\n constructor(address admin, address trustedForwarder) {\n _setupRole(DEFAULT_ADMIN_ROLE, admin);\n __ERC2771Handler_initialize(trustedForwarder);\n }\n\n /// @notice Function to add a new giveaway.\n /// @param merkleRoot The merkle root hash of the claim data.\n /// @param expiryTime The expiry time for the giveaway.\n function addNewGiveaway(bytes32 merkleRoot, uint256 expiryTime)\n external\n onlyRole(DEFAULT_ADMIN_ROLE)\n whenNotPaused()\n {\n _expiryTime[merkleRoot] = expiryTime;\n emit NewGiveaway(merkleRoot, expiryTime);\n }\n\n /// @notice set the trusted forwarder\n /// @param trustedForwarder address of the contract that is enabled to send meta-tx on behalf of the user\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _trustedForwarder = trustedForwarder;\n\n emit NewTrustedForwarder(trustedForwarder);\n }\n\n /// @notice Function to permit the claiming of multiple tokens from multiple giveaways to a reserved address.\n /// @param claims The array of claim structs, each containing a destination address, the giveaway items to be claimed and an optional salt param.\n /// @param proofs The proofs submitted for verification.\n function claimMultipleTokensFromMultipleMerkleTree(\n bytes32[] calldata rootHashes,\n Claim[] memory claims,\n bytes32[][] calldata proofs\n ) external {\n require(claims.length == rootHashes.length, \"MULTIGIVEAWAY_INVALID_INPUT\");\n require(claims.length == proofs.length, \"MULTIGIVEAWAY_INVALID_INPUT\");\n for (uint256 i = 0; i < rootHashes.length; i++) {\n claimMultipleTokens(rootHashes[i], claims[i], proofs[i]);\n }\n }\n\n /// @notice Function to check which giveaways have been claimed by a particular user.\n /// @param user The user (intended token destination) address.\n /// @param claims The claim struct containing the destination address, all items to be claimed and optional salt param.\n /// @return claimedGiveaways The array of bools confirming whether or not the giveaways relating to the root hashes provided have been claimed.\n function getClaimedStatus(address user, Claim[] memory claims) external view returns (bool[] memory) {\n bool[] memory claimedGiveaways = new bool[](claims.length);\n for (uint256 i = 0; i < claims.length; i++) {\n bytes32 merkleLeaf = _generateClaimHash(claims[i]);\n claimedGiveaways[i] = claimed[user][merkleLeaf];\n }\n return claimedGiveaways;\n }\n\n /// @dev Public function used to perform validity checks and progress to claim multiple token types in one claim.\n /// @param merkleRoot The merkle root hash for the specific set of items being claimed.\n /// @param claim The claim struct containing the destination address, all items to be claimed and optional salt param.\n /// @param proof The proof provided by the user performing the claim function.\n function claimMultipleTokens(\n bytes32 merkleRoot,\n Claim memory claim,\n bytes32[] calldata proof\n ) public whenNotPaused() {\n uint256 giveawayExpiryTime = _expiryTime[merkleRoot];\n require(claim.to != address(0), \"MULTIGIVEAWAY_INVALID_TO_ZERO_ADDRESS\");\n require(claim.to != address(this), \"MULTIGIVEAWAY_DESTINATION_MULTIGIVEAWAY_CONTRACT\");\n require(giveawayExpiryTime != 0, \"MULTIGIVEAWAY_DOES_NOT_EXIST\");\n require(block.timestamp < giveawayExpiryTime, \"MULTIGIVEAWAY_CLAIM_PERIOD_IS_OVER\");\n bytes32 merkleLeaf = _generateClaimHash(claim);\n require(claimed[claim.to][merkleLeaf] == false, \"MULTIGIVEAWAY_DESTINATION_ALREADY_CLAIMED\");\n claimed[claim.to][merkleLeaf] = true;\n\n _claimERC1155ERC721ERC20(merkleRoot, claim, proof);\n }\n\n function onERC721Received(\n address, /*operator*/\n address, /*from*/\n uint256, /*id*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC721_RECEIVED;\n }\n\n function onERC721BatchReceived(\n address, /*operator*/\n address, /*from*/\n uint256[] calldata, /*ids*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC721_BATCH_RECEIVED;\n }\n\n function onERC1155Received(\n address, /*operator*/\n address, /*from*/\n uint256, /*id*/\n uint256, /*value*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address, /*operator*/\n address, /*from*/\n uint256[] calldata, /*ids*/\n uint256[] calldata, /*values*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n\n function _msgSender() internal view override(Context, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n}\n" + }, + "src/solc_0.8/claims/MultiGiveawayV2/ClaimERC1155ERC721ERC20V2.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IERC1155} from \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\nimport {IERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport {MerkleProof} from \"@openzeppelin/contracts-0.8/utils/cryptography/MerkleProof.sol\";\nimport {IERC721Extended} from \"../../common/interfaces/IERC721Extended.sol\";\n\ncontract ClaimERC1155ERC721ERC20V2 {\n using SafeERC20 for IERC20;\n\n struct Claim {\n address to;\n ERC1155Claim[] erc1155;\n ERC721Claim[] erc721;\n ERC20Claim erc20;\n bytes32 salt;\n }\n\n struct ERC1155Claim {\n uint256[] ids;\n uint256[] values;\n address contractAddress;\n }\n\n struct ERC721Claim {\n uint256[] ids;\n address contractAddress;\n }\n\n struct ERC20Claim {\n uint256[] amounts;\n address[] contractAddresses;\n }\n\n /// @dev Emits when a successful claim occurs.\n /// @param to The destination address for the claimed ERC1155, ERC721 and ERC20 tokens.\n /// @param erc1155 The array of ERC1155Claim structs containing the ids, values and ERC1155 contract address.\n /// @param erc721 The array of ERC721Claim structs containing the ids and ERC721 contract address.\n /// @param erc20 The ERC20Claim struct containing the amounts and ERC20 contract addresses.\n /// @param merkleRoot The merkle root hash for the specific set of items being claimed.\n event ClaimedMultipleTokens(\n address indexed to,\n ERC1155Claim[] erc1155,\n ERC721Claim[] erc721,\n ERC20Claim erc20,\n bytes32 merkleRoot\n );\n\n /// @dev Internal function used to claim multiple token types in one claim.\n /// @param merkleRoot The merkle root hash for the specific set of items being claimed.\n /// @param claim The claim struct containing the destination address, all items to be claimed and optional salt param.\n /// @param proof The proof provided by the user performing the claim function.\n function _claimERC1155ERC721ERC20(\n bytes32 merkleRoot,\n Claim memory claim,\n bytes32[] calldata proof\n ) internal {\n _checkValidity(merkleRoot, claim, proof);\n for (uint256 i = 0; i < claim.erc1155.length; i++) {\n require(claim.erc1155[i].ids.length == claim.erc1155[i].values.length, \"CLAIM_INVALID_INPUT\");\n _transferERC1155(claim.to, claim.erc1155[i].ids, claim.erc1155[i].values, claim.erc1155[i].contractAddress);\n }\n for (uint256 i = 0; i < claim.erc721.length; i++) {\n _transferERC721(claim.to, claim.erc721[i].ids, claim.erc721[i].contractAddress);\n }\n if (claim.erc20.amounts.length != 0) {\n require(claim.erc20.amounts.length == claim.erc20.contractAddresses.length, \"CLAIM_INVALID_INPUT\");\n _transferERC20(claim.to, claim.erc20.amounts, claim.erc20.contractAddresses);\n }\n emit ClaimedMultipleTokens(claim.to, claim.erc1155, claim.erc721, claim.erc20, merkleRoot);\n }\n\n /// @dev Private function used to check the validity of a specific claim.\n /// @param merkleRoot The merkle root hash for the specific set of items being claimed.\n /// @param claim The claim struct containing the destination address, all items to be claimed and optional salt param.\n /// @param proof The proof provided by the user performing the claim function.\n function _checkValidity(\n bytes32 merkleRoot,\n Claim memory claim,\n bytes32[] memory proof\n ) private pure {\n bytes32 leaf = _generateClaimHash(claim);\n require(MerkleProof.verify(proof, merkleRoot, leaf), \"CLAIM_INVALID\");\n }\n\n /// @dev Internal function used to generate a hash from an encoded claim.\n /// @param claim The claim struct.\n function _generateClaimHash(Claim memory claim) internal pure returns (bytes32) {\n return keccak256(abi.encode(claim));\n }\n\n /// @dev Private function used to transfer the ERC1155 tokens specified in a specific claim.\n /// @param to The destination address for the claimed tokens.\n /// @param ids The array of ERC1155 ids.\n /// @param values The amount of ERC1155 tokens of each id to be transferred.\n /// @param contractAddress The ERC1155 token contract address.\n function _transferERC1155(\n address to,\n uint256[] memory ids,\n uint256[] memory values,\n address contractAddress\n ) private {\n require(contractAddress != address(0), \"CLAIM_INVALID_CONTRACT_ZERO_ADDRESS\");\n IERC1155(contractAddress).safeBatchTransferFrom(address(this), to, ids, values, \"\");\n }\n\n /// @dev Private function used to transfer the ERC721tokens specified in a specific claim.\n /// @param to The destination address for the claimed tokens.\n /// @param ids The array of ERC721 ids.\n /// @param contractAddress The ERC721 token contract address.\n function _transferERC721(\n address to,\n uint256[] memory ids,\n address contractAddress\n ) private {\n require(contractAddress != address(0), \"CLAIM_INVALID_CONTRACT_ZERO_ADDRESS\");\n IERC721Extended(contractAddress).safeBatchTransferFrom(address(this), to, ids, \"\");\n }\n\n /// @dev Private function used to transfer the ERC20 tokens specified in a specific claim.\n /// @param to The destination address for the claimed tokens.\n /// @param amounts The array of amounts of ERC20 tokens to be transferred.\n /// @param contractAddresses The array of ERC20 token contract addresses.\n function _transferERC20(\n address to,\n uint256[] memory amounts,\n address[] memory contractAddresses\n ) private {\n for (uint256 i = 0; i < amounts.length; i++) {\n address erc20ContractAddress = contractAddresses[i];\n uint256 erc20Amount = amounts[i];\n require(erc20ContractAddress != address(0), \"CLAIM_INVALID_CONTRACT_ZERO_ADDRESS\");\n IERC20(erc20ContractAddress).safeTransferFrom(address(this), to, erc20Amount);\n }\n }\n}\n" + }, + "src/solc_0.8/claims/MultiGiveawayV2/MultiGiveawayV2.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {Context} from \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport {ClaimERC1155ERC721ERC20V2} from \"./ClaimERC1155ERC721ERC20V2.sol\";\nimport {AccessControl} from \"@openzeppelin/contracts-0.8/access/AccessControl.sol\";\nimport {Pausable} from \"@openzeppelin/contracts-0.8/security/Pausable.sol\";\nimport {ERC2771Handler} from \"../../common/BaseWithStorage/ERC2771Handler.sol\";\n\n/// @title A Multi Claim contract that enables claims of user rewards in the form of ERC1155, ERC721 and / or ERC20 tokens\n/// @notice This contract manages claims for multiple token types\n/// @notice The following privileged roles are used in this contract: DEFAULT_ADMIN_ROLE, MULTIGIVEAWAY_ROLE\n/// @notice DEFAULT_ADMIN_ROLE is intended for setup / emergency, MULTIGIVEAWAY_ROLE is provided for business purposes\n/// @dev The contract implements ERC2771 to ensure that users do not pay gas\ncontract MultiGiveawayV2 is AccessControl, ClaimERC1155ERC721ERC20V2, ERC2771Handler, Pausable {\n /// @dev `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n\n /// @dev `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n /// @dev `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`\n bytes4 internal constant ERC721_RECEIVED = 0x150b7a02;\n\n /// @dev `bytes4(keccak256(\"onERC721BatchReceived(address,address,uint256[],bytes)\"))`\n bytes4 internal constant ERC721_BATCH_RECEIVED = 0x4b808c46;\n\n mapping(address => mapping(bytes32 => bool)) public claimed;\n mapping(bytes32 => uint256) private _expiryTime;\n\n /// @dev MULTIGIVEAWAY_ROLE is provided for business-related admin functions\n bytes32 public constant MULTIGIVEAWAY_ROLE = keccak256(\"MULTIGIVEAWAY_ROLE\");\n\n event NewGiveaway(bytes32 merkleRoot, uint256 expiryTime);\n event NewTrustedForwarder(address indexed trustedForwarder);\n\n /// @notice Constructor with the admin & trusted forwarder\n /// @param admin Admin of the contract\n /// @param trustedForwarder Trusted forwarder for ERC2771\n constructor(\n address admin,\n address multigiveawayAdmin,\n address trustedForwarder\n ) {\n require(admin != address(0), \"MULTIGIVEAWAY_INVALID_TO_ZERO_ADDRESS\");\n _grantRole(DEFAULT_ADMIN_ROLE, admin);\n _grantRole(MULTIGIVEAWAY_ROLE, multigiveawayAdmin);\n __ERC2771Handler_initialize(trustedForwarder);\n }\n\n /// @notice Function to add a new giveaway.\n /// @param merkleRoot The merkle root hash of the claim data.\n /// @param expiryTime The expiry time for the giveaway.\n function addNewGiveaway(bytes32 merkleRoot, uint256 expiryTime)\n external\n onlyRole(MULTIGIVEAWAY_ROLE)\n whenNotPaused()\n {\n require(expiryTime > block.timestamp, \"MULTIGIVEAWAY_INVALID_INPUT\");\n require(merkleRoot != 0, \"MULTIGIVEAWAY_INVALID_INPUT\");\n require(_expiryTime[merkleRoot] == 0, \"MULTIGIVEAWAY_ALREADY_EXISTS\");\n _expiryTime[merkleRoot] = expiryTime;\n emit NewGiveaway(merkleRoot, expiryTime);\n }\n\n /// @notice set the trusted forwarder\n /// @param trustedForwarder address of the contract that is enabled to send meta-tx on behalf of the user\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(trustedForwarder != address(0), \"MULTIGIVEAWAY_INVALID_ZERO_ADDRESS\");\n _trustedForwarder = trustedForwarder;\n\n emit NewTrustedForwarder(trustedForwarder);\n }\n\n /// @notice Function to permit the claiming of multiple tokens from multiple giveaways to a reserved address.\n /// @param claims The array of claim structs, each containing a destination address, the giveaway items to be claimed and an optional salt param.\n /// @param proofs The proofs submitted for verification.\n function claimMultipleTokensFromMultipleMerkleTree(\n bytes32[] calldata rootHashes,\n Claim[] memory claims,\n bytes32[][] calldata proofs\n ) external {\n require(claims.length == rootHashes.length, \"MULTIGIVEAWAY_INVALID_INPUT\");\n require(claims.length == proofs.length, \"MULTIGIVEAWAY_INVALID_INPUT\");\n for (uint256 i = 0; i < rootHashes.length; i++) {\n claimMultipleTokens(rootHashes[i], claims[i], proofs[i]);\n }\n }\n\n /// @notice Function to check which giveaways have been claimed by a particular user.\n /// @param user The user (intended token destination) address.\n /// @param claims The claim struct containing the destination address, all items to be claimed and optional salt param.\n /// @return claimedGiveaways The array of bools confirming whether or not the giveaways relating to the root hashes provided have been claimed.\n function getClaimedStatus(address user, Claim[] memory claims) external view returns (bool[] memory) {\n bool[] memory claimedGiveaways = new bool[](claims.length);\n for (uint256 i = 0; i < claims.length; i++) {\n bytes32 merkleLeaf = _generateClaimHash(claims[i]);\n claimedGiveaways[i] = claimed[user][merkleLeaf];\n }\n return claimedGiveaways;\n }\n\n /// @dev Public function used to perform validity checks and progress to claim multiple token types in one claim.\n /// @param merkleRoot The merkle root hash for the specific set of items being claimed.\n /// @param claim The claim struct containing the destination address, all items to be claimed and optional salt param.\n /// @param proof The proof provided by the user performing the claim function.\n function claimMultipleTokens(\n bytes32 merkleRoot,\n Claim memory claim,\n bytes32[] calldata proof\n ) public whenNotPaused() {\n uint256 giveawayExpiryTime = _expiryTime[merkleRoot];\n require(claim.to != address(0), \"MULTIGIVEAWAY_INVALID_TO_ZERO_ADDRESS\");\n require(claim.to != address(this), \"MULTIGIVEAWAY_DESTINATION_MULTIGIVEAWAY_CONTRACT\");\n require(giveawayExpiryTime != 0, \"MULTIGIVEAWAY_DOES_NOT_EXIST\");\n require(block.timestamp < giveawayExpiryTime, \"MULTIGIVEAWAY_CLAIM_PERIOD_IS_OVER\");\n bytes32 merkleLeaf = _generateClaimHash(claim);\n require(claimed[claim.to][merkleLeaf] == false, \"MULTIGIVEAWAY_DESTINATION_ALREADY_CLAIMED\");\n claimed[claim.to][merkleLeaf] = true;\n\n _claimERC1155ERC721ERC20(merkleRoot, claim, proof);\n }\n\n /// @notice Get the expiry time for a merkle root\n /// @param merkleRoot merkle root\n function getExpiryTime(bytes32 merkleRoot) external view returns (uint256) {\n return _expiryTime[merkleRoot];\n }\n\n /// @notice Pause the contract\n /// @dev Only the role DEFAULT_ADMIN_ROLE can pause\n function pause() external onlyRole(DEFAULT_ADMIN_ROLE) {\n _pause();\n }\n\n /// @notice Unpause the contract\n /// @dev Only the role DEFAULT_ADMIN_ROLE can unpause\n function unpause() external onlyRole(DEFAULT_ADMIN_ROLE) {\n _unpause();\n }\n\n /// @notice Handle the receipt of an NFT\n /// @return `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`\n function onERC721Received(\n address, /*operator*/\n address, /*from*/\n uint256, /*id*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC721_RECEIVED;\n }\n\n /// @notice Handle the receipt of a batch of NFTs\n /// @return `bytes4(keccak256(\"onERC721BatchReceived(address,address,uint256[],bytes)\"))`\n function onERC721BatchReceived(\n address, /*operator*/\n address, /*from*/\n uint256[] calldata, /*ids*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC721_BATCH_RECEIVED;\n }\n\n /// @notice Handle the receipt of a single ERC1155 token type.\n /// @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n function onERC1155Received(\n address, /*operator*/\n address, /*from*/\n uint256, /*id*/\n uint256, /*value*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n /// @notice Handle the receipt of a batch of ERC1155 tokens type.\n /// @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n function onERC1155BatchReceived(\n address, /*operator*/\n address, /*from*/\n uint256[] calldata, /*ids*/\n uint256[] calldata, /*values*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n\n /// @dev Returns the real sender of meta-transactions\n /// @return sender sender of the meta-tx\n function _msgSender() internal view override(Context, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n /// @dev Returns the real data of meta-transactions\n /// @return calldata data of the meta-tx\n function _msgData() internal view override(Context, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n}\n" + }, + "src/solc_0.8/claims/signedGiveaway/SignedERC20Giveaway.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {EIP712Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol\";\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {ERC2771Handler} from \"../../common/BaseWithStorage/ERC2771Handler.sol\";\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\nimport {ECDSAUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol\";\nimport {AccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\n\n/// @title This contract pays Sand claims when the backend authorize it via message signing.\n/// @dev can be extended to support NFTs, etc.\n/// @dev This contract support meta transactions.\n/// @dev This contract is final, don't inherit form it.\ncontract SignedERC20Giveaway is\n Initializable,\n ContextUpgradeable,\n AccessControlUpgradeable,\n EIP712Upgradeable,\n ERC2771Handler,\n PausableUpgradeable\n{\n event Claimed(address indexed signer, uint256 claimId, address indexed token, address indexed to, uint256 amount);\n event RevokedClaims(uint256[] claimIds);\n\n bytes32 public constant SIGNER_ROLE = keccak256(\"SIGNER_ROLE\");\n bytes32 public constant CLAIM_TYPEHASH =\n keccak256(\"Claim(address signer,uint256 claimId,address token,address to,uint256 amount)\");\n string public constant name = \"Sandbox SignedERC20Giveaway\";\n string public constant version = \"1.0\";\n mapping(uint256 => bool) public claimed;\n\n function initialize(address trustedForwarder_, address defaultAdmin_) external initializer {\n __Context_init_unchained();\n __ERC165_init_unchained();\n __AccessControl_init_unchained();\n __EIP712_init_unchained(name, version);\n __ERC2771Handler_initialize(trustedForwarder_);\n __Pausable_init_unchained();\n _setupRole(DEFAULT_ADMIN_ROLE, defaultAdmin_);\n }\n\n /// @notice verifies a ERC712 signature for the Mint data type.\n /// @param v signature part\n /// @param r signature part\n /// @param s signature part\n /// @param signer the address of the signer, must be part of the signer role\n /// @param claimId unique claim id\n /// @param token token contract address\n /// @param to destination user\n /// @param amount of ERC20 to transfer\n /// @return true if the signature is valid\n function verify(\n uint8 v,\n bytes32 r,\n bytes32 s,\n address signer,\n uint256 claimId,\n address token,\n address to,\n uint256 amount\n ) external view returns (bool) {\n return _verify(v, r, s, signer, claimId, token, to, amount);\n }\n\n /// @notice verifies a ERC712 signature and mint a new NFT for the buyer.\n /// @param v signature part\n /// @param r signature part\n /// @param s signature part\n /// @param signer the address of the signer, must be part of the signer role\n /// @param claimId unique claim id\n /// @param token token contract address\n /// @param to destination user\n /// @param amount of ERC20 to transfer\n function claim(\n uint8 v,\n bytes32 r,\n bytes32 s,\n address signer,\n uint256 claimId,\n address token,\n address to,\n uint256 amount\n ) external whenNotPaused {\n require(_verify(v, r, s, signer, claimId, token, to, amount), \"Invalid signature\");\n require(hasRole(SIGNER_ROLE, signer), \"Invalid signer\");\n require(!claimed[claimId], \"Already claimed\");\n claimed[claimId] = true;\n require(IERC20Upgradeable(token).transfer(to, amount), \"Transfer failed\");\n emit Claimed(signer, claimId, token, to, amount);\n }\n\n /// @notice let the admin revoke some claims so they cannot be used\n /// @param claimIds and array of claim Ids to revoke\n function revokeClaims(uint256[] calldata claimIds) external {\n require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), \"Only admin\");\n for (uint256 i = 0; i < claimIds.length; i++) {\n claimed[claimIds[i]] = true;\n }\n emit RevokedClaims(claimIds);\n }\n\n // @dev Triggers stopped state.\n // The contract must not be paused.\n function pause() external {\n require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), \"Only admin\");\n _pause();\n }\n\n // @dev Returns to normal state.\n // The contract must be paused.\n function unpause() external {\n require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), \"Only admin\");\n _unpause();\n }\n\n function domainSeparator() external view returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n function getChainId() external view returns (uint256) {\n return block.chainid;\n }\n\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n\n function _verify(\n uint8 v,\n bytes32 r,\n bytes32 s,\n address signer,\n uint256 claimId,\n address token,\n address to,\n uint256 amount\n ) internal view returns (bool) {\n bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(CLAIM_TYPEHASH, signer, claimId, token, to, amount)));\n address recoveredSigner = ECDSAUpgradeable.recover(digest, v, r, s);\n return recoveredSigner == signer;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view override(AccessControlUpgradeable) returns (bool) {\n return super.supportsInterface(interfaceId);\n }\n}\n" + }, + "src/solc_0.8/common/Base/TheSandbox712.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ncontract TheSandbox712 {\n bytes32 internal constant EIP712DOMAIN_TYPEHASH =\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n // solhint-disable-next-line var-name-mixedcase\n bytes32 public immutable _DOMAIN_SEPARATOR;\n\n constructor() {\n _DOMAIN_SEPARATOR = keccak256(\n // chainId 137 = Polygon\n abi.encode(EIP712DOMAIN_TYPEHASH, keccak256(\"The Sandbox\"), keccak256(\"1\"), block.chainid, address(this))\n );\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC20/ERC20BaseToken.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport \"./extensions/ERC20Internal.sol\";\nimport \"../../interfaces/IERC20Extended.sol\";\nimport \"../WithSuperOperators.sol\";\n\nabstract contract ERC20BaseToken is WithSuperOperators, IERC20, IERC20Extended, ERC20Internal, Context {\n string internal _name;\n string internal _symbol;\n address internal immutable _operator;\n uint256 internal _totalSupply;\n mapping(address => uint256) internal _balances;\n mapping(address => mapping(address => uint256)) internal _allowances;\n\n constructor(\n string memory tokenName,\n string memory tokenSymbol,\n address admin,\n address operator\n ) {\n _name = tokenName;\n _symbol = tokenSymbol;\n _admin = admin;\n _operator = operator;\n }\n\n /// @notice Transfer `amount` tokens to `to`.\n /// @param to The recipient address of the tokens being transfered.\n /// @param amount The number of tokens being transfered.\n /// @return success Whether or not the transfer succeeded.\n function transfer(address to, uint256 amount) external override returns (bool success) {\n _transfer(_msgSender(), to, amount);\n return true;\n }\n\n /// @notice Transfer `amount` tokens from `from` to `to`.\n /// @param from The origin address of the tokens being transferred.\n /// @param to The recipient address of the tokensbeing transfered.\n /// @param amount The number of tokens transfered.\n /// @return success Whether or not the transfer succeeded.\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool success) {\n if (_msgSender() != from && !_superOperators[_msgSender()] && _msgSender() != _operator) {\n uint256 currentAllowance = _allowances[from][_msgSender()];\n if (currentAllowance != ~uint256(0)) {\n // save gas when allowance is maximal by not reducing it (see https://github.com/ethereum/EIPs/issues/717)\n require(currentAllowance >= amount, \"NOT_AUTHORIZED_ALLOWANCE\");\n _allowances[from][_msgSender()] = currentAllowance - amount;\n }\n }\n _transfer(from, to, amount);\n return true;\n }\n\n /// @notice Burn `amount` tokens.\n /// @param amount The number of tokens to burn.\n function burn(uint256 amount) external override {\n _burn(_msgSender(), amount);\n }\n\n /// @notice Burn `amount` tokens from `owner`.\n /// @param from The address whose token to burn.\n /// @param amount The number of tokens to burn.\n function burnFor(address from, uint256 amount) external override {\n _burn(from, amount);\n }\n\n /// @notice Approve `spender` to transfer `amount` tokens.\n /// @param spender The address to be given rights to transfer.\n /// @param amount The number of tokens allowed.\n /// @return success Whether or not the call succeeded.\n function approve(address spender, uint256 amount) external override returns (bool success) {\n _approveFor(_msgSender(), spender, amount);\n return true;\n }\n\n /// @notice Get the name of the token collection.\n /// @return The name of the token collection.\n function name() external view virtual returns (string memory) {\n //added virtual\n return _name;\n }\n\n /// @notice Get the symbol for the token collection.\n /// @return The symbol of the token collection.\n function symbol() external view virtual returns (string memory) {\n //added virtual\n return _symbol;\n }\n\n /// @notice Get the total number of tokens in existence.\n /// @return The total number of tokens in existence.\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n\n /// @notice Get the balance of `owner`.\n /// @param owner The address to query the balance of.\n /// @return The amount owned by `owner`.\n function balanceOf(address owner) external view override returns (uint256) {\n return _balances[owner];\n }\n\n /// @notice Get the allowance of `spender` for `owner`'s tokens.\n /// @param owner The address whose token is allowed.\n /// @param spender The address allowed to transfer.\n /// @return remaining The amount of token `spender` is allowed to transfer on behalf of `owner`.\n function allowance(address owner, address spender) external view override returns (uint256 remaining) {\n return _allowances[owner][spender];\n }\n\n /// @notice Get the number of decimals for the token collection.\n /// @return The number of decimals.\n function decimals() external pure virtual returns (uint8) {\n return uint8(18);\n }\n\n /// @notice Approve `spender` to transfer `amount` tokens from `owner`.\n /// @param owner The address whose token is allowed.\n /// @param spender The address to be given rights to transfer.\n /// @param amount The number of tokens allowed.\n /// @return success Whether or not the call succeeded.\n function approveFor(\n address owner,\n address spender,\n uint256 amount\n ) public override returns (bool success) {\n require(_msgSender() == owner || _superOperators[_msgSender()] || _msgSender() == _operator, \"NOT_AUTHORIZED\");\n _approveFor(owner, spender, amount);\n return true;\n }\n\n /// @notice Increase the allowance for the spender if needed\n /// @param owner The address of the owner of the tokens\n /// @param spender The address wanting to spend tokens\n /// @param amountNeeded The amount requested to spend\n /// @return success Whether or not the call succeeded.\n function addAllowanceIfNeeded(\n address owner,\n address spender,\n uint256 amountNeeded\n ) public returns (bool success) {\n require(_msgSender() == owner || _superOperators[_msgSender()] || _msgSender() == _operator, \"INVALID_SENDER\");\n _addAllowanceIfNeeded(owner, spender, amountNeeded);\n return true;\n }\n\n /// @dev See addAllowanceIfNeeded.\n function _addAllowanceIfNeeded(\n address owner,\n address spender,\n uint256 amountNeeded /*(ERC20Internal, ERC20ExecuteExtension, ERC20BasicApproveExtension)*/\n ) internal virtual override {\n if (amountNeeded > 0 && !isSuperOperator(spender) && spender != _operator) {\n uint256 currentAllowance = _allowances[owner][spender];\n if (currentAllowance < amountNeeded) {\n _approveFor(owner, spender, amountNeeded);\n }\n }\n }\n\n /// @dev See approveFor.\n function _approveFor(\n address owner,\n address spender,\n uint256 amount /*(ERC20BasicApproveExtension, ERC20Internal)*/\n ) internal virtual override {\n require(owner != address(0) && spender != address(0), \"INVALID_OWNER_||_SPENDER\");\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /// @dev See transfer.\n function _transfer(\n address from,\n address to,\n uint256 amount /*(ERC20Internal, ERC20ExecuteExtension)*/\n ) internal virtual override {\n require(to != address(0), \"NOT_TO_ZEROADDRESS\");\n require(to != address(this), \"NOT_TO_THIS\");\n uint256 currentBalance = _balances[from];\n require(currentBalance >= amount, \"INSUFFICIENT_FUNDS\");\n _balances[from] = currentBalance - amount;\n _balances[to] += amount;\n emit Transfer(from, to, amount);\n }\n\n /// @dev Mint tokens for a recipient.\n /// @param to The recipient address.\n /// @param amount The number of token to mint.\n function _mint(address to, uint256 amount) internal {\n require(to != address(0), \"NOT_TO_ZEROADDRESS\");\n require(amount > 0, \"MINT_O_TOKENS\");\n uint256 currentTotalSupply = _totalSupply;\n uint256 newTotalSupply = currentTotalSupply + amount;\n require(newTotalSupply > currentTotalSupply, \"OVERFLOW\");\n _totalSupply = newTotalSupply;\n _balances[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @dev Burn tokens from an address.\n /// @param from The address whose tokens to burn.\n /// @param amount The number of token to burn.\n function _burn(address from, uint256 amount) internal {\n require(amount > 0, \"BURN_O_TOKENS\");\n if (_msgSender() != from && !_superOperators[_msgSender()] && _msgSender() != _operator) {\n uint256 currentAllowance = _allowances[from][_msgSender()];\n if (currentAllowance != ~uint256(0)) {\n // save gas when allowance is maximal by not reducing it (see https://github.com/ethereum/EIPs/issues/717)\n require(currentAllowance >= amount, \"INSUFFICIENT_ALLOWANCE\");\n _allowances[from][_msgSender()] = currentAllowance - amount;\n }\n }\n\n uint256 currentBalance = _balances[from];\n require(currentBalance >= amount, \"INSUFFICIENT_FUNDS\");\n _balances[from] = currentBalance - amount;\n _totalSupply -= amount;\n emit Transfer(from, address(0), amount);\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC20/ERC20BaseTokenUpgradeable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-upgradeable/metatx/ERC2771ContextUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport \"./extensions/ERC20Internal.sol\";\nimport \"../../interfaces/IERC20Extended.sol\";\n\nabstract contract ERC20BaseTokenUpgradeable is\n IERC20,\n IERC20Extended,\n ERC20Internal,\n ERC2771ContextUpgradeable,\n AccessControlUpgradeable\n{\n bytes32 public constant SUPER_OPERATOR_ROLE = keccak256(\"SUPER_OPERATOR_ROLE\");\n\n string internal _name;\n string internal _symbol;\n uint256 internal _totalSupply;\n mapping(address => uint256) internal _balances;\n mapping(address => mapping(address => uint256)) internal _allowances;\n\n uint256[50] private __gap;\n\n function __ERC20BaseTokenUpgradeable_init(\n string memory tokenName,\n string memory tokenSymbol,\n address trustedForwarder,\n address admin\n ) internal initializer {\n _name = tokenName;\n _symbol = tokenSymbol;\n __AccessControl_init();\n _setupRole(DEFAULT_ADMIN_ROLE, admin);\n __ERC2771Context_init(trustedForwarder);\n }\n\n /// @notice Transfer `amount` tokens to `to`.\n /// @param to The recipient address of the tokens being transfered.\n /// @param amount The number of tokens being transfered.\n /// @return success Whether or not the transfer succeeded.\n function transfer(address to, uint256 amount) external override returns (bool success) {\n _transfer(_msgSender(), to, amount);\n return true;\n }\n\n /// @notice Transfer `amount` tokens from `from` to `to`.\n /// @param from The origin address of the tokens being transferred.\n /// @param to The recipient address of the tokensbeing transfered.\n /// @param amount The number of tokens transfered.\n /// @return success Whether or not the transfer succeeded.\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool success) {\n if (_msgSender() != from && !hasRole(SUPER_OPERATOR_ROLE, _msgSender())) {\n uint256 currentAllowance = _allowances[from][_msgSender()];\n if (currentAllowance != ~uint256(0)) {\n // save gas when allowance is maximal by not reducing it (see https://github.com/ethereum/EIPs/issues/717)\n require(currentAllowance >= amount, \"NOT_AUTHORIZED_ALLOWANCE\");\n _allowances[from][_msgSender()] = currentAllowance - amount;\n }\n }\n _transfer(from, to, amount);\n return true;\n }\n\n /// @notice Burn `amount` tokens.\n /// @param amount The number of tokens to burn.\n function burn(uint256 amount) external override {\n _burn(_msgSender(), amount);\n }\n\n /// @notice Burn `amount` tokens from `owner`.\n /// @param from The address whose token to burn.\n /// @param amount The number of tokens to burn.\n function burnFor(address from, uint256 amount) external override {\n _burn(from, amount);\n }\n\n /// @notice Approve `spender` to transfer `amount` tokens.\n /// @param spender The address to be given rights to transfer.\n /// @param amount The number of tokens allowed.\n /// @return success Whether or not the call succeeded.\n function approve(address spender, uint256 amount) external override returns (bool success) {\n _approveFor(_msgSender(), spender, amount);\n return true;\n }\n\n /// @notice Get the name of the token collection.\n /// @return The name of the token collection.\n function name() external view virtual returns (string memory) {\n //added virtual\n return _name;\n }\n\n /// @notice Get the symbol for the token collection.\n /// @return The symbol of the token collection.\n function symbol() external view virtual returns (string memory) {\n //added virtual\n return _symbol;\n }\n\n /// @notice Get the total number of tokens in existence.\n /// @return The total number of tokens in existence.\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n\n /// @notice Get the balance of `owner`.\n /// @param owner The address to query the balance of.\n /// @return The amount owned by `owner`.\n function balanceOf(address owner) external view override returns (uint256) {\n return _balances[owner];\n }\n\n /// @notice Get the allowance of `spender` for `owner`'s tokens.\n /// @param owner The address whose token is allowed.\n /// @param spender The address allowed to transfer.\n /// @return remaining The amount of token `spender` is allowed to transfer on behalf of `owner`.\n function allowance(address owner, address spender) external view override returns (uint256 remaining) {\n return _allowances[owner][spender];\n }\n\n /// @notice Get the number of decimals for the token collection.\n /// @return The number of decimals.\n function decimals() public pure virtual returns (uint8) {\n return uint8(18);\n }\n\n /// @notice Approve `spender` to transfer `amount` tokens from `owner`.\n /// @param owner The address whose token is allowed.\n /// @param spender The address to be given rights to transfer.\n /// @param amount The number of tokens allowed.\n /// @return success Whether or not the call succeeded.\n function approveFor(\n address owner,\n address spender,\n uint256 amount\n ) external virtual override returns (bool success) {\n require(_msgSender() == owner || hasRole(SUPER_OPERATOR_ROLE, _msgSender()), \"NOT_AUTHORIZED\");\n _approveFor(owner, spender, amount);\n return true;\n }\n\n /// @notice Increase the allowance for the spender if needed\n /// @param owner The address of the owner of the tokens\n /// @param spender The address wanting to spend tokens\n /// @param amountNeeded The amount requested to spend\n /// @return success Whether or not the call succeeded.\n function addAllowanceIfNeeded(\n address owner,\n address spender,\n uint256 amountNeeded\n ) external returns (bool success) {\n require(_msgSender() == owner || hasRole(SUPER_OPERATOR_ROLE, _msgSender()), \"INVALID_SENDER\");\n _addAllowanceIfNeeded(owner, spender, amountNeeded);\n return true;\n }\n\n /// @dev See addAllowanceIfNeeded.\n function _addAllowanceIfNeeded(\n address owner,\n address spender,\n uint256 amountNeeded\n ) internal virtual override {\n if (amountNeeded > 0 && !hasRole(SUPER_OPERATOR_ROLE, _msgSender())) {\n uint256 currentAllowance = _allowances[owner][spender];\n if (currentAllowance < amountNeeded) {\n _approveFor(owner, spender, amountNeeded);\n }\n }\n }\n\n /// @dev See approveFor.\n function _approveFor(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual override {\n require(owner != address(0) && spender != address(0), \"INVALID_OWNER_||_SPENDER\");\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /// @dev See transfer.\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n require(to != address(0), \"NOT_TO_ZEROADDRESS\");\n require(to != address(this), \"NOT_TO_THIS\");\n uint256 currentBalance = _balances[from];\n require(currentBalance >= amount, \"INSUFFICIENT_FUNDS\");\n _balances[from] = currentBalance - amount;\n _balances[to] += amount;\n emit Transfer(from, to, amount);\n }\n\n /// @dev Mint tokens for a recipient.\n /// @param to The recipient address.\n /// @param amount The number of token to mint.\n function _mint(address to, uint256 amount) internal {\n require(to != address(0), \"NOT_TO_ZEROADDRESS\");\n require(amount > 0, \"MINT_O_TOKENS\");\n uint256 currentTotalSupply = _totalSupply;\n uint256 newTotalSupply = currentTotalSupply + amount;\n require(newTotalSupply > currentTotalSupply, \"OVERFLOW\");\n _totalSupply = newTotalSupply;\n _balances[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @dev Burn tokens from an address.\n /// @param from The address whose tokens to burn.\n /// @param amount The number of token to burn.\n function _burn(address from, uint256 amount) internal {\n require(amount > 0, \"BURN_O_TOKENS\");\n if (_msgSender() != from && !hasRole(SUPER_OPERATOR_ROLE, _msgSender())) {\n uint256 currentAllowance = _allowances[from][_msgSender()];\n if (currentAllowance != ~uint256(0)) {\n // save gas when allowance is maximal by not reducing it (see https://github.com/ethereum/EIPs/issues/717)\n require(currentAllowance >= amount, \"INSUFFICIENT_ALLOWANCE\");\n _allowances[from][_msgSender()] = currentAllowance - amount;\n }\n }\n uint256 currentBalance = _balances[from];\n require(currentBalance >= amount, \"INSUFFICIENT_FUNDS\");\n _balances[from] = currentBalance - amount;\n _totalSupply -= amount;\n emit Transfer(from, address(0), amount);\n }\n\n function _msgSender()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771ContextUpgradeable)\n returns (address sender)\n {\n return ERC2771ContextUpgradeable._msgSender();\n }\n\n function _msgData()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771ContextUpgradeable)\n returns (bytes calldata)\n {\n return ERC2771ContextUpgradeable._msgData();\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC20/ERC20Token.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./ERC20BaseToken.sol\";\nimport \"./extensions/ERC20BasicApproveExtension.sol\";\nimport \"../WithPermit.sol\";\nimport \"../ERC677/extensions/ERC677Extension.sol\";\nimport \"../../interfaces/IERC677Receiver.sol\";\n\ncontract ERC20Token is ERC20BasicApproveExtension, ERC677Extension, WithPermit, ERC20BaseToken {\n // /////////////////// CONSTRUCTOR ////////////////////\n constructor(\n string memory name,\n string memory symbol,\n address admin,\n address operator\n )\n ERC20BaseToken(name, symbol, admin, operator) // solhint-disable-next-line no-empty-blocks\n {}\n\n function mint(address to, uint256 amount) external onlyAdmin {\n _mint(to, amount);\n }\n\n /// @notice Function to permit the expenditure of ERC20 token by a nominated spender\n /// @param owner The owner of the ERC20 tokens\n /// @param spender The nominated spender of the ERC20 tokens\n /// @param value The value (allowance) of the ERC20 tokens that the nominated spender will be allowed to spend\n /// @param deadline The deadline for granting permission to the spender\n /// @param v The final 1 byte of signature\n /// @param r The first 32 bytes of signature\n /// @param s The second 32 bytes of signature\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public override {\n checkApproveFor(owner, spender, value, deadline, v, r, s);\n _approveFor(owner, spender, value);\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC20/ERC20TokenUpgradeable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./ERC20BaseTokenUpgradeable.sol\";\nimport \"../WithPermitUpgradeable.sol\";\nimport \"../ERC677/extensions/ERC677Extension.sol\";\nimport \"../../interfaces/IERC677Receiver.sol\";\n\ncontract ERC20TokenUpgradeable is ERC677Extension, WithPermitUpgradeable, ERC20BaseTokenUpgradeable {\n function __ERC20TokenUpgradeable_init(\n string memory name,\n string memory symbol,\n address trustedForwarder,\n address admin\n ) public initializer {\n __ERC20BaseTokenUpgradeable_init(name, symbol, trustedForwarder, admin);\n __WithPermitUpgradeable_init(\"The Sandbox\");\n }\n\n function mint(address to, uint256 amount) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _mint(to, amount);\n }\n\n /// @notice Function to permit the expenditure of ERC20 token by a nominated spender\n /// @param owner The owner of the ERC20 tokens\n /// @param spender The nominated spender of the ERC20 tokens\n /// @param value The value (allowance) of the ERC20 tokens that the nominated spender will be allowed to spend\n /// @param deadline The deadline for granting permission to the spender\n /// @param v The final 1 byte of signature\n /// @param r The first 32 bytes of signature\n /// @param s The second 32 bytes of signature\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public override {\n checkApproveFor(owner, spender, value, deadline, v, r, s);\n _approveFor(owner, spender, value);\n }\n\n function _msgSender() internal view override(Context, ERC20BaseTokenUpgradeable) returns (address sender) {\n return ERC2771ContextUpgradeable._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC20BaseTokenUpgradeable) returns (bytes calldata) {\n return ERC2771ContextUpgradeable._msgData();\n }\n\n uint256[50] private __gap;\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC20/extensions/ERC20BasicApproveExtension.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport \"./ERC20Internal.sol\";\nimport \"../../../Libraries/BytesUtil.sol\";\n\nabstract contract ERC20BasicApproveExtension is ERC20Internal, Context {\n /// @notice Approve `target` to spend `amount` and call it with data.\n /// @param target The address to be given rights to transfer and destination of the call.\n /// @param amount The number of tokens allowed.\n /// @param data The bytes for the call.\n /// @return The data of the call.\n function approveAndCall(\n address target,\n uint256 amount,\n bytes calldata data\n ) external payable returns (bytes memory) {\n require(BytesUtil.doFirstParamEqualsAddress(data, _msgSender()), \"FIRST_PARAM_NOT_SENDER\");\n\n _approveFor(_msgSender(), target, amount);\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returnData) = target.call{value: msg.value}(data);\n require(success, string(returnData));\n return returnData;\n }\n\n /// @notice Temporarily approve `target` to spend `amount` and call it with data.\n /// Previous approvals remains unchanged.\n /// @param target The destination of the call, allowed to spend the amount specified\n /// @param amount The number of tokens allowed to spend.\n /// @param data The bytes for the call.\n /// @return The data of the call.\n function paidCall(\n address target,\n uint256 amount,\n bytes calldata data\n ) external payable returns (bytes memory) {\n require(BytesUtil.doFirstParamEqualsAddress(data, _msgSender()), \"FIRST_PARAM_NOT_SENDER\");\n\n if (amount > 0) {\n _addAllowanceIfNeeded(_msgSender(), target, amount);\n }\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returnData) = target.call{value: msg.value}(data);\n require(success, string(returnData));\n\n return returnData;\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC20/extensions/ERC20Internal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nabstract contract ERC20Internal {\n function _approveFor(\n address owner,\n address target,\n uint256 amount\n ) internal virtual;\n\n function _addAllowanceIfNeeded(\n address owner,\n address spender,\n uint256 amountNeeded\n ) internal virtual;\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual;\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC2771/ERC2771HandlerUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/// @dev minimal ERC2771 handler to keep bytecode-size down\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.6.0/contracts/metatx/ERC2771Context.sol\n/// with an initializer for proxies and a mutable forwarder\n/// @dev same as ERC2771Handler.sol but with gap\n\ncontract ERC2771HandlerUpgradeable {\n address internal _trustedForwarder;\n uint256[49] private __gap;\n\n function __ERC2771Handler_initialize(address forwarder) internal {\n _trustedForwarder = forwarder;\n }\n\n function isTrustedForwarder(address forwarder) public view returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n function getTrustedForwarder() external view returns (address trustedForwarder) {\n return _trustedForwarder;\n }\n\n function _msgSender() internal view virtual returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return msg.sender;\n }\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender)) {\n return msg.data[:msg.data.length - 20];\n } else {\n return msg.data;\n }\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC2771/ERC2771HandlerV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/// @dev minimal ERC2771 handler to keep bytecode-size down\n/// @dev no initializer version\n\ncontract ERC2771HandlerV2 {\n address internal _trustedForwarder;\n\n constructor(address forwarder) {\n _trustedForwarder = forwarder;\n }\n\n function isTrustedForwarder(address forwarder) public view returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n function getTrustedForwarder() external view returns (address trustedForwarder) {\n return _trustedForwarder;\n }\n\n function _msgSender() internal view virtual returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return msg.sender;\n }\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender)) {\n return msg.data[:msg.data.length - 20];\n } else {\n return msg.data;\n }\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC2771Handler.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/**\n * @title ERC2771Handler\n * @author The Sandbox\n * @notice Handle meta-transactions\n * @dev minimal ERC2771 handler to keep bytecode-size down\n * based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.6.0/contracts/metatx/ERC2771Context.sol\n * with an initializer for proxies and a mutable forwarder\n */\nabstract contract ERC2771Handler {\n address internal _trustedForwarder;\n\n event TrustedForwarderSet(address indexed newForwarder);\n\n /**\n * @dev Initializes the contract\n * @param forwarder trusted forwarder address\n */\n function __ERC2771Handler_initialize(address forwarder) internal {\n _trustedForwarder = forwarder;\n emit TrustedForwarderSet(_trustedForwarder);\n }\n\n /**\n * @notice Checks if an address is a trusted forwarder\n * @param forwarder address to check\n * @return is trusted\n */\n function isTrustedForwarder(address forwarder) public view returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n /**\n * @notice Get the current trusted forwarder\n * @return trustedForwarder address of the trusted forwarder\n */\n function getTrustedForwarder() external view returns (address) {\n return _trustedForwarder;\n }\n\n /**\n * @dev if the call comes from the trusted forwarder, it gets the real sender by checking the encoded address in the data\n * @return sender address of the real sender\n */\n function _msgSender() internal view virtual returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return msg.sender;\n }\n }\n\n /**\n * @dev if the call comes from the trusted forwarder, it substracts the sender address from `msg.data` to get the real `msg.data`\n * @return the real `msg.data`\n */\n function _msgData() internal view virtual returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender)) {\n return msg.data[:msg.data.length - 20];\n } else {\n return msg.data;\n }\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC2771HandlerV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/// @dev minimal ERC2771 handler to keep bytecode-size down.\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\n\nabstract contract ERC2771HandlerV2 {\n address internal _trustedForwarder;\n\n function __ERC2771HandlerV2_initialize(address forwarder) internal {\n _trustedForwarder = forwarder;\n }\n\n function isTrustedForwarder(address forwarder) public view returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n function getTrustedForwarder() external view returns (address trustedForwarder) {\n return _trustedForwarder;\n }\n\n function _msgSender() internal view virtual returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n require(msg.data.length >= 24, \"ERC2771HandlerV2: Invalid msg.data\");\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return msg.sender;\n }\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender)) {\n require(msg.data.length >= 24, \"ERC2771HandlerV2: Invalid msg.data\");\n return msg.data[:msg.data.length - 20];\n } else {\n return msg.data;\n }\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC2771HandlerV3.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/// @dev minimal ERC2771 handler to keep bytecode-size down.\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\n\nabstract contract ERC2771HandlerV3 {\n address internal _trustedForwarder;\n\n function __ERC2771HandlerV3_initialize(address forwarder) internal {\n _trustedForwarder = forwarder;\n }\n\n /// @notice check if an given address is a trusted forwarder\n /// @param forwarder address to check\n function isTrustedForwarder(address forwarder) public view returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n /// @notice return trusted forwarder address\n function getTrustedForwarder() external view returns (address) {\n return _trustedForwarder;\n }\n\n function _msgSender() internal view virtual returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n require(msg.data.length >= 24, \"ERC2771HandlerV2: Invalid msg.data\");\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return msg.sender;\n }\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender)) {\n require(msg.data.length >= 24, \"ERC2771HandlerV2: Invalid msg.data\");\n return msg.data[:msg.data.length - 20];\n } else {\n return msg.data;\n }\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC677/extensions/ERC677Extension.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../../interfaces/IERC677.sol\";\nimport \"../../../interfaces/IERC677Receiver.sol\";\nimport \"../../ERC20/extensions/ERC20Internal.sol\";\nimport \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport \"@openzeppelin/contracts-0.8/utils/Context.sol\";\n\nabstract contract ERC677Extension is ERC20Internal, IERC677, Context {\n using Address for address;\n\n /// @notice Transfers tokens to an address with _data if the recipient is a contact.\n /// @param _to The address to transfer to.\n /// @param _value The amount to be transferred.\n /// @param _data The extra data to be passed to the receiving contract.\n function transferAndCall(\n address _to,\n uint256 _value,\n bytes calldata _data\n ) external override returns (bool success) {\n _transfer(_msgSender(), _to, _value);\n if (_to.isContract()) {\n IERC677Receiver receiver = IERC677Receiver(_to);\n receiver.onTokenTransfer(_msgSender(), _value, _data);\n }\n return true;\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC721BaseToken.sol": { + "content": "//SPDX-License-Identifier: MIT\n/* solhint-disable func-order, code-complexity */\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\nimport \"./WithSuperOperators.sol\";\nimport \"../interfaces/IERC721MandatoryTokenReceiver.sol\";\nimport \"./ERC2771Handler.sol\";\n\ncontract ERC721BaseToken is IERC721Upgradeable, WithSuperOperators, ERC2771Handler {\n using AddressUpgradeable for address;\n\n bytes4 internal constant _ERC721_RECEIVED = 0x150b7a02;\n bytes4 internal constant _ERC721_BATCH_RECEIVED = 0x4b808c46;\n\n bytes4 internal constant ERC165ID = 0x01ffc9a7;\n bytes4 internal constant ERC721_MANDATORY_RECEIVER = 0x5e8bf644;\n\n uint256 internal constant NOT_ADDRESS = 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000;\n uint256 internal constant OPERATOR_FLAG = (2**255);\n uint256 internal constant NOT_OPERATOR_FLAG = OPERATOR_FLAG - 1;\n uint256 internal constant BURNED_FLAG = (2**160);\n\n mapping(address => uint256) internal _numNFTPerAddress;\n mapping(uint256 => uint256) internal _owners;\n mapping(address => mapping(address => bool)) internal _operatorsForAll;\n mapping(uint256 => address) internal _operators;\n\n /// @notice Approve an operator to spend tokens on the senders behalf.\n /// @param operator The address receiving the approval.\n /// @param id The id of the token.\n function approve(address operator, uint256 id) external override {\n uint256 ownerData = _owners[_storageId(id)];\n address owner = _ownerOf(id);\n address msgSender = _msgSender();\n require(owner != address(0), \"NONEXISTENT_TOKEN\");\n require(\n owner == msgSender || _superOperators[msgSender] || _operatorsForAll[owner][msgSender],\n \"UNAUTHORIZED_APPROVAL\"\n );\n _approveFor(ownerData, operator, id);\n }\n\n /// @notice Approve an operator to spend tokens on the sender behalf.\n /// @param sender The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param id The id of the token.\n function approveFor(\n address sender,\n address operator,\n uint256 id\n ) external {\n uint256 ownerData = _owners[_storageId(id)];\n address owner = _ownerOf(id);\n address msgSender = _msgSender();\n require(sender != address(0), \"ZERO_ADDRESS_SENDER\");\n require(owner != address(0), \"NONEXISTENT_TOKEN\");\n require(\n msgSender == sender || _superOperators[msgSender] || _operatorsForAll[sender][msgSender],\n \"UNAUTHORIZED_APPROVAL\"\n );\n require(address(uint160(ownerData)) == sender, \"OWNER_NOT_SENDER\");\n _approveFor(ownerData, operator, id);\n }\n\n /// @notice Transfer a token between 2 addresses.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param id The id of the token.\n function transferFrom(\n address from,\n address to,\n uint256 id\n ) external override {\n _checkTransfer(from, to, id);\n _transferFrom(from, to, id);\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n require(_checkOnERC721Received(_msgSender(), from, to, id, \"\"), \"ERC721_TRANSFER_REJECTED\");\n }\n }\n\n /// @notice Transfer a token between 2 addresses letting the receiver know of the transfer.\n /// @param from The send of the token.\n /// @param to The recipient of the token.\n /// @param id The id of the token.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id\n ) external override {\n safeTransferFrom(from, to, id, \"\");\n }\n\n /// @notice Transfer many tokens between 2 addresses.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param ids The ids of the tokens.\n /// @param data Additional data.\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) public virtual {\n _batchTransferFrom(from, to, ids, data, false);\n }\n\n /// @notice Transfer many tokens between 2 addresses, while\n /// ensuring the receiving contract has a receiver method.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param ids The ids of the tokens.\n /// @param data Additional data.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external {\n _batchTransferFrom(from, to, ids, data, true);\n }\n\n /// @notice Set the approval for an operator to manage all the tokens of the sender.\n /// @param sender The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param approved The determination of the approval.\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) external {\n require(sender != address(0), \"Invalid sender address\");\n address msgSender = _msgSender();\n require(msgSender == sender || _superOperators[msgSender], \"UNAUTHORIZED_APPROVE_FOR_ALL\");\n\n _setApprovalForAll(sender, operator, approved);\n }\n\n /// @notice Set the approval for an operator to manage all the tokens of the sender.\n /// @param operator The address receiving the approval.\n /// @param approved The determination of the approval.\n function setApprovalForAll(address operator, bool approved) external override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /// @notice Burns token `id`.\n /// @param id The token which will be burnt.\n function burn(uint256 id) external virtual {\n _burn(_msgSender(), _ownerOf(id), id);\n }\n\n /// @notice Burn token`id` from `from`.\n /// @param from address whose token is to be burnt.\n /// @param id The token which will be burnt.\n function burnFrom(address from, uint256 id) external virtual {\n require(from != address(0), \"NOT_FROM_ZEROADDRESS\");\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n address msgSender = _msgSender();\n require(\n msgSender == from ||\n (operatorEnabled && _operators[id] == msgSender) ||\n _superOperators[msgSender] ||\n _operatorsForAll[from][msgSender],\n \"UNAUTHORIZED_BURN\"\n );\n _burn(from, owner, id);\n }\n\n /// @notice Get the number of tokens owned by an address.\n /// @param owner The address to look for.\n /// @return The number of tokens owned by the address.\n function balanceOf(address owner) external view override returns (uint256) {\n require(owner != address(0), \"ZERO_ADDRESS_OWNER\");\n return _numNFTPerAddress[owner];\n }\n\n /// @notice Get the owner of a token.\n /// @param id The id of the token.\n /// @return owner The address of the token owner.\n function ownerOf(uint256 id) external view override returns (address owner) {\n owner = _ownerOf(id);\n require(owner != address(0), \"NONEXISTANT_TOKEN\");\n }\n\n /// @notice Get the approved operator for a specific token.\n /// @param id The id of the token.\n /// @return The address of the operator.\n function getApproved(uint256 id) external view override returns (address) {\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(owner != address(0), \"NONEXISTENT_TOKEN\");\n if (operatorEnabled) {\n return _operators[id];\n } else {\n return address(0);\n }\n }\n\n /// @notice Check if the sender approved the operator.\n /// @param owner The address of the owner.\n /// @param operator The address of the operator.\n /// @return isOperator The status of the approval.\n function isApprovedForAll(address owner, address operator) external view override returns (bool isOperator) {\n return _operatorsForAll[owner][operator] || _superOperators[operator];\n }\n\n /// @notice Transfer a token between 2 addresses letting the receiver knows of the transfer.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param id The id of the token.\n /// @param data Additional data.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) public override {\n _checkTransfer(from, to, id);\n _transferFrom(from, to, id);\n if (to.isContract()) {\n require(_checkOnERC721Received(_msgSender(), from, to, id, data), \"ERC721_TRANSFER_REJECTED\");\n }\n }\n\n /// @notice Check if the contract supports an interface.\n /// 0x01ffc9a7 is ERC-165.\n /// 0x80ac58cd is ERC-721\n /// @param id The id of the interface.\n /// @return Whether the interface is supported.\n function supportsInterface(bytes4 id) public pure virtual override returns (bool) {\n return id == 0x01ffc9a7 || id == 0x80ac58cd;\n }\n\n /// @dev By overriding this function in an implementation which inherits this contract, you can enable versioned tokenIds without the extra overhead of writing to a new storage slot in _owners each time a version is incremented. See GameToken._storageId() for an example, where the storageId is the tokenId minus the version number.\n /// !!! Caution !!! Overriding this function without taking appropriate care could lead to\n /// ownerOf() returning an owner for non-existent tokens. Tests should be written to\n /// guard against introducing this bug.\n /// @param id The id of a token.\n /// @return The id used for storage mappings.\n function _storageId(uint256 id) internal view virtual returns (uint256) {\n return id;\n }\n\n function _updateOwnerData(\n uint256 id,\n uint256 oldData,\n address newOwner,\n bool hasOperator\n ) internal virtual {\n if (hasOperator) {\n _owners[_storageId(id)] = (oldData & NOT_ADDRESS) | OPERATOR_FLAG | uint256(uint160(newOwner));\n } else {\n _owners[_storageId(id)] = ((oldData & NOT_ADDRESS) & NOT_OPERATOR_FLAG) | uint256(uint160(newOwner));\n }\n }\n\n function _transferFrom(\n address from,\n address to,\n uint256 id\n ) internal {\n _numNFTPerAddress[from]--;\n _numNFTPerAddress[to]++;\n _updateOwnerData(id, _owners[_storageId(id)], to, false);\n emit Transfer(from, to, id);\n }\n\n /// @dev See approveFor.\n function _approveFor(\n uint256 ownerData,\n address operator,\n uint256 id\n ) internal {\n address owner = _ownerOf(id);\n if (operator == address(0)) {\n _updateOwnerData(id, ownerData, owner, false);\n } else {\n _updateOwnerData(id, ownerData, owner, true);\n _operators[id] = operator;\n }\n emit Approval(owner, operator, id);\n }\n\n /// @dev See batchTransferFrom.\n function _batchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n bytes memory data,\n bool safe\n ) internal {\n address msgSender = _msgSender();\n bool authorized = msgSender == from || _superOperators[msgSender] || _operatorsForAll[from][msgSender];\n\n require(from != address(0), \"NOT_FROM_ZEROADDRESS\");\n require(to != address(0), \"NOT_TO_ZEROADDRESS\");\n\n uint256 numTokens = ids.length;\n for (uint256 i = 0; i < numTokens; i++) {\n uint256 id = ids[i];\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(owner == from, \"BATCHTRANSFERFROM_NOT_OWNER\");\n require(authorized || (operatorEnabled && _operators[id] == msgSender), \"NOT_AUTHORIZED\");\n _updateOwnerData(id, _owners[_storageId(id)], to, false);\n emit Transfer(from, to, id);\n }\n if (from != to) {\n _numNFTPerAddress[from] -= numTokens;\n _numNFTPerAddress[to] += numTokens;\n }\n\n if (to.isContract()) {\n if (_checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n require(_checkOnERC721BatchReceived(msgSender, from, to, ids, data), \"ERC721_BATCH_RECEIVED_REJECTED\");\n } else if (safe) {\n for (uint256 i = 0; i < numTokens; i++) {\n require(_checkOnERC721Received(msgSender, from, to, ids[i], data), \"ERC721_RECEIVED_REJECTED\");\n }\n }\n }\n }\n\n /// @dev See setApprovalForAll.\n function _setApprovalForAll(\n address sender,\n address operator,\n bool approved\n ) internal {\n require(!_superOperators[operator], \"INVALID_APPROVAL_CHANGE\");\n _operatorsForAll[sender][operator] = approved;\n\n emit ApprovalForAll(sender, operator, approved);\n }\n\n /// @dev See burn.\n function _burn(\n address from,\n address owner,\n uint256 id\n ) internal {\n require(from == owner, \"NOT_OWNER\");\n uint256 storageId = _storageId(id);\n _owners[storageId] = (_owners[storageId] & NOT_OPERATOR_FLAG) | BURNED_FLAG; // record as non owner but keep track of last owner\n _numNFTPerAddress[from]--;\n emit Transfer(from, address(0), id);\n }\n\n /// @dev Check if receiving contract accepts erc721 transfers.\n /// @param operator The address of the operator.\n /// @param from The from address, may be different from msg.sender.\n /// @param to The adddress we want to transfer to.\n /// @param tokenId The id of the token we would like to transfer.\n /// @param _data Any additional data to send with the transfer.\n /// @return Whether the expected value of 0x150b7a02 is returned.\n function _checkOnERC721Received(\n address operator,\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal returns (bool) {\n bytes4 retval = IERC721ReceiverUpgradeable(to).onERC721Received(operator, from, tokenId, _data);\n return (retval == _ERC721_RECEIVED);\n }\n\n /// @dev Check if receiving contract accepts erc721 batch transfers.\n /// @param operator The address of the operator.\n /// @param from The from address, may be different from msg.sender.\n /// @param to The adddress we want to transfer to.\n /// @param ids The ids of the tokens we would like to transfer.\n /// @param _data Any additional data to send with the transfer.\n /// @return Whether the expected value of 0x4b808c46 is returned.\n function _checkOnERC721BatchReceived(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n bytes memory _data\n ) internal returns (bool) {\n bytes4 retval = IERC721MandatoryTokenReceiver(to).onERC721BatchReceived(operator, from, ids, _data);\n return (retval == _ERC721_BATCH_RECEIVED);\n }\n\n /// @dev See ownerOf\n function _ownerOf(uint256 id) internal view virtual returns (address) {\n uint256 data = _owners[_storageId(id)];\n if ((data & BURNED_FLAG) == BURNED_FLAG) {\n return address(0);\n }\n return address(uint160(data));\n }\n\n /// @dev Get the owner and operatorEnabled status of a token.\n /// @param id The token to query.\n /// @return owner The owner of the token.\n /// @return operatorEnabled Whether or not operators are enabled for this token.\n function _ownerAndOperatorEnabledOf(uint256 id)\n internal\n view\n virtual\n returns (address owner, bool operatorEnabled)\n {\n uint256 data = _owners[_storageId(id)];\n if ((data & BURNED_FLAG) == BURNED_FLAG) {\n owner = address(0);\n } else {\n owner = address(uint160(data));\n }\n operatorEnabled = (data & OPERATOR_FLAG) == OPERATOR_FLAG;\n }\n\n /// @dev Check whether a transfer is a meta Transaction or not.\n /// @param from The address who initiated the transfer (may differ from msg.sender).\n /// @param to The address recieving the token.\n /// @param id The token being transferred.\n /// @return isMetaTx Whether or not the transaction is a MetaTx.\n function _checkTransfer(\n address from,\n address to,\n uint256 id\n ) internal view returns (bool isMetaTx) {\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n address msgSender = _msgSender();\n require(owner != address(0), \"NONEXISTENT_TOKEN\");\n require(owner == from, \"CHECKTRANSFER_NOT_OWNER\");\n require(to != address(0), \"NOT_TO_ZEROADDRESS\");\n require(\n msgSender == owner ||\n _superOperators[msgSender] ||\n _operatorsForAll[from][msgSender] ||\n (operatorEnabled && _operators[id] == msgSender),\n \"UNAUTHORIZED_TRANSFER\"\n );\n return true;\n }\n\n /// @dev Check if there was enough gas.\n /// @param _contract The address of the contract to check.\n /// @param interfaceId The id of the interface we want to test.\n /// @return Whether or not this check succeeded.\n function _checkInterfaceWith10000Gas(address _contract, bytes4 interfaceId) internal view returns (bool) {\n bool success;\n bool result;\n bytes memory callData = abi.encodeWithSelector(ERC165ID, interfaceId);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let call_ptr := add(0x20, callData)\n let call_size := mload(callData)\n let output := mload(0x40) // Find empty storage location using \"free memory pointer\"\n mstore(output, 0x0)\n success := staticcall(10000, _contract, call_ptr, call_size, output, 0x20) // 32 bytes\n result := mload(output)\n }\n // (10000 / 63) \"not enough for supportsInterface(...)\" // consume all gas, so caller can potentially know that there was not enough gas\n assert(gasleft() > 158);\n return success && result;\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC721BaseTokenV2.sol": { + "content": "//SPDX-License-Identifier: MIT\n/* solhint-disable func-order, code-complexity */\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport {AddressUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport {\n IERC721ReceiverUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\";\nimport {IERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\nimport {WithSuperOperatorsV2} from \"./WithSuperOperatorsV2.sol\";\nimport {IERC721MandatoryTokenReceiver} from \"../interfaces/IERC721MandatoryTokenReceiver.sol\";\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\n/// @title ERC721BaseTokenV2\n/// @author The Sandbox\n/// @notice Basic functionalities of a NFT\n/// @dev ERC721 implementation that supports meta-transactions and super operators\ncontract ERC721BaseTokenV2 is ContextUpgradeable, IERC721Upgradeable, WithSuperOperatorsV2 {\n using AddressUpgradeable for address;\n\n bytes4 internal constant _ERC721_RECEIVED = 0x150b7a02;\n bytes4 internal constant _ERC721_BATCH_RECEIVED = 0x4b808c46;\n\n bytes4 internal constant ERC165ID = 0x01ffc9a7;\n bytes4 internal constant ERC721_MANDATORY_RECEIVER = 0x5e8bf644;\n\n uint256 internal constant NOT_ADDRESS = 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000;\n uint256 internal constant OPERATOR_FLAG = (2**255);\n uint256 internal constant NOT_OPERATOR_FLAG = OPERATOR_FLAG - 1;\n uint256 internal constant BURNED_FLAG = (2**160);\n\n mapping(address => uint256) internal _numNFTPerAddress;\n /**\n * @dev mapping to store owner of lands and quads.\n * For 1x1 lands it also the 255 bit is 1 if that land has operator approved and is 0 if no operator is approved.\n * For burned 1x1 Land 160 bit is set to 1.\n */\n mapping(uint256 => uint256) internal _owners;\n mapping(address => mapping(address => bool)) internal _operatorsForAll;\n mapping(uint256 => address) internal _operators;\n\n /// @notice Approve an operator to spend tokens on the senders behalf.\n /// @param operator The address receiving the approval.\n /// @param id The id of the token.\n function approve(address operator, uint256 id) public virtual override {\n uint256 ownerData = _owners[_storageId(id)];\n address owner = _ownerOf(id);\n address msgSender = _msgSender();\n require(owner != address(0), \"NONEXISTENT_TOKEN\");\n require(\n owner == msgSender || _operatorsForAll[owner][msgSender] || _superOperators[msgSender],\n \"UNAUTHORIZED_APPROVAL\"\n );\n _approveFor(ownerData, operator, id);\n }\n\n /// @notice Approve an operator to spend tokens on the sender behalf.\n /// @param sender The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param id The id of the token.\n function approveFor(\n address sender,\n address operator,\n uint256 id\n ) public virtual {\n uint256 ownerData = _owners[_storageId(id)];\n address owner = _ownerOf(id);\n address msgSender = _msgSender();\n require(sender != address(0), \"ZERO_ADDRESS_SENDER\");\n require(owner != address(0), \"NONEXISTENT_TOKEN\");\n require(\n msgSender == sender || _operatorsForAll[sender][msgSender] || _superOperators[msgSender],\n \"UNAUTHORIZED_APPROVAL\"\n );\n require(address(uint160(ownerData)) == sender, \"OWNER_NOT_SENDER\");\n _approveFor(ownerData, operator, id);\n }\n\n /// @notice Transfer a token between 2 addresses.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param id The id of the token.\n function transferFrom(\n address from,\n address to,\n uint256 id\n ) public virtual override {\n _checkTransfer(from, to, id);\n _transferFrom(from, to, id);\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n require(_checkOnERC721Received(_msgSender(), from, to, id, \"\"), \"ERC721_TRANSFER_REJECTED\");\n }\n }\n\n /// @notice Transfer a token between 2 addresses letting the receiver know of the transfer.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param id The id of the token.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id\n ) public virtual override {\n safeTransferFrom(from, to, id, \"\");\n }\n\n /// @notice Transfer many tokens between 2 addresses.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param ids The ids of the tokens.\n /// @param data Additional data.\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) public virtual {\n _batchTransferFrom(from, to, ids, data, false);\n }\n\n /// @notice Transfer many tokens between 2 addresses, while\n /// ensuring the receiving contract has a receiver method.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param ids The ids of the tokens.\n /// @param data Additional data.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external virtual {\n _batchTransferFrom(from, to, ids, data, true);\n }\n\n /// @notice Set the approval for an operator to manage all the tokens of the sender.\n /// @param sender The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param approved The determination of the approval.\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) public virtual {\n require(sender != address(0), \"Invalid sender address\");\n address msgSender = _msgSender();\n require(msgSender == sender || _superOperators[msgSender], \"UNAUTHORIZED_APPROVE_FOR_ALL\");\n\n _setApprovalForAll(sender, operator, approved);\n }\n\n /// @notice Set the approval for an operator to manage all the tokens of the sender.\n /// @param operator The address receiving the approval.\n /// @param approved The determination of the approval.\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /// @notice Burns token `id`.\n /// @param id The token which will be burnt.\n function burn(uint256 id) external virtual {\n _burn(_msgSender(), _ownerOf(id), id);\n }\n\n /// @notice Burn token `id` from `from`.\n /// @param from address whose token is to be burnt.\n /// @param id The token which will be burnt.\n function burnFrom(address from, uint256 id) external virtual {\n require(from != address(0), \"NOT_FROM_ZEROADDRESS\");\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n address msgSender = _msgSender();\n require(\n msgSender == from ||\n (operatorEnabled && _operators[id] == msgSender) ||\n _superOperators[msgSender] ||\n _operatorsForAll[from][msgSender],\n \"UNAUTHORIZED_BURN\"\n );\n _burn(from, owner, id);\n }\n\n /// @notice Get the number of tokens owned by an address.\n /// @param owner The address to look for.\n /// @return The number of tokens owned by the address.\n function balanceOf(address owner) external view override returns (uint256) {\n require(owner != address(0), \"ZERO_ADDRESS_OWNER\");\n return _numNFTPerAddress[owner];\n }\n\n /// @notice Get the owner of a token.\n /// @param id The id of the token.\n /// @return owner The address of the token owner.\n function ownerOf(uint256 id) external view override returns (address owner) {\n owner = _ownerOf(id);\n require(owner != address(0), \"NONEXISTANT_TOKEN\");\n }\n\n /// @notice Get the approved operator for a specific token.\n /// @param id The id of the token.\n /// @return The address of the operator.\n function getApproved(uint256 id) external view override returns (address) {\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(owner != address(0), \"NONEXISTENT_TOKEN\");\n if (operatorEnabled) {\n return _operators[id];\n } else {\n return address(0);\n }\n }\n\n /// @notice Check if the sender approved the operator.\n /// @param owner The address of the owner.\n /// @param operator The address of the operator.\n /// @return isOperator The status of the approval.\n function isApprovedForAll(address owner, address operator) external view override returns (bool) {\n return _operatorsForAll[owner][operator] || _superOperators[operator];\n }\n\n /// @notice Transfer a token between 2 addresses letting the receiver knows of the transfer.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param id The id of the token.\n /// @param data Additional data.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) public virtual override {\n _checkTransfer(from, to, id);\n _transferFrom(from, to, id);\n if (to.isContract()) {\n require(_checkOnERC721Received(_msgSender(), from, to, id, data), \"ERC721_TRANSFER_REJECTED\");\n }\n }\n\n /// @notice Check if the contract supports an interface.\n /// 0x01ffc9a7 is ERC-165.\n /// 0x80ac58cd is ERC-721\n /// @param id The id of the interface.\n /// @return Whether the interface is supported.\n function supportsInterface(bytes4 id) public pure virtual override returns (bool) {\n return id == 0x01ffc9a7 || id == 0x80ac58cd;\n }\n\n /// @dev By overriding this function in an implementation which inherits this contract,\n /// you can enable versioned tokenIds without the extra overhead of writing to a new storage slot in _owners each time a version is incremented.\n /// See GameToken._storageId() for an example, where the storageId is the tokenId minus the version number.\n /// !!! Caution !!! Overriding this function without taking appropriate care could lead to\n /// ownerOf() returning an owner for non-existent tokens. Tests should be written to\n /// guard against introducing this bug.\n /// @param id The id of a token.\n /// @return The id used for storage mappings.\n function _storageId(uint256 id) internal view virtual returns (uint256) {\n return id;\n }\n\n function _updateOwnerData(\n uint256 id,\n uint256 oldData,\n address newOwner,\n bool hasOperator\n ) internal virtual {\n if (hasOperator) {\n _owners[_storageId(id)] = (oldData & NOT_ADDRESS) | OPERATOR_FLAG | uint256(uint160(newOwner));\n } else {\n _owners[_storageId(id)] = ((oldData & NOT_ADDRESS) & NOT_OPERATOR_FLAG) | uint256(uint160(newOwner));\n }\n }\n\n function _transferFrom(\n address from,\n address to,\n uint256 id\n ) internal {\n _numNFTPerAddress[from]--;\n _numNFTPerAddress[to]++;\n _updateOwnerData(id, _owners[_storageId(id)], to, false);\n emit Transfer(from, to, id);\n }\n\n /// @dev See approveFor.\n function _approveFor(\n uint256 ownerData,\n address operator,\n uint256 id\n ) internal {\n address owner = _ownerOf(id);\n if (operator == address(0)) {\n _updateOwnerData(id, ownerData, owner, false);\n } else {\n _updateOwnerData(id, ownerData, owner, true);\n _operators[id] = operator;\n }\n emit Approval(owner, operator, id);\n }\n\n /// @dev See batchTransferFrom.\n function _batchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n bytes memory data,\n bool safe\n ) internal {\n address msgSender = _msgSender();\n bool authorized = msgSender == from || _operatorsForAll[from][msgSender] || _superOperators[msgSender];\n\n require(from != address(0), \"NOT_FROM_ZEROADDRESS\");\n require(to != address(0), \"NOT_TO_ZEROADDRESS\");\n\n uint256 numTokens = ids.length;\n for (uint256 i = 0; i < numTokens; i++) {\n uint256 id = ids[i];\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(owner == from, \"BATCHTRANSFERFROM_NOT_OWNER\");\n require(authorized || (operatorEnabled && _operators[id] == msgSender), \"NOT_AUTHORIZED\");\n _updateOwnerData(id, _owners[_storageId(id)], to, false);\n emit Transfer(from, to, id);\n }\n if (from != to) {\n _numNFTPerAddress[from] -= numTokens;\n _numNFTPerAddress[to] += numTokens;\n }\n\n if (to.isContract()) {\n if (_checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n require(_checkOnERC721BatchReceived(msgSender, from, to, ids, data), \"ERC721_BATCH_RECEIVED_REJECTED\");\n } else if (safe) {\n for (uint256 i = 0; i < numTokens; i++) {\n require(_checkOnERC721Received(msgSender, from, to, ids[i], data), \"ERC721_RECEIVED_REJECTED\");\n }\n }\n }\n }\n\n /// @dev See setApprovalForAll.\n function _setApprovalForAll(\n address sender,\n address operator,\n bool approved\n ) internal {\n require(!_superOperators[operator], \"INVALID_APPROVAL_CHANGE\");\n _operatorsForAll[sender][operator] = approved;\n\n emit ApprovalForAll(sender, operator, approved);\n }\n\n /// @dev See burn.\n function _burn(\n address from,\n address owner,\n uint256 id\n ) internal {\n require(from == owner, \"NOT_OWNER\");\n uint256 storageId = _storageId(id);\n _owners[storageId] = (_owners[storageId] & NOT_OPERATOR_FLAG) | BURNED_FLAG; // record as non owner but keep track of last owner\n _numNFTPerAddress[from]--;\n emit Transfer(from, address(0), id);\n }\n\n /// @dev Check if receiving contract accepts erc721 transfers.\n /// @param operator The address of the operator.\n /// @param from The from address, may be different from msg.sender.\n /// @param to The address we want to transfer to.\n /// @param tokenId The id of the token we would like to transfer.\n /// @param _data Any additional data to send with the transfer.\n /// @return Whether the expected value of 0x150b7a02 is returned.\n function _checkOnERC721Received(\n address operator,\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal returns (bool) {\n bytes4 retval = IERC721ReceiverUpgradeable(to).onERC721Received(operator, from, tokenId, _data);\n return (retval == _ERC721_RECEIVED);\n }\n\n /// @dev Check if receiving contract accepts erc721 batch transfers.\n /// @param operator The address of the operator.\n /// @param from The from address, may be different from msg.sender.\n /// @param to The address we want to transfer to.\n /// @param ids The ids of the tokens we would like to transfer.\n /// @param _data Any additional data to send with the transfer.\n /// @return Whether the expected value of 0x4b808c46 is returned.\n function _checkOnERC721BatchReceived(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n bytes memory _data\n ) internal returns (bool) {\n bytes4 retval = IERC721MandatoryTokenReceiver(to).onERC721BatchReceived(operator, from, ids, _data);\n return (retval == _ERC721_BATCH_RECEIVED);\n }\n\n /// @dev See ownerOf\n function _ownerOf(uint256 id) internal view virtual returns (address) {\n uint256 data = _owners[_storageId(id)];\n if ((data & BURNED_FLAG) == BURNED_FLAG) {\n return address(0);\n }\n return address(uint160(data));\n }\n\n /// @dev Get the owner and operatorEnabled status of a token.\n /// @param id The token to query.\n /// @return owner The owner of the token.\n /// @return operatorEnabled Whether or not operators are enabled for this token.\n function _ownerAndOperatorEnabledOf(uint256 id)\n internal\n view\n virtual\n returns (address owner, bool operatorEnabled)\n {\n uint256 data = _owners[_storageId(id)];\n if ((data & BURNED_FLAG) == BURNED_FLAG) {\n owner = address(0);\n } else {\n owner = address(uint160(data));\n }\n operatorEnabled = (data & OPERATOR_FLAG) == OPERATOR_FLAG;\n }\n\n /// @dev Check whether a transfer is a meta Transaction or not.\n /// @param from The address who initiated the transfer (may differ from msg.sender).\n /// @param to The address receiving the token.\n /// @param id The token being transferred.\n function _checkTransfer(\n address from,\n address to,\n uint256 id\n ) internal view {\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n address msgSender = _msgSender();\n require(owner != address(0), \"NONEXISTENT_TOKEN\");\n require(owner == from, \"CHECKTRANSFER_NOT_OWNER\");\n require(to != address(0), \"NOT_TO_ZEROADDRESS\");\n require(\n msgSender == owner ||\n _superOperators[msgSender] ||\n _operatorsForAll[from][msgSender] ||\n (operatorEnabled && _operators[id] == msgSender),\n \"UNAUTHORIZED_TRANSFER\"\n );\n }\n\n /// @dev Check if there was enough gas.\n /// @param _contract The address of the contract to check.\n /// @param interfaceId The id of the interface we want to test.\n /// @return Whether or not this check succeeded.\n function _checkInterfaceWith10000Gas(address _contract, bytes4 interfaceId) internal view returns (bool) {\n bool success;\n bool result;\n bytes memory callData = abi.encodeWithSelector(ERC165ID, interfaceId);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let call_ptr := add(0x20, callData)\n let call_size := mload(callData)\n let output := mload(0x40) // Find empty storage location using \"free memory pointer\"\n mstore(output, 0x0)\n success := staticcall(10000, _contract, call_ptr, call_size, output, 0x20) // 32 bytes\n result := mload(output)\n }\n // (10000 / 63) \"not enough for supportsInterface(...)\" // consume all gas, so caller can potentially know that there was not enough gas\n assert(gasleft() > 158);\n return success && result;\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ImmutableERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../BaseWithStorage/ERC721BaseToken.sol\";\n\ncontract ImmutableERC721 is ERC721BaseToken {\n uint256 internal constant CREATOR_OFFSET_MULTIPLIER = uint256(2)**(256 - 160);\n uint256 internal constant SUBID_MULTIPLIER = uint256(2)**(256 - 224);\n uint256 internal constant CHAIN_INDEX_OFFSET_MULTIPLIER = uint256(2)**(256 - 160 - 64 - 16);\n uint256 internal constant STORAGE_ID_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000;\n uint256 internal constant VERSION_MASK = 0x000000FFFFFFFF00000000000000000000000000000000000000000000000000;\n uint256 internal constant CHAIN_INDEX_MASK = 0x0000000000000000000000000000000000000000000000000000000000FF0000;\n bytes32 internal constant base32Alphabet = 0x6162636465666768696A6B6C6D6E6F707172737475767778797A323334353637;\n\n uint8 internal _chainIndex;\n\n function __ImmutableERC721_initialize(uint8 index) internal {\n _chainIndex = index;\n }\n\n /// @dev get the layer a token was minted on from its id.\n /// @param id The id of the token to query.\n /// @return The index of the original layer of minting.\n /// 0 = eth mainnet, 1 == Polygon, etc...\n function getChainIndex(uint256 id) public pure virtual returns (uint256) {\n return uint256((id & CHAIN_INDEX_MASK) >> 16);\n }\n\n /// @dev An implementation which handles versioned tokenIds.\n /// @param id The tokenId to get the owner of.\n /// @return The address of the owner.\n function _ownerOf(uint256 id) internal view virtual override returns (address) {\n uint256 packedData = _owners[_storageId(id)];\n uint16 idVersion = uint16(id);\n uint16 storageVersion = uint16((packedData & VERSION_MASK) >> 200);\n if (((packedData & BURNED_FLAG) == BURNED_FLAG) || idVersion != storageVersion) {\n return address(0);\n }\n return address(uint160(packedData));\n }\n\n /// @dev Check if a withdrawal is allowed.\n /// @param from The address requesting the withdrawal.\n /// @param gameId The id of the GAME token to withdraw assets from.\n function _check_withdrawal_authorized(address from, uint256 gameId) internal view virtual {\n require(from != address(0), \"SENDER_ZERO_ADDRESS\");\n require(from == _withdrawalOwnerOf(gameId), \"LAST_OWNER_NOT_EQUAL_SENDER\");\n }\n\n /// @dev Get the address allowed to withdraw associated tokens from the parent token.\n /// If too many associated tokens in TOKEN, block.gaslimit won't allow detroy and withdraw in 1 tx.\n /// An owner may destroy their token, then withdraw associated tokens in a later tx (even\n /// though ownerOf(id) would be address(0) after burning.)\n /// @param id The id of the token to query.\n /// @return the address of the owner before burning.\n function _withdrawalOwnerOf(uint256 id) internal view virtual returns (address) {\n uint256 packedData = _owners[_storageId(id)];\n return address(uint160(packedData));\n }\n\n /// @notice Get the storageID (no chainIndex or version data), which is constant for a given token.\n /// @param tokenId The tokenId for which to find the first token Id.\n /// @return The storage id for this token.\n function getStorageId(uint256 tokenId) external pure virtual returns (uint256) {\n return _storageId(tokenId);\n }\n\n /// @dev Get the storageId (full id without the version number) from the full tokenId.\n /// @param id The full tokenId for the GAME token.\n /// @return The storageId.\n function _storageId(uint256 id) internal pure virtual override returns (uint256) {\n return uint256(id & STORAGE_ID_MASK);\n }\n\n /// @dev Get the a full URI string for a given hash + gameId.\n /// @param hash The 32 byte IPFS hash.\n /// @return The URI string.\n function _toFullURI(bytes32 hash) internal pure virtual returns (string memory) {\n return string(abi.encodePacked(\"ipfs://bafybei\", hash2base32(hash), \"/\", \"token.json\"));\n }\n\n /// @dev Create a new tokenId and associate it with an owner.\n /// This is a packed id, consisting of 4 parts:\n /// the creator's address, a uint64 subId, a uint18 chainIndex and a uint16 version.\n /// @param creator The address of the Token creator.\n /// @param subId The id used to generate the id.\n /// @param version The publicversion used to generate the id.\n function _generateTokenId(\n address creator,\n uint64 subId,\n uint8 chainIndex,\n uint16 version\n ) internal pure returns (uint256) {\n return\n uint256(uint160(creator)) *\n CREATOR_OFFSET_MULTIPLIER +\n subId *\n SUBID_MULTIPLIER +\n chainIndex *\n CHAIN_INDEX_OFFSET_MULTIPLIER +\n version;\n }\n\n /// @dev Convert a 32 byte hash to a base 32 string.\n /// @param hash A 32 byte (IPFS) hash.\n /// @return _uintAsString The hash as a base 32 string.\n // solhint-disable-next-line security/no-assign-params\n function hash2base32(bytes32 hash) internal pure returns (string memory _uintAsString) {\n uint256 _i = uint256(hash);\n uint256 k = 52;\n bytes memory bstr = new bytes(k);\n bstr[--k] = base32Alphabet[uint8((_i % 8) << 2)]; // uint8 s = uint8((256 - skip) % 5); // (_i % (2**s)) << (5-s)\n _i /= 8;\n while (k > 0) {\n bstr[--k] = base32Alphabet[_i % 32];\n _i /= 32;\n }\n return string(bstr);\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/MetaTransactionReceiver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./WithAdmin.sol\";\n\ncontract MetaTransactionReceiver is WithAdmin {\n mapping(address => bool) internal _metaTransactionContracts;\n event MetaTransactionProcessor(address metaTransactionProcessor, bool enabled);\n\n /// @notice Enable or disable the ability of `metaTransactionProcessor` to perform meta-tx (metaTransactionProcessor rights).\n /// @param metaTransactionProcessor address that will be given/removed metaTransactionProcessor rights.\n /// @param enabled set whether the metaTransactionProcessor is enabled or disabled.\n function setMetaTransactionProcessor(address metaTransactionProcessor, bool enabled) external {\n require(msg.sender == _admin, \"only admin can setup metaTransactionProcessors\");\n _setMetaTransactionProcessor(metaTransactionProcessor, enabled);\n }\n\n function _setMetaTransactionProcessor(address metaTransactionProcessor, bool enabled) internal {\n _metaTransactionContracts[metaTransactionProcessor] = enabled;\n emit MetaTransactionProcessor(metaTransactionProcessor, enabled);\n }\n\n /// @notice check whether address `who` is given meta-transaction execution rights.\n /// @param who The address to query.\n /// @return whether the address has meta-transaction execution rights.\n function isMetaTransactionProcessor(address who) external view returns (bool) {\n return _metaTransactionContracts[who];\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/WithAdmin.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\ncontract WithAdmin {\n address internal _admin;\n\n /// @dev Emits when the contract administrator is changed.\n /// @param oldAdmin The address of the previous administrator.\n /// @param newAdmin The address of the new administrator.\n event AdminChanged(address indexed oldAdmin, address indexed newAdmin);\n\n modifier onlyAdmin() {\n require(msg.sender == _admin, \"ADMIN_ONLY\");\n _;\n }\n\n /// @dev Get the current administrator of this contract.\n /// @return The current administrator of this contract.\n function getAdmin() external view returns (address) {\n return _admin;\n }\n\n /// @dev Change the administrator to be `newAdmin`.\n /// @param newAdmin The address of the new administrator.\n function changeAdmin(address newAdmin) external {\n require(msg.sender == _admin, \"ADMIN_ACCESS_DENIED\");\n emit AdminChanged(_admin, newAdmin);\n _admin = newAdmin;\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/WithAdminV2.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\n/// @title WithAdminV2\n/// @author The Sandbox\n/// @notice Add an admin to the contract\ncontract WithAdminV2 is ContextUpgradeable {\n address internal _admin;\n\n /// @dev Emits when the contract administrator is changed.\n /// @param oldAdmin The address of the previous administrator.\n /// @param newAdmin The address of the new administrator.\n event AdminChanged(address indexed oldAdmin, address indexed newAdmin);\n\n modifier onlyAdmin() {\n require(_msgSender() == _admin, \"ADMIN_ONLY\");\n _;\n }\n\n /// @notice Get the current admin\n /// @dev Get the current administrator of this contract.\n /// @return The current administrator of this contract.\n function getAdmin() external view returns (address) {\n return _admin;\n }\n\n /// @notice Change the admin of the contract\n /// @dev Change the administrator to be `newAdmin`.\n /// @param newAdmin The address of the new administrator.\n function changeAdmin(address newAdmin) external {\n address admin = _admin;\n require(_msgSender() == admin, \"ADMIN_ACCESS_DENIED\");\n emit AdminChanged(admin, newAdmin);\n _admin = newAdmin;\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/WithMinter.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"./WithAdmin.sol\";\n\ncontract WithMinter is WithAdmin {\n address internal _minter;\n\n /// @dev Emits when the Minter address is changed\n /// @param oldMinter The previous Minter address\n /// @param newMinter The new Minter address\n event MinterChanged(address oldMinter, address newMinter);\n\n modifier onlyMinter() {\n require(msg.sender == _minter, \"MINTER_ACCESS_DENIED\");\n _;\n }\n\n /// @dev Get the current minter of this contract.\n /// @return The current minter of this contract.\n function getMinter() external view returns (address) {\n return _minter;\n }\n\n /// @dev Change the minter to be `newMinter`.\n /// @param newMinter The address of the new minter.\n function changeMinter(address newMinter) external onlyAdmin() {\n emit MinterChanged(_minter, newMinter);\n _minter = newMinter;\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/WithPermit.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC20/extensions/draft-IERC20Permit.sol\";\nimport \"../../common/interfaces/IERC20Extended.sol\";\nimport \"../../common/Base/TheSandbox712.sol\";\n\n/// @title Permit contract\n/// @notice This contract manages approvals of SAND via signature\nabstract contract WithPermit is TheSandbox712, IERC20Permit {\n mapping(address => uint256) public _nonces;\n\n bytes32 public constant PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n\n /// @notice Function to permit the expenditure of ERC20 token by a nominated spender\n /// @param owner The owner of the ERC20 tokens\n /// @param spender The nominated spender of the ERC20 tokens\n /// @param value The value (allowance) of the ERC20 tokens that the nominated spender will be allowed to spend\n /// @param deadline The deadline for granting permission to the spender\n /// @param v The final 1 byte of signature\n /// @param r The first 32 bytes of signature\n /// @param s The second 32 bytes of signature\n function checkApproveFor(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public {\n require(deadline >= block.timestamp, \"PAST_DEADLINE\");\n bytes32 digest =\n keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n _DOMAIN_SEPARATOR,\n keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, _nonces[owner]++, deadline))\n )\n );\n address recoveredAddress = ecrecover(digest, v, r, s);\n require(recoveredAddress != address(0) && recoveredAddress == owner, \"INVALID_SIGNATURE\");\n }\n\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _DOMAIN_SEPARATOR;\n }\n\n function nonces(address owner) external view override returns (uint256) {\n return _nonces[owner];\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/WithPermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\";\n\nabstract contract WithPermitUpgradeable is EIP712Upgradeable, IERC20PermitUpgradeable {\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n mapping(address => CountersUpgradeable.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 public constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n\n function __WithPermitUpgradeable_init(string memory name) internal onlyInitializing {\n __EIP712_init_unchained(name, \"1\");\n }\n\n /// @notice Function to permit the expenditure of ERC20 token by a nominated spender\n /// @param owner The owner of the ERC20 tokens\n /// @param spender The nominated spender of the ERC20 tokens\n /// @param value The value (allowance) of the ERC20 tokens that the nominated spender will be allowed to spend\n /// @param deadline The deadline for granting permission to the spender\n /// @param v The final 1 byte of signature\n /// @param r The first 32 bytes of signature\n /// @param s The second 32 bytes of signature\n function checkApproveFor(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public {\n require(block.timestamp <= deadline, \"PAST_DEADLINE\");\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n bytes32 hash = _hashTypedDataV4(structHash);\n address signer = ECDSAUpgradeable.recover(hash, v, r, s);\n require(signer == owner, \"INVALID_SIGNATURE\");\n }\n\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n function nonces(address owner) external view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n CountersUpgradeable.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n\n uint256[49] private __gap;\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/WithSuperOperators.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"./WithAdmin.sol\";\n\ncontract WithSuperOperators is WithAdmin {\n mapping(address => bool) internal _superOperators;\n\n event SuperOperator(address indexed superOperator, bool indexed enabled);\n\n /// @notice Enable or disable the ability of `superOperator` to transfer tokens of all (superOperator rights).\n /// @param superOperator address that will be given/removed superOperator right.\n /// @param enabled set whether the superOperator is enabled or disabled.\n function setSuperOperator(address superOperator, bool enabled) external {\n require(msg.sender == _admin, \"only admin is allowed to add super operators\");\n _superOperators[superOperator] = enabled;\n emit SuperOperator(superOperator, enabled);\n }\n\n /// @notice check whether address `who` is given superOperator rights.\n /// @param who The address to query.\n /// @return whether the address has superOperator rights.\n function isSuperOperator(address who) public view returns (bool) {\n return _superOperators[who];\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/WithSuperOperatorsV2.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport {WithAdminV2} from \"./WithAdminV2.sol\";\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\n/// @title WithSuperOperatorsV2\n/// @author The Sandbox\n/// @notice Add super operators handled by an admin\ncontract WithSuperOperatorsV2 is ContextUpgradeable, WithAdminV2 {\n mapping(address => bool) internal _superOperators;\n\n event SuperOperator(address indexed superOperator, bool indexed enabled);\n\n /// @notice Enable or disable the ability of `superOperator` to transfer tokens of all (superOperator rights).\n /// @param superOperator address that will be given/removed superOperator right.\n /// @param enabled set whether the superOperator is enabled or disabled.\n function setSuperOperator(address superOperator, bool enabled) external onlyAdmin {\n require(_msgSender() == _admin, \"only admin is allowed to add super operators\");\n _superOperators[superOperator] = enabled;\n emit SuperOperator(superOperator, enabled);\n }\n\n /// @notice check whether address `who` is given superOperator rights.\n /// @param who The address to query.\n /// @return whether the address has superOperator rights.\n function isSuperOperator(address who) public view returns (bool) {\n return _superOperators[who];\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/WithUpgrader.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./WithAdmin.sol\";\n\ncontract WithUpgrader is WithAdmin {\n address internal _upgrader;\n\n /// @dev Emits when the Upgrader address is changed\n /// @param oldUpgrader The previous Upgrader address\n /// @param newUpgrader The new Upgrader address\n event UpgraderChanged(address oldUpgrader, address newUpgrader);\n\n modifier onlyUpgrader() {\n require(msg.sender == _upgrader, \"UPGRADER_ACCESS_DENIED\");\n _;\n }\n\n /// @dev Get the current upgrader of this contract.\n /// @return The current upgrader of this contract.\n function getUpgrader() external view returns (address) {\n return _upgrader;\n }\n\n /// @dev Change the upgrader to be `newUpgrader`.\n /// @param newUpgrader The address of the new upgrader.\n function changeUpgrader(address newUpgrader) external onlyAdmin() {\n emit UpgraderChanged(_upgrader, newUpgrader);\n _upgrader = newUpgrader;\n }\n}\n" + }, + "src/solc_0.8/common/fx-portal/FxBaseChildTunnelUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {FxBaseChildTunnel} from \"@maticnetwork/fx-portal/contracts/tunnel/FxBaseChildTunnel.sol\";\n\n/**\n * @title FxBaseChildTunnelUpgradeable\n * @author The Sandbox\n * @dev Upgradeable version of the fx-portal tunnel for the child chain\n */\nabstract contract FxBaseChildTunnelUpgradeable is FxBaseChildTunnel {\n // solhint-disable-next-line no-empty-blocks\n constructor() FxBaseChildTunnel(address(0)) {}\n\n /**\n * @dev Initializes the contract\n * @param _fxChild fx child\n */\n function __FxBaseChildTunnelUpgradeable_initialize(address _fxChild) internal {\n fxChild = _fxChild;\n }\n\n uint256[50] private __gap;\n}\n" + }, + "src/solc_0.8/common/fx-portal/FxBaseRootTunnelUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {\n FxBaseRootTunnel,\n ICheckpointManager,\n IFxStateSender\n} from \"@maticnetwork/fx-portal/contracts/tunnel/FxBaseRootTunnel.sol\";\n\n/**\n * @title FxBaseRootTunnelUpgradeable\n * @author The Sandbox\n * @dev Upgradeable version of the fx-portal tunnel for the root chain\n */\nabstract contract FxBaseRootTunnelUpgradeable is FxBaseRootTunnel {\n // solhint-disable-next-line no-empty-blocks\n constructor() FxBaseRootTunnel(address(0), address(0)) {}\n\n /**\n * @dev Initializes the contract\n * @param _checkpointManager checkpoint manager address\n * @param _fxRoot state sender contract\n */\n function __FxBaseRootTunnelUpgradeable_initialize(address _checkpointManager, address _fxRoot) internal {\n checkpointManager = ICheckpointManager(_checkpointManager);\n fxRoot = IFxStateSender(_fxRoot);\n }\n\n uint256[50] private __gap;\n}\n" + }, + "src/solc_0.8/common/interfaces/ERC1271.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface ERC1271 {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param data Arbitrary length data signed on the behalf of address(this)\n * @param signature Signature byte array associated with _data\n *\n * MUST return the bytes4 magic value 0x20c13b0b when function passes.\n * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5)\n * MUST allow external calls\n */\n function isValidSignature(bytes memory data, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" + }, + "src/solc_0.8/common/interfaces/ERC1271Constants.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ncontract ERC1271Constants {\n bytes4 internal constant ERC1271_MAGICVALUE = 0x20c13b0b;\n}\n" + }, + "src/solc_0.8/common/interfaces/ERC1654.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface ERC1654 {\n /**\n * @dev Should return whether the signature provided is valid for the provided hash\n * @param hash 32 bytes hash to be signed\n * @param signature Signature byte array associated with hash\n * @return magicValue - 0x1626ba7e if valid else 0x00000000\n */\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" + }, + "src/solc_0.8/common/interfaces/ERC1654Constants.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ncontract ERC1654Constants {\n bytes4 internal constant ERC1654_MAGICVALUE = 0x1626ba7e;\n}\n" + }, + "src/solc_0.8/common/interfaces/IAssetAttributesRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\npragma experimental ABIEncoderV2;\n\ninterface IAssetAttributesRegistry {\n struct GemEvent {\n uint16[] gemIds;\n bytes32 blockHash;\n }\n\n struct AssetGemsCatalystData {\n uint256 assetId;\n uint16 catalystContractId;\n uint16[] gemContractIds;\n }\n\n function getRecord(uint256 assetId)\n external\n view\n returns (\n bool exists,\n uint16 catalystId,\n uint16[] memory gemIds\n );\n\n function getAttributes(uint256 assetId, GemEvent[] calldata events) external view returns (uint32[] memory values);\n\n function setCatalyst(\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds\n ) external;\n\n function setCatalystWhenDepositOnOtherLayer(\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds\n ) external;\n\n function setCatalystWithBlockNumber(\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds,\n uint64 blockNumber\n ) external;\n\n function addGems(uint256 assetId, uint16[] calldata gemIds) external;\n\n function setMigrationContract(address _migrationContract) external;\n\n function getCatalystRegistry() external view returns (address);\n}\n" + }, + "src/solc_0.8/common/interfaces/IAssetERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IAssetERC721} from \"./IAssetERC721.sol\";\n\ninterface IAssetERC1155 {\n function changeBouncerAdmin(address newBouncerAdmin) external;\n\n function setBouncer(address bouncer, bool enabled) external;\n\n function setPredicate(address predicate) external;\n\n function mint(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256 supply,\n uint8 rarity,\n address owner,\n bytes calldata data\n ) external returns (uint256 id);\n\n function mint(\n address account,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n function mintMultiple(\n address account,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n\n // for bridging, where the ID has already been minted on that layer\n function mintDeficit(\n address account,\n uint256 id,\n uint256 amount\n ) external;\n\n // fails on non-NFT or nft who do not have collection (was a mistake)\n function collectionOf(uint256 id) external view returns (uint256);\n\n function balanceOf(address owner, uint256 id) external view returns (uint256);\n\n // return true for Non-NFT ERC1155 tokens which exists\n function isCollection(uint256 id) external view returns (bool);\n\n function collectionIndexOf(uint256 id) external view returns (uint256);\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external;\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external;\n\n function burnFrom(\n address from,\n uint256 id,\n uint256 amount\n ) external;\n\n function getBouncerAdmin() external view returns (address);\n\n function extractERC721From(\n address sender,\n uint256 id,\n address to\n ) external returns (uint256 newId);\n\n function isBouncer(address who) external view returns (bool);\n\n function creatorOf(uint256 id) external view returns (address);\n\n function doesHashExist(uint256 id) external view returns (bool);\n\n function isSuperOperator(address who) external view returns (bool);\n\n function isApprovedForAll(address owner, address operator) external view returns (bool isOperator);\n\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) external returns (uint256[] memory);\n\n function name() external returns (string memory _name);\n\n function symbol() external returns (string memory _symbol);\n\n function supportsInterface(bytes4 id) external returns (bool);\n\n function uri(uint256 id) external returns (string memory);\n\n function setAssetERC721(IAssetERC721 assetERC721) external;\n\n function exists(uint256 tokenId) external view returns (bool);\n\n function setTrustedForwarder(address trustedForwarder) external;\n\n function isTrustedForwarder(address forwarder) external returns (bool);\n\n function getTrustedForwarder() external view returns (address);\n\n function metadataHash(uint256 id) external view returns (bytes32);\n}\n" + }, + "src/solc_0.8/common/interfaces/IAssetERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IERC721Base} from \"./IERC721Base.sol\";\n\ninterface IAssetERC721 is IERC721Base {\n function setTokenURI(uint256 id, string memory uri) external;\n\n function tokenURI(uint256 id) external view returns (string memory);\n}\n" + }, + "src/solc_0.8/common/interfaces/IAssetMinter.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\npragma experimental ABIEncoderV2;\n\ninterface IAssetMinter {\n struct AssetData {\n uint16[] gemIds;\n uint16 catalystId;\n }\n\n // use only to fix stack too deep\n struct MintData {\n address from;\n address to;\n uint40 packId;\n bytes32 metadataHash;\n bytes data;\n }\n\n function mintWithoutCatalyst(\n MintData calldata mintData,\n uint16 typeAsset1Based,\n uint256 quantity\n ) external returns (uint256 assetId);\n\n function mintWithCatalyst(\n MintData calldata mintData,\n uint16 catalystId,\n uint16[] calldata gemIds,\n uint256 quantity,\n uint256 _numberOfCatalystBurnPerAsset,\n uint256 _numberOfGemsBurnPerAsset\n ) external returns (uint256 assetId);\n\n function mintMultipleWithCatalyst(\n MintData calldata mintData,\n AssetData[] memory assets,\n uint256[] memory supplies,\n uint256 _numberOfCatalystBurnPerAsset,\n uint256 _numberOfGemsBurnPerAsset\n ) external returns (uint256[] memory assetIds);\n\n function mintMultipleWithoutCatalyst(\n MintData calldata mintData,\n uint256[] calldata supplies,\n uint16[] calldata assetTypesIds\n ) external returns (uint256[] memory assetIds);\n\n function mintCustomNumberWithCatalyst(\n MintData calldata mintData,\n uint16 catalystId,\n uint16[] calldata gemIds,\n uint256 quantity,\n uint256 _numberOfCatalystBurnPerAsset,\n uint256 _numberOfGemsBurnPerAsset\n ) external returns (uint256 assetId);\n\n function mintCustomNumberWithoutCatalyst(MintData calldata mintData, uint256 quantity)\n external\n returns (uint256 assetId);\n\n function addOrReplaceQuantityByCatalystId(uint16 catalystId, uint256 newQuantity) external;\n\n function addOrReplaceAssetTypeQuantity(uint16 index1Based, uint256 newQuantity) external;\n\n function setNumberOfGemsBurnPerAsset(uint32 newQuantity) external;\n\n function setNumberOfCatalystsBurnPerAsset(uint32 newQuantity) external;\n\n function setCustomMintingAllowance(address addressToModify, bool isAddressAllowed) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IAssetToken.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\ninterface IAssetToken {\n function mint(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256 supply,\n uint8 rarity,\n address owner,\n bytes calldata data\n ) external returns (uint256 id);\n\n function mintMultiple(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256[] calldata supplies,\n bytes calldata rarityPack,\n address owner,\n bytes calldata data\n ) external returns (uint256[] memory ids);\n\n // fails on non-NFT or nft who do not have collection (was a mistake)\n function collectionOf(uint256 id) external view returns (uint256);\n\n function balanceOf(address owner, uint256 id) external view returns (uint256);\n\n // return true for Non-NFT ERC1155 tokens which exists\n function isCollection(uint256 id) external view returns (bool);\n\n function collectionIndexOf(uint256 id) external view returns (uint256);\n\n function extractERC721From(\n address sender,\n uint256 id,\n address to\n ) external returns (uint256 newId);\n\n function transferFrom(\n address from,\n address to,\n uint256 id\n ) external;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id\n ) external;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external;\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external;\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external;\n\n function isSuperOperator(address who) external view returns (bool);\n}\n" + }, + "src/solc_0.8/common/interfaces/IAssetUpgrader.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\npragma experimental ABIEncoderV2;\n\ninterface IAssetUpgrader {\n function extractAndSetCatalyst(\n address from,\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds,\n address to\n ) external returns (uint256 tokenId);\n\n function changeCatalyst(\n address from,\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds,\n address to\n ) external returns (uint256 tokenId);\n\n function addGems(\n address from,\n uint256 assetId,\n uint16[] calldata gemIds,\n address to\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IAttributes.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\npragma experimental ABIEncoderV2;\n\nimport \"../interfaces/IAssetAttributesRegistry.sol\";\n\ninterface IAttributes {\n function getAttributes(uint256 assetId, IAssetAttributesRegistry.GemEvent[] calldata events)\n external\n view\n returns (uint32[] memory values);\n}\n" + }, + "src/solc_0.8/common/interfaces/IAuthValidator.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface IAuthValidator {\n function isAuthValid(bytes calldata signature, bytes32 hashedData) external view returns (bool);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/**\n @title ERC-1155 Multi Token Standard\n @dev See https://eips.ethereum.org/EIPS/eip-1155\n Note: The ERC-165 identifier for this interface is 0xd9b67a26.\n */\ninterface IERC1155 {\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n event URI(string value, uint256 indexed id);\n\n /**\n @notice Transfers `value` amount of an `id` from `from` to `to` (with safety call).\n @dev Caller must be approved to manage the tokens being transferred out of the `from` account (see \"Approval\" section of the standard).\n MUST revert if `to` is the zero address.\n MUST revert if balance of holder for token `id` is lower than the `value` sent.\n MUST revert on any other error.\n MUST emit the `TransferSingle` event to reflect the balance change (see \"Safe Transfer Rules\" section of the standard).\n After the above conditions are met, this function MUST check if `to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `to` and act appropriately (see \"Safe Transfer Rules\" section of the standard).\n @param from Source address\n @param to Target address\n @param id ID of the token type\n @param value Transfer amount\n @param data Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `to`\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external;\n\n /**\n @notice Transfers `values` amount(s) of `ids` from the `from` address to the `to` address specified (with safety call).\n @dev Caller must be approved to manage the tokens being transferred out of the `from` account (see \"Approval\" section of the standard).\n MUST revert if `to` is the zero address.\n MUST revert if length of `ids` is not the same as length of `values`.\n MUST revert if any of the balance(s) of the holder(s) for token(s) in `ids` is lower than the respective amount(s) in `values` sent to the recipient.\n MUST revert on any other error.\n MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see \"Safe Transfer Rules\" section of the standard).\n Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).\n After the above conditions for the transfer(s) in the batch are met, this function MUST check if `to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `to` and act appropriately (see \"Safe Transfer Rules\" section of the standard).\n @param from Source address\n @param to Target address\n @param ids IDs of each token type (order and length must match _values array)\n @param values Transfer amounts per token type (order and length must match _ids array)\n @param data Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `to`\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external;\n\n /**\n @notice Get the balance of an account's tokens.\n @param owner The address of the token holder\n @param id ID of the token\n @return The _owner's balance of the token type requested\n */\n function balanceOf(address owner, uint256 id) external view returns (uint256);\n\n /**\n @notice Get the balance of multiple account/token pairs\n @param owners The addresses of the token holders\n @param ids ID of the tokens\n @return The _owner's balance of the token types requested (i.e. balance for each (owner, id) pair)\n */\n function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) external view returns (uint256[] memory);\n\n /**\n @notice Enable or disable approval for a third party (\"operator\") to manage all of the caller's tokens.\n @dev MUST emit the ApprovalForAll event on success.\n @param operator Address to add to the set of authorized operators\n @param approved True if the operator is approved, false to revoke approval\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n @notice Queries the approval status of an operator for a given owner.\n @param owner The owner of the tokens\n @param operator Address of authorized operator\n @return True if the operator is approved, false if not\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC1155TokenReceiver.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/**\n Note: The ERC-165 identifier for this interface is 0x4e2312e0.\n*/\ninterface IERC1155TokenReceiver {\n /**\n @notice Handle the receipt of a single ERC1155 token type.\n @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.\n This function MUST return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` (i.e. 0xf23a6e61) if it accepts the transfer.\n This function MUST revert if it rejects the transfer.\n Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller.\n @param operator The address which initiated the transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param id The ID of the token being transferred\n @param value The amount of tokens being transferred\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n @notice Handle the receipt of multiple ERC1155 token types.\n @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.\n This function MUST return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` (i.e. 0xbc197c81) if it accepts the transfer(s).\n This function MUST revert if it rejects the transfer(s).\n Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller.\n @param operator The address which initiated the batch transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param ids An array containing ids of each token being transferred (order and length must match _values array)\n @param values An array containing amounts of each token being transferred (order and length must match _ids array)\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC165.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/**\n * @title ERC165\n * @dev https://eips.ethereum.org/EIPS/eip-165\n */\ninterface IERC165 {\n /**\n * @notice Query if a contract implements interface `interfaceId`\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @dev Interface identification is specified in ERC-165. This function\n * uses less than 30,000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\n/// @dev see https://eips.ethereum.org/EIPS/eip-20\ninterface IERC20 {\n /// @notice emitted when tokens are transfered from one address to another.\n /// @param from address from which the token are transfered from (zero means tokens are minted).\n /// @param to destination address which the token are transfered to (zero means tokens are burnt).\n /// @param value amount of tokens transferred.\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice emitted when owner grant transfer rights to another address\n /// @param owner address allowing its token to be transferred.\n /// @param spender address allowed to spend on behalf of `owner`\n /// @param value amount of tokens allowed.\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /// @notice return the current total amount of tokens owned by all holders.\n /// @return supply total number of tokens held.\n function totalSupply() external view returns (uint256 supply);\n\n /// @notice return the number of tokens held by a particular address.\n /// @param who address being queried.\n /// @return balance number of token held by that address.\n function balanceOf(address who) external view returns (uint256 balance);\n\n /// @notice transfer tokens to a specific address.\n /// @param to destination address receiving the tokens.\n /// @param value number of tokens to transfer.\n /// @return success whether the transfer succeeded.\n function transfer(address to, uint256 value) external returns (bool success);\n\n /// @notice transfer tokens from one address to another.\n /// @param from address tokens will be sent from.\n /// @param to destination address receiving the tokens.\n /// @param value number of tokens to transfer.\n /// @return success whether the transfer succeeded.\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool success);\n\n /// @notice approve an address to spend on your behalf.\n /// @param spender address entitled to transfer on your behalf.\n /// @param value amount allowed to be transfered.\n /// @param success whether the approval succeeded.\n function approve(address spender, uint256 value) external returns (bool success);\n\n /// @notice return the current allowance for a particular owner/spender pair.\n /// @param owner address allowing spender.\n /// @param spender address allowed to spend.\n /// @return amount number of tokens `spender` can spend on behalf of `owner`.\n function allowance(address owner, address spender) external view returns (uint256 amount);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC20Extended.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"./IERC20.sol\";\n\ninterface IERC20Extended is IERC20 {\n function burnFor(address from, uint256 amount) external;\n\n function burn(uint256 amount) external;\n\n function approveFor(\n address owner,\n address spender,\n uint256 amount\n ) external returns (bool success);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC677.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface IERC677 {\n function transferAndCall(\n address to,\n uint256 value,\n bytes calldata data\n ) external returns (bool success);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC677Receiver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface IERC677Receiver {\n function onTokenTransfer(\n address _sender,\n uint256 _value,\n bytes calldata _data\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"./IERC165.sol\";\nimport \"./IERC721Events.sol\";\n\n/**\n * @title ERC721 Non-Fungible Token Standard basic interface\n * @dev see https://eips.ethereum.org/EIPS/eip-721\n */\n/*interface*/\ninterface IERC721 is IERC165, IERC721Events {\n function balanceOf(address owner) external view returns (uint256 balance);\n\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n // function exists(uint256 tokenId) external view returns (bool exists);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC721Base.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\nimport {IERC721ExtendedToken} from \"./IERC721ExtendedToken.sol\";\n\ninterface IERC721Base is IERC721Upgradeable {\n function mint(address to, uint256 id) external;\n\n function mint(\n address to,\n uint256 id,\n bytes calldata metaData\n ) external;\n\n function approveFor(\n address from,\n address operator,\n uint256 id\n ) external;\n\n function setApprovalForAllFor(\n address from,\n address operator,\n bool approved\n ) external;\n\n function burnFrom(address from, uint256 id) external;\n\n function burn(uint256 id) external;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external override;\n\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids\n ) external;\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external;\n\n function exists(uint256 tokenId) external view returns (bool);\n\n function supportsInterface(bytes4 id) external view override returns (bool);\n\n function setTrustedForwarder(address trustedForwarder) external;\n\n function isTrustedForwarder(address forwarder) external returns (bool);\n\n function getTrustedForwarder() external returns (address trustedForwarder);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC721Events.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/**\n * @title ERC721 Non-Fungible Token Standard basic interface\n * @dev see https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Events {\n event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);\n event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);\n // Duplicate event, ERC1155 ApprovalForAll\n // event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC721Extended.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\n\ninterface IERC721Extended is IERC721 {\n function approveFor(\n address sender,\n address operator,\n uint256 id\n ) external;\n\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external;\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external;\n\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) external;\n\n function burn(uint256 id) external;\n\n function burnFrom(address from, uint256 id) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC721ExtendedToken.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface IERC721ExtendedToken {\n function approveFor(\n address sender,\n address operator,\n uint256 id\n ) external;\n\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids\n ) external;\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external;\n\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) external;\n\n function burn(uint256 id) external;\n\n function burnFrom(address from, uint256 id) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC721MandatoryTokenReceiver.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/**\n * @title IERC721MandatoryTokenReceiver\n * @author The Sandbox\n * @notice Interface for any contract that wants to support safeBatchTransfers\n * from ERC721 asset contracts.\n * @dev The ERC-165 identifier for this interface is 0x5e8bf644.\n */\ninterface IERC721MandatoryTokenReceiver {\n /**\n * @notice Whenever tokens are transferred to this contract via {IERC721-safeBatchTransferFrom}\n * by `operator` from `from`, this function is called.\n * @param operator sender\n * @param from owner of the tokens\n * @param ids token ids\n * @param data extra data\n * @return 0x4b808c46 if the transfer is a success\n */\n function onERC721BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n bytes calldata data\n ) external returns (bytes4); // needs to return 0x4b808c46\n\n /**\n * @notice Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n * @param operator sender\n * @param from owner of the token\n * @param tokenId token id\n * @param data extra data\n * @return 0x4b808c46 if the transfer is a success\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4); // needs to return 0x150b7a02\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC721Minter.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface IERC721Minter {\n function mint(address to, uint256 id) external;\n\n function mint(\n address to,\n uint256 id,\n bytes calldata data\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC721Token.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\ninterface IERC721Token {\n function mint(address to, uint256 id) external;\n\n function mint(\n address to,\n uint256 id,\n bytes calldata metaData\n ) external;\n\n function burnFrom(address from, uint256 id) external;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n function exists(uint256 tokenId) external view returns (bool);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC721TokenReceiver.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n *\n * This code has not been reviewed.\n * Do not use or deploy this code before reviewing it personally first.\n */\n\ninterface IERC721TokenReceiver {\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "src/solc_0.8/common/interfaces/IGameMinter.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"./IGameToken.sol\";\n\ninterface IGameMinter {\n function createGame(\n address to,\n IGameToken.GameData calldata creation,\n address editor,\n uint64 subId\n ) external returns (uint256 gameId);\n\n function updateGame(uint256 gameId, IGameToken.GameData memory update) external returns (uint256 newId);\n}\n" + }, + "src/solc_0.8/common/interfaces/IGameToken.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/// @title Interface for the Game token\n\ninterface IGameToken {\n struct GameData1155 {\n uint256[] assetIdsToRemove;\n uint256[] assetAmountsToRemove;\n uint256[] assetIdsToAdd;\n uint256[] assetAmountsToAdd;\n }\n\n struct GameData721 {\n uint256[] assetIdsToRemove;\n uint256[] assetIdsToAdd;\n }\n\n struct GameData {\n GameData1155 gameData1155;\n GameData721 gameData721;\n bytes32 uri; // ipfs hash (without the prefix, assume cidv1 folder)\n }\n\n function createGame(\n address from,\n address to,\n GameData calldata creation,\n address editor,\n uint64 subId\n ) external returns (uint256 id);\n\n function burn(uint256 gameId) external;\n\n function burnFrom(address from, uint256 gameId) external;\n\n function recoverAssets(\n address from,\n address to,\n uint256 gameId,\n uint256[] calldata assetERC1155Ids,\n uint256[] calldata assetERC721Ids\n ) external;\n\n function burnAndRecover(\n address from,\n address to,\n uint256 gameId,\n uint256[] calldata assetERC1155Ids,\n uint256[] calldata assetERC721Ids\n ) external;\n\n function updateGame(\n address from,\n uint256 gameId,\n GameData calldata update\n ) external returns (uint256);\n\n function getERC1155AssetBalances(uint256 gameId, uint256[] calldata assetIds)\n external\n view\n returns (uint256[] calldata);\n\n function getERC721AssetBalances(uint256 gameId, uint256[] calldata assetIds)\n external\n view\n returns (uint256[] calldata);\n\n function setGameEditor(\n address gameCreator,\n address editor,\n bool isEditor\n ) external;\n\n function isGameEditor(address gameOwner, address editor) external view returns (bool isEditor);\n\n function creatorOf(uint256 id) external view returns (address);\n\n function transferCreatorship(\n uint256 gameId,\n address sender,\n address to\n ) external;\n\n function name() external pure returns (string memory);\n\n function symbol() external pure returns (string memory);\n\n function tokenURI(uint256 gameId) external returns (string memory uri);\n\n function onERC1155Received(\n address operator,\n address, /*from*/\n uint256, /*id*/\n uint256, /*value*/\n bytes calldata /*data*/\n ) external view returns (bytes4);\n\n function onERC1155BatchReceived(\n address operator,\n address, /*from*/\n uint256[] calldata, /*ids*/\n uint256[] calldata, /*values*/\n bytes calldata /*data*/\n ) external view returns (bytes4);\n}\n" + }, + "src/solc_0.8/common/interfaces/ILandToken.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\n/// @title ILandToken\n/// @author The Sandbox\n/// @notice Interface of the LAND token including quad methods\ninterface ILandToken {\n /// @notice transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\n /// @param from current owner of the quad\n /// @param to destination\n /// @param sizes list of sizes for each quad\n /// @param xs list of bottom left x coordinates for each quad\n /// @param ys list of bottom left y coordinates for each quad\n /// @param data additional data\n function batchTransferQuad(\n address from,\n address to,\n uint256[] calldata sizes,\n uint256[] calldata xs,\n uint256[] calldata ys,\n bytes calldata data\n ) external;\n\n /// @notice transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\n /// @param from current owner of the quad\n /// @param to destination\n /// @param size size of the quad\n /// @param x The top left x coordinate of the quad\n /// @param y The top left y coordinate of the quad\n /// @param data additional data\n function transferQuad(\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external;\n\n /// @notice Transfer many tokens between 2 addresses.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param ids The ids of the tokens.\n /// @param data Additional data.\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/ILandTokenV2.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./ILandToken.sol\";\n\n/**\n * @title ILandTokenV2\n * @author The Sandbox\n * @notice Interface of the LAND token including quad methods\n */\ninterface ILandTokenV2 is ILandToken {\n /**\n * @notice Checks if an address if an operator\n * @param who address checked\n * @return is it super operator\n */\n function isSuperOperator(address who) external view returns (bool);\n\n /**\n * @notice Checks if a LAND exists by its coordinates\n * @param size size of the quad\n * @param x x coordinate\n * @param y y coordinate\n * @return does the LAND exist\n */\n function exists(\n uint256 size,\n uint256 x,\n uint256 y\n ) external view returns (bool);\n\n /**\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\n * @param to The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external;\n\n /**\n * @notice Checks if a parent quad has child quads already minted.\n * Then mints the rest child quads and transfers the parent quad.\n * Should only be called by the tunnel.\n * @param to The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintAndTransferQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/ILandTokenV3.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./ILandTokenV2.sol\";\n\ninterface ILandTokenV3 is ILandTokenV2 {\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) external;\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IMintableERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface IMintableERC1155 {\n /**\n * @notice Creates `amount` tokens of token type `id`, and assigns them to `account`.\n * @dev Should be callable only by MintableERC1155Predicate\n * Make sure minting is done only by this function\n * @param account user address for whom token is being minted\n * @param id token which is being minted\n * @param amount amount of token being minted\n * @param data extra byte data to be accompanied with minted tokens\n */\n function mint(\n address account,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @notice Batched version of singular token minting, where\n * for each token in `ids` respective amount to be minted from `amounts`\n * array, for address `to`.\n * @dev Should be callable only by MintableERC1155Predicate\n * Make sure minting is done only by this function\n * @param to user address for whom token is being minted\n * @param ids tokens which are being minted\n * @param amounts amount of each token being minted\n * @param data extra byte data to be accompanied with minted tokens\n */\n function mintBatch(\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IMintableERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\n// import {IERC721} from \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\n\npragma solidity 0.8.2;\n\ninterface IMintableERC721 {\n // is IERC721 {\n\n /**\n * @notice called by predicate contract to mint tokens while withdrawing\n * @dev Should be callable only by MintableERC721Predicate\n * Make sure minting is done only by this function\n * @param user user address for whom token is being minted\n * @param tokenId tokenId being minted\n */\n function mint(address user, uint256 tokenId) external;\n\n /**\n * @notice called by predicate contract to mint tokens while withdrawing with metadata from L2\n * @dev Should be callable only by MintableERC721Predicate\n * Make sure minting is only done either by this function/ 👆\n * @param user user address for whom token is being minted\n * @param tokenId tokenId being minted\n * @param metaData Associated token metadata, to be decoded & set using `setTokenMetadata`\n *\n * Note : If you're interested in taking token metadata from L2 to L1 during exit, you must\n * implement this method\n */\n function mint(\n address user,\n uint256 tokenId,\n bytes calldata metaData\n ) external;\n\n /**\n * @notice check if token already exists, return true if it does exist\n * @dev this check will be used by the predicate to determine if the token needs to be minted or transfered\n * @param tokenId tokenId being checked\n */\n function exists(uint256 tokenId) external view returns (bool);\n\n // This one came form ERC721 and is used by the predicate!!!\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IPolygonAssetERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IAssetERC721} from \"./IAssetERC721.sol\";\n\ninterface IPolygonAssetERC1155 {\n function changeBouncerAdmin(address newBouncerAdmin) external;\n\n function setBouncer(address bouncer, bool enabled) external;\n\n function setPredicate(address predicate) external;\n\n function mint(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256 supply,\n address owner,\n bytes calldata data\n ) external returns (uint256 id);\n\n function mint(\n address account,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n function mintDeficit(\n address account,\n uint256 id,\n uint256 amount\n ) external;\n\n function mintMultiple(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256[] calldata supplies,\n bytes calldata rarityPack,\n address owner,\n bytes calldata data\n ) external returns (uint256[] memory ids);\n\n // fails on non-NFT or nft who do not have collection (was a mistake)\n function collectionOf(uint256 id) external view returns (uint256);\n\n function balanceOf(address owner, uint256 id) external view returns (uint256);\n\n // return true for Non-NFT ERC1155 tokens which exists\n function isCollection(uint256 id) external view returns (bool);\n\n function collectionIndexOf(uint256 id) external view returns (uint256);\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external;\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external;\n\n function burnFrom(\n address from,\n uint256 id,\n uint256 amount\n ) external;\n\n function getBouncerAdmin() external view returns (address);\n\n function extractERC721From(\n address sender,\n uint256 id,\n address to\n ) external returns (uint256 newId);\n\n function isBouncer(address who) external view returns (bool);\n\n function creatorOf(uint256 id) external view returns (address);\n\n function doesHashExist(uint256 id) external view returns (bool);\n\n function isSuperOperator(address who) external view returns (bool);\n\n function isApprovedForAll(address owner, address operator) external view returns (bool isOperator);\n\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) external returns (uint256[] memory);\n\n function name() external returns (string memory _name);\n\n function symbol() external returns (string memory _symbol);\n\n function supportsInterface(bytes4 id) external returns (bool);\n\n function uri(uint256 id) external returns (string memory);\n\n function setAssetERC721(IAssetERC721 assetERC721) external;\n\n function exists(uint256 tokenId) external view returns (bool);\n\n function setTrustedForwarder(address trustedForwarder) external;\n\n function isTrustedForwarder(address forwarder) external returns (bool);\n\n function getTrustedForwarder() external returns (address);\n\n function metadataHash(uint256 id) external returns (bytes32);\n}\n" + }, + "src/solc_0.8/common/interfaces/IPolygonAssetERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IERC721Base} from \"./IERC721Base.sol\";\n\ninterface IPolygonAssetERC721 is IERC721Base {\n function setTokenURI(uint256 id, string memory uri) external;\n\n function tokenURI(uint256 id) external view returns (string memory);\n}\n" + }, + "src/solc_0.8/common/interfaces/IPolygonLand.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {ILandToken} from \"./ILandToken.sol\";\n\n/**\n * @title IPolygonLand\n * @author The Sandbox\n * @notice Interface of the LAND token on the child chain\n */\ninterface IPolygonLand is ILandToken {\n /**\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\n * @param to The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) external;\n\n /**\n * @notice Checks if a LAND exists by its coordinates\n * @param size size of the quad\n * @param x x coordinate\n * @param y y coordinate\n * @return does the LAND exist\n */\n function exists(\n uint256 size,\n uint256 x,\n uint256 y\n ) external view returns (bool);\n}\n" + }, + "src/solc_0.8/common/interfaces/IPolygonLandTunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\n/**\n * @title IPolygonLandTunnel\n * @author The Sandbox\n * @notice Interface of the LAND tunnel on the child chain\n */\ninterface IPolygonLandTunnel {\n /**\n * @notice Withdraw multiple quads to the root chain\n * @param to the recipient\n * @param sizes size of the quads\n * @param xs x of the quads\n * @param ys y of the quads\n * @param data extra data\n */\n function batchTransferQuadToL1(\n address to,\n uint256[] calldata sizes,\n uint256[] calldata xs,\n uint256[] calldata ys,\n bytes memory data\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IPolygonLandV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./IPolygonLand.sol\";\n\n/**\n * @title IPolygonLandV2\n * @author The Sandbox\n * @notice interface of the LAND v2 based on IPolygonLand\n */\ninterface IPolygonLandV2 is IPolygonLand {\n /**\n * @notice checks if an address if an operator\n * @param who address checked\n * @return is it super operator\n */\n function isSuperOperator(address who) external view returns (bool);\n\n /**\n * @notice checks if a parent quad has child quads already minted.\n * Then mints the rest child quads and transfers the parent quad.\n * Should only be called by the tunnel.\n * @param to The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintAndTransferQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IPolygonLandWithSetApproval.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IPolygonLand} from \"./IPolygonLand.sol\";\n\n/**\n * @title IPolygonLandWithSetApproval\n * @author The Sandbox\n * @notice Approve for all interface for the LAND on the chain root\n */\ninterface IPolygonLandWithSetApproval is IPolygonLand {\n /**\n * @notice Approve or disapprove the operator for all the tokens\n * @param operator address to approve\n * @param approved should it be approved or not\n */\n function setApprovalForAll(address operator, bool approved) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/Medianizer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\n/**\n * @title Medianizer contract\n * @dev From MakerDAO (https://etherscan.io/address/0x729D19f657BD0614b4985Cf1D82531c67569197B#code)\n */\ninterface Medianizer {\n function read() external view returns (bytes32);\n}\n" + }, + "src/solc_0.8/common/interfaces/pos-portal/child/IChildToken.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface IChildToken {\n function deposit(address user, bytes calldata depositData) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/pos-portal/root/IRootERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\n// import {IERC721} from \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\n\npragma solidity 0.8.2;\n\ninterface IRootERC721 {\n // is IERC721 {\n // Make sure you implement this method in root ERC721\n // contract when you're interested in transferring\n // metadata from L2 to L1\n function setTokenMetadata(uint256 tokenId, bytes calldata data) external;\n}\n" + }, + "src/solc_0.8/common/Libraries/BytesUtil.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nlibrary BytesUtil {\n uint256 private constant DATA_MIN_LENGTH = 68;\n\n /// @dev Check if the data == _address.\n /// @param data The bytes passed to the function.\n /// @param _address The address to compare to.\n /// @return Whether the first param == _address.\n function doFirstParamEqualsAddress(bytes memory data, address _address) internal pure returns (bool) {\n if (data.length < DATA_MIN_LENGTH) {\n return false;\n }\n uint256 value;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n value := mload(add(data, 36))\n }\n return value == uint256(uint160(_address));\n }\n}\n" + }, + "src/solc_0.8/common/Libraries/ObjectLib32.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nlibrary ObjectLib32 {\n enum Operations {ADD, SUB, REPLACE}\n // Constants regarding bin or chunk sizes for balance packing\n uint256 internal constant TYPES_BITS_SIZE = 32; // Max size of each object\n uint256 internal constant TYPES_PER_UINT256 = 256 / TYPES_BITS_SIZE; // Number of types per uint256\n uint256 internal constant TYPE_ELIMINATOR = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFFFFFFFFFFF;\n\n //\n // Objects and Tokens Functions\n //\n\n /// @dev Return the bin number and index within that bin where ID is\n /// @param tokenId Object type\n /// @return bin Bin number.\n /// @return index ID's index within that bin.\n function getTokenBinIndex(uint256 tokenId) internal pure returns (uint256 bin, uint256 index) {\n uint256 id = tokenId & TYPE_ELIMINATOR;\n unchecked {bin = (id * TYPES_BITS_SIZE) / 256;}\n index = tokenId % TYPES_PER_UINT256;\n return (bin, index);\n }\n\n /**\n * @dev update the balance of a type provided in binBalances\n * @param binBalances Uint256 containing the balances of objects\n * @param index Index of the object in the provided bin\n * @param amount Value to update the type balance\n * @param operation Which operation to conduct :\n * Operations.REPLACE : Replace type balance with amount\n * Operations.ADD : ADD amount to type balance\n * Operations.SUB : Substract amount from type balance\n */\n function updateTokenBalance(\n uint256 binBalances,\n uint256 index,\n uint256 amount,\n Operations operation\n ) internal pure returns (uint256 newBinBalance) {\n uint256 objectBalance = 0;\n if (operation == Operations.ADD) {\n objectBalance = getValueInBin(binBalances, index);\n newBinBalance = writeValueInBin(binBalances, index, objectBalance + amount);\n } else if (operation == Operations.SUB) {\n objectBalance = getValueInBin(binBalances, index);\n require(objectBalance >= amount, \"can't substract more than there is\");\n newBinBalance = writeValueInBin(binBalances, index, objectBalance - amount);\n } else if (operation == Operations.REPLACE) {\n newBinBalance = writeValueInBin(binBalances, index, amount);\n } else {\n revert(\"Invalid operation\"); // Bad operation\n }\n\n return newBinBalance;\n }\n\n /*\n * @dev return value in binValue at position index\n * @param binValue uint256 containing the balances of TYPES_PER_UINT256 types\n * @param index index at which to retrieve value\n * @return Value at given index in bin\n */\n function getValueInBin(uint256 binValue, uint256 index) internal pure returns (uint256) {\n // Mask to retrieve data for a given binData\n uint256 mask = (uint256(1) << TYPES_BITS_SIZE) - 1;\n\n // Shift amount\n uint256 rightShift = 256 - TYPES_BITS_SIZE * (index + 1);\n return (binValue >> rightShift) & mask;\n }\n\n /**\n * @dev return the updated binValue after writing amount at index\n * @param binValue uint256 containing the balances of TYPES_PER_UINT256 types\n * @param index Index at which to retrieve value\n * @param amount Value to store at index in bin\n * @return Value at given index in bin\n */\n function writeValueInBin(\n uint256 binValue,\n uint256 index,\n uint256 amount\n ) internal pure returns (uint256) {\n require(amount < 2**TYPES_BITS_SIZE, \"Amount to write in bin is too large\");\n\n // Mask to retrieve data for a given binData\n uint256 mask = (uint256(1) << TYPES_BITS_SIZE) - 1;\n\n // Shift amount\n uint256 leftShift = 256 - TYPES_BITS_SIZE * (index + 1);\n return (binValue & ~(mask << leftShift)) | (amount << leftShift);\n }\n}\n" + }, + "src/solc_0.8/common/Libraries/PriceUtil.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nlibrary PriceUtil {\n function calculateCurrentPrice(\n uint256 startingPrice,\n uint256 endingPrice,\n uint256 duration,\n uint256 secondsPassed\n ) internal pure returns (uint256) {\n if (secondsPassed > duration) {\n return endingPrice;\n }\n if (endingPrice == startingPrice) {\n return endingPrice;\n } else if (endingPrice > startingPrice) {\n return startingPrice + ((endingPrice - startingPrice) * secondsPassed) / duration;\n } else {\n return startingPrice - ((startingPrice - endingPrice) * secondsPassed) / duration;\n }\n }\n\n function calculateFee(uint256 price, uint256 fee10000th) internal pure returns (uint256) {\n // _fee < 10000, so the result will be <= price\n return (price * fee10000th) / 10000;\n }\n}\n" + }, + "src/solc_0.8/common/Libraries/SafeMathWithRequire.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that revert\n */\nlibrary SafeMathWithRequire {\n uint256 private constant DECIMALS_18 = 1000000000000000000;\n uint256 private constant DECIMALS_12 = 1000000000000;\n uint256 private constant DECIMALS_9 = 1000000000;\n uint256 private constant DECIMALS_6 = 1000000;\n\n function sqrt6(uint256 a) internal pure returns (uint256 c) {\n a = a * DECIMALS_12;\n uint256 tmp = (a + 1) / 2;\n c = a;\n // tmp cannot be zero unless a = 0 which skip the loop\n while (tmp < c) {\n c = tmp;\n tmp = ((a / tmp) + tmp) / 2;\n }\n }\n\n function sqrt3(uint256 a) internal pure returns (uint256 c) {\n a = a * DECIMALS_6;\n uint256 tmp = (a + 1) / 2;\n c = a;\n // tmp cannot be zero unless a = 0 which skip the loop\n while (tmp < c) {\n c = tmp;\n tmp = ((a / tmp) + tmp) / 2;\n }\n }\n\n function cbrt6(uint256 a) internal pure returns (uint256 c) {\n a = a * DECIMALS_18;\n uint256 tmp = (a + 2) / 3;\n c = a;\n // tmp cannot be zero unless a = 0 which skip the loop\n while (tmp < c) {\n c = tmp;\n uint256 tmpSquare = tmp**2;\n require(tmpSquare > tmp, \"overflow\");\n tmp = ((a / tmpSquare) + (tmp * 2)) / 3;\n }\n return c;\n }\n\n function cbrt3(uint256 a) internal pure returns (uint256 c) {\n a = a * DECIMALS_9;\n uint256 tmp = (a + 2) / 3;\n c = a;\n // tmp cannot be zero unless a = 0 which skip the loop\n while (tmp < c) {\n c = tmp;\n uint256 tmpSquare = tmp**2;\n require(tmpSquare > tmp, \"overflow\");\n tmp = ((a / tmpSquare) + (tmp * 2)) / 3;\n }\n return c;\n }\n}\n" + }, + "src/solc_0.8/common/Libraries/SigUtil.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nlibrary SigUtil {\n function recover(bytes32 hash, bytes memory sig) internal pure returns (address recovered) {\n require(sig.length == 65, \"incorrect signature length\");\n\n bytes32 r;\n bytes32 s;\n uint8 v;\n assembly {\n r := mload(add(sig, 32))\n s := mload(add(sig, 64))\n v := byte(0, mload(add(sig, 96)))\n }\n\n // Version of signature should be 27 or 28, but 0 and 1 are also possible versions\n if (v < 27) {\n v += 27;\n }\n require(v == 27 || v == 28, \"version of signature should be 27 or 28\");\n\n recovered = ecrecover(hash, v, r, s);\n require(recovered != address(0), \"incorrect address\");\n }\n\n function recoverWithZeroOnFailure(bytes32 hash, bytes memory sig) internal pure returns (address) {\n if (sig.length != 65) {\n return (address(0));\n }\n\n bytes32 r;\n bytes32 s;\n uint8 v;\n assembly {\n r := mload(add(sig, 32))\n s := mload(add(sig, 64))\n v := byte(0, mload(add(sig, 96)))\n }\n\n // Version of signature should be 27 or 28, but 0 and 1 are also possible versions\n if (v < 27) {\n v += 27;\n }\n\n if (v != 27 && v != 28) {\n return (address(0));\n } else {\n return ecrecover(hash, v, r, s);\n }\n }\n\n // Builds a prefixed hash to mimic the behavior of eth_sign.\n function prefixed(bytes32 hash) internal pure returns (bytes memory) {\n return abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash);\n }\n}\n" + }, + "src/solc_0.8/defi/contributionCalculation/LandContributionCalculator.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {IERC721} from \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\nimport {SafeMathWithRequire} from \"../../common/Libraries/SafeMathWithRequire.sol\";\nimport {IContributionCalculator} from \"../interfaces/IContributionCalculator.sol\";\n\ncontract LandContributionCalculator is IContributionCalculator, Ownable {\n using Address for address;\n\n uint256 internal constant DECIMALS_9 = 1000000000;\n uint256 internal constant MIDPOINT_9 = 500000000;\n uint256 internal constant NFT_FACTOR_6 = 10000;\n uint256 internal constant NFT_CONSTANT_3 = 9000;\n uint256 internal constant ROOT3_FACTOR = 697;\n\n IERC721 public multiplierNFToken;\n\n constructor(IERC721 multiplierNFToken_) {\n multiplierNFToken = multiplierNFToken_;\n }\n\n function multiplierOf(address account) external view virtual returns (uint256) {\n return multiplierNFToken.balanceOf(account);\n }\n\n function computeContribution(address account, uint256 amountStaked) external view override returns (uint256) {\n uint256 numLands = multiplierNFToken.balanceOf(account);\n return _contribution(amountStaked, numLands);\n }\n\n function contribution(uint256 amountStaked, uint256 numLands) external pure returns (uint256) {\n return _contribution(amountStaked, numLands);\n }\n\n function setNFTMultiplierToken(address newNFTMultiplierToken) external onlyOwner {\n require(newNFTMultiplierToken.isContract(), \"LandContributionCalc: Bad NFTMultiplierToken address\");\n multiplierNFToken = IERC721(newNFTMultiplierToken);\n }\n\n function _contribution(uint256 amountStaked, uint256 numLands) internal pure returns (uint256) {\n if (numLands == 0) {\n return amountStaked;\n }\n uint256 nftContrib =\n NFT_FACTOR_6 * (NFT_CONSTANT_3 + SafeMathWithRequire.cbrt3((((numLands - 1) * ROOT3_FACTOR) + 1)));\n if (nftContrib > MIDPOINT_9) {\n nftContrib = MIDPOINT_9 + (nftContrib - MIDPOINT_9) / 10;\n }\n return amountStaked + ((amountStaked * nftContrib) / DECIMALS_9);\n }\n}\n" + }, + "src/solc_0.8/defi/contributionCalculation/LandOwnerContributionCalculator.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {IERC721} from \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\nimport {SafeMathWithRequire} from \"../../common/Libraries/SafeMathWithRequire.sol\";\nimport {IContributionCalculator} from \"../interfaces/IContributionCalculator.sol\";\n\ncontract LandOwnersAloneContributionCalculator is IContributionCalculator, Ownable {\n using Address for address;\n\n IERC721 public multiplierNFToken;\n\n constructor(IERC721 multiplierNFToken_) {\n multiplierNFToken = multiplierNFToken_;\n }\n\n function multiplierOf(address account) external view virtual returns (uint256) {\n return multiplierNFToken.balanceOf(account);\n }\n\n function computeContribution(address account, uint256 amountStaked) external view override returns (uint256) {\n uint256 numLands = multiplierNFToken.balanceOf(account);\n if (numLands > 0) {\n return amountStaked;\n }\n return 0;\n }\n\n function setNFTMultiplierToken(address newNFTMultiplierToken) external onlyOwner {\n require(newNFTMultiplierToken.isContract(), \"LandOwnersAloneContributionCalc: Bad NFTMultiplierToken address\");\n multiplierNFToken = IERC721(newNFTMultiplierToken);\n }\n}\n" + }, + "src/solc_0.8/defi/ERC20RewardPool.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Context} from \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport {IERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts-0.8/security/ReentrancyGuard.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {Pausable} from \"@openzeppelin/contracts-0.8/security/Pausable.sol\";\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport {Math} from \"@openzeppelin/contracts-0.8/utils/math/Math.sol\";\nimport {ERC2771HandlerV2} from \"../common/BaseWithStorage/ERC2771HandlerV2.sol\";\nimport {StakeTokenWrapper} from \"./StakeTokenWrapper.sol\";\nimport {IContributionRules} from \"./interfaces/IContributionRules.sol\";\nimport {IRewardCalculator} from \"./interfaces/IRewardCalculator.sol\";\nimport {LockRules} from \"./rules/LockRules.sol\";\nimport {RequirementsRules} from \"./rules/RequirementsRules.sol\";\n\n/// @title A pool that distributes rewards between users that stake any erc20 token\n/// @notice The contributions are updated passively, an external call to computeContribution from a backend is needed.\n/// @notice After initialization the reward calculator must be set by the admin.\n/// @dev The contract has two plugins that affect the behaviour: contributionCalculator and rewardCalculator\n/// @dev contributionCalculator instead of using the stake directly the result of computeContribution is used\n/// @dev this way some users can get an extra share of the rewards\n/// @dev rewardCalculator is used to manage the rate at which the rewards are distributed.\n/// @dev This way we can build different types of pools by mixing in the plugins we want with this contract.\n/// @dev default behaviour (address(0)) for contributionCalculator is to use the stacked amount as contribution.\n/// @dev default behaviour (address(0)) for rewardCalculator is that no rewards are given\ncontract ERC20RewardPool is\n Ownable,\n StakeTokenWrapper,\n LockRules,\n RequirementsRules,\n ReentrancyGuard,\n ERC2771HandlerV2,\n Pausable\n{\n using SafeERC20 for IERC20;\n using Address for address;\n\n event Staked(address indexed account, uint256 stakeAmount);\n event Withdrawn(address indexed account, uint256 stakeAmount);\n event Exit(address indexed account);\n event RewardPaid(address indexed account, uint256 rewardAmount);\n event ContributionUpdated(address indexed account, uint256 newContribution, uint256 oldContribution);\n\n uint256 internal constant DECIMALS_18 = 1 ether;\n\n // This value multiplied by the user contribution is the share of accumulated rewards (from the start of time\n // until the last call to restartRewards) for the user taking into account the value of totalContributions.\n uint256 public rewardPerTokenStored;\n\n IERC20 public rewardToken;\n IContributionRules public contributionRules;\n IRewardCalculator public rewardCalculator;\n\n // This value multiplied by the user contribution is the share of reward from the the last time\n // the user changed his contribution and called restartRewards\n mapping(address => uint256) public userRewardPerTokenPaid;\n\n // This value is the accumulated rewards won by the user when he called the contract.\n mapping(address => uint256) public rewards;\n\n uint256 internal _totalContributions;\n mapping(address => uint256) internal _contributions;\n\n constructor(\n IERC20 stakeToken_,\n IERC20 rewardToken_,\n address trustedForwarder\n ) StakeTokenWrapper(stakeToken_) {\n require(address(rewardToken_).isContract(), \"ERC20RewardPool: is not a contract\");\n rewardToken = rewardToken_;\n __ERC2771HandlerV2_initialize(trustedForwarder);\n }\n\n // Checks that the given address is a contract and\n // that the caller of the method is the owner of this contract - ERC20RewardPool.\n modifier isContractAndAdmin(address contractAddress) {\n require(contractAddress.isContract(), \"ERC20RewardPool: is not a contract\");\n require(owner() == _msgSender(), \"ERC20RewardPool: not admin\");\n _;\n }\n\n modifier isValidAddress(address account) {\n require(account != address(0), \"ERC20RewardPool: zero address\");\n\n _;\n }\n\n /// @notice set the reward token\n /// @param contractAddress address token used to pay rewards\n function setRewardToken(address contractAddress)\n external\n isContractAndAdmin(contractAddress)\n isValidAddress(contractAddress)\n {\n IERC20 _newRewardToken = IERC20(contractAddress);\n require(\n rewardToken.balanceOf(address(this)) <= _newRewardToken.balanceOf(address(this)),\n \"ERC20RewardPool: insufficient balance\"\n );\n rewardToken = _newRewardToken;\n }\n\n /// @notice set the stake token\n /// @param contractAddress address token used to stake funds\n function setStakeToken(address contractAddress)\n external\n isContractAndAdmin(contractAddress)\n isValidAddress(contractAddress)\n {\n IERC20 _newStakeToken = IERC20(contractAddress);\n require(\n _stakeToken.balanceOf(address(this)) <= _newStakeToken.balanceOf(address(this)),\n \"ERC20RewardPool: insufficient balance\"\n );\n _stakeToken = _newStakeToken;\n }\n\n /// @notice set the trusted forwarder\n /// @param trustedForwarder address of the contract that is enabled to send meta-tx on behalf of the user\n function setTrustedForwarder(address trustedForwarder) external isContractAndAdmin(trustedForwarder) {\n _trustedForwarder = trustedForwarder;\n }\n\n /// @notice set contract that contains all the contribution rules\n function setContributionRules(address contractAddress)\n external\n isContractAndAdmin(contractAddress)\n isValidAddress(contractAddress)\n {\n contributionRules = IContributionRules(contractAddress);\n }\n\n /// @notice set the reward calculator\n /// @param contractAddress address of a plugin that calculates absolute rewards at any point in time\n /// @param restartRewards_ if true the rewards from the previous calculator are accumulated before changing it\n function setRewardCalculator(address contractAddress, bool restartRewards_)\n external\n isContractAndAdmin(contractAddress)\n isValidAddress(contractAddress)\n {\n // We process the rewards of the current reward calculator before the switch.\n if (restartRewards_) {\n _restartRewards();\n }\n rewardCalculator = IRewardCalculator(contractAddress);\n }\n\n /// @notice the admin recover is able to recover reward funds\n /// @param receiver address of the beneficiary of the recovered funds\n /// @dev this function must be called in an emergency situation only.\n /// @dev Calling it is risky specially when rewardToken == stakeToken\n function recoverFunds(address receiver) external onlyOwner whenPaused() isValidAddress(receiver) {\n uint256 recoverAmount;\n\n if (rewardToken == _stakeToken) {\n recoverAmount = rewardToken.balanceOf(address(this)) - _totalSupply;\n } else {\n recoverAmount = rewardToken.balanceOf(address(this));\n }\n\n rewardToken.safeTransfer(receiver, recoverAmount);\n }\n\n /// @notice return the total supply of staked tokens\n /// @return the total supply of staked tokens\n function totalSupply() external view returns (uint256) {\n return _totalSupply;\n }\n\n /// @notice return the balance of staked tokens for a user\n /// @param account the address of the account\n /// @return balance of staked tokens\n function balanceOf(address account) external view returns (uint256) {\n return _balances[account];\n }\n\n /// @notice return the address of the stake token contract\n /// @return address of the stake token contract\n function stakeToken() external view returns (IERC20) {\n return _stakeToken;\n }\n\n /// @notice return the amount of rewards deposited in the contract that can be distributed by different campaigns\n /// @return the total amount of deposited rewards\n /// @dev this function can be called by a reward calculator to throw if a campaign doesn't have\n /// @dev enough rewards to start\n function getRewardsAvailable() external view returns (uint256) {\n if (address(rewardToken) != address(_stakeToken)) {\n return rewardToken.balanceOf(address(this));\n }\n return _stakeToken.balanceOf(address(this)) - _totalSupply;\n }\n\n /// @notice return the sum of the values returned by the contribution calculator\n /// @return total contributions of the users\n /// @dev this is the same than the totalSupply only if the contribution calculator\n /// @dev uses the staked amount as the contribution of the user which is the default behaviour\n function totalContributions() external view returns (uint256) {\n return _totalContributions;\n }\n\n /// @notice return the contribution of some user\n /// @param account the address of the account\n /// @return contribution of the users\n /// @dev this is the same than the balanceOf only if the contribution calculator\n /// @dev uses the staked amount as the contribution of the user which is the default behaviour\n function contributionOf(address account) external view returns (uint256) {\n return _contributions[account];\n }\n\n /// @notice accumulated rewards taking into account the totalContribution (see: rewardPerTokenStored)\n /// @return the accumulated total rewards\n /// @dev This value multiplied by the user contribution is the share of accumulated rewards for the user. Taking\n /// @dev into account the value of totalContributions.\n function rewardPerToken() external view returns (uint256) {\n return rewardPerTokenStored + _rewardPerToken();\n }\n\n /// @notice available earnings for some user\n /// @param account the address of the account\n /// @return the available earnings for the user\n function earned(address account) external view returns (uint256) {\n return rewards[account] + _earned(account, _rewardPerToken());\n }\n\n /// @notice accumulates the current rewards into rewardPerTokenStored and restart the reward calculator\n /// @dev calling this function makes no difference. It is useful for testing and when the reward calculator\n /// @dev is changed.\n function restartRewards() external {\n _restartRewards();\n }\n\n /// @notice update the contribution for a user\n /// @param account the address of the account\n /// @dev if the user change his holdings (or any other parameter that affect the contribution calculation),\n /// @dev he can the reward distribution to his favor. This function must be called by an external agent ASAP to\n /// @dev update the contribution for the user. We understand the risk but the rewards are distributed slowly so\n /// @dev the user cannot affect the reward distribution heavily.\n function computeContribution(address account) external isValidAddress(account) {\n // We decide to give the user the accumulated rewards even if he cheated a little bit.\n _processRewards(account);\n _updateContribution(account);\n }\n\n /// @notice update the contribution for a sef of users\n /// @param accounts the addresses of the accounts to update\n /// @dev see: computeContribution\n function computeContributionInBatch(address[] calldata accounts) external {\n _restartRewards();\n for (uint256 i = 0; i < accounts.length; i++) {\n address account = accounts[i];\n if (account == address(0)) {\n continue;\n }\n _processAccountRewards(account);\n _updateContribution(account);\n }\n }\n\n /// @notice stake some amount into the contract\n /// @param amount the amount of tokens to stake\n /// @dev the user must approve in the stake token before calling this function\n function stake(uint256 amount)\n external\n nonReentrant\n whenNotPaused()\n antiDepositCheck(_msgSender())\n checkRequirements(_msgSender(), amount, _balances[_msgSender()])\n {\n require(amount > 0, \"ERC20RewardPool: Cannot stake 0\");\n\n // The first time a user stakes he cannot remove his rewards immediately.\n if (timeLockClaim.lastClaim[_msgSender()] == 0) {\n timeLockClaim.lastClaim[_msgSender()] = block.timestamp;\n }\n\n lockDeposit.lastDeposit[_msgSender()] = block.timestamp;\n\n uint256 earlierRewards = 0;\n\n if (_totalContributions == 0 && rewardCalculator != IRewardCalculator(address(0))) {\n earlierRewards = rewardCalculator.getRewards();\n }\n\n _processRewards(_msgSender());\n super._stake(amount);\n _updateContribution(_msgSender());\n require(_contributions[_msgSender()] > 0, \"ERC20RewardPool: not enough contributions\");\n\n if (earlierRewards != 0) {\n rewards[_msgSender()] = rewards[_msgSender()] + earlierRewards;\n }\n emit Staked(_msgSender(), amount);\n }\n\n /// @notice withdraw the stake from the contract\n /// @param amount the amount of tokens to withdraw\n /// @dev the user can withdraw his stake independently from the rewards\n function withdraw(uint256 amount) external nonReentrant whenNotPaused() {\n _processRewards(_msgSender());\n _withdrawStake(_msgSender(), amount);\n _updateContribution(_msgSender());\n }\n\n /// @notice withdraw the stake and the rewards from the contract\n function exit() external nonReentrant whenNotPaused() {\n _processRewards(_msgSender());\n _withdrawStake(_msgSender(), _balances[_msgSender()]);\n _withdrawRewards(_msgSender());\n _updateContribution(_msgSender());\n emit Exit(_msgSender());\n }\n\n /// @notice withdraw the rewards from the contract\n /// @dev the user can withdraw his stake independently from the rewards\n function getReward() external nonReentrant whenNotPaused() {\n _processRewards(_msgSender());\n _withdrawRewards(_msgSender());\n _updateContribution(_msgSender());\n }\n\n function renounceOwnership() public view override onlyOwner {\n revert(\"ERC20RewardPool: can't renounceOwnership\");\n }\n\n function _withdrawStake(address account, uint256 amount) internal antiWithdrawCheck(_msgSender()) {\n require(amount > 0, \"ERC20RewardPool: Cannot withdraw 0\");\n lockWithdraw.lastWithdraw[_msgSender()] = block.timestamp;\n super._withdraw(amount);\n emit Withdrawn(account, amount);\n }\n\n function _withdrawRewards(address account) internal timeLockClaimCheck(account) {\n uint256 reward = rewards[account];\n uint256 mod = 0;\n if (reward > 0) {\n if (amountLockClaim.claimLockEnabled == true) {\n // constrain the reward amount to the integer allowed\n mod = reward % DECIMALS_18;\n reward = reward - mod;\n require(\n amountLockClaim.amount <= reward,\n \"ERC20RewardPool: Cannot withdraw - lockClaim.amount < reward\"\n );\n }\n rewards[account] = mod;\n rewardToken.safeTransfer(account, reward);\n emit RewardPaid(account, reward);\n }\n }\n\n function _updateContribution(address account) internal {\n uint256 oldContribution = _contributions[account];\n _totalContributions = _totalContributions - oldContribution;\n uint256 contribution = _computeContribution(account);\n _totalContributions = _totalContributions + contribution;\n _contributions[account] = contribution;\n emit ContributionUpdated(account, contribution, oldContribution);\n }\n\n function _computeContribution(address account) internal returns (uint256) {\n if (contributionRules == IContributionRules(address(0))) {\n return Math.min(_balances[account], maxStakeAllowedCalculator(account));\n } else {\n return\n contributionRules.computeMultiplier(\n account,\n Math.min(_balances[account], maxStakeAllowedCalculator(account))\n );\n }\n }\n\n // Something changed (stake, withdraw, etc), we distribute current accumulated rewards and start from zero.\n // Called each time there is a change in contract state (stake, withdraw, etc).\n function _processRewards(address account) internal {\n _restartRewards();\n _processAccountRewards(account);\n }\n\n // Update the earnings for this specific user with what he earned until now\n function _processAccountRewards(address account) internal {\n // usually _earned takes _rewardPerToken() but in this method is zero because _restartRewards must be\n // called before _processAccountRewards\n rewards[account] = rewards[account] + _earned(account, 0);\n // restart rewards for this specific user, now earned(account) = 0\n userRewardPerTokenPaid[account] = rewardPerTokenStored;\n }\n\n function _restartRewards() internal {\n if (rewardCalculator != IRewardCalculator(address(0))) {\n // Distribute the accumulated rewards\n rewardPerTokenStored = rewardPerTokenStored + _rewardPerToken();\n // restart rewards so now the rewardCalculator return zero rewards\n rewardCalculator.restartRewards();\n }\n }\n\n function _earned(address account, uint256 rewardPerToken_) internal view returns (uint256) {\n // - userRewardPerTokenPaid[account] * _contributions[account] / _totalContributions is the portion of\n // rewards the last time the user changed his contribution and called _restartRewards\n // (_totalContributions corresponds to previous value of that moment).\n // - rewardPerTokenStored * _contributions[account] is the share of the user from the\n // accumulated rewards (from the start of time until the last call to _restartRewards) with the\n // current value of _totalContributions\n // - _rewardPerToken() * _contributions[account] / _totalContributions is the share of the user of the\n // rewards from the last time anybody called _restartRewards until this moment\n //\n // The important thing to note is that at any moment in time _contributions[account] / _totalContributions is\n // the share of the user even if _totalContributions changes because of other users activity.\n return\n ((rewardPerToken_ + rewardPerTokenStored - userRewardPerTokenPaid[account]) * _contributions[account]) /\n 1e24;\n }\n\n // This function gives the proportion of the total contribution that corresponds to each user from\n // last restartRewards call.\n // _rewardsPerToken() * _contributions[account] is the amount of extra rewards gained from last restartRewards.\n function _rewardPerToken() internal view returns (uint256) {\n if (rewardCalculator == IRewardCalculator(address(0)) || _totalContributions == 0) {\n return 0;\n }\n return (rewardCalculator.getRewards() * 1e24) / _totalContributions;\n }\n\n // @dev Triggers stopped state.\n // The contract must not be paused.\n function pause() external onlyOwner {\n _pause();\n }\n\n // @dev Returns to normal state.\n // The contract must be paused.\n function unpause() external onlyOwner {\n _unpause();\n }\n\n function _msgSender() internal view override(Context, ERC2771HandlerV2) returns (address sender) {\n return ERC2771HandlerV2._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC2771HandlerV2) returns (bytes calldata) {\n return ERC2771HandlerV2._msgData();\n }\n}\n" + }, + "src/solc_0.8/defi/ERC20RewardPoolV2.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Context} from \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport {IERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts-0.8/security/ReentrancyGuard.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {Pausable} from \"@openzeppelin/contracts-0.8/security/Pausable.sol\";\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport {Math} from \"@openzeppelin/contracts-0.8/utils/math/Math.sol\";\nimport {ERC2771HandlerV3} from \"../common/BaseWithStorage/ERC2771HandlerV3.sol\";\nimport {StakeTokenWrapperV2} from \"./StakeTokenWrapperV2.sol\";\nimport {IContributionRules} from \"./interfaces/IContributionRules.sol\";\nimport {IRewardCalculator} from \"./interfaces/IRewardCalculator.sol\";\nimport {LockRulesV2} from \"./rules-v2/LockRulesV2.sol\";\nimport {RequirementsRulesV2} from \"./rules-v2/RequirementsRulesV2.sol\";\n\n/// @title A pool that distributes rewards between users that stake any erc20 token\n/// @notice The contributions are updated passively, an external call to computeContribution from a backend is needed.\n/// @notice After initialization the reward calculator must be set by the admin.\n/// @dev The contract has two plugins that affect the behaviour: contributionCalculator and rewardCalculator\n/// @dev contributionCalculator instead of using the stake directly the result of computeContribution is used\n/// @dev this way some users can get an extra share of the rewards\n/// @dev rewardCalculator is used to manage the rate at which the rewards are distributed.\n/// @dev This way we can build different types of pools by mixing in the plugins we want with this contract.\n/// @dev default behaviour (address(0)) for contributionCalculator is to use the stacked amount as contribution.\n/// @dev default behaviour (address(0)) for rewardCalculator is that no rewards are given\ncontract ERC20RewardPoolV2 is\n Ownable,\n StakeTokenWrapperV2,\n LockRulesV2,\n RequirementsRulesV2,\n ReentrancyGuard,\n ERC2771HandlerV3,\n Pausable\n{\n using SafeERC20 for IERC20;\n using Address for address;\n\n event RewardTokenSet(address indexed contractAddress);\n event StakeTokenSet(address indexed contractAddress);\n event TrustedForwarderSet(address indexed trustedForwarder);\n event ContributionRulesSet(address indexed contractAddress);\n event RewardCalculatorSet(address indexed contractAddress, bool restartRewards_);\n event FundsRecovered(address indexed receiver, uint256 recoverAmount);\n event Staked(address indexed account, uint256 stakeAmount);\n event Withdrawn(address indexed account, uint256 stakeAmount);\n event Exit(address indexed account);\n event RewardPaid(address indexed account, uint256 rewardAmount);\n event ContributionUpdated(address indexed account, uint256 newContribution, uint256 oldContribution);\n\n uint256 private constant DECIMALS_18 = 1 ether;\n\n // This value multiplied by the user contribution is the share of accumulated rewards (from the start of time\n // until the last call to restartRewards) for the user taking into account the value of totalContributions.\n uint256 public rewardPerTokenStored;\n\n IERC20 public rewardToken;\n IContributionRules public contributionRules;\n IRewardCalculator public rewardCalculator;\n\n // This value multiplied by the user contribution is the share of reward from the the last time\n // the user changed his contribution and called restartRewards\n mapping(address => uint256) public userRewardPerTokenPaid;\n\n // This value is the accumulated rewards won by the user when he called the contract.\n mapping(address => uint256) public rewards;\n\n uint256 internal _totalContributions;\n mapping(address => uint256) internal _contributions;\n\n constructor(\n IERC20 stakeToken_,\n IERC20 rewardToken_,\n address trustedForwarder\n ) StakeTokenWrapperV2(stakeToken_) {\n require(address(rewardToken_).isContract(), \"ERC20RewardPool: is not a contract\");\n rewardToken = rewardToken_;\n __ERC2771HandlerV3_initialize(trustedForwarder);\n }\n\n modifier isValidAddress(address account) {\n require(account != address(0), \"ERC20RewardPool: zero address\");\n\n _;\n }\n\n /// @notice set the reward token\n /// @param contractAddress address token used to pay rewards\n function setRewardToken(address contractAddress)\n external\n isContract(contractAddress)\n isValidAddress(contractAddress)\n onlyOwner\n {\n IERC20 _newRewardToken = IERC20(contractAddress);\n require(\n rewardToken.balanceOf(address(this)) <= _newRewardToken.balanceOf(address(this)),\n \"ERC20RewardPool: insufficient balance\"\n );\n rewardToken = _newRewardToken;\n\n emit RewardTokenSet(contractAddress);\n }\n\n /// @notice set the stake token\n /// @param contractAddress address token used to stake funds\n function setStakeToken(address contractAddress)\n external\n isContract(contractAddress)\n isValidAddress(contractAddress)\n onlyOwner\n {\n IERC20 _newStakeToken = IERC20(contractAddress);\n require(\n _stakeToken.balanceOf(address(this)) <= _newStakeToken.balanceOf(address(this)),\n \"ERC20RewardPool: insufficient balance\"\n );\n _stakeToken = _newStakeToken;\n\n emit StakeTokenSet(contractAddress);\n }\n\n /// @notice set the trusted forwarder\n /// @param trustedForwarder address of the contract that is enabled to send meta-tx on behalf of the user\n function setTrustedForwarder(address trustedForwarder) external isContract(trustedForwarder) onlyOwner {\n _trustedForwarder = trustedForwarder;\n\n emit TrustedForwarderSet(trustedForwarder);\n }\n\n /// @notice set contract that contains all the contribution rules\n function setContributionRules(address contractAddress)\n external\n isContract(contractAddress)\n isValidAddress(contractAddress)\n onlyOwner\n {\n contributionRules = IContributionRules(contractAddress);\n\n emit ContributionRulesSet(contractAddress);\n }\n\n /// @notice set the reward calculator\n /// @param contractAddress address of a plugin that calculates absolute rewards at any point in time\n /// @param restartRewards_ if true the rewards from the previous calculator are accumulated before changing it\n function setRewardCalculator(address contractAddress, bool restartRewards_)\n external\n isContract(contractAddress)\n isValidAddress(contractAddress)\n onlyOwner\n {\n // We process the rewards of the current reward calculator before the switch.\n if (restartRewards_) {\n _restartRewards();\n }\n rewardCalculator = IRewardCalculator(contractAddress);\n\n emit RewardCalculatorSet(contractAddress, restartRewards_);\n }\n\n /// @notice the admin recover is able to recover reward funds\n /// @param receiver address of the beneficiary of the recovered funds\n /// @dev this function must be called in an emergency situation only.\n /// @dev Calling it is risky specially when rewardToken == stakeToken\n function recoverFunds(address receiver) external onlyOwner whenPaused() isValidAddress(receiver) {\n uint256 recoverAmount;\n\n if (rewardToken == _stakeToken) {\n recoverAmount = rewardToken.balanceOf(address(this)) - _totalSupply;\n } else {\n recoverAmount = rewardToken.balanceOf(address(this));\n }\n\n rewardToken.safeTransfer(receiver, recoverAmount);\n\n emit FundsRecovered(receiver, recoverAmount);\n }\n\n /// @notice return the total supply of staked tokens\n /// @return the total supply of staked tokens\n function totalSupply() external view returns (uint256) {\n return _totalSupply;\n }\n\n /// @notice return the balance of staked tokens for a user\n /// @param account the address of the account\n /// @return balance of staked tokens\n function balanceOf(address account) external view returns (uint256) {\n return _balances[account];\n }\n\n /// @notice return the address of the stake token contract\n /// @return address of the stake token contract\n function stakeToken() external view returns (IERC20) {\n return _stakeToken;\n }\n\n /// @notice return the amount of rewards deposited in the contract that can be distributed by different campaigns\n /// @return the total amount of deposited rewards\n /// @dev this function can be called by a reward calculator to throw if a campaign doesn't have\n /// @dev enough rewards to start\n function getRewardsAvailable() public view returns (uint256) {\n if (address(rewardToken) != address(_stakeToken)) {\n return rewardToken.balanceOf(address(this));\n }\n return rewardToken.balanceOf(address(this)) - _totalSupply;\n }\n\n /// @notice return the sum of the values returned by the contribution calculator\n /// @return total contributions of the users\n /// @dev this is the same than the totalSupply only if the contribution calculator\n /// @dev uses the staked amount as the contribution of the user which is the default behaviour\n function totalContributions() external view returns (uint256) {\n return _totalContributions;\n }\n\n /// @notice return the contribution of some user\n /// @param account the address of the account\n /// @return contribution of the users\n /// @dev this is the same than the balanceOf only if the contribution calculator\n /// @dev uses the staked amount as the contribution of the user which is the default behaviour\n function contributionOf(address account) external view returns (uint256) {\n return _contributions[account];\n }\n\n /// @notice accumulated rewards taking into account the totalContribution (see: rewardPerTokenStored)\n /// @return the accumulated total rewards\n /// @dev This value multiplied by the user contribution is the share of accumulated rewards for the user. Taking\n /// @dev into account the value of totalContributions.\n function rewardPerToken() external view returns (uint256) {\n return rewardPerTokenStored + _rewardPerToken();\n }\n\n /// @notice available earnings for some user\n /// @param account the address of the account\n /// @return the available earnings for the user\n function earned(address account) external view returns (uint256) {\n return rewards[account] + _earned(account, _rewardPerToken());\n }\n\n /// @notice accumulates the current rewards into rewardPerTokenStored and restart the reward calculator\n /// @dev calling this function makes no difference. It is useful for testing and when the reward calculator\n /// @dev is changed.\n function restartRewards() external {\n _restartRewards();\n }\n\n /// @notice update the contribution for a user\n /// @param account the address of the account\n /// @dev if the user change his holdings (or any other parameter that affect the contribution calculation),\n /// @dev he can the reward distribution to his favor. This function must be called by an external agent ASAP to\n /// @dev update the contribution for the user. We understand the risk but the rewards are distributed slowly so\n /// @dev the user cannot affect the reward distribution heavily.\n function computeContribution(address account) external isValidAddress(account) {\n // We decide to give the user the accumulated rewards even if he cheated a little bit.\n _processRewards(account);\n _updateContribution(account);\n }\n\n /// @notice update the contribution for a sef of users\n /// @param accounts the addresses of the accounts to update\n /// @dev see: computeContribution\n function computeContributionInBatch(address[] calldata accounts) external {\n _restartRewards();\n for (uint256 i; i < accounts.length; ) {\n address account = accounts[i];\n if (account == address(0)) {\n continue;\n }\n _processAccountRewards(account);\n _updateContribution(account);\n\n unchecked {i++;}\n }\n }\n\n /// @notice stake some amount into the contract\n /// @param amount the amount of tokens to stake\n /// @dev the user must approve in the stake token before calling this function\n function stake(uint256 amount)\n external\n nonReentrant\n whenNotPaused()\n antiDepositCheck(_msgSender())\n checkRequirements(_msgSender(), amount, _balances[_msgSender()])\n {\n require(amount > 0, \"ERC20RewardPool: Cannot stake 0\");\n\n address _sender = _msgSender();\n\n // The first time a user stakes he cannot remove his rewards immediately.\n if (timeLockClaim.lastClaim[_sender] == 0) {\n timeLockClaim.lastClaim[_sender] = block.timestamp;\n }\n\n uint256 earlierRewards;\n\n if (_totalContributions == 0 && rewardCalculator != IRewardCalculator(address(0))) {\n earlierRewards = rewardCalculator.getRewards();\n }\n\n _processRewards(_sender);\n super._stake(amount);\n _updateContribution(_sender);\n require(_contributions[_sender] > 0, \"ERC20RewardPool: not enough contributions\");\n\n if (earlierRewards != 0) {\n rewards[_sender] = rewards[_sender] + earlierRewards;\n }\n emit Staked(_sender, amount);\n }\n\n /// @notice withdraw the stake from the contract\n /// @param amount the amount of tokens to withdraw\n /// @dev the user can withdraw his stake independently from the rewards\n function withdraw(uint256 amount) external nonReentrant whenNotPaused() {\n address _sender = _msgSender();\n\n _processRewards(_sender);\n _withdrawStake(_sender, amount);\n _updateContribution(_sender);\n }\n\n /// @notice withdraw the stake and the rewards from the contract\n function exit() external nonReentrant whenNotPaused() {\n address _sender = _msgSender();\n\n _processRewards(_sender);\n _withdrawStake(_sender, _balances[_sender]);\n _withdrawRewards(_sender);\n _updateContribution(_sender);\n emit Exit(_sender);\n }\n\n /// @notice withdraw the rewards from the contract\n /// @dev the user can withdraw his stake independently from the rewards\n function getReward() external nonReentrant whenNotPaused() {\n address _sender = _msgSender();\n\n _processRewards(_sender);\n _withdrawRewards(_sender);\n _updateContribution(_sender);\n }\n\n /// @notice as admin powers are really important in this contract\n /// we're overriding the renounceOwnership method to avoid losing rights\n function renounceOwnership() public view override onlyOwner {\n revert(\"ERC20RewardPool: can't renounceOwnership\");\n }\n\n function _withdrawStake(address account, uint256 amount) internal antiWithdrawCheck(_msgSender()) {\n require(amount > 0, \"ERC20RewardPool: Cannot withdraw 0\");\n super._withdraw(amount);\n emit Withdrawn(account, amount);\n }\n\n function _withdrawRewards(address account) internal timeLockClaimCheck(account) {\n uint256 reward = rewards[account];\n uint256 mod;\n if (reward > 0) {\n if (amountLockClaim.claimLockEnabled == true) {\n // constrain the reward amount to the integer allowed\n mod = reward % DECIMALS_18;\n reward -= mod;\n require(\n amountLockClaim.amount <= reward,\n \"ERC20RewardPool: Cannot withdraw - lockClaim.amount < reward\"\n );\n }\n require(reward <= getRewardsAvailable(), \"ERC20RewardPool: not enough rewards\");\n rewards[account] = mod;\n rewardToken.safeTransfer(account, reward);\n emit RewardPaid(account, reward);\n }\n }\n\n function _updateContribution(address account) internal {\n uint256 oldContribution = _contributions[account];\n _totalContributions -= oldContribution;\n uint256 contribution = _computeContribution(account);\n _totalContributions += contribution;\n _contributions[account] = contribution;\n emit ContributionUpdated(account, contribution, oldContribution);\n }\n\n function _computeContribution(address account) internal returns (uint256) {\n if (contributionRules == IContributionRules(address(0))) {\n return Math.min(_balances[account], maxStakeAllowedCalculator(account));\n } else {\n return\n contributionRules.computeMultiplier(\n account,\n Math.min(_balances[account], maxStakeAllowedCalculator(account))\n );\n }\n }\n\n // Something changed (stake, withdraw, etc), we distribute current accumulated rewards and start from zero.\n // Called each time there is a change in contract state (stake, withdraw, etc).\n function _processRewards(address account) internal {\n _restartRewards();\n _processAccountRewards(account);\n }\n\n // Update the earnings for this specific user with what he earned until now\n function _processAccountRewards(address account) internal {\n // usually _earned takes _rewardPerToken() but in this method is zero because _restartRewards must be\n // called before _processAccountRewards\n rewards[account] = rewards[account] + _earned(account, 0);\n // restart rewards for this specific user, now earned(account) = 0\n userRewardPerTokenPaid[account] = rewardPerTokenStored;\n }\n\n function _restartRewards() internal {\n if (rewardCalculator != IRewardCalculator(address(0))) {\n // Distribute the accumulated rewards\n rewardPerTokenStored = rewardPerTokenStored + _rewardPerToken();\n // restart rewards so now the rewardCalculator return zero rewards\n rewardCalculator.restartRewards();\n }\n }\n\n function _earned(address account, uint256 rewardPerToken_) internal view returns (uint256) {\n // - userRewardPerTokenPaid[account] * _contributions[account] / _totalContributions is the portion of\n // rewards the last time the user changed his contribution and called _restartRewards\n // (_totalContributions corresponds to previous value of that moment).\n // - rewardPerTokenStored * _contributions[account] is the share of the user from the\n // accumulated rewards (from the start of time until the last call to _restartRewards) with the\n // current value of _totalContributions\n // - _rewardPerToken() * _contributions[account] / _totalContributions is the share of the user of the\n // rewards from the last time anybody called _restartRewards until this moment\n //\n // The important thing to note is that at any moment in time _contributions[account] / _totalContributions is\n // the share of the user even if _totalContributions changes because of other users activity.\n return\n ((rewardPerToken_ + rewardPerTokenStored - userRewardPerTokenPaid[account]) * _contributions[account]) /\n 1e24;\n }\n\n // This function gives the proportion of the total contribution that corresponds to each user from\n // last restartRewards call.\n // _rewardsPerToken() * _contributions[account] is the amount of extra rewards gained from last restartRewards.\n function _rewardPerToken() internal view returns (uint256) {\n if (rewardCalculator == IRewardCalculator(address(0)) || _totalContributions == 0) {\n return 0;\n }\n return (rewardCalculator.getRewards() * 1e24) / _totalContributions;\n }\n\n /// @dev Triggers stopped state.\n /// The contract must not be paused.\n function pause() external onlyOwner {\n _pause();\n }\n\n /// @dev Returns to normal state.\n /// The contract must be paused.\n function unpause() external onlyOwner {\n _unpause();\n }\n\n function _msgSender() internal view override(Context, ERC2771HandlerV3) returns (address) {\n return ERC2771HandlerV3._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC2771HandlerV3) returns (bytes calldata) {\n return ERC2771HandlerV3._msgData();\n }\n}\n" + }, + "src/solc_0.8/defi/interfaces/IContributionCalculator.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\n/// @title Plugins for the SandRewardPool that calculate the contributions must implement this interface\ninterface IContributionCalculator {\n /// @notice based on the user stake and address calculate the contribution\n /// @param account address of the user that is staking tokens\n /// @param amountStaked the amount of tokens stacked\n function computeContribution(address account, uint256 amountStaked) external returns (uint256);\n}\n" + }, + "src/solc_0.8/defi/interfaces/IContributionRules.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\n/// @title Plugins for the ERC20RewardPool that calculates the contributions (multipliers) must implement this interface\ninterface IContributionRules {\n /// @notice based on the user stake and address apply the contribution rules\n /// @param account address of the user that is staking tokens\n /// @param amountStaked the amount of tokens stacked\n function computeMultiplier(address account, uint256 amountStaked) external returns (uint256);\n}\n" + }, + "src/solc_0.8/defi/interfaces/IRewardCalculator.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\n/// @title Plugins for Reward Pools that calculate the rewards must implement this interface\ninterface IRewardCalculator {\n /// @dev At any point in time this function must return the accumulated rewards from the last call to restartRewards\n function getRewards() external view returns (uint256);\n\n /// @dev The main contract has distributed the rewards (getRewards()) until this point, this must start\n /// @dev from scratch => getRewards() == 0\n function restartRewards() external;\n}\n" + }, + "src/solc_0.8/defi/rewardCalculation/PeriodicRewardCalculator.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Math} from \"@openzeppelin/contracts-0.8/utils/math/Math.sol\";\nimport {AccessControl} from \"@openzeppelin/contracts-0.8/access/AccessControl.sol\";\nimport {IRewardCalculator} from \"../interfaces/IRewardCalculator.sol\";\n\n/*\n This contract calculate rewards linearly from the call to notifyRewardAmount until periodFinish\n if restartRewards is called in the middle with a nonzero contribution rewards are\n restarted (the main contract distribute the rewards at that point in time before calling)\n at the end of the period all the accumulated rewards (including those when restartRewards was called) are given.\n*/\ncontract PeriodicRewardCalculator is IRewardCalculator, AccessControl {\n event RewardAdded(uint256 reward);\n\n // This role is in charge of configuring reward distribution\n bytes32 public constant REWARD_DISTRIBUTION = keccak256(\"REWARD_DISTRIBUTION\");\n // Each time a parameter that affects the reward distribution is changed the rewards are distributed by the reward\n // pool contract this is the restart time.\n uint256 public lastUpdateTime;\n // This is the end of the period in which rewards are distributed\n uint256 public periodFinish;\n // Rewards are distributed at a fixed rate => reward = rewardRate * time\n uint256 public rewardRate;\n // The duration of the distribution period\n uint256 public duration;\n // This variable is only used when a new campaign starts (notifyRewardAmount is called)\n // We need to save the rewards accumulated between the last call to restartRewards and the call to notifyRewardAmount\n uint256 public savedRewards;\n // The address of the reward pool, the only one authorized to restart rewards\n address public immutable rewardPool;\n\n constructor(address rewardPool_, uint256 duration_) {\n rewardPool = rewardPool_;\n duration = duration_;\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n }\n\n function setDuration(uint256 newDuration) external {\n require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), \"PeriodicRewardCalculator: not admin\");\n require(block.timestamp >= periodFinish, \"PeriodicRewardCalculator: campaign already started\");\n\n duration = newDuration;\n }\n\n // At any point in time this function must return the accumulated rewards from last call to restartRewards\n function getRewards() external view override returns (uint256) {\n return savedRewards + _getRewards();\n }\n\n // The main contract has distributed the rewards until this point, this must start from scratch => getRewards() == 0\n function restartRewards() external override {\n require(msg.sender == rewardPool, \"PeriodicRewardCalculator: not reward pool\");\n // ensure reward past the first stacker do not get lost\n lastUpdateTime = _lastTimeRewardApplicable();\n savedRewards = 0;\n }\n\n // Useful when switching reward calculators to set an initial reward.\n function setSavedRewards(uint256 reward) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"PeriodicRewardCalculator: not reward distribution\");\n savedRewards = reward;\n lastUpdateTime = block.timestamp;\n }\n\n function lastTimeRewardApplicable() external view returns (uint256) {\n return _lastTimeRewardApplicable();\n }\n\n ///@notice to be called after the amount of reward tokens (specified by the reward parameter) has been sent to the contract\n // Note that the reward should be divisible by the duration to avoid reward token lost\n // When calling this function with remaining>0 then reward + leftover must be divisible by duration (which can be problematic)\n ///@param reward number of token to be distributed over the duration\n function notifyRewardAmount(uint256 reward) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"PeriodicRewardCalculator: not reward distribution\");\n savedRewards = _getRewards();\n lastUpdateTime = block.timestamp;\n if (block.timestamp >= periodFinish) {\n rewardRate = reward / duration;\n } else {\n uint256 remaining = periodFinish - block.timestamp;\n uint256 leftover = remaining * rewardRate;\n rewardRate = (reward + leftover) / duration;\n }\n periodFinish = block.timestamp + duration;\n emit RewardAdded(reward);\n }\n\n function _getRewards() internal view returns (uint256) {\n return (_lastTimeRewardApplicable() - lastUpdateTime) * rewardRate;\n }\n\n function _lastTimeRewardApplicable() internal view returns (uint256) {\n return Math.min(block.timestamp, periodFinish);\n }\n}\n" + }, + "src/solc_0.8/defi/rewardCalculation/TwoPeriodsRewardCalculator.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Math} from \"@openzeppelin/contracts-0.8/utils/math/Math.sol\";\nimport {AccessControl} from \"@openzeppelin/contracts-0.8/access/AccessControl.sol\";\nimport {IRewardCalculator} from \"../interfaces/IRewardCalculator.sol\";\n\ncontract TwoPeriodsRewardCalculator is IRewardCalculator, AccessControl {\n event InitialCampaign(\n uint256 reward,\n uint256 duration,\n uint256 finish1,\n uint256 rate1,\n uint256 finish2,\n uint256 rate2\n );\n event NextCampaign(\n uint256 reward,\n uint256 duration,\n uint256 finish1,\n uint256 rate1,\n uint256 finish2,\n uint256 rate2\n );\n event UpdateCampaign(\n uint256 reward,\n uint256 duration,\n uint256 finish1,\n uint256 rate1,\n uint256 finish2,\n uint256 rate2\n );\n\n // This role is in charge of configuring reward distribution\n bytes32 public constant REWARD_DISTRIBUTION = keccak256(\"REWARD_DISTRIBUTION\");\n // Each time a parameter that affects the reward distribution is changed the rewards are distributed by the reward\n // pool contract this is the restart time.\n uint256 public lastUpdateTime;\n // This variable is only used when a new campaign starts (notifyRewardAmount is called)\n // We need to save the rewards accumulated between the last call to restartRewards and the call to notifyRewardAmount\n uint256 public savedRewards;\n // The reward distribution is divided in two periods with two different rated\n // | | |************|*\n // | | **| |*\n // | | ** | |*\n // | | ** | |*\n // | | ** | |*\n // | | ** | |*\n // | |** | |*\n // | ****| | |*\n // | **** | | |*\n // |**** | | |*\n // zero -> **********| | | |********************\n // |<-perido1-> |<-period2-> |<-restart-> |\n uint256 public finish1;\n uint256 public rate1;\n uint256 public finish2;\n uint256 public rate2;\n\n // The address of the reward pool, the only one authorized to restart rewards\n address public immutable rewardPool;\n\n constructor(address rewardPool_) {\n rewardPool = rewardPool_;\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n }\n\n // For the UI\n function getRate() external view returns (uint256) {\n return rate1;\n }\n\n // For the UI\n function getFinish() external view returns (uint256) {\n return finish1;\n }\n\n // At any point in time this function must return the accumulated rewards from last call to restartRewards\n function getRewards() external view override returns (uint256) {\n return savedRewards + _getRewards();\n }\n\n // The main contract has distributed the rewards until this point, this must start from scratch => getRewards() == 0\n function restartRewards() external override {\n require(msg.sender == rewardPool, \"not reward pool\");\n lastUpdateTime = block.timestamp;\n savedRewards = 0;\n }\n\n // Useful when switching reward calculators to set an initial reward.\n function setSavedRewards(uint256 reward) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n savedRewards = reward;\n lastUpdateTime = block.timestamp;\n }\n\n // This is a helper function, it is better to call setInitialCampaign or updateNextCampaign directly\n function runCampaign(uint256 reward, uint256 duration) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n if (block.timestamp >= finish2) {\n _initialCampaign(reward, duration);\n } else {\n _updateNextCampaign(reward, duration);\n }\n }\n\n // Start an initial campaign, set the period1 of reward distribution, period2 rate is zero\n function setInitialCampaign(uint256 reward, uint256 duration) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n require(block.timestamp >= finish2, \"initial campaign running\");\n _initialCampaign(reward, duration);\n }\n\n // Update the period2 of rate distribution, must be called after an initial campaign is set\n // If period1 is running, period2 is set with the rate reward/duration.\n // If period1 is finished it is updated with the values of period2 and period2 is set with the rate reward/duration.\n function updateNextCampaign(uint256 reward, uint256 duration) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n require(block.timestamp < finish2, \"initial campaign not running\");\n _updateNextCampaign(reward, duration);\n }\n\n function updateCurrentCampaign(uint256 reward, uint256 duration) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n require(block.timestamp < finish2, \"initial campaign not running\");\n _updateCurrentCampaign(reward, duration);\n }\n\n // Check if both periods already ended => campaign is finished\n function isCampaignFinished() external view returns (bool) {\n return (block.timestamp >= finish2);\n }\n\n // Check if some of the periods are still running\n function isCampaignRunning() external view returns (bool) {\n return (block.timestamp < finish2);\n }\n\n function _initialCampaign(uint256 reward, uint256 duration) internal {\n // block.timestamp >= finish2\n _saveRewards();\n finish1 = block.timestamp + duration;\n rate1 = reward / duration;\n finish2 = block.timestamp + duration;\n rate2 = 0;\n emit InitialCampaign(reward, duration, finish1, rate1, finish2, rate2);\n }\n\n function _updateNextCampaign(uint256 reward, uint256 duration) internal {\n // block.timestamp < finish2\n _saveRewards();\n if (block.timestamp >= finish1) {\n // The next campaign is new.\n finish1 = finish2;\n rate1 = rate2;\n }\n finish2 = finish1 + duration;\n rate2 = reward / duration;\n emit NextCampaign(reward, duration, finish1, rate1, finish2, rate2);\n }\n\n // TODO: we need to check the logic for this one, what to do with the remainder rewards and the next campaign duration ?\n // TODO: Right now we restart the current campaign forgetting the old values and leaving next one untouched.\n function _updateCurrentCampaign(uint256 reward, uint256 duration) internal {\n _saveRewards();\n if (block.timestamp >= finish1) {\n // The next campaign is new.\n finish1 = finish2;\n rate1 = rate2;\n rate2 = 0;\n }\n assert(finish1 <= finish2);\n uint256 duration2 = finish2 - finish1;\n finish1 = block.timestamp + duration;\n finish2 = finish1 + duration2;\n rate1 = reward / duration;\n emit UpdateCampaign(reward, duration, finish1, rate1, finish2, rate2);\n }\n\n function _saveRewards() internal {\n savedRewards = savedRewards + _getRewards();\n lastUpdateTime = block.timestamp;\n }\n\n function _getRewards() internal view returns (uint256) {\n assert(lastUpdateTime <= block.timestamp);\n assert(finish1 <= finish2);\n if (lastUpdateTime >= finish2) {\n return 0;\n }\n if (block.timestamp <= finish1) {\n return (block.timestamp - lastUpdateTime) * rate1;\n }\n // block.timestamp > finish1\n uint256 rewards2 = (Math.min(block.timestamp, finish2) - Math.max(lastUpdateTime, finish1)) * rate2;\n if (lastUpdateTime < finish1) {\n // add reward1 + reward2\n return (finish1 - lastUpdateTime) * rate1 + rewards2;\n }\n return rewards2;\n }\n}\n" + }, + "src/solc_0.8/defi/rewardCalculation/TwoPeriodsRewardCalculatorV2.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Math} from \"@openzeppelin/contracts-0.8/utils/math/Math.sol\";\nimport {AccessControl} from \"@openzeppelin/contracts-0.8/access/AccessControl.sol\";\nimport {IRewardCalculator} from \"../interfaces/IRewardCalculator.sol\";\n\n/// @notice This contract has two periods and two corresponding rates and durations. After an initial call\n/// that sets the first period duration and rate another call can be done to set the duration and rate\n/// for the next period. When the first period finishes, the next period becomes the current one, and\n/// then the parameters for the future next period can be set again. This way the rate for the next\n/// period can be set at any moment.\ncontract TwoPeriodsRewardCalculatorV2 is IRewardCalculator, AccessControl {\n event InitialCampaign(\n uint256 reward,\n uint256 duration,\n uint256 finish1,\n uint256 rate1,\n uint256 finish2,\n uint256 rate2\n );\n event NextCampaign(\n uint256 reward,\n uint256 duration,\n uint256 finish1,\n uint256 rate1,\n uint256 finish2,\n uint256 rate2\n );\n event UpdateCampaign(\n uint256 reward,\n uint256 duration,\n uint256 finish1,\n uint256 rate1,\n uint256 finish2,\n uint256 rate2\n );\n\n event SavedRewardsSet(uint256 indexed reward);\n\n // This role is in charge of configuring reward distribution\n bytes32 public constant REWARD_DISTRIBUTION = keccak256(\"REWARD_DISTRIBUTION\");\n // Each time a parameter that affects the reward distribution is changed the rewards are distributed by the reward\n // pool contract this is the restart time.\n uint256 public lastUpdateTime;\n // This variable is only used when a new campaign starts (notifyRewardAmount is called)\n // We need to save the rewards accumulated between the last call to restartRewards and the call to notifyRewardAmount\n uint256 public savedRewards;\n // The reward distribution is divided in two periods with two different rated\n // | | |************|*\n // | | **| |*\n // | | ** | |*\n // | | ** | |*\n // | | ** | |*\n // | | ** | |*\n // | |** | |*\n // | ****| | |*\n // | **** | | |*\n // |**** | | |*\n // zero -> **********| | | |********************\n // |<-period1-> |<-period2-> |<-restart-> |\n uint256 public finish1;\n uint256 public rate1;\n uint256 public finish2;\n uint256 public rate2;\n\n // The address of the reward pool, the only one authorized to restart rewards\n address public immutable rewardPool;\n\n constructor(address rewardPool_) {\n rewardPool = rewardPool_;\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n }\n\n /// @notice For the UI\n function getRate() external view returns (uint256) {\n if (isCampaignFinished()) {\n return 0;\n } else if (block.timestamp >= finish1) {\n return rate2;\n } else {\n return rate1;\n }\n }\n\n /// @notice For the UI\n function getFinish() external view returns (uint256) {\n if (isCampaignFinished()) {\n return 0;\n } else if (block.timestamp >= finish1) {\n return finish2;\n } else {\n return finish1;\n }\n }\n\n /// @notice At any point in time this function must return the accumulated rewards from last call to restartRewards\n function getRewards() external view override returns (uint256) {\n return savedRewards + _getRewards();\n }\n\n /// @notice The main contract has distributed the rewards until this point, this must start from scratch => getRewards() == 0\n function restartRewards() external override {\n require(msg.sender == rewardPool, \"not reward pool\");\n lastUpdateTime = block.timestamp;\n savedRewards = 0;\n }\n\n /// @notice Useful when switching reward calculators to set an initial reward.\n function setSavedRewards(uint256 reward) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n savedRewards = reward;\n lastUpdateTime = block.timestamp;\n\n emit SavedRewardsSet(reward);\n }\n\n /// @notice This is a helper function, it is better to call setInitialCampaign or updateNextCampaign directly\n function runCampaign(uint256 reward, uint256 duration) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n if (block.timestamp >= finish2) {\n _initialCampaign(reward, duration);\n } else {\n _updateNextCampaign(reward, duration);\n }\n }\n\n /// @notice Start an initial campaign, set the period1 of reward distribution, period2 rate is zero\n function setInitialCampaign(uint256 reward, uint256 duration) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n require(block.timestamp >= finish2, \"initial campaign running\");\n _initialCampaign(reward, duration);\n }\n\n /// @notice Update the period2 of rate distribution, must be called after an initial campaign is set\n /// If period1 is running, period2 is set with the rate reward/duration.\n /// If period1 is finished it is updated with the values of period2 and period2 is set with the rate reward/duration.\n function updateNextCampaign(uint256 reward, uint256 duration) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n require(block.timestamp < finish2, \"initial campaign not running\");\n _updateNextCampaign(reward, duration);\n }\n\n /// @notice Update the period1 (current campaign) of rate distribution, must be called after an initial campaign is set\n function updateCurrentCampaign(uint256 reward, uint256 duration) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n require(block.timestamp < finish2, \"initial campaign not running\");\n _updateCurrentCampaign(reward, duration);\n }\n\n // Check if both periods already ended => campaign is finished\n function isCampaignFinished() public view returns (bool) {\n return (block.timestamp >= finish2);\n }\n\n /// @notice Check if some of the periods are still running\n function isCampaignRunning() external view returns (bool) {\n return (block.timestamp < finish2);\n }\n\n function _initialCampaign(uint256 reward, uint256 duration) internal {\n // block.timestamp >= finish2\n _saveRewards();\n finish1 = block.timestamp + duration;\n rate1 = reward / duration;\n finish2 = block.timestamp + duration;\n rate2 = 0;\n emit InitialCampaign(reward, duration, finish1, rate1, finish2, rate2);\n }\n\n function _updateNextCampaign(uint256 reward, uint256 duration) internal {\n // block.timestamp < finish2\n _saveRewards();\n if (block.timestamp >= finish1) {\n // The next campaign is new.\n finish1 = finish2;\n rate1 = rate2;\n }\n finish2 = finish1 + duration;\n rate2 = reward / duration;\n emit NextCampaign(reward, duration, finish1, rate1, finish2, rate2);\n }\n\n // TODO: we need to check the logic for this one, what to do with the remainder rewards and the next campaign duration ?\n // TODO: Right now we restart the current campaign forgetting the old values and leaving next one untouched.\n function _updateCurrentCampaign(uint256 reward, uint256 duration) internal {\n _saveRewards();\n if (block.timestamp >= finish1) {\n // The next campaign is new.\n finish1 = finish2;\n rate1 = rate2;\n rate2 = 0;\n }\n assert(finish1 <= finish2);\n uint256 duration2 = finish2 - finish1;\n finish1 = block.timestamp + duration;\n finish2 = finish1 + duration2;\n rate1 = reward / duration;\n emit UpdateCampaign(reward, duration, finish1, rate1, finish2, rate2);\n }\n\n function _saveRewards() internal {\n savedRewards = savedRewards + _getRewards();\n lastUpdateTime = block.timestamp;\n }\n\n function _getRewards() internal view returns (uint256) {\n assert(lastUpdateTime <= block.timestamp);\n assert(finish1 <= finish2);\n if (lastUpdateTime >= finish2) {\n return 0;\n }\n if (block.timestamp <= finish1) {\n return (block.timestamp - lastUpdateTime) * rate1;\n }\n // block.timestamp > finish1\n uint256 rewards2 = (Math.min(block.timestamp, finish2) - Math.max(lastUpdateTime, finish1)) * rate2;\n if (lastUpdateTime < finish1) {\n // add reward1 + reward2\n return (finish1 - lastUpdateTime) * rate1 + rewards2;\n }\n return rewards2;\n }\n}\n" + }, + "src/solc_0.8/defi/rules-v2/ContributionRulesV2.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {SafeMathWithRequire} from \"../../common/Libraries/SafeMathWithRequire.sol\";\nimport {IERC721} from \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\nimport {IERC1155} from \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\nimport {IContributionRules} from \"../interfaces/IContributionRules.sol\";\n\n/// @notice The contribution rules is a plugin contract that takes the amount staked and the address of\n/// the user and returns the absolute share (contribution) that the user will get from the total rewards.\n/// The contribution rules must implement the IContributionRules interface. This interface has only one method:\n/// computeMultiplier which takes the account and amountStaked parameters and returns the contribution for this user.\ncontract ContributionRulesV2 is Ownable, IContributionRules {\n using Address for address;\n\n // LIMITS\n // we limited the number of Ids and contracts that we can have in the lists\n // to avoid the risk of DoS caused by gas limits being exceeded during the iterations\n uint256 public constant IDS_LIMIT = 64;\n uint256 public constant CONTRACTS_LIMIT = 4;\n uint256 public constant MAX_MULTIPLIER = 1000;\n uint256 public multiplierLimitERC721 = 1000;\n uint256 public multiplierLimitERC1155 = 1000;\n\n uint256 internal constant DECIMALS_7 = 10_000_000;\n uint256 internal constant MIDPOINT_9 = 500_000_000;\n uint256 internal constant NFT_FACTOR_6 = 10000;\n uint256 internal constant NFT_CONSTANT_3 = 9000;\n uint256 internal constant ROOT3_FACTOR = 697;\n\n struct MultiplierRule {\n uint256[] ids;\n uint256[] multipliers;\n bool balanceOf;\n uint256 index;\n }\n\n mapping(IERC721 => MultiplierRule) internal _listERC721;\n mapping(IERC1155 => MultiplierRule) internal _listERC1155;\n IERC721[] internal _listERC721Index;\n IERC1155[] internal _listERC1155Index;\n\n event ERC1155MultiplierListSet(address indexed contractERC1155, uint256[] multipliers, uint256[] ids);\n event ERC721MultiplierListSet(address indexed contractERC721, uint256[] multipliers, uint256[] ids, bool balanceOf);\n event ERC1155MultiplierListDeleted(address indexed contractERC1155);\n event ERC721MultiplierListDeleted(address indexed contractERC721);\n event ERC721MultiplierLimitSet(uint256 newERC721MultiplierLimit);\n event ERC1155MultiplierLimitSet(uint256 newERC1155MultiplierLimit);\n\n modifier isContract(address account) {\n require(account.isContract(), \"ContributionRules: is not contract\");\n\n _;\n }\n\n modifier isERC721MemberList(address contractERC721) {\n require(\n isERC721MemberMultiplierList(IERC721(contractERC721)),\n \"ContributionRules: contract is not in the list\"\n );\n _;\n }\n\n modifier isERC1155MemberList(address contractERC1155) {\n require(\n isERC1155MemberMultiplierList(IERC1155(contractERC1155)),\n \"ContributionRules: contract is not in the list\"\n );\n _;\n }\n\n /// @notice compute user multiplier based on the amount staked\n /// @param account account to compute the multiplier\n /// @param amountStaked amount stake for the given account\n /// @return amountStaked\n function computeMultiplier(address account, uint256 amountStaked) external view override returns (uint256) {\n uint256 multiplierERC721 = multiplierBalanceOfERC721(account);\n uint256 multiplierERC1155 = multiplierBalanceOfERC1155(account);\n\n // check if the calculated multipliers exceed the limit\n if (multiplierLimitERC721 < multiplierERC721) {\n multiplierERC721 = multiplierLimitERC721;\n }\n\n if (multiplierLimitERC1155 < multiplierERC1155) {\n multiplierERC1155 = multiplierLimitERC1155;\n }\n\n return amountStaked + ((amountStaked * (multiplierERC721 + multiplierERC1155)) / 100);\n }\n\n /// @notice set a Multiplier limit a user can reach by having ERC721 tokens\n /// @param _newLimit new limit value - should be less then the max limit allowed by the system.\n function setERC721MultiplierLimit(uint256 _newLimit) external onlyOwner {\n require(_newLimit <= MAX_MULTIPLIER, \"ContributionRules: invalid newLimit\");\n\n multiplierLimitERC721 = _newLimit;\n\n emit ERC721MultiplierLimitSet(_newLimit);\n }\n\n /// @notice set a Multiplier limit a user can reach by having ERC1155 tokens\n /// @param _newLimit new limit value - should be less then the max limit allowed by the system.\n function setERC1155MultiplierLimit(uint256 _newLimit) external onlyOwner {\n require(_newLimit <= MAX_MULTIPLIER, \"ContributionRules: invalid newLimit\");\n\n multiplierLimitERC1155 = _newLimit;\n\n emit ERC1155MultiplierLimitSet(_newLimit);\n }\n\n /// @notice set the ERC1155 Multiplier list\n /// @param contractERC1155 ERC1155 contract address to add to the list\n /// @param ids ID user should hold to earn the multiplier\n /// @param multipliers multiplier applied if the user has the respective id\n function setERC1155MultiplierList(\n address contractERC1155,\n uint256[] memory ids,\n uint256[] memory multipliers\n ) external onlyOwner isContract(contractERC1155) {\n require(ids.length > 0, \"ContributionRules: ids <= 0\");\n require(ids.length <= IDS_LIMIT, \"ContributionRules: invalid array of ids\");\n require(multipliers.length > 0, \"ContributionRules: invalid array of multipliers\");\n require(multipliers.length == ids.length, \"ContributionRules: multipliers array != ids array\");\n\n IERC1155 multContract = IERC1155(contractERC1155);\n\n // if it's a new member create a new registry, instead, only update\n if (isERC1155MemberMultiplierList(multContract) == false) {\n // Limiting the size of the array (iterations) to avoid the risk of DoS.\n require(CONTRACTS_LIMIT > _listERC1155Index.length, \"ContributionRules: CONTRACTS_LIMIT exceeded\");\n _listERC1155Index.push(multContract);\n _listERC1155[multContract].index = _listERC1155Index.length - 1;\n }\n\n _listERC1155[multContract].ids = ids;\n _listERC1155[multContract].multipliers = multipliers;\n _listERC1155[multContract].balanceOf = false;\n\n emit ERC1155MultiplierListSet(contractERC1155, multipliers, ids);\n }\n\n /// @notice set the ERC721 Multiplier list\n /// @param contractERC721 ERC721 contract address to add to the list\n /// @param ids ID user should hold to earn the multiplier\n /// @param multipliers multiplier applied if the user has the respective id\n /// @param balanceOf if true, will use balanceOf instead of ID - id.length should be = 0\n function setERC721MultiplierList(\n address contractERC721,\n uint256[] memory ids,\n uint256[] memory multipliers,\n bool balanceOf\n ) external onlyOwner isContract(contractERC721) {\n if (balanceOf == false) {\n require(ids.length > 0, \"ContributionRules: invalid ids array\");\n require(multipliers.length == ids.length, \"ContributionRules: ids array != multipliers array\");\n }\n require(ids.length <= IDS_LIMIT, \"ContributionRules: invalid array of ids\");\n\n IERC721 multContract = IERC721(contractERC721);\n\n // if it's a new member create a new registry, instead, only update\n if (isERC721MemberMultiplierList(multContract) == false) {\n // Limiting the size of the array (iterations) to avoid the risk of DoS.\n require(CONTRACTS_LIMIT > _listERC721Index.length, \"ContributionRules: CONTRACTS_LIMIT exceeded\");\n _listERC721Index.push(multContract);\n _listERC721[multContract].index = _listERC721Index.length - 1;\n }\n\n _listERC721[multContract].multipliers = multipliers;\n _listERC721[multContract].balanceOf = balanceOf;\n _listERC721[multContract].ids = ids;\n\n emit ERC721MultiplierListSet(contractERC721, multipliers, ids, balanceOf);\n }\n\n /// @notice Return the max multiplier for the given account\n /// @param account account address to retrieve the max multiplier\n function getMaxGlobalMultiplier(address account) external view returns (uint256) {\n return multiplierBalanceOfERC721(account) + multiplierBalanceOfERC1155(account);\n }\n\n /// @notice return the ERC721 multiplier list for the given contract\n /// @param reqContract ERC721 contract address to retrieve\n function getERC721MultiplierList(address reqContract)\n external\n view\n isContract(reqContract)\n isERC721MemberList(reqContract)\n returns (MultiplierRule memory)\n {\n return _listERC721[IERC721(reqContract)];\n }\n\n /// @notice return the ERC1155 multiplier list for the given contract\n /// @param reqContract ERC1155 contract address to retrieve\n function getERC1155MultiplierList(address reqContract)\n external\n view\n isContract(reqContract)\n isERC1155MemberList(reqContract)\n returns (MultiplierRule memory)\n {\n return _listERC1155[IERC1155(reqContract)];\n }\n\n /// @notice remove the given contract from the list\n /// @param contractERC721 contract address to be removed from the list\n function deleteERC721MultiplierList(address contractERC721)\n external\n isContract(contractERC721)\n isERC721MemberList(contractERC721)\n onlyOwner\n {\n IERC721 reqContract = IERC721(contractERC721);\n uint256 indexToDelete = _listERC721[reqContract].index;\n IERC721 addrToMove = _listERC721Index[_listERC721Index.length - 1];\n _listERC721Index[indexToDelete] = addrToMove;\n _listERC721[addrToMove].index = indexToDelete;\n _listERC721Index.pop();\n\n emit ERC721MultiplierListDeleted(address(reqContract));\n }\n\n /// @notice remove the given contract from the list\n /// @param contractERC1155 contract address to be removed from the list\n function deleteERC1155MultiplierList(address contractERC1155)\n external\n isContract(contractERC1155)\n isERC1155MemberList(contractERC1155)\n onlyOwner\n {\n IERC1155 reqContract = IERC1155(contractERC1155);\n uint256 indexToDelete = _listERC1155[reqContract].index;\n IERC1155 addrToMove = _listERC1155Index[_listERC1155Index.length - 1];\n _listERC1155Index[indexToDelete] = addrToMove;\n _listERC1155[addrToMove].index = indexToDelete;\n _listERC1155Index.pop();\n\n emit ERC1155MultiplierListDeleted(address(reqContract));\n }\n\n /// @notice check if the given contract is in the list\n /// @param reqContract contract address to check\n /// @return true if the contract is in the list\n function isERC721MemberMultiplierList(IERC721 reqContract) public view returns (bool) {\n return !(_listERC721Index.length == 0) && (_listERC721Index[_listERC721[reqContract].index] == reqContract);\n }\n\n /// @notice check if the given contract is in the list\n /// @param reqContract contract address to check\n /// @return true if the contract is in the list\n function isERC1155MemberMultiplierList(IERC1155 reqContract) public view returns (bool) {\n return !(_listERC1155Index.length == 0) && (_listERC1155Index[_listERC1155[reqContract].index] == reqContract);\n }\n\n /// @notice calculate and return the ERC721 multiplier for a given user\n /// @param account user address to calculate the multiplier\n function multiplierBalanceOfERC721(address account) public view returns (uint256) {\n uint256 _multiplier;\n uint256 _indexLength = _listERC721Index.length;\n\n for (uint256 i; i < _indexLength; ) {\n IERC721 reqContract = _listERC721Index[i];\n\n if (_listERC721[reqContract].balanceOf == true) {\n _multiplier = _multiplier + multiplierLogarithm(account, reqContract);\n } else {\n uint256 _listIdsLength = _listERC721[reqContract].ids.length;\n for (uint256 j; j < _listIdsLength; ) {\n address owner = reqContract.ownerOf(_listERC721[reqContract].ids[j]);\n if (owner == account) {\n _multiplier = _multiplier + _listERC721[reqContract].multipliers[j];\n }\n\n unchecked {j++;}\n }\n }\n\n unchecked {i++;}\n }\n\n return _multiplier;\n }\n\n /// @notice calculate and return the ERC1155 multiplier for a given user\n /// @param account user address to calculate the multiplier\n function multiplierBalanceOfERC1155(address account) public view returns (uint256) {\n uint256 _multiplier;\n uint256 _indexLength = _listERC1155Index.length;\n\n for (uint256 i; i < _indexLength; ) {\n IERC1155 reqContract = _listERC1155Index[i];\n uint256 _listIdsLength = _listERC1155[reqContract].ids.length;\n\n for (uint256 j; j < _listIdsLength; ) {\n uint256 _bal = reqContract.balanceOf(account, _listERC1155[reqContract].ids[j]);\n\n if (_bal > 0) {\n _multiplier = _multiplier + _listERC1155[reqContract].multipliers[j];\n }\n\n unchecked {j++;}\n }\n\n unchecked {i++;}\n }\n\n return _multiplier;\n }\n\n /// @notice calculate and return the multiplier for a given user,\n /// based on the amount of the specific ERC721 he owns\n /// @param account user address to calculate the multiplier\n /// @param contractERC721 contract address to check\n /// @return ERC721 _multiplier based on the balance\n function multiplierLogarithm(address account, IERC721 contractERC721) public view returns (uint256) {\n uint256 balERC721 = contractERC721.balanceOf(account);\n\n if (balERC721 == 0) {\n return 0;\n }\n\n uint256 _multiplierERC721 =\n NFT_FACTOR_6 * (NFT_CONSTANT_3 + SafeMathWithRequire.cbrt3((((balERC721 - 1) * ROOT3_FACTOR) + 1)));\n if (_multiplierERC721 > MIDPOINT_9) {\n _multiplierERC721 = MIDPOINT_9 + (_multiplierERC721 - MIDPOINT_9) / 10;\n }\n\n return _multiplierERC721 / DECIMALS_7;\n }\n\n /// @notice as admin powers are really important in this contract\n /// we're overriding the renounceOwnership method to avoid losing rights\n function renounceOwnership() public view override onlyOwner {\n revert(\"ContributionRules: can't renounceOwnership\");\n }\n}\n" + }, + "src/solc_0.8/defi/rules-v2/LockRulesV2.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Context} from \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\n\n// Note: this contract is meant to be inherited by ERC20RewardPool.\n// we should override the renounceOwnership() method otherwise.\n\n/// @notice The base contract (ERC20RewardPool) also inherits from this one. In this contract,\n/// we handle all the rules related to: Deposit, withdrawal, and claim. Basically, we have time locks for each action,\n/// where we can force the user to wait for a specific amount of time (lockPeriodInSecs) to re-do any of these actions.\n/// For the claim action, we also have the amountLockClaim(amount, bool). With this requirement,\n/// we can set a minimum amount to claim and also constrain the claim to an integer.\ncontract LockRulesV2 is Context, Ownable {\n // limits\n uint256 public constant TIME_LOCK_LIMIT = 180 days;\n uint256 public constant AMOUNT_LOCK_LIMIT = 1000 ether;\n\n struct TimeLockClaim {\n uint256 lockPeriodInSecs;\n mapping(address => uint256) lastClaim;\n }\n\n struct AmountLockClaim {\n uint256 amount;\n bool claimLockEnabled;\n }\n\n struct TimeLockWithdraw {\n uint256 lockPeriodInSecs;\n mapping(address => uint256) lastWithdraw;\n }\n\n struct TimeLockDeposit {\n uint256 lockPeriodInSecs;\n mapping(address => uint256) lastDeposit;\n }\n\n event TimelockClaimSet(uint256 lockPeriodInSecs);\n event TimelockDepositSet(uint256 newTimeDeposit);\n event TimeLockWithdrawSet(uint256 newTimeWithdraw);\n event AmountLockClaimSet(uint256 newAmountLockClaim, bool isEnabled);\n\n // This is used to implement a time buffer for reward retrieval, so the user cannot re-stake the rewards too fast.\n TimeLockClaim public timeLockClaim;\n AmountLockClaim public amountLockClaim;\n TimeLockWithdraw public lockWithdraw;\n TimeLockDeposit public lockDeposit;\n\n modifier timeLockClaimCheck(address account) {\n // We use lockPeriodInSecs == 0 to disable this check\n if (timeLockClaim.lockPeriodInSecs != 0) {\n require(\n block.timestamp > timeLockClaim.lastClaim[account] + timeLockClaim.lockPeriodInSecs,\n \"LockRules: Claim must wait\"\n );\n }\n timeLockClaim.lastClaim[account] = block.timestamp;\n _;\n }\n\n modifier antiWithdrawCheck(address account) {\n // We use lockPeriodInSecs == 0 to disable this check\n if (lockWithdraw.lockPeriodInSecs != 0) {\n require(\n block.timestamp > lockWithdraw.lastWithdraw[account] + lockWithdraw.lockPeriodInSecs,\n \"LockRules: Withdraw must wait\"\n );\n }\n lockWithdraw.lastWithdraw[account] = block.timestamp;\n _;\n }\n\n modifier antiDepositCheck(address account) {\n // We use lockPeriodInSecs == 0 to disable this check\n if (lockDeposit.lockPeriodInSecs != 0) {\n require(\n block.timestamp > lockDeposit.lastDeposit[account] + lockDeposit.lockPeriodInSecs,\n \"LockRules: Deposit must wait\"\n );\n }\n lockDeposit.lastDeposit[account] = block.timestamp;\n _;\n }\n\n /// @notice set the _lockPeriodInSecs for the anti-compound buffer\n /// @param _lockPeriodInSecs amount of time the user must wait between reward withdrawal\n function setTimelockClaim(uint256 _lockPeriodInSecs) external onlyOwner {\n require(_lockPeriodInSecs <= TIME_LOCK_LIMIT, \"LockRules: invalid lockPeriodInSecs\");\n timeLockClaim.lockPeriodInSecs = _lockPeriodInSecs;\n\n emit TimelockClaimSet(_lockPeriodInSecs);\n }\n\n /// @notice set a new time lock for the deposit\n /// user will only be able to stake again, after that time.\n /// @param _newTimeDeposit amount of time the user must wait between deposits/stake\n function setTimelockDeposit(uint256 _newTimeDeposit) external onlyOwner {\n require(_newTimeDeposit <= TIME_LOCK_LIMIT, \"LockRules: invalid lockPeriodInSecs\");\n lockDeposit.lockPeriodInSecs = _newTimeDeposit;\n\n emit TimelockDepositSet(_newTimeDeposit);\n }\n\n /// @notice set a new time lock for the withdrawn/unstake\n /// user will only be able to withdrawn/unstake again, after that time.\n /// @param _newTimeWithdraw amount of time the user must wait between withdrawn/unstake\n function setTimeLockWithdraw(uint256 _newTimeWithdraw) external onlyOwner {\n require(_newTimeWithdraw <= TIME_LOCK_LIMIT, \"LockRules: invalid lockPeriodInSecs\");\n lockWithdraw.lockPeriodInSecs = _newTimeWithdraw;\n\n emit TimeLockWithdrawSet(_newTimeWithdraw);\n }\n\n /// @notice set a new oamount lock for the claim\n /// user will only be able to claim rewards if the value is higher then the lock.\n /// @param _newAmountLockClaim min amount user should have to claim the rewards\n /// @param _isEnabled if true, the lock is enabled\n function setAmountLockClaim(uint256 _newAmountLockClaim, bool _isEnabled) external onlyOwner {\n require(_newAmountLockClaim <= AMOUNT_LOCK_LIMIT, \"LockRules: invalid newAmountLockClaim\");\n amountLockClaim.amount = _newAmountLockClaim;\n amountLockClaim.claimLockEnabled = _isEnabled;\n\n emit AmountLockClaimSet(_newAmountLockClaim, _isEnabled);\n }\n\n /// @notice return the remaining time for the user to be able to claim again\n function getRemainingTimelockClaim() external view returns (uint256) {\n uint256 timeLock = (timeLockClaim.lastClaim[_msgSender()] + timeLockClaim.lockPeriodInSecs);\n\n if (timeLock > block.timestamp) {\n return timeLock - block.timestamp;\n } else {\n return 0;\n }\n }\n\n /// @notice return the remaining time for the user to be able to withdrawn/unstake again\n function getRemainingTimelockWithdraw() external view returns (uint256) {\n uint256 timeLock = (lockWithdraw.lastWithdraw[_msgSender()] + lockWithdraw.lockPeriodInSecs);\n\n if (timeLock > block.timestamp) {\n return timeLock - block.timestamp;\n } else {\n return 0;\n }\n }\n\n /// @notice return the remaining time for the user to be able to deposit/stake again\n function getRemainingTimelockDeposit() external view returns (uint256) {\n uint256 timeLock = (lockDeposit.lastDeposit[_msgSender()] + lockDeposit.lockPeriodInSecs);\n\n if (timeLock > block.timestamp) {\n return timeLock - block.timestamp;\n } else {\n return 0;\n }\n }\n}\n" + }, + "src/solc_0.8/defi/rules-v2/RequirementsRulesV2.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {Math} from \"@openzeppelin/contracts-0.8/utils/math/Math.sol\";\nimport {IERC721} from \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\nimport {IERC1155} from \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\n\n/// @notice The base contract (ERC20RewardPool) inherits from this one. This contract contains\n/// and checks all the requirements that a user needs to meet in order to stake.\n/// These requirements are checked through the modifier checkRequirements at the moment of the stake\ncontract RequirementsRulesV2 is Ownable {\n using Address for address;\n\n // we limited the number of Ids and contracts that we can have in the lists\n // to avoid the risk of DoS caused by gas limits being exceeded during the iterations\n uint256 public constant IDS_LIMIT = 64;\n uint256 public constant CONTRACTS_LIMIT = 4;\n\n // maxStake amount allowed if user has no ERC721 or ERC1155\n uint256 public maxStakeOverall;\n\n struct ERC721RequirementRule {\n uint256[] ids;\n bool balanceOf;\n uint256 minAmountBalanceOf;\n uint256 maxAmountBalanceOf;\n uint256 minAmountId;\n uint256 maxAmountId;\n uint256 index;\n }\n\n struct ERC1155RequirementRule {\n uint256[] ids;\n uint256 minAmountId;\n uint256 maxAmountId;\n uint256 index;\n }\n\n mapping(IERC721 => ERC721RequirementRule) internal _listERC721;\n mapping(IERC1155 => ERC1155RequirementRule) internal _listERC1155;\n IERC721[] internal _listERC721Index;\n IERC1155[] internal _listERC1155Index;\n\n event ERC1155RequirementListSet(\n address indexed contractERC1155,\n uint256[] ids,\n uint256 minAmountId,\n uint256 maxAmountId\n );\n event ERC721RequirementListSet(\n address indexed contractERC721,\n uint256[] ids,\n bool balanceOf,\n uint256 minAmountBalanceOf,\n uint256 maxAmountBalanceOf,\n uint256 minAmountId,\n uint256 maxAmountId\n );\n event MaxStakeOverallSet(uint256 newMaxStake, uint256 oldMaxStake);\n event ERC11551RequirementListDeleted(address indexed contractERC1155);\n event ERC721RequirementListDeleted(address indexed contractERC721);\n\n modifier isContract(address account) {\n require(account.isContract(), \"RequirementsRules: is not a contract\");\n\n _;\n }\n\n modifier checkRequirements(\n address account,\n uint256 amount,\n uint256 balanceOf\n ) {\n uint256 maxStakeERC721 = checkAndGetERC721Stake(account);\n uint256 maxStakeERC1155 = checkAndGetERC1155Stake(account);\n uint256 maxAllowed = _maxStakeAllowedCalculator(maxStakeERC721, maxStakeERC1155);\n\n if ((maxAllowed > 0) || _listERC721Index.length > 0 || _listERC1155Index.length > 0) {\n require(amount + balanceOf <= maxAllowed, \"RequirementsRules: maxAllowed\");\n }\n\n _;\n }\n\n modifier isERC721MemberList(address contractERC721) {\n require(\n isERC721MemberRequirementList(IERC721(contractERC721)),\n \"RequirementsRules: contract is not in the list\"\n );\n _;\n }\n\n modifier isERC1155MemberList(address contractERC1155) {\n require(\n isERC1155MemberRequirementList(IERC1155(contractERC1155)),\n \"RequirementsRules: contract is not in the list\"\n );\n _;\n }\n\n /// @notice set a Max stake in case user has not ERC721 or ERC1155\n /// @param newMaxStake new max stake value\n /// @dev we should always try setting this value to less than the lowest amount\n /// @dev possible from meeting a requirement rule.\n /// @dev That way we don't benefit those who do not have assets\n function setMaxStakeOverall(uint256 newMaxStake) external onlyOwner {\n uint256 oldMaxStake = maxStakeOverall;\n maxStakeOverall = newMaxStake;\n\n emit MaxStakeOverallSet(newMaxStake, oldMaxStake);\n }\n\n /// @notice set the ERC71 requirements for the user to stake\n /// @param contractERC721 ERC721 contract address to add to the list\n /// @param ids ID user should hold\n /// @param balanceOf if true, use the balanceOf values instead of Ids\n /// @param minAmountBalanceOf min amount user should hold to be able to stake\n /// @param maxAmountBalanceOf max value user can stake for each ERC721 he owns.\n /// @param minAmountId min amount user needs to own of a specific ID to be able to stake\n /// @param maxAmountId max value user can stake for each asset(ID) he owns\n function setERC721RequirementList(\n address contractERC721,\n uint256[] memory ids,\n bool balanceOf,\n uint256 minAmountBalanceOf,\n uint256 maxAmountBalanceOf,\n uint256 minAmountId,\n uint256 maxAmountId\n ) external onlyOwner isContract(contractERC721) {\n if (balanceOf == true) {\n require(ids.length == 0, \"RequirementRules: invalid ids array\");\n require(minAmountBalanceOf > 0, \"RequirementRules: invalid minAmountBalanceOf\");\n require(maxAmountBalanceOf > 0, \"RequirementRules: invalid maxAmountBalanceOf\");\n } else {\n require(ids.length > 0, \"RequirementRules: invalid ids array\");\n require(minAmountId > 0, \"RequirementRules: invalid minAmountId\");\n require(maxAmountId > 0, \"RequirementRules: invalid maxAmountId\");\n require(ids.length <= IDS_LIMIT, \"RequirementRules: ids array > limit\");\n }\n\n IERC721 newContract = IERC721(contractERC721);\n\n if (ids.length != 0) {\n _listERC721[newContract].ids = ids;\n }\n _listERC721[newContract].minAmountBalanceOf = minAmountBalanceOf;\n _listERC721[newContract].maxAmountBalanceOf = maxAmountBalanceOf;\n _listERC721[newContract].minAmountId = minAmountId;\n _listERC721[newContract].maxAmountId = maxAmountId;\n _listERC721[newContract].balanceOf = balanceOf;\n\n // if it's a new member create a new registry, instead, only update\n if (isERC721MemberRequirementList(newContract) == false) {\n // Limiting the size of the array (interations) to avoid the risk of DoS.\n require(CONTRACTS_LIMIT > _listERC721Index.length, \"RequirementsRules: CONTRACTS_LIMIT exceeded\");\n _listERC721Index.push(newContract);\n _listERC721[newContract].index = _listERC721Index.length - 1;\n }\n\n emit ERC721RequirementListSet(\n contractERC721,\n ids,\n balanceOf,\n minAmountBalanceOf,\n maxAmountBalanceOf,\n minAmountId,\n maxAmountId\n );\n }\n\n /// @notice set the ERC1155 requirements for the user to stake\n /// @param contractERC1155 ERC1155 contract address to add to the list\n /// @param ids ID user should hold\n /// @param minAmountId min amount user needs to own of a specific ID to be able to stake\n /// @param maxAmountId max value user can stake for each asset(ID) he owns\n function setERC1155RequirementList(\n address contractERC1155,\n uint256[] memory ids,\n uint256 minAmountId,\n uint256 maxAmountId\n ) external onlyOwner isContract(contractERC1155) {\n require(ids.length > 0, \"RequirementRules: invalid ids\");\n require(minAmountId > 0, \"RequirementRules: invalid minAmountId\");\n require(maxAmountId > 0, \"RequirementRules: invalid\");\n require(ids.length <= IDS_LIMIT, \"RequirementRules: IDS_LIMIT\");\n IERC1155 newContract = IERC1155(contractERC1155);\n _listERC1155[newContract].ids = ids;\n _listERC1155[newContract].minAmountId = minAmountId;\n _listERC1155[newContract].maxAmountId = maxAmountId;\n\n // if it's a new member create a new registry, instead, only update\n if (isERC1155MemberRequirementList(newContract) == false) {\n // Limiting the size of the array (interations) to avoid the risk of DoS.\n require(CONTRACTS_LIMIT > _listERC1155Index.length, \"RequirementsRules: CONTRACTS_LIMIT exceeded\");\n _listERC1155Index.push(newContract);\n _listERC1155[newContract].index = _listERC1155Index.length - 1;\n }\n\n emit ERC1155RequirementListSet(contractERC1155, ids, minAmountId, maxAmountId);\n }\n\n /// @notice return the ERC721 list of the given contract\n /// @param contractERC721 contract address to retrieve the list\n function getERC721RequirementList(address contractERC721)\n external\n view\n isContract(contractERC721)\n isERC721MemberList(contractERC721)\n returns (ERC721RequirementRule memory)\n {\n return _listERC721[IERC721(contractERC721)];\n }\n\n /// @notice return the ERC1155 list of the given contract\n /// @param contractERC1155 contract address to retrieve the list\n function getERC1155RequirementList(address contractERC1155)\n external\n view\n isContract(contractERC1155)\n isERC1155MemberList(contractERC1155)\n returns (ERC1155RequirementRule memory)\n {\n return _listERC1155[IERC1155(contractERC1155)];\n }\n\n /// @notice remove the given contract from the list\n /// @param contractERC721 contract address to be removed from the list\n function deleteERC721RequirementList(address contractERC721)\n external\n onlyOwner\n isContract(contractERC721)\n isERC721MemberList(contractERC721)\n {\n IERC721 reqContract = IERC721(contractERC721);\n uint256 indexToDelete = _listERC721[reqContract].index;\n IERC721 addrToMove = _listERC721Index[_listERC721Index.length - 1];\n _listERC721Index[indexToDelete] = addrToMove;\n _listERC721[addrToMove].index = indexToDelete;\n _listERC721Index.pop();\n\n emit ERC721RequirementListDeleted(contractERC721);\n }\n\n /// @notice remove the given contract from the list\n /// @param contractERC1155 contract address to be removed from the list\n function deleteERC1155RequirementList(address contractERC1155)\n external\n onlyOwner\n isContract(contractERC1155)\n isERC1155MemberList(contractERC1155)\n {\n IERC1155 reqContract = IERC1155(contractERC1155);\n uint256 indexToDelete = _listERC1155[reqContract].index;\n IERC1155 addrToMove = _listERC1155Index[_listERC1155Index.length - 1];\n _listERC1155Index[indexToDelete] = addrToMove;\n _listERC1155[addrToMove].index = indexToDelete;\n _listERC1155Index.pop();\n\n emit ERC11551RequirementListDeleted(contractERC1155);\n }\n\n /// @notice check if the given contract is in the list\n /// @param reqContract contract address to check\n /// @return true if the contract is in the list\n function isERC721MemberRequirementList(IERC721 reqContract) public view returns (bool) {\n return (_listERC721Index.length != 0) && (_listERC721Index[_listERC721[reqContract].index] == reqContract);\n }\n\n /// @notice check if the given contract is in the list\n /// @param reqContract contract address to check\n /// @return true if the contract is in the list\n function isERC1155MemberRequirementList(IERC1155 reqContract) public view returns (bool) {\n return (_listERC1155Index.length != 0) && (_listERC1155Index[_listERC1155[reqContract].index] == reqContract);\n }\n\n /// @notice return the max amount the user can stake for holding ERC721 assets\n /// @param account user address to calculate the max stake amount\n function getERC721MaxStake(address account) public view returns (uint256) {\n uint256 _maxStake;\n uint256 _indexLength = _listERC721Index.length;\n\n for (uint256 i; i < _indexLength; ) {\n uint256 balanceOf;\n uint256 balanceOfId;\n IERC721 reqContract = _listERC721Index[i];\n\n if (_listERC721[reqContract].balanceOf == true) {\n balanceOf = reqContract.balanceOf(account);\n } else {\n balanceOfId = getERC721BalanceId(reqContract, account);\n }\n\n _maxStake =\n _maxStake +\n (balanceOf *\n _listERC721[reqContract].maxAmountBalanceOf +\n balanceOfId *\n _listERC721[reqContract].maxAmountId);\n\n unchecked {i++;}\n }\n\n return _maxStake;\n }\n\n /// @notice return the max amount the user can stake for holding ERC1155 assets\n /// @param account user address to calculate the max stake amount\n function getERC1155MaxStake(address account) public view returns (uint256) {\n uint256 _maxStake;\n uint256 _indexLength = _listERC1155Index.length;\n\n for (uint256 i; i < _indexLength; ) {\n uint256 _totalBal;\n IERC1155 reqContract = _listERC1155Index[i];\n\n uint256 bal = getERC1155BalanceId(reqContract, account);\n\n _totalBal = _totalBal + bal;\n\n _maxStake = _maxStake + (_totalBal * _listERC1155[reqContract].maxAmountId);\n\n unchecked {i++;}\n }\n\n return _maxStake;\n }\n\n /// @notice return the max amount the user can stake\n /// @param account user address to calculate the max stake amount\n function maxStakeAllowedCalculator(address account) public view returns (uint256) {\n uint256 maxStakeERC721 = getERC721MaxStake(account);\n uint256 maxStakeERC1155 = getERC1155MaxStake(account);\n return _maxStakeAllowedCalculator(maxStakeERC721, maxStakeERC1155);\n }\n\n /// @notice return the balance of a specific ID the given user owns\n /// @param account user address to check the balance\n function getERC721BalanceId(IERC721 reqContract, address account) public view returns (uint256) {\n uint256 balanceOfId;\n uint256 _listIdsLength = _listERC721[reqContract].ids.length;\n\n for (uint256 j; j < _listIdsLength; ) {\n address owner = reqContract.ownerOf(_listERC721[reqContract].ids[j]);\n if (owner == account) {\n ++balanceOfId;\n }\n\n unchecked {j++;}\n }\n\n return balanceOfId;\n }\n\n /// @notice return the balance of a specific ID the given user owns\n /// @param account user address to check the balance\n function getERC1155BalanceId(IERC1155 reqContract, address account) public view returns (uint256) {\n uint256 balanceOfId;\n uint256 _listIdsLength = _listERC1155[reqContract].ids.length;\n\n for (uint256 j; j < _listIdsLength; ) {\n uint256 bal = reqContract.balanceOf(account, _listERC1155[reqContract].ids[j]);\n\n balanceOfId = balanceOfId + bal;\n\n unchecked {j++;}\n }\n\n return balanceOfId;\n }\n\n /// @notice check and calculates the ERC1155 max stake for the given user\n /// @param account user address to check\n function checkAndGetERC1155Stake(address account) public view returns (uint256) {\n uint256 _maxStake;\n uint256 _indexLength = _listERC1155Index.length;\n\n for (uint256 i; i < _indexLength; ) {\n IERC1155 reqContract = _listERC1155Index[i];\n\n uint256 balanceId = getERC1155BalanceId(reqContract, account);\n if (_listERC1155[reqContract].ids.length > 0) {\n require(balanceId >= _listERC1155[reqContract].minAmountId, \"RequirementsRules: balanceId\");\n }\n _maxStake = _maxStake + (balanceId * _listERC1155[reqContract].maxAmountId);\n\n unchecked {i++;}\n }\n return _maxStake;\n }\n\n /// @notice check and calculates the ERC721 max stake for the given user\n /// @param account user address to check\n function checkAndGetERC721Stake(address account) public view returns (uint256) {\n uint256 _maxStake;\n uint256 _indexLength = _listERC721Index.length;\n\n for (uint256 i; i < _indexLength; ) {\n uint256 balanceOf;\n uint256 balanceOfId;\n IERC721 reqContract = _listERC721Index[i];\n\n if (_listERC721[reqContract].balanceOf == true) {\n require(\n (reqContract.balanceOf(account) >= _listERC721[reqContract].minAmountBalanceOf) ||\n (maxStakeOverall > 0),\n \"RequirementsRules: balanceOf\"\n );\n balanceOf = reqContract.balanceOf(account);\n } else {\n balanceOfId = getERC721BalanceId(reqContract, account);\n if (_listERC721[reqContract].ids.length > 0) {\n require(\n (balanceOfId >= _listERC721[reqContract].minAmountId) || (maxStakeOverall > 0),\n \"RequirementsRules: balanceId\"\n );\n }\n }\n\n _maxStake =\n _maxStake +\n (balanceOf *\n _listERC721[reqContract].maxAmountBalanceOf +\n balanceOfId *\n _listERC721[reqContract].maxAmountId);\n\n unchecked {i++;}\n }\n return _maxStake;\n }\n\n /// @notice calculates the maxStake allowed\n /// @param maxStakeERC721 max stake ERC721 previously calculated for the user\n /// @param maxStakeERC1155 max stake ERC1155 previously calculated for the user\n /// @return max amount allowed for the user to stake\n function _maxStakeAllowedCalculator(uint256 maxStakeERC721, uint256 maxStakeERC1155)\n internal\n view\n returns (uint256)\n {\n uint256 maxAllowed = maxStakeOverall;\n\n uint256 totalMaxStake = maxStakeERC721 + maxStakeERC1155;\n\n if (totalMaxStake > 0) {\n if (maxAllowed > 0) {\n maxAllowed = Math.min(maxAllowed, totalMaxStake);\n } else {\n maxAllowed = totalMaxStake;\n }\n }\n\n return maxAllowed;\n }\n}\n" + }, + "src/solc_0.8/defi/rules/ContributionRules.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {SafeMathWithRequire} from \"../../common/Libraries/SafeMathWithRequire.sol\";\nimport {IERC721} from \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\nimport {IERC1155} from \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\nimport {IContributionRules} from \"../interfaces/IContributionRules.sol\";\n\ncontract ContributionRules is Ownable, IContributionRules {\n using Address for address;\n\n // LIMITS\n // we limited the number of Ids and contracts that we can have in the lists\n // to avoid the risk of DoS caused by gas limits being exceeded during the iterations\n uint256 public constant idsLimit = 64;\n uint256 public constant contractsLimit = 4;\n uint256 public constant maxMultiplier = 1000;\n uint256 public multiplierLimitERC721 = 1000;\n uint256 public multiplierLimitERC1155 = 1000;\n\n uint256 internal constant DECIMALS_7 = 10_000_000;\n uint256 internal constant MIDPOINT_9 = 500_000_000;\n uint256 internal constant NFT_FACTOR_6 = 10000;\n uint256 internal constant NFT_CONSTANT_3 = 9000;\n uint256 internal constant ROOT3_FACTOR = 697;\n\n struct MultiplierRule {\n uint256[] ids;\n uint256[] multipliers;\n bool balanceOf;\n uint256 index;\n }\n\n mapping(IERC721 => MultiplierRule) internal _listERC721;\n mapping(IERC1155 => MultiplierRule) internal _listERC1155;\n IERC721[] internal _listERC721Index;\n IERC1155[] internal _listERC1155Index;\n\n event ERC1155MultiplierListSet(address indexed contractERC1155, uint256[] multipliers, uint256[] ids);\n event ERC721MultiplierListSet(address indexed contractERC721, uint256[] multipliers, uint256[] ids, bool balanceOf);\n event ERC1155MultiplierListDeleted(address indexed contractERC1155);\n event ERC721MultiplierListDeleted(address indexed contractERC721);\n event ERC721MultiplierLimitSet(uint256 newERC721MultiplierLimit);\n event ERC1155MultiplierLimitSet(uint256 newERC1155MultiplierLimit);\n\n modifier isContract(address account) {\n require(account.isContract(), \"ContributionRules: is not contract\");\n\n _;\n }\n\n modifier isERC721MemberList(address contractERC721) {\n require(\n isERC721MemberMultiplierList(IERC721(contractERC721)),\n \"ContributionRules: contract is not in the list\"\n );\n _;\n }\n\n modifier isERC1155MemberList(address contractERC1155) {\n require(\n isERC1155MemberMultiplierList(IERC1155(contractERC1155)),\n \"ContributionRules: contract is not in the list\"\n );\n _;\n }\n\n function computeMultiplier(address account, uint256 amountStaked) external view override returns (uint256) {\n uint256 multiplierERC721 = multiplierBalanceOfERC721(account);\n uint256 multiplierERC1155 = multiplierBalanceOfERC1155(account);\n\n // check if the calculated multipliers exceeds the limit\n if (multiplierLimitERC721 < multiplierERC721) {\n multiplierERC721 = multiplierLimitERC721;\n }\n\n if (multiplierLimitERC1155 < multiplierERC1155) {\n multiplierERC1155 = multiplierLimitERC1155;\n }\n\n return amountStaked + ((amountStaked * (multiplierERC721 + multiplierERC1155)) / 100);\n }\n\n function setERC721MultiplierLimit(uint256 _newLimit) external onlyOwner {\n require(_newLimit <= maxMultiplier, \"ContributionRules: invalid newLimit\");\n\n multiplierLimitERC721 = _newLimit;\n\n emit ERC721MultiplierLimitSet(_newLimit);\n }\n\n function setERC1155MultiplierLimit(uint256 _newLimit) external onlyOwner {\n require(_newLimit <= maxMultiplier, \"ContributionRules: invalid newLimit\");\n\n multiplierLimitERC1155 = _newLimit;\n\n emit ERC1155MultiplierLimitSet(_newLimit);\n }\n\n function setERC1155MultiplierList(\n address contractERC1155,\n uint256[] memory ids,\n uint256[] memory multipliers\n ) external onlyOwner isContract(contractERC1155) {\n require(ids.length > 0 && ids.length <= idsLimit, \"ContributionRules: invalid array of ids\");\n require(multipliers.length > 0, \"ContributionRules: invalid array of multipliers\");\n\n IERC1155 multContract = IERC1155(contractERC1155);\n\n // if it's a new member create a new registry, instead, only update\n if (isERC1155MemberMultiplierList(multContract) == false) {\n // Limiting the size of the array (interations) to avoid the risk of DoS.\n require(contractsLimit > _listERC1155Index.length, \"ContributionRules: contractsLimit exceeded\");\n _listERC1155Index.push(multContract);\n _listERC1155[multContract].index = _listERC1155Index.length - 1;\n }\n\n _listERC1155[multContract].ids = ids;\n _listERC1155[multContract].multipliers = multipliers;\n _listERC1155[multContract].balanceOf = false;\n\n emit ERC1155MultiplierListSet(contractERC1155, multipliers, ids);\n }\n\n function setERC721MultiplierList(\n address contractERC721,\n uint256[] memory ids,\n uint256[] memory multipliers,\n bool balanceOf\n ) external onlyOwner isContract(contractERC721) {\n require(\n balanceOf == true || (ids.length > 0 && multipliers.length == ids.length),\n \"ContributionRules: invalid list\"\n );\n require(ids.length <= idsLimit, \"ContributionRules: invalid array of ids\");\n\n IERC721 multContract = IERC721(contractERC721);\n\n // if it's a new member create a new registry, instead, only update\n if (isERC721MemberMultiplierList(multContract) == false) {\n // Limiting the size of the array (interations) to avoid the risk of DoS.\n require(contractsLimit > _listERC721Index.length, \"ContributionRules: contractsLimit exceeded\");\n _listERC721Index.push(multContract);\n _listERC721[multContract].index = _listERC721Index.length - 1;\n }\n\n _listERC721[multContract].multipliers = multipliers;\n _listERC721[multContract].balanceOf = balanceOf;\n _listERC721[multContract].ids = ids;\n\n emit ERC721MultiplierListSet(contractERC721, multipliers, ids, balanceOf);\n }\n\n function getMaxGlobalMultiplier(address account) external view returns (uint256) {\n return multiplierBalanceOfERC721(account) + multiplierBalanceOfERC1155(account);\n }\n\n function getERC721MultiplierList(address reqContract)\n external\n view\n isContract(reqContract)\n isERC721MemberList(reqContract)\n returns (MultiplierRule memory)\n {\n return _listERC721[IERC721(reqContract)];\n }\n\n function getERC1155MultiplierList(address reqContract)\n external\n view\n isContract(reqContract)\n isERC1155MemberList(reqContract)\n returns (MultiplierRule memory)\n {\n return _listERC1155[IERC1155(reqContract)];\n }\n\n function deleteERC721MultiplierList(address contractERC721)\n external\n isContract(contractERC721)\n isERC721MemberList(contractERC721)\n onlyOwner\n {\n IERC721 reqContract = IERC721(contractERC721);\n uint256 indexToDelete = _listERC721[reqContract].index;\n IERC721 addrToMove = _listERC721Index[_listERC721Index.length - 1];\n _listERC721Index[indexToDelete] = addrToMove;\n _listERC721[addrToMove].index = indexToDelete;\n _listERC721Index.pop();\n\n emit ERC721MultiplierListDeleted(address(reqContract));\n }\n\n function deleteERC1155MultiplierList(address contractERC1155)\n external\n isContract(contractERC1155)\n isERC1155MemberList(contractERC1155)\n onlyOwner\n {\n IERC1155 reqContract = IERC1155(contractERC1155);\n uint256 indexToDelete = _listERC1155[reqContract].index;\n IERC1155 addrToMove = _listERC1155Index[_listERC1155Index.length - 1];\n _listERC1155Index[indexToDelete] = addrToMove;\n _listERC1155[addrToMove].index = indexToDelete;\n _listERC1155Index.pop();\n\n emit ERC1155MultiplierListDeleted(address(reqContract));\n }\n\n function isERC721MemberMultiplierList(IERC721 reqContract) public view returns (bool) {\n return !(_listERC721Index.length == 0) && (_listERC721Index[_listERC721[reqContract].index] == reqContract);\n }\n\n function isERC1155MemberMultiplierList(IERC1155 reqContract) public view returns (bool) {\n return !(_listERC1155Index.length == 0) && (_listERC1155Index[_listERC1155[reqContract].index] == reqContract);\n }\n\n function multiplierBalanceOfERC721(address account) public view returns (uint256) {\n uint256 _multiplier = 0;\n\n for (uint256 i = 0; i < _listERC721Index.length; i++) {\n IERC721 reqContract = _listERC721Index[i];\n\n if (_listERC721[reqContract].balanceOf == true) {\n _multiplier = _multiplier + multiplierLogarithm(account, reqContract);\n } else {\n for (uint256 j = 0; j < _listERC721[reqContract].ids.length; j++) {\n address owner = reqContract.ownerOf(_listERC721[reqContract].ids[j]);\n if (owner == account) {\n _multiplier = _multiplier + _listERC721[reqContract].multipliers[j];\n }\n }\n }\n }\n\n return _multiplier;\n }\n\n function multiplierBalanceOfERC1155(address account) public view returns (uint256) {\n uint256 _multiplier = 0;\n for (uint256 i = 0; i < _listERC1155Index.length; i++) {\n IERC1155 reqContract = _listERC1155Index[i];\n\n for (uint256 j = 0; j < _listERC1155[reqContract].ids.length; j++) {\n uint256 _bal = reqContract.balanceOf(account, _listERC1155[reqContract].ids[j]);\n\n if (_bal > 0) {\n _multiplier = _multiplier + _listERC1155[reqContract].multipliers[j];\n }\n }\n }\n\n return _multiplier;\n }\n\n function multiplierLogarithm(address account, IERC721 contractERC721) public view returns (uint256) {\n uint256 balERC721 = contractERC721.balanceOf(account);\n\n if (balERC721 == 0) {\n return 0;\n }\n\n uint256 _multiplierERC721 =\n NFT_FACTOR_6 * (NFT_CONSTANT_3 + SafeMathWithRequire.cbrt3((((balERC721 - 1) * ROOT3_FACTOR) + 1)));\n if (_multiplierERC721 > MIDPOINT_9) {\n _multiplierERC721 = MIDPOINT_9 + (_multiplierERC721 - MIDPOINT_9) / 10;\n }\n\n return _multiplierERC721 / DECIMALS_7;\n }\n\n function renounceOwnership() public view override onlyOwner {\n revert(\"ContributionRules: can't renounceOwnership\");\n }\n}\n" + }, + "src/solc_0.8/defi/rules/LockRules.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Context} from \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\n\n// Note: this contract is meant to be inherited by ERC20RewardPool.\n// we should override the renounceOwnership() method otherwise.\ncontract LockRules is Context, Ownable {\n // limits\n uint256 public constant timeLockLimit = 180 days;\n uint256 public constant amountLockLimit = 1000 ether;\n\n struct TimeLockClaim {\n uint256 lockPeriodInSecs;\n mapping(address => uint256) lastClaim;\n }\n\n struct AmountLockClaim {\n uint256 amount;\n bool claimLockEnabled;\n }\n\n struct TimeLockWithdraw {\n uint256 lockPeriodInSecs;\n mapping(address => uint256) lastWithdraw;\n }\n\n struct TimeLockDeposit {\n uint256 lockPeriodInSecs;\n mapping(address => uint256) lastDeposit;\n }\n\n event TimelockClaimSet(uint256 lockPeriodInSecs);\n event TimelockDepositSet(uint256 newTimeDeposit);\n event TimeLockWithdrawSet(uint256 newTimeWithdraw);\n event AmountLockClaimSet(uint256 newAmountLockClaim, bool isEnabled);\n\n // This is used to implement a time buffer for reward retrieval, so the user cannot re-stake the rewards too fast.\n TimeLockClaim public timeLockClaim;\n AmountLockClaim public amountLockClaim;\n TimeLockWithdraw public lockWithdraw;\n TimeLockDeposit public lockDeposit;\n\n modifier timeLockClaimCheck(address account) {\n // We use lockPeriodInSecs == 0 to disable this check\n if (timeLockClaim.lockPeriodInSecs != 0) {\n require(\n block.timestamp > timeLockClaim.lastClaim[account] + timeLockClaim.lockPeriodInSecs,\n \"LockRules: Claim must wait\"\n );\n }\n timeLockClaim.lastClaim[account] = block.timestamp;\n _;\n }\n\n modifier antiWithdrawCheck(address account) {\n // We use lockPeriodInSecs == 0 to disable this check\n if (lockWithdraw.lockPeriodInSecs != 0) {\n require(\n block.timestamp > lockWithdraw.lastWithdraw[account] + lockWithdraw.lockPeriodInSecs,\n \"LockRules: Withdraw must wait\"\n );\n }\n lockWithdraw.lastWithdraw[account] = block.timestamp;\n _;\n }\n\n modifier antiDepositCheck(address account) {\n // We use lockPeriodInSecs == 0 to disable this check\n if (lockDeposit.lockPeriodInSecs != 0) {\n require(\n block.timestamp > lockDeposit.lastDeposit[account] + lockDeposit.lockPeriodInSecs,\n \"LockRules: Deposit must wait\"\n );\n }\n lockDeposit.lastDeposit[account] = block.timestamp;\n _;\n }\n\n /// @notice set the _lockPeriodInSecs for the anti-compound buffer\n /// @param _lockPeriodInSecs amount of time the user must wait between reward withdrawal\n function setTimelockClaim(uint256 _lockPeriodInSecs) external onlyOwner {\n require(_lockPeriodInSecs <= timeLockLimit, \"LockRules: invalid lockPeriodInSecs\");\n timeLockClaim.lockPeriodInSecs = _lockPeriodInSecs;\n\n emit TimelockClaimSet(_lockPeriodInSecs);\n }\n\n function setTimelockDeposit(uint256 _newTimeDeposit) external onlyOwner {\n require(_newTimeDeposit <= timeLockLimit, \"LockRules: invalid lockPeriodInSecs\");\n lockDeposit.lockPeriodInSecs = _newTimeDeposit;\n\n emit TimelockDepositSet(_newTimeDeposit);\n }\n\n function setTimeLockWithdraw(uint256 _newTimeWithdraw) external onlyOwner {\n require(_newTimeWithdraw <= timeLockLimit, \"LockRules: invalid lockPeriodInSecs\");\n lockWithdraw.lockPeriodInSecs = _newTimeWithdraw;\n\n emit TimeLockWithdrawSet(_newTimeWithdraw);\n }\n\n function setAmountLockClaim(uint256 _newAmountLockClaim, bool _isEnabled) external onlyOwner {\n require(_newAmountLockClaim <= amountLockLimit, \"LockRules: invalid newAmountLockClaim\");\n amountLockClaim.amount = _newAmountLockClaim;\n amountLockClaim.claimLockEnabled = _isEnabled;\n\n emit AmountLockClaimSet(_newAmountLockClaim, _isEnabled);\n }\n\n function getRemainingTimelockClaim() external view returns (uint256) {\n uint256 timeLock = (timeLockClaim.lastClaim[_msgSender()] + timeLockClaim.lockPeriodInSecs);\n\n if (timeLock > block.timestamp) {\n return timeLock - block.timestamp;\n } else {\n return 0;\n }\n }\n\n function getRemainingTimelockWithdraw() external view returns (uint256) {\n uint256 timeLock = (lockWithdraw.lastWithdraw[_msgSender()] + lockWithdraw.lockPeriodInSecs);\n\n if (timeLock > block.timestamp) {\n return timeLock - block.timestamp;\n } else {\n return 0;\n }\n }\n\n function getRemainingTimelockDeposit() external view returns (uint256) {\n uint256 timeLock = (lockDeposit.lastDeposit[_msgSender()] + lockDeposit.lockPeriodInSecs);\n\n if (timeLock > block.timestamp) {\n return timeLock - block.timestamp;\n } else {\n return 0;\n }\n }\n}\n" + }, + "src/solc_0.8/defi/rules/RequirementsRules.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {Math} from \"@openzeppelin/contracts-0.8/utils/math/Math.sol\";\nimport {IERC721} from \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\nimport {IERC1155} from \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\n\ncontract RequirementsRules is Ownable {\n using Address for address;\n\n // we limited the number of Ids and contracts that we can have in the lists\n // to avoid the risk of DoS caused by gas limits being exceeded during the iterations\n uint256 public idsLimit = 64;\n uint256 public contractsLimit = 4;\n\n // maxStake amount allowed if user has no ERC721 or ERC1155\n uint256 public maxStakeOverall;\n\n struct ERC721RequirementRule {\n uint256[] ids;\n bool balanceOf;\n uint256 minAmountBalanceOf;\n uint256 maxAmountBalanceOf;\n uint256 minAmountId;\n uint256 maxAmountId;\n uint256 index;\n }\n\n struct ERC1155RequirementRule {\n uint256[] ids;\n uint256 minAmountId;\n uint256 maxAmountId;\n uint256 index;\n }\n\n mapping(IERC721 => ERC721RequirementRule) internal _listERC721;\n mapping(IERC1155 => ERC1155RequirementRule) internal _listERC1155;\n IERC721[] internal _listERC721Index;\n IERC1155[] internal _listERC1155Index;\n\n event ERC1155RequirementListSet(\n address indexed contractERC1155,\n uint256[] ids,\n uint256 minAmountId,\n uint256 maxAmountId\n );\n event ERC721RequirementListSet(\n address indexed contractERC721,\n uint256[] ids,\n bool balanceOf,\n uint256 minAmountBalanceOf,\n uint256 maxAmountBalanceOf,\n uint256 minAmountId,\n uint256 maxAmountId\n );\n event MaxStakeOverallSet(uint256 newMaxStake, uint256 oldMaxStake);\n event ERC11551RequirementListDeleted(address indexed contractERC1155);\n event ERC721RequirementListDeleted(address indexed contractERC721);\n\n modifier isContract(address account) {\n require(account.isContract(), \"RequirementsRules: is not contract\");\n\n _;\n }\n\n modifier checkRequirements(\n address account,\n uint256 amount,\n uint256 balanceOf\n ) {\n uint256 maxStakeERC721 = checkAndGetERC721Stake(account);\n uint256 maxStakeERC1155 = checkAndGetERC1155Stake(account);\n uint256 maxAllowed = _maxStakeAllowedCalculator(maxStakeERC721, maxStakeERC1155);\n\n if ((maxAllowed > 0) || _listERC721Index.length > 0 || _listERC1155Index.length > 0) {\n require(amount + balanceOf <= maxAllowed, \"RequirementsRules: maxAllowed\");\n }\n\n _;\n }\n\n modifier isERC721MemberList(address contractERC721) {\n require(\n isERC721MemberRequirementList(IERC721(contractERC721)),\n \"RequirementsRules: contract is not in the list\"\n );\n _;\n }\n\n modifier isERC1155MemberList(address contractERC1155) {\n require(\n isERC1155MemberRequirementList(IERC1155(contractERC1155)),\n \"RequirementsRules: contract is not in the list\"\n );\n _;\n }\n\n // if user has not erc721 or erc1155\n function setMaxStakeOverall(uint256 newMaxStake) external onlyOwner {\n uint256 oldMaxStake = maxStakeOverall;\n maxStakeOverall = newMaxStake;\n\n emit MaxStakeOverallSet(newMaxStake, oldMaxStake);\n }\n\n function setERC721RequirementList(\n address contractERC721,\n uint256[] memory ids,\n bool balanceOf,\n uint256 minAmountBalanceOf,\n uint256 maxAmountBalanceOf,\n uint256 minAmountId,\n uint256 maxAmountId\n ) external onlyOwner isContract(contractERC721) {\n require(\n (balanceOf == true && ids.length == 0 && minAmountBalanceOf > 0 && maxAmountBalanceOf > 0) ||\n (balanceOf == false && ids.length > 0 && minAmountId > 0 && maxAmountId > 0 && ids.length <= idsLimit),\n \"RequirementRules: invalid list\"\n );\n IERC721 newContract = IERC721(contractERC721);\n\n if (ids.length != 0) {\n _listERC721[newContract].ids = ids;\n }\n _listERC721[newContract].minAmountBalanceOf = minAmountBalanceOf;\n _listERC721[newContract].maxAmountBalanceOf = maxAmountBalanceOf;\n _listERC721[newContract].minAmountId = minAmountId;\n _listERC721[newContract].maxAmountId = maxAmountId;\n _listERC721[newContract].balanceOf = balanceOf;\n\n // if it's a new member create a new registry, instead, only update\n if (isERC721MemberRequirementList(newContract) == false) {\n // Limiting the size of the array (interations) to avoid the risk of DoS.\n require(contractsLimit > _listERC721Index.length, \"RequirementsRules: contractsLimit exceeded\");\n _listERC721Index.push(newContract);\n _listERC721[newContract].index = _listERC721Index.length - 1;\n }\n\n emit ERC721RequirementListSet(\n contractERC721,\n ids,\n balanceOf,\n minAmountBalanceOf,\n maxAmountBalanceOf,\n minAmountId,\n maxAmountId\n );\n }\n\n function setERC1155RequirementList(\n address contractERC1155,\n uint256[] memory ids,\n uint256 minAmountId,\n uint256 maxAmountId\n ) external onlyOwner isContract(contractERC1155) {\n require(\n ids.length > 0 && minAmountId > 0 && maxAmountId > 0 && ids.length <= idsLimit,\n \"RequirementRules: invalid list\"\n );\n IERC1155 newContract = IERC1155(contractERC1155);\n _listERC1155[newContract].ids = ids;\n _listERC1155[newContract].minAmountId = minAmountId;\n _listERC1155[newContract].maxAmountId = maxAmountId;\n\n // if it's a new member create a new registry, instead, only update\n if (isERC1155MemberRequirementList(newContract) == false) {\n // Limiting the size of the array (interations) to avoid the risk of DoS.\n require(contractsLimit > _listERC1155Index.length, \"RequirementsRules: contractsLimit exceeded\");\n _listERC1155Index.push(newContract);\n _listERC1155[newContract].index = _listERC1155Index.length - 1;\n }\n\n emit ERC1155RequirementListSet(contractERC1155, ids, minAmountId, maxAmountId);\n }\n\n function getERC721RequirementList(address contractERC721)\n external\n view\n isContract(contractERC721)\n isERC721MemberList(contractERC721)\n returns (ERC721RequirementRule memory)\n {\n return _listERC721[IERC721(contractERC721)];\n }\n\n function getERC1155RequirementList(address contractERC1155)\n external\n view\n isContract(contractERC1155)\n isERC1155MemberList(contractERC1155)\n returns (ERC1155RequirementRule memory)\n {\n return _listERC1155[IERC1155(contractERC1155)];\n }\n\n function deleteERC721RequirementList(address contractERC721)\n external\n onlyOwner\n isContract(contractERC721)\n isERC721MemberList(contractERC721)\n {\n IERC721 reqContract = IERC721(contractERC721);\n uint256 indexToDelete = _listERC721[reqContract].index;\n IERC721 addrToMove = _listERC721Index[_listERC721Index.length - 1];\n _listERC721Index[indexToDelete] = addrToMove;\n _listERC721[addrToMove].index = indexToDelete;\n _listERC721Index.pop();\n\n emit ERC721RequirementListDeleted(contractERC721);\n }\n\n function deleteERC1155RequirementList(address contractERC1155)\n external\n onlyOwner\n isContract(contractERC1155)\n isERC1155MemberList(contractERC1155)\n {\n IERC1155 reqContract = IERC1155(contractERC1155);\n uint256 indexToDelete = _listERC1155[reqContract].index;\n IERC1155 addrToMove = _listERC1155Index[_listERC1155Index.length - 1];\n _listERC1155Index[indexToDelete] = addrToMove;\n _listERC1155[addrToMove].index = indexToDelete;\n _listERC1155Index.pop();\n\n emit ERC11551RequirementListDeleted(contractERC1155);\n }\n\n function isERC721MemberRequirementList(IERC721 reqContract) public view returns (bool) {\n return (_listERC721Index.length != 0) && (_listERC721Index[_listERC721[reqContract].index] == reqContract);\n }\n\n function isERC1155MemberRequirementList(IERC1155 reqContract) public view returns (bool) {\n return (_listERC1155Index.length != 0) && (_listERC1155Index[_listERC1155[reqContract].index] == reqContract);\n }\n\n function getERC721MaxStake(address account) public view returns (uint256) {\n uint256 _maxStake = 0;\n for (uint256 i = 0; i < _listERC721Index.length; i++) {\n uint256 balanceOf = 0;\n uint256 balanceOfId = 0;\n IERC721 reqContract = _listERC721Index[i];\n\n if (_listERC721[reqContract].balanceOf == true) {\n balanceOf = reqContract.balanceOf(account);\n } else {\n balanceOfId = getERC721BalanceId(reqContract, account);\n }\n\n _maxStake =\n _maxStake +\n (balanceOf *\n _listERC721[reqContract].maxAmountBalanceOf +\n balanceOfId *\n _listERC721[reqContract].maxAmountId);\n }\n\n return _maxStake;\n }\n\n function getERC1155MaxStake(address account) public view returns (uint256) {\n uint256 _maxStake = 0;\n\n for (uint256 i = 0; i < _listERC1155Index.length; i++) {\n uint256 _totalBal = 0;\n IERC1155 reqContract = _listERC1155Index[i];\n\n uint256 bal = getERC1155BalanceId(reqContract, account);\n\n _totalBal = _totalBal + bal;\n\n _maxStake = _maxStake + (_totalBal * _listERC1155[reqContract].maxAmountId);\n }\n\n return _maxStake;\n }\n\n function maxStakeAllowedCalculator(address account) public view returns (uint256) {\n uint256 maxStakeERC721 = getERC721MaxStake(account);\n uint256 maxStakeERC1155 = getERC1155MaxStake(account);\n return _maxStakeAllowedCalculator(maxStakeERC721, maxStakeERC1155);\n }\n\n function getERC721BalanceId(IERC721 reqContract, address account) public view returns (uint256) {\n uint256 balanceOfId = 0;\n\n for (uint256 j = 0; j < _listERC721[reqContract].ids.length; j++) {\n address owner = reqContract.ownerOf(_listERC721[reqContract].ids[j]);\n if (owner == account) {\n ++balanceOfId;\n }\n }\n\n return balanceOfId;\n }\n\n function getERC1155BalanceId(IERC1155 reqContract, address account) public view returns (uint256) {\n uint256 balanceOfId = 0;\n\n for (uint256 j = 0; j < _listERC1155[reqContract].ids.length; j++) {\n uint256 bal = reqContract.balanceOf(account, _listERC1155[reqContract].ids[j]);\n\n balanceOfId = balanceOfId + bal;\n }\n\n return balanceOfId;\n }\n\n function checkAndGetERC1155Stake(address account) public view returns (uint256) {\n uint256 _maxStake = 0;\n for (uint256 i = 0; i < _listERC1155Index.length; i++) {\n uint256 _totalBal = 0;\n IERC1155 reqContract = _listERC1155Index[i];\n\n uint256 balanceId = getERC1155BalanceId(reqContract, account);\n if (_listERC1155[reqContract].ids.length > 0) {\n require(balanceId >= _listERC1155[reqContract].minAmountId, \"RequirementsRules: balanceId\");\n }\n\n _totalBal = _totalBal + balanceId;\n _maxStake = _maxStake + (_totalBal * _listERC1155[reqContract].maxAmountId);\n }\n return _maxStake;\n }\n\n function checkAndGetERC721Stake(address account) public view returns (uint256) {\n uint256 _maxStake = 0;\n for (uint256 i = 0; i < _listERC721Index.length; i++) {\n uint256 balanceOf = 0;\n uint256 balanceOfId = 0;\n IERC721 reqContract = _listERC721Index[i];\n\n if (_listERC721[reqContract].balanceOf == true) {\n require(\n (reqContract.balanceOf(account) >= _listERC721[reqContract].minAmountBalanceOf) ||\n (maxStakeOverall > 0),\n \"RequirementsRules: balanceOf\"\n );\n balanceOf = reqContract.balanceOf(account);\n } else {\n balanceOfId = getERC721BalanceId(reqContract, account);\n if (_listERC721[reqContract].ids.length > 0) {\n require(\n (balanceOfId >= _listERC721[reqContract].minAmountId) || (maxStakeOverall > 0),\n \"RequirementsRules: balanceId\"\n );\n }\n }\n\n _maxStake =\n _maxStake +\n (balanceOf *\n _listERC721[reqContract].maxAmountBalanceOf +\n balanceOfId *\n _listERC721[reqContract].maxAmountId);\n }\n return _maxStake;\n }\n\n function _maxStakeAllowedCalculator(uint256 maxStakeERC721, uint256 maxStakeERC1155)\n internal\n view\n returns (uint256)\n {\n uint256 maxAllowed = maxStakeOverall;\n\n if (maxStakeERC721 + maxStakeERC1155 > 0) {\n if (maxStakeOverall > 0) {\n maxAllowed = Math.min(maxAllowed, maxStakeERC721 + maxStakeERC1155);\n } else {\n maxAllowed = maxStakeERC721 + maxStakeERC1155;\n }\n } else {\n maxAllowed = maxStakeOverall;\n }\n\n return maxAllowed;\n }\n}\n" + }, + "src/solc_0.8/defi/SandRewardPool.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Context} from \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport {IERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts-0.8/security/ReentrancyGuard.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {AccessControl} from \"@openzeppelin/contracts-0.8/access/AccessControl.sol\";\nimport {ERC2771Handler} from \"../common/BaseWithStorage/ERC2771Handler.sol\";\nimport {StakeTokenWrapper} from \"./StakeTokenWrapper.sol\";\nimport {IContributionCalculator} from \"./interfaces/IContributionCalculator.sol\";\nimport {IRewardCalculator} from \"./interfaces/IRewardCalculator.sol\";\n\n/// @title A pool that distributes rewards between users that stake sand (or any erc20 token)\n/// @notice The contributions are updated passively, an external call to computeContribution from a backend is needed.\n/// @notice After initialization the reward calculator must be set by the admin.\n/// @dev The contract has two plugins that affect the behaviour: contributionCalculator and rewardCalculator\n/// @dev contributionCalculator instead of using the stake directly the result of computeContribution is used\n/// @dev this way some users can get an extra share of the rewards\n/// @dev rewardCalculator is used to manage the rate at which the rewards are distributed.\n/// @dev This way we can build different types of pools by mixing in the plugins we want with this contract.\n/// @dev default behaviour (address(0)) for contributionCalculator is to use the stacked amount as contribution.\n/// @dev default behaviour (address(0)) for rewardCalculator is that no rewards are giving\ncontract SandRewardPool is StakeTokenWrapper, AccessControl, ReentrancyGuard, ERC2771Handler {\n using SafeERC20 for IERC20;\n using Address for address;\n\n event Staked(address indexed account, uint256 stakeAmount);\n event Withdrawn(address indexed account, uint256 stakeAmount);\n event Exit(address indexed account);\n event RewardPaid(address indexed account, uint256 rewardAmount);\n event ContributionUpdated(address indexed account, uint256 newContribution, uint256 oldContribution);\n\n // This value multiplied by the user contribution is the share of accumulated rewards (from the start of time\n // until the last call to restartRewards) for the user taking into account the value of totalContributions.\n uint256 public rewardPerTokenStored;\n\n // This value multiplied by the user contribution is the share of reward from the the last time\n // the user changed his contribution and called restartRewards\n mapping(address => uint256) public userRewardPerTokenPaid;\n\n // This value is the accumulated rewards won by the user when he called the contract.\n mapping(address => uint256) public rewards;\n\n IERC20 public rewardToken;\n IContributionCalculator public contributionCalculator;\n IRewardCalculator public rewardCalculator;\n\n uint256 internal _totalContributions;\n mapping(address => uint256) internal _contributions;\n\n struct AntiCompound {\n uint256 lockPeriodInSecs;\n mapping(address => uint256) lastClaim;\n }\n // This is used to implement a time buffer for reward retrieval, so the used cannot re-stake the rewards too fast.\n AntiCompound public antiCompound;\n\n constructor(\n IERC20 stakeToken_,\n IERC20 rewardToken_,\n address trustedForwarder\n ) StakeTokenWrapper(stakeToken_) {\n rewardToken = rewardToken_;\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n __ERC2771Handler_initialize(trustedForwarder);\n }\n\n modifier antiCompoundCheck(address account) {\n // We use lockPeriodInSecs == 0 to disable this check\n if (antiCompound.lockPeriodInSecs != 0) {\n require(\n block.timestamp > antiCompound.lastClaim[account] + antiCompound.lockPeriodInSecs,\n \"SandRewardPool: must wait\"\n );\n }\n antiCompound.lastClaim[account] = block.timestamp;\n _;\n }\n\n modifier isContractAndAdmin(address contractAddress) {\n require(contractAddress.isContract(), \"SandRewardPool: not a contract\");\n require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), \"SandRewardPool: not admin\");\n _;\n }\n\n /// @notice set the lockPeriodInSecs for the anti-compound buffer\n /// @param lockPeriodInSecs amount of time the user must wait between reward withdrawal\n function setAntiCompoundLockPeriod(uint256 lockPeriodInSecs) external {\n require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), \"SandRewardPool: not admin\");\n antiCompound.lockPeriodInSecs = lockPeriodInSecs;\n }\n\n /// @notice set the contribution calculator\n /// @param contractAddress address of a plugin that calculates the contribution of the user based on his stake\n function setContributionCalculator(address contractAddress) external isContractAndAdmin(contractAddress) {\n contributionCalculator = IContributionCalculator(contractAddress);\n }\n\n /// @notice set the reward token\n /// @param contractAddress address token used to pay rewards\n function setRewardToken(address contractAddress) external isContractAndAdmin(contractAddress) {\n rewardToken = IERC20(contractAddress);\n }\n\n /// @notice set the stake token\n /// @param contractAddress address token used to stake funds\n function setStakeToken(address contractAddress) external isContractAndAdmin(contractAddress) {\n _stakeToken = IERC20(contractAddress);\n }\n\n /// @notice set the trusted forwarder\n /// @param trustedForwarder address of the contract that is enabled to send meta-tx on behalf of the user\n function setTrustedForwarder(address trustedForwarder) external {\n require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), \"SandRewardPool: not admin\");\n _trustedForwarder = trustedForwarder;\n }\n\n /// @notice set the reward calculator\n /// @param contractAddress address of a plugin that calculates absolute rewards at any point in time\n /// @param restartRewards if true the rewards from the previous calculator are accumulated before changing it\n function setRewardCalculator(address contractAddress, bool restartRewards)\n external\n isContractAndAdmin(contractAddress)\n {\n // We process the rewards of the current reward calculator before the switch.\n if (restartRewards) {\n _restartRewards();\n }\n rewardCalculator = IRewardCalculator(contractAddress);\n }\n\n /// @notice the admin recover is able to recover reward funds\n /// @param receiver address of the beneficiary of the recovered funds\n /// @dev this function must be called in an emergency situation only.\n /// @dev Calling it is risky specially when rewardToken == stakeToken\n function recoverFunds(address receiver) external {\n require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), \"SandRewardPool: not admin\");\n require(receiver != address(0), \"SandRewardPool: invalid receiver\");\n rewardToken.safeTransfer(receiver, rewardToken.balanceOf(address(this)));\n }\n\n /// @notice return the total supply of staked tokens\n /// @return the total supply of staked tokens\n function totalSupply() external view returns (uint256) {\n return _totalSupply;\n }\n\n /// @notice return the balance of staked tokens for a user\n /// @param account the address of the account\n /// @return balance of staked tokens\n function balanceOf(address account) external view returns (uint256) {\n return _balances[account];\n }\n\n /// @notice return the address of the stake token contract\n /// @return address of the stake token contract\n function stakeToken() external view returns (IERC20) {\n return _stakeToken;\n }\n\n /// @notice return the amount of rewards deposited in the contract that can be distributed by different campaigns\n /// @return the total amount of deposited rewards\n /// @dev this function can be called by a reward calculator to throw if a campaign doesn't have\n /// @dev enough rewards to start\n function getRewardsAvailable() external view returns (uint256) {\n if (address(rewardToken) != address(_stakeToken)) {\n return rewardToken.balanceOf(address(this));\n }\n return _stakeToken.balanceOf(address(this)) - _totalSupply;\n }\n\n /// @notice return the sum of the values returned by the contribution calculator\n /// @return total contributions of the users\n /// @dev this is the same than the totalSupply only if the contribution calculator\n /// @dev uses the staked amount as the contribution of the user which is the default behaviour\n function totalContributions() external view returns (uint256) {\n return _totalContributions;\n }\n\n /// @notice return the contribution of some user\n /// @param account the address of the account\n /// @return contribution of the users\n /// @dev this is the same than the balanceOf only if the contribution calculator\n /// @dev uses the staked amount as the contribution of the user which is the default behaviour\n function contributionOf(address account) external view returns (uint256) {\n return _contributions[account];\n }\n\n /// @notice accumulated rewards taking into account the totalContribution (see: rewardPerTokenStored)\n /// @return the accumulated total rewards\n /// @dev This value multiplied by the user contribution is the share of accumulated rewards for the user. Taking\n /// @dev into account the value of totalContributions.\n function rewardPerToken() external view returns (uint256) {\n return rewardPerTokenStored + _rewardPerToken();\n }\n\n /// @notice available earnings for some user\n /// @param account the address of the account\n /// @return the available earnings for the user\n function earned(address account) external view returns (uint256) {\n return rewards[account] + _earned(account, _rewardPerToken());\n }\n\n /// @notice accumulates the current rewards into rewardPerTokenStored and restart the reward calculator\n /// @dev calling this function make no difference. It is useful for testing and when the reward calculator\n /// @dev is changed.\n function restartRewards() external {\n _restartRewards();\n }\n\n /// @notice update the contribution for a user\n /// @param account the address of the account\n /// @dev if the user change his holdings (or any other parameter that affect the contribution calculation),\n /// @dev he can the reward distribution to his favor. This function must be called by an external agent ASAP to\n /// @dev update the contribution for the user. We understand the risk but the rewards are distributes slowly so\n /// @dev the user cannot affect the reward distribution heavily.\n function computeContribution(address account) external {\n require(account != address(0), \"SandRewardPool: invalid address\");\n // We decide to give the user the accumulated rewards even if he cheated a little bit.\n _processRewards(account);\n _updateContribution(account);\n }\n\n /// @notice update the contribution for a sef of users\n /// @param accounts the addresses of the accounts to update\n /// @dev see: computeContribution\n function computeContributionInBatch(address[] calldata accounts) external {\n _restartRewards();\n for (uint256 i = 0; i < accounts.length; i++) {\n address account = accounts[i];\n if (account == address(0)) {\n continue;\n }\n _processAccountRewards(account);\n _updateContribution(account);\n }\n }\n\n /// @notice stake some amount into the contract\n /// @param amount the amount of tokens to stake\n /// @dev the user must approve in the stack token before calling this function\n function stake(uint256 amount) external nonReentrant {\n require(amount > 0, \"SandRewardPool: Cannot stake 0\");\n\n // The first time a user stakes he cannot remove his rewards immediately.\n if (antiCompound.lastClaim[_msgSender()] == 0) {\n antiCompound.lastClaim[_msgSender()] = block.timestamp;\n }\n\n uint256 earlierRewards = 0;\n\n if (_totalContributions == 0 && rewardCalculator != IRewardCalculator(address(0))) {\n earlierRewards = rewardCalculator.getRewards();\n }\n\n _processRewards(_msgSender());\n super._stake(amount);\n _updateContribution(_msgSender());\n require(_contributions[_msgSender()] > 0, \"SandRewardPool: not enough contributions\");\n\n if (earlierRewards != 0) {\n rewards[_msgSender()] = rewards[_msgSender()] + earlierRewards;\n }\n emit Staked(_msgSender(), amount);\n }\n\n /// @notice withdraw the stake from the contract\n /// @param amount the amount of tokens to withdraw\n /// @dev the user can withdraw his stake independently from the rewards\n function withdraw(uint256 amount) external nonReentrant {\n _processRewards(_msgSender());\n _withdrawStake(_msgSender(), amount);\n _updateContribution(_msgSender());\n }\n\n /// @notice withdraw the stake and the rewards from the contract\n function exit() external nonReentrant {\n _processRewards(_msgSender());\n _withdrawStake(_msgSender(), _balances[_msgSender()]);\n _withdrawRewards(_msgSender());\n _updateContribution(_msgSender());\n emit Exit(_msgSender());\n }\n\n /// @notice withdraw the rewards from the contract\n /// @dev the user can withdraw his stake independently from the rewards\n function getReward() external nonReentrant {\n _processRewards(_msgSender());\n _withdrawRewards(_msgSender());\n _updateContribution(_msgSender());\n }\n\n function _withdrawStake(address account, uint256 amount) internal {\n require(amount > 0, \"SandRewardPool: Cannot withdraw 0\");\n super._withdraw(amount);\n emit Withdrawn(account, amount);\n }\n\n function _withdrawRewards(address account) internal antiCompoundCheck(account) {\n uint256 reward = rewards[account];\n if (reward > 0) {\n rewards[account] = 0;\n rewardToken.safeTransfer(account, reward);\n emit RewardPaid(account, reward);\n }\n }\n\n function _updateContribution(address account) internal {\n uint256 oldContribution = _contributions[account];\n _totalContributions = _totalContributions - oldContribution;\n uint256 contribution = _computeContribution(account);\n _totalContributions = _totalContributions + contribution;\n _contributions[account] = contribution;\n emit ContributionUpdated(account, contribution, oldContribution);\n }\n\n function _computeContribution(address account) internal returns (uint256) {\n if (contributionCalculator == IContributionCalculator(address(0))) {\n return _balances[account];\n } else {\n return contributionCalculator.computeContribution(account, _balances[account]);\n }\n }\n\n // Something changed (stake, withdraw, etc), we distribute current accumulated rewards and start from zero.\n // Called each time there is a change in contract state (stake, withdraw, etc).\n function _processRewards(address account) internal {\n _restartRewards();\n _processAccountRewards(account);\n }\n\n // Update the earnings for this specific user with what he earned until now\n function _processAccountRewards(address account) internal {\n // usually _earned takes _rewardPerToken() but in this method is zero because _restartRewards must be\n // called before _processAccountRewards\n rewards[account] = rewards[account] + _earned(account, 0);\n // restart rewards for this specific user, now earned(account) = 0\n userRewardPerTokenPaid[account] = rewardPerTokenStored;\n }\n\n function _restartRewards() internal {\n if (rewardCalculator != IRewardCalculator(address(0))) {\n // Distribute the accumulated rewards\n rewardPerTokenStored = rewardPerTokenStored + _rewardPerToken();\n // restart rewards so now the rewardCalculator return zero rewards\n rewardCalculator.restartRewards();\n }\n }\n\n function _earned(address account, uint256 rewardPerToken) internal view returns (uint256) {\n // - userRewardPerTokenPaid[account] * _contributions[account] / _totalContributions is the portion of\n // rewards the last time the user changed his contribution and called _restartRewards\n // (_totalContributions corresponds to previous value of that moment).\n // - rewardPerTokenStored * _contributions[account] is the share of the user from the\n // accumulated rewards (from the start of time until the last call to _restartRewards) with the\n // current value of _totalContributions\n // - _rewardPerToken() * _contributions[account] / _totalContributions is the share of the user of the\n // rewards from the last time anybody called _restartRewards until this moment\n //\n // The important thing to note is that at any moment in time _contributions[account] / _totalContributions is\n // the share of the user even if _totalContributions changes because of other users activity.\n return\n ((rewardPerToken + rewardPerTokenStored - userRewardPerTokenPaid[account]) * _contributions[account]) /\n 1e24;\n }\n\n // This function gives the proportion of the total contribution that corresponds to each user from\n // last restartRewards call.\n // _rewardsPerToken() * _contributions[account] is the amount of extra rewards gained from last restartRewards.\n function _rewardPerToken() internal view returns (uint256) {\n if (rewardCalculator == IRewardCalculator(address(0)) || _totalContributions == 0) {\n return 0;\n }\n return (rewardCalculator.getRewards() * 1e24) / _totalContributions;\n }\n\n function _msgSender() internal view override(Context, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n}\n" + }, + "src/solc_0.8/defi/StakeTokenWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\n\nabstract contract StakeTokenWrapper is Context {\n using Address for address;\n using SafeERC20 for IERC20;\n IERC20 internal _stakeToken;\n\n uint256 internal _totalSupply;\n mapping(address => uint256) internal _balances;\n\n constructor(IERC20 stakeToken) {\n require(address(stakeToken).isContract(), \"StakeTokenWrapper: is not a contract\");\n _stakeToken = stakeToken;\n }\n\n function _stake(uint256 amount) internal virtual {\n require(amount > 0, \"StakeTokenWrapper: amount > 0\");\n _totalSupply = _totalSupply + amount;\n _balances[_msgSender()] = _balances[_msgSender()] + amount;\n _stakeToken.safeTransferFrom(_msgSender(), address(this), amount);\n }\n\n function _withdraw(uint256 amount) internal virtual {\n require(amount > 0, \"StakeTokenWrapper: amount > 0\");\n _totalSupply = _totalSupply - amount;\n _balances[_msgSender()] = _balances[_msgSender()] - amount;\n _stakeToken.safeTransfer(_msgSender(), amount);\n }\n\n uint256[50] private __gap;\n}\n" + }, + "src/solc_0.8/defi/StakeTokenWrapperV2.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Context} from \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport {SafeERC20, IERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\n\n/// @title Token wrapper contract to be used by the staking pools\nabstract contract StakeTokenWrapperV2 is Context {\n using Address for address;\n using SafeERC20 for IERC20;\n IERC20 internal _stakeToken;\n\n uint256 internal _totalSupply;\n mapping(address => uint256) internal _balances;\n\n constructor(IERC20 stakeToken) {\n require(address(stakeToken).isContract(), \"StakeTokenWrapper: is not a contract\");\n _stakeToken = stakeToken;\n }\n\n function _stake(uint256 amount) internal virtual {\n require(amount > 0, \"StakeTokenWrapper: amount > 0\");\n\n address _sender = _msgSender();\n\n _totalSupply += amount;\n _balances[_sender] += amount;\n _stakeToken.safeTransferFrom(_sender, address(this), amount);\n }\n\n function _withdraw(uint256 amount) internal virtual {\n require(amount > 0, \"StakeTokenWrapper: amount > 0\");\n\n address _sender = _msgSender();\n\n _totalSupply -= amount;\n _balances[_sender] -= amount;\n _stakeToken.safeTransfer(_sender, amount);\n }\n}\n" + }, + "src/solc_0.8/faucet/Faucet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport \"@openzeppelin/contracts-0.8/utils/Strings.sol\";\n\ncontract Faucet is Ownable {\n IERC20 internal immutable _ierc20;\n uint256 internal _period;\n uint256 internal _amountLimit;\n\n mapping(address => uint256) public _lastTimestamps;\n\n constructor(\n IERC20 ierc20,\n uint256 period,\n uint256 amountLimit\n ) {\n _ierc20 = ierc20;\n _period = period;\n _amountLimit = amountLimit;\n }\n\n event FaucetPeriod(uint256 period);\n event FaucetLimit(uint256 amountLimit);\n event FaucetSent(address _receiver, uint256 _amountSent);\n event FaucetRetrieved(address receiver, uint256 _amountSent);\n\n /// @notice set the minimum time delta between 2 calls to send() for an address.\n /// @param period time delta between 2 calls to send() for an address.\n function setPeriod(uint256 period) public onlyOwner {\n _period = period;\n emit FaucetPeriod(period);\n }\n\n /// @notice returns the minimum time delta between 2 calls to Send for an address.\n function getPeriod() public view returns (uint256) {\n return _period;\n }\n\n /// @notice return the maximum IERC20 token amount for an address.\n function setLimit(uint256 amountLimit) public onlyOwner {\n _amountLimit = amountLimit;\n emit FaucetLimit(amountLimit);\n }\n\n /// @notice return the maximum IERC20 token amount for an address.\n function getLimit() public view returns (uint256) {\n return _amountLimit;\n }\n\n /// @notice return the current IERC20 token balance for the contract.\n function balance() public view returns (uint256) {\n return _ierc20.balanceOf(address(this));\n }\n\n /// @notice retrieve all IERC20 token from contract to an address.\n /// @param receiver The address that will receive all IERC20 tokens.\n function retrieve(address receiver) public onlyOwner {\n uint256 accountBalance = balance();\n _ierc20.transferFrom(address(this), receiver, accountBalance);\n\n emit FaucetRetrieved(receiver, accountBalance);\n }\n\n /// @notice send amount of IERC20 to a receiver.\n /// @param amount The value of the IERC20 token that the receiver will received.\n function send(uint256 amount) public {\n require(\n amount <= _amountLimit,\n string(abi.encodePacked(\"Demand must not exceed \", Strings.toString(_amountLimit)))\n );\n\n uint256 accountBalance = balance();\n\n require(\n accountBalance > 0,\n string(abi.encodePacked(\"Insufficient balance on Faucet account: \", Strings.toString(accountBalance)))\n );\n require(\n _lastTimestamps[msg.sender] + _period < block.timestamp,\n string(abi.encodePacked(\"After each call you must wait \", Strings.toString(_period), \" seconds.\"))\n );\n _lastTimestamps[msg.sender] = block.timestamp;\n\n if (accountBalance < amount) {\n amount = accountBalance;\n }\n _ierc20.transferFrom(address(this), msg.sender, amount);\n\n emit FaucetSent(msg.sender, amount);\n }\n}\n" + }, + "src/solc_0.8/faucet/Faucets.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\n\ncontract Faucets is Ownable {\n event Faucet(address faucet, bool enabled);\n event Period(address faucet, uint256 period);\n event Limit(address faucet, uint256 limit);\n event Claimed(address faucet, address receiver, uint256 amount);\n event Withdrawn(address faucet, address receiver, uint256 amount);\n\n mapping(address => bool) private _faucets;\n mapping(address => uint256) private _periods;\n mapping(address => uint256) private _limits;\n mapping(address => mapping(address => uint256)) private _lastTimestamps;\n\n modifier exists(address faucet) {\n require(_faucets[faucet], \"Faucets: FAUCET_DOES_NOT_EXIST\");\n _;\n }\n\n function addFaucet(\n address faucet,\n uint256 period,\n uint256 limit\n ) public onlyOwner {\n require(!_faucets[faucet], \"Faucets: FAUCET_ALREADY_EXISTS\");\n _setFaucet(faucet);\n _setPeriod(faucet, period);\n _setLimit(faucet, limit);\n }\n\n function _setFaucet(address faucet) internal {\n _faucets[faucet] = true;\n emit Faucet(faucet, true);\n }\n\n function removeFaucet(address faucet) external onlyOwner exists(faucet) {\n _withdraw(faucet, _msgSender());\n delete _faucets[faucet];\n delete _periods[faucet];\n delete _limits[faucet];\n emit Faucet(faucet, false);\n }\n\n function getFaucet(address faucet) public view returns (bool) {\n return _faucets[faucet];\n }\n\n function setPeriod(address faucet, uint256 period) public onlyOwner exists(faucet) {\n _setPeriod(faucet, period);\n }\n\n function _setPeriod(address faucet, uint256 period) internal {\n _periods[faucet] = period;\n emit Period(faucet, period);\n }\n\n function getPeriod(address faucet) public view exists(faucet) returns (uint256) {\n return _periods[faucet];\n }\n\n function setLimit(address faucet, uint256 limit) public onlyOwner exists(faucet) {\n _setLimit(faucet, limit);\n }\n\n function _setLimit(address faucet, uint256 limit) internal {\n _limits[faucet] = limit;\n emit Limit(faucet, limit);\n }\n\n function getLimit(address faucet) public view exists(faucet) returns (uint256) {\n return _limits[faucet];\n }\n\n function getBalance(address faucet) public view exists(faucet) returns (uint256) {\n return IERC20(faucet).balanceOf(address(this));\n }\n\n function _getBalance(address faucet) internal view exists(faucet) returns (uint256) {\n return IERC20(faucet).balanceOf(address(this));\n }\n\n function canClaim(address faucet, address walletAddress) external view exists(faucet) returns (bool) {\n return _canClaim(faucet, walletAddress);\n }\n\n function _canClaim(address faucet, address walletAddress) internal view returns (bool) {\n return _lastTimestamps[faucet][walletAddress] + _periods[faucet] < block.timestamp;\n }\n\n function withdraw(address faucet, address receiver) external onlyOwner exists(faucet) {\n _withdraw(faucet, receiver);\n }\n\n function _withdraw(address faucet, address receiver) internal onlyOwner {\n uint256 accountBalance = _getBalance(faucet);\n IERC20(faucet).transfer(receiver, accountBalance);\n emit Withdrawn(faucet, receiver, accountBalance);\n }\n\n function claimBatch(address[] calldata faucets, uint256[] calldata amounts) public {\n require(faucets.length == amounts.length, \"Faucets: ARRAY_LENGTH_MISMATCH\");\n for (uint256 i = 0; i < faucets.length; i++) {\n claim(faucets[i], amounts[i]);\n }\n }\n\n function claim(address faucet, uint256 amount) public exists(faucet) {\n require(amount <= _limits[faucet], \"Faucets: AMOUNT_EXCEEDED_LIMIT\");\n uint256 accountBalance = _getBalance(faucet);\n require(accountBalance >= amount, \"Faucets: FAUCET_INSUFFICIENT_BALANCE\");\n require(_canClaim(faucet, msg.sender), \"Faucets: FAUCET_PERIOD_COOLDOWN\");\n _lastTimestamps[faucet][msg.sender] = block.timestamp;\n IERC20(faucet).transfer(msg.sender, amount);\n emit Claimed(faucet, msg.sender, amount);\n }\n}\n" + }, + "src/solc_0.8/Game/GameBaseToken.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC721/IERC721Receiver.sol\";\n\nimport \"../common/BaseWithStorage/ImmutableERC721.sol\";\nimport \"../common/BaseWithStorage/WithMinter.sol\";\nimport \"../common/interfaces/IGameToken.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\ncontract GameBaseToken is IERC721Receiver, ImmutableERC721, WithMinter, Initializable, IGameToken {\n /////////////////////////////// Data //////////////////////////////\n\n IERC1155 internal _assetERC1155;\n IERC721 internal _assetERC721;\n\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n mapping(uint256 => mapping(uint256 => uint256)) private _gameERC1155Assets;\n mapping(uint256 => mapping(uint256 => uint256)) private _gameERC721Assets;\n mapping(uint256 => address) private _creatorship; // creatorship transfer\n\n mapping(uint256 => bytes32) private _metaData;\n mapping(address => mapping(address => bool)) private _gameEditors;\n /////////////////////////////// Events //////////////////////////////\n\n /// @dev Emits when a game is updated.\n /// @param oldId The id of the previous ERC721 GAME token.\n /// @param newId The id of the newly minted token.\n /// @param update The changes made to the Game: new assets, removed assets, uri\n\n event GameTokenUpdated(uint256 indexed oldId, uint256 indexed newId, IGameToken.GameData update);\n\n /// @dev Emits when creatorship of a GAME token is transferred.\n /// @param original The original creator of the GAME token.\n /// @param from The current 'creator' of the token.\n /// @param to The new 'creator' of the token.\n event CreatorshipTransfer(address indexed original, address indexed from, address indexed to);\n\n /// @dev Emits when an address has its gameEditor status changed.\n /// @param gameOwner The owner of the GAME token.\n /// @param gameEditor The address whose editor rights to update.\n /// @param isEditor WHether the address 'gameEditor' should be an editor.\n event GameEditorSet(address indexed gameOwner, address gameEditor, bool isEditor);\n\n function initV1(\n address trustedForwarder,\n address admin,\n IERC1155 asset1155,\n IERC721 asset721,\n uint8 chainIndex\n ) public initializer {\n _admin = admin;\n _assetERC1155 = asset1155;\n _assetERC721 = asset721;\n ImmutableERC721.__ImmutableERC721_initialize(chainIndex);\n ERC2771Handler.__ERC2771Handler_initialize(trustedForwarder);\n }\n\n /////////////////////////////// Modifiers //////////////////////////////\n\n modifier notToZero(address to) {\n require(to != address(0), \"DESTINATION_ZERO_ADDRESS\");\n _;\n }\n\n modifier notToThis(address to) {\n require(to != address(this), \"DESTINATION_GAME_CONTRACT\");\n _;\n }\n\n function onERC721Received(\n address, /*operator*/\n address, /*from*/\n uint256, /*id*/\n bytes calldata /*data*/\n ) external view override returns (bytes4) {\n require(_msgSender() == address(_assetERC721), \"WRONG_SENDER\");\n return IERC721Receiver.onERC721Received.selector;\n }\n\n /////////////////////////////// Functions //////////////////////////////\n\n /// @notice Create a new GAME token.\n /// @param from The address of the one creating the game (may be different from msg.sender if metaTx).\n /// @param to The address who will be assigned ownership of this game.\n /// @param creation The struct containing ids & ammounts of assets to add to this game,\n /// along with the uri to set.\n /// @param editor The address to allow to edit (can also be set later).\n /// @param subId A random id created on the backend.\n /// @return id The id of the new GAME token (ERC721).\n function createGame(\n address from,\n address to,\n IGameToken.GameData memory creation,\n address editor,\n uint64 subId\n ) external override onlyMinter notToZero(to) notToThis(to) returns (uint256 id) {\n (uint256 gameId, uint256 strgId) = _mintGame(from, to, subId, 0, true);\n\n if (editor != address(0)) {\n _setGameEditor(to, editor, true);\n }\n\n if (creation.gameData721.assetIdsToAdd.length != 0) {\n _addAssets(from, strgId, creation.gameData721.assetIdsToAdd, new uint256[](0), false);\n }\n\n if (creation.gameData1155.assetIdsToAdd.length != 0) {\n _addAssets(\n from,\n strgId,\n creation.gameData1155.assetIdsToAdd,\n creation.gameData1155.assetAmountsToAdd,\n true\n );\n }\n\n _metaData[strgId] = creation.uri;\n emit GameTokenUpdated(0, gameId, creation);\n return gameId;\n }\n\n /// @notice Update an existing GAME token.This actually burns old token\n /// and mints new token with same basId & incremented version.\n /// @param from The one updating the GAME token.\n /// @param gameId The current id of the GAME token.\n /// @param update The values to use for the update.\n /// @return The new gameId.\n function updateGame(\n address from,\n uint256 gameId,\n IGameToken.GameData memory update\n ) external override onlyMinter returns (uint256) {\n uint256 id = _storageId(gameId);\n if (update.gameData721.assetIdsToAdd.length != 0) {\n _addAssets(from, id, update.gameData721.assetIdsToAdd, new uint256[](0), false);\n }\n if (update.gameData721.assetIdsToRemove.length != 0) {\n _removeAssets(id, update.gameData721.assetIdsToRemove, new uint256[](0), _ownerOf(gameId), false);\n }\n\n if (update.gameData1155.assetIdsToAdd.length != 0) {\n _addAssets(from, id, update.gameData1155.assetIdsToAdd, update.gameData1155.assetAmountsToAdd, true);\n }\n if (update.gameData1155.assetIdsToRemove.length != 0) {\n _removeAssets(\n id,\n update.gameData1155.assetIdsToRemove,\n update.gameData1155.assetAmountsToRemove,\n _ownerOf(gameId),\n true\n );\n }\n _metaData[id] = update.uri;\n uint256 newId = _bumpGameVersion(from, gameId);\n emit GameTokenUpdated(gameId, newId, update);\n return newId;\n }\n\n /// @notice Allow token owner to set game editors.\n /// @param gameOwner The address of a GAME token creator.\n /// @param editor The address of the editor to set.\n /// @param isEditor Add or remove the ability to edit.\n function setGameEditor(\n address gameOwner,\n address editor,\n bool isEditor\n ) external override {\n require(_msgSender() == gameOwner, \"EDITOR_ACCESS_DENIED\");\n _setGameEditor(gameOwner, editor, isEditor);\n }\n\n /// @notice Transfers creatorship of `original` from `sender` to `to`.\n /// @param gameId The current id of the GAME token.\n /// @param sender The address of current registered creator.\n /// @param to The address to transfer the creatorship to\n function transferCreatorship(\n uint256 gameId,\n address sender,\n address to\n ) external override notToZero(to) {\n require(_ownerOf(gameId) != address(0), \"NONEXISTENT_TOKEN\");\n uint256 id = _storageId(gameId);\n address msgSender = _msgSender();\n require(msgSender == sender || _superOperators[msgSender], \"TRANSFER_ACCESS_DENIED\");\n require(sender != address(0), \"NOT_FROM_ZEROADDRESS\");\n address originalCreator = address(uint160(id / CREATOR_OFFSET_MULTIPLIER));\n address current = creatorOf(gameId);\n require(current != to, \"CURRENT_=_TO\");\n require(current == sender, \"CURRENT_!=_SENDER\");\n _creatorship[id] = to;\n emit CreatorshipTransfer(originalCreator, current, to);\n }\n\n /// @notice Burn a GAME token and recover assets.\n /// @param from The address of the one destroying the game.\n /// @param to The address to send all GAME assets to.\n /// @param gameId The id of the GAME to destroy.\n /// @param assetERC1155Ids The ERC1155 assets to recover from the burnt GAME.\n /// @param assetERC721Ids The ERC721 assets to recover from the burnt GAME.\n function burnAndRecover(\n address from,\n address to,\n uint256 gameId,\n uint256[] calldata assetERC1155Ids,\n uint256[] calldata assetERC721Ids\n ) external override notToZero(to) notToThis(to) {\n _burnGame(from, gameId);\n if (assetERC1155Ids.length != 0) {\n _recoverAssets(from, to, gameId, assetERC1155Ids, true);\n }\n if (assetERC721Ids.length != 0) {\n _recoverAssets(from, to, gameId, assetERC721Ids, false);\n }\n }\n\n /// @notice Burn a GAME token.\n /// @param gameId The id of the GAME to destroy.\n function burn(uint256 gameId) external override(ERC721BaseToken, IGameToken) {\n _burnGame(_msgSender(), gameId);\n }\n\n /// @notice Burn a GAME token on behalf of owner.\n /// @param from The address whose GAME is being burnt.\n /// @param gameId The id of the GAME to burn.\n function burnFrom(address from, uint256 gameId) external override(ERC721BaseToken, IGameToken) {\n require(from != address(0), \"NOT_FROM_ZEROADDRESS\");\n _burnGame(from, gameId);\n }\n\n /// @notice Transfer assets from a burnt GAME.\n /// @param from Previous owner of the burnt game.\n /// @param to Address that will receive the assets.\n /// @param gameId Id of the burnt GAME token.\n /// @param assetERC1155Ids The ERC1155 assets to recover from the burnt GAME.\n /// @param assetERC721Ids The ERC1155 assets to recover from the burnt GAME.\n function recoverAssets(\n address from,\n address to,\n uint256 gameId,\n uint256[] calldata assetERC1155Ids,\n uint256[] calldata assetERC721Ids\n ) public override {\n if (assetERC1155Ids.length != 0) {\n _recoverAssets(from, to, gameId, assetERC1155Ids, true);\n }\n if (assetERC721Ids.length != 0) {\n _recoverAssets(from, to, gameId, assetERC721Ids, false);\n }\n }\n\n /// @notice Get the amount of each assetId in a GAME.\n /// @param gameId The game to query.\n /// @param assetIds The assets to get balances for.\n function getERC1155AssetBalances(uint256 gameId, uint256[] calldata assetIds)\n external\n view\n override\n returns (uint256[] memory)\n {\n uint256 storageId = _storageId(gameId);\n require(_ownerOf(gameId) != address(0), \"NONEXISTENT_TOKEN\");\n uint256 length = assetIds.length;\n uint256[] memory assets;\n assets = new uint256[](length);\n for (uint256 i = 0; i < length; i++) {\n assets[i] = _gameERC1155Assets[storageId][assetIds[i]];\n }\n return assets;\n }\n\n /// @notice Get the amount of each assetId in a GAME.\n /// @param gameId The game to query.\n /// @param assetIds The assets to get balances for.\n function getERC721AssetBalances(uint256 gameId, uint256[] calldata assetIds)\n external\n view\n override\n returns (uint256[] memory)\n {\n uint256 storageId = _storageId(gameId);\n require(_ownerOf(gameId) != address(0), \"NONEXISTENT_TOKEN\");\n uint256 length = assetIds.length;\n uint256[] memory assets;\n assets = new uint256[](length);\n for (uint256 i = 0; i < length; i++) {\n assets[i] = _gameERC721Assets[storageId][assetIds[i]];\n }\n return assets;\n }\n\n /// @notice Get game editor status.\n /// @param gameOwner The address of the owner of the GAME.\n /// @param editor The address of the editor to set.\n /// @return isEditor Editor status of editor for given tokenId.\n function isGameEditor(address gameOwner, address editor) external view override returns (bool isEditor) {\n return _gameEditors[gameOwner][editor];\n }\n\n /// @notice Called by other contracts to check if this can receive ERC1155 batch.\n /// @param operator The address of the operator in the current tx.\n /// @return the bytes4 value 0xbc197c81.\n function onERC1155BatchReceived(\n address operator,\n address, /*from*/\n uint256[] calldata, /*ids*/\n uint256[] calldata, /*values*/\n bytes calldata /*data*/\n ) external view override returns (bytes4) {\n if (operator == address(this)) {\n return ERC1155_BATCH_RECEIVED;\n }\n revert(\"ERC1155_BATCH_REJECTED\");\n }\n\n /// @notice Called by other contracts to check if this can receive ERC1155 tokens.\n /// @param operator The address of the operator in the current tx.\n /// @return the bytes4 value 0xf23a6e61.\n function onERC1155Received(\n address operator,\n address, /*from*/\n uint256, /*id*/\n uint256, /*value*/\n bytes calldata /*data*/\n ) external view override returns (bytes4) {\n if (operator == address(this)) {\n return ERC1155_RECEIVED;\n }\n revert(\"ERC1155_REJECTED\");\n }\n\n /// @notice Return the name of the token contract.\n /// @return The name of the token contract.\n function name() external pure override returns (string memory) {\n return \"The Sandbox: GAME token\";\n }\n\n /// @notice Get the symbol of the token contract.\n /// @return the symbol of the token contract.\n function symbol() external pure override returns (string memory) {\n return \"GAME\";\n }\n\n /// @notice Get the creator of the token type `id`.\n /// @param gameId The id of the token to get the creator of.\n /// @return the creator of the token type `id`.\n function creatorOf(uint256 gameId) public view override returns (address) {\n require(gameId != uint256(0), \"GAME_NEVER_MINTED\");\n uint256 id = _storageId(gameId);\n address originalCreator = address(uint160(id / CREATOR_OFFSET_MULTIPLIER));\n address newCreator = _creatorship[id];\n if (newCreator != address(0)) {\n return newCreator;\n }\n return originalCreator;\n }\n\n /// @notice Return the URI of a specific token.\n /// @param gameId The id of the token.\n /// @return uri The URI of the token metadata.\n function tokenURI(uint256 gameId) public view override returns (string memory uri) {\n require(_ownerOf(gameId) != address(0), \"BURNED_OR_NEVER_MINTED\");\n uint256 id = _storageId(gameId);\n return _toFullURI(_metaData[id]);\n }\n\n /// @notice Check if the contract supports an interface.\n /// 0x01ffc9a7 is ERC-165.\n /// 0x80ac58cd is ERC-721.\n /// @param id The id of the interface.\n /// @return if the interface is supported.\n function supportsInterface(bytes4 id) public pure override returns (bool) {\n return id == 0x01ffc9a7 || id == 0x80ac58cd || id == 0x5b5e139f;\n }\n\n /// @notice Return the amount of token for a storage id\n /// @param strgId The storageId of the GAME to add assets to.\n /// @param assetIds The id of the asset to add to GAME.\n /// @param isERC1155 If the asset is an ERC1155\n /// @return amounts The amounts of token for asset ids.\n function getAndClearAmounts(\n uint256 strgId,\n uint256[] memory assetIds,\n bool isERC1155\n ) internal returns (uint256[] memory amounts) {\n uint256[] memory values;\n values = isERC1155 ? new uint256[](assetIds.length) : new uint256[](0);\n for (uint256 i = 0; i < assetIds.length; i++) {\n if (isERC1155) {\n values[i] = _gameERC1155Assets[strgId][assetIds[i]];\n delete _gameERC1155Assets[strgId][assetIds[i]];\n } else {\n delete _gameERC721Assets[strgId][assetIds[i]];\n }\n }\n return values;\n }\n\n /// @notice Return the amount of token for a storage id\n /// @param strgId The storageId of the GAME to add assets to.\n /// @param assetId The id of the asset to add to GAME.\n /// @param amount The amount to increase.\n /// @param isERC1155 If the asset is an ERC1155\n function _increaseAmount(\n uint256 strgId,\n uint256 assetId,\n uint256 amount,\n bool isERC1155\n ) internal {\n if (isERC1155) {\n require(amount != 0, \"INVALID_ASSET_ADDITION\");\n uint256 currentValue = _gameERC1155Assets[strgId][assetId];\n _gameERC1155Assets[strgId][assetId] = currentValue + amount;\n } else {\n uint256 currentValue = _gameERC721Assets[strgId][assetId];\n require(amount == 1 && currentValue == 0, \"INVALID_ASSET_ADDITION\");\n _gameERC721Assets[strgId][assetId] = 1;\n }\n }\n\n /// @notice Return the amount of token for a storage id\n /// @param strgId The storageId of the GAME to add assets to.\n /// @param assetId The id of the asset to add to GAME.\n /// @param amount The amount to decrease.\n /// @param isERC1155 If the asset is an ERC1155\n function _decreaseAmount(\n uint256 strgId,\n uint256 assetId,\n uint256 amount,\n bool isERC1155\n ) internal {\n if (isERC1155) {\n uint256 currentValue = _gameERC1155Assets[strgId][assetId];\n require(amount != 0 && currentValue >= amount, \"INVALID_ASSET_REMOVAL\");\n _gameERC1155Assets[strgId][assetId] = currentValue - amount;\n } else {\n uint256 currentValue = _gameERC721Assets[strgId][assetId];\n require(amount == 1 && currentValue == 1, \"INVALID_ASSET_REMOVAL\");\n _gameERC721Assets[strgId][assetId] = 0;\n }\n }\n\n /// @notice Return the amount of token for a storage id\n /// @param from The address of the current owner of assets.\n /// @param to The address of the receiver owner of assets.\n /// @param assetIds The id of the asset to add to GAME.\n /// @param amounts The amount of each asset to add to GAME.\n /// @param isERC1155 If the asset is an ERC1155\n function _safeTransferFrom(\n address from,\n address to,\n uint256[] memory assetIds,\n uint256[] memory amounts,\n bool isERC1155\n ) internal {\n if (isERC1155) {\n if (assetIds.length == 1) {\n _assetERC1155.safeTransferFrom(from, to, assetIds[0], amounts[0], \"\");\n } else {\n _assetERC1155.safeBatchTransferFrom(from, to, assetIds, amounts, \"\");\n }\n } else {\n for (uint256 i = 0; i < assetIds.length; i++) {\n _assetERC721.safeTransferFrom(from, to, assetIds[i], \"\");\n }\n }\n }\n\n /// @notice Add assets to an existing GAME.\n /// @param from The address of the current owner of assets.\n /// @param strgId The storageId of the GAME to add assets to.\n /// @param assetIds The id of the asset to add to GAME.\n /// @param amounts The amount of each asset to add to GAME.\n function _addAssets(\n address from,\n uint256 strgId,\n uint256[] memory assetIds,\n uint256[] memory amounts,\n bool isERC1155\n ) internal {\n if (assetIds.length == 0) {\n return;\n }\n require(!isERC1155 || assetIds.length == amounts.length, \"INVALID_INPUT_LENGTHS\");\n for (uint256 i = 0; i < assetIds.length; i++) {\n _increaseAmount(strgId, assetIds[i], isERC1155 ? amounts[i] : 1, isERC1155);\n }\n _safeTransferFrom(from, address(this), assetIds, amounts, isERC1155);\n }\n\n /// @notice Remove assets from a GAME.\n /// @param strgId The storageId of the GAME to remove assets from.\n /// @param assetIds An array of asset Ids to remove.\n /// @param values An array of the number of each asset id to remove.\n /// @param to The address to send removed assets to.\n function _removeAssets(\n uint256 strgId,\n uint256[] memory assetIds,\n uint256[] memory values,\n address to,\n bool isERC1155\n ) internal {\n if (assetIds.length == 0) {\n return;\n }\n require(assetIds.length == values.length && assetIds.length != 0, \"INVALID_INPUT_LENGTHS\");\n for (uint256 i = 0; i < assetIds.length; i++) {\n _decreaseAmount(strgId, assetIds[i], isERC1155 ? values[i] : 1, isERC1155);\n }\n _safeTransferFrom(address(this), to, assetIds, values, isERC1155);\n }\n\n /// @dev See burn / burnFrom.\n function _burnGame(address from, uint256 gameId) internal {\n uint256 storageId = _storageId(gameId);\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(storageId);\n address msgSender = _msgSender();\n require(\n msgSender == owner ||\n (operatorEnabled && _operators[storageId] == msgSender) ||\n _superOperators[msgSender] ||\n _operatorsForAll[from][msgSender],\n \"UNAUTHORIZED_BURN\"\n );\n\n delete _metaData[storageId];\n _creatorship[gameId] = address(0);\n _burn(from, owner, gameId);\n }\n\n /// @dev See recoverAssets.\n function _recoverAssets(\n address from,\n address to,\n uint256 gameId,\n uint256[] memory assetIds,\n bool isERC1155\n ) internal notToZero(to) notToThis(to) {\n require(_ownerOf(gameId) == address(0), \"ONLY_FROM_BURNED_TOKEN\");\n uint256 storageId = _storageId(gameId);\n require(from == _msgSender(), \"INVALID_RECOVERY\");\n _check_withdrawal_authorized(from, gameId);\n require(assetIds.length > 0, \"WITHDRAWAL_COMPLETE\");\n uint256[] memory values = getAndClearAmounts(storageId, assetIds, isERC1155);\n _safeTransferFrom(address(this), to, assetIds, values, isERC1155);\n GameData memory recovery;\n if (isERC1155) {\n recovery.gameData1155.assetIdsToRemove = assetIds;\n recovery.gameData1155.assetAmountsToRemove = values;\n } else {\n recovery.gameData721.assetIdsToRemove = assetIds;\n }\n emit GameTokenUpdated(gameId, 0, recovery);\n }\n\n /// @dev Create a new gameId and associate it with an owner.\n /// @param from The address of one creating the game.\n /// @param to The address of the Game owner.\n /// @param subId The id to use when generating the new GameId.\n /// @param version The version number part of the gameId.\n /// @param isCreation Whether this is a brand new GAME (as opposed to an update).\n /// @return gameId The newly created gameId.\n function _mintGame(\n address from,\n address to,\n uint64 subId,\n uint16 version,\n bool isCreation\n ) internal returns (uint256 gameId, uint256 strgId) {\n uint16 idVersion;\n if (isCreation) {\n idVersion = 1;\n gameId = _generateTokenId(from, subId, _chainIndex, idVersion);\n strgId = _storageId(gameId);\n require(_owners[strgId] == 0, \"STORAGE_ID_REUSE_FORBIDDEN\");\n } else {\n idVersion = version;\n gameId = _generateTokenId(from, subId, _chainIndex, idVersion);\n strgId = _storageId(gameId);\n }\n\n _owners[strgId] = (uint256(idVersion) << 200) + uint256(uint160(to));\n _numNFTPerAddress[to]++;\n emit Transfer(address(0), to, gameId);\n }\n\n /// @dev Allow token owner to set game editors.\n /// @param gameCreator The address of a GAME creator,\n /// @param editor The address of the editor to set.\n /// @param isEditor Add or remove the ability to edit.\n function _setGameEditor(\n address gameCreator,\n address editor,\n bool isEditor\n ) internal {\n emit GameEditorSet(gameCreator, editor, isEditor);\n _gameEditors[gameCreator][editor] = isEditor;\n }\n\n /// @dev Bumps the version number of a game token, buring the previous\n /// version and minting a new one.\n /// @param from The address of the GAME token owner.\n /// @param gameId The Game token to bump the version of.\n /// @return The new gameId.\n function _bumpGameVersion(address from, uint256 gameId) internal returns (uint256) {\n address originalCreator = address(uint160(gameId / CREATOR_OFFSET_MULTIPLIER));\n uint64 subId = uint64(gameId / SUBID_MULTIPLIER);\n uint16 version = uint16(gameId);\n version++;\n address owner = _ownerOf(gameId);\n if (from == owner) {\n // caller is owner or metaTx on owner's behalf\n _burn(from, owner, gameId);\n } else if (_gameEditors[owner][from]) {\n // caller is editor or metaTx on editor's behalf, so we need to pass owner\n // instead of from or _burn will fail\n _burn(owner, owner, gameId);\n }\n (uint256 newId, ) = _mintGame(originalCreator, owner, subId, version, false);\n address newOwner = _ownerOf(newId);\n assert(owner == newOwner);\n return newId;\n }\n\n /// @dev Get the a full URI string for a given hash + gameId.\n /// @param hash The 32 byte IPFS hash.\n /// @return The URI string.\n function _toFullURI(bytes32 hash) internal pure override returns (string memory) {\n return string(abi.encodePacked(\"ipfs://bafybei\", hash2base32(hash), \"/\", \"game.json\"));\n }\n}\n" + }, + "src/solc_0.8/Game/GameMinter.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"./GameBaseToken.sol\";\nimport \"../common/interfaces/IGameMinter.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport \"../common/BaseWithStorage/ERC2771Handler.sol\";\n\ncontract GameMinter is ERC2771Handler, IGameMinter {\n /////////////////////////////// Data //////////////////////////////\n\n GameBaseToken internal immutable _gameToken;\n // @todo confirm actual fees\n uint256 internal immutable _gameMintingFee;\n uint256 internal immutable _gameUpdateFee;\n address internal immutable _feeBeneficiary;\n IERC20 internal immutable _sand;\n\n /////////////////////////////// Functions /////////////////////////\n\n constructor(\n GameBaseToken gameTokenContract,\n address trustedForwarder,\n uint256 gameMintingFee,\n uint256 gameUpdateFee,\n address feeBeneficiary,\n IERC20 sand\n ) {\n _gameToken = gameTokenContract;\n _gameMintingFee = gameMintingFee;\n _gameUpdateFee = gameUpdateFee;\n _feeBeneficiary = feeBeneficiary;\n _sand = sand;\n ERC2771Handler.__ERC2771Handler_initialize(trustedForwarder);\n }\n\n /// @notice Function to create a new GAME token\n /// @param to The address who will be assigned ownership of this game.\n /// @param creation The struct containing ids & ammounts of assets to add to this game,\n /// along with the uri to set.\n /// @param editor The address to allow to edit (can also be set later).\n /// @param subId A random id created on the backend.\n /// @return gameId The id of the new GAME token (erc721)\n function createGame(\n address to,\n GameBaseToken.GameData calldata creation,\n address editor,\n uint64 subId\n ) external override returns (uint256 gameId) {\n address msgSender = _msgSender();\n _chargeSand(msgSender, _gameMintingFee);\n return _gameToken.createGame(msgSender, to, creation, editor, subId);\n }\n\n /// @notice Update an existing GAME token.This actually burns old token\n /// and mints new token with same basId & incremented version.\n /// @param gameId The current id of the GAME token.\n /// @param update The values to use for the update.\n /// @return newId The new gameId.\n function updateGame(uint256 gameId, GameBaseToken.GameData memory update)\n external\n override\n returns (uint256 newId)\n {\n address gameOwner = _gameToken.ownerOf(gameId);\n address msgSender = _msgSender();\n require(msgSender == gameOwner || _gameToken.isGameEditor(gameOwner, msgSender), \"AUTH_ACCESS_DENIED\");\n _chargeSand(msgSender, _gameUpdateFee);\n return _gameToken.updateGame(msgSender, gameId, update);\n }\n\n /// @dev Charge a fee in Sand if conditions are met.\n /// @param from The address responsible for paying the fee.\n /// @param sandFee The fee that applies to the current operation (create || update).\n function _chargeSand(address from, uint256 sandFee) internal {\n if (_feeBeneficiary != address(0) && sandFee != 0) {\n _sand.transferFrom(from, _feeBeneficiary, sandFee);\n }\n }\n}\n" + }, + "src/solc_0.8/Game/GameV1.sol": { + "content": "//SPDX-License-Identifier: MIT\n\n/* solhint-disable no-empty-blocks */\n\npragma solidity 0.8.2;\nimport \"./GameBaseToken.sol\";\n\ncontract GameV1 is GameBaseToken {}\n" + }, + "src/solc_0.8/OperatorFilterer/contracts/OperatorFilterRegistrant.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport {IOperatorFilterRegistry} from \"../interfaces/IOperatorFilterRegistry.sol\";\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\n/// @title OperatorFilterSubription\n/// @notice This contract is ment to register and copy the default subscription of the openSea for the operator filter and our Token contract are supposed to subscribe to This contract on openSea operator filter registry\n/// @custom:experimental This is an experimental contract. There could be future changes according to the change in the requirements\ncontract OperatorFilterSubscription is OwnableUpgradeable {\n address public constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);\n\n IOperatorFilterRegistry public constant operatorFilterRegistry =\n IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);\n\n function initialize() external initializer {\n // Subscribe and copy the entries of the Default subscription list of open sea.\n if (address(operatorFilterRegistry).code.length > 0) {\n operatorFilterRegistry.registerAndCopyEntries(address(this), DEFAULT_SUBSCRIPTION);\n }\n __Ownable_init();\n }\n}\n" + }, + "src/solc_0.8/OperatorFilterer/contracts/upgradeable/DefaultOperatorFiltererUpgradeable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {OperatorFiltererUpgradeable} from \"./OperatorFiltererUpgradeable.sol\";\n\n/// @title DefaultOperatorFiltererUpgradeable\n/// @notice This contract is ment to be imported in Token contracts to subscribe to the default Black list of Opensea.\nabstract contract DefaultOperatorFiltererUpgradeable is OperatorFiltererUpgradeable {\n // Registration address of the default subscription list.\n address public constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);\n\n function __DefaultOperatorFilterer_init(bool subscribe) internal onlyInitializing {\n __OperatorFilterer_init(DEFAULT_SUBSCRIPTION, subscribe);\n }\n}\n" + }, + "src/solc_0.8/OperatorFilterer/contracts/upgradeable/OperatorFiltererUpgradeable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IOperatorFilterRegistry} from \"../../interfaces/IOperatorFilterRegistry.sol\";\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\n///@title OperatorFiltererUpgradeable\n///@author The Sandbox\n///@notice This contract would subscibe or copy or just to the subscription provided or just register to default subscription list\n///@dev This contract is the upgradeable version of the OpenSea implementation https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/OperatorFilterer.sol and adapted to the 0.5.9 solidity version\nabstract contract OperatorFiltererUpgradeable is ContextUpgradeable {\n IOperatorFilterRegistry public operatorFilterRegistry;\n\n event ContractRegistered(address indexed subscriptionOrRegistrant, bool subscribe);\n\n function __OperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe) internal onlyInitializing {\n _register(subscriptionOrRegistrantToCopy, subscribe);\n }\n\n /**\n * @notice Register this contract into the registry\n * @param subscriptionOrRegistrantToCopy address to subscribe or copy entries from\n * @param subscribe should it subscribe\n */\n function _register(address subscriptionOrRegistrantToCopy, bool subscribe) internal {\n if (address(operatorFilterRegistry).code.length > 0) {\n if (!operatorFilterRegistry.isRegistered(address(this))) {\n if (subscribe) {\n operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);\n } else {\n if (subscriptionOrRegistrantToCopy != address(0)) {\n operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);\n } else {\n operatorFilterRegistry.register(address(this));\n }\n }\n }\n }\n emit ContractRegistered(subscriptionOrRegistrantToCopy, subscribe);\n }\n\n modifier onlyAllowedOperator(address from) virtual {\n // Check registry code length to facilitate testing in environments without a deployed registry.\n if (address(operatorFilterRegistry).code.length > 0) {\n // Allow spending tokens from addresses with balance\n // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred\n // from an EOA.\n if (from == _msgSender()) {\n _;\n return;\n }\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), _msgSender())) {\n revert(\"Operator Not Allowed\");\n }\n }\n _;\n }\n\n modifier onlyAllowedOperatorApproval(address operator) virtual {\n // Check registry code length to facilitate testing in environments without a deployed registry.\n if (address(operatorFilterRegistry).code.length > 0) {\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), operator)) {\n revert(\"Operator Not Allowed\");\n }\n }\n _;\n }\n}\n" + }, + "src/solc_0.8/OperatorFilterer/interfaces/IOperatorFilterRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\n/**\n * @title IOperatorFilterRegistry\n * @author OpenSea\n * @notice Interface of the operator filter registry\n * @dev This interface comes from OpenSea https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/IOperatorFilterRegistry.sol and adapted to the 0.5.9 solidity version\n */\ninterface IOperatorFilterRegistry {\n /**\n * @notice Check if the operator is allowed for the given registrant\n * @param registrant address of the registrant\n * @param operator operator address to check\n * @return is the operator allowed\n */\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\n\n /**\n * @notice Register a new address\n * @param registrant address to register\n */\n function register(address registrant) external;\n\n /**\n * @notice Register a new address & subscribe to an address\n * @param registrant address of the registrant\n * @param subscription address where the registrant is subscribed to\n */\n function registerAndSubscribe(address registrant, address subscription) external;\n\n /**\n * @notice Register and copy entries of another registrant\n * @param registrant address of the registrant\n * @param registrantToCopy address to copy from\n */\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\n\n /**\n * @notice update the operator for a registrant\n * @param registrant address of the registrant\n * @param operator operator to be updated\n * @param filtered is it filtered\n */\n function updateOperator(\n address registrant,\n address operator,\n bool filtered\n ) external;\n\n /**\n * @notice Update operators for a registrant\n * @param registrant address of the registrant\n * @param operators addresses of the operators\n * @param filtered is it filtered\n */\n function updateOperators(\n address registrant,\n address[] calldata operators,\n bool filtered\n ) external;\n\n /**\n * @notice Update code hash\n * @param registrant address of the registrant\n * @param codehash code hash\n * @param filtered is it filtered\n */\n function updateCodeHash(\n address registrant,\n bytes32 codehash,\n bool filtered\n ) external;\n\n /**\n * @notice Update code hashes\n * @param registrant address of the registrant\n * @param codeHashes code hashes\n * @param filtered is it filtered\n */\n function updateCodeHashes(\n address registrant,\n bytes32[] calldata codeHashes,\n bool filtered\n ) external;\n\n /**\n * @notice Subscribe a registrant\n * @param registrant address of the registrant\n * @param registrantToSubscribe address to subscribe with\n */\n function subscribe(address registrant, address registrantToSubscribe) external;\n\n /**\n * @notice Unsubscribe a registrant\n * @param registrant address of the registrant\n * @param copyExistingEntries copy existing entries\n */\n function unsubscribe(address registrant, bool copyExistingEntries) external;\n\n /**\n * @notice Get the subscription of an address\n * @param addr address to check\n * @return registrant the registrant address\n */\n function subscriptionOf(address addr) external returns (address registrant);\n\n /**\n * @notice Get the subscribers of the registrant\n * @param registrant address of the registrant\n * @return the subscribers addresses\n */\n function subscribers(address registrant) external returns (address[] memory);\n\n /**\n * @notice Get a specific subscriber\n * @param registrant address of the registrant\n * @param index index to check\n * @return the ith subscriber of the registrant\n */\n function subscriberAt(address registrant, uint256 index) external returns (address);\n\n /**\n * @notice Copy the entries of a registrant\n * @param registrant address of the registrant\n * @param registrantToCopy address to copy\n */\n function copyEntriesOf(address registrant, address registrantToCopy) external;\n\n /**\n * @notice Is a registrant filtered\n * @param registrant address of the registrant\n * @param operator operator address to check\n * @return is it filtered\n */\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\n\n /**\n * @notice Is the code hash of an operator filtered\n * @param registrant address of the registrant\n * @param operatorWithCode operator address to check\n * @return is it filtered\n */\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\n\n /**\n * @notice Is the code hash filtered\n * @param registrant address of the registrant\n * @param codeHash code hash\n * @return is it filtered\n */\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\n\n /**\n * @notice Get the filtered operators\n * @param addr address to check\n * @return filtered operators\n */\n function filteredOperators(address addr) external returns (address[] memory);\n\n /**\n * @notice Get the filtered code hashes\n * @param addr address to check\n * @return filtered code hashes\n */\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\n\n /**\n * @notice Get a specific operator\n * @param registrant address of the registrant\n * @param index index to check\n * @return address of the operator\n */\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\n\n /**\n * @notice Get the ith filtered code hash\n * @param registrant address of the registrant\n * @param index index to check\n * @return the code hash\n */\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\n\n /**\n * @notice Is the address registered\n * @param addr address to check\n * @return is it registered\n */\n function isRegistered(address addr) external returns (bool);\n\n /**\n * @notice Get the code hash for this address\n * @param addr address to check\n * @return the code hash\n */\n function codeHashOf(address addr) external returns (bytes32);\n}\n" + }, + "src/solc_0.8/permit/Permit.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../common/interfaces/IERC20Extended.sol\";\nimport \"../common/BaseWithStorage/WithPermit.sol\";\n\n/// @title Permit contract\n/// @notice This contract manages approvals of SAND via signature\ncontract Permit is WithPermit {\n IERC20Extended internal immutable _sand;\n\n constructor(IERC20Extended sandContractAddress) {\n _sand = sandContractAddress;\n }\n\n /// @notice Permit the expenditure of SAND by a nominated spender.\n /// @param owner The owner of the ERC20 tokens.\n /// @param spender The nominated spender of the ERC20 tokens.\n /// @param value The value (allowance) of the ERC20 tokens that the nominated.\n /// spender will be allowed to spend.\n /// @param deadline The deadline for granting permission to the spender.\n /// @param v The final 1 byte of signature.\n /// @param r The first 32 bytes of signature.\n /// @param s The second 32 bytes of signature.\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public override {\n checkApproveFor(owner, spender, value, deadline, v, r, s);\n _sand.approveFor(owner, spender, value);\n }\n}\n" + }, + "src/solc_0.8/polygon/child/asset/MockPolygonAssetERC1155Tunnel.sol": { + "content": "/* solhint-disable no-empty-blocks */\n// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./PolygonAssetERC1155Tunnel.sol\";\n\ncontract MockPolygonAssetERC1155Tunnel is PolygonAssetERC1155Tunnel {\n function init(\n address _fxChild,\n IPolygonAssetERC1155 _childToken,\n address trustedForwarder,\n uint256 _maxTransferLimit\n ) external {\n PolygonAssetERC1155Tunnel.initialize(_fxChild, _childToken, trustedForwarder, _maxTransferLimit);\n }\n}\n" + }, + "src/solc_0.8/polygon/child/asset/PolygonAssetERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\nimport {AssetBaseERC1155, ERC1155ERC721Helper, IAssetERC721} from \"../../../assetERC1155/AssetBaseERC1155.sol\";\nimport {\n OperatorFiltererUpgradeable\n} from \"../../../OperatorFilterer/contracts/upgradeable/OperatorFiltererUpgradeable.sol\";\nimport {IChildToken} from \"../../../common/interfaces/pos-portal/child/IChildToken.sol\";\n\n/// @title This contract is for AssetERC1155 which can be minted by a minter role.\n/// @dev AssetERC1155 will be minted only on L2 and can be transferred to L1 and not minted on L1.\n/// @dev This contract supports meta transactions.\n/// @dev This contract is final, don't inherit from it.\ncontract PolygonAssetERC1155 is AssetBaseERC1155, ContextUpgradeable, OperatorFiltererUpgradeable, IChildToken {\n address public _childChainManager;\n\n function initialize(\n address trustedForwarder,\n address admin,\n address bouncerAdmin,\n address childChainManager,\n IAssetERC721 polygonAssetERC721,\n uint8 chainIndex,\n address subscription\n ) external initializer {\n require(address(childChainManager) != address(0), \"PolygonAssetERC1155Tunnel: childChainManager can't be zero\");\n init(trustedForwarder, admin, bouncerAdmin, polygonAssetERC721, chainIndex);\n _childChainManager = childChainManager;\n __OperatorFilterer_init(subscription, true);\n }\n\n /// @notice Mint a token type for `creator` on slot `packId`.\n /// @dev For this function it is not required to provide data.\n /// @param creator address of the creator of the token.\n /// @param packId unique packId for that token.\n /// @param hash hash of an IPFS cidv1 folder that contains the metadata of the token type in the file 0.json.\n /// @param supply number of tokens minted for that token type.\n /// @param owner address that will receive the tokens.\n /// @param data extra data to accompany the minting call.\n /// @return id the id of the newly minted token type.\n function mint(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256 supply,\n address owner,\n bytes calldata data\n ) external returns (uint256 id) {\n require(hash != 0, \"HASH==0\");\n require(isBouncer(_msgSender()), \"!BOUNCER\");\n require(owner != address(0), \"TO==0\");\n id = _generateTokenId(creator, supply, packId, supply == 1 ? 0 : 1, 0);\n uint256 uriId = id & ERC1155ERC721Helper.URI_ID;\n require(uint256(_metadataHash[uriId]) == 0, \"ID_TAKEN\");\n _metadataHash[uriId] = hash;\n _mint(_msgSender(), owner, id, supply, data);\n }\n\n /// @notice Creates `amount` tokens of token type `id`, and assigns them to `account`.\n /// @dev Should be used only by PolygonAssetERC1155Tunnel.\n /// @dev This function can be called when the token ID exists on another layer.\n /// @dev Encoded bytes32 metadata hash must be provided as data.\n /// @param owner address that will receive the tokens.\n /// @param id the id of the newly minted token.\n /// @param supply number of tokens minted for that token type.\n /// @param data token metadata.\n function mint(\n address owner,\n uint256 id,\n uint256 supply,\n bytes calldata data\n ) external {\n require(isBouncer(_msgSender()), \"!BOUNCER\");\n require(data.length > 0, \"METADATA_MISSING\");\n require(owner != address(0), \"TO==0\");\n uint256 uriId = id & ERC1155ERC721Helper.URI_ID;\n require(uint256(_metadataHash[uriId]) == 0, \"ID_TAKEN\");\n _metadataHash[uriId] = abi.decode(data, (bytes32));\n _mint(_msgSender(), owner, id, supply, data);\n }\n\n /// @notice Mint multiple token types for `creator` on slot `packId`.\n /// @dev For this function it is not required to provide data.\n /// @param creator address of the creator of the tokens.\n /// @param packId unique packId for the tokens.\n /// @param hash hash of an IPFS cidv1 folder that contains the metadata of each token type in the files: 0.json, 1.json, 2.json, etc...\n /// @param supplies number of tokens minted for each token type.\n /// @param rarityPack rarity power of each token types packed into 2 bits each.\n /// @param owner address that will receive the tokens.\n /// @param data extra data to accompany the minting call.\n /// @return ids the ids of each newly minted token types.\n function mintMultiple(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256[] calldata supplies,\n bytes calldata rarityPack,\n address owner,\n bytes calldata data\n ) external returns (uint256[] memory ids) {\n require(hash != 0, \"HASH==0\");\n require(isBouncer(_msgSender()), \"!BOUNCER\");\n require(owner != address(0), \"TO==0\");\n ids = _allocateIds(creator, supplies, rarityPack, packId, hash);\n _mintBatch(owner, ids, supplies, data);\n }\n\n /// @notice function to be called by tunnel to mint deficit of minted tokens\n /// @dev This mint calls for add instead of replace in packedTokenBalance\n /// @param account address of the ownerof tokens.\n /// @param id id of the token to be minted.\n /// @param amount quantity of the token to be minted.\n function mintDeficit(\n address account,\n uint256 id,\n uint256 amount\n ) external {\n require(isBouncer(_msgSender()), \"!BOUNCER\");\n _mintDeficit(account, id, amount);\n }\n\n /// @notice Burns `amount` tokens of type `id`.\n /// @param id token type which will be burnt.\n /// @param amount amount of token to burn.\n function burn(uint256 id, uint256 amount) external {\n _burn(_msgSender(), id, amount);\n }\n\n /// @notice Burns `amount` tokens of type `id` from `from`.\n /// @param from address whose token is to be burnt.\n /// @param id token type which will be burnt.\n /// @param amount amount of token to burn.\n function burnFrom(\n address from,\n uint256 id,\n uint256 amount\n ) external {\n require(from == _msgSender() || isApprovedForAll(from, _msgSender()), \"!AUTHORIZED\");\n _burn(from, id, amount);\n }\n\n /// @notice This function is called when a token is deposited to the root chain.\n /// @dev Should be callable only by ChildChainManager.\n /// @dev Should handle deposit by minting the required tokenId(s) for user.\n /// @dev Minting can also be done by other functions.\n /// @param user user address for whom deposit is being done.\n /// @param depositData abi encoded tokenIds. Batch deposit also supported.\n function deposit(address user, bytes calldata depositData) external override {\n require(_msgSender() == _childChainManager, \"!DEPOSITOR\");\n require(user != address(0), \"INVALID_DEPOSIT_USER\");\n (uint256[] memory ids, uint256[] memory amounts, bytes memory data) =\n abi.decode(depositData, (uint256[], uint256[], bytes));\n\n _mintBatches(user, ids, amounts, data);\n }\n\n /// @notice called when user wants to withdraw single token back to root chain.\n /// @dev Should burn user's tokens. This transaction will be verified when exiting on root chain.\n /// @param id id to withdraw.\n /// @param amount amount to withdraw.\n function withdrawSingle(uint256 id, uint256 amount) external {\n _burn(_msgSender(), id, amount);\n }\n\n /// @notice called when user wants to batch withdraw tokens back to root chain.\n /// @dev Should burn user's tokens. This transaction will be verified when exiting on root chain.\n /// @param ids ids to withdraw.\n /// @param amounts amounts to withdraw.\n function withdrawBatch(uint256[] calldata ids, uint256[] calldata amounts) external {\n _burnBatch(_msgSender(), ids, amounts);\n }\n\n /// @notice gets the metadata hash set for the and asset with id \"id\"\n /// @param id the id of the asset whose metadata hash has to be returned\n function metadataHash(uint256 id) external view returns (bytes32) {\n return _metadataHash[id & ERC1155ERC721Helper.URI_ID];\n }\n\n function _allocateIds(\n address creator,\n uint256[] memory supplies,\n bytes memory rarityPack,\n uint40 packId,\n bytes32 hash\n ) internal returns (uint256[] memory ids) {\n require(supplies.length > 0, \"SUPPLIES<=0\");\n require(supplies.length <= ERC1155ERC721Helper.MAX_PACK_SIZE, \"BATCH_TOO_BIG\");\n ids = _generateTokenIds(creator, supplies, packId);\n\n require(uint256(_metadataHash[ids[0] & ERC1155ERC721Helper.URI_ID]) == 0, \"ID_TAKEN\");\n _metadataHash[ids[0] & ERC1155ERC721Helper.URI_ID] = hash;\n _rarityPacks[ids[0] & ERC1155ERC721Helper.URI_ID] = rarityPack;\n }\n\n function _generateTokenIds(\n address creator,\n uint256[] memory supplies,\n uint40 packId\n ) internal view returns (uint256[] memory) {\n uint16 numTokenTypes = uint16(supplies.length);\n uint256[] memory ids = new uint256[](numTokenTypes);\n uint16 numNFTs = 0;\n for (uint16 i = 0; i < numTokenTypes; i++) {\n if (numNFTs == 0) {\n if (supplies[i] == 1) {\n numNFTs = uint16(numTokenTypes - i);\n }\n } else {\n require(supplies[i] == 1, \"NFTS_MUST_BE_LAST\");\n }\n }\n uint16 numFTs = numTokenTypes - numNFTs;\n for (uint16 i = 0; i < numTokenTypes; i++) {\n ids[i] = _generateTokenId(creator, supplies[i], packId, numFTs, i);\n }\n return ids;\n }\n\n function _generateTokenId(\n address creator,\n uint256 supply,\n uint40 packId,\n uint16 numFTs,\n uint16 packIndex\n ) internal view returns (uint256) {\n require(supply > 0 && supply <= ERC1155ERC721Helper.MAX_SUPPLY, \"SUPPLY_OUT_OF_BOUNDS\");\n require(numFTs >= 0 && numFTs <= ERC1155ERC721Helper.MAX_NUM_FT, \"NUM_FT_OUT_OF_BOUNDS\");\n return\n uint256(uint160(creator)) *\n ERC1155ERC721Helper.CREATOR_OFFSET_MULTIPLIER + // CREATOR uint160\n (supply == 1 ? uint256(1) * ERC1155ERC721Helper.IS_NFT_OFFSET_MULTIPLIER : 0) + // minted as NFT(1)|FT(0), 1 bit\n uint256(_chainIndex) *\n ERC1155ERC721Helper.CHAIN_INDEX_OFFSET_MULTIPLIER + // mainnet = 0, polygon = 1, uint8\n uint256(packId) *\n ERC1155ERC721Helper.PACK_ID_OFFSET_MULTIPLIER + // packId (unique pack), uint40\n numFTs *\n ERC1155ERC721Helper.PACK_NUM_FT_TYPES_OFFSET_MULTIPLIER + // number of fungible token in the pack, 12 bits\n packIndex; // packIndex (position in the pack), 11 bits\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param value amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override onlyAllowedOperator(from) {\n super._safeTransferFrom(from, to, id, value, data);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @dev call data should be optimized to order ids so packedBalance can be used efficiently.\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param values amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override onlyAllowedOperator(from) {\n super._safeBatchTransferFrom(from, to, ids, values, data);\n }\n\n /// @notice Enable or disable approval for `operator` to manage all `sender`'s tokens.\n /// @dev used for Meta Transaction (from metaTransactionContract).\n /// @param sender address which grant approval.\n /// @param operator address which will be granted rights to transfer all token owned by `sender`.\n /// @param approved whether to approve or revoke.\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) external onlyAllowedOperatorApproval(operator) {\n super._setApprovalForAll(sender, operator, approved);\n }\n\n /// @notice Enable or disable approval for `operator` to manage all of the caller's tokens.\n /// @param operator address which will be granted rights to transfer all tokens of the caller.\n /// @param approved whether to approve or revoke\n function setApprovalForAll(address operator, bool approved)\n external\n override\n onlyAllowedOperatorApproval(operator)\n {\n super._setApprovalForAll(_msgSender(), operator, approved);\n }\n\n function _msgSender()\n internal\n view\n virtual\n override(ContextUpgradeable, AssetBaseERC1155)\n returns (address sender)\n {\n return AssetBaseERC1155._msgSender();\n }\n\n function _msgData() internal view virtual override(ContextUpgradeable, AssetBaseERC1155) returns (bytes calldata) {\n return AssetBaseERC1155._msgData();\n }\n}\n" + }, + "src/solc_0.8/polygon/child/asset/PolygonAssetERC1155Tunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../../common/fx-portal/FxBaseChildTunnelUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\n\nimport \"../../../common/interfaces/IPolygonAssetERC1155.sol\";\nimport \"../../common/ERC1155Receiver.sol\";\nimport \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\n\nimport \"./PolygonAssetERC1155.sol\";\n\n/// @title ASSETERC1155 bridge on L2\ncontract PolygonAssetERC1155Tunnel is\n Initializable,\n FxBaseChildTunnelUpgradeable,\n ERC1155Receiver,\n ERC2771Handler,\n OwnableUpgradeable,\n PausableUpgradeable\n{\n IPolygonAssetERC1155 public childToken;\n uint256 public maxTransferLimit;\n bool private fetchingAssets = false;\n\n event SetTransferLimit(uint256 limit);\n event Deposit(address user, uint256 id, uint256 value, bytes data);\n event Withdraw(address user, uint256 id, uint256 value, bytes data);\n\n // solhint-disable-next-line no-empty-blocks\n constructor() initializer {}\n\n function initialize(\n address _fxChild,\n IPolygonAssetERC1155 _childToken,\n address trustedForwarder,\n uint256 _maxTransferLimit\n ) public initializer {\n require(address(_childToken) != address(0), \"PolygonAssetERC1155Tunnel: _childToken can't be zero\");\n childToken = _childToken;\n maxTransferLimit = _maxTransferLimit;\n __Ownable_init();\n __Pausable_init();\n __ERC2771Handler_initialize(trustedForwarder);\n __FxBaseChildTunnelUpgradeable_initialize(_fxChild);\n }\n\n function setTransferLimit(uint256 _maxTransferLimit) external onlyOwner {\n maxTransferLimit = _maxTransferLimit;\n emit SetTransferLimit(_maxTransferLimit);\n }\n\n function batchWithdrawToRoot(\n address to,\n uint256[] calldata ids,\n uint256[] calldata values\n ) external whenNotPaused {\n require(to != address(0), \"PolygonAssetERC1155Tunnel: to can't be zero\");\n require(ids.length > 0, \"MISSING_TOKEN_IDS\");\n require(ids.length < maxTransferLimit, \"EXCEEDS_TRANSFER_LIMIT\");\n bytes32[] memory metadataHashes = new bytes32[](ids.length);\n fetchingAssets = true;\n for (uint256 i = 0; i < ids.length; i++) {\n bytes32 metadataHash = childToken.metadataHash(ids[i]);\n metadataHashes[i] = metadataHash;\n bytes memory metadata = abi.encode(metadataHash);\n childToken.safeTransferFrom(_msgSender(), address(this), ids[i], values[i], abi.encode(metadataHash));\n emit Withdraw(to, ids[i], values[i], metadata);\n }\n fetchingAssets = false;\n _sendMessageToRoot(abi.encode(to, ids, values, abi.encode(metadataHashes)));\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n }\n\n /// @dev Pauses all token transfers across bridge\n function pause() external onlyOwner {\n _pause();\n }\n\n /// @dev Unpauses all token transfers across bridge\n function unpause() external onlyOwner {\n _unpause();\n }\n\n function _processMessageFromRoot(\n uint256, /* stateId */\n address sender,\n bytes memory data\n ) internal override validateSender(sender) {\n _syncDeposit(data);\n }\n\n function _syncDeposit(bytes memory syncData) internal {\n (address to, uint256[] memory ids, uint256[] memory values, bytes memory data) =\n abi.decode(syncData, (address, uint256[], uint256[], bytes));\n bytes32[] memory metadataHashes = abi.decode(data, (bytes32[]));\n for (uint256 i = 0; i < ids.length; i++) {\n bytes memory metadata = abi.encode(metadataHashes[i]);\n if (childToken.doesHashExist(ids[i])) {\n _depositMinted(to, ids[i], values[i], metadata);\n } else {\n childToken.mint(to, ids[i], values[i], metadata);\n }\n emit Deposit(to, ids[i], values[i], metadata);\n }\n }\n\n function _depositMinted(\n address to,\n uint256 id,\n uint256 value,\n bytes memory data\n ) internal {\n uint256 balance = childToken.balanceOf(address(this), id);\n if (balance >= value) {\n childToken.safeTransferFrom(address(this), to, id, value, data);\n } else {\n if (balance > 0) childToken.safeTransferFrom(address(this), to, id, balance, data);\n childToken.mintDeficit(to, id, (value - balance));\n }\n }\n\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n\n function onERC1155Received(\n address, /*_operator*/\n address, /*_from*/\n uint256, /*_id*/\n uint256, /*_value*/\n bytes calldata /*_data*/\n ) external view override returns (bytes4) {\n require(fetchingAssets == true, \"PolygonAssetERC1155Tunnel: can't directly send Assets\");\n return 0xf23a6e61; //bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))\n }\n\n function onERC1155BatchReceived(\n address, /*_operator*/\n address, /*_from*/\n uint256[] calldata, /*_ids*/\n uint256[] calldata, /*_values*/\n bytes calldata /*_data*/\n ) external view override returns (bytes4) {\n require(fetchingAssets == true, \"PolygonAssetERC1155Tunnel: can't directly send Assets\");\n return 0xbc197c81; //bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))\n }\n\n function supportsInterface(bytes4 interfaceId) external pure override returns (bool) {\n return\n interfaceId == 0x4e2312e0 || // ERC1155Receiver\n interfaceId == 0x01ffc9a7; // ERC165\n }\n}\n" + }, + "src/solc_0.8/polygon/child/asset/PolygonAssetERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\nimport {BaseERC721} from \"../../../assetERC721/BaseERC721.sol\";\nimport {IPolygonAssetERC721} from \"../../../common/interfaces/IPolygonAssetERC721.sol\";\nimport {IERC721Base} from \"../../../common/interfaces/IERC721Base.sol\";\nimport {\n OperatorFiltererUpgradeable\n} from \"../../../OperatorFilterer/contracts/upgradeable/OperatorFiltererUpgradeable.sol\";\n\n/// @title This contract is for AssetERC721 which can be minted by a minter role.\n/// @dev AssetERC721 will be minted only on L2 and can be transferred to L1 but not minted on L1.\n/// @dev This contract supports meta transactions.\n/// @dev This contract is final, don't inherit from it.\ncontract PolygonAssetERC721 is BaseERC721, IPolygonAssetERC721, OperatorFiltererUpgradeable {\n bytes32 public constant METADATA_ROLE = keccak256(\"METADATA_ROLE\");\n\n /// @notice fulfills the purpose of a constructor in upgradeable contracts\n function initialize(\n address trustedForwarder,\n address admin,\n address subscription\n ) public initializer {\n _setupRole(DEFAULT_ADMIN_ROLE, admin);\n _trustedForwarder = trustedForwarder;\n __ERC721_init(\"Sandbox's ASSETs ERC721\", \"ASSETERC721\");\n __OperatorFilterer_init(subscription, true);\n }\n\n /// @notice Creates a new token for `to`\n /// @dev Minting is only permitted to MINTER_ROLE\n /// @param to The address that will receive a new token\n /// @param id The id of the new token\n function mint(address to, uint256 id) public override(BaseERC721, IERC721Base) onlyRole(MINTER_ROLE) {\n BaseERC721.mint(to, id);\n }\n\n /// @notice Creates a new token for `to`\n /// @dev Minting is only permitted to MINTER_ROLE\n /// @dev Use this function to retain metadata\n /// @param to The address that will receive a new token\n /// @param id The id of the new token\n /// @param data Associated token metadata, which is decoded & used to set the token's metadata hash.\n function mint(\n address to,\n uint256 id,\n bytes calldata data\n ) public override(BaseERC721, IERC721Base) onlyRole(MINTER_ROLE) {\n BaseERC721.mint(to, id, data);\n }\n\n /// @notice Set the metadatahash for a given token id.\n /// @dev The metadata hash for the ERC721 may need to be manually set or overridden.\n /// @param id The token id.\n /// @param uri The full token URI to be used for the token id.\n function setTokenURI(uint256 id, string memory uri) external override onlyRole(METADATA_ROLE) {\n tokenUris[id] = uri;\n }\n\n /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.\n /// @param id The token to get the uri of.\n /// @return URI The token's URI string.\n function tokenURI(uint256 id) public view override(BaseERC721, IPolygonAssetERC721) returns (string memory) {\n require(ownerOf(id) != address(0), \"ZERO_ADDRESS\");\n return tokenUris[id];\n }\n\n /// @notice Query if a contract implements interface `id`.\n /// @param id the interface identifier, as specified in ERC-165.\n /// @return `true` if the contract implements `id`.\n function supportsInterface(bytes4 id) public view override(BaseERC721, IERC721Base) returns (bool) {\n return BaseERC721.supportsInterface(id);\n }\n\n /// @notice Change the address of the trusted forwarder for meta-transactions\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder)\n public\n override(BaseERC721, IERC721Base)\n onlyRole(DEFAULT_ADMIN_ROLE)\n {\n BaseERC721.setTrustedForwarder(trustedForwarder);\n }\n\n /// @notice Set the approval for an operator to manage all the tokens of the sender.\n /// @param from The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param approved The determination of the approval.\n function setApprovalForAllFor(\n address from,\n address operator,\n bool approved\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperatorApproval(operator) {\n BaseERC721.setApprovalForAllFor(from, operator, approved);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param from Address whose token is to be transferred.\n /// @param to Recipient.\n /// @param tokenId The token id to be transferred.\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperator(from) {\n BaseERC721.safeTransferFrom(from, to, tokenId);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n /// @param data Additional data.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperator(from) {\n BaseERC721.safeBatchTransferFrom(from, to, ids, data);\n }\n\n /// @notice Checks if address supplierd is that of an forwarder\n /// @param forwarder the address to be checked\n function isTrustedForwarder(address forwarder) public view override(BaseERC721, IERC721Base) returns (bool) {\n BaseERC721.isTrustedForwarder(forwarder);\n }\n\n /// @notice returns the address of the trusted forwarder\n function getTrustedForwarder() public view override(BaseERC721, IERC721Base) returns (address trustedForwarder) {\n BaseERC721.getTrustedForwarder();\n }\n\n /// @notice checks if the token id has been minted or not\n /// @param tokenId the id to be checked\n function exists(uint256 tokenId) public view override(BaseERC721, IERC721Base) returns (bool) {\n BaseERC721.exists(tokenId);\n }\n\n /// @notice Burns token with given `id`.\n /// @param from Address whose token is to be burned.\n /// @param id Token id which will be burned.\n function burnFrom(address from, uint256 id) public override(BaseERC721, IERC721Base) {\n BaseERC721.burnFrom(from, id);\n }\n\n /// @notice Burns token with given `id`.\n /// @dev Used by default fx-portal tunnel which burns rather than locks.\n /// @param id The id of the token to be burned.\n function burn(uint256 id) public override(BaseERC721, IERC721Base) {\n BaseERC721.burn(id);\n }\n\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperator(from) {\n BaseERC721.batchTransferFrom(from, to, ids);\n }\n\n /// @notice Approve an operator to operate tokens on the sender's behalf.\n /// @param from The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param id The id of the token.\n function approveFor(\n address from,\n address operator,\n uint256 id\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperatorApproval(operator) {\n BaseERC721.approveFor(from, operator, id);\n }\n\n function _msgSender() internal view virtual override(BaseERC721, ContextUpgradeable) returns (address sender) {\n return BaseERC721._msgSender();\n }\n\n function _msgData() internal view virtual override(BaseERC721, ContextUpgradeable) returns (bytes calldata) {\n return BaseERC721._msgData();\n }\n}\n" + }, + "src/solc_0.8/polygon/child/asset/PolygonAssetERC721Tunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../../common/fx-portal/FxBaseChildTunnelUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\n\nimport \"../../../common/interfaces/IPolygonAssetERC721.sol\";\nimport \"../../../common/interfaces/IERC721MandatoryTokenReceiver.sol\";\nimport \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\n\nimport \"./PolygonAssetERC721.sol\";\n\n/// @title ASSETERC721 bridge on L2\ncontract PolygonAssetERC721Tunnel is\n FxBaseChildTunnelUpgradeable,\n IERC165Upgradeable,\n IERC721MandatoryTokenReceiver,\n ERC2771Handler,\n OwnableUpgradeable,\n PausableUpgradeable\n{\n IPolygonAssetERC721 public childToken;\n uint256 public maxTransferLimit;\n bool private fetchingAssets = false;\n\n event SetTransferLimit(uint256 limit);\n event Deposit(address user, uint256 id, bytes data);\n event Withdraw(address user, uint256 id, bytes data);\n\n // solhint-disable-next-line no-empty-blocks\n constructor() initializer {}\n\n function initialize(\n address _fxChild,\n IPolygonAssetERC721 _childToken,\n address _trustedForwarder,\n uint256 _maxTransferLimit\n ) public initializer {\n require(address(_childToken) != address(0), \"PolygonAssetERC721Tunnel: _childToken can't be zero\");\n childToken = _childToken;\n maxTransferLimit = _maxTransferLimit;\n __Ownable_init();\n __Pausable_init();\n __ERC2771Handler_initialize(_trustedForwarder);\n __FxBaseChildTunnelUpgradeable_initialize(_fxChild);\n }\n\n function setTransferLimit(uint256 _maxTransferLimit) external onlyOwner {\n require(_maxTransferLimit > 0, \"PolygonAssetERC721Tunnel: _maxTransferLimit invalid\");\n maxTransferLimit = _maxTransferLimit;\n emit SetTransferLimit(_maxTransferLimit);\n }\n\n function batchWithdrawToRoot(address to, uint256[] calldata ids) external whenNotPaused {\n require(ids.length < maxTransferLimit, \"EXCEEDS_TRANSFER_LIMIT\");\n string[] memory uris = new string[](ids.length);\n fetchingAssets = true;\n for (uint256 i = 0; i < ids.length; i++) {\n // lock the child tokens in this contract\n uint256 id = ids[i];\n string memory uniqueUri = childToken.tokenURI(id);\n uris[i] = uniqueUri;\n bytes memory uniqueUriData = abi.encode(uniqueUri);\n childToken.safeTransferFrom(_msgSender(), address(this), ids[i], uniqueUriData);\n emit Withdraw(to, ids[i], uniqueUriData);\n }\n fetchingAssets = false;\n _sendMessageToRoot(abi.encode(to, ids, uris));\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n }\n\n /// @dev Pauses all token transfers across bridge\n function pause() external onlyOwner {\n _pause();\n }\n\n /// @dev Unpauses all token transfers across bridge\n function unpause() external onlyOwner {\n _unpause();\n }\n\n function _processMessageFromRoot(\n uint256, /* stateId */\n address sender,\n bytes memory data /* encoded message from root tunnel */\n ) internal override validateSender(sender) {\n _syncDeposit(data);\n }\n\n function _syncDeposit(bytes memory syncData) internal {\n (address to, uint256[] memory ids, string[] memory uris) = abi.decode(syncData, (address, uint256[], string[]));\n for (uint256 i = 0; i < ids.length; i++) {\n bytes memory uniqueUriData = abi.encode(uris[i]);\n if (!childToken.exists(ids[i])) childToken.mint(to, ids[i], uniqueUriData);\n else childToken.safeTransferFrom(address(this), to, ids[i], uniqueUriData);\n emit Deposit(to, ids[i], uniqueUriData);\n }\n }\n\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n\n function onERC721Received(\n address, /* operator */\n address, /* from */\n uint256, /* tokenId */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(fetchingAssets == true, \"PolygonAssetERC721Tunnel: can't directly send Assets\");\n return this.onERC721Received.selector;\n }\n\n function onERC721BatchReceived(\n address, /* operator */\n address, /* from */\n uint256[] calldata, /* ids */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(fetchingAssets == true, \"PolygonAssetERC721Tunnel: can't directly send Assets\");\n return this.onERC721BatchReceived.selector;\n }\n\n function supportsInterface(bytes4 interfaceId) external pure override returns (bool) {\n return interfaceId == 0x5e8bf644 || interfaceId == 0x01ffc9a7;\n }\n}\n" + }, + "src/solc_0.8/polygon/child/ChildGameTokenV1.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../Game/GameBaseToken.sol\";\n\n// solhint-disable-next-line no-empty-blocks\ncontract ChildGameTokenV1 is GameBaseToken {\n\n}\n" + }, + "src/solc_0.8/polygon/child/land/PolygonLandBaseToken.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable code-complexity\n\npragma solidity 0.8.2;\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\";\nimport \"../../../common/BaseWithStorage/ERC721BaseTokenV2.sol\";\nimport \"../../../common/interfaces/IPolygonLand.sol\";\n\nabstract contract PolygonLandBaseToken is IPolygonLand, Initializable, ERC721BaseTokenV2 {\n using AddressUpgradeable for address;\n\n uint256 internal constant GRID_SIZE = 408;\n\n uint256 internal constant LAYER = 0xFF00000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_1x1 = 0x0000000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_3x3 = 0x0100000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_6x6 = 0x0200000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_12x12 = 0x0300000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_24x24 = 0x0400000000000000000000000000000000000000000000000000000000000000;\n\n mapping(address => bool) internal _minters;\n\n event Minter(address minter, bool enabled);\n\n modifier validQuad(\n uint256 size,\n uint256 x,\n uint256 y\n ) {\n require(size == 1 || size == 3 || size == 6 || size == 12 || size == 24, \"Invalid size\");\n require(x % size == 0 && y % size == 0, \"Invalid coordinates\");\n require(x <= GRID_SIZE - size && y <= GRID_SIZE - size, \"Out of bounds\");\n\n _;\n }\n\n /**\n * @notice Return the name of the token contract\n * @return The name of the token contract\n */\n function name() public pure returns (string memory) {\n return \"Sandbox's LANDs\";\n }\n\n /**\n * @notice Return the symbol of the token contract\n * @return The symbol of the token contract\n */\n function symbol() public pure returns (string memory) {\n return \"LAND\";\n }\n\n /// @notice total width of the map\n /// @return width\n function width() public pure returns (uint256) {\n return GRID_SIZE;\n }\n\n /// @notice total height of the map\n /// @return height\n function height() public pure returns (uint256) {\n return GRID_SIZE;\n }\n\n /// @notice x coordinate of Land token\n /// @param id tokenId\n /// @return the x coordinates\n function getX(uint256 id) external view returns (uint256) {\n require(_ownerOf(id) != address(0), \"token does not exist\");\n return id % GRID_SIZE;\n }\n\n /// @notice y coordinate of Land token\n /// @param id tokenId\n /// @return the y coordinates\n function getY(uint256 id) external view returns (uint256) {\n require(_ownerOf(id) != address(0), \"token does not exist\");\n return id / GRID_SIZE;\n }\n\n /**\n * @notice Return the URI of a specific token\n * @param id The id of the token\n * @return The URI of the token\n */\n function tokenURI(uint256 id) public view returns (string memory) {\n require(_ownerOf(id) != address(0), \"Id does not exist\");\n return\n string(\n abi.encodePacked(\"https://api.sandbox.game/lands/\", StringsUpgradeable.toString(id), \"/metadata.json\")\n );\n }\n\n /**\n * @notice Check if the contract supports an interface\n * 0x01ffc9a7 is ERC-165\n * 0x80ac58cd is ERC-721\n * 0x5b5e139f is ERC-721 metadata\n * @param id The id of the interface\n * @return True if the interface is supported\n */\n function supportsInterface(bytes4 id) public pure override returns (bool) {\n return id == 0x01ffc9a7 || id == 0x80ac58cd || id == 0x5b5e139f;\n }\n\n /**\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\n * @param user The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintQuad(\n address user,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) external virtual override {\n require(isMinter(_msgSender()), \"!AUTHORIZED\");\n _mintQuad(user, size, x, y, data);\n }\n\n function _mintQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) internal {\n require(to != address(0), \"to is zero address\");\n require(!exists(size, x, y), \"Already minted\");\n\n uint256 quadId;\n uint256 id = x + y * GRID_SIZE;\n\n if (size == 1) {\n quadId = id;\n } else if (size == 3) {\n quadId = LAYER_3x3 + id;\n } else if (size == 6) {\n quadId = LAYER_6x6 + id;\n } else if (size == 12) {\n quadId = LAYER_12x12 + id;\n } else if (size == 24) {\n quadId = LAYER_24x24 + id;\n }\n\n for (uint256 i = 0; i < size * size; i++) {\n emit Transfer(address(0), to, _idInPath(i, size, x, y));\n }\n\n _owners[quadId] = uint256(uint160(address(to)));\n _numNFTPerAddress[to] += size * size;\n\n _checkBatchReceiverAcceptQuad(_msgSender(), address(0), to, size, x, y, data);\n }\n\n function batchTransferQuad(\n address from,\n address to,\n uint256[] calldata sizes,\n uint256[] calldata xs,\n uint256[] calldata ys,\n bytes calldata data\n ) external override {\n require(from != address(0), \"from is zero address\");\n require(to != address(0), \"can't send to zero address\");\n require(sizes.length == xs.length && xs.length == ys.length, \"invalid data\");\n if (_msgSender() != from) {\n require(\n _operatorsForAll[from][_msgSender()] || _superOperators[_msgSender()],\n \"not authorized to transferMultiQuads\"\n );\n }\n uint256 numTokensTransfered = 0;\n for (uint256 i = 0; i < sizes.length; i++) {\n uint256 size = sizes[i];\n _transferQuad(from, to, size, xs[i], ys[i]);\n numTokensTransfered += size * size;\n }\n _numNFTPerAddress[from] -= numTokensTransfered;\n _numNFTPerAddress[to] += numTokensTransfered;\n\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n uint256[] memory ids = new uint256[](numTokensTransfered);\n uint256 counter = 0;\n for (uint256 j = 0; j < sizes.length; j++) {\n uint256 size = sizes[j];\n for (uint256 i = 0; i < size * size; i++) {\n ids[counter] = _idInPath(i, size, xs[j], ys[j]);\n counter++;\n }\n }\n require(\n _checkOnERC721BatchReceived(_msgSender(), from, to, ids, data),\n \"erc721 batch transfer rejected by to\"\n );\n }\n }\n\n function transferQuad(\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external override {\n require(from != address(0), \"from is zero address\");\n require(to != address(0), \"can't send to zero address\");\n if (_msgSender() != from) {\n require(\n _operatorsForAll[from][_msgSender()] || _superOperators[_msgSender()],\n \"not authorized to transferQuad\"\n );\n }\n _transferQuad(from, to, size, x, y);\n _numNFTPerAddress[from] -= size * size;\n _numNFTPerAddress[to] += size * size;\n\n _checkBatchReceiverAcceptQuad(_msgSender(), from, to, size, x, y, data);\n }\n\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) public override(ILandToken, ERC721BaseTokenV2) {\n super.batchTransferFrom(from, to, ids, data);\n }\n\n function exists(\n uint256 size,\n uint256 x,\n uint256 y\n ) public view override validQuad(size, x, y) returns (bool) {\n if (_owners[LAYER_24x24 + (x / 24) * 24 + ((y / 24) * 24) * GRID_SIZE] != 0) return true;\n uint256 toX = x + size;\n uint256 toY = y + size;\n if (size <= 12) {\n if (_owners[LAYER_12x12 + (x / 12) * 12 + ((y / 12) * 12) * GRID_SIZE] != 0) return true;\n } else {\n for (uint256 x12i = x; x12i < toX; x12i += 12) {\n for (uint256 y12i = y; y12i < toY; y12i += 12) {\n uint256 id12x12 = LAYER_12x12 + x12i + y12i * GRID_SIZE;\n if (_owners[id12x12] != 0) return true;\n }\n }\n }\n\n if (size <= 6) {\n if (_owners[LAYER_6x6 + (x / 6) * 6 + ((y / 6) * 6) * GRID_SIZE] != 0) return true;\n } else {\n for (uint256 x6i = x; x6i < toX; x6i += 6) {\n for (uint256 y6i = y; y6i < toY; y6i += 6) {\n uint256 id6x6 = LAYER_6x6 + x6i + y6i * GRID_SIZE;\n if (_owners[id6x6] != 0) return true;\n }\n }\n }\n\n if (size <= 3) {\n if (_owners[LAYER_3x3 + (x / 3) * 3 + ((y / 3) * 3) * GRID_SIZE] != 0) return true;\n } else {\n for (uint256 x3i = x; x3i < toX; x3i += 3) {\n for (uint256 y3i = y; y3i < toY; y3i += 3) {\n uint256 id3x3 = LAYER_3x3 + x3i + y3i * GRID_SIZE;\n if (_owners[id3x3] != 0) return true;\n }\n }\n }\n\n for (uint256 i = 0; i < size * size; i++) {\n if (_owners[_idInPath(i, size, x, y)] != 0) return true;\n }\n\n return false;\n }\n\n /// @notice Enable or disable the ability of `minter` to transfer tokens of all (minter rights).\n /// @param minter address that will be given/removed minter right.\n /// @param enabled set whether the minter is enabled or disabled.\n function setMinter(address minter, bool enabled) external {\n require(_msgSender() == _admin, \"only admin is allowed to add minters\");\n require(minter != address(0), \"PolygonLand: Invalid address\");\n _minters[minter] = enabled;\n emit Minter(minter, enabled);\n }\n\n /// @notice check whether address `who` is given minter rights.\n /// @param who The address to query.\n /// @return whether the address has minter rights.\n function isMinter(address who) public view returns (bool) {\n return _minters[who];\n }\n\n function _transferQuad(\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y\n ) internal validQuad(size, x, y) {\n if (size == 1) {\n uint256 id1x1 = x + y * GRID_SIZE;\n address owner = _ownerOf(id1x1);\n require(owner != address(0), \"token does not exist\");\n require(owner == from, \"not owner in _transferQuad\");\n _owners[id1x1] = uint256(uint160(address(to)));\n } else {\n _regroup(from, to, size, x, y);\n }\n for (uint256 i = 0; i < size * size; i++) {\n emit Transfer(from, to, _idInPath(i, size, x, y));\n }\n }\n\n function _idInPath(\n uint256 i,\n uint256 size,\n uint256 x,\n uint256 y\n ) internal pure returns (uint256) {\n uint256 row = i / size;\n if (row % 2 == 0) {\n // allow ids to follow a path in a quad\n return (x + (i % size)) + ((y + row) * GRID_SIZE);\n } else {\n return ((x + size) - (1 + (i % size))) + ((y + row) * GRID_SIZE);\n }\n }\n\n function _regroup(\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y\n ) internal {\n if (size == 3) {\n _regroup3x3(from, to, x, y, true);\n } else if (size == 6) {\n _regroup6x6(from, to, x, y, true);\n } else if (size == 12) {\n _regroup12x12(from, to, x, y, true);\n } else if (size == 24) {\n _regroup24x24(from, to, x, y, true);\n }\n }\n\n function _regroup3x3(\n address from,\n address to,\n uint256 x,\n uint256 y,\n bool set\n ) internal returns (bool) {\n uint256 id = x + y * GRID_SIZE;\n uint256 quadId = LAYER_3x3 + id;\n bool ownerOfAll = true;\n for (uint256 xi = x; xi < x + 3; xi++) {\n for (uint256 yi = y; yi < y + 3; yi++) {\n ownerOfAll = _checkAndClear(from, xi + yi * GRID_SIZE) && ownerOfAll;\n }\n }\n if (set) {\n if (!ownerOfAll) {\n require(_ownerOfQuad(3, x, y) == from, \"not owner of all sub quads nor parent quads\");\n }\n _owners[quadId] = uint256(uint160(address(to)));\n return true;\n }\n return ownerOfAll;\n }\n\n function _regroup6x6(\n address from,\n address to,\n uint256 x,\n uint256 y,\n bool set\n ) internal returns (bool) {\n uint256 id = x + y * GRID_SIZE;\n uint256 quadId = LAYER_6x6 + id;\n bool ownerOfAll = true;\n for (uint256 xi = x; xi < x + 6; xi += 3) {\n for (uint256 yi = y; yi < y + 6; yi += 3) {\n bool ownAllIndividual = _regroup3x3(from, to, xi, yi, false);\n uint256 id3x3 = LAYER_3x3 + xi + yi * GRID_SIZE;\n uint256 owner3x3 = _owners[id3x3];\n if (owner3x3 != 0) {\n if (!ownAllIndividual) {\n require(owner3x3 == uint256(uint160(address(from))), \"not owner of 3x3 quad\");\n }\n _owners[id3x3] = 0;\n }\n ownerOfAll = (ownAllIndividual || owner3x3 != 0) && ownerOfAll;\n }\n }\n if (set) {\n if (!ownerOfAll) {\n require(_ownerOfQuad(6, x, y) == from, \"not owner of all sub quads nor parent quads\");\n }\n _owners[quadId] = uint256(uint160(address(to)));\n return true;\n }\n return ownerOfAll;\n }\n\n function _regroup12x12(\n address from,\n address to,\n uint256 x,\n uint256 y,\n bool set\n ) internal returns (bool) {\n uint256 id = x + y * GRID_SIZE;\n uint256 quadId = LAYER_12x12 + id;\n bool ownerOfAll = true;\n for (uint256 xi = x; xi < x + 12; xi += 6) {\n for (uint256 yi = y; yi < y + 12; yi += 6) {\n bool ownAllIndividual = _regroup6x6(from, to, xi, yi, false);\n uint256 id6x6 = LAYER_6x6 + xi + yi * GRID_SIZE;\n uint256 owner6x6 = _owners[id6x6];\n if (owner6x6 != 0) {\n if (!ownAllIndividual) {\n require(owner6x6 == uint256(uint160(address(from))), \"not owner of 6x6 quad\");\n }\n _owners[id6x6] = 0;\n }\n ownerOfAll = (ownAllIndividual || owner6x6 != 0) && ownerOfAll;\n }\n }\n if (set) {\n if (!ownerOfAll) {\n require(_ownerOfQuad(12, x, y) == from, \"not owner of all sub quads nor parent quads\");\n }\n _owners[quadId] = uint256(uint160(address(to)));\n return true;\n }\n return ownerOfAll;\n }\n\n function _regroup24x24(\n address from,\n address to,\n uint256 x,\n uint256 y,\n bool set\n ) internal returns (bool) {\n uint256 id = x + y * GRID_SIZE;\n uint256 quadId = LAYER_24x24 + id;\n bool ownerOfAll = true;\n for (uint256 xi = x; xi < x + 24; xi += 12) {\n for (uint256 yi = y; yi < y + 24; yi += 12) {\n bool ownAllIndividual = _regroup12x12(from, to, xi, yi, false);\n uint256 id12x12 = LAYER_12x12 + xi + yi * GRID_SIZE;\n uint256 owner12x12 = _owners[id12x12];\n if (owner12x12 != 0) {\n if (!ownAllIndividual) {\n require(owner12x12 == uint256(uint160(address(from))), \"not owner of 12x12 quad\");\n }\n _owners[id12x12] = 0;\n }\n ownerOfAll = (ownAllIndividual || owner12x12 != 0) && ownerOfAll;\n }\n }\n if (set) {\n if (!ownerOfAll) {\n require(\n _owners[quadId] == uint256(uint160(address(from))),\n \"not owner of all sub quads not parent quad\"\n );\n }\n _owners[quadId] = uint256(uint160(address(to)));\n return true;\n }\n return ownerOfAll || _owners[quadId] == uint256(uint160(address(from)));\n }\n\n function _ownerOfQuad(\n uint256 size,\n uint256 x,\n uint256 y\n ) internal returns (address) {\n uint256 layer;\n uint256 parentSize = size * 2;\n if (size == 3) {\n layer = LAYER_3x3;\n } else if (size == 6) {\n layer = LAYER_6x6;\n } else if (size == 12) {\n layer = LAYER_12x12;\n } else if (size == 24) {\n layer = LAYER_24x24;\n } else {\n require(false, \"Invalid size\");\n }\n\n address owner = address(uint160(_owners[layer + (x / size) * size + ((y / size) * size) * GRID_SIZE]));\n if (owner != address(0)) {\n return owner;\n } else if (size < 24) {\n return _ownerOfQuad(parentSize, x, y);\n }\n return address(0);\n }\n\n function _ownerOf(uint256 id) internal view override returns (address) {\n require(id & LAYER == 0, \"Invalid token id\");\n uint256 x = id % GRID_SIZE;\n uint256 y = id / GRID_SIZE;\n uint256 owner1x1 = _owners[id];\n\n if ((owner1x1 & BURNED_FLAG) == BURNED_FLAG) {\n return address(0);\n }\n\n if (owner1x1 != 0) {\n return address(uint160(owner1x1)); //we check if the quad exists as an 1x1 quad, then 3x3, and so on..\n } else {\n address owner3x3 = address(uint160(_owners[LAYER_3x3 + (x / 3) * 3 + ((y / 3) * 3) * GRID_SIZE]));\n if (owner3x3 != address(0)) {\n return owner3x3;\n } else {\n address owner6x6 = address(uint160(_owners[LAYER_6x6 + (x / 6) * 6 + ((y / 6) * 6) * GRID_SIZE]));\n if (owner6x6 != address(0)) {\n return owner6x6;\n } else {\n address owner12x12 =\n address(uint160(_owners[LAYER_12x12 + (x / 12) * 12 + ((y / 12) * 12) * GRID_SIZE]));\n if (owner12x12 != address(0)) {\n return owner12x12;\n } else {\n return address(uint160(_owners[LAYER_24x24 + (x / 24) * 24 + ((y / 24) * 24) * GRID_SIZE]));\n }\n }\n }\n }\n }\n\n function _checkAndClear(address from, uint256 id) internal returns (bool) {\n uint256 owner = _owners[id];\n if (owner != 0) {\n require((owner & BURNED_FLAG) != BURNED_FLAG, \"not owner\");\n require(address(uint160(owner)) == from, \"not owner\");\n _owners[id] = 0;\n return true;\n }\n return false;\n }\n\n function _checkBatchReceiverAcceptQuad(\n address operator,\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) internal {\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n uint256[] memory ids = new uint256[](size * size);\n for (uint256 i = 0; i < size * size; i++) {\n ids[i] = _idInPath(i, size, x, y);\n }\n require(_checkOnERC721BatchReceived(operator, from, to, ids, data), \"erc721 batch transfer rejected by to\");\n }\n }\n\n function _ownerAndOperatorEnabledOf(uint256 id)\n internal\n view\n override\n returns (address owner, bool operatorEnabled)\n {\n require(id & LAYER == 0, \"Invalid token id\");\n uint256 x = id % GRID_SIZE;\n uint256 y = id / GRID_SIZE;\n uint256 owner1x1 = _owners[id];\n\n if ((owner1x1 & BURNED_FLAG) == BURNED_FLAG) {\n owner = address(0);\n operatorEnabled = (owner1x1 & OPERATOR_FLAG) == OPERATOR_FLAG;\n return (owner, operatorEnabled);\n }\n\n if (owner1x1 != 0) {\n owner = address(uint160(owner1x1));\n operatorEnabled = (owner1x1 & OPERATOR_FLAG) == OPERATOR_FLAG;\n } else {\n address owner3x3 = address(uint160(_owners[LAYER_3x3 + (x / 3) * 3 + ((y / 3) * 3) * GRID_SIZE]));\n if (owner3x3 != address(uint160(0))) {\n owner = owner3x3;\n operatorEnabled = false;\n } else {\n address owner6x6 = address(uint160(_owners[LAYER_6x6 + (x / 6) * 6 + ((y / 6) * 6) * GRID_SIZE]));\n if (owner6x6 != address(uint160(0))) {\n owner = owner6x6;\n operatorEnabled = false;\n } else {\n address owner12x12 =\n address(uint160(_owners[LAYER_12x12 + (x / 12) * 12 + ((y / 12) * 12) * GRID_SIZE]));\n if (owner12x12 != address(uint160(0))) {\n owner = owner12x12;\n operatorEnabled = false;\n } else {\n owner = address(uint160(_owners[LAYER_24x24 + (x / 24) * 24 + ((y / 24) * 24) * GRID_SIZE]));\n operatorEnabled = false;\n }\n }\n }\n }\n }\n\n // Empty storage space in contracts for future enhancements\n // ref: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/issues/13)\n uint256[49] private __gap;\n}\n" + }, + "src/solc_0.8/polygon/child/land/PolygonLandBaseTokenV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable code-complexity\n\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\";\nimport \"../../../common/BaseWithStorage/ERC721BaseTokenV2.sol\";\nimport \"../../../common/interfaces/IPolygonLand.sol\";\n\n/**\n * @title PolygonLandBaseTokenV2\n * @author The Sandbox\n * @notice Implement LAND and quad functionalities on top of an ERC721 token\n * @dev This contract implements a quad tree structure to handle groups of ERC721 tokens at once\n */\nabstract contract PolygonLandBaseTokenV2 is IPolygonLand, Initializable, ERC721BaseTokenV2 {\n using AddressUpgradeable for address;\n\n uint256 internal constant GRID_SIZE = 408;\n\n uint256 internal constant LAYER = 0xFF00000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_1x1 = 0x0000000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_3x3 = 0x0100000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_6x6 = 0x0200000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_12x12 = 0x0300000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_24x24 = 0x0400000000000000000000000000000000000000000000000000000000000000;\n\n mapping(address => bool) internal _minters;\n\n event Minter(address indexed minter, bool enabled);\n\n struct Land {\n uint256 x;\n uint256 y;\n uint256 size;\n }\n\n /// @notice transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\n /// @param from current owner of the quad\n /// @param to destination\n /// @param sizes list of sizes for each quad\n /// @param xs list of bottom left x coordinates for each quad\n /// @param ys list of bottom left y coordinates for each quad\n /// @param data additional data\n function batchTransferQuad(\n address from,\n address to,\n uint256[] calldata sizes,\n uint256[] calldata xs,\n uint256[] calldata ys,\n bytes calldata data\n ) external override {\n require(from != address(0), \"from is zero address\");\n require(to != address(0), \"can't send to zero address\");\n require(sizes.length == xs.length, \"PolygonLandBaseTokenV2: sizes's and x's length are different\");\n require(xs.length == ys.length, \"PolygonLandBaseTokenV2: x's and y's length are different\");\n if (_msgSender() != from) {\n require(\n _operatorsForAll[from][_msgSender()] || _superOperators[_msgSender()],\n \"not authorized to transferMultiQuads\"\n );\n }\n uint256 numTokensTransfered = 0;\n for (uint256 i = 0; i < sizes.length; i++) {\n uint256 size = sizes[i];\n _transferQuad(from, to, size, xs[i], ys[i]);\n numTokensTransfered += size * size;\n }\n _numNFTPerAddress[from] -= numTokensTransfered;\n _numNFTPerAddress[to] += numTokensTransfered;\n\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n uint256[] memory ids = new uint256[](numTokensTransfered);\n uint256 counter = 0;\n for (uint256 j = 0; j < sizes.length; j++) {\n uint256 size = sizes[j];\n for (uint256 i = 0; i < size * size; i++) {\n ids[counter] = _idInPath(i, size, xs[j], ys[j]);\n counter++;\n }\n }\n require(\n _checkOnERC721BatchReceived(_msgSender(), from, to, ids, data),\n \"erc721 batch transfer rejected by to\"\n );\n }\n }\n\n /// @notice Enable or disable the ability of `minter` to transfer tokens of all (minter rights).\n /// @param minter address that will be given/removed minter right.\n /// @param enabled set whether the minter is enabled or disabled.\n function setMinter(address minter, bool enabled) external onlyAdmin {\n require(minter != address(0), \"PolygonLand: Invalid address\");\n _minters[minter] = enabled;\n emit Minter(minter, enabled);\n }\n\n /// @notice transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\n /// @param from current owner of the quad\n /// @param to destination\n /// @param size size of the quad\n /// @param x The top left x coordinate of the quad\n /// @param y The top left y coordinate of the quad\n /// @param data additional data for transfer\n function transferQuad(\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external override {\n require(from != address(0), \"from is zero address\");\n require(to != address(0), \"can't send to zero address\");\n if (_msgSender() != from) {\n require(\n _operatorsForAll[from][_msgSender()] || _superOperators[_msgSender()],\n \"not authorized to transferQuad\"\n );\n }\n _transferQuad(from, to, size, x, y);\n _numNFTPerAddress[from] -= size * size;\n _numNFTPerAddress[to] += size * size;\n\n _checkBatchReceiverAcceptQuad(_msgSender(), from, to, size, x, y, data);\n }\n\n /**\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\n * @param user The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintQuad(\n address user,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) external virtual override {\n _isValidQuad(size, x, y);\n require(isMinter(_msgSender()), \"!AUTHORIZED\");\n _mintQuad(user, size, x, y, data);\n }\n\n /**\n * @notice Checks if a parent quad has child quads already minted.\n * Then mints the rest child quads and transfers the parent quad.\n * Should only be called by the tunnel.\n * @param to The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintAndTransferQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external virtual {\n require(isMinter(msg.sender), \"!AUTHORIZED\");\n require(to != address(0), \"to is zero address\");\n\n if (exists(size, x, y)) {\n _transferQuad(msg.sender, to, size, x, y);\n _numNFTPerAddress[msg.sender] -= size * size;\n _numNFTPerAddress[to] += size * size;\n _checkBatchReceiverAcceptQuad(msg.sender, msg.sender, to, size, x, y, data);\n } else {\n _mintAndTransferQuad(to, size, x, y, data);\n }\n }\n\n /// @notice x coordinate of Land token\n /// @param id tokenId\n /// @return the x coordinates\n function getX(uint256 id) external pure returns (uint256) {\n return _getX(id);\n }\n\n /// @inheritdoc ERC721BaseTokenV2\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) public virtual override(ILandToken, ERC721BaseTokenV2) {\n super.batchTransferFrom(from, to, ids, data);\n }\n\n /// @notice y coordinate of Land token\n /// @param id tokenId\n /// @return the y coordinates\n function getY(uint256 id) external pure returns (uint256) {\n return _getY(id);\n }\n\n /**\n * @notice Check if the contract supports an interface\n * 0x01ffc9a7 is ERC-165\n * 0x80ac58cd is ERC-721\n * 0x5b5e139f is ERC-721 metadata\n * @param id The id of the interface\n * @return True if the interface is supported\n */\n function supportsInterface(bytes4 id) public pure override returns (bool) {\n return id == 0x01ffc9a7 || id == 0x80ac58cd || id == 0x5b5e139f;\n }\n\n /**\n * @notice Return the name of the token contract\n * @return The name of the token contract\n */\n function name() public pure returns (string memory) {\n return \"Sandbox's LANDs\";\n }\n\n /// @notice check whether address `who` is given minter rights.\n /// @param who The address to query.\n /// @return whether the address has minter rights.\n function isMinter(address who) public view returns (bool) {\n return _minters[who];\n }\n\n /// @notice checks if Land has been minted or not\n /// @param size size of the\n /// @param x x coordinate of the quad\n /// @param y y coordinate of the quad\n /// @return bool for if Land has been minted or not\n function exists(\n uint256 size,\n uint256 x,\n uint256 y\n ) public view override returns (bool) {\n _isValidQuad(size, x, y);\n return _ownerOfQuad(size, x, y) != address(0);\n }\n\n /**\n * @notice Return the symbol of the token contract\n * @return The symbol of the token contract\n */\n function symbol() public pure returns (string memory) {\n return \"LAND\";\n }\n\n /// @notice total width of the map\n /// @return width\n function width() public pure returns (uint256) {\n return GRID_SIZE;\n }\n\n /// @notice total height of the map\n /// @return height\n function height() public pure returns (uint256) {\n return GRID_SIZE;\n }\n\n /**\n * @notice Return the URI of a specific token\n * @param id The id of the token\n * @return The URI of the token\n */\n function tokenURI(uint256 id) public view returns (string memory) {\n require(_ownerOf(id) != address(0), \"Id does not exist\");\n return\n string(\n abi.encodePacked(\"https://api.sandbox.game/lands/\", StringsUpgradeable.toString(id), \"/metadata.json\")\n );\n }\n\n function _isValidQuad(\n uint256 size,\n uint256 x,\n uint256 y\n ) internal pure {\n require(size == 1 || size == 3 || size == 6 || size == 12 || size == 24, \"Invalid size\");\n require(x % size == 0, \"Invalid x coordinate\");\n require(y % size == 0, \"Invalid y coordinate\");\n require(x <= GRID_SIZE - size, \"x out of bounds\");\n require(y <= GRID_SIZE - size, \"y out of bounds\");\n }\n\n function _transferQuad(\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y\n ) internal {\n _isValidQuad(size, x, y);\n if (size == 1) {\n uint256 id1x1 = _getQuadId(LAYER_1x1, x, y);\n address owner = _ownerOf(id1x1);\n require(owner != address(0), \"token does not exist\");\n require(owner == from, \"not owner in _transferQuad\");\n _owners[id1x1] = uint256(uint160(address(to)));\n } else {\n _regroupQuad(from, to, Land({x: x, y: y, size: size}), true, size / 2);\n }\n for (uint256 i = 0; i < size * size; i++) {\n emit Transfer(from, to, _idInPath(i, size, x, y));\n }\n }\n\n function _mintQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) internal {\n require(to != address(0), \"to is zero address\");\n\n (uint256 layer, , ) = _getQuadLayer(size);\n uint256 quadId = _getQuadId(layer, x, y);\n\n _checkOwner(size, x, y, 24);\n for (uint256 i = 0; i < size * size; i++) {\n uint256 _id = _idInPath(i, size, x, y);\n require(_owners[_id] == 0, \"Already minted\");\n emit Transfer(address(0), to, _id);\n }\n\n _owners[quadId] = uint256(uint160(to));\n _numNFTPerAddress[to] += size * size;\n\n _checkBatchReceiverAcceptQuad(msg.sender, address(0), to, size, x, y, data);\n }\n\n /**\n * @dev checks if the child quads in the parent quad (size, x, y) are owned by msg.sender.\n * It recursively checks child quad of every size(exculding Lands of 1x1 size) are minted or not.\n * Quad which are minted are pushed into quadMinted to also check if every Land of size 1x1 in\n * the parent quad is minted or not. While checking if the every child Quad and Land is minted it\n * also checks and clear the owner for quads which are minted. Finally it checks if the new owner\n * if is a contract can handle ERC721 tokens or not and transfers the parent quad to new owner.\n * @param to The address to which the ownership of the quad will be transferred\n * @param size The size of the quad being minted and transfered\n * @param x The x-coordinate of the top-left corner of the quad being minted.\n * @param y The y-coordinate of the top-left corner of the quad being minted.\n * @param y The y-coordinate of the top-left corner of the quad being minted.\n */\n function _mintAndTransferQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) internal {\n (uint256 layer, , ) = _getQuadLayer(size);\n uint256 quadId = _getQuadId(layer, x, y);\n\n // Length of array is equal to number of 3x3 child quad a 24x24 quad can have. Would be used to push the minted Quads.\n Land[] memory quadMinted = new Land[](64);\n // index of last minted quad pushed on quadMinted Array\n uint256 index;\n uint256 landMinted;\n\n // if size of the Quad in land struct to be transfered is greater than 3 we check recursivly if the child quads are minted or not.\n if (size > 3) {\n (index, landMinted) = _checkAndClearOwner(\n Land({x: x, y: y, size: size}),\n quadMinted,\n landMinted,\n index,\n size / 2\n );\n }\n\n // Lopping around the Quad in land struct to generate ids of 1x1 land token and checking if they are owned by msg.sender\n {\n for (uint256 i = 0; i < size * size; i++) {\n uint256 _id = _idInPath(i, size, x, y);\n // checking land with token id \"_id\" is in the quadMinted array.\n bool isAlreadyMinted = _isQuadMinted(quadMinted, Land({x: _getX(_id), y: _getY(_id), size: 1}), index);\n if (isAlreadyMinted) {\n // if land is in the quadMinted array there just emitting transfer event\n emit Transfer(msg.sender, to, _id);\n } else {\n if (address(uint160(_owners[_id])) == msg.sender) {\n if (_operators[_id] != address(0)) _operators[_id] = address(0);\n landMinted += 1;\n emit Transfer(msg.sender, to, _id);\n } else {\n // else is checked if owned by the msg.sender or not. If it is not owned by msg.sender it should not have an owner.\n require(_owners[_id] == 0, \"Already minted\");\n\n emit Transfer(address(0), to, _id);\n }\n }\n }\n }\n\n // checking if the new owner \"to\" is a contract. If yes, checking if it could handle ERC721 tokens.\n _checkBatchReceiverAcceptQuadAndClearOwner(quadMinted, index, landMinted, to, size, x, y, data);\n\n _owners[quadId] = uint256(uint160(to));\n _numNFTPerAddress[to] += size * size;\n _numNFTPerAddress[msg.sender] -= landMinted;\n }\n\n /**\n * @dev recursivly checks if the child quads are minted in land and push them to the quadMinted array.\n * if a child quad is minted in land such quads child quads will be skipped such that there is no overlapping\n * in quads which are minted. it clears the minted child quads owners.\n * @param land the stuct which has the size x and y co-ordinate of Quad to be checked\n * @param quadMinted array in which the minted child quad would be pushed\n * @param landMinted total 1x1 land already minted\n * @param index index of last element of quadMinted array\n * @param quadCompareSize the size of the child quads to be checked.\n * @return the index of last quad pushed in quadMinted array and the total land already minted\n */\n function _checkAndClearOwner(\n Land memory land,\n Land[] memory quadMinted,\n uint256 landMinted,\n uint256 index,\n uint256 quadCompareSize\n ) internal returns (uint256, uint256) {\n (uint256 layer, , ) = _getQuadLayer(quadCompareSize);\n uint256 toX = land.x + land.size;\n uint256 toY = land.y + land.size;\n\n //Lopping around the Quad in land struct to check if the child quad are minted or not\n for (uint256 xi = land.x; xi < toX; xi += quadCompareSize) {\n for (uint256 yi = land.y; yi < toY; yi += quadCompareSize) {\n //checking if the child Quad is minted or not. i.e Checks if the quad is in the quadMinted array.\n bool isQuadChecked = _isQuadMinted(quadMinted, Land({x: xi, y: yi, size: quadCompareSize}), index);\n // if child quad is not already in the quadMinted array.\n if (!isQuadChecked) {\n uint256 id = _getQuadId(layer, xi, yi);\n address owner = address(uint160(_owners[id]));\n // owner of the child quad is checked to be owned by msg.sender else should not be owned by anyone.\n if (owner == msg.sender) {\n // if child quad is minted it would be pushed in quadMinted array.\n quadMinted[index] = Land({x: xi, y: yi, size: quadCompareSize});\n // index of quadMinted is increased\n index++;\n // total land minted is increase by the number if land of 1x1 in child quad\n landMinted += quadCompareSize * quadCompareSize;\n //owner is cleared\n _owners[id] = 0;\n } else {\n require(owner == address(0), \"Already minted\");\n }\n }\n }\n }\n\n // size of the child quad is set to be the next smaller child quad size (12 => 6 => 3)\n quadCompareSize = quadCompareSize / 2;\n // if child quad size is greater than 3 _checkAndClearOwner is checked for new child quads in the quad in land struct.\n if (quadCompareSize >= 3)\n (index, landMinted) = _checkAndClearOwner(land, quadMinted, landMinted, index, quadCompareSize);\n return (index, landMinted);\n }\n\n /// @dev checks the owner of land with 'tokenId' to be 'from' and clears it\n /// @param from the address to be checked agains the owner of the land\n /// @param tokenId th id of land\n /// @return bool for if land is owned by 'from' or not.\n function _checkAndClearLandOwner(address from, uint256 tokenId) internal returns (bool) {\n uint256 currentOwner = _owners[tokenId];\n if (currentOwner != 0) {\n require((currentOwner & BURNED_FLAG) != BURNED_FLAG, \"not owner\");\n require(address(uint160(currentOwner)) == from, \"not owner\");\n _owners[tokenId] = 0;\n return true;\n }\n return false;\n }\n\n function _checkBatchReceiverAcceptQuad(\n address operator,\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) internal {\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n uint256[] memory ids = new uint256[](size * size);\n for (uint256 i = 0; i < size * size; i++) {\n ids[i] = _idInPath(i, size, x, y);\n }\n require(_checkOnERC721BatchReceived(operator, from, to, ids, data), \"erc721 batch transfer rejected by to\");\n }\n }\n\n /// @dev checks if the receiver of the quad(size, x, y) is a contact. If yes can it handle ERC721 tokens. It also clears owner of 1x1 land's owned by msg.sender.\n /// @param quadMinted - an array of Land structs in which the minted child quad or Quad to be transfered are.\n /// @param landMinted - the total amount of land that has been minted\n /// @param index - the index of the last element in the quadMinted array\n /// @param to the address of the new owner of Quad to be transfered\n /// @param size The size of the quad being minted and transfered\n /// @param x The x-coordinate of the top-left corner of the quad being minted.\n /// @param y The y-coordinate of the top-left corner of the quad being minted.\n /// @param y The y-coordinate of the top-left corner of the quad being minted.\n function _checkBatchReceiverAcceptQuadAndClearOwner(\n Land[] memory quadMinted,\n uint256 index,\n uint256 landMinted,\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) internal {\n // checks if to is a contract and supports ERC721_MANDATORY_RECEIVER interfaces. if it doesn't it just clears the owner of 1x1 lands in quad(size, x, y)\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n // array to push minted 1x1 land\n uint256[] memory idsToTransfer = new uint256[](landMinted);\n // index of last land pushed in idsToTransfer array\n uint256 transferIndex;\n // array to push ids to be minted\n uint256[] memory idsToMint = new uint256[]((size * size) - landMinted);\n // index of last land pushed in idsToMint array\n uint256 mintIndex;\n\n // iterating over every 1x1 land in the quad to be pushed in the above arrays\n for (uint256 i = 0; i < size * size; i++) {\n uint256 id = _idInPath(i, size, x, y);\n\n if (_isQuadMinted(quadMinted, Land({x: _getX(id), y: _getY(id), size: 1}), index)) {\n // if land is in the quads already minted it just pushed in to the idsToTransfer array\n idsToTransfer[transferIndex] = id;\n transferIndex++;\n } else if (address(uint160(_owners[id])) == msg.sender) {\n // if it is owned by the msg.sender owner data is removed and it is pused in to idsToTransfer array\n _owners[id] = 0;\n idsToTransfer[transferIndex] = id;\n transferIndex++;\n } else {\n // else it is not owned by any one and and pushed in teh idsToMint array\n idsToMint[mintIndex] = id;\n mintIndex++;\n }\n }\n\n // checking if \"to\" contact can handle ERC721 tokens\n require(\n _checkOnERC721BatchReceived(msg.sender, address(0), to, idsToMint, data),\n \"erc721 batch transfer rejected by to\"\n );\n require(\n _checkOnERC721BatchReceived(msg.sender, msg.sender, to, idsToTransfer, data),\n \"erc721 batch transfer rejected by to\"\n );\n } else {\n for (uint256 i = 0; i < size * size; i++) {\n uint256 id = _idInPath(i, size, x, y);\n if (address(uint160(_owners[id])) == msg.sender) _owners[id] = 0;\n }\n }\n }\n\n function _getX(uint256 id) internal pure returns (uint256) {\n return (id & ~LAYER) % GRID_SIZE;\n }\n\n function _getY(uint256 id) internal pure returns (uint256) {\n return (id & ~LAYER) / GRID_SIZE;\n }\n\n function _isQuadMinted(\n Land[] memory mintedLand,\n Land memory quad,\n uint256 index\n ) internal pure returns (bool) {\n for (uint256 i = 0; i < index; i++) {\n Land memory land = mintedLand[i];\n if (\n land.size > quad.size &&\n quad.x >= land.x &&\n quad.x < land.x + land.size &&\n quad.y >= land.y &&\n quad.y < land.y + land.size\n ) {\n return true;\n }\n }\n return false;\n }\n\n function _getQuadLayer(uint256 size)\n internal\n pure\n returns (\n uint256 layer,\n uint256 parentSize,\n uint256 childLayer\n )\n {\n if (size == 1) {\n layer = LAYER_1x1;\n parentSize = 3;\n } else if (size == 3) {\n layer = LAYER_3x3;\n parentSize = 6;\n } else if (size == 6) {\n layer = LAYER_6x6;\n parentSize = 12;\n childLayer = LAYER_3x3;\n } else if (size == 12) {\n layer = LAYER_12x12;\n parentSize = 24;\n childLayer = LAYER_6x6;\n } else if (size == 24) {\n layer = LAYER_24x24;\n childLayer = LAYER_12x12;\n } else {\n require(false, \"Invalid size\");\n }\n }\n\n function _getQuadId(\n uint256 layer,\n uint256 x,\n uint256 y\n ) internal pure returns (uint256) {\n return layer + x + y * GRID_SIZE;\n }\n\n function _checkOwner(\n uint256 size,\n uint256 x,\n uint256 y,\n uint256 quadCompareSize\n ) internal view {\n (uint256 layer, , ) = _getQuadLayer(quadCompareSize);\n\n if (size <= quadCompareSize) {\n // when the size of the quad is smaller than the quadCompareSize(size to be compared with),\n // then it is checked if the bigger quad which encapsulates the quad to be minted\n // of with size equals the quadCompareSize has been minted or not\n require(\n _owners[\n _getQuadId(layer, (x / quadCompareSize) * quadCompareSize, (y / quadCompareSize) * quadCompareSize)\n ] == 0,\n \"Already minted\"\n );\n } else {\n // when the size is smaller than the quadCompare size the owner of all the smaller quads with size\n // quadCompare size in the quad to be minted are checked if they are minted or not\n uint256 toX = x + size;\n uint256 toY = y + size;\n for (uint256 xi = x; xi < toX; xi += quadCompareSize) {\n for (uint256 yi = y; yi < toY; yi += quadCompareSize) {\n require(_owners[_getQuadId(layer, xi, yi)] == 0, \"Already minted\");\n }\n }\n }\n\n quadCompareSize = quadCompareSize / 2;\n if (quadCompareSize >= 3) _checkOwner(size, x, y, quadCompareSize);\n }\n\n function _idInPath(\n uint256 i,\n uint256 size,\n uint256 x,\n uint256 y\n ) internal pure returns (uint256) {\n uint256 row = i / size;\n if (row % 2 == 0) {\n // allow ids to follow a path in a quad\n return _getQuadId(LAYER_1x1, (x + (i % size)), (y + row));\n } else {\n return _getQuadId(LAYER_1x1, (x + size) - (1 + (i % size)), (y + row));\n }\n }\n\n /// @dev checks if the Land's child quads are owned by the from address and clears all the previous owners\n /// if all the child quads are not owned by the \"from\" address then the owner of parent quad to the land\n /// is checked if owned by the \"from\" address. If from is the owner then land owner is set to \"to\" address\n /// @param from address of the previous owner\n /// @param to address of the new owner\n /// @param land the quad to be regrouped and transferred\n /// @param set for setting the new owner\n /// @param childQuadSize size of the child quad to be checked for owner in the regrouping\n function _regroupQuad(\n address from,\n address to,\n Land memory land,\n bool set,\n uint256 childQuadSize\n ) internal returns (bool) {\n (uint256 layer, , uint256 childLayer) = _getQuadLayer(land.size);\n uint256 quadId = _getQuadId(layer, land.x, land.y);\n bool ownerOfAll = true;\n\n {\n // double for loop iterates and checks owner of all the smaller quads in land\n for (uint256 xi = land.x; xi < land.x + land.size; xi += childQuadSize) {\n for (uint256 yi = land.y; yi < land.y + land.size; yi += childQuadSize) {\n uint256 ownerChild;\n bool ownAllIndividual;\n if (childQuadSize < 3) {\n // case when the smaller quad is 1x1,\n ownAllIndividual = _checkAndClearLandOwner(from, _getQuadId(LAYER_1x1, xi, yi)) && ownerOfAll;\n } else {\n // recursively calling the _regroupQuad function to check the owner of child quads.\n ownAllIndividual = _regroupQuad(\n from,\n to,\n Land({x: xi, y: yi, size: childQuadSize}),\n false,\n childQuadSize / 2\n );\n uint256 idChild = _getQuadId(childLayer, xi, yi);\n ownerChild = _owners[idChild];\n if (ownerChild != 0) {\n // checking the owner of child quad\n if (!ownAllIndividual) {\n require(ownerChild == uint256(uint160(from)), \"not owner of child Quad\");\n }\n // clearing owner of child quad\n _owners[idChild] = 0;\n }\n }\n // ownerOfAll should be true if \"from\" is owner of all the child quads itereated over\n ownerOfAll = (ownAllIndividual || ownerChild != 0) && ownerOfAll;\n }\n }\n }\n\n // if set is true it check if the \"from\" is owner of all else checks for the owner of parent quad is\n // owned by \"from\" and sets the owner for the id of land to \"to\" address.\n if (set) {\n if (!ownerOfAll) {\n require(_ownerOfQuad(land.size, land.x, land.y) == from, \"not owner of all sub quads nor parent quads\");\n }\n _owners[quadId] = uint256(uint160(to));\n return true;\n }\n\n return ownerOfAll;\n }\n\n function _ownerOfQuad(\n uint256 size,\n uint256 x,\n uint256 y\n ) internal view returns (address) {\n (uint256 layer, uint256 parentSize, ) = _getQuadLayer(size);\n address owner = address(uint160(_owners[_getQuadId(layer, (x / size) * size, (y / size) * size)]));\n if (owner != address(0)) {\n return owner;\n } else if (size < 24) {\n return _ownerOfQuad(parentSize, x, y);\n }\n return address(0);\n }\n\n function _getQuadById(uint256 id)\n internal\n pure\n returns (\n uint256 size,\n uint256 x,\n uint256 y\n )\n {\n x = _getX(id);\n y = _getY(id);\n uint256 layer = id & LAYER;\n if (layer == LAYER_1x1) {\n size = 1;\n } else if (layer == LAYER_3x3) {\n size = 3;\n } else if (layer == LAYER_6x6) {\n size = 6;\n } else if (layer == LAYER_12x12) {\n size = 12;\n } else if (layer == LAYER_24x24) {\n size = 24;\n } else {\n require(false, \"Invalid token id\");\n }\n }\n\n function _ownerOf(uint256 id) internal view override returns (address) {\n require(id & LAYER == 0, \"Invalid token id\");\n (uint256 size, uint256 x, uint256 y) = _getQuadById(id);\n require(x % size == 0, \"x coordinate: Invalid token id\");\n require(y % size == 0, \"y coordinate: Invalid token id\");\n if (size == 1) {\n uint256 owner1x1 = _owners[id];\n return (owner1x1 & BURNED_FLAG) == BURNED_FLAG ? address(0) : _ownerOfQuad(size, x, y);\n }\n return _ownerOfQuad(size, x, y);\n }\n\n function _ownerAndOperatorEnabledOf(uint256 id)\n internal\n view\n override\n returns (address owner, bool operatorEnabled)\n {\n require(id & LAYER == 0, \"Invalid token id\");\n uint256 x = id % GRID_SIZE;\n uint256 y = id / GRID_SIZE;\n uint256 owner1x1 = _owners[id];\n\n if ((owner1x1 & BURNED_FLAG) == BURNED_FLAG) {\n owner = address(0);\n operatorEnabled = (owner1x1 & OPERATOR_FLAG) == OPERATOR_FLAG;\n return (owner, operatorEnabled);\n }\n\n if (owner1x1 != 0) {\n owner = address(uint160(owner1x1));\n operatorEnabled = (owner1x1 & OPERATOR_FLAG) == OPERATOR_FLAG;\n } else {\n owner = _ownerOfQuad(3, (x * 3) / 3, (y * 3) / 3);\n operatorEnabled = false;\n }\n }\n\n // Empty storage space in contracts for future enhancements\n // ref: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/issues/13)\n uint256[49] private __gap;\n}\n" + }, + "src/solc_0.8/polygon/child/land/PolygonLandTunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"fx-portal/contracts/tunnel/FxBaseChildTunnel.sol\";\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport \"@openzeppelin/contracts-0.8/security/Pausable.sol\";\n\nimport \"../../../common/interfaces/IPolygonLand.sol\";\nimport \"../../../common/interfaces/IERC721MandatoryTokenReceiver.sol\";\nimport \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\nimport \"./PolygonLandBaseToken.sol\";\n\n/// @title LAND bridge on L2\ncontract PolygonLandTunnel is FxBaseChildTunnel, IERC721MandatoryTokenReceiver, ERC2771Handler, Ownable, Pausable {\n IPolygonLand public immutable childToken;\n uint32 public maxGasLimitOnL1;\n uint256 public maxAllowedQuads;\n bool internal transferringToL1;\n\n mapping(uint8 => uint32) public gasLimits;\n\n event SetGasLimit(uint8 size, uint32 limit);\n event SetMaxGasLimit(uint32 maxGasLimit);\n event SetMaxAllowedQuads(uint256 maxQuads);\n event Deposit(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\n event Withdraw(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\n\n function setMaxLimitOnL1(uint32 _maxGasLimit) external onlyOwner {\n maxGasLimitOnL1 = _maxGasLimit;\n emit SetMaxGasLimit(_maxGasLimit);\n }\n\n function setMaxAllowedQuads(uint256 _maxAllowedQuads) external onlyOwner {\n require(_maxAllowedQuads > 0, \"PolygonLandTunnel: max allowed value cannot be zero\");\n maxAllowedQuads = _maxAllowedQuads;\n emit SetMaxAllowedQuads(_maxAllowedQuads);\n }\n\n function _setLimit(uint8 size, uint32 limit) internal {\n gasLimits[size] = limit;\n emit SetGasLimit(size, limit);\n }\n\n function setLimit(uint8 size, uint32 limit) external onlyOwner {\n _setLimit(size, limit);\n }\n\n // setupLimits([5, 10, 20, 90, 340]);\n function setupLimits(uint32[5] memory limits) public onlyOwner {\n _setLimit(1, limits[0]);\n _setLimit(3, limits[1]);\n _setLimit(6, limits[2]);\n _setLimit(12, limits[3]);\n _setLimit(24, limits[4]);\n }\n\n constructor(\n address _fxChild,\n IPolygonLand _childToken,\n address _trustedForwarder,\n uint32 _maxGasLimit,\n uint256 _maxAllowedQuads,\n uint32[5] memory limits\n ) FxBaseChildTunnel(_fxChild) {\n childToken = _childToken;\n maxGasLimitOnL1 = _maxGasLimit;\n maxAllowedQuads = _maxAllowedQuads;\n setupLimits(limits);\n __ERC2771Handler_initialize(_trustedForwarder);\n }\n\n function batchTransferQuadToL1(\n address to,\n uint256[] calldata sizes,\n uint256[] calldata xs,\n uint256[] calldata ys,\n bytes memory data\n ) external whenNotPaused() {\n require(sizes.length == xs.length && sizes.length == ys.length, \"sizes, xs, ys must be same length\");\n\n uint32 gasLimit = 0;\n uint256 quads = 0;\n for (uint256 i = 0; i < sizes.length; i++) {\n gasLimit += gasLimits[uint8(sizes[i])];\n quads += sizes[i] * sizes[i];\n }\n\n require(quads <= maxAllowedQuads, \"Exceeds max allowed quads.\");\n require(gasLimit < maxGasLimitOnL1, \"Exceeds gas limit on L1.\");\n transferringToL1 = true;\n for (uint256 i = 0; i < sizes.length; i++) {\n childToken.transferQuad(_msgSender(), address(this), sizes[i], xs[i], ys[i], data);\n emit Withdraw(to, sizes[i], xs[i], ys[i], data);\n }\n _sendMessageToRoot(abi.encode(to, sizes, xs, ys, data));\n transferringToL1 = false;\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n }\n\n /// @dev Pauses all token transfers across bridge\n function pause() external onlyOwner {\n _pause();\n }\n\n /// @dev Unpauses all token transfers across bridge\n function unpause() external onlyOwner {\n _unpause();\n }\n\n function _processMessageFromRoot(\n uint256, /* stateId */\n address sender,\n bytes memory data\n ) internal override validateSender(sender) {\n _syncDeposit(data);\n }\n\n function _syncDeposit(bytes memory syncData) internal {\n (address to, uint256 size, uint256 x, uint256 y, bytes memory data) =\n abi.decode(syncData, (address, uint256, uint256, uint256, bytes));\n if (!childToken.exists(size, x, y)) childToken.mintQuad(to, size, x, y, data);\n else childToken.transferQuad(address(this), to, size, x, y, data);\n emit Deposit(to, size, x, y, data);\n }\n\n function _msgSender() internal view override(Context, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n\n function onERC721Received(\n address, /* operator */\n address, /* from */\n uint256, /* tokenId */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(transferringToL1, \"PolygonLandTunnel: !BRIDGING\");\n return this.onERC721Received.selector;\n }\n\n function onERC721BatchReceived(\n address, /* operator */\n address, /* from */\n uint256[] calldata, /* ids */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(transferringToL1, \"PolygonLandTunnel: !BRIDGING\");\n return this.onERC721BatchReceived.selector;\n }\n\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n return interfaceId == 0x5e8bf644 || interfaceId == 0x01ffc9a7;\n }\n}\n" + }, + "src/solc_0.8/polygon/child/land/PolygonLandTunnelMigration.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IPolygonLandWithSetApproval} from \"../../../common/interfaces/IPolygonLandWithSetApproval.sol\";\nimport {IPolygonLandTunnel} from \"../../../common/interfaces/IPolygonLandTunnel.sol\";\nimport {IERC721MandatoryTokenReceiver} from \"../../../common/interfaces/IERC721MandatoryTokenReceiver.sol\";\n\n/// @title Tunnel migration on L2\n/// @author The Sandbox\n/// @notice contract handling the migration of LAND tokens from a tunnel to a new one\ncontract PolygonLandTunnelMigration is IERC721MandatoryTokenReceiver {\n struct OwnerWithLandIds {\n address owner;\n uint256[] sizes;\n uint256[] x;\n uint256[] y;\n }\n\n IPolygonLandWithSetApproval public immutable polygonLand;\n address public immutable newLandTunnel;\n address public immutable oldLandTunnel;\n address private admin;\n\n event TunnelLandsMigrated(address indexed oldLandTunnel, address indexed newLandTunnel, uint256[] ids);\n event TunnelLandsMigratedWithWithdraw(OwnerWithLandIds indexed _ownerWithLandIds);\n event TunnelQuadsMigrated(\n address indexed oldLandTunnel,\n address indexed newLandTunnel,\n uint256[] sizes,\n uint256[] x,\n uint256[] y\n );\n event AdminChanged(address indexed _newAdmin);\n\n modifier isAdmin() {\n require(admin == msg.sender, \"PolygonLandTunnelMigration: !AUTHORISED\");\n _;\n }\n\n /// @notice constructor of the tunnel migration contract\n /// @param _polygonLand LAND token address on the child chain\n /// @param _newLandTunnel tunnel address to migrate to\n /// @param _oldLandTunnel tunnel address to migrate from\n /// @param _admin admin of the contract\n constructor(\n address _polygonLand,\n address _newLandTunnel,\n address _oldLandTunnel,\n address _admin\n ) {\n require(_admin != address(0), \"PolygonLandTunnelMigration: admin can't be zero address\");\n require(_polygonLand != address(0), \"PolygonLandTunnelMigration: polygonLand can't be zero address\");\n require(_newLandTunnel != address(0), \"PolygonLandTunnelMigration: new Tunnel can't be zero address\");\n require(_oldLandTunnel != address(0), \"PolygonLandTunnelMigration: old Tunnel can't be zero address\");\n admin = _admin;\n polygonLand = IPolygonLandWithSetApproval(_polygonLand);\n newLandTunnel = _newLandTunnel;\n oldLandTunnel = _oldLandTunnel;\n\n emit AdminChanged(_admin);\n }\n\n /// @dev Transfers all the passed land ids from the old land tunnel to the new land tunnel\n /// @notice This method needs super operator role to execute\n /// @param ids of land tokens to be migrated\n function migrateLandsToTunnel(uint256[] memory ids) external isAdmin {\n polygonLand.batchTransferFrom(oldLandTunnel, newLandTunnel, ids, \"\");\n emit TunnelLandsMigrated(oldLandTunnel, newLandTunnel, ids);\n }\n\n /// @dev Fetches locked land ids to this contract and withdraws again through the new tunnel\n /// @notice This method needs super operator role to execute\n /// @param _ownerWithLandIds struct containing token owner with their land ids\n function migrateToTunnelWithWithdraw(OwnerWithLandIds memory _ownerWithLandIds) external isAdmin {\n // check for gas limits based on the number of locked tokens\n // Fetch locked tokens to this contract address\n polygonLand.batchTransferQuad(\n oldLandTunnel,\n address(this),\n _ownerWithLandIds.sizes,\n _ownerWithLandIds.x,\n _ownerWithLandIds.y,\n \"\"\n );\n // Withdraw tokens to L1\n IPolygonLandTunnel(newLandTunnel).batchTransferQuadToL1(\n _ownerWithLandIds.owner,\n _ownerWithLandIds.sizes,\n _ownerWithLandIds.x,\n _ownerWithLandIds.y,\n \"\"\n );\n\n emit TunnelLandsMigratedWithWithdraw(_ownerWithLandIds);\n }\n\n ///@dev approves New Land Tunnel to transfer Lands on behalf of this contract\n function approveNewLandTunnel() external isAdmin {\n polygonLand.setApprovalForAll(newLandTunnel, true);\n }\n\n /// @dev Transfers all the passed quads from the old land tunnel to the new land tunnel\n /// @notice This method needs super operator role to execute\n /// @param sizes of land quads to be migrated\n /// @param x coordinate of land quads to be migrated\n /// @param y coordinate of land quads to be migrated\n function migrateQuadsToTunnel(\n uint256[] memory sizes,\n uint256[] memory x,\n uint256[] memory y\n ) external isAdmin {\n polygonLand.batchTransferQuad(oldLandTunnel, newLandTunnel, sizes, x, y, \"\");\n emit TunnelQuadsMigrated(oldLandTunnel, newLandTunnel, sizes, x, y);\n }\n\n /// @notice changes admin to new admin\n /// @param _newAdmin the new admin to be set\n function changeAdmin(address _newAdmin) external isAdmin {\n require(_newAdmin != address(0), \"PolygonLandTunnelMigration: admin can't be zero address\");\n admin = _newAdmin;\n emit AdminChanged(_newAdmin);\n }\n\n /// @dev called on ERC721 transfer to this contract\n /// @return onERC721Received function selector\n function onERC721Received(\n address, /* operator */\n address, /* from */\n uint256, /* tokenId */\n bytes calldata /* data */\n ) external pure override returns (bytes4) {\n return this.onERC721Received.selector;\n }\n\n /// @dev called on ERC721 batch transfer to this contract\n /// @return onERC721BatchReceived function selector\n function onERC721BatchReceived(\n address, /* operator */\n address, /* from */\n uint256[] calldata, /* ids */\n bytes calldata /* data */\n ) external pure override returns (bytes4) {\n return this.onERC721BatchReceived.selector;\n }\n\n /// @dev to be called by external contact to check if this contract supports ERC721 token and batch token receive\n /// @param interfaceId the interface to be checked if supported by the contract\n /// @return 0x5e8bf644 is the interface of IERC721MandatoryTokenReceiver and 0x01ffc9a7 for the Eip 165 supports interface's interface id\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n return interfaceId == 0x5e8bf644 || interfaceId == 0x01ffc9a7;\n }\n}\n" + }, + "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {FxBaseChildTunnelUpgradeable} from \"../../../common/fx-portal/FxBaseChildTunnelUpgradeable.sol\";\nimport {\n OwnableUpgradeable,\n ContextUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport {IPolygonLandV2} from \"../../../common/interfaces/IPolygonLandV2.sol\";\nimport {IERC721MandatoryTokenReceiver} from \"../../../common/interfaces/IERC721MandatoryTokenReceiver.sol\";\nimport {ERC2771Handler} from \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\n\n/**\n * @title PolygonLandTunnelV2\n * @author The Sandbox\n * @notice LAND tunnel on the child chain\n */\ncontract PolygonLandTunnelV2 is\n FxBaseChildTunnelUpgradeable,\n IERC721MandatoryTokenReceiver,\n ERC2771Handler,\n OwnableUpgradeable,\n PausableUpgradeable\n{\n bool internal transferringToL1;\n uint32 public maxGasLimitOnL1;\n uint256 public maxAllowedLands;\n IPolygonLandV2 public childToken;\n\n mapping(uint8 => uint32) public gasLimits;\n\n event SetGasLimit(uint8 indexed size, uint32 indexed limit);\n event SetMaxGasLimit(uint32 maxGasLimit);\n event SetMaxAllowedLands(uint256 maxLands);\n event Deposit(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\n event Withdraw(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\n\n /// @notice initialize the contract\n /// @param _fxChild child contract for state receiver\n /// @param _childToken address of the token on the child chain\n /// @param _trustedForwarder address of an ERC2771 meta transaction sender contract\n /// @param _maxGasLimit maximum accepted gas limit\n /// @param _maxAllowedLands maximum number of Lands accepted\n /// @param limits the estimated gas that the L1 tx will use per quad size\n function initialize(\n address _fxChild,\n IPolygonLandV2 _childToken,\n address _trustedForwarder,\n uint32 _maxGasLimit,\n uint256 _maxAllowedLands,\n uint32[5] memory limits\n ) public initializer {\n __Ownable_init();\n __Pausable_init();\n childToken = _childToken;\n _setMaxLimitOnL1(_maxGasLimit);\n _setMaxAllowedLands(_maxAllowedLands);\n setupGasLimits(limits);\n __FxBaseChildTunnelUpgradeable_initialize(_fxChild);\n __ERC2771Handler_initialize(_trustedForwarder);\n }\n\n /// @notice set the limit of lands we can send in one tx to L1\n /// @param _maxAllowedLands maximum number of lands accepted\n function setMaxAllowedLands(uint256 _maxAllowedLands) external onlyOwner {\n require(_maxAllowedLands > 0, \"PolygonLandTunnelV2: max allowed value cannot be zero\");\n maxAllowedLands = _maxAllowedLands;\n emit SetMaxAllowedLands(_maxAllowedLands);\n }\n\n /// @notice set the estimate of gas that the L1 transaction will use per quad size\n /// @param size the size of the quad\n /// @param limit the estimated gas that the L1 tx will use\n function setGasLimit(uint8 size, uint32 limit) external onlyOwner {\n require(size == 1 || size == 3 || size == 6 || size == 12 || size == 24, \"PolygonLandTunnelV2: invalid data\");\n\n _setGasLimit(size, limit);\n }\n\n /// @notice set the estimate of gas that the L1 transaction will use per quad size\n /// @param limits the estimated gas that the L1 tx will use per quad size\n function setupGasLimits(uint32[5] memory limits) public onlyOwner {\n _setGasLimit(1, limits[0]);\n _setGasLimit(3, limits[1]);\n _setGasLimit(6, limits[2]);\n _setGasLimit(12, limits[3]);\n _setGasLimit(24, limits[4]);\n }\n\n /// @notice send a batch of quads to L1\n /// @param to address of the receiver on L1\n /// @param sizes sizes of quad\n /// @param xs x coordinates of quads\n /// @param ys y coordinates of quads\n /// @param data data send to the receiver onERC721BatchReceived on L1\n function batchTransferQuadToL1(\n address to,\n uint256[] calldata sizes,\n uint256[] calldata xs,\n uint256[] calldata ys,\n bytes memory data\n ) external whenNotPaused() {\n require(to != address(0), \"PolygonLandTunnelV2: can't send to zero address\");\n require(sizes.length == xs.length, \"PolygonLandTunnelV2: sizes's and x's length are different\");\n require(sizes.length == ys.length, \"PolygonLandTunnelV2: x's and y's length are different\");\n\n uint32 totalGasLimit = 0;\n uint256 lands = 0;\n for (uint256 i = 0; i < sizes.length; i++) {\n totalGasLimit += gasLimits[uint8(sizes[i])];\n lands += sizes[i] * sizes[i];\n }\n\n require(lands <= maxAllowedLands, \"PolygonLandTunnelV2: Exceeds max allowed lands.\");\n require(totalGasLimit < maxGasLimitOnL1, \"PolygonLandTunnelV2: Exceeds gas limit on L1.\");\n transferringToL1 = true;\n for (uint256 i = 0; i < sizes.length; i++) {\n childToken.transferQuad(_msgSender(), address(this), sizes[i], xs[i], ys[i], data);\n emit Withdraw(to, sizes[i], xs[i], ys[i], data);\n }\n _sendMessageToRoot(abi.encode(to, sizes, xs, ys, data));\n transferringToL1 = false;\n }\n\n /// @notice sets the fx-root tunnel\n /// @dev only owner can call this funtion\n /// @param _fxRootTunnel address of the fx-root tunnel\n function setFxRootTunnel(address _fxRootTunnel) external override onlyOwner {\n require(fxRootTunnel == address(0), \"PolygonLandTunnelV2: ROOT_TUNNEL_ALREADY_SET\");\n\n fxRootTunnel = _fxRootTunnel;\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n\n emit TrustedForwarderSet(trustedForwarder);\n }\n\n /// @notice set the limit of estimated gas we accept when sending a batch of quads to L1\n /// @param _maxGasLimit maximum accepted gas limit\n function setMaxLimitOnL1(uint32 _maxGasLimit) external onlyOwner {\n _setMaxLimitOnL1(_maxGasLimit);\n }\n\n /// @dev Pauses all token transfers across bridge\n function pause() external onlyOwner {\n _pause();\n }\n\n /// @dev Unpauses all token transfers across bridge\n function unpause() external onlyOwner {\n _unpause();\n }\n\n /// @dev called on ERC721 transfer to this contract\n /// @param operator address of the one sending the ERC721 Token\n /// @return onERC721Received function selector\n function onERC721Received(\n address operator,\n address,\n uint256,\n bytes calldata\n ) external view override returns (bytes4) {\n require(transferringToL1 || childToken.isSuperOperator(operator), \"PolygonLandTunnelV2: !BRIDGING\");\n return this.onERC721Received.selector;\n }\n\n /// @dev called on ERC721 batch transfer to this contract\n /// @param operator address of the one sending the ERC721 Token\n /// @return onERC721BatchReceived function selector\n function onERC721BatchReceived(\n address operator,\n address,\n uint256[] calldata,\n bytes calldata\n ) external view override returns (bytes4) {\n require(transferringToL1 || childToken.isSuperOperator(operator), \"PolygonLandTunnelV2: !BRIDGING\");\n return this.onERC721BatchReceived.selector;\n }\n\n /// @dev to be called by external contact to check if this contract supports ERC721 token and batch token receive\n /// @param interfaceId the interface to be checked if supported by the contract\n /// @return 0x5e8bf644 is the interface of IERC721MandatoryTokenReceiver and 0x01ffc9a7 for the Eip 165 supports interface's interface id\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n return interfaceId == 0x5e8bf644 || interfaceId == 0x01ffc9a7;\n }\n\n function _processMessageFromRoot(\n uint256,\n address sender,\n bytes memory data\n ) internal override validateSender(sender) {\n _syncDeposit(data);\n }\n\n function _setMaxLimitOnL1(uint32 _maxGasLimit) internal {\n maxGasLimitOnL1 = _maxGasLimit;\n emit SetMaxGasLimit(_maxGasLimit);\n }\n\n function _setMaxAllowedLands(uint256 _maxAllowedLands) internal {\n require(_maxAllowedLands > 0, \"PolygonLandTunnelV2: max allowed value cannot be zero\");\n maxAllowedLands = _maxAllowedLands;\n emit SetMaxAllowedLands(_maxAllowedLands);\n }\n\n function _syncDeposit(bytes memory syncData) internal {\n (address to, uint256 size, uint256 x, uint256 y, bytes memory data) =\n abi.decode(syncData, (address, uint256, uint256, uint256, bytes));\n childToken.mintAndTransferQuad(to, size, x, y, data);\n emit Deposit(to, size, x, y, data);\n }\n\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n\n function _setGasLimit(uint8 size, uint32 limit) internal {\n gasLimits[size] = limit;\n emit SetGasLimit(size, limit);\n }\n\n uint256[50] private __gap;\n}\n" + }, + "src/solc_0.8/polygon/child/land/PolygonLandV1.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"./PolygonLandBaseToken.sol\";\nimport \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\n/// @title LAND token on L2\ncontract PolygonLandV1 is PolygonLandBaseToken, ERC2771Handler {\n function initialize(address trustedForwarder) external initializer {\n _admin = _msgSender();\n __ERC2771Handler_initialize(trustedForwarder);\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyAdmin {\n _trustedForwarder = trustedForwarder;\n }\n\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n}\n" + }, + "src/solc_0.8/polygon/child/land/PolygonLandV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"./PolygonLandBaseTokenV2.sol\";\nimport \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\nimport \"../../../OperatorFilterer/contracts/upgradeable/OperatorFiltererUpgradeable.sol\";\n\n/// @title LAND token on L2\ncontract PolygonLandV2 is PolygonLandBaseTokenV2, ERC2771Handler, OperatorFiltererUpgradeable {\n using AddressUpgradeable for address;\n\n event OperatorRegistrySet(address indexed registry);\n\n function initialize(address trustedForwarder) external initializer {\n _admin = _msgSender();\n __ERC2771Handler_initialize(trustedForwarder);\n emit AdminChanged(address(0), _admin);\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyAdmin {\n _trustedForwarder = trustedForwarder;\n emit TrustedForwarderSet(trustedForwarder);\n }\n\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n\n /**\n * @notice Approve an operator to spend tokens on the sender behalf\n * @param sender The address giving the approval\n * @param operator The address receiving the approval\n * @param id The id of the token\n */\n function approveFor(\n address sender,\n address operator,\n uint256 id\n ) public override onlyAllowedOperatorApproval(operator) {\n super.approveFor(sender, operator, id);\n }\n\n /**\n * @notice Approve an operator to spend tokens on the sender behalf\n * @param operator The address receiving the approval\n * @param id The id of the token\n */\n function approve(address operator, uint256 id) public override onlyAllowedOperatorApproval(operator) {\n super.approve(operator, id);\n }\n\n /**\n * @notice Transfer a token between 2 addresses\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param id The id of the token\n */\n function transferFrom(\n address from,\n address to,\n uint256 id\n ) public override onlyAllowedOperator(from) {\n super.transferFrom(from, to, id);\n }\n\n /**\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param id The id of the token\n * @param data Additional data\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) public override onlyAllowedOperator(from) {\n super.safeTransferFrom(from, to, id, data);\n }\n\n /**\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\n * @param from The send of the token\n * @param to The recipient of the token\n * @param id The id of the token\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id\n ) public override onlyAllowedOperator(from) {\n super.safeTransferFrom(from, to, id);\n }\n\n /**\n * @notice Set the approval for an operator to manage all the tokens of the sender\n * @param operator The address receiving the approval\n * @param approved The determination of the approval\n */\n function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {\n super.setApprovalForAll(operator, approved);\n }\n\n /**\n * @notice Set the approval for an operator to manage all the tokens of the sender\n * @param sender The address giving the approval\n * @param operator The address receiving the approval\n * @param approved The determination of the approval\n */\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) public override onlyAllowedOperatorApproval(operator) {\n super.setApprovalForAllFor(sender, operator, approved);\n }\n\n /// @notice This function is used to register Land contract on the Operator Filterer Registry of Opensea.\n /// @dev can only be called by admin.\n /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe.\n /// @param subscribe bool to signify subscription 'true' or to copy the list 'false'.\n function register(address subscriptionOrRegistrantToCopy, bool subscribe) external onlyAdmin {\n require(subscriptionOrRegistrantToCopy != address(0), \"PolygonLandV2: subscription can't be zero address\");\n _register(subscriptionOrRegistrantToCopy, subscribe);\n }\n\n /// @notice sets filter registry address deployed in test\n /// @param registry the address of the registry\n function setOperatorRegistry(address registry) external virtual onlyAdmin {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n emit OperatorRegistrySet(registry);\n }\n}\n" + }, + "src/solc_0.8/polygon/child/sand/interfaces/IPolygonSand.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface IPolygonSand {\n /// @notice update the ChildChainManager Proxy address\n /// @param newChildChainManagerProxy address of the new childChainManagerProxy\n function updateChildChainManager(address newChildChainManagerProxy) external;\n\n /// @notice called when tokens are deposited on root chain\n /// @param user user address for whom deposit is being done\n /// @param depositData abi encoded amount\n function deposit(address user, bytes calldata depositData) external;\n\n /// @notice called when user wants to withdraw tokens back to root chain\n /// @dev Should burn user's tokens. This transaction will be verified when exiting on root chain\n /// @param amount amount to withdraw\n function withdraw(uint256 amount) external;\n\n /// @notice Get the balance of `owner`.\n /// @param owner The address to query the balance of.\n /// @return The amount owned by `owner`.\n function balanceOf(address owner) external returns (uint256);\n\n /// @notice transfer tokens to a specific address.\n /// @param to destination address receiving the tokens.\n /// @param amount number of tokens to transfer.\n /// @return success whether the transfer succeeded.\n function transfer(address to, uint256 amount) external returns (bool success);\n\n /// @notice transfer tokens from one address to another.\n /// @param from address tokens will be sent from.\n /// @param to destination address receiving the tokens.\n /// @param amount number of tokens to transfer.\n /// @return success whether the transfer succeeded.\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool success);\n\n function setTrustedForwarder(address trustedForwarder) external;\n}\n" + }, + "src/solc_0.8/polygon/child/sand/PolygonSand.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\nimport \"../../../Sand/SandBaseToken.sol\";\n\ncontract PolygonSand is SandBaseToken, Ownable, ERC2771Handler {\n address public childChainManagerProxy;\n\n constructor(\n address _childChainManagerProxy,\n address trustedForwarder,\n address sandAdmin,\n address executionAdmin\n ) SandBaseToken(sandAdmin, executionAdmin, address(0), 0) {\n require(_childChainManagerProxy != address(0), \"Bad ChildChainManagerProxy address\");\n childChainManagerProxy = _childChainManagerProxy;\n __ERC2771Handler_initialize(trustedForwarder);\n }\n\n /// @notice update the ChildChainManager Proxy address\n /// @param newChildChainManagerProxy address of the new childChainManagerProxy\n function updateChildChainManager(address newChildChainManagerProxy) external onlyOwner {\n require(newChildChainManagerProxy != address(0), \"Bad ChildChainManagerProxy address\");\n childChainManagerProxy = newChildChainManagerProxy;\n }\n\n /// @notice called when tokens are deposited on root chain\n /// @param user user address for whom deposit is being done\n /// @param depositData abi encoded amount\n function deposit(address user, bytes calldata depositData) external {\n require(_msgSender() == childChainManagerProxy, \"You're not allowed to deposit\");\n uint256 amount = abi.decode(depositData, (uint256));\n _mint(user, amount);\n }\n\n /// @notice called when user wants to withdraw tokens back to root chain\n /// @dev Should burn user's tokens. This transaction will be verified when exiting on root chain\n /// @param amount amount to withdraw\n function withdraw(uint256 amount) external {\n _burn(_msgSender(), amount);\n }\n\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n }\n\n function _msgSender() internal view override(Context, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n}\n" + }, + "src/solc_0.8/polygon/child/sand/PolygonSandClaim.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/security/ReentrancyGuard.sol\";\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport \"./interfaces/IPolygonSand.sol\";\n\ncontract PolygonSandClaim is Ownable, ReentrancyGuard {\n IPolygonSand internal immutable _polygonSand;\n IERC20 internal immutable _fakePolygonSand;\n\n event SandClaimed(address indexed user, uint256 amount);\n\n constructor(IPolygonSand polygonSand, IERC20 fakePolygonSand) {\n _polygonSand = polygonSand;\n _fakePolygonSand = fakePolygonSand;\n }\n\n /**\n * @notice Swaps fake sand with the new polygonSand\n * @param amount the amount of tokens to be swapped\n */\n function claim(uint256 amount) external nonReentrant {\n require(unclaimedSand() >= amount, \"Not enough sand for claim\");\n bool success = _fakePolygonSand.transferFrom(msg.sender, address(this), amount);\n if (success) {\n _polygonSand.transfer(msg.sender, amount);\n emit SandClaimed(msg.sender, amount);\n }\n }\n\n // Getters\n\n /**\n * @notice Getter for amount of sand which is still locked in this contract\n */\n function unclaimedSand() public returns (uint256) {\n return _polygonSand.balanceOf(address(this));\n }\n\n /**\n * @notice Getter for amount of fake Sand swapped\n */\n function claimedSand() external view returns (uint256) {\n return _fakePolygonSand.balanceOf(address(this));\n }\n}\n" + }, + "src/solc_0.8/polygon/common/ERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155Receiver.sol\";\n\nabstract contract ERC1155Receiver is IERC1155Receiver {\n function onERC1155Received(\n address, /* operator */\n address, /* from */\n uint256, /* id */\n uint256, /* value */\n bytes calldata /* data */\n ) external view virtual override returns (bytes4) {\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address, /* operator */\n address, /* from */\n uint256[] calldata, /* ids */\n uint256[] calldata, /* values */\n bytes calldata /* data */\n ) external view virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n}\n" + }, + "src/solc_0.8/polygon/LiquidityMining/IRewardDistributionRecipient.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\n\nabstract contract IRewardDistributionRecipient is Ownable {\n address public rewardDistribution;\n\n function notifyRewardAmount(uint256 reward) external virtual;\n\n modifier onlyRewardDistribution() {\n require(_msgSender() == rewardDistribution, \"Caller is not reward distribution\");\n _;\n }\n\n modifier onlyRewardDistributionOrAccount(address account) {\n require(\n _msgSender() == rewardDistribution || _msgSender() == account,\n \"Caller is not reward distribution or account\"\n );\n _;\n }\n\n function setRewardDistribution(address _rewardDistribution) external onlyOwner {\n rewardDistribution = _rewardDistribution;\n }\n}\n" + }, + "src/solc_0.8/polygon/LiquidityMining/PolygonLandWeightedSANDRewardPool.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/utils/math/SafeMath.sol\";\nimport \"@openzeppelin/contracts-0.8/utils/math/Math.sol\";\nimport \"@openzeppelin/contracts-0.8/security/ReentrancyGuard.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../../common/Libraries/SafeMathWithRequire.sol\";\nimport \"./IRewardDistributionRecipient.sol\";\nimport \"../../common/interfaces/IERC721.sol\";\n\ncontract PolygonLPTokenWrapper {\n using SafeMath for uint256;\n using SafeERC20 for IERC20;\n\n uint256 internal constant DECIMALS_18 = 1000000000000000000;\n\n IERC20 internal _stakeToken;\n\n uint256 private _totalSupply;\n mapping(address => uint256) private _balances;\n\n constructor(IERC20 stakeToken) {\n _stakeToken = stakeToken;\n }\n\n function totalSupply() public view returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view returns (uint256) {\n return _balances[account];\n }\n\n function stake(uint256 amount) public virtual {\n _totalSupply = _totalSupply.add(amount);\n _balances[msg.sender] = _balances[msg.sender].add(amount);\n _stakeToken.safeTransferFrom(msg.sender, address(this), amount);\n }\n\n function withdraw(uint256 amount) public virtual {\n _totalSupply = _totalSupply.sub(amount);\n _balances[msg.sender] = _balances[msg.sender].sub(amount);\n _stakeToken.safeTransfer(msg.sender, amount);\n }\n}\n\n///@notice Reward Pool based on unipool contract : https://github.com/Synthetixio/Unipool/blob/master/contracts/Unipool.sol\n//with the addition of NFT multiplier reward\ncontract PolygonLandWeightedSANDRewardPool is PolygonLPTokenWrapper, IRewardDistributionRecipient, ReentrancyGuard {\n using SafeMath for uint256;\n using SafeMathWithRequire for uint256;\n using SafeERC20 for IERC20;\n using Address for address;\n\n event RewardAdded(uint256 reward);\n event Staked(address indexed user, uint256 amount);\n event Withdrawn(address indexed user, uint256 amount);\n event RewardPaid(address indexed user, uint256 reward);\n event MultiplierComputed(address indexed user, uint256 multiplier, uint256 contribution);\n\n uint256 public immutable duration;\n\n uint256 public periodFinish = 0;\n uint256 public rewardRate = 0;\n uint256 public lastUpdateTime;\n uint256 public rewardPerTokenStored;\n mapping(address => uint256) public userRewardPerTokenPaid;\n mapping(address => uint256) public rewards;\n\n uint256 internal constant DECIMALS_9 = 1000000000;\n uint256 internal constant MIDPOINT_9 = 500000000;\n uint256 internal constant NFT_FACTOR_6 = 10000;\n uint256 internal constant NFT_CONSTANT_3 = 9000;\n uint256 internal constant ROOT3_FACTOR = 697;\n\n IERC20 internal _rewardToken;\n IERC721 internal _multiplierNFToken;\n\n uint256 internal _totalContributions;\n mapping(address => uint256) internal _multipliers;\n mapping(address => uint256) internal _contributions;\n\n constructor(\n IERC20 stakeToken,\n IERC20 rewardToken,\n IERC721 multiplierNFToken,\n uint256 rewardDuration\n ) PolygonLPTokenWrapper(stakeToken) {\n _rewardToken = rewardToken;\n _multiplierNFToken = multiplierNFToken;\n duration = rewardDuration;\n }\n\n function totalContributions() public view returns (uint256) {\n return _totalContributions;\n }\n\n function contributionOf(address account) public view returns (uint256) {\n return _contributions[account];\n }\n\n function multiplierOf(address account) public view returns (uint256) {\n return _multipliers[account];\n }\n\n modifier updateReward(address account) {\n rewardPerTokenStored = rewardPerToken();\n\n if (block.timestamp >= periodFinish || _totalContributions != 0) {\n // ensure reward past the first staker do not get lost\n lastUpdateTime = lastTimeRewardApplicable();\n }\n if (account != address(0)) {\n rewards[account] = earned(account);\n userRewardPerTokenPaid[account] = rewardPerTokenStored;\n }\n _;\n }\n\n function lastTimeRewardApplicable() public view returns (uint256) {\n return Math.min(block.timestamp, periodFinish);\n }\n\n function rewardPerToken() public view returns (uint256) {\n if (totalContributions() == 0) {\n return rewardPerTokenStored;\n }\n return\n rewardPerTokenStored.add(\n lastTimeRewardApplicable().sub(lastUpdateTime).mul(rewardRate).mul(1e24).div(totalContributions())\n );\n }\n\n function earned(address account) public view returns (uint256) {\n return\n contributionOf(account).mul(rewardPerToken().sub(userRewardPerTokenPaid[account])).div(1e24).add(\n rewards[account]\n );\n }\n\n function computeContribution(uint256 amountStaked, uint256 numLands) public pure returns (uint256) {\n if (numLands == 0) {\n return amountStaked;\n }\n uint256 nftContrib = NFT_FACTOR_6.mul(NFT_CONSTANT_3.add(numLands.sub(1).mul(ROOT3_FACTOR).add(1).cbrt3()));\n if (nftContrib > MIDPOINT_9) {\n nftContrib = MIDPOINT_9.add(nftContrib.sub(MIDPOINT_9).div(10));\n }\n return amountStaked.add(amountStaked.mul(nftContrib).div(DECIMALS_9));\n }\n\n function updateContribution(address account) internal {\n _totalContributions = _totalContributions.sub(contributionOf(account));\n _multipliers[account] = _multiplierNFToken.balanceOf(account);\n\n uint256 contribution = computeContribution(balanceOf(account), multiplierOf(account));\n\n _totalContributions = _totalContributions.add(contribution);\n _contributions[account] = contribution;\n }\n\n function computeMultiplier(address account) public onlyRewardDistributionOrAccount(account) updateReward(account) {\n updateContribution(account);\n\n emit MultiplierComputed(account, multiplierOf(account), contributionOf(account));\n }\n\n function stake(uint256 amount) public override nonReentrant updateReward(msg.sender) {\n require(amount > 0, \"Cannot stake 0\");\n\n super.stake(amount);\n\n updateContribution(msg.sender);\n\n emit Staked(msg.sender, amount);\n }\n\n function withdraw(uint256 amount) public override nonReentrant updateReward(msg.sender) {\n require(amount > 0, \"Cannot withdraw 0\");\n\n super.withdraw(amount);\n\n updateContribution(msg.sender);\n\n emit Withdrawn(msg.sender, amount);\n }\n\n function exit() external {\n withdraw(balanceOf(msg.sender));\n getReward();\n }\n\n function getReward() public nonReentrant updateReward(msg.sender) {\n uint256 reward = rewards[msg.sender];\n if (reward > 0) {\n rewards[msg.sender] = 0;\n _rewardToken.safeTransfer(msg.sender, reward);\n emit RewardPaid(msg.sender, reward);\n }\n }\n\n ///@notice to be called after the amount of reward tokens (specified by the reward parameter) has been sent to the contract\n // Note that the reward should be divisible by the duration to avoid reward token lost\n ///@param reward number of token to be distributed over the duration\n function notifyRewardAmount(uint256 reward) external override onlyRewardDistribution updateReward(address(0)) {\n if (block.timestamp >= periodFinish) {\n rewardRate = reward.div(duration);\n } else {\n uint256 remaining = periodFinish.sub(block.timestamp);\n uint256 leftover = remaining.mul(rewardRate);\n rewardRate = reward.add(leftover).div(duration);\n }\n lastUpdateTime = block.timestamp;\n periodFinish = block.timestamp.add(duration);\n emit RewardAdded(reward);\n }\n\n // Add Setter functions for every external contract\n\n function SetRewardToken(address newRewardToken) external onlyOwner {\n require(newRewardToken.isContract(), \"Bad RewardToken address\");\n\n _rewardToken = IERC20(newRewardToken);\n }\n\n function SetStakeLPToken(address newStakeLPToken) external onlyOwner {\n require(newStakeLPToken.isContract(), \"Bad StakeToken address\");\n\n _stakeToken = IERC20(newStakeLPToken);\n }\n\n function SetNFTMultiplierToken(address newNFTMultiplierToken) external onlyOwner {\n require(newNFTMultiplierToken.isContract(), \"Bad NFTMultiplierToken address\");\n\n _multiplierNFToken = IERC721(newNFTMultiplierToken);\n }\n}\n" + }, + "src/solc_0.8/polygon/LiquidityMining/PolygonSANDRewardPool.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/utils/math/SafeMath.sol\";\nimport \"@openzeppelin/contracts-0.8/utils/math/Math.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport \"./IRewardDistributionRecipient.sol\";\nimport \"../../common/interfaces/IERC721.sol\";\n\ncontract LPTokenWrapper {\n using SafeMath for uint256;\n using SafeERC20 for IERC20;\n\n IERC20 internal _stakeToken;\n\n uint256 private _totalSupply;\n mapping(address => uint256) private _balances;\n\n constructor(IERC20 stakeToken) {\n _stakeToken = stakeToken;\n }\n\n function totalSupply() public view returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view returns (uint256) {\n return _balances[account];\n }\n\n function stake(uint256 amount) public virtual {\n _totalSupply = _totalSupply.add(amount);\n _balances[msg.sender] = _balances[msg.sender].add(amount);\n _stakeToken.safeTransferFrom(msg.sender, address(this), amount);\n }\n\n function withdraw(uint256 amount) public virtual {\n _totalSupply = _totalSupply.sub(amount);\n _balances[msg.sender] = _balances[msg.sender].sub(amount);\n _stakeToken.safeTransfer(msg.sender, amount);\n }\n}\n\ncontract PolygonSANDRewardPool is LPTokenWrapper, IRewardDistributionRecipient {\n using SafeMath for uint256;\n using SafeERC20 for IERC20;\n\n uint256 public constant DURATION = 30 days; // Reward period\n\n uint256 public periodFinish = 0;\n uint256 public rewardRate = 0;\n uint256 public lastUpdateTime;\n uint256 public rewardPerTokenStored;\n mapping(address => uint256) public userRewardPerTokenPaid;\n mapping(address => uint256) public rewards;\n\n event RewardAdded(uint256 reward);\n event Staked(address indexed user, uint256 amount);\n event Withdrawn(address indexed user, uint256 amount);\n event RewardPaid(address indexed user, uint256 reward);\n\n IERC20 internal _rewardToken;\n\n constructor(IERC20 stakeToken, IERC20 rewardToken) LPTokenWrapper(stakeToken) {\n _rewardToken = rewardToken;\n }\n\n modifier updateReward(address account) {\n rewardPerTokenStored = rewardPerToken();\n lastUpdateTime = lastTimeRewardApplicable();\n if (account != address(0)) {\n rewards[account] = earned(account);\n userRewardPerTokenPaid[account] = rewardPerTokenStored;\n }\n _;\n }\n\n function lastTimeRewardApplicable() public view returns (uint256) {\n return Math.min(block.timestamp, periodFinish);\n }\n\n function rewardPerToken() public view returns (uint256) {\n if (totalSupply() == 0) {\n return rewardPerTokenStored;\n }\n return\n rewardPerTokenStored.add(\n lastTimeRewardApplicable().sub(lastUpdateTime).mul(rewardRate).mul(1e18).div(totalSupply())\n );\n }\n\n function earned(address account) public view returns (uint256) {\n return\n balanceOf(account).mul(rewardPerToken().sub(userRewardPerTokenPaid[account])).div(1e18).add(\n rewards[account]\n );\n }\n\n // stake visibility is public as overriding LPTokenWrapper's stake() function\n function stake(uint256 amount) public override updateReward(msg.sender) {\n require(amount > 0, \"Cannot stake 0\");\n super.stake(amount);\n emit Staked(msg.sender, amount);\n }\n\n function withdraw(uint256 amount) public override updateReward(msg.sender) {\n require(amount > 0, \"Cannot withdraw 0\");\n super.withdraw(amount);\n emit Withdrawn(msg.sender, amount);\n }\n\n function exit() external {\n withdraw(balanceOf(msg.sender));\n getReward();\n }\n\n function getReward() public updateReward(msg.sender) {\n uint256 reward = earned(msg.sender);\n if (reward > 0) {\n rewards[msg.sender] = 0;\n _rewardToken.safeTransfer(msg.sender, reward);\n emit RewardPaid(msg.sender, reward);\n }\n }\n\n function notifyRewardAmount(uint256 reward) external override onlyRewardDistribution updateReward(address(0)) {\n if (block.timestamp >= periodFinish) {\n rewardRate = reward.div(DURATION);\n } else {\n uint256 remaining = periodFinish.sub(block.timestamp);\n uint256 leftover = remaining.mul(rewardRate);\n rewardRate = reward.add(leftover).div(DURATION);\n }\n lastUpdateTime = block.timestamp;\n periodFinish = block.timestamp.add(DURATION);\n emit RewardAdded(reward);\n }\n\n // Add Setter functions for every external contract\n\n function SetRewardLPToken(address newRewardToken) external onlyOwner {\n require(newRewardToken != address(0), \"Bad RewardToken address\");\n\n _rewardToken = IERC20(newRewardToken);\n }\n\n function SetStakeLPToken(address newStakeLPToken) external onlyOwner {\n require(newStakeLPToken != address(0), \"Bad StakeToken address\");\n\n _stakeToken = IERC20(newStakeLPToken);\n }\n}\n" + }, + "src/solc_0.8/polygon/root/asset/AssetERC1155Tunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../../common/fx-portal/FxBaseRootTunnelUpgradeable.sol\";\nimport \"../../../common/interfaces/IAssetERC1155.sol\";\nimport \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\nimport \"../../common/ERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\n\n/// @title ASSETERC1155 bridge on L1\ncontract AssetERC1155Tunnel is\n Initializable,\n FxBaseRootTunnelUpgradeable,\n ERC1155Receiver,\n ERC2771Handler,\n OwnableUpgradeable,\n PausableUpgradeable\n{\n IAssetERC1155 public rootToken;\n uint256 public maxTransferLimit;\n bool private fetchingAssets = false;\n\n event SetTransferLimit(uint256 limit);\n event Deposit(address user, uint256 id, uint256 value, bytes data);\n event Withdraw(address user, uint256 id, uint256 value, bytes data);\n\n // solhint-disable-next-line no-empty-blocks\n constructor() initializer {}\n\n function initialize(\n address _checkpointManager,\n address _fxRoot,\n IAssetERC1155 _rootToken,\n address trustedForwarder,\n uint256 _maxTransferLimit\n ) public initializer {\n require(address(_rootToken) != address(0), \"AssetERC1155Tunnel: _rootToken can't be zero\");\n rootToken = _rootToken;\n maxTransferLimit = _maxTransferLimit;\n __Ownable_init();\n __Pausable_init();\n __ERC2771Handler_initialize(trustedForwarder);\n __FxBaseRootTunnelUpgradeable_initialize(_checkpointManager, _fxRoot);\n }\n\n function setTransferLimit(uint256 _maxTransferLimit) external onlyOwner {\n maxTransferLimit = _maxTransferLimit;\n emit SetTransferLimit(_maxTransferLimit);\n }\n\n function supportsInterface(bytes4 interfaceId) external pure override returns (bool) {\n return\n interfaceId == 0x4e2312e0 || // ERC1155Receiver\n interfaceId == 0x01ffc9a7; // ERC165\n }\n\n function batchDepositToChild(\n address to,\n uint256[] memory ids,\n uint256[] memory values\n ) public whenNotPaused {\n require(ids.length > 0, \"MISSING_TOKEN_IDS\");\n require(ids.length < maxTransferLimit, \"EXCEEDS_TRANSFER_LIMIT\");\n bytes32[] memory metadataHashes = new bytes32[](ids.length);\n fetchingAssets = true;\n for (uint256 i = 0; i < ids.length; i++) {\n bytes32 metadataHash = rootToken.metadataHash(ids[i]);\n metadataHashes[i] = metadataHash;\n bytes memory metadata = abi.encode(metadataHash);\n rootToken.safeTransferFrom(_msgSender(), address(this), ids[i], values[i], abi.encode(metadataHash));\n emit Deposit(to, ids[i], values[i], metadata);\n }\n fetchingAssets = false;\n _sendMessageToChild(abi.encode(to, ids, values, abi.encode(metadataHashes)));\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n }\n\n /// @dev Pauses all token transfers across bridge\n function pause() public onlyOwner {\n _pause();\n }\n\n /// @dev Unpauses all token transfers across bridge\n function unpause() public onlyOwner {\n _unpause();\n }\n\n function _processMessageFromChild(bytes memory message) internal override {\n (address to, uint256[] memory ids, uint256[] memory values, bytes memory data) =\n abi.decode(message, (address, uint256[], uint256[], bytes));\n bytes32[] memory metadataHashes = abi.decode(data, (bytes32[]));\n for (uint256 i = 0; i < ids.length; i++) {\n bytes memory metadata = abi.encode(metadataHashes[i]);\n if (rootToken.doesHashExist(ids[i])) {\n _depositMinted(to, ids[i], values[i], metadata);\n } else {\n rootToken.mint(to, ids[i], values[i], metadata);\n }\n emit Withdraw(to, ids[i], values[i], metadata);\n }\n }\n\n function _depositMinted(\n address to,\n uint256 id,\n uint256 value,\n bytes memory data\n ) internal {\n uint256 balance = rootToken.balanceOf(address(this), id);\n if (balance >= value) {\n rootToken.safeTransferFrom(address(this), to, id, value, data);\n } else {\n if (balance > 0) rootToken.safeTransferFrom(address(this), to, id, balance, data);\n rootToken.mintDeficit(to, id, (value - balance));\n }\n }\n\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n\n function onERC1155Received(\n address, /*_operator*/\n address, /*_from*/\n uint256, /*_id*/\n uint256, /*_value*/\n bytes calldata /*_data*/\n ) external view override returns (bytes4) {\n require(fetchingAssets == true, \"AssetERC1155Tunnel: can't directly send Assets\");\n return 0xf23a6e61; //bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))\n }\n\n function onERC1155BatchReceived(\n address, /*_operator*/\n address, /*_from*/\n uint256[] calldata, /*_ids*/\n uint256[] calldata, /*_values*/\n bytes calldata /*_data*/\n ) external view override returns (bytes4) {\n require(fetchingAssets == true, \"AssetERC1155Tunnel: can't directly send Assets\");\n return 0xbc197c81; //bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))\n }\n}\n" + }, + "src/solc_0.8/polygon/root/asset/AssetERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\nimport {BaseERC721} from \"../../../assetERC721/BaseERC721.sol\";\nimport {IERC721Base} from \"../../../common/interfaces/IERC721Base.sol\";\nimport {IAssetERC721} from \"../../../common/interfaces/IAssetERC721.sol\";\nimport {\n DefaultOperatorFiltererUpgradeable\n} from \"../../../OperatorFilterer/contracts/upgradeable/DefaultOperatorFiltererUpgradeable.sol\";\nimport {\n OperatorFiltererUpgradeable\n} from \"../../../OperatorFilterer/contracts/upgradeable/OperatorFiltererUpgradeable.sol\";\n\n/// @title This contract is for AssetERC721 which can be minted by a minter role.\n/// @dev This contract supports meta transactions.\n/// @dev This contract is final, don't inherit from it.\ncontract AssetERC721 is BaseERC721, IAssetERC721, OperatorFiltererUpgradeable {\n bytes32 public constant METADATA_ROLE = keccak256(\"METADATA_ROLE\");\n\n /// @notice fulfills the purpose of a constructor in upgradeable contracts\n function initialize(\n address trustedForwarder,\n address admin,\n address subscription\n ) public initializer {\n _setupRole(DEFAULT_ADMIN_ROLE, admin);\n _trustedForwarder = trustedForwarder;\n __ERC721_init(\"Sandbox's ASSETs ERC721\", \"ASSETERC721\");\n __OperatorFilterer_init(subscription, true);\n }\n\n /// @notice Mint an ERC721 Asset with the provided id.\n /// @dev Should be callable only by the AssetTunnel on L1 via MINTER_ROLE.\n /// @param to Address that will receive the token.\n /// @param id ERC721 id to be used.\n function mint(address to, uint256 id) public override(BaseERC721, IERC721Base) onlyRole(MINTER_ROLE) {\n BaseERC721.mint(to, id);\n }\n\n /// @notice Mint an ERC721 Asset with the provided id.\n /// @dev Should be callable only by the AssetTunnel on L1.\n /// @dev If you want to retain token metadata from L2 to L1 during exit, you must implement this method.\n /// @param to Address that will receive the token.\n /// @param id ERC721 id to be used.\n /// @param data Associated token metadata, which is decoded & used to set the token's metadata hash.\n function mint(\n address to,\n uint256 id,\n bytes calldata data\n ) public override(BaseERC721, IERC721Base) onlyRole(MINTER_ROLE) {\n BaseERC721.mint(to, id, data);\n }\n\n /// @notice Set the metadatahash for a given token id.\n /// @dev The metadata hash for the ERC721 may need to be manually set or overridden.\n /// @param id The token id.\n /// @param uri The full token URI to be used for the token id.\n function setTokenURI(uint256 id, string memory uri) external override onlyRole(METADATA_ROLE) {\n tokenUris[id] = uri;\n }\n\n /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.\n /// @param id The token to get the uri of.\n /// @return URI The token's URI string.\n function tokenURI(uint256 id) public view override(BaseERC721, IAssetERC721) returns (string memory) {\n require(ownerOf(id) != address(0), \"ZERO_ADDRESS\");\n return tokenUris[id];\n }\n\n /// @notice Query if a contract implements interface `id`.\n /// @param id the interface identifier, as specified in ERC-165.\n /// @return `true` if the contract implements `id`.\n function supportsInterface(bytes4 id) public view override(BaseERC721, IERC721Base) returns (bool) {\n return BaseERC721.supportsInterface(id);\n }\n\n /// @notice Change the address of the trusted forwarder for meta-transactions\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder)\n public\n override(BaseERC721, IERC721Base)\n onlyRole(DEFAULT_ADMIN_ROLE)\n {\n BaseERC721.setTrustedForwarder(trustedForwarder);\n }\n\n /// @notice Set the approval for an operator to manage all the tokens of the sender.\n /// @param from The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param approved The determination of the approval.\n function setApprovalForAllFor(\n address from,\n address operator,\n bool approved\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperatorApproval(operator) {\n BaseERC721.setApprovalForAllFor(from, operator, approved);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param from Address whose token is to be transferred.\n /// @param to Recipient.\n /// @param tokenId The token id to be transferred.\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperator(from) {\n BaseERC721.safeTransferFrom(from, to, tokenId);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n /// @param data Additional data.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperator(from) {\n BaseERC721.safeBatchTransferFrom(from, to, ids, data);\n }\n\n /// @notice Checks if address supplierd is that of an forwarder\n /// @param forwarder the address to be checked\n function isTrustedForwarder(address forwarder) public view override(BaseERC721, IERC721Base) returns (bool) {\n return BaseERC721.isTrustedForwarder(forwarder);\n }\n\n /// @notice returns the address of the trusted forwarder\n function getTrustedForwarder() public view override(BaseERC721, IERC721Base) returns (address trustedForwarder) {\n return BaseERC721.getTrustedForwarder();\n }\n\n /// @notice checks if the token id has been minted or not\n /// @param tokenId the id to be checked\n function exists(uint256 tokenId) public view override(BaseERC721, IERC721Base) returns (bool) {\n return BaseERC721.exists(tokenId);\n }\n\n /// @notice Burns token with given `id`.\n /// @param from Address whose token is to be burned.\n /// @param id Token id which will be burned.\n function burnFrom(address from, uint256 id) public override(BaseERC721, IERC721Base) {\n BaseERC721.burnFrom(from, id);\n }\n\n /// @notice Burns token with given `id`.\n /// @dev Used by default fx-portal tunnel which burns rather than locks.\n /// @param id The id of the token to be burned.\n function burn(uint256 id) public override(BaseERC721, IERC721Base) {\n BaseERC721.burn(id);\n }\n\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperator(from) {\n BaseERC721.batchTransferFrom(from, to, ids);\n }\n\n /// @notice Approve an operator to operate tokens on the sender's behalf.\n /// @param from The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param id The id of the token.\n function approveFor(\n address from,\n address operator,\n uint256 id\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperatorApproval(operator) {\n BaseERC721.approveFor(from, operator, id);\n }\n\n function _msgSender() internal view virtual override(BaseERC721, ContextUpgradeable) returns (address sender) {\n return BaseERC721._msgSender();\n }\n\n function _msgData() internal view virtual override(BaseERC721, ContextUpgradeable) returns (bytes calldata) {\n return BaseERC721._msgData();\n }\n}\n" + }, + "src/solc_0.8/polygon/root/asset/AssetERC721Tunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../../common/fx-portal/FxBaseRootTunnelUpgradeable.sol\";\nimport \"../../../common/interfaces/IAssetERC721.sol\";\nimport \"../../../common/interfaces/IERC721MandatoryTokenReceiver.sol\";\nimport \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\n\n/// @title ASSETERC721 bridge on L1\ncontract AssetERC721Tunnel is\n FxBaseRootTunnelUpgradeable,\n IERC721MandatoryTokenReceiver,\n ERC2771Handler,\n OwnableUpgradeable,\n PausableUpgradeable,\n IERC165Upgradeable\n{\n IAssetERC721 public rootToken;\n uint256 public maxTransferLimit;\n bool private fetchingAssets = false;\n\n event SetTransferLimit(uint256 indexed limit);\n event Deposit(address indexed user, uint256 id, bytes indexed data);\n event Withdraw(address indexed user, uint256 id, bytes indexed data);\n\n // solhint-disable-next-line no-empty-blocks\n constructor() initializer {}\n\n function initialize(\n address _checkpointManager,\n address _fxRoot,\n IAssetERC721 _rootToken,\n address trustedForwarder,\n uint256 _maxTransferLimit\n ) public initializer {\n require(address(_rootToken) != address(0), \"AssetERC721Tunnel: _rootToken can't be zero\");\n require(_maxTransferLimit > 0, \"AssetERC721Tunnel: _maxTransferLimit invalid\");\n rootToken = _rootToken;\n maxTransferLimit = _maxTransferLimit;\n __Ownable_init();\n __Pausable_init();\n __ERC2771Handler_initialize(trustedForwarder);\n __FxBaseRootTunnelUpgradeable_initialize(_checkpointManager, _fxRoot);\n }\n\n function setTransferLimit(uint256 _maxTransferLimit) external onlyOwner {\n maxTransferLimit = _maxTransferLimit;\n emit SetTransferLimit(_maxTransferLimit);\n }\n\n function onERC721Received(\n address, /* operator */\n address, /* from */\n uint256, /* tokenId */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(fetchingAssets == true, \"AssetERC721Tunnel: can't directly send Assets\");\n return this.onERC721Received.selector;\n }\n\n function onERC721BatchReceived(\n address, /* operator */\n address, /* from */\n uint256[] calldata, /* ids */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(fetchingAssets == true, \"AssetERC721Tunnel: can't directly send Assets\");\n return this.onERC721BatchReceived.selector;\n }\n\n function supportsInterface(bytes4 interfaceId) external pure override returns (bool) {\n return interfaceId == 0x5e8bf644 || interfaceId == 0x01ffc9a7;\n }\n\n function batchDepositToChild(address to, uint256[] memory ids) external whenNotPaused {\n string[] memory uris = new string[](ids.length);\n fetchingAssets = true;\n for (uint256 i = 0; i < ids.length; i++) {\n // lock the root tokens in this contract\n uint256 id = ids[i];\n string memory uniqueUri = rootToken.tokenURI(id);\n uris[i] = uniqueUri;\n bytes memory uniqueUriData = abi.encode(uniqueUri);\n rootToken.safeTransferFrom(_msgSender(), address(this), ids[i], uniqueUriData);\n emit Deposit(to, ids[i], uniqueUriData);\n }\n fetchingAssets = false;\n _sendMessageToChild(abi.encode(to, ids, uris));\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n }\n\n /// @dev Pauses all token transfers across bridge\n function pause() external onlyOwner {\n _pause();\n }\n\n /// @dev Unpauses all token transfers across bridge\n function unpause() external onlyOwner {\n _unpause();\n }\n\n function _processMessageFromChild(bytes memory message) internal override {\n (address to, uint256[] memory ids, string[] memory uris) = abi.decode(message, (address, uint256[], string[]));\n for (uint256 i = 0; i < ids.length; i++) {\n bytes memory uniqueUriData = abi.encode(uris[i]);\n if (!rootToken.exists(ids[i])) rootToken.mint(to, ids[i], uniqueUriData);\n else rootToken.safeTransferFrom(address(this), to, ids[i], uniqueUriData);\n emit Withdraw(to, ids[i], uniqueUriData);\n }\n }\n\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n}\n" + }, + "src/solc_0.8/polygon/root/IRootChainManager.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\ninterface IRootChainManager {\n event TokenMapped(address indexed rootToken, address indexed childToken, bytes32 indexed tokenType);\n\n event PredicateRegistered(bytes32 indexed tokenType, address indexed predicateAddress);\n\n function registerPredicate(bytes32 tokenType, address predicateAddress) external;\n\n function mapToken(\n address rootToken,\n address childToken,\n bytes32 tokenType\n ) external;\n\n function cleanMapToken(address rootToken, address childToken) external;\n\n function remapToken(\n address rootToken,\n address childToken,\n bytes32 tokenType\n ) external;\n\n function depositEtherFor(address user) external payable;\n\n function depositFor(\n address user,\n address rootToken,\n bytes calldata depositData\n ) external;\n\n function exit(bytes calldata inputData) external;\n}\n" + }, + "src/solc_0.8/polygon/root/land/LandTunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"fx-portal/contracts/tunnel/FxBaseRootTunnel.sol\";\nimport \"../../../common/interfaces/ILandToken.sol\";\nimport \"../../../common/interfaces/IERC721MandatoryTokenReceiver.sol\";\nimport \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport \"@openzeppelin/contracts-0.8/security/Pausable.sol\";\n\n/// @title LAND bridge on L1\ncontract LandTunnel is FxBaseRootTunnel, IERC721MandatoryTokenReceiver, ERC2771Handler, Ownable, Pausable {\n address public immutable rootToken;\n bool internal transferringToL2;\n\n event Deposit(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\n event Withdraw(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\n\n constructor(\n address _checkpointManager,\n address _fxRoot,\n address _rootToken,\n address _trustedForwarder\n ) FxBaseRootTunnel(_checkpointManager, _fxRoot) {\n rootToken = _rootToken;\n __ERC2771Handler_initialize(_trustedForwarder);\n }\n\n function onERC721Received(\n address, /* operator */\n address, /* from */\n uint256, /* tokenId */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(transferringToL2, \"LandTunnel: !BRIDGING\");\n return this.onERC721Received.selector;\n }\n\n function onERC721BatchReceived(\n address, /* operator */\n address, /* from */\n uint256[] calldata, /* ids */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(transferringToL2, \"LandTunnel: !BRIDGING\");\n return this.onERC721BatchReceived.selector;\n }\n\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n return interfaceId == 0x5e8bf644 || interfaceId == 0x01ffc9a7;\n }\n\n function batchTransferQuadToL2(\n address to,\n uint256[] memory sizes,\n uint256[] memory xs,\n uint256[] memory ys,\n bytes memory data\n ) public whenNotPaused() {\n require(sizes.length == xs.length && xs.length == ys.length, \"l2: invalid data\");\n transferringToL2 = true;\n ILandToken(rootToken).batchTransferQuad(_msgSender(), address(this), sizes, xs, ys, data);\n transferringToL2 = false;\n for (uint256 index = 0; index < sizes.length; index++) {\n bytes memory message = abi.encode(to, sizes[index], xs[index], ys[index], data);\n _sendMessageToChild(message);\n emit Deposit(to, sizes[index], xs[index], ys[index], data);\n }\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n }\n\n /// @dev Pauses all token transfers across bridge\n function pause() external onlyOwner {\n _pause();\n }\n\n /// @dev Unpauses all token transfers across bridge\n function unpause() external onlyOwner {\n _unpause();\n }\n\n function _processMessageFromChild(bytes memory message) internal override {\n (address to, uint256[] memory size, uint256[] memory x, uint256[] memory y, bytes memory data) =\n abi.decode(message, (address, uint256[], uint256[], uint256[], bytes));\n for (uint256 index = 0; index < x.length; index++) {\n ILandToken(rootToken).transferQuad(address(this), to, size[index], x[index], y[index], data);\n emit Withdraw(to, size[index], x[index], y[index], data);\n }\n }\n\n function _msgSender() internal view override(Context, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n}\n" + }, + "src/solc_0.8/polygon/root/land/LandTunnelMigration.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {ILandToken} from \"../../../common/interfaces/ILandToken.sol\";\n\n/// @title Tunnel migration on L1\n/// @author The Sandbox\n/// @notice Contract handling the migration of LAND tokens from a tunnel to a new one\ncontract LandTunnelMigration {\n ILandToken public immutable landToken;\n address public immutable newLandTunnel;\n address public immutable oldLandTunnel;\n address private admin;\n\n event TunnelLandsMigrated(address indexed oldLandTunnel, address indexed newLandTunnel, uint256[] ids);\n event TunnelQuadsMigrated(\n address indexed oldLandTunnel,\n address indexed newLandTunnel,\n uint256[] sizes,\n uint256[] x,\n uint256[] y\n );\n event AdminChanged(address indexed _newAdmin);\n\n modifier isAdmin() {\n require(admin == msg.sender, \"LandTunnelMigration: !AUTHORISED\");\n _;\n }\n\n /// @notice Constructor of the tunnel migration contract\n /// @param _landToken LAND token address\n /// @param _newLandTunnel the tunnel address to migrate to\n /// @param _oldLandTunnel the tunnel address to migrate from\n /// @param _admin admin of the contract\n constructor(\n address _landToken,\n address _newLandTunnel,\n address _oldLandTunnel,\n address _admin\n ) {\n require(_admin != address(0), \"LandTunnelMigration: admin can't be zero address\");\n require(_landToken != address(0), \"LandTunnelMigration: landToken can't be zero address\");\n require(_newLandTunnel != address(0), \"LandTunnelMigration: new Tunnel can't be zero address\");\n require(_oldLandTunnel != address(0), \"LandTunnelMigration: old Tunnel can't be zero address\");\n\n admin = _admin;\n landToken = ILandToken(_landToken);\n newLandTunnel = _newLandTunnel;\n oldLandTunnel = _oldLandTunnel;\n\n emit AdminChanged(_admin);\n }\n\n /// @dev Transfers all the passed land ids from the old land tunnel to the new land tunnel\n /// @notice This method needs super operator role to execute\n /// @param ids of land tokens to be migrated\n function migrateLandsToTunnel(uint256[] memory ids) external isAdmin {\n landToken.batchTransferFrom(oldLandTunnel, newLandTunnel, ids, \"\");\n emit TunnelLandsMigrated(oldLandTunnel, newLandTunnel, ids);\n }\n\n /// @dev Transfers all the passed quads from the old land tunnel to the new land tunnel\n /// @notice This method needs super operator role to execute\n /// @param sizes of land quads to be migrated\n /// @param x coordinate of land quads to be migrated\n /// @param y coordinate of land quads to be migrated\n function migrateQuadsToTunnel(\n uint256[] memory sizes,\n uint256[] memory x,\n uint256[] memory y\n ) external isAdmin {\n landToken.batchTransferQuad(oldLandTunnel, newLandTunnel, sizes, x, y, \"\");\n emit TunnelQuadsMigrated(oldLandTunnel, newLandTunnel, sizes, x, y);\n }\n\n /// @notice changes admin to new admin\n /// @param _newAdmin the new admin to be set\n function changeAdmin(address _newAdmin) external isAdmin {\n require(_newAdmin != address(0), \"LandTunnelMigration: admin can't be zero address\");\n admin = _newAdmin;\n emit AdminChanged(_newAdmin);\n }\n}\n" + }, + "src/solc_0.8/polygon/root/land/LandTunnelV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {\n OwnableUpgradeable,\n ContextUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport {FxBaseRootTunnelUpgradeable} from \"../../../common/fx-portal/FxBaseRootTunnelUpgradeable.sol\";\nimport {ERC2771Handler} from \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\nimport {ILandTokenV2} from \"../../../common/interfaces/ILandTokenV2.sol\";\nimport {IERC721MandatoryTokenReceiver} from \"../../../common/interfaces/IERC721MandatoryTokenReceiver.sol\";\n\n/// @title LandTunnelV2\n/// @author The Sandbox\n/// @notice LAND tunnel on the root chain\ncontract LandTunnelV2 is\n FxBaseRootTunnelUpgradeable,\n IERC721MandatoryTokenReceiver,\n ERC2771Handler,\n OwnableUpgradeable,\n PausableUpgradeable\n{\n ILandTokenV2 public rootToken;\n bool internal transferringToL2;\n\n event Deposit(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\n event Withdraw(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\n\n /// @notice Initializes the contract\n /// @param _checkpointManager checkpoint manager address\n /// @param _fxRoot state sender contract\n /// @param _rootToken LAND token on the root chain\n /// @param _trustedForwarder trusted forwarder for meta-tx\n function initialize(\n address _checkpointManager,\n address _fxRoot,\n ILandTokenV2 _rootToken,\n address _trustedForwarder\n ) public initializer {\n rootToken = _rootToken;\n __Ownable_init();\n __Pausable_init();\n __FxBaseRootTunnelUpgradeable_initialize(_checkpointManager, _fxRoot);\n __ERC2771Handler_initialize(_trustedForwarder);\n }\n\n /// @dev called on ERC721 transfer to this contract\n /// @param operator address of the one sending the ERC721 Token\n /// @return onERC721Received function selector\n function onERC721Received(\n address operator,\n address, /* from */\n uint256, /* tokenId */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(transferringToL2 || rootToken.isSuperOperator(operator), \"LandTunnelV2: !BRIDGING\");\n return this.onERC721Received.selector;\n }\n\n /// @dev called on ERC721 batch transfer to this contract\n /// @param operator address of the one sending the ERC721 Token\n /// @return onERC721BatchReceived function selector\n function onERC721BatchReceived(\n address operator,\n address, /* from */\n uint256[] calldata, /* ids */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(transferringToL2 || rootToken.isSuperOperator(operator), \"LandTunnelV2: !BRIDGING\");\n return this.onERC721BatchReceived.selector;\n }\n\n /// @dev to be called by external contact to check if this contract supports ERC721 token and batch token receive\n /// @param interfaceId the interface to be checked if supported by the contract\n /// @return 0x5e8bf644 is the interface of IERC721MandatoryTokenReceiver and 0x01ffc9a7 for the Eip 165 supports interface's interface id\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n return interfaceId == 0x5e8bf644 || interfaceId == 0x01ffc9a7;\n }\n\n /// @notice Send a batch of quads to L2\n /// @param to address of the receiver on L2\n /// @param sizes sizes of quad\n /// @param xs x coordinates of quads\n /// @param ys y coordinates of quads\n /// @param data data send to the receiver onERC721BatchReceived on L1\n function batchTransferQuadToL2(\n address to,\n uint256[] memory sizes,\n uint256[] memory xs,\n uint256[] memory ys,\n bytes memory data\n ) external whenNotPaused() {\n require(to != address(0), \"LandTunnelV2: can't send to zero address\");\n require(sizes.length == xs.length, \"LandTunnelV2: sizes's and x's length are different\");\n require(xs.length == ys.length, \"LandTunnelV2: x's and y's length are different\");\n transferringToL2 = true;\n rootToken.batchTransferQuad(_msgSender(), address(this), sizes, xs, ys, data);\n transferringToL2 = false;\n for (uint256 index = 0; index < sizes.length; index++) {\n bytes memory message = abi.encode(to, sizes[index], xs[index], ys[index], data);\n _sendMessageToChild(message);\n emit Deposit(to, sizes[index], xs[index], ys[index], data);\n }\n }\n\n /// @notice sets the fx-child tunnel\n /// @dev only owner can call this funtion\n /// @param _fxChildTunnel address of the fx-child tunnel\n function setFxChildTunnel(address _fxChildTunnel) public override onlyOwner {\n super.setFxChildTunnel(_fxChildTunnel);\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n\n emit TrustedForwarderSet(trustedForwarder);\n }\n\n /// @dev Pauses all token transfers across bridge\n function pause() external onlyOwner {\n _pause();\n }\n\n /// @dev Unpauses all token transfers across bridge\n function unpause() external onlyOwner {\n _unpause();\n }\n\n function _processMessageFromChild(bytes memory message) internal override {\n (address to, uint256[] memory size, uint256[] memory x, uint256[] memory y, bytes memory data) =\n abi.decode(message, (address, uint256[], uint256[], uint256[], bytes));\n for (uint256 index = 0; index < x.length; index++) {\n rootToken.mintAndTransferQuad(to, size[index], x[index], y[index], data);\n emit Withdraw(to, size[index], x[index], y[index], data);\n }\n }\n\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n\n uint256[50] private __gap;\n}\n" + }, + "src/solc_0.8/polygon/root/land/MockLandTunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./LandTunnel.sol\";\n\ncontract MockLandTunnel is LandTunnel {\n constructor(\n address _checkpointManager,\n address _fxRoot,\n address _rootToken,\n address _trustedForwarder\n ) LandTunnel(_checkpointManager, _fxRoot, _rootToken, _trustedForwarder) {\n checkpointManager = ICheckpointManager(_checkpointManager);\n fxRoot = IFxStateSender(_fxRoot);\n }\n\n function receiveMessage(bytes memory message) public virtual override {\n _processMessageFromChild(message);\n }\n}\n" + }, + "src/solc_0.8/polygon/root/land/MockLandTunnelV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./LandTunnelV2.sol\";\n\ncontract MockLandTunnelV2 is LandTunnelV2 {\n function receiveMessage(bytes memory inputData) public override {\n _processMessageFromChild(inputData);\n }\n}\n" + }, + "src/solc_0.8/polygon/root/SandPolygonDepositor.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\nimport \"../../common/interfaces/IERC20Extended.sol\";\nimport \"./IRootChainManager.sol\";\n\ncontract SandPolygonDepositor {\n IERC20Extended internal immutable _sand;\n address internal immutable _predicate;\n IRootChainManager internal immutable _rootChainManager;\n\n constructor(\n IERC20Extended sand,\n address predicate,\n IRootChainManager rootChainManager\n ) {\n _sand = sand;\n _predicate = predicate;\n _rootChainManager = rootChainManager;\n }\n\n function depositToPolygon(address beneficiary, uint256 amount) public {\n _sand.transferFrom(beneficiary, address(this), amount);\n _sand.approve(_predicate, amount);\n _rootChainManager.depositFor(beneficiary, address(_sand), abi.encode(amount));\n }\n}\n" + }, + "src/solc_0.8/raffle/CareBears.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./GenericRaffle.sol\";\n\n/* solhint-disable max-states-count */\ncontract CareBears is GenericRaffle {\n uint256 public constant MAX_SUPPLY = 3_060;\n\n function initialize(\n string memory baseURI,\n string memory _name,\n string memory _symbol,\n address payable _sandOwner,\n address _signAddress,\n address _trustedForwarder\n ) public initializer {\n __GenericRaffle_init(baseURI, _name, _symbol, _sandOwner, _signAddress, _trustedForwarder, MAX_SUPPLY);\n }\n}\n" + }, + "src/solc_0.8/raffle/GenericRaffle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {ERC2771HandlerUpgradeable} from \"../common/BaseWithStorage/ERC2771/ERC2771HandlerUpgradeable.sol\";\n\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts-0.8/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts-0.8/security/ReentrancyGuard.sol\";\n\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\";\n\n/* solhint-disable max-states-count */\ncontract GenericRaffle is\n ERC721EnumerableUpgradeable,\n OwnableUpgradeable,\n ReentrancyGuardUpgradeable,\n ERC2771HandlerUpgradeable\n{\n using Address for address;\n uint256 public maxSupply;\n\n event TogglePaused(bool _pause);\n event Personalized(uint256 _tokenId, uint256 _personalizationMask);\n event ContractInitialized(\n string baseURI,\n string _name,\n string _symbol,\n address _sandOwner,\n address _signAddress,\n uint256 _maxSupply\n );\n event WaveSetup(\n uint256 _waveType,\n uint256 _waveMaxTokens,\n uint256 _waveMaxTokensToBuy,\n uint256 _waveSingleTokenPrice\n );\n event AllowedExecuteMintSet(address _address);\n event SandOwnerSet(address _owner);\n event BaseURISet(string baseURI);\n event SignAddressSet(address _signAddress);\n\n uint256 public waveType = 0;\n uint256 public waveMaxTokens;\n uint256 public waveMaxTokensToBuy;\n uint256 public waveSingleTokenPrice;\n uint256 public waveTotalMinted;\n\n uint256 public erc1155Id;\n address public contractAddress;\n\n mapping(address => mapping(uint256 => uint256)) public waveOwnerToClaimedCounts;\n mapping(uint256 => uint256) public personalizationTraits; // stores the personalization for a tokenId\n uint256 public indexWave;\n uint256 public paused;\n\n mapping(uint256 => uint256) private signatureIds;\n mapping(uint256 => uint256) private availableIds;\n\n address public allowedToExecuteMint;\n address public sandOwner;\n address public signAddress;\n string public baseTokenURI;\n\n function __GenericRaffle_init(\n string memory baseURI,\n string memory _name,\n string memory _symbol,\n address payable _sandOwner,\n address _signAddress,\n address _trustedForwarder,\n uint256 _maxSupply\n ) internal onlyInitializing {\n __ERC721_init(_name, _symbol);\n __ERC2771Handler_initialize(_trustedForwarder);\n __Ownable_init_unchained();\n __ReentrancyGuard_init();\n setBaseURI(baseURI);\n require(bytes(baseURI).length != 0, \"baseURI is not set\");\n require(bytes(_name).length != 0, \"_name is not set\");\n require(bytes(_symbol).length != 0, \"_symbol is not set\");\n require(_signAddress != address(0x0), \"Sign address is zero address\");\n require(_trustedForwarder != address(0x0), \"Trusted forwarder is zero address\");\n require(_sandOwner != address(0x0), \"Sand owner is zero address\");\n require(_maxSupply > 0, \"Max supply should be more than 0\");\n sandOwner = _sandOwner;\n signAddress = _signAddress;\n maxSupply = _maxSupply;\n\n emit ContractInitialized(baseURI, _name, _symbol, _sandOwner, _signAddress, _maxSupply);\n }\n\n function setupWave(\n uint256 _waveType,\n uint256 _waveMaxTokens,\n uint256 _waveMaxTokensToBuy,\n uint256 _waveSingleTokenPrice,\n address _contractAddress,\n uint256 _erc1155Id\n ) external onlyOwner {\n require(_waveMaxTokens <= maxSupply, \"_waveMaxTokens should not exceed maxSupply\");\n require(_waveType < 3 && _waveMaxTokens > 0 && _waveMaxTokensToBuy > 0, \"Invalid configuration\");\n if (_waveType != 0) {\n require(_contractAddress != address(0x0), \"Invalid contract address\");\n require(_contractAddress.isContract(), \"Contract address must be that of a contract\");\n }\n require(_waveMaxTokensToBuy <= _waveMaxTokens, \"Invalid supply configuration\");\n\n waveType = _waveType;\n waveMaxTokens = _waveMaxTokens;\n waveMaxTokensToBuy = _waveMaxTokensToBuy;\n waveSingleTokenPrice = _waveSingleTokenPrice;\n waveTotalMinted = 0;\n contractAddress = _waveType == 0 ? address(0x0) : _contractAddress;\n erc1155Id = _waveType == 2 ? _erc1155Id : 0;\n indexWave++;\n\n emit WaveSetup(_waveType, _waveMaxTokens, _waveMaxTokensToBuy, _waveSingleTokenPrice);\n }\n\n function price(uint256 _count) public view virtual returns (uint256) {\n return waveSingleTokenPrice * _count;\n }\n\n function chain() public view returns (uint256) {\n return block.chainid;\n }\n\n function checkWaveNotComplete(uint256 _amount) internal view returns (bool) {\n return _amount > 0 && waveTotalMinted + _amount <= waveMaxTokens;\n }\n\n function checkLimitNotReached(address _wallet, uint256 _amount) internal view returns (bool) {\n return\n waveOwnerToClaimedCounts[_wallet][indexWave - 1] + _amount <= waveMaxTokensToBuy &&\n totalSupply() + _amount <= maxSupply;\n }\n\n function checkMintAllowed(address _wallet, uint256 _amount) public view returns (bool) {\n return checkWaveNotComplete(_amount) && checkLimitNotReached(_wallet, _amount);\n }\n\n function mint(\n address _wallet,\n uint256 _amount,\n uint256 _signatureId,\n bytes memory _signature\n ) external nonReentrant {\n require(indexWave > 0, \"Contract is not configured\");\n require(_msgSender() == allowedToExecuteMint, \"Not allowed\");\n require(paused == 0, \"Contract is paused\");\n require(_wallet != address(0x0), \"Wallet is zero address\");\n require(_amount > 0, \"Amount cannot be 0\");\n require(signatureIds[_signatureId] == 0, \"signatureId already used\");\n require(\n checkSignature(_wallet, _signatureId, address(this), block.chainid, _signature) == signAddress,\n \"Signature failed\"\n );\n\n signatureIds[_signatureId] = 1;\n\n require(checkWaveNotComplete(_amount), \"Wave completed\");\n require(checkLimitNotReached(_wallet, _amount), \"Max allowed\");\n\n if (waveType == 1) {\n require(IERC721(contractAddress).balanceOf(_wallet) > 0, \"No NFT\");\n } else if (waveType == 2) {\n require(IERC1155(contractAddress).balanceOf(_wallet, erc1155Id) > 0, \"No NFT\");\n }\n\n uint256 _price = price(_amount);\n if (_price > 0) {\n SafeERC20.safeTransferFrom(IERC20(_msgSender()), _wallet, sandOwner, _price);\n }\n\n waveOwnerToClaimedCounts[_wallet][indexWave - 1] += _amount;\n\n waveTotalMinted += _amount;\n\n for (uint256 i = 0; i < _amount; i++) {\n uint256 tokenId = getRandomToken(_wallet, totalSupply());\n _safeMint(_wallet, tokenId);\n }\n }\n\n function checkSignature(\n address _wallet,\n uint256 _signatureId,\n address _contractAddress,\n uint256 _chainId,\n bytes memory _signature\n ) public pure returns (address) {\n return\n ECDSA.recover(\n keccak256(\n abi.encodePacked(\n \"\\x19Ethereum Signed Message:\\n32\",\n keccak256(abi.encode(_wallet, _signatureId, _contractAddress, _chainId))\n )\n ),\n _signature\n );\n }\n\n function checkPersonalizationSignature(\n address _wallet,\n uint256 _signatureId,\n address _contractAddress,\n uint256 _chainId,\n uint256 _tokenId,\n uint256 _personalizationMask,\n bytes memory _signature\n ) public pure returns (address) {\n return\n ECDSA.recover(\n keccak256(\n abi.encodePacked(\n \"\\x19Ethereum Signed Message:\\n32\",\n keccak256(\n abi.encode(\n _wallet,\n _signatureId,\n _contractAddress,\n _chainId,\n _tokenId,\n _personalizationMask\n )\n )\n )\n ),\n _signature\n );\n }\n\n // Thx Cyberkongs VX <3\n function getRandomToken(address _wallet, uint256 _totalMinted) private returns (uint256) {\n uint256 remaining = maxSupply - _totalMinted;\n uint256 rand =\n uint256(keccak256(abi.encodePacked(_wallet, block.difficulty, block.timestamp, remaining))) % remaining;\n uint256 value = rand;\n\n if (availableIds[rand] != 0) {\n value = availableIds[rand];\n }\n\n if (availableIds[remaining - 1] == 0) {\n availableIds[rand] = remaining - 1;\n } else {\n availableIds[rand] = availableIds[remaining - 1];\n }\n\n return value;\n }\n\n function personalizationOf(uint256 _tokenId) external view returns (uint256) {\n return personalizationTraits[_tokenId];\n }\n\n function toggleSale() external onlyOwner {\n paused = paused == 0 ? 1 : 0;\n emit TogglePaused(paused == 1);\n }\n\n function personalize(\n uint256 _signatureId,\n bytes memory _signature,\n uint256 _tokenId,\n uint256 _personalizationMask\n ) external {\n require(ownerOf(_tokenId) == _msgSender(), \"You must be the owner of the token in order to personalize it\");\n\n require(signatureIds[_signatureId] == 0, \"SignatureId already used\");\n require(\n checkPersonalizationSignature(\n _msgSender(),\n _signatureId,\n address(this),\n block.chainid,\n _tokenId,\n _personalizationMask,\n _signature\n ) == signAddress,\n \"Signature failed\"\n );\n\n signatureIds[_signatureId] = 1;\n\n personalizationTraits[_tokenId] = _personalizationMask;\n emit Personalized(_tokenId, _personalizationMask);\n }\n\n function setAllowedExecuteMint(address _address) external onlyOwner {\n require(_address != address(0x0), \"Address is zero address\");\n allowedToExecuteMint = _address;\n emit AllowedExecuteMintSet(_address);\n }\n\n function setSandOwnerAddress(address _owner) external onlyOwner {\n require(_owner != address(0x0), \"Owner is zero address\");\n sandOwner = _owner;\n emit SandOwnerSet(_owner);\n }\n\n function _baseURI() internal view virtual override returns (string memory) {\n return baseTokenURI;\n }\n\n function setBaseURI(string memory baseURI) public onlyOwner {\n require(bytes(baseURI).length != 0, \"baseURI is not set\");\n baseTokenURI = baseURI;\n emit BaseURISet(baseURI);\n }\n\n function setSignAddress(address _signAddress) external onlyOwner {\n require(_signAddress != address(0x0), \"Sign address is zero address\");\n signAddress = _signAddress;\n emit SignAddressSet(_signAddress);\n }\n\n function _msgSender()\n internal\n view\n override(ContextUpgradeable, ERC2771HandlerUpgradeable)\n returns (address sender)\n {\n return ERC2771HandlerUpgradeable._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771HandlerUpgradeable) returns (bytes calldata) {\n return ERC2771HandlerUpgradeable._msgData();\n }\n\n function renounceOwnership() public virtual override onlyOwner {\n revert(\"Renounce ownership is not available\");\n }\n\n // Empty storage space in contracts for future enhancements\n // ref: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/issues/13)\n uint256[50] private __gap;\n}\n" + }, + "src/solc_0.8/raffle/PeopleOfCryptoGeneric.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./GenericRaffle.sol\";\n\n/* solhint-disable max-states-count */\ncontract PeopleOfCryptoGeneric is GenericRaffle {\n uint256 public constant MAX_SUPPLY = 8_430;\n\n function initialize(\n string memory baseURI,\n string memory _name,\n string memory _symbol,\n address payable _sandOwner,\n address _signAddress,\n address _trustedForwarder\n ) public initializer {\n __GenericRaffle_init(baseURI, _name, _symbol, _sandOwner, _signAddress, _trustedForwarder, MAX_SUPPLY);\n }\n}\n" + }, + "src/solc_0.8/raffle/PlayboyPartyPeople.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.2;\n\nimport \"./GenericRaffle.sol\";\n\n/* solhint-disable max-states-count */\ncontract PlayboyPartyPeople is GenericRaffle {\n uint256 public constant MAX_SUPPLY = 1_969;\n\n function initialize(\n string memory baseURI,\n string memory _name,\n string memory _symbol,\n address payable _sandOwner,\n address _signAddress,\n address _trustedForwarder\n ) public initializer {\n __GenericRaffle_init(baseURI, _name, _symbol, _sandOwner, _signAddress, _trustedForwarder, MAX_SUPPLY);\n }\n}\n" + }, + "src/solc_0.8/raffle/SteveAoki.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./GenericRaffle.sol\";\n\n/* solhint-disable max-states-count */\ncontract SteveAoki is GenericRaffle {\n uint256 public constant MAX_SUPPLY = 3_333;\n\n function initialize(\n string memory baseURI,\n string memory _name,\n string memory _symbol,\n address payable _sandOwner,\n address _signAddress,\n address _trustedForwarder\n ) public initializer {\n __GenericRaffle_init(baseURI, _name, _symbol, _sandOwner, _signAddress, _trustedForwarder, MAX_SUPPLY);\n }\n}\n" + }, + "src/solc_0.8/Sand/SandBaseToken.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"../common/BaseWithStorage/ERC20/extensions/ERC20BasicApproveExtension.sol\";\nimport \"../common/BaseWithStorage/ERC20/ERC20BaseToken.sol\";\n\ncontract SandBaseToken is ERC20BaseToken, ERC20BasicApproveExtension {\n constructor(\n address sandAdmin,\n address executionAdmin,\n address beneficiary,\n uint256 amount\n ) ERC20BaseToken(\"SAND\", \"SAND\", sandAdmin, executionAdmin) {\n _admin = sandAdmin;\n if (beneficiary != address(0)) {\n uint256 initialSupply = amount * (1 ether);\n _mint(beneficiary, initialSupply);\n }\n }\n}\n" + }, + "src/solc_0.8/StarterPack/PurchaseValidator.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {AccessControl, Context} from \"@openzeppelin/contracts-0.8/access/AccessControl.sol\";\nimport {EIP712, ECDSA} from \"@openzeppelin/contracts-0.8/utils/cryptography/draft-EIP712.sol\";\n\n/// @title Purchase Validator contract that validates the purchase of catalysts and gems bundles with EIP712\n/// @notice This contract manages the validation of purchases\n/// @notice The following privileged roles are used in PurchaseValidator: DEFAULT_ADMIN_ROLE\n/// @dev It is intended that this contract is inherited by StarterPack\ncontract PurchaseValidator is AccessControl, EIP712 {\n address private _signingWallet;\n\n // A parallel-queue mapping to nonces: user => (queueID => nonce)\n mapping(address => mapping(uint128 => uint128)) public queuedNonces;\n\n bytes32 public constant PURCHASE_TYPEHASH =\n keccak256(\n \"Purchase(address buyer,uint16[] catalystIds,uint256[] catalystQuantities,uint16[] gemIds,uint256[] gemQuantities,uint256 nonce)\"\n );\n\n event SigningWallet(address indexed newSigningWallet);\n\n constructor(\n address initialSigningWallet,\n string memory name,\n string memory version\n ) EIP712(name, version) {\n require(initialSigningWallet != address(0), \"WALLET_ZERO_ADDRESS\");\n _signingWallet = initialSigningWallet;\n }\n\n /// @notice Update the signing wallet address\n /// @param newSigningWallet The new address of the signing wallet\n function setSigningWallet(address newSigningWallet) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(newSigningWallet != address(0), \"WALLET_ZERO_ADDRESS\");\n require(newSigningWallet != _signingWallet, \"WALLET_ALREADY_SET\");\n _signingWallet = newSigningWallet;\n emit SigningWallet(newSigningWallet);\n }\n\n /// @notice Function to get the nonce for a given address and queue ID\n /// @param _buyer The address of the starterPack purchaser\n /// @param _queueId The ID of the nonce queue for the given address.\n /// The default is queueID=0, and the max is queueID=2**128-1\n /// @return uint128 representing the requested nonce\n function getNonceByBuyer(address _buyer, uint128 _queueId) external view returns (uint128) {\n return queuedNonces[_buyer][_queueId];\n }\n\n /// @notice Function to get the domain separator\n function domainSeparator() external view returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /// @notice Function to get the chainId\n function getChainId() external view returns (uint256) {\n return block.chainid;\n }\n\n /// @notice Get the wallet authorized for signing purchase-messages.\n /// @return _signingWallet the address of the signing wallet\n function getSigningWallet() external view returns (address) {\n return _signingWallet;\n }\n\n /// @notice Check if a purchase message is valid by verifying a EIP712 signature for the purchase message\n /// @dev It is intended that this contract is inherited so this internal function can be used\n /// @param buyer The address paying for the purchase & receiving tokens\n /// @param catalystIds The catalyst IDs to be purchased\n /// @param catalystQuantities The quantities of the catalysts to be purchased\n /// @param gemIds The gem IDs to be purchased\n /// @param gemQuantities The quantities of the gems to be purchased\n /// @param nonce The current nonce for the user. This is represented as a\n /// uint256 value, but is actually 2 packed uint128's (queueId + nonce)\n /// @param signature A signed message specifying tx details\n /// @return true if the purchase is valid\n function _isPurchaseValid(\n address buyer,\n uint16[] memory catalystIds,\n uint256[] memory catalystQuantities,\n uint16[] memory gemIds,\n uint256[] memory gemQuantities,\n uint256 nonce,\n bytes memory signature\n ) internal returns (bool) {\n require(_checkAndUpdateNonce(buyer, nonce), \"INVALID_NONCE\");\n bytes32 digest =\n _hashTypedDataV4(\n keccak256(\n abi.encode(\n PURCHASE_TYPEHASH,\n buyer,\n keccak256(abi.encodePacked(catalystIds)),\n keccak256(abi.encodePacked(catalystQuantities)),\n keccak256(abi.encodePacked(gemIds)),\n keccak256(abi.encodePacked(gemQuantities)),\n nonce\n )\n )\n );\n address recoveredSigner = ECDSA.recover(digest, signature);\n return recoveredSigner == _signingWallet;\n }\n\n /// @dev Function for validating the nonce for a user.\n /// @param _buyer The address for which we want to check the nonce\n /// @param _packedValue The queueId + nonce, packed together.\n /// @return bool Whether the nonce is valid.\n /// EG: for queueId=42 nonce=7, pass: \"0x0000000000000000000000000000002A00000000000000000000000000000007\"\n function _checkAndUpdateNonce(address _buyer, uint256 _packedValue) private returns (bool) {\n uint128 queueId = uint128(_packedValue / 2**128);\n uint128 nonce = uint128(_packedValue % 2**128);\n uint128 currentNonce = queuedNonces[_buyer][queueId];\n if (nonce == currentNonce) {\n queuedNonces[_buyer][queueId] = currentNonce + 1;\n return true;\n }\n return false;\n }\n}\n" + }, + "src/solc_0.8/StarterPack/StarterPackV2.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {PurchaseValidator, Context, AccessControl} from \"./PurchaseValidator.sol\";\nimport {GemsCatalystsRegistry, ICatalyst, IGem, IERC20} from \"../catalyst/GemsCatalystsRegistry.sol\";\nimport {ERC2771HandlerV2} from \"../common/BaseWithStorage/ERC2771/ERC2771HandlerV2.sol\";\n\n/// @title StarterPack contract for the purchase of StarterPacks (bundles of Catalysts and Gems) with EIP712\n/// @notice This contract enables purchases with SAND when the backend authorizes it via message signing\n/// @notice The following privileged roles are used in StarterPackV2: DEFAULT_ADMIN_ROLE, STARTERPACK_ROLE\n/// @dev DEFAULT_ADMIN_ROLE is intended for contract setup / emergency, STARTERPACK_ROLE is provided for business purposes\ncontract StarterPackV2 is AccessControl, PurchaseValidator, ERC2771HandlerV2 {\n uint256 internal constant MAX_UINT16 = type(uint16).max;\n uint256 private constant DECIMAL_PLACES = 1 ether;\n uint256 private constant MAX_WITHDRAWAL = 100;\n // The delay between calling setPrices() and when the new prices come into effect\n // Minimizes the effect of price changes on pending TXs\n uint256 private constant PRICE_CHANGE_DELAY = 1 hours;\n\n // The timestamp of the last price change\n uint256 private _priceChangeTimestamp;\n\n // The following role is provided for business-related admin functions\n bytes32 public constant STARTERPACK_ROLE = keccak256(\"STARTERPACK_ROLE\");\n\n address internal immutable _sand;\n address internal immutable _registry;\n address payable internal _wallet;\n bool public _sandEnabled;\n\n // Mapping catalyst and gem ids to their prices\n mapping(uint16 => uint256) private _catalystPrices;\n mapping(uint16 => uint256) private _catalystPreviousPrices;\n mapping(uint16 => uint256) private _gemPrices;\n mapping(uint16 => uint256) private _gemPreviousPrices;\n\n event ReceivingWallet(address indexed newReceivingWallet);\n event Purchase(address indexed buyer, Message message, uint256 amountPaid, address indexed token);\n event WithdrawAll(address indexed to, uint16[] catalystIds, uint16[] gemIds);\n event SandEnabled(bool enabled);\n event SetPrices(\n uint16[] catalystIds,\n uint256[] catalystPrices,\n uint16[] gemIds,\n uint256[] gemPrices,\n uint256 priceChangeTimestamp\n );\n\n struct Message {\n address buyer;\n uint16[] catalystIds;\n uint256[] catalystQuantities;\n uint16[] gemIds;\n uint256[] gemQuantities;\n uint256 nonce;\n }\n\n constructor(\n address defaultAdmin,\n address starterPackAdmin,\n address sandContractAddress,\n address trustedForwarder,\n address payable initialWalletAddress,\n address initialSigningWallet,\n address registry\n ) PurchaseValidator(initialSigningWallet, \"Sandbox StarterPack\", \"1.0\") ERC2771HandlerV2(trustedForwarder) {\n require(defaultAdmin != address(0), \"ADMIN_ZERO_ADDRESS\");\n require(starterPackAdmin != address(0), \"STARTERPACK_ADMIN_ZERO_ADDRESS\");\n require(sandContractAddress != address(0), \"SAND_ZERO_ADDRESS\");\n require(trustedForwarder != address(0), \"FORWARDER_ZERO_ADDRESS\");\n require(initialWalletAddress != address(0), \"WALLET_ZERO_ADDRESS\");\n require(registry != address(0), \"REGISTRY_ZERO_ADDRESS\");\n _grantRole(DEFAULT_ADMIN_ROLE, defaultAdmin);\n _grantRole(STARTERPACK_ROLE, starterPackAdmin);\n _sand = sandContractAddress;\n _wallet = initialWalletAddress;\n _registry = registry;\n }\n\n /// @notice Set the wallet receiving the proceeds\n /// @param newReceivingWallet Address of the new receiving wallet\n function setReceivingWallet(address payable newReceivingWallet) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(newReceivingWallet != address(0), \"WALLET_ZERO_ADDRESS\");\n require(newReceivingWallet != _wallet, \"WALLET_ALREADY_SET\");\n _wallet = newReceivingWallet;\n emit ReceivingWallet(newReceivingWallet);\n }\n\n /// @dev Enable / disable the specific SAND payment for StarterPacks\n /// @param enabled Whether to enable or disable\n function setSANDEnabled(bool enabled) external onlyRole(STARTERPACK_ROLE) {\n _sandEnabled = enabled;\n emit SandEnabled(enabled);\n }\n\n /// @notice Enables admin to change the prices (in SAND) of the catalysts and gems in the StarterPack bundle\n /// @param catalystIds Array of catalyst IDs for which new prices will take effect after a delay period\n /// @param catalystPrices Array of new catalyst prices that will take effect after a delay period\n /// @param gemIds Array of gem IDs for which new prices will take effect after a delay period\n /// @param gemPrices Array of new gems prices that will take effect after a delay period\n function setPrices(\n uint16[] calldata catalystIds,\n uint256[] calldata catalystPrices,\n uint16[] calldata gemIds,\n uint256[] calldata gemPrices\n ) external onlyRole(STARTERPACK_ROLE) {\n require(block.timestamp > _priceChangeTimestamp + PRICE_CHANGE_DELAY, \"DELAY_PERIOD_IN_EFFECT\");\n require(catalystIds.length == catalystPrices.length, \"INVALID_CAT_INPUT\");\n require(gemIds.length == gemPrices.length, \"INVALID_GEM_INPUT\");\n require(catalystPrices.length <= MAX_UINT16, \"TOO_MANY_CATALYST_PRICES\");\n require(gemPrices.length <= MAX_UINT16, \"TOO_MANY_GEM_PRICES\");\n for (uint256 i = 0; i < catalystIds.length; i++) {\n uint16 id = catalystIds[i];\n require(_isValidCatalyst(id), \"INVALID_CAT_ID\");\n _catalystPreviousPrices[id] = _catalystPrices[id];\n _catalystPrices[id] = catalystPrices[i];\n }\n for (uint256 i = 0; i < gemIds.length; i++) {\n uint16 id = gemIds[i];\n require(_isValidGem(id), \"INVALID_GEM_ID\");\n _gemPreviousPrices[id] = _gemPrices[id];\n _gemPrices[id] = gemPrices[i];\n }\n _priceChangeTimestamp = block.timestamp;\n emit SetPrices(catalystIds, catalystPrices, gemIds, gemPrices, _priceChangeTimestamp);\n }\n\n /// @notice Enables admin to withdraw any remaining tokens\n /// @param to The destination address for the purchased Catalysts and Gems\n /// @param catalystIds The IDs of the catalysts to be transferred\n /// @param gemIds The IDs of the gems to be transferred\n /// @dev The sum length of catalystIds + gemIds must be <= MAX_WITHDRAWAL\n function withdrawAll(\n address to,\n uint16[] calldata catalystIds,\n uint16[] calldata gemIds\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(catalystIds.length + gemIds.length <= MAX_WITHDRAWAL, \"TOO_MANY_IDS\");\n require(to != address(0), \"ZERO_ADDRESS\");\n for (uint256 i = 0; i < catalystIds.length; i++) {\n uint16 id = catalystIds[i];\n require(_isValidCatalyst(id), \"INVALID_CATALYST_ID\");\n ICatalyst catalyst = _getCatalyst(id);\n uint256 balance = catalyst.balanceOf(address(this));\n _executeRegistryTransferCatalyst(catalyst, address(this), to, balance);\n }\n for (uint256 i = 0; i < gemIds.length; i++) {\n uint16 id = gemIds[i];\n require(_isValidGem(id), \"INVALID_GEM_ID\");\n IGem gem = _getGem(id);\n uint256 balance = gem.balanceOf(address(this));\n _executeRegistryTransferGem(gem, address(this), to, balance);\n }\n emit WithdrawAll(to, catalystIds, gemIds);\n }\n\n /// @notice Purchase StarterPacks with SAND\n /// @dev The buyer param is duplicated outside the message so the function is compatible with Sand approveAndCall\n /// @dev The buyer param is included inside the message so it is clear it is part of the message to be signed\n /// @dev If Sand amount is not approved then Sand amount will fail in Sand transferFrom\n /// @param buyer The recipient of the Catalysts and Gems to be purchased\n /// @param message A message containing information about the Catalysts and Gems to be purchased together with the destination (buyer) and a nonce\n /// @param signature A signed message specifying tx details\n function purchaseWithSAND(\n address buyer,\n Message calldata message,\n bytes calldata signature\n ) external {\n require(buyer == message.buyer, \"INVALID_BUYER\");\n require(_sandEnabled, \"SAND_IS_NOT_ENABLED\");\n require(\n _isPurchaseValid(\n message.buyer,\n message.catalystIds,\n message.catalystQuantities,\n message.gemIds,\n message.gemQuantities,\n message.nonce,\n signature\n ),\n \"INVALID_PURCHASE\"\n );\n uint256 amountInSAND =\n _calculateTotalPriceInSAND(\n message.catalystIds,\n message.catalystQuantities,\n message.gemIds,\n message.gemQuantities\n );\n _transferSANDPayment(message.buyer, _wallet, amountInSAND);\n _transferCatalysts(message.catalystIds, message.catalystQuantities, message.buyer);\n _transferGems(message.gemIds, message.gemQuantities, message.buyer);\n emit Purchase(message.buyer, message, amountInSAND, _sand);\n }\n\n /// @notice Get current StarterPack prices for catalysts and gems by id\n /// @param catalystIds The IDs of the catalysts you want to obtain price information for\n /// @param gemIds The IDs of the gems you want to obtain price information for\n /// @return catalystPricesBeforeSwitch Catalyst prices before price change\n /// @return catalystPricesAfterSwitch Catalyst prices after price change\n /// @return gemPricesBeforeSwitch Gem prices before price change\n /// @return gemPricesAfterSwitch Gem prices after price change\n /// @return switchTime The time the latest price change will take effect, being the time of the price change plus the price change delay\n function getPrices(uint16[] calldata catalystIds, uint16[] calldata gemIds)\n external\n view\n returns (\n uint256[] memory,\n uint256[] memory,\n uint256[] memory,\n uint256[] memory,\n uint256\n )\n {\n uint256 switchTime = 0;\n // check whether any prices have been set; return switchTime = 0 if prices were never set\n if (_priceChangeTimestamp != 0) {\n switchTime = _priceChangeTimestamp + PRICE_CHANGE_DELAY;\n }\n uint256[] memory catalystPricesBeforeSwitch = new uint256[](catalystIds.length);\n uint256[] memory catalystPricesAfterSwitch = new uint256[](catalystIds.length);\n uint256[] memory gemPricesBeforeSwitch = new uint256[](gemIds.length);\n uint256[] memory gemPricesAfterSwitch = new uint256[](gemIds.length);\n for (uint256 i = 0; i < catalystIds.length; i++) {\n uint16 id = catalystIds[i];\n catalystPricesBeforeSwitch[i] = _catalystPreviousPrices[id];\n catalystPricesAfterSwitch[i] = _catalystPrices[id];\n }\n for (uint256 i = 0; i < gemIds.length; i++) {\n uint16 id = gemIds[i];\n gemPricesBeforeSwitch[i] = _gemPreviousPrices[id];\n gemPricesAfterSwitch[i] = _gemPrices[id];\n }\n return (\n catalystPricesBeforeSwitch,\n catalystPricesAfterSwitch,\n gemPricesBeforeSwitch,\n gemPricesAfterSwitch,\n switchTime\n );\n }\n\n /// @notice Return whether SAND payments are enabled\n /// @return Whether SAND payments are enabled\n function isSANDEnabled() external view returns (bool) {\n return _sandEnabled;\n }\n\n /// @notice Get the beneficiary wallet.\n /// @return the address of the receiving wallet\n function getReceivingWallet() external view returns (address) {\n return _wallet;\n }\n\n /// @notice Verify the total expected price to pay in SAND\n /// @param catalystIds An array of catalyst IDs to be purchased\n /// @param catalystQuantities An array of catalyst amounts to be purchased\n /// @param gemIds An array of gem IDs to be purchased\n /// @param gemQuantities An array of gem amounts to be purchased\n /// @return the total price to pay in SAND for the cats and gems in the bundle\n function calculateTotalPriceInSAND(\n uint16[] memory catalystIds,\n uint256[] memory catalystQuantities,\n uint16[] memory gemIds,\n uint256[] memory gemQuantities\n ) external view returns (uint256) {\n return _calculateTotalPriceInSAND(catalystIds, catalystQuantities, gemIds, gemQuantities);\n }\n\n function _transferCatalysts(\n uint16[] memory catalystIds,\n uint256[] memory catalystQuantities,\n address buyer\n ) internal {\n for (uint256 i = 0; i < catalystIds.length; i++) {\n uint16 id = catalystIds[i];\n require(_isValidCatalyst(id), \"INVALID_CATALYST_ID\");\n _executeRegistryTransferCatalyst(_getCatalyst(id), address(this), buyer, catalystQuantities[i]);\n }\n }\n\n function _transferGems(\n uint16[] memory gemIds,\n uint256[] memory gemQuantities,\n address buyer\n ) internal {\n for (uint256 i = 0; i < gemIds.length; i++) {\n uint16 id = gemIds[i];\n require(_isValidGem(id), \"INVALID_GEM_ID\");\n _executeRegistryTransferGem(_getGem(id), address(this), buyer, gemQuantities[i]);\n }\n }\n\n function _executeRegistryTransferCatalyst(\n ICatalyst catalyst,\n address from,\n address to,\n uint256 quantity\n ) private {\n require(catalyst.transferFrom(from, to, quantity), \"CATALYST_TRANSFER_FAILED\");\n }\n\n function _executeRegistryTransferGem(\n IGem gem,\n address from,\n address to,\n uint256 quantity\n ) private {\n require(gem.transferFrom(from, to, quantity), \"GEM_TRANSFER_FAILED\");\n }\n\n function _getCatalyst(uint16 catalystId) internal view returns (ICatalyst) {\n return GemsCatalystsRegistry(_registry).getCatalyst(catalystId);\n }\n\n function _isValidCatalyst(uint16 catalystId) internal view returns (bool) {\n return GemsCatalystsRegistry(_registry).doesCatalystExist(catalystId) && catalystId > 0;\n }\n\n function _getGem(uint16 gemId) internal view returns (IGem) {\n return GemsCatalystsRegistry(_registry).getGem(gemId);\n }\n\n function _isValidGem(uint16 gemId) internal view returns (bool) {\n return GemsCatalystsRegistry(_registry).doesGemExist(gemId) && gemId > 0;\n }\n\n /// @dev Function to calculate the total price in SAND of the StarterPacks to be purchased\n function _calculateTotalPriceInSAND(\n uint16[] memory catalystIds,\n uint256[] memory catalystQuantities,\n uint16[] memory gemIds,\n uint256[] memory gemQuantities\n ) internal view returns (uint256) {\n require(catalystIds.length == catalystQuantities.length, \"INVALID_CAT_INPUT\");\n require(gemIds.length == gemQuantities.length, \"INVALID_GEM_INPUT\");\n uint256 totalPrice;\n bool useCurrentPrices = _priceSelector();\n for (uint256 i = 0; i < catalystIds.length; i++) {\n uint16 id = catalystIds[i];\n uint256 quantity = catalystQuantities[i];\n totalPrice =\n totalPrice +\n (useCurrentPrices ? _catalystPrices[id] * (quantity) : _catalystPreviousPrices[id] * (quantity));\n }\n for (uint256 i = 0; i < gemIds.length; i++) {\n uint16 id = gemIds[i];\n uint256 quantity = gemQuantities[i];\n totalPrice =\n totalPrice +\n (useCurrentPrices ? _gemPrices[id] * (quantity) : _gemPreviousPrices[id] * (quantity));\n }\n return totalPrice;\n }\n\n /// @dev Function to determine whether to purchase with previous or current prices\n function _priceSelector() internal view returns (bool) {\n return block.timestamp >= _priceChangeTimestamp + PRICE_CHANGE_DELAY;\n }\n\n /// @dev Function to handle purchase with SAND\n function _transferSANDPayment(\n address buyer,\n address payable paymentRecipient,\n uint256 amount\n ) internal {\n uint256 amountForDestination = amount;\n require(IERC20(_sand).transferFrom(buyer, paymentRecipient, amountForDestination), \"PAYMENT_TRANSFER_FAILED\");\n }\n\n /// @dev this override is required; two or more base classes define function\n function _msgSender() internal view override(Context, ERC2771HandlerV2) returns (address sender) {\n return ERC2771HandlerV2._msgSender();\n }\n\n /// @dev this override is required; two or more base classes define function\n function _msgData() internal view override(Context, ERC2771HandlerV2) returns (bytes calldata) {\n return ERC2771HandlerV2._msgData();\n }\n}\n" + }, + "src/solc_0.8/test/AssetUpgraderFeeBurner.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../asset/AssetUpgrader.sol\";\n\n/// @notice Allow to upgrade Asset with Catalyst, Gems and Sand, giving the assets attributes through AssetAttributeRegistry\ncontract AssetUpgraderFeeBurner is AssetUpgrader {\n constructor(\n IAssetAttributesRegistry registry,\n IERC20Extended sand,\n IPolygonAssetERC721 assetERC721,\n IPolygonAssetERC1155 assetERC1155,\n GemsCatalystsRegistry gemsCatalystsRegistry,\n uint256 _upgradeFee,\n uint256 _gemAdditionFee,\n address _feeRecipient,\n address trustedForwarder\n )\n AssetUpgrader(\n registry,\n sand,\n assetERC721,\n assetERC1155,\n gemsCatalystsRegistry,\n _upgradeFee,\n _gemAdditionFee,\n _feeRecipient,\n trustedForwarder\n )\n // solhint-disable-next-line no-empty-blocks\n {\n\n }\n}\n" + }, + "src/solc_0.8/test/ContributionCalculatorMock.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"../defi/interfaces/IContributionCalculator.sol\";\n\ncontract ContributionCalculatorMock is IContributionCalculator {\n mapping(address => uint256) public contribution;\n\n function computeContribution(address account, uint256) external view override returns (uint256) {\n return contribution[account];\n }\n\n function setContribution(address account, uint256 contribution_) external {\n contribution[account] = contribution_;\n }\n}\n" + }, + "src/solc_0.8/test/ContributionRulesMock.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"../defi/interfaces/IContributionRules.sol\";\n\ncontract ContributionRulesMock is IContributionRules {\n mapping(address => uint256) public contribution;\n\n function computeMultiplier(address account, uint256) external view override returns (uint256) {\n return contribution[account];\n }\n\n function setContribution(address account, uint256 contribution_) external {\n contribution[account] = contribution_;\n }\n}\n" + }, + "src/solc_0.8/test/EmptyContract.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\n// solhint-disable-next-line no-empty-blocks\ncontract EmptyContract {\n\n}\n" + }, + "src/solc_0.8/test/ERC1155Mintable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {ERC1155} from \"@openzeppelin/contracts-0.8/token/ERC1155/ERC1155.sol\";\n\n/// @dev This is NOT a secure ERC1155\n/// DO NOT USE in production.\ncontract ERC1155Mintable is ERC1155 {\n mapping(uint256 => mapping(address => uint256)) public fakeBalance;\n\n // solhint-disable-next-line no-empty-blocks\n constructor(string memory uri_) ERC1155(uri_) {}\n\n function mint(\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) external {\n _mint(to, id, amount, data);\n }\n\n function balanceOf(address owner, uint256 id) public view override returns (uint256) {\n if (fakeBalance[id][owner] != 0) {\n return fakeBalance[id][owner];\n }\n return ERC1155.balanceOf(owner, id);\n }\n\n function setFakeBalance(\n address owner,\n uint256 id,\n uint256 balance\n ) external {\n fakeBalance[id][owner] = balance;\n }\n}\n" + }, + "src/solc_0.8/test/ERC20Mintable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {ERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/ERC20.sol\";\n\n/// @dev This is NOT a secure ERC20\n/// DO NOT USE in production.\ncontract ERC20Mintable is ERC20 {\n // solhint-disable-next-line no-empty-blocks\n constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) {}\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n" + }, + "src/solc_0.8/test/ERC721Mintable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {ERC721} from \"@openzeppelin/contracts-0.8/token/ERC721/ERC721.sol\";\n\n/// @dev This is NOT a secure ERC721\n/// DO NOT USE in production.\ncontract ERC721Mintable is ERC721 {\n mapping(address => uint256) public fakeBalance;\n\n // solhint-disable-next-line no-empty-blocks\n constructor(string memory name_, string memory symbol_) ERC721(name_, symbol_) {}\n\n function mint(address to, uint256 tokenId) external {\n _mint(to, tokenId);\n }\n\n function balanceOf(address owner) public view override returns (uint256) {\n if (fakeBalance[owner] != 0) {\n return fakeBalance[owner];\n }\n return ERC721.balanceOf(owner);\n }\n\n function ownerOf(uint256 tokenId) public view override returns (address) {\n return ERC721.ownerOf(tokenId);\n }\n\n function setFakeBalance(address owner, uint256 balance) external {\n fakeBalance[owner] = balance;\n }\n}\n" + }, + "src/solc_0.8/test/FakeCheckpointManager.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ncontract ICheckpointManager {\n struct HeaderBlock {\n bytes32 root;\n uint256 start;\n uint256 end;\n uint256 createdAt;\n address proposer;\n }\n\n /**\n * @notice mapping of checkpoint header numbers to block details\n * @dev These checkpoints are submited by plasma contracts\n */\n mapping(uint256 => HeaderBlock) public headerBlocks;\n}\n\ncontract FakeCheckpointManager is ICheckpointManager {\n uint256 public currentCheckpointNumber = 0;\n\n function setCheckpoint(\n bytes32 rootHash,\n uint256 start,\n uint256 end\n ) public {\n HeaderBlock memory headerBlock =\n HeaderBlock({root: rootHash, start: start, end: end, createdAt: block.timestamp, proposer: msg.sender});\n\n currentCheckpointNumber = currentCheckpointNumber + 1;\n headerBlocks[currentCheckpointNumber] = headerBlock;\n }\n}\n" + }, + "src/solc_0.8/test/FakeChildChainManager.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../polygon/child/asset/PolygonAssetERC1155.sol\";\nimport \"../polygon/child/sand/PolygonSand.sol\";\n\n/// @dev This is NOT a secure ChildChainManager contract implementation!\n/// DO NOT USE in production.\n\ncontract FakeChildChainManager {\n address public polygonAsset;\n\n // solhint-disable-next-line no-empty-blocks\n constructor() {}\n\n function setPolygonAsset(address _polygonAsset) external {\n polygonAsset = _polygonAsset;\n }\n\n function callDeposit(address user, bytes calldata depositData) external {\n PolygonAssetERC1155(polygonAsset).deposit(user, depositData);\n }\n\n function callSandDeposit(\n address polygonSand,\n address user,\n bytes calldata depositData\n ) external {\n PolygonSand(polygonSand).deposit(user, depositData);\n }\n}\n" + }, + "src/solc_0.8/test/FakeERC1155Predicate.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IERC1155} from \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\nimport {ERC1155Receiver} from \"@openzeppelin/contracts-0.8/token/ERC1155/utils/ERC1155Receiver.sol\";\n\ninterface IMintableERC1155 is IERC1155 {\n function mint(\n address account,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n function mintBatch(\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n\n/// @dev This is NOT a secure ChildChainManager contract implementation!\n/// DO NOT USE in production.\n\ncontract FakeERC1155Predicate is ERC1155Receiver {\n address private asset;\n\n function setAsset(address _asset) external {\n asset = _asset;\n }\n\n function lockTokens(\n address depositor,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external {\n IMintableERC1155(asset).safeBatchTransferFrom(depositor, address(this), ids, amounts, data);\n }\n\n function exitTokens(\n address withdrawer,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public {\n IMintableERC1155 token = IMintableERC1155(asset);\n uint256[] memory balances = token.balanceOfBatch(makeArrayWithAddress(address(this), ids.length), ids);\n (uint256[] memory toBeMinted, bool needMintStep, bool needTransferStep) =\n calculateAmountsToBeMinted(balances, amounts);\n if (needMintStep) {\n token.mintBatch(\n withdrawer,\n ids,\n toBeMinted,\n data // passing data when minting to withdrawer\n );\n }\n if (needTransferStep) {\n token.safeBatchTransferFrom(\n address(this),\n withdrawer,\n ids,\n balances,\n data // passing data when transferring unlocked tokens to withdrawer\n );\n }\n }\n\n function calculateAmountsToBeMinted(uint256[] memory balances, uint256[] memory exitAmounts)\n internal\n pure\n returns (\n uint256[] memory,\n bool,\n bool\n )\n {\n uint256 count = balances.length;\n require(count == exitAmounts.length, \"ChainExitERC1155Predicate: Array length mismatch found\");\n uint256[] memory toBeMinted = new uint256[](count);\n bool needMintStep;\n bool needTransferStep;\n for (uint256 i = 0; i < count; i++) {\n if (balances[i] < exitAmounts[i]) {\n toBeMinted[i] = exitAmounts[i] - balances[i];\n needMintStep = true;\n }\n if (balances[i] != 0) {\n needTransferStep = true;\n }\n }\n return (toBeMinted, needMintStep, needTransferStep);\n }\n\n function makeArrayWithAddress(address addr, uint256 size) internal pure returns (address[] memory) {\n require(addr != address(0), \"MintableERC1155Predicate: Invalid address\");\n require(size > 0, \"MintableERC1155Predicate: Invalid resulting array length\");\n address[] memory addresses = new address[](size);\n for (uint256 i = 0; i < size; i++) {\n addresses[i] = addr;\n }\n return addresses;\n }\n\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes calldata\n ) external pure override returns (bytes4) {\n return 0;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external pure override returns (bytes4) {\n return ERC1155Receiver(address(0)).onERC1155BatchReceived.selector;\n }\n}\n" + }, + "src/solc_0.8/test/FakeERC20Predicate.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {SafeERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport {IERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\n\n/// @dev This is NOT a secure ERC20 Predicate contract implementation!\n/// DO NOT USE in production.\n\ncontract FakeERC20Predicate {\n address private token;\n using SafeERC20 for IERC20;\n\n event LockedERC20(\n address indexed depositor,\n address indexed depositReceiver,\n address indexed rootToken,\n uint256 amount\n );\n\n function setToken(address _token) external {\n token = _token;\n }\n\n function lockTokens(\n address depositor,\n address depositReceiver,\n bytes calldata depositData\n ) external {\n uint256 amount = abi.decode(depositData, (uint256));\n emit LockedERC20(depositor, depositReceiver, token, amount);\n IERC20(token).safeTransferFrom(depositor, address(this), amount);\n }\n\n function exitTokens(address withdrawer, uint256 amount) public {\n IERC20(token).safeTransfer(withdrawer, amount);\n }\n}\n" + }, + "src/solc_0.8/test/FakeFxRoot.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../common/interfaces/IPolygonLand.sol\";\n\n// solhint-disable\n\n/// @dev This is NOT a secure FxRoot contract implementation!\n/// DO NOT USE in production.\n\ninterface IFakeFxChild {\n function onStateReceive(\n uint256 stateId,\n address receiver,\n address rootMessageSender,\n bytes memory data\n ) external;\n}\n\n/**\n * @title FxRoot root contract for fx-portal\n */\ncontract FakeFxRoot {\n address fxChild;\n\n function setFxChild(address _fxChild) public {\n fxChild = _fxChild;\n }\n\n function sendMessageToChild(address _receiver, bytes calldata _data) public {\n IFakeFxChild(fxChild).onStateReceive(0, _receiver, msg.sender, _data);\n }\n}\n" + }, + "src/solc_0.8/test/FakeLPSandMatic.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../common/BaseWithStorage/ERC20/ERC20BaseToken.sol\";\n\ncontract FakeLPSandMatic is ERC20BaseToken {\n constructor() ERC20BaseToken(\"LPSandMatic\", \"LPSM\", msg.sender, msg.sender) {\n _mint(msg.sender, 3000000000 * 10**18);\n }\n}\n" + }, + "src/solc_0.8/test/FakeMintableERC721Predicate.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../common/interfaces/IMintableERC721.sol\";\nimport \"../common/interfaces/IERC721TokenReceiver.sol\";\n\n/// @dev based on: @maticnetwork/pos-portal/contracts/root/TokenPredicates/MintableERC721Predicate.sol\n/// @dev This is NOT a secure ERC721 Predicate contract implementation!\n/// DO NOT USE in production.\n\ncontract FakeMintableERC721Predicate is IERC721TokenReceiver {\n /**\n * @notice Lock ERC721 token(s) for deposit, callable only by manager\n * @param depositor Address who wants to deposit token\n * @param rootToken Token which gets deposited\n * @param depositData ABI encoded tokenId(s). It's possible to deposit batch of tokens.\n */\n function lockTokens(\n address depositor,\n address rootToken,\n bytes calldata depositData\n ) external {\n // Locking single ERC721 token\n if (depositData.length == 32) {\n uint256 tokenId = abi.decode(depositData, (uint256));\n\n // Emitting event that single token is getting locked in predicate\n // emit LockedMintableERC721(depositor, depositReceiver, rootToken, tokenId);\n\n // Transferring token to this address, which will be\n // released when attempted to be unlocked\n IMintableERC721(rootToken).safeTransferFrom(depositor, address(this), tokenId);\n } else {\n // Locking a set a ERC721 token(s)\n\n uint256[] memory tokenIds = abi.decode(depositData, (uint256[]));\n\n // Emitting event that a set of ERC721 tokens are getting lockec\n // in this predicate contract\n // emit LockedMintableERC721Batch(depositor, depositReceiver, rootToken, tokenIds);\n\n // These many tokens are attempted to be deposited\n // by user\n uint256 length = tokenIds.length;\n // Iteratively trying to transfer ERC721 token\n // to this predicate address\n for (uint256 i; i < length; i++) {\n IMintableERC721(rootToken).safeTransferFrom(depositor, address(this), tokenIds[i]);\n }\n }\n }\n\n /**\n * @notice Validates log signature, from and to address\n * then checks if token already exists on root chain\n * if token exits then transfers it to withdrawer\n * if token doesn't exit then it is minted\n * callable only by manager\n */\n function exitTokens(\n address rootToken,\n address withdrawer,\n uint256 tokenId\n ) public {\n // If it's a simple exit ( with out metadata coming from L2 to L1 )\n IMintableERC721 token = IMintableERC721(rootToken);\n\n // topic3 is tokenId field\n if (token.exists(tokenId)) {\n token.safeTransferFrom(address(this), withdrawer, tokenId);\n } else {\n token.mint(withdrawer, tokenId);\n }\n }\n\n function exitTokens(\n address rootToken,\n address withdrawer,\n uint256[] calldata tokenIds\n ) public {\n // topic0 is event sig\n // If it's a simple batch exit, where a set of\n // ERC721s were burnt in child chain with event signature\n // looking like `WithdrawnBatch(address indexed user, uint256[] tokenIds);`\n //\n // @note This doesn't allow transfer of metadata cross chain\n // For that check below `else if` block\n // topic1 is from address\n\n uint256 length = tokenIds.length;\n IMintableERC721 token = IMintableERC721(rootToken);\n for (uint256 i; i < length; i++) {\n uint256 tokenId = tokenIds[i];\n\n // Check if token exists or not\n //\n // If does, transfer token to withdrawer\n if (token.exists(tokenId)) {\n token.safeTransferFrom(address(this), withdrawer, tokenId);\n } else {\n // If token was minted on L2\n // we'll mint it here, on L1, during\n // exiting from L2\n token.mint(withdrawer, tokenId);\n }\n }\n }\n\n function exitTokens(\n address rootToken,\n address withdrawer,\n uint256 tokenId,\n bytes calldata metadata\n ) public {\n // If this is NFT exit with metadata i.e. URI 👆\n //\n // Note: If your token is only minted in L2, you can exit\n // it with metadata. But if it was minted on L1, it'll be\n // simply transferred to withdrawer address. And in that case,\n // it's lot better to exit with `Transfer(address,address,uint256)`\n // i.e. calling `withdraw` method on L2 contract\n // event signature proof, which is defined under first `if` clause\n //\n // If you've called `withdrawWithMetadata`, you should submit\n // proof of event signature `TransferWithMetadata(address,address,uint256,bytes)`\n\n IMintableERC721 token = IMintableERC721(rootToken);\n\n // topic3 is tokenId field\n if (token.exists(tokenId)) {\n token.safeTransferFrom(address(this), withdrawer, tokenId);\n } else {\n token.mint(withdrawer, tokenId, metadata);\n }\n }\n\n /**\n * @notice accepts safe ERC721 transfer\n */\n function onERC721Received(\n address,\n address,\n uint256,\n bytes calldata\n ) external pure override returns (bytes4) {\n return IERC721TokenReceiver.onERC721Received.selector;\n }\n}\n" + }, + "src/solc_0.8/test/FakePolygonLand.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../common/BaseWithStorage/ERC20/ERC20BaseToken.sol\";\n\ncontract FakePolygonLand is ERC20BaseToken {\n constructor() ERC20BaseToken(\"FakePolygonLand\", \"FPL\", msg.sender, msg.sender) {\n _mint(msg.sender, 3000000000 * 10**18);\n }\n}\n" + }, + "src/solc_0.8/test/FakePolygonSand.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../common/BaseWithStorage/ERC20/ERC20BaseToken.sol\";\n\ncontract FakePolygonSand is ERC20BaseToken {\n constructor() ERC20BaseToken(\"FakePolygonSand\", \"FPS\", msg.sender, msg.sender) {\n _mint(msg.sender, 3000000000 * 10**18);\n }\n}\n" + }, + "src/solc_0.8/test/FakePredicateForwarder.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\n/// @dev This is NOT a secure forwarder contract implementation!\n/// DO NOT USE in production.\ncontract FakePredicateForwarder {\n struct Request {\n address from;\n address to;\n uint256 value;\n uint256 gas;\n bytes data;\n }\n\n // solhint-disable-next-line no-empty-blocks\n constructor() {}\n\n function forward(Request calldata req) public returns (bool, bytes memory) {\n // solhint-disable avoid-low-level-calls\n (bool success, bytes memory returndata) =\n req.to.call{gas: req.gas, value: req.value}(abi.encodePacked(req.data, req.from));\n // solhint-enable avoid-low-level-calls\n\n return (success, returndata);\n }\n}\n" + }, + "src/solc_0.8/test/FallbackContract.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ncontract FallBackContract {\n // solhint-disable-next-line payable-fallback\n fallback() external {}\n}\n" + }, + "src/solc_0.8/test/MockAssetAttributesRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\npragma experimental ABIEncoderV2;\n\nimport \"../asset/AssetAttributesRegistry.sol\";\n\n/// @notice Allows setting the gems and catalysts of an asset\ncontract MockAssetAttributesRegistry is AssetAttributesRegistry {\n uint256 private constant IS_NFT = 0x0000000000000000000000000000000000000000800000000000000000000000;\n\n constructor(\n GemsCatalystsRegistry gemsCatalystsRegistry,\n address admin,\n address minter,\n address upgrader\n )\n AssetAttributesRegistry(gemsCatalystsRegistry, admin, minter, upgrader)\n // solhint-disable-next-line no-empty-blocks\n {\n\n }\n\n function setCatalyst(\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds\n ) external override {\n // @note access control removed for testing\n _setCatalyst(assetId, catalystId, gemIds, _getBlockNumber(), true);\n }\n\n function _setCatalyst(\n uint256 assetId,\n uint16 catalystId,\n uint16[] memory gemIds,\n uint64 blockNumber,\n bool hasToEmitEvent\n ) internal override {\n // @note access control removed for testing\n require(gemIds.length <= MAX_NUM_GEMS, \"GEMS_MAX_REACHED\");\n uint8 maxGems = _gemsCatalystsRegistry.getMaxGems(catalystId);\n require(gemIds.length <= maxGems, \"GEMS_TOO_MANY\");\n uint16[MAX_NUM_GEMS] memory gemIdsToStore;\n for (uint8 i = 0; i < gemIds.length; i++) {\n require(gemIds[i] != 0, \"INVALID_GEM_ID\");\n gemIdsToStore[i] = gemIds[i];\n }\n _records[assetId] = Record(catalystId, gemIdsToStore);\n if (hasToEmitEvent) {\n emit CatalystApplied(assetId, catalystId, gemIds, blockNumber);\n }\n }\n\n function addGems(uint256 assetId, uint16[] calldata gemIds) external override {\n // @note removed access control for ease of testing.\n require(assetId & IS_NFT != 0, \"INVALID_NOT_NFT\");\n require(gemIds.length != 0, \"INVALID_GEMS_0\");\n\n uint16 catalystId = _records[assetId].catalystId;\n uint16[MAX_NUM_GEMS] memory gemIdsToStore;\n if (catalystId == 0) {\n // fallback on collection catalyst\n uint256 collectionId = _getCollectionId(assetId);\n catalystId = _records[collectionId].catalystId;\n if (catalystId != 0) {\n _records[assetId].catalystId = catalystId;\n gemIdsToStore = _records[collectionId].gemIds;\n }\n } else {\n gemIdsToStore = _records[assetId].gemIds;\n }\n\n require(catalystId != 0, \"NO_CATALYST_SET\");\n uint8 j = 0;\n uint8 i = 0;\n for (i = 0; i < MAX_NUM_GEMS; i++) {\n if (j == gemIds.length) {\n break;\n }\n if (gemIdsToStore[i] == 0) {\n require(gemIds[j] != 0, \"INVALID_GEM_ID\");\n gemIdsToStore[i] = gemIds[j];\n j++;\n }\n }\n uint8 maxGems = _gemsCatalystsRegistry.getMaxGems(catalystId);\n require(i <= maxGems, \"GEMS_TOO_MANY\");\n _records[assetId].gemIds = gemIdsToStore;\n uint64 blockNumber = _getBlockNumber();\n emit GemsAdded(assetId, gemIds, blockNumber);\n }\n}\n" + }, + "src/solc_0.8/test/MockAssetERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {AssetERC1155} from \"../assetERC1155/AssetERC1155.sol\";\nimport \"../asset/libraries/ERC1155ERC721Helper.sol\";\nimport {IOperatorFilterRegistry} from \"../OperatorFilterer/interfaces/IOperatorFilterRegistry.sol\";\n\ncontract MockAssetERC1155 is AssetERC1155 {\n /// @notice sets filter registry address deployed in test\n /// @param registry the address of the registry\n function setOperatorRegistry(address registry) external {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n }\n\n /// @notice registers and substribe to the subscription on the said deployed registry\n /// @param subscription the address to subcribe to\n function registerAndSubscribe(address subscription) external {\n operatorFilterRegistry.registerAndSubscribe(address(this), subscription);\n }\n\n /// @notice sets Approvals with operator filterer check in case to test the transfer.\n /// @param operator address of the operator to be approved\n /// @param approved bool value denoting approved (true) or not Approved(false)\n function setApprovalForAllWithOutFilter(address operator, bool approved) external {\n super._setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /// @notice mint with out the bouncer check for the test\n /// @param creator address of the creator of the token.\n /// @param packId unique packId for that token.\n /// @param hash hash of an IPFS cidv1 folder that contains the metadata of the token type in the file 0.json.\n /// @param supply number of tokens minted for that token type.\n /// @param owner address that will receive the tokens.\n /// @param data extra data to accompany the minting call.\n /// @return id the id of the newly minted token type.\n function mintWithOutBouncerCheck(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256 supply,\n address owner,\n bytes calldata data\n ) external returns (uint256 id) {\n require(hash != 0, \"HASH==0\");\n require(owner != address(0), \"TO==0\");\n id = _generateTokenId(creator, supply, packId, supply == 1 ? 0 : 1, 0);\n uint256 uriId = id & ERC1155ERC721Helper.URI_ID;\n require(uint256(_metadataHash[uriId]) == 0, \"ID_TAKEN\");\n _metadataHash[uriId] = hash;\n _mint(_msgSender(), owner, id, supply, data);\n }\n}\n" + }, + "src/solc_0.8/test/MockAssetERC1155Tunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../polygon/root/asset/AssetERC1155Tunnel.sol\";\n\ncontract MockAssetERC1155Tunnel is AssetERC1155Tunnel {\n function init(\n address _checkpointManager,\n address _fxRoot,\n IAssetERC1155 _rootToken,\n address trustedForwarder,\n uint256 _maxTransferLimit\n ) external {\n AssetERC1155Tunnel.initialize(_checkpointManager, _fxRoot, _rootToken, trustedForwarder, _maxTransferLimit);\n }\n\n function receiveMessage(bytes memory message) public virtual override {\n _processMessageFromChild(message);\n }\n}\n" + }, + "src/solc_0.8/test/MockAssetERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {AssetERC721} from \"../polygon/root/asset/AssetERC721.sol\";\nimport {BaseERC721} from \"../assetERC721/BaseERC721.sol\";\nimport {IOperatorFilterRegistry} from \"../OperatorFilterer/interfaces/IOperatorFilterRegistry.sol\";\n\ncontract MockAssetERC721 is AssetERC721 {\n /// @notice sets filter registry address deployed in test\n /// @param registry the address of the registry\n function setOperatorRegistry(address registry) external {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n }\n\n /// @notice registers and substribe to the subscription on the said deployed registry\n /// @param subscription the address to subcribe to\n function registerAndSubscribe(address subscription) external {\n operatorFilterRegistry.registerAndSubscribe(address(this), subscription);\n }\n\n /// @notice sets Approvals with operator filterer check in case to test the transfer.\n /// @param operator address of the operator to be approved\n /// @param approved bool value denoting approved (true) or not Approved(false)\n function setApprovalForAllWithOutFilter(address operator, bool approved) external {\n super._setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /// @notice Mint without the minter check for test.\n /// @param to Address that will receive the token.\n /// @param id ERC721 id to be used.\n function mintWithOutMinterCheck(address to, uint256 id) external {\n BaseERC721.mint(to, id);\n }\n}\n" + }, + "src/solc_0.8/test/MockAssetERC721Tunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../polygon/root/asset/AssetERC721Tunnel.sol\";\nimport \"../common/interfaces/IAssetERC721.sol\";\n\ncontract MockAssetERC721Tunnel is AssetERC721Tunnel {\n function init(\n address _checkpointManager,\n address _fxRoot,\n IAssetERC721 _rootToken,\n address trustedForwarder,\n uint256 _maxTransferLimit\n ) external {\n AssetERC721Tunnel.initialize(_checkpointManager, _fxRoot, _rootToken, trustedForwarder, _maxTransferLimit);\n }\n\n function receiveMessage(bytes memory message) public virtual override {\n _processMessageFromChild(message);\n }\n}\n" + }, + "src/solc_0.8/test/MockERC1155Asset.sol": { + "content": "//SPDX-License-Identifier: MIT\n\n/* solhint-disable no-empty-blocks */\n\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC1155/presets/ERC1155PresetMinterPauser.sol\";\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\n\ncontract MockERC1155Asset is ERC1155PresetMinterPauser, Ownable {\n constructor(string memory uri) ERC1155PresetMinterPauser(uri) Ownable() {}\n}\n" + }, + "src/solc_0.8/test/MockERC20BasicApprovalTarget.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\n\ncontract MockERC20BasicApprovalTarget {\n event LogOnCall(address);\n\n function logOnCall(address sender) external returns (address) {\n emit LogOnCall(sender);\n return sender;\n }\n\n function revertOnCall() external pure {\n revert(\"REVERT_ON_CALL\");\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool) {\n return IERC20(msg.sender).transferFrom(sender, recipient, amount);\n }\n}\n" + }, + "src/solc_0.8/test/MockERC667Reciever.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\nimport \"../common/interfaces/IERC677Receiver.sol\";\n\ncontract MockERC677Receiver is IERC677Receiver {\n event OnTokenTransferEvent(address indexed _sender, uint256 _value, bytes _data);\n\n /// @dev Emits the OnTokenTransferEvent.\n /// @param _sender The address of the sender.\n /// @param _value The value sent with the tx.\n /// @param _data The data sent with the tx.\n function onTokenTransfer(\n address _sender,\n uint256 _value,\n bytes calldata _data\n ) external override {\n emit OnTokenTransferEvent(_sender, _value, _data);\n }\n}\n" + }, + "src/solc_0.8/test/MockERC721Asset.sol": { + "content": "//SPDX-License-Identifier: MIT\n\n/* solhint-disable no-empty-blocks */\n\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC721/presets/ERC721PresetMinterPauserAutoId.sol\";\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\n\ncontract MockERC721Asset is ERC721PresetMinterPauserAutoId, Ownable {\n constructor(\n string memory name,\n string memory symbol,\n string memory uri\n ) ERC721PresetMinterPauserAutoId(name, symbol, uri) Ownable() {}\n}\n" + }, + "src/solc_0.8/test/MockLandV2WithMint.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable code-complexity\npragma solidity 0.8.2;\n\nimport \"../polygon/child/land/PolygonLandBaseTokenV2.sol\";\n\ncontract MockLandV2WithMint is PolygonLandBaseTokenV2 {\n /** @notice Removed caller validations */\n function mintQuad(\n address user,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) external override {\n _mintQuad(user, size, x, y, data);\n }\n\n /** @notice Removed caller validations */\n function mintAndTransferQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external override {\n require(to != address(0), \"to is zero address\");\n\n if (exists(size, x, y)) {\n _transferQuad(msg.sender, to, size, x, y);\n _numNFTPerAddress[msg.sender] -= size * size;\n _numNFTPerAddress[to] += size * size;\n _checkBatchReceiverAcceptQuad(msg.sender, msg.sender, to, size, x, y, data);\n } else {\n _mintAndTransferQuad(to, size, x, y, data);\n }\n }\n}\n" + }, + "src/solc_0.8/test/MockLandWithMint.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable code-complexity\npragma solidity 0.8.2;\n\nimport \"../polygon/child/land/PolygonLandBaseToken.sol\";\n\ncontract MockLandWithMint is PolygonLandBaseToken {\n /** @notice Removed caller validations */\n function mint(\n address user,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) external {\n _mintQuad(user, size, x, y, data);\n }\n\n function mintQuad(\n address user,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) external override {\n _mintQuad(user, size, x, y, data);\n }\n}\n" + }, + "src/solc_0.8/test/MockMarketPlace1.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\nimport {IAssetERC721} from \"../common/interfaces/IAssetERC721.sol\";\nimport {IAssetERC1155} from \"../common/interfaces/IAssetERC1155.sol\";\nimport {ILandTokenV3} from \"../common/interfaces/ILandTokenV3.sol\";\n\ncontract MockMarketPlace1 {\n bytes4 private constant ERC721_IS_RECEIVER = 0x150b7a02;\n bytes4 private constant ERC721_RECEIVED = 0x150b7a02;\n bytes4 private constant ERC1155_IS_RECEIVER = 0x4e2312e0;\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param amount amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function transferTokenForERC1155(\n address asset,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) external {\n IAssetERC1155(asset).safeTransferFrom(from, to, id, amount, data);\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param land the contract address on which the token transfer will take place\n /// @param from adderess from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param data aditional data accompanying the transfer.\n function transferLand(\n address land,\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) external {\n ILandTokenV3(land).safeTransferFrom(from, to, id, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param asset the contract address on which the token transfer will take place\n /// @param from Address whose token is to be transferred.\n /// @param to Recipient.\n /// @param id The token id to be transferred.\n function transferTokenERC721(\n address asset,\n address from,\n address to,\n uint256 id\n ) external {\n IAssetERC721(asset).safeTransferFrom(from, to, id);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param amounts amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function batchTransferTokenERC1155(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) external {\n IAssetERC1155(asset).safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param asset the contract address on which the token transfer will take place\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n /// @param data Additional data.\n function batchTransferTokenERC721(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n bytes memory data\n ) external {\n IAssetERC721(asset).safeBatchTransferFrom(from, to, ids, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param land the contract address on which the token transfer will take place\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param id The id of the token to be transferred.\n function transferLand(\n address land,\n address from,\n address to,\n uint256 id\n ) external {\n ILandTokenV3(land).safeTransferFrom(from, to, id);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n\n function onERC721Received(\n address,\n address,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC721_RECEIVED;\n }\n\n function supportsInterface(bytes4 _interfaceId) external pure returns (bool) {\n return _interfaceId == 0x01ffc9a7 || _interfaceId == ERC1155_IS_RECEIVER || _interfaceId == ERC721_IS_RECEIVER;\n }\n}\n" + }, + "src/solc_0.8/test/MockMarketPlace2.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\nimport {IAssetERC721} from \"../common/interfaces/IAssetERC721.sol\";\nimport {IAssetERC1155} from \"../common/interfaces/IAssetERC1155.sol\";\nimport {ILandTokenV3} from \"../common/interfaces/ILandTokenV3.sol\";\n\ncontract MockMarketPlace2 {\n bytes4 private constant ERC721_IS_RECEIVER = 0x150b7a02;\n bytes4 private constant ERC721_RECEIVED = 0x150b7a02;\n bytes4 private constant ERC1155_IS_RECEIVER = 0x4e2312e0;\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param amount amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function transferTokenForERC1155(\n address asset,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) external {\n IAssetERC1155(asset).safeTransferFrom(from, to, id, amount, data);\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param land the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param data aditional data accompanying the transfer.\n function transferLand(\n address land,\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) external {\n ILandTokenV3(land).safeTransferFrom(from, to, id, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param asset the contract address on which the token transfer will take place\n /// @param from Address whose token is to be transferred.\n /// @param to Recipient.\n /// @param id The token id to be transferred.\n function transferTokenERC721(\n address asset,\n address from,\n address to,\n uint256 id\n ) external {\n IAssetERC721(asset).safeTransferFrom(from, to, id);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param amounts amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function batchTransferTokenERC1155(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) external {\n IAssetERC1155(asset).safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param asset the contract address on which the token transfer will take place\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n /// @param data Additional data.\n function batchTransferTokenERC721(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n bytes memory data\n ) external {\n IAssetERC721(asset).safeBatchTransferFrom(from, to, ids, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param land the contract address on which the token transfer will take place\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param id The id of the token to be transferred.\n function transferLand(\n address land,\n address from,\n address to,\n uint256 id\n ) external {\n ILandTokenV3(land).safeTransferFrom(from, to, id);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n\n function onERC721Received(\n address,\n address,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC721_RECEIVED;\n }\n\n function supportsInterface(bytes4 _interfaceId) external pure returns (bool) {\n return _interfaceId == 0x01ffc9a7 || _interfaceId == ERC1155_IS_RECEIVER || _interfaceId == ERC721_IS_RECEIVER;\n }\n}\n" + }, + "src/solc_0.8/test/MockMarketPlace3.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\nimport {IAssetERC721} from \"../common/interfaces/IAssetERC721.sol\";\nimport {IAssetERC1155} from \"../common/interfaces/IAssetERC1155.sol\";\nimport {ILandTokenV3} from \"../common/interfaces/ILandTokenV3.sol\";\n\ncontract MockMarketPlace3 {\n bytes4 private constant ERC721_IS_RECEIVER = 0x150b7a02;\n bytes4 private constant ERC721_RECEIVED = 0x150b7a02;\n bytes4 private constant ERC1155_IS_RECEIVER = 0x4e2312e0;\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param amount amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function transferTokenForERC1155(\n address asset,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) external {\n IAssetERC1155(asset).safeTransferFrom(from, to, id, amount, data);\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param land the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param data aditional data accompanying the transfer.\n function transferLand(\n address land,\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) external {\n ILandTokenV3(land).safeTransferFrom(from, to, id, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param asset the contract address on which the token transfer will take place\n /// @param from Address whose token is to be transferred.\n /// @param to Recipient.\n /// @param id The token id to be transferred.\n function transferTokenERC721(\n address asset,\n address from,\n address to,\n uint256 id\n ) external {\n IAssetERC721(asset).safeTransferFrom(from, to, id);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param amounts amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function batchTransferTokenERC1155(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) external {\n IAssetERC1155(asset).safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param asset the contract address on which the token transfer will take place\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n /// @param data Additional data.\n function batchTransferTokenERC721(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n bytes memory data\n ) external {\n IAssetERC721(asset).safeBatchTransferFrom(from, to, ids, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param land the contract address on which the token transfer will take place\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param id The id of the token to be transferred.\n function transferLand(\n address land,\n address from,\n address to,\n uint256 id\n ) external {\n ILandTokenV3(land).safeTransferFrom(from, to, id);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n\n function onERC721Received(\n address,\n address,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC721_RECEIVED;\n }\n\n function supportsInterface(bytes4 _interfaceId) external pure returns (bool) {\n return _interfaceId == 0x01ffc9a7 || _interfaceId == ERC1155_IS_RECEIVER || _interfaceId == ERC721_IS_RECEIVER;\n }\n}\n" + }, + "src/solc_0.8/test/MockMarketPlace4.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\nimport {IAssetERC721} from \"../common/interfaces/IAssetERC721.sol\";\nimport {IAssetERC1155} from \"../common/interfaces/IAssetERC1155.sol\";\nimport {ILandTokenV3} from \"../common/interfaces/ILandTokenV3.sol\";\n\ncontract MockMarketPlace4 {\n bytes4 private constant ERC721_IS_RECEIVER = 0x150b7a02;\n bytes4 private constant ERC721_RECEIVED = 0x150b7a02;\n bytes4 private constant ERC1155_IS_RECEIVER = 0x4e2312e0;\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param amount amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function transferTokenForERC1155(\n address asset,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) external {\n IAssetERC1155(asset).safeTransferFrom(from, to, id, amount, data);\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param land the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param data aditional data accompanying the transfer.\n function transferLand(\n address land,\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) external {\n ILandTokenV3(land).safeTransferFrom(from, to, id, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param asset the contract address on which the token transfer will take place\n /// @param from Address whose token is to be transferred.\n /// @param to Recipient.\n /// @param id The token id to be transferred.\n function transferTokenERC721(\n address asset,\n address from,\n address to,\n uint256 id\n ) external {\n IAssetERC721(asset).safeTransferFrom(from, to, id);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param amounts amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function batchTransferTokenERC1155(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) external {\n IAssetERC1155(asset).safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param asset the contract address on which the token transfer will take place\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n /// @param data Additional data.\n function batchTransferTokenERC721(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n bytes memory data\n ) external {\n IAssetERC721(asset).safeBatchTransferFrom(from, to, ids, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param land the contract address on which the token transfer will take place\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param id The id of the token to be transferred.\n function transferLand(\n address land,\n address from,\n address to,\n uint256 id\n ) external {\n ILandTokenV3(land).safeTransferFrom(from, to, id);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n\n function onERC721Received(\n address,\n address,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC721_RECEIVED;\n }\n\n function supportsInterface(bytes4 _interfaceId) external pure returns (bool) {\n return _interfaceId == 0x01ffc9a7 || _interfaceId == ERC1155_IS_RECEIVER || _interfaceId == ERC721_IS_RECEIVER;\n }\n}\n" + }, + "src/solc_0.8/test/MockOperatorFilterRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable code-complexity\npragma solidity 0.8.2;\n\nimport {IOperatorFilterRegistry} from \"../OperatorFilterer/interfaces/IOperatorFilterRegistry.sol\";\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport {EnumerableSet} from \"@openzeppelin/contracts-0.8/utils/structs/EnumerableSet.sol\";\nimport {OperatorFilterRegistryEvents} from \"./OperatorFilterRegistryEvents.sol\";\n\n/**\n * @title MockOperatorFilterRegistry\n * @notice Made based on the OperatorFilterRegistry of openSea at https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/OperatorFilterRegistry.sol\n * @notice This contracts allows tokens or token owners to register specific addresses or codeHashes that may be\n * * restricted according to the isOperatorAllowed function.\n */\ncontract MockOperatorFilterRegistry is IOperatorFilterRegistry, OperatorFilterRegistryEvents {\n using EnumerableSet for EnumerableSet.AddressSet;\n using EnumerableSet for EnumerableSet.Bytes32Set;\n\n /// @dev initialized accounts have a nonzero codehash (see https://eips.ethereum.org/EIPS/eip-1052)\n /// Note that this will also be a smart contract's codehash when making calls from its constructor.\n bytes32 public constant EOA_CODEHASH = keccak256(\"\");\n\n mapping(address => EnumerableSet.AddressSet) private _filteredOperators;\n mapping(address => EnumerableSet.Bytes32Set) private _filteredCodeHashes;\n mapping(address => address) private _registrations;\n mapping(address => EnumerableSet.AddressSet) private _subscribers;\n\n constructor(address _defaultSubscribtion, address[] memory _blacklistedAddresses) {\n _registrations[_defaultSubscribtion] = _defaultSubscribtion;\n EnumerableSet.AddressSet storage filteredOperatorsRef = _filteredOperators[_defaultSubscribtion];\n EnumerableSet.Bytes32Set storage filteredCodeHashesRef = _filteredCodeHashes[_defaultSubscribtion];\n for (uint256 i; i < _blacklistedAddresses.length; i++) {\n filteredOperatorsRef.add(_blacklistedAddresses[i]);\n bytes32 codeHash = _blacklistedAddresses[i].codehash;\n filteredCodeHashesRef.add(codeHash);\n }\n }\n\n /**\n * @notice restricts method caller to the address or EIP-173 \"owner()\"\n */\n modifier onlyAddressOrOwner(address addr) {\n if (msg.sender != addr) {\n try Ownable(addr).owner() returns (address owner) {\n if (msg.sender != owner) {\n revert(\"Only Address or Owner\");\n }\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"Not Ownable\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n }\n _;\n }\n\n /**\n * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns\n * true if supplied registrant address is not registered.\n */\n function isOperatorAllowed(address registrant, address operator) external view override returns (bool) {\n address registration = _registrations[registrant];\n if (registration != address(0)) {\n EnumerableSet.AddressSet storage filteredOperatorsRef;\n EnumerableSet.Bytes32Set storage filteredCodeHashesRef;\n\n filteredOperatorsRef = _filteredOperators[registration];\n filteredCodeHashesRef = _filteredCodeHashes[registration];\n\n if (filteredOperatorsRef.contains(operator)) {\n revert(\"Address is filtered\");\n }\n if (operator.code.length > 0) {\n bytes32 codeHash = operator.codehash;\n if (filteredCodeHashesRef.contains(codeHash)) {\n revert(\"Codehash is filtered\");\n }\n }\n }\n return true;\n }\n\n //////////////////\n // AUTH METHODS //\n //////////////////\n\n /**\n * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.\n */\n function register(address registrant) external override onlyAddressOrOwner(registrant) {\n if (_registrations[registrant] != address(0)) {\n revert(\"Already registered\");\n }\n _registrations[registrant] = registrant;\n emit RegistrationUpdated(registrant, true);\n }\n\n /**\n * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.\n * Note that this does not remove any filtered addresses or codeHashes.\n * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.\n */\n function unregister(address registrant) external onlyAddressOrOwner(registrant) {\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert(\"Not registered\");\n }\n if (registration != registrant) {\n _subscribers[registration].remove(registrant);\n emit SubscriptionUpdated(registrant, registration, false);\n }\n _registrations[registrant] = address(0);\n emit RegistrationUpdated(registrant, false);\n }\n\n /**\n * @notice Registers an address with the registry and \"subscribes\" to another address's filtered operators and codeHashes.\n */\n function registerAndSubscribe(address registrant, address subscription)\n external\n override\n onlyAddressOrOwner(registrant)\n {\n address registration = _registrations[registrant];\n if (registration != address(0)) {\n revert(\"Already registered\");\n }\n if (registrant == subscription) {\n revert(\"Cannot subscribe to self\");\n }\n address subscriptionRegistration = _registrations[subscription];\n if (subscriptionRegistration == address(0)) {\n revert(\"Subscribtion not registered\");\n }\n if (subscriptionRegistration != subscription) {\n revert(\"Cannot subscribe to registrant with subscribtion\");\n }\n\n _registrations[registrant] = subscription;\n _subscribers[subscription].add(registrant);\n emit RegistrationUpdated(registrant, true);\n emit SubscriptionUpdated(registrant, subscription, true);\n }\n\n /**\n * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another\n * address without subscribing.\n */\n function registerAndCopyEntries(address registrant, address registrantToCopy)\n external\n override\n onlyAddressOrOwner(registrant)\n {\n if (registrantToCopy == registrant) {\n revert(\"Cannot copy from self\");\n }\n address registration = _registrations[registrant];\n if (registration != address(0)) {\n revert(\"Already registered\");\n }\n address registrantRegistration = _registrations[registrantToCopy];\n if (registrantRegistration == address(0)) {\n revert(\"Registrant to copy from not registered\");\n }\n _registrations[registrant] = registrant;\n emit RegistrationUpdated(registrant, true);\n _copyEntries(registrant, registrantToCopy);\n }\n\n /**\n * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered.\n */\n function updateOperator(\n address registrant,\n address operator,\n bool filtered\n ) external override onlyAddressOrOwner(registrant) {\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert(\"Not registered\");\n }\n if (registration != registrant) {\n revert(\"Cannot update while subscribed\");\n }\n EnumerableSet.AddressSet storage filteredOperatorsRef = _filteredOperators[registrant];\n\n if (!filtered) {\n bool removed = filteredOperatorsRef.remove(operator);\n if (!removed) {\n revert(\"Address not filtered\");\n }\n } else {\n bool added = filteredOperatorsRef.add(operator);\n if (!added) {\n revert(\"Address already filtered\");\n }\n }\n emit OperatorUpdated(registrant, operator, filtered);\n }\n\n /**\n * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.\n */\n function updateCodeHash(\n address registrant,\n bytes32 codeHash,\n bool filtered\n ) external override onlyAddressOrOwner(registrant) {\n if (codeHash == EOA_CODEHASH) {\n revert(\"Cannot filter EOAs\");\n }\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert(\"Not registered\");\n }\n if (registration != registrant) {\n revert(\"Cannot update while subscribed\");\n }\n EnumerableSet.Bytes32Set storage filteredCodeHashesRef = _filteredCodeHashes[registrant];\n\n if (!filtered) {\n bool removed = filteredCodeHashesRef.remove(codeHash);\n if (!removed) {\n revert(\"Codehash not filtered\");\n }\n } else {\n bool added = filteredCodeHashesRef.add(codeHash);\n if (!added) {\n revert(\"Codehash already filtered\");\n }\n }\n emit CodeHashUpdated(registrant, codeHash, filtered);\n }\n\n /**\n * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.\n */\n function updateOperators(\n address registrant,\n address[] calldata operators,\n bool filtered\n ) external override onlyAddressOrOwner(registrant) {\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert(\"Not registered\");\n }\n if (registration != registrant) {\n revert(\"Cannot update while subscribed\");\n }\n EnumerableSet.AddressSet storage filteredOperatorsRef = _filteredOperators[registrant];\n uint256 operatorsLength = operators.length;\n unchecked {\n if (!filtered) {\n for (uint256 i = 0; i < operatorsLength; ++i) {\n address operator = operators[i];\n bool removed = filteredOperatorsRef.remove(operator);\n if (!removed) {\n revert(\"Address not filtered\");\n }\n }\n } else {\n for (uint256 i = 0; i < operatorsLength; ++i) {\n address operator = operators[i];\n bool added = filteredOperatorsRef.add(operator);\n if (!added) {\n revert(\"Address already filtered\");\n }\n }\n }\n }\n emit OperatorsUpdated(registrant, operators, filtered);\n }\n\n /**\n * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.\n */\n function updateCodeHashes(\n address registrant,\n bytes32[] calldata codeHashes,\n bool filtered\n ) external override onlyAddressOrOwner(registrant) {\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert(\"Not registered\");\n }\n if (registration != registrant) {\n revert(\"Cannot update while subscribed\");\n }\n EnumerableSet.Bytes32Set storage filteredCodeHashesRef = _filteredCodeHashes[registrant];\n uint256 codeHashesLength = codeHashes.length;\n unchecked {\n if (!filtered) {\n for (uint256 i = 0; i < codeHashesLength; ++i) {\n bytes32 codeHash = codeHashes[i];\n bool removed = filteredCodeHashesRef.remove(codeHash);\n if (!removed) {\n revert(\"Codehash not filtered\");\n }\n }\n } else {\n for (uint256 i = 0; i < codeHashesLength; ++i) {\n bytes32 codeHash = codeHashes[i];\n if (codeHash == EOA_CODEHASH) {\n revert(\"Cannot filter EOAs\");\n }\n bool added = filteredCodeHashesRef.add(codeHash);\n if (!added) {\n revert(\"Codehash already filtered\");\n }\n }\n }\n }\n emit CodeHashesUpdated(registrant, codeHashes, filtered);\n }\n\n /**\n * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous\n * subscription if present.\n * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,\n * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be\n * used.\n */\n function subscribe(address registrant, address newSubscription) external override onlyAddressOrOwner(registrant) {\n if (registrant == newSubscription) {\n revert(\"Cannot subscribe to self\");\n }\n if (newSubscription == address(0)) {\n revert(\"Cannot subscribe to zero address\");\n }\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert(\"Not registered\");\n }\n if (registration == newSubscription) {\n revert(\"Already subscribed\");\n }\n address newSubscriptionRegistration = _registrations[newSubscription];\n if (newSubscriptionRegistration == address(0)) {\n revert(\"New subscription not registered\");\n }\n if (newSubscriptionRegistration != newSubscription) {\n revert(\"Cannot Subscribe to registrant with subscription\");\n }\n\n if (registration != registrant) {\n _subscribers[registration].remove(registrant);\n emit SubscriptionUpdated(registrant, registration, false);\n }\n _registrations[registrant] = newSubscription;\n _subscribers[newSubscription].add(registrant);\n emit SubscriptionUpdated(registrant, newSubscription, true);\n }\n\n /**\n * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.\n */\n function unsubscribe(address registrant, bool copyExistingEntries)\n external\n override\n onlyAddressOrOwner(registrant)\n {\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert(\"Not registered\");\n }\n if (registration == registrant) {\n revert(\"Not subscribed\");\n }\n _subscribers[registration].remove(registrant);\n _registrations[registrant] = registrant;\n emit SubscriptionUpdated(registrant, registration, false);\n if (copyExistingEntries) {\n _copyEntries(registrant, registration);\n }\n }\n\n /**\n * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.\n */\n function copyEntriesOf(address registrant, address registrantToCopy)\n external\n override\n onlyAddressOrOwner(registrant)\n {\n if (registrant == registrantToCopy) {\n revert(\"Cannot copy from self\");\n }\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert(\"Not registered\");\n }\n if (registration != registrant) {\n revert(\"Cannot upgrade while subscribed\");\n }\n address registrantRegistration = _registrations[registrantToCopy];\n if (registrantRegistration == address(0)) {\n revert(\"Registrant not registered\");\n }\n _copyEntries(registrant, registrantToCopy);\n }\n\n /// @dev helper to copy entries from registrantToCopy to registrant and emit events\n function _copyEntries(address registrant, address registrantToCopy) private {\n EnumerableSet.AddressSet storage filteredOperatorsRef = _filteredOperators[registrantToCopy];\n EnumerableSet.Bytes32Set storage filteredCodeHashesRef = _filteredCodeHashes[registrantToCopy];\n uint256 filteredOperatorsLength = filteredOperatorsRef.length();\n uint256 filteredCodeHashesLength = filteredCodeHashesRef.length();\n unchecked {\n for (uint256 i = 0; i < filteredOperatorsLength; ++i) {\n address operator = filteredOperatorsRef.at(i);\n bool added = _filteredOperators[registrant].add(operator);\n if (added) {\n emit OperatorUpdated(registrant, operator, true);\n }\n }\n for (uint256 i = 0; i < filteredCodeHashesLength; ++i) {\n bytes32 codehash = filteredCodeHashesRef.at(i);\n bool added = _filteredCodeHashes[registrant].add(codehash);\n if (added) {\n emit CodeHashUpdated(registrant, codehash, true);\n }\n }\n }\n }\n\n //////////////////\n // VIEW METHODS //\n //////////////////\n\n /**\n * @notice Get the subscription address of a given registrant, if any.\n */\n function subscriptionOf(address registrant) external view override returns (address subscription) {\n subscription = _registrations[registrant];\n if (subscription == address(0)) {\n revert(\"Not registered\");\n } else if (subscription == registrant) {\n subscription = address(0);\n }\n }\n\n /**\n * @notice Get the set of addresses subscribed to a given registrant.\n * Note that order is not guaranteed as updates are made.\n */\n function subscribers(address registrant) external view override returns (address[] memory) {\n return _subscribers[registrant].values();\n }\n\n /**\n * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.\n * Note that order is not guaranteed as updates are made.\n */\n function subscriberAt(address registrant, uint256 index) external view override returns (address) {\n return _subscribers[registrant].at(index);\n }\n\n /**\n * @notice Returns true if operator is filtered by a given address or its subscription.\n */\n function isOperatorFiltered(address registrant, address operator) external view override returns (bool) {\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredOperators[registration].contains(operator);\n }\n return _filteredOperators[registrant].contains(operator);\n }\n\n /**\n * @notice Returns true if a codeHash is filtered by a given address or its subscription.\n */\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external view override returns (bool) {\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredCodeHashes[registration].contains(codeHash);\n }\n return _filteredCodeHashes[registrant].contains(codeHash);\n }\n\n /**\n * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription.\n */\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external view override returns (bool) {\n bytes32 codeHash = operatorWithCode.codehash;\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredCodeHashes[registration].contains(codeHash);\n }\n return _filteredCodeHashes[registrant].contains(codeHash);\n }\n\n /**\n * @notice Returns true if an address has registered\n */\n function isRegistered(address registrant) external view override returns (bool) {\n return _registrations[registrant] != address(0);\n }\n\n /**\n * @notice Returns a list of filtered operators for a given address or its subscription.\n */\n function filteredOperators(address registrant) external view override returns (address[] memory) {\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredOperators[registration].values();\n }\n return _filteredOperators[registrant].values();\n }\n\n /**\n * @notice Returns the set of filtered codeHashes for a given address or its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredCodeHashes(address registrant) external view override returns (bytes32[] memory) {\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredCodeHashes[registration].values();\n }\n return _filteredCodeHashes[registrant].values();\n }\n\n /**\n * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or\n * its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredOperatorAt(address registrant, uint256 index) external view override returns (address) {\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredOperators[registration].at(index);\n }\n return _filteredOperators[registrant].at(index);\n }\n\n /**\n * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or\n * its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredCodeHashAt(address registrant, uint256 index) external view override returns (bytes32) {\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredCodeHashes[registration].at(index);\n }\n return _filteredCodeHashes[registrant].at(index);\n }\n\n /// @dev Convenience method to compute the code hash of an arbitrary contract\n function codeHashOf(address a) external view override returns (bytes32) {\n return a.codehash;\n }\n}\n" + }, + "src/solc_0.8/test/MockPolygonAssetERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {PolygonAssetERC1155} from \"../polygon/child/asset/PolygonAssetERC1155.sol\";\nimport \"../asset/libraries/ERC1155ERC721Helper.sol\";\nimport {IOperatorFilterRegistry} from \"../OperatorFilterer/interfaces/IOperatorFilterRegistry.sol\";\n\ncontract MockPolygonAssetERC1155 is PolygonAssetERC1155 {\n function setOperatorRegistry(address registry) external {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n }\n\n function registerAndSubscribe(address subsciption) external {\n operatorFilterRegistry.registerAndSubscribe(address(this), subsciption);\n }\n\n function setApprovalForAllWithOutFilter(address operator, bool approved) external {\n super._setApprovalForAll(_msgSender(), operator, approved);\n }\n\n function mintWithOutBouncerCheck(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256 supply,\n address owner,\n bytes calldata data\n ) external returns (uint256 id) {\n require(hash != 0, \"HASH==0\");\n require(owner != address(0), \"TO==0\");\n id = _generateTokenId(creator, supply, packId, supply == 1 ? 0 : 1, 0);\n uint256 uriId = id & ERC1155ERC721Helper.URI_ID;\n require(uint256(_metadataHash[uriId]) == 0, \"ID_TAKEN\");\n _metadataHash[uriId] = hash;\n _mint(_msgSender(), owner, id, supply, data);\n }\n}\n" + }, + "src/solc_0.8/test/MockPolygonAssetERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {PolygonAssetERC721} from \"../polygon/child/asset/PolygonAssetERC721.sol\";\nimport {BaseERC721} from \"../assetERC721/BaseERC721.sol\";\nimport {IOperatorFilterRegistry} from \"../OperatorFilterer/interfaces/IOperatorFilterRegistry.sol\";\n\ncontract MockPolygonAssetERC721 is PolygonAssetERC721 {\n function setOperatorRegistry(address registry) external {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n }\n\n function registerAndSubscribe(address subsciption) external {\n operatorFilterRegistry.registerAndSubscribe(address(this), subsciption);\n }\n\n function setApprovalForAllWithOutFilter(address operator, bool approved) external {\n super._setApprovalForAll(_msgSender(), operator, approved);\n }\n\n function mintWithOutMinterCheck(address to, uint256 id) external {\n BaseERC721.mint(to, id);\n }\n}\n" + }, + "src/solc_0.8/test/MockPolygonLandV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"../polygon/child/land/PolygonLandV2.sol\";\n\ncontract MockPolygonLandV2 is PolygonLandV2 {\n /// @notice sets filter registry address deployed in test\n /// @param registry the address of the registry\n function setOperatorRegistry(address registry) external override {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n }\n\n /// @notice sets Approvals with operator filterer check in case to test the transfer.\n /// @param operator address of the operator to be approved\n /// @param approved bool value denoting approved (true) or not Approved(false)\n function setApprovalForAllWithOutFilter(address operator, bool approved) external {\n super._setApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @notice Mint a new quad without a minter (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\n * @param user The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintQuad(\n address user,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) external override {\n _mintQuad(user, size, x, y, data);\n }\n\n /// @notice This function is used to register Land contract on the Operator Filterer Registry of Opensea.can only be called by admin.\n /// @dev used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.\n /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe.\n /// @param subscribe bool to signify subscription \"true\"\" or to copy the list \"false\".\n function registerFilterer(address subscriptionOrRegistrantToCopy, bool subscribe) external {\n _register(subscriptionOrRegistrantToCopy, subscribe);\n }\n}\n" + }, + "src/solc_0.8/test/MockSafeMathWithRequire.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../common/Libraries/SafeMathWithRequire.sol\";\n\n/**\n * @title SafeMathWithRequire\n * @dev Specific Mock to test SafeMathWithRequire\n */\ncontract MockSafeMathWithRequire {\n function sqrt6(uint256 a) external pure returns (uint256 c) {\n return SafeMathWithRequire.sqrt6(a);\n }\n\n function sqrt3(uint256 a) external pure returns (uint256 c) {\n return SafeMathWithRequire.sqrt3(a);\n }\n\n function cbrt6(uint256 a) external pure returns (uint256 c) {\n return SafeMathWithRequire.cbrt6(a);\n }\n\n function cbrt3(uint256 a) external pure returns (uint256 c) {\n return SafeMathWithRequire.cbrt3(a);\n }\n}\n" + }, + "src/solc_0.8/test/OperatorFilterRegistryEvents.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ncontract OperatorFilterRegistryEvents {\n event RegistrationUpdated(address indexed registrant, bool indexed registered);\n\n event OperatorUpdated(address indexed registrant, address indexed operator, bool indexed filtered);\n\n event OperatorsUpdated(address indexed registrant, address[] operators, bool indexed filtered);\n\n event CodeHashUpdated(address indexed registrant, bytes32 indexed codeHash, bool indexed filtered);\n\n event CodeHashesUpdated(address indexed registrant, bytes32[] codeHashes, bool indexed filtered);\n\n event SubscriptionUpdated(address indexed registrant, address indexed subscription, bool indexed subscribed);\n}\n" + }, + "src/solc_0.8/test/PayableMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ncontract PayableMock {\n bool public called;\n bool public fallbackCalled;\n bool public receiveCalled;\n\n function payME() external payable {\n called = true;\n }\n\n function callME() external {\n called = true;\n }\n\n fallback() external payable {\n fallbackCalled = true;\n }\n\n receive() external payable {\n receiveCalled = true;\n }\n}\n" + }, + "src/solc_0.8/test/PolygonLandWeightedSANDRewardPoolNFTTest.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../polygon/LiquidityMining/PolygonLandWeightedSANDRewardPool.sol\";\n\ncontract PolygonLandWeightedSANDRewardPoolNFTTest is PolygonLandWeightedSANDRewardPool {\n constructor(\n address stakeTokenContract,\n address rewardTokenContract,\n address nftContract,\n uint256 rewardDuration\n )\n PolygonLandWeightedSANDRewardPool(\n IERC20(stakeTokenContract),\n IERC20(rewardTokenContract),\n IERC721(nftContract),\n rewardDuration\n )\n // solhint-disable-next-line no-empty-blocks\n {\n\n }\n}\n" + }, + "src/solc_0.8/test/RewardCalculatorMock.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"../defi/interfaces/IRewardCalculator.sol\";\n\ncontract RewardCalculatorMock is IRewardCalculator {\n event RewardRestarted();\n\n uint256 public reward;\n bool public skipRestart;\n\n // At any point in time this function must return the accumulated rewards from last call to restartRewards\n function getRewards() external view override returns (uint256) {\n return reward;\n }\n\n function restartRewards() external override {\n if (!skipRestart) {\n reward = 0;\n }\n emit RewardRestarted();\n }\n\n function setReward(uint256 reward_) external {\n reward = reward_;\n }\n\n function setSkipRestart(bool val) external {\n skipRestart = val;\n }\n}\n" + }, + "src/solc_0.8/test/TestEIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/utils/cryptography/ECDSA.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712 {\n /* solhint-disable var-name-mixedcase */\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n // invalidate the cached domain separator if the chain id changes.\n // bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;\n // uint256 private immutable _CACHED_CHAIN_ID;\n\n bytes32 private immutable _HASHED_NAME;\n bytes32 private immutable _HASHED_VERSION;\n bytes32 private immutable _TYPE_HASH;\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n constructor(string memory name, string memory version) {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n bytes32 typeHash = keccak256(\"EIP712Domain(string name,string version,address verifyingContract)\");\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n // _CACHED_CHAIN_ID = block.chainid;\n // _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n _TYPE_HASH = typeHash;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n // if (block.chainid == _CACHED_CHAIN_ID) {\n // return _CACHED_DOMAIN_SEPARATOR;\n // } else {\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n // }\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 name,\n bytes32 version\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, name, version, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n}\n" + }, + "src/solc_0.8/test/TestMetaTxForwarder.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/utils/cryptography/ECDSA.sol\";\nimport \"./TestEIP712.sol\";\n\n// @note !!! For Testing Only !!!\n// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\ncontract TestMetaTxForwarder is EIP712 {\n using ECDSA for bytes32;\n event TXResult(bool success, bytes returndata);\n\n struct ForwardRequest {\n address from;\n address to;\n uint256 value;\n uint256 gas;\n uint256 nonce;\n bytes data;\n }\n\n bytes32 private constant TYPEHASH =\n keccak256(\"ForwardRequest(address from,address to,uint256 value,uint256 gas,uint256 nonce,bytes data)\");\n\n mapping(address => uint256) private _nonces;\n\n // solhint-disable no-empty-blocks\n constructor() EIP712(\"The Sandbox\", \"1\") {}\n\n // solhint-enable no-empty-blocks\n\n function getNonce(address from) public view returns (uint256) {\n return _nonces[from];\n }\n\n function verify(ForwardRequest calldata req, bytes calldata signature) public view returns (bool) {\n address signer =\n _hashTypedDataV4(\n keccak256(abi.encode(TYPEHASH, req.from, req.to, req.value, req.gas, req.nonce, keccak256(req.data)))\n )\n .recover(signature);\n return _nonces[req.from] == req.nonce && signer == req.from;\n }\n\n function execute(ForwardRequest calldata req, bytes calldata signature)\n public\n payable\n returns (bool, bytes memory)\n {\n require(verify(req, signature), \"MinimalForwarder: signature does not match request\");\n _nonces[req.from] = req.nonce + 1;\n\n // solhint-disable avoid-low-level-calls\n (bool success, bytes memory returndata) =\n req.to.call{gas: req.gas, value: req.value}(abi.encodePacked(req.data, req.from));\n // Validate that the relayer has sent enough gas for the call.\n // See https://ronan.eth.link/blog/ethereum-gas-dangers/\n assert(gasleft() > req.gas / 63);\n emit TXResult(success, returndata);\n // solhint-enable avoid-low-level-calls\n return (success, returndata);\n }\n}\n" + }, + "src/solc_0.8/Utils/Batch.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\npragma experimental ABIEncoderV2;\n\nimport \"@openzeppelin/contracts-0.8/utils/Address.sol\";\n\ncontract Batch {\n using Address for address;\n\n struct Execution {\n address target;\n bytes callData;\n }\n\n struct ExecutionWithETH {\n address target;\n bytes callData;\n uint256 value;\n }\n\n struct SingleTargetExecutionWithETH {\n bytes callData;\n uint256 value;\n }\n\n address public immutable executor;\n\n constructor(address _executor) {\n executor = _executor;\n }\n\n modifier onlyExecutor() {\n require(msg.sender == executor, \"NOT_AUTHORIZED\");\n _;\n }\n\n function atomicBatchWithETH(ExecutionWithETH[] calldata executions) external payable onlyExecutor {\n for (uint256 i = 0; i < executions.length; i++) {\n executions[i].target.functionCallWithValue(executions[i].callData, executions[i].value);\n }\n }\n\n function nonAtomicBatchWithETH(ExecutionWithETH[] calldata executions) external payable onlyExecutor {\n for (uint256 i = 0; i < executions.length; i++) {\n _call(executions[i].target, executions[i].callData, executions[i].value);\n }\n }\n\n function atomicBatch(Execution[] calldata executions) external onlyExecutor {\n for (uint256 i = 0; i < executions.length; i++) {\n executions[i].target.functionCall(executions[i].callData);\n }\n }\n\n function nonAtomicBatch(Execution[] calldata executions) external onlyExecutor {\n for (uint256 i = 0; i < executions.length; i++) {\n _call(executions[i].target, executions[i].callData, 0);\n }\n }\n\n function singleTargetAtomicBatchWithETH(address target, SingleTargetExecutionWithETH[] calldata executions)\n external\n payable\n onlyExecutor\n {\n for (uint256 i = 0; i < executions.length; i++) {\n target.functionCallWithValue(executions[i].callData, executions[i].value);\n }\n }\n\n function singleTargetNonAtomicBatchWithETH(address target, SingleTargetExecutionWithETH[] calldata executions)\n external\n payable\n onlyExecutor\n {\n for (uint256 i = 0; i < executions.length; i++) {\n _call(target, executions[i].callData, executions[i].value);\n }\n }\n\n function singleTargetAtomicBatch(address target, bytes[] calldata callDatas) external onlyExecutor {\n for (uint256 i = 0; i < callDatas.length; i++) {\n target.functionCall(callDatas[i]);\n }\n }\n\n function singleTargetNonAtomicBatch(address target, bytes[] calldata callDatas) external onlyExecutor {\n for (uint256 i = 0; i < callDatas.length; i++) {\n _call(target, callDatas[i], 0);\n }\n }\n\n function _call(\n address target,\n bytes calldata data,\n uint256 value\n ) internal returns (bool) {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, ) = target.call{value: value}(data);\n return success;\n }\n\n // ----------------------------------------------------------------------------------------------------\n // TOKEN RECEPTION\n // ----------------------------------------------------------------------------------------------------\n\n // ERC1155\n bytes4 private constant ERC1155_IS_RECEIVER = 0x4e2312e0;\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n\n // ERC721\n\n bytes4 private constant ERC721_IS_RECEIVER = 0x150b7a02;\n bytes4 private constant ERC721_RECEIVED = 0x150b7a02;\n\n function onERC721Received(\n address,\n address,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC721_RECEIVED;\n }\n\n // ERC165\n function supportsInterface(bytes4 _interfaceId) external pure returns (bool) {\n return _interfaceId == 0x01ffc9a7 || _interfaceId == ERC1155_IS_RECEIVER || _interfaceId == ERC721_IS_RECEIVER;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 2000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/core/deployments/mainnet/solcInputs/fcd35bfc0b4ed9a8e53dfc2c10882b4b.json b/packages/core/deployments/mainnet/solcInputs/fcd35bfc0b4ed9a8e53dfc2c10882b4b.json new file mode 100644 index 0000000000..3269517cc3 --- /dev/null +++ b/packages/core/deployments/mainnet/solcInputs/fcd35bfc0b4ed9a8e53dfc2c10882b4b.json @@ -0,0 +1,308 @@ +{ + "language": "Solidity", + "sources": { + "src/solc_0.5/Asset.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"./Asset/ERC1155ERC721.sol\";\n\ncontract Asset is ERC1155ERC721 {}\n" + }, + "src/solc_0.5/Asset/CommonMinter.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"./ERC1155ERC721.sol\";\nimport \"../contracts_common/Interfaces/ERC20.sol\";\nimport \"../contracts_common/BaseWithStorage/MetaTransactionReceiver.sol\";\nimport \"../contracts_common/Libraries/SafeMathWithRequire.sol\";\n\ncontract CommonMinter is MetaTransactionReceiver {\n using SafeMathWithRequire for uint256;\n\n uint256 _feePerCopy;\n\n ERC1155ERC721 _asset;\n mapping(address => bool) _minters;\n address _feeReceiver;\n ERC20 _sand;\n\n constructor(ERC1155ERC721 asset, ERC20 sand, uint256 feePerCopy, address admin, address feeReceiver)\n public\n {\n _sand = sand;\n _asset = asset;\n _feePerCopy = feePerCopy;\n _admin = admin;\n _feeReceiver = feeReceiver;\n _setMetaTransactionProcessor(address(sand), true);\n }\n\n /// @notice set the receiver of the proceeds\n /// @param newFeeReceiver address of the new fee receiver\n function setFeeReceiver(address newFeeReceiver) external {\n require(msg.sender == _admin, \"only admin can change the receiver\");\n _feeReceiver = newFeeReceiver;\n }\n\n /// @notice set the fee in Sand for each common Asset copies\n /// @param newFee new fee in Sand\n function setFeePerCopy(uint256 newFee) external {\n require(msg.sender == _admin, \"only admin allowed to set fee\");\n _feePerCopy = newFee;\n }\n\n /// @notice mint common Asset token by paying the Sand fee\n /// @param creator address creating the Asset, need to be the tx sender or meta tx signer\n /// @param packId unused packId that will let you predict the resulting tokenId\n /// @param hash cidv1 ipfs hash of the folder where 0.json file contains the metadata\n /// @param supply number of copies to mint, cost in Sand is relative it it\n /// @param owner address receiving the minted tokens\n /// @param data extra data\n /// @param feePerCopy fee in Sand for each copies\n function mintFor(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint32 supply,\n address owner,\n bytes calldata data,\n uint256 feePerCopy\n ) external returns (uint256 id) {\n require(creator == msg.sender || _metaTransactionContracts[msg.sender], \"not authorized\");\n require(feePerCopy == _feePerCopy, \"invalid fee\");\n require(_sand.transferFrom(creator, _feeReceiver, uint256(supply).mul(feePerCopy)), \"failed to transfer SAND\");\n return _asset.mint(creator, packId, hash, supply, 0, owner, data);\n }\n\n /// @notice mint multiple common Asset tokena by paying the Sand fee\n /// @param creator address creating the Asset, need to be the tx sender or meta tx signer\n /// @param packId unused packId that will let you predict the resulting tokenId\n /// @param hash cidv1 ipfs hash of the folder where 0.json file contains the metadata\n /// @param supplies number of copies to mint for each Asset, cost in Sand is relative it it\n /// @param owner address receiving the minted tokens\n /// @param data extra data\n /// @param feePerCopy fee in Sand for each copies\n function mintMultipleFor(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256[] calldata supplies,\n address owner,\n bytes calldata data,\n uint256 feePerCopy\n ) external returns (uint256[] memory ids) {\n require(creator == msg.sender || _metaTransactionContracts[msg.sender], \"not authorized\");\n require(feePerCopy == _feePerCopy, \"invalid fee\");\n uint256 totalCopies = 0;\n uint256 numAssetTypes = supplies.length;\n for (uint256 i = 0; i < numAssetTypes; i++) {\n totalCopies = totalCopies.add(supplies[i]);\n }\n require(_sand.transferFrom(creator, _feeReceiver, totalCopies.mul(feePerCopy)), \"failed to transfer SAND\");\n return\n _asset.mintMultiple(\n creator,\n packId,\n hash,\n supplies,\n \"\",\n owner,\n data\n );\n }\n}\n" + }, + "src/solc_0.5/Asset/erc1155/AssetApproveExtension.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../../contracts_common/Libraries/BytesUtil.sol\";\n\ncontract AssetApproveExtension {\n // will expect TheSandBox721\n\n mapping(address => mapping(address => uint256)) approvalMessages;\n // TODO mapping(address => mapping (uint256 => bool)) usedApprovalMessages;\n\n // TODO remove as we can use erc1155 totkensReceived hook\n function setApprovalForAllAndCall(address _target, bytes memory _data)\n public\n payable\n returns (bytes memory)\n {\n require(\n BytesUtil.doFirstParamEqualsAddress(_data, msg.sender),\n \"first param != sender\"\n );\n _setApprovalForAllFrom(msg.sender, _target, true);\n (bool success, bytes memory returnData) = _target.call.value(msg.value)(\n _data\n );\n require(success, \"Something went wrong with the extra call.\");\n return returnData;\n }\n\n function approveAllViaSignedMessage(\n address _target,\n uint256 _nonce,\n bytes calldata signature\n ) external {\n address signer; // TODO ecrecover(hash, v, r, s);\n require(approvalMessages[signer][_target]++ == _nonce);\n _setApprovalForAllFrom(signer, _target, true);\n }\n\n // TODO 2 signatures one for approve and one for call ?\n function approveAllAndCallViaSignedMessage(\n address _target,\n uint256 _nonce,\n bytes calldata _data,\n bytes calldata signature\n ) external payable returns (bytes memory) {\n address signer; // TODO ecrecover(hash, v, r, s);\n require(\n BytesUtil.doFirstParamEqualsAddress(_data, signer),\n \"first param != signer\"\n );\n require(approvalMessages[signer][_target]++ == _nonce);\n _setApprovalForAllFrom(signer, _target, true);\n (bool success, bytes memory returnData) = _target.call.value(msg.value)(\n _data\n );\n require(success, \"Something went wrong with the extra call.\");\n return returnData;\n }\n\n function _setApprovalForAllFrom(\n address owner,\n address _operator,\n bool _approved\n ) internal;\n\n}\n" + }, + "src/solc_0.5/Asset/ERC1155ERC721.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../contracts_common/Interfaces/ERC1155.sol\";\nimport \"../contracts_common/Interfaces/ERC1155TokenReceiver.sol\";\n\nimport \"../contracts_common/Libraries/AddressUtils.sol\";\nimport \"../contracts_common/Libraries/ObjectLib32.sol\";\n\nimport \"../contracts_common/Interfaces/ERC721.sol\";\nimport \"../contracts_common/Interfaces/ERC721TokenReceiver.sol\";\n\nimport \"../contracts_common/BaseWithStorage/SuperOperators.sol\";\n\ncontract ERC1155ERC721 is SuperOperators, ERC1155, ERC721 {\n using AddressUtils for address;\n using ObjectLib32 for ObjectLib32.Operations;\n using ObjectLib32 for uint256;\n\n bytes4 private constant ERC1155_IS_RECEIVER = 0x4e2312e0;\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n bytes4 private constant ERC721_RECEIVED = 0x150b7a02;\n\n uint256 private constant CREATOR_OFFSET_MULTIPLIER = uint256(2)**(256 - 160);\n uint256 private constant IS_NFT_OFFSET_MULTIPLIER = uint256(2)**(256 - 160 - 1);\n uint256 private constant PACK_ID_OFFSET_MULTIPLIER = uint256(2)**(256 - 160 - 1 - 32 - 40);\n uint256 private constant PACK_NUM_FT_TYPES_OFFSET_MULTIPLIER = uint256(2)**(256 - 160 - 1 - 32 - 40 - 12);\n uint256 private constant NFT_INDEX_OFFSET = 63;\n\n uint256 private constant IS_NFT = 0x0000000000000000000000000000000000000000800000000000000000000000;\n uint256 private constant NOT_IS_NFT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFFFFFFFFFFF;\n uint256 private constant NFT_INDEX = 0x00000000000000000000000000000000000000007FFFFFFF8000000000000000;\n uint256 private constant NOT_NFT_INDEX = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000007FFFFFFFFFFFFFFF;\n uint256 private constant URI_ID = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000007FFFFFFFFFFFF800;\n uint256 private constant PACK_ID = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000007FFFFFFFFF800000;\n uint256 private constant PACK_INDEX = 0x00000000000000000000000000000000000000000000000000000000000007FF;\n uint256 private constant PACK_NUM_FT_TYPES = 0x00000000000000000000000000000000000000000000000000000000007FF800;\n\n uint256 private constant MAX_SUPPLY = uint256(2)**32 - 1;\n uint256 private constant MAX_PACK_SIZE = uint256(2)**11;\n\n event CreatorshipTransfer(\n address indexed original,\n address indexed from,\n address indexed to\n );\n\n mapping(address => uint256) private _numNFTPerAddress; // erc721\n mapping(uint256 => uint256) private _owners; // erc721\n mapping(address => mapping(uint256 => uint256)) private _packedTokenBalance; // erc1155\n mapping(address => mapping(address => bool)) private _operatorsForAll; // erc721 and erc1155\n mapping(uint256 => address) private _erc721operators; // erc721\n mapping(uint256 => bytes32) private _metadataHash; // erc721 and erc1155\n mapping(uint256 => bytes) private _rarityPacks; // rarity configuration per packs (2 bits per Asset)\n mapping(uint256 => uint32) private _nextCollectionIndex; // extraction\n\n mapping(address => address) private _creatorship; // creatorship transfer\n\n mapping(address => bool) private _bouncers; // the contracts allowed to mint\n mapping(address => bool) private _metaTransactionContracts; // native meta-transaction support\n\n address private _bouncerAdmin;\n\n bool internal _init;\n\n function init(\n address metaTransactionContract,\n address admin,\n address bouncerAdmin\n ) public {\n require(!_init, \"ALREADY_INITIALISED\");\n _init = true;\n _metaTransactionContracts[metaTransactionContract] = true;\n _admin = admin;\n _bouncerAdmin = bouncerAdmin;\n emit MetaTransactionProcessor(metaTransactionContract, true);\n }\n\n event BouncerAdminChanged(address oldBouncerAdmin, address newBouncerAdmin);\n\n /// @notice Returns the current administrator in charge of minting rights.\n /// @return the current minting administrator in charge of minting rights.\n function getBouncerAdmin() external view returns(address) {\n return _bouncerAdmin;\n }\n\n /// @notice Change the minting administrator to be `newBouncerAdmin`.\n /// @param newBouncerAdmin address of the new minting administrator.\n function changeBouncerAdmin(address newBouncerAdmin) external {\n require(\n msg.sender == _bouncerAdmin,\n \"only bouncerAdmin can change itself\"\n );\n emit BouncerAdminChanged(_bouncerAdmin, newBouncerAdmin);\n _bouncerAdmin = newBouncerAdmin;\n }\n\n event Bouncer(address bouncer, bool enabled);\n\n /// @notice Enable or disable the ability of `bouncer` to mint tokens (minting bouncer rights).\n /// @param bouncer address that will be given/removed minting bouncer rights.\n /// @param enabled set whether the address is enabled or disabled as a minting bouncer.\n function setBouncer(address bouncer, bool enabled) external {\n require(\n msg.sender == _bouncerAdmin,\n \"only bouncerAdmin can setup bouncers\"\n );\n _bouncers[bouncer] = enabled;\n emit Bouncer(bouncer, enabled);\n }\n\n /// @notice check whether address `who` is given minting bouncer rights.\n /// @param who The address to query.\n /// @return whether the address has minting rights.\n function isBouncer(address who) external view returns(bool) {\n return _bouncers[who];\n }\n\n event MetaTransactionProcessor(address metaTransactionProcessor, bool enabled);\n\n /// @notice Enable or disable the ability of `metaTransactionProcessor` to perform meta-tx (metaTransactionProcessor rights).\n /// @param metaTransactionProcessor address that will be given/removed metaTransactionProcessor rights.\n /// @param enabled set whether the metaTransactionProcessor is enabled or disabled.\n function setMetaTransactionProcessor(address metaTransactionProcessor, bool enabled) external {\n require(\n msg.sender == _admin,\n \"only admin can setup metaTransactionProcessors\"\n );\n _metaTransactionContracts[metaTransactionProcessor] = enabled;\n emit MetaTransactionProcessor(metaTransactionProcessor, enabled);\n }\n\n /// @notice check whether address `who` is given meta-transaction execution rights.\n /// @param who The address to query.\n /// @return whether the address has meta-transaction execution rights.\n function isMetaTransactionProcessor(address who) external view returns(bool) {\n return _metaTransactionContracts[who];\n }\n\n /// @notice Mint a token type for `creator` on slot `packId`.\n /// @param creator address of the creator of the token.\n /// @param packId unique packId for that token.\n /// @param hash hash of an IPFS cidv1 folder that contains the metadata of the token type in the file 0.json.\n /// @param supply number of tokens minted for that token type.\n /// @param rarity rarity power of the token.\n /// @param owner address that will receive the tokens.\n /// @param data extra data to accompany the minting call.\n /// @return the id of the newly minted token type.\n function mint(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256 supply,\n uint8 rarity,\n address owner,\n bytes calldata data\n ) external returns (uint256 id) {\n require(hash != 0, \"hash is zero\");\n require(_bouncers[msg.sender], \"only bouncer allowed to mint\");\n require(owner != address(0), \"destination is zero address\");\n id = generateTokenId(creator, supply, packId, supply == 1 ? 0 : 1, 0);\n _mint(\n hash,\n supply,\n rarity,\n msg.sender,\n owner,\n id,\n data,\n false\n );\n }\n\n function generateTokenId(\n address creator,\n uint256 supply,\n uint40 packId,\n uint16 numFTs,\n uint16 packIndex\n ) internal pure returns (uint256) {\n require(supply > 0 && supply <= MAX_SUPPLY, \"invalid supply\");\n\n return\n uint256(creator) * CREATOR_OFFSET_MULTIPLIER + // CREATOR\n (supply == 1 ? uint256(1) * IS_NFT_OFFSET_MULTIPLIER : 0) + // minted as NFT (1) or FT (0) // IS_NFT\n uint256(packId) * PACK_ID_OFFSET_MULTIPLIER + // packId (unique pack) // PACk_ID\n numFTs * PACK_NUM_FT_TYPES_OFFSET_MULTIPLIER + // number of fungible token in the pack // PACK_NUM_FT_TYPES\n packIndex; // packIndex (position in the pack) // PACK_INDEX\n }\n\n function _mint(\n bytes32 hash,\n uint256 supply,\n uint8 rarity,\n address operator,\n address owner,\n uint256 id,\n bytes memory data,\n bool extraction\n ) internal {\n uint256 uriId = id & URI_ID;\n if (!extraction) {\n require(uint256(_metadataHash[uriId]) == 0, \"id already used\");\n _metadataHash[uriId] = hash;\n require(rarity < 4, \"rarity >= 4\");\n bytes memory pack = new bytes(1);\n pack[0] = bytes1(rarity * 64);\n _rarityPacks[uriId] = pack;\n }\n if (supply == 1) {\n // ERC721\n _numNFTPerAddress[owner]++;\n _owners[id] = uint256(owner);\n emit Transfer(address(0), owner, id);\n } else {\n (uint256 bin, uint256 index) = id.getTokenBinIndex();\n _packedTokenBalance[owner][bin] = _packedTokenBalance[owner][bin]\n .updateTokenBalance(\n index,\n supply,\n ObjectLib32.Operations.REPLACE\n );\n }\n\n emit TransferSingle(operator, address(0), owner, id, supply);\n require(\n _checkERC1155AndCallSafeTransfer(\n operator,\n address(0),\n owner,\n id,\n supply,\n data,\n false,\n false\n ),\n \"transfer rejected\"\n );\n }\n\n /// @notice Mint multiple token types for `creator` on slot `packId`.\n /// @param creator address of the creator of the tokens.\n /// @param packId unique packId for the tokens.\n /// @param hash hash of an IPFS cidv1 folder that contains the metadata of each token type in the files: 0.json, 1.json, 2.json, etc...\n /// @param supplies number of tokens minted for each token type.\n /// @param rarityPack rarity power of each token types packed into 2 bits each.\n /// @param owner address that will receive the tokens.\n /// @param data extra data to accompany the minting call.\n /// @return the ids of each newly minted token types.\n function mintMultiple(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256[] calldata supplies,\n bytes calldata rarityPack,\n address owner,\n bytes calldata data\n ) external returns (uint256[] memory ids) {\n require(hash != 0, \"hash is zero\");\n require(_bouncers[msg.sender], \"only bouncer allowed to mint\");\n require(owner != address(0), \"destination is zero address\");\n uint16 numNFTs;\n (ids, numNFTs) = allocateIds(\n creator,\n supplies,\n rarityPack,\n packId,\n hash\n );\n _mintBatches(supplies, owner, ids, numNFTs);\n completeMultiMint(msg.sender, owner, ids, supplies, data);\n }\n\n function allocateIds(\n address creator,\n uint256[] memory supplies,\n bytes memory rarityPack,\n uint40 packId,\n bytes32 hash\n ) internal returns (uint256[] memory ids, uint16 numNFTs) {\n require(supplies.length > 0, \"supplies.length == 0\");\n require(supplies.length <= MAX_PACK_SIZE, \"too big batch\");\n (ids, numNFTs) = generateTokenIds(creator, supplies, packId);\n uint256 uriId = ids[0] & URI_ID;\n require(uint256(_metadataHash[uriId]) == 0, \"id already used\");\n _metadataHash[uriId] = hash;\n _rarityPacks[uriId] = rarityPack;\n }\n\n function generateTokenIds(\n address creator,\n uint256[] memory supplies,\n uint40 packId\n ) internal pure returns (uint256[] memory, uint16) {\n uint16 numTokenTypes = uint16(supplies.length);\n uint256[] memory ids = new uint256[](numTokenTypes);\n uint16 numNFTs = 0;\n for (uint16 i = 0; i < numTokenTypes; i++) {\n if (numNFTs == 0) {\n if (supplies[i] == 1) {\n numNFTs = uint16(numTokenTypes - i);\n }\n } else {\n require(supplies[i] == 1, \"NFTs need to be put at the end\");\n }\n }\n uint16 numFTs = numTokenTypes - numNFTs;\n for (uint16 i = 0; i < numTokenTypes; i++) {\n ids[i] = generateTokenId(creator, supplies[i], packId, numFTs, i);\n }\n return (ids, numNFTs);\n }\n\n function completeMultiMint(\n address operator,\n address owner,\n uint256[] memory ids,\n uint256[] memory supplies,\n bytes memory data\n ) internal {\n emit TransferBatch(operator, address(0), owner, ids, supplies);\n require(\n _checkERC1155AndCallSafeBatchTransfer(\n operator,\n address(0),\n owner,\n ids,\n supplies,\n data\n ),\n \"transfer rejected\"\n );\n }\n\n function _mintBatches(\n uint256[] memory supplies,\n address owner,\n uint256[] memory ids,\n uint16 numNFTs\n ) internal {\n uint16 offset = 0;\n while (offset < supplies.length - numNFTs) {\n _mintBatch(offset, supplies, owner, ids);\n offset += 8;\n }\n // deal with NFT last. they do not care of balance packing\n if (numNFTs > 0) {\n _mintNFTs(\n uint16(supplies.length - numNFTs),\n numNFTs,\n owner,\n ids\n );\n }\n }\n\n function _mintNFTs(\n uint16 offset,\n uint32 numNFTs,\n address owner,\n uint256[] memory ids\n ) internal {\n for (uint16 i = 0; i < numNFTs; i++) {\n uint256 id = ids[i + offset];\n _owners[id] = uint256(owner);\n emit Transfer(address(0), owner, id);\n }\n _numNFTPerAddress[owner] += numNFTs;\n }\n\n function _mintBatch(\n uint16 offset,\n uint256[] memory supplies,\n address owner,\n uint256[] memory ids\n ) internal {\n uint256 firstId = ids[offset];\n (uint256 bin, uint256 index) = firstId.getTokenBinIndex();\n uint256 balances = _packedTokenBalance[owner][bin];\n for (uint256 i = 0; i < 8 && offset + i < supplies.length; i++) {\n uint256 j = offset + i;\n if (supplies[j] > 1) {\n balances = balances.updateTokenBalance(\n index + i,\n supplies[j],\n ObjectLib32.Operations.REPLACE\n );\n } else {\n break;\n }\n }\n _packedTokenBalance[owner][bin] = balances;\n }\n\n function _transferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value\n ) internal returns (bool metaTx) {\n require(to != address(0), \"destination is zero address\");\n require(from != address(0), \"from is zero address\");\n metaTx = _metaTransactionContracts[msg.sender];\n bool authorized = from == msg.sender ||\n metaTx ||\n _superOperators[msg.sender] ||\n _operatorsForAll[from][msg.sender];\n\n if (id & IS_NFT > 0) {\n require(\n authorized || _erc721operators[id] == msg.sender,\n \"Operator not approved\"\n );\n if(value > 0) {\n require(value == 1, \"cannot transfer nft if amount not 1\");\n _numNFTPerAddress[from]--;\n _numNFTPerAddress[to]++;\n _owners[id] = uint256(to);\n if (_erc721operators[id] != address(0)) { // TODO operatorEnabled flag optimization (like in ERC721BaseToken)\n _erc721operators[id] = address(0);\n }\n emit Transfer(from, to, id);\n }\n } else {\n require(authorized, \"Operator not approved\");\n if(value > 0) {\n // if different owners it will fails\n (uint256 bin, uint256 index) = id.getTokenBinIndex();\n _packedTokenBalance[from][bin] = _packedTokenBalance[from][bin]\n .updateTokenBalance(index, value, ObjectLib32.Operations.SUB);\n _packedTokenBalance[to][bin] = _packedTokenBalance[to][bin]\n .updateTokenBalance(index, value, ObjectLib32.Operations.ADD);\n }\n }\n\n emit TransferSingle(\n metaTx ? from : msg.sender,\n from,\n to,\n id,\n value\n );\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param value amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external {\n if (id & IS_NFT > 0) {\n require(_ownerOf(id) == from, \"not owner\");\n }\n bool metaTx = _transferFrom(from, to, id, value);\n require(\n _checkERC1155AndCallSafeTransfer(\n metaTx ? from : msg.sender,\n from,\n to,\n id,\n value,\n data,\n false,\n false\n ),\n \"erc1155 transfer rejected\"\n );\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @dev call data should be optimized to order ids so packedBalance can be used efficiently.\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param values amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external {\n require(\n ids.length == values.length,\n \"Inconsistent array length between args\"\n );\n require(to != address(0), \"destination is zero address\");\n require(from != address(0), \"from is zero address\");\n bool metaTx = _metaTransactionContracts[msg.sender];\n bool authorized = from == msg.sender ||\n metaTx ||\n _superOperators[msg.sender] ||\n _operatorsForAll[from][msg.sender]; // solium-disable-line max-len\n\n _batchTransferFrom(from, to, ids, values, authorized);\n emit TransferBatch(\n metaTx ? from : msg.sender,\n from,\n to,\n ids,\n values\n );\n require(\n _checkERC1155AndCallSafeBatchTransfer(\n metaTx ? from : msg.sender,\n from,\n to,\n ids,\n values,\n data\n ),\n \"erc1155 transfer rejected\"\n );\n }\n\n function _batchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory values,\n bool authorized\n ) internal {\n uint256 numItems = ids.length;\n uint256 bin;\n uint256 index;\n uint256 balFrom;\n uint256 balTo;\n\n uint256 lastBin;\n uint256 numNFTs = 0;\n for (uint256 i = 0; i < numItems; i++) {\n if (ids[i] & IS_NFT > 0) {\n require(\n authorized || _erc721operators[ids[i]] == msg.sender,\n \"Operator not approved\"\n );\n if(values[i] > 0) {\n require(values[i] == 1, \"cannot transfer nft if amount not 1\");\n require(_ownerOf(ids[i]) == from, \"not owner\");\n numNFTs++;\n _owners[ids[i]] = uint256(to);\n if (_erc721operators[ids[i]] != address(0)) { // TODO operatorEnabled flag optimization (like in ERC721BaseToken)\n _erc721operators[ids[i]] = address(0);\n }\n emit Transfer(from, to, ids[i]);\n }\n } else {\n require(authorized, \"Operator not approved\");\n if (from == to) {\n _checkEnoughBalance(from, ids[i], values[i]);\n } else if(values[i] > 0) {\n (bin, index) = ids[i].getTokenBinIndex();\n if (lastBin == 0) {\n lastBin = bin;\n balFrom = ObjectLib32.updateTokenBalance(\n _packedTokenBalance[from][bin],\n index,\n values[i],\n ObjectLib32.Operations.SUB\n );\n balTo = ObjectLib32.updateTokenBalance(\n _packedTokenBalance[to][bin],\n index,\n values[i],\n ObjectLib32.Operations.ADD\n );\n } else {\n if (bin != lastBin) {\n _packedTokenBalance[from][lastBin] = balFrom;\n _packedTokenBalance[to][lastBin] = balTo;\n balFrom = _packedTokenBalance[from][bin];\n balTo = _packedTokenBalance[to][bin];\n lastBin = bin;\n }\n\n balFrom = balFrom.updateTokenBalance(\n index,\n values[i],\n ObjectLib32.Operations.SUB\n );\n balTo = balTo.updateTokenBalance(\n index,\n values[i],\n ObjectLib32.Operations.ADD\n );\n }\n }\n }\n }\n if (numNFTs > 0 && from != to) {\n _numNFTPerAddress[from] -= numNFTs;\n _numNFTPerAddress[to] += numNFTs;\n }\n\n if (bin != 0 && from != to) {\n _packedTokenBalance[from][bin] = balFrom;\n _packedTokenBalance[to][bin] = balTo;\n }\n }\n\n function _checkEnoughBalance(address from, uint256 id, uint256 value) internal {\n (uint256 bin, uint256 index) = id.getTokenBinIndex();\n require(_packedTokenBalance[from][bin].getValueInBin(index) >= value, \"can't substract more than there is\");\n }\n\n /// @notice Get the balance of `owner` for the token type `id`.\n /// @param owner The address of the token holder.\n /// @param id the token type of which to get the balance of.\n /// @return the balance of `owner` for the token type `id`.\n function balanceOf(address owner, uint256 id)\n public\n view\n returns (uint256)\n {\n // do not check for existence, balance is zero if never minted\n // require(wasEverMinted(id), \"token was never minted\");\n if (id & IS_NFT > 0) {\n if (_ownerOf(id) == owner) {\n return 1;\n } else {\n return 0;\n }\n }\n (uint256 bin, uint256 index) = id.getTokenBinIndex();\n return _packedTokenBalance[owner][bin].getValueInBin(index);\n }\n\n /// @notice Get the balance of `owners` for each token type `ids`.\n /// @param owners the addresses of the token holders queried.\n /// @param ids ids of each token type to query.\n /// @return the balance of each `owners` for each token type `ids`.\n function balanceOfBatch(\n address[] calldata owners,\n uint256[] calldata ids\n ) external view returns (uint256[] memory) {\n require(\n owners.length == ids.length,\n \"Inconsistent array length between args\"\n );\n uint256[] memory balances = new uint256[](ids.length);\n for (uint256 i = 0; i < ids.length; i++) {\n balances[i] = balanceOf(owners[i], ids[i]);\n }\n return balances;\n }\n\n /// @notice Get the creator of the token type `id`.\n /// @param id the id of the token to get the creator of.\n /// @return the creator of the token type `id`.\n function creatorOf(uint256 id) external view returns (address) {\n require(wasEverMinted(id), \"token was never minted\");\n address originalCreator = address(id / CREATOR_OFFSET_MULTIPLIER);\n address newCreator = _creatorship[originalCreator];\n if (newCreator != address(0)) {\n return newCreator;\n }\n return originalCreator;\n }\n\n /// @notice Transfers creatorship of `original` from `sender` to `to`.\n /// @param sender address of current registered creator.\n /// @param original address of the original creator whose creation are saved in the ids themselves.\n /// @param to address which will be given creatorship for all tokens originally minted by `original`.\n function transferCreatorship(\n address sender,\n address original,\n address to\n ) external {\n require(\n msg.sender == sender ||\n _metaTransactionContracts[msg.sender] ||\n _superOperators[msg.sender],\n \"require meta approval\"\n );\n require(sender != address(0), \"sender is zero address\");\n require(to != address(0), \"destination is zero address\");\n address current = _creatorship[original];\n if (current == address(0)) {\n current = original;\n }\n require(current != to, \"current == to\");\n require(current == sender, \"current != sender\");\n if (to == original) {\n _creatorship[original] = address(0);\n } else {\n _creatorship[original] = to;\n }\n emit CreatorshipTransfer(original, current, to);\n }\n\n /// @notice Enable or disable approval for `operator` to manage all `sender`'s tokens.\n /// @dev used for Meta Transaction (from metaTransactionContract).\n /// @param sender address which grant approval.\n /// @param operator address which will be granted rights to transfer all token owned by `sender`.\n /// @param approved whether to approve or revoke.\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) external {\n require(\n msg.sender == sender ||\n _metaTransactionContracts[msg.sender] ||\n _superOperators[msg.sender],\n \"require meta approval\"\n );\n _setApprovalForAll(sender, operator, approved);\n }\n\n /// @notice Enable or disable approval for `operator` to manage all of the caller's tokens.\n /// @param operator address which will be granted rights to transfer all tokens of the caller.\n /// @param approved whether to approve or revoke\n function setApprovalForAll(address operator, bool approved) external {\n _setApprovalForAll(msg.sender, operator, approved);\n }\n\n function _setApprovalForAll(\n address sender,\n address operator,\n bool approved\n ) internal {\n require(sender != address(0), \"sender is zero address\");\n require(sender != operator, \"sender = operator\");\n require(operator != address(0), \"operator is zero address\");\n require(\n !_superOperators[operator],\n \"super operator can't have their approvalForAll changed\"\n );\n _operatorsForAll[sender][operator] = approved;\n emit ApprovalForAll(sender, operator, approved);\n }\n\n /// @notice Queries the approval status of `operator` for owner `owner`.\n /// @param owner the owner of the tokens.\n /// @param operator address of authorized operator.\n /// @return true if the operator is approved, false if not.\n function isApprovedForAll(address owner, address operator)\n external\n view\n returns (bool isOperator)\n {\n require(owner != address(0), \"owner is zero address\");\n require(operator != address(0), \"operator is zero address\");\n return _operatorsForAll[owner][operator] || _superOperators[operator];\n }\n\n /// @notice Count all NFTs assigned to `owner`.\n /// @param owner address for whom to query the balance.\n /// @return the number of NFTs owned by `owner`, possibly zero.\n function balanceOf(address owner)\n external\n view\n returns (uint256 balance)\n {\n require(owner != address(0), \"owner is zero address\");\n return _numNFTPerAddress[owner];\n }\n\n /// @notice Find the owner of an NFT.\n /// @param id the identifier for an NFT.\n /// @return the address of the owner of the NFT.\n function ownerOf(uint256 id) external view returns (address owner) {\n owner = _ownerOf(id);\n require(owner != address(0), \"NFT does not exist\");\n }\n\n function _ownerOf(uint256 id) internal view returns (address) {\n return address(_owners[id]);\n }\n\n /// @notice Change or reaffirm the approved address for an NFT for `sender`.\n /// @dev used for Meta Transaction (from metaTransactionContract).\n /// @param sender the sender granting control.\n /// @param operator the address to approve as NFT controller.\n /// @param id the NFT to approve.\n function approveFor(address sender, address operator, uint256 id)\n external\n {\n address owner = _ownerOf(id);\n require(sender != address(0), \"sender is zero address\");\n require(\n msg.sender == sender ||\n _metaTransactionContracts[msg.sender] ||\n _superOperators[msg.sender] ||\n _operatorsForAll[sender][msg.sender],\n \"require operators\"\n ); // solium-disable-line max-len\n require(owner == sender, \"not owner\");\n _erc721operators[id] = operator;\n emit Approval(owner, operator, id);\n }\n\n /// @notice Change or reaffirm the approved address for an NFT.\n /// @param operator the address to approve as NFT controller.\n /// @param id the id of the NFT to approve.\n function approve(address operator, uint256 id) external {\n address owner = _ownerOf(id);\n require(owner != address(0), \"NFT does not exist\");\n require(\n owner == msg.sender ||\n _superOperators[msg.sender] ||\n _operatorsForAll[owner][msg.sender],\n \"not authorized\"\n );\n _erc721operators[id] = operator;\n emit Approval(owner, operator, id);\n }\n\n /// @notice Get the approved address for a single NFT.\n /// @param id the NFT to find the approved address for.\n /// @return the approved address for this NFT, or the zero address if there is none.\n function getApproved(uint256 id)\n external\n view\n returns (address operator)\n {\n require(_ownerOf(id) != address(0), \"NFT does not exist\");\n return _erc721operators[id];\n }\n\n /// @notice Transfers ownership of an NFT.\n /// @param from the current owner of the NFT.\n /// @param to the new owner.\n /// @param id the NFT to transfer.\n function transferFrom(address from, address to, uint256 id) external {\n require(_ownerOf(id) == from, \"not owner\");\n bool metaTx = _transferFrom(from, to, id, 1);\n require(\n _checkERC1155AndCallSafeTransfer(\n metaTx ? from : msg.sender,\n from,\n to,\n id,\n 1,\n \"\",\n true,\n false\n ),\n \"erc1155 transfer rejected\"\n );\n }\n\n /// @notice Transfers the ownership of an NFT from one address to another address.\n /// @param from the current owner of the NFT.\n /// @param to the new owner.\n /// @param id the NFT to transfer.\n function safeTransferFrom(address from, address to, uint256 id)\n external\n {\n safeTransferFrom(from, to, id, \"\");\n }\n\n /// @notice Transfers the ownership of an NFT from one address to another address.\n /// @param from the current owner of the NFT.\n /// @param to the new owner.\n /// @param id the NFT to transfer.\n /// @param data additional data with no specified format, sent in call to `to`.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) public {\n require(_ownerOf(id) == from, \"not owner\");\n bool metaTx = _transferFrom(from, to, id, 1);\n require(\n _checkERC1155AndCallSafeTransfer(\n metaTx ? from : msg.sender,\n from,\n to,\n id,\n 1,\n data,\n true,\n true\n ),\n \"erc721/erc1155 transfer rejected\"\n );\n }\n\n /// @notice A descriptive name for the collection of tokens in this contract.\n /// @return the name of the tokens.\n function name() external pure returns (string memory _name) {\n return \"Sandbox's ASSETs\";\n }\n\n /// @notice An abbreviated name for the collection of tokens in this contract.\n /// @return the symbol of the tokens.\n function symbol() external pure returns (string memory _symbol) {\n return \"ASSET\";\n }\n\n /// @notice Gives the rarity power of a particular token type.\n /// @param id the token type to get the rarity of.\n /// @return the rarity power(between 0 and 3).\n function rarity(uint256 id) public view returns (uint256) {\n require(wasEverMinted(id), \"token was never minted\");\n bytes storage rarityPack = _rarityPacks[id & URI_ID];\n uint256 packIndex = id & PACK_INDEX;\n if (packIndex / 4 >= rarityPack.length) {\n return 0;\n } else {\n uint8 pack = uint8(rarityPack[packIndex / 4]);\n uint8 i = (3 - uint8(packIndex % 4)) * 2;\n return (pack / (uint8(2)**i)) % 4;\n }\n }\n\n /// @notice Gives the collection a specific token belongs to.\n /// @param id the token to get the collection of.\n /// @return the collection the NFT is part of.\n function collectionOf(uint256 id) public view returns (uint256) {\n require(_ownerOf(id) != address(0), \"NFT does not exist\");\n uint256 collectionId = id & NOT_NFT_INDEX & NOT_IS_NFT;\n require(wasEverMinted(collectionId), \"no collection ever minted for that token\");\n return collectionId;\n }\n\n /// @notice Return wether the id is a collection\n /// @param id collectionId to check.\n /// @return whether the id is a collection.\n function isCollection(uint256 id) public view returns (bool) {\n uint256 collectionId = id & NOT_NFT_INDEX & NOT_IS_NFT;\n return wasEverMinted(collectionId);\n }\n\n /// @notice Gives the index at which an NFT was minted in a collection : first of a collection get the zero index.\n /// @param id the token to get the index of.\n /// @return the index/order at which the token `id` was minted in a collection.\n function collectionIndexOf(uint256 id) public view returns (uint256) {\n collectionOf(id); // this check if id and collection indeed was ever minted\n return uint32((id & NFT_INDEX) >> NFT_INDEX_OFFSET);\n }\n\n function toFullURI(bytes32 hash, uint256 id)\n internal\n pure\n returns (string memory)\n {\n return\n string(\n abi.encodePacked(\n \"ipfs://bafybei\",\n hash2base32(hash),\n \"/\",\n uint2str(id & PACK_INDEX),\n \".json\"\n )\n );\n }\n\n function wasEverMinted(uint256 id) public view returns(bool) {\n if ((id & IS_NFT) > 0) {\n return _owners[id] != 0;\n } else {\n return\n ((id & PACK_INDEX) < ((id & PACK_NUM_FT_TYPES) / PACK_NUM_FT_TYPES_OFFSET_MULTIPLIER)) &&\n _metadataHash[id & URI_ID] != 0;\n }\n }\n\n /// @notice check whether a packId/numFT tupple has been used\n /// @param creator for which creator\n /// @param packId the packId to check\n /// @param numFTs number of Fungible Token in that pack (can reuse packId if different)\n /// @return whether the pack has already been used\n function isPackIdUsed(address creator, uint40 packId, uint16 numFTs) external returns(bool) {\n uint256 uriId = uint256(creator) * CREATOR_OFFSET_MULTIPLIER + // CREATOR\n uint256(packId) * PACK_ID_OFFSET_MULTIPLIER + // packId (unique pack) // PACk_ID\n numFTs * PACK_NUM_FT_TYPES_OFFSET_MULTIPLIER; // number of fungible token in the pack // PACK_NUM_FT_TYPES\n return _metadataHash[uriId] != 0;\n }\n\n /// @notice A distinct Uniform Resource Identifier (URI) for a given token.\n /// @param id token to get the uri of.\n /// @return URI string\n function uri(uint256 id) public view returns (string memory) {\n require(wasEverMinted(id), \"token was never minted\"); // prevent returning invalid uri\n return toFullURI(_metadataHash[id & URI_ID], id);\n }\n\n /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.\n /// @param id token to get the uri of.\n /// @return URI string\n function tokenURI(uint256 id) public view returns (string memory) {\n require(_ownerOf(id) != address(0), \"NFT does not exist\");\n return toFullURI(_metadataHash[id & URI_ID], id);\n }\n\n bytes32 private constant base32Alphabet = 0x6162636465666768696A6B6C6D6E6F707172737475767778797A323334353637;\n // solium-disable-next-line security/no-assign-params\n function hash2base32(bytes32 hash)\n private\n pure\n returns (string memory _uintAsString)\n {\n uint256 _i = uint256(hash);\n uint256 k = 52;\n bytes memory bstr = new bytes(k);\n bstr[--k] = base32Alphabet[uint8((_i % 8) << 2)]; // uint8 s = uint8((256 - skip) % 5); // (_i % (2**s)) << (5-s)\n _i /= 8;\n while (k > 0) {\n bstr[--k] = base32Alphabet[_i % 32];\n _i /= 32;\n }\n return string(bstr);\n }\n\n // solium-disable-next-line security/no-assign-params\n function uint2str(uint256 _i)\n private\n pure\n returns (string memory _uintAsString)\n {\n if (_i == 0) {\n return \"0\";\n }\n\n uint256 j = _i;\n uint256 len;\n while (j != 0) {\n len++;\n j /= 10;\n }\n\n bytes memory bstr = new bytes(len);\n uint256 k = len - 1;\n while (_i != 0) {\n bstr[k--] = bytes1(uint8(48 + (_i % 10)));\n _i /= 10;\n }\n\n return string(bstr);\n }\n\n /// @notice Query if a contract implements interface `id`.\n /// @param id the interface identifier, as specified in ERC-165.\n /// @return `true` if the contract implements `id`.\n function supportsInterface(bytes4 id) external view returns (bool) {\n return\n id == 0x01ffc9a7 || //ERC165\n id == 0xd9b67a26 || // ERC1155\n id == 0x80ac58cd || // ERC721\n id == 0x5b5e139f || // ERC721 metadata\n id == 0x0e89341c; // ERC1155 metadata\n }\n\n bytes4 constant ERC165ID = 0x01ffc9a7;\n function checkIsERC1155Receiver(address _contract)\n internal\n view\n returns (bool)\n {\n bool success;\n bool result;\n bytes memory call_data = abi.encodeWithSelector(\n ERC165ID,\n ERC1155_IS_RECEIVER\n );\n // solium-disable-next-line security/no-inline-assembly\n assembly {\n let call_ptr := add(0x20, call_data)\n let call_size := mload(call_data)\n let output := mload(0x40) // Find empty storage location using \"free memory pointer\"\n mstore(output, 0x0)\n success := staticcall(\n 10000,\n _contract,\n call_ptr,\n call_size,\n output,\n 0x20\n ) // 32 bytes\n result := mload(output)\n }\n // (10000 / 63) \"not enough for supportsInterface(...)\" // consume all gas, so caller can potentially know that there was not enough gas\n assert(gasleft() > 158);\n return success && result;\n }\n\n function _checkERC1155AndCallSafeTransfer(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes memory data,\n bool erc721,\n bool erc721Safe\n ) internal returns (bool) {\n if (!to.isContract()) {\n return true;\n }\n if (erc721) {\n if (!checkIsERC1155Receiver(to)) {\n if (erc721Safe) {\n return\n _checkERC721AndCallSafeTransfer(\n operator,\n from,\n to,\n id,\n data\n );\n } else {\n return true;\n }\n }\n }\n return\n ERC1155TokenReceiver(to).onERC1155Received(\n operator,\n from,\n id,\n value,\n data\n ) == ERC1155_RECEIVED;\n }\n\n function _checkERC1155AndCallSafeBatchTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory values,\n bytes memory data\n ) internal returns (bool) {\n if (!to.isContract()) {\n return true;\n }\n bytes4 retval = ERC1155TokenReceiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n values,\n data\n );\n return (retval == ERC1155_BATCH_RECEIVED);\n }\n\n function _checkERC721AndCallSafeTransfer(\n address operator,\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) internal returns (bool) {\n // following not required as this function is always called as part of ERC1155 checks that include such check already\n // if (!to.isContract()) {\n // return true;\n // }\n return (ERC721TokenReceiver(to).onERC721Received(\n operator,\n from,\n id,\n data\n ) ==\n ERC721_RECEIVED);\n }\n\n event Extraction(uint256 indexed fromId, uint256 toId);\n event AssetUpdate(uint256 indexed fromId, uint256 toId);\n\n function _burnERC1155(\n address operator,\n address from,\n uint256 id,\n uint32 amount\n ) internal {\n (uint256 bin, uint256 index) = (id).getTokenBinIndex();\n _packedTokenBalance[from][bin] = _packedTokenBalance[from][bin]\n .updateTokenBalance(index, amount, ObjectLib32.Operations.SUB);\n emit TransferSingle(operator, from, address(0), id, amount);\n }\n\n function _burnERC721(address operator, address from, uint256 id)\n internal\n {\n require(from == _ownerOf(id), \"not owner\");\n _owners[id] = 2**160; // equivalent to zero address when casted but ensure we track minted status\n _numNFTPerAddress[from]--;\n emit Transfer(from, address(0), id);\n emit TransferSingle(operator, from, address(0), id, 1);\n }\n\n /// @notice Burns `amount` tokens of type `id`.\n /// @param id token type which will be burnt.\n /// @param amount amount of token to burn.\n function burn(uint256 id, uint256 amount) external {\n _burn(msg.sender, id, amount);\n }\n\n /// @notice Burns `amount` tokens of type `id` from `from`.\n /// @param from address whose token is to be burnt.\n /// @param id token type which will be burnt.\n /// @param amount amount of token to burn.\n function burnFrom(address from, uint256 id, uint256 amount) external {\n require(from != address(0), \"from is zero address\");\n require(\n msg.sender == from ||\n _metaTransactionContracts[msg.sender] ||\n _superOperators[msg.sender] ||\n _operatorsForAll[from][msg.sender],\n \"require meta approval\"\n );\n _burn(from, id, amount);\n }\n\n function _burn(address from, uint256 id, uint256 amount) internal {\n if ((id & IS_NFT) > 0) {\n require(amount == 1, \"can only burn one NFT\");\n _burnERC721(\n _metaTransactionContracts[msg.sender] ? from : msg.sender,\n from,\n id\n );\n } else {\n require(amount > 0 && amount <= MAX_SUPPLY, \"invalid amount\");\n _burnERC1155(\n _metaTransactionContracts[msg.sender] ? from : msg.sender,\n from,\n id,\n uint32(amount)\n );\n }\n }\n\n /// @notice Upgrades an NFT with new metadata and rarity.\n /// @param from address which own the NFT to be upgraded.\n /// @param id the NFT that will be burnt to be upgraded.\n /// @param packId unqiue packId for the token.\n /// @param hash hash of an IPFS cidv1 folder that contains the metadata of the new token type in the file 0.json.\n /// @param newRarity rarity power of the new NFT.\n /// @param to address which will receive the NFT.\n /// @param data bytes to be transmitted as part of the minted token.\n /// @return the id of the newly minted NFT.\n function updateERC721(\n address from,\n uint256 id,\n uint40 packId,\n bytes32 hash,\n uint8 newRarity,\n address to,\n bytes calldata data\n ) external returns(uint256) {\n require(hash != 0, \"hash is zero\");\n require(\n _bouncers[msg.sender],\n \"only bouncer allowed to mint via update\"\n );\n require(to != address(0), \"destination is zero address\");\n require(from != address(0), \"from is zero address\");\n\n _burnERC721(msg.sender, from, id);\n\n uint256 newId = generateTokenId(from, 1, packId, 0, 0);\n _mint(hash, 1, newRarity, msg.sender, to, newId, data, false);\n emit AssetUpdate(id, newId);\n return newId;\n }\n\n /// @notice Extracts an EIP-721 NFT from an EIP-1155 token.\n /// @param id the token type to extract from.\n /// @param to address which will receive the token.\n /// @return the id of the newly minted NFT.\n function extractERC721(uint256 id, address to)\n external\n returns (uint256 newId)\n {\n return _extractERC721From(msg.sender, msg.sender, id, to);\n }\n\n /// @notice Extracts an EIP-721 NFT from an EIP-1155 token.\n /// @param sender address which own the token to be extracted.\n /// @param id the token type to extract from.\n /// @param to address which will receive the token.\n /// @return the id of the newly minted NFT.\n function extractERC721From(address sender, uint256 id, address to)\n external\n returns (uint256 newId)\n {\n bool metaTx = _metaTransactionContracts[msg.sender];\n require(\n msg.sender == sender ||\n metaTx ||\n _superOperators[msg.sender] ||\n _operatorsForAll[sender][msg.sender],\n \"require meta approval\"\n );\n return _extractERC721From(metaTx ? sender : msg.sender, sender, id, to);\n }\n\n function _extractERC721From(address operator, address sender, uint256 id, address to)\n internal\n returns (uint256 newId)\n {\n require(to != address(0), \"destination is zero address\");\n require(id & IS_NFT == 0, \"Not an ERC1155 Token\");\n uint32 tokenCollectionIndex = _nextCollectionIndex[id];\n newId = id +\n IS_NFT +\n (tokenCollectionIndex) *\n 2**NFT_INDEX_OFFSET;\n _nextCollectionIndex[id] = tokenCollectionIndex + 1;\n _burnERC1155(operator, sender, id, 1);\n _mint(\n _metadataHash[id & URI_ID],\n 1,\n 0,\n operator,\n to,\n newId,\n \"\",\n true\n );\n emit Extraction(id, newId);\n }\n}\n" + }, + "src/solc_0.5/Asset/ERC1155ERC721Test.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../contracts_common/Interfaces/ERC1155.sol\";\nimport \"../contracts_common/Interfaces/ERC1155TokenReceiver.sol\";\n\nimport \"../contracts_common/Libraries/AddressUtils.sol\";\nimport \"../contracts_common/Libraries/ObjectLib32.sol\";\n\nimport \"../contracts_common/Interfaces/ERC721.sol\";\nimport \"../contracts_common/Interfaces/ERC721TokenReceiver.sol\";\n\nimport \"../contracts_common/BaseWithStorage/SuperOperators.sol\";\n\n// using double loop for transfer\ncontract ERC1155ERC721Test is SuperOperators, ERC1155, ERC721 {\n using AddressUtils for address;\n using ObjectLib32 for ObjectLib32.Operations;\n using ObjectLib32 for uint256;\n\n bytes4 private constant ERC1155_IS_RECEIVER = 0x4e2312e0;\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n bytes4 private constant ERC721_RECEIVED = 0x150b7a02;\n\n uint256 private constant CREATOR_OFFSET_MULTIPLIER = uint256(2)**(256 - 160);\n uint256 private constant IS_NFT_OFFSET_MULTIPLIER = uint256(2)**(256 - 160 - 1);\n uint256 private constant PACK_ID_OFFSET_MULTIPLIER = uint256(2)**(256 - 160 - 1 - 32 - 40);\n uint256 private constant PACK_NUM_FT_TYPES_OFFSET_MULTIPLIER = uint256(2)**(256 - 160 - 1 - 32 - 40 - 12);\n uint256 private constant NFT_INDEX_OFFSET = 63;\n\n uint256 private constant IS_NFT = 0x0000000000000000000000000000000000000000800000000000000000000000;\n uint256 private constant NOT_IS_NFT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFFFFFFFFFFF;\n uint256 private constant NFT_INDEX = 0x00000000000000000000000000000000000000007FFFFFFF8000000000000000;\n uint256 private constant NOT_NFT_INDEX = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000007FFFFFFFFFFFFFFF;\n uint256 private constant URI_ID = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000007FFFFFFFFFFFF800;\n uint256 private constant PACK_ID = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000007FFFFFFFFF800000;\n uint256 private constant PACK_INDEX = 0x00000000000000000000000000000000000000000000000000000000000007FF;\n uint256 private constant PACK_NUM_FT_TYPES = 0x00000000000000000000000000000000000000000000000000000000007FF800;\n\n uint256 private constant MAX_SUPPLY = uint256(2)**32 - 1;\n uint256 private constant MAX_PACK_SIZE = uint256(2)**11;\n\n event CreatorshipTransfer(\n address indexed original,\n address indexed from,\n address indexed to\n );\n\n mapping(address => uint256) private _numNFTPerAddress; // erc721\n mapping(uint256 => uint256) private _owners; // erc721\n mapping(address => mapping(uint256 => uint256)) private _packedTokenBalance; // erc1155\n mapping(address => mapping(address => bool)) private _operatorsForAll; // erc721 and erc1155\n mapping(uint256 => address) private _erc721operators; // erc721\n mapping(uint256 => bytes32) private _metadataHash; // erc721 and erc1155\n mapping(uint256 => bytes) private _rarityPacks; // rarity configuration per packs (2 bits per Asset)\n mapping(uint256 => uint32) private _nextCollectionIndex; // extraction\n\n mapping(address => address) private _creatorship; // creatorship transfer\n\n mapping(address => bool) private _bouncers; // the contracts allowed to mint\n mapping(address => bool) private _metaTransactionContracts; // native meta-transaction support\n\n address private _bouncerAdmin;\n\n constructor(\n address metaTransactionContract,\n address admin,\n address bouncerAdmin\n ) public {\n _metaTransactionContracts[metaTransactionContract] = true;\n _admin = admin;\n _bouncerAdmin = bouncerAdmin;\n emit MetaTransactionProcessor(metaTransactionContract, true);\n }\n\n event BouncerAdminChanged(address oldBouncerAdmin, address newBouncerAdmin);\n\n /// @notice Returns the current administrator in charge of minting rights.\n /// @return the current minting administrator in charge of minting rights.\n function getBouncerAdmin() external view returns(address) {\n return _bouncerAdmin;\n }\n\n /// @notice Change the minting administrator to be `newBouncerAdmin`.\n /// @param newBouncerAdmin address of the new minting administrator.\n function changeBouncerAdmin(address newBouncerAdmin) external {\n require(\n msg.sender == _bouncerAdmin,\n \"only bouncerAdmin can change itself\"\n );\n emit BouncerAdminChanged(_bouncerAdmin, newBouncerAdmin);\n _bouncerAdmin = newBouncerAdmin;\n }\n\n event Bouncer(address bouncer, bool enabled);\n\n /// @notice Enable or disable the ability of `bouncer` to mint tokens (minting bouncer rights).\n /// @param bouncer address that will be given/removed minting bouncer rights.\n /// @param enabled set whether the address is enabled or disabled as a minting bouncer.\n function setBouncer(address bouncer, bool enabled) external {\n require(\n msg.sender == _bouncerAdmin,\n \"only bouncerAdmin can setup bouncers\"\n );\n _bouncers[bouncer] = enabled;\n emit Bouncer(bouncer, enabled);\n }\n\n /// @notice check whether address `who` is given minting bouncer rights.\n /// @param who The address to query.\n /// @return whether the address has minting rights.\n function isBouncer(address who) external view returns(bool) {\n return _bouncers[who];\n }\n\n event MetaTransactionProcessor(address metaTransactionProcessor, bool enabled);\n\n /// @notice Enable or disable the ability of `metaTransactionProcessor` to perform meta-tx (metaTransactionProcessor rights).\n /// @param metaTransactionProcessor address that will be given/removed metaTransactionProcessor rights.\n /// @param enabled set whether the metaTransactionProcessor is enabled or disabled.\n function setMetaTransactionProcessor(address metaTransactionProcessor, bool enabled) external {\n require(\n msg.sender == _admin,\n \"only admin can setup metaTransactionProcessors\"\n );\n _metaTransactionContracts[metaTransactionProcessor] = enabled;\n emit MetaTransactionProcessor(metaTransactionProcessor, enabled);\n }\n\n /// @notice check whether address `who` is given meta-transaction execution rights.\n /// @param who The address to query.\n /// @return whether the address has meta-transaction execution rights.\n function isMetaTransactionProcessor(address who) external view returns(bool) {\n return _metaTransactionContracts[who];\n }\n\n /// @notice Mint a token type for `creator` on slot `packId`.\n /// @param creator address of the creator of the token.\n /// @param packId unique packId for that token.\n /// @param hash hash of an IPFS cidv1 folder that contains the metadata of the token type in the file 0.json.\n /// @param supply number of tokens minted for that token type.\n /// @param rarity rarity power of the token.\n /// @param owner address that will receive the tokens.\n /// @param data extra data to accompany the minting call.\n /// @return the id of the newly minted token type.\n function mint(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256 supply,\n uint8 rarity,\n address owner,\n bytes calldata data\n ) external returns (uint256 id) {\n require(hash != 0, \"hash is zero\");\n require(_bouncers[msg.sender], \"only bouncer allowed to mint\");\n require(owner != address(0), \"destination is zero address\");\n id = generateTokenId(creator, supply, packId, supply == 1 ? 0 : 1, 0);\n _mint(\n hash,\n supply,\n rarity,\n msg.sender,\n owner,\n id,\n data,\n false\n );\n }\n\n function generateTokenId(\n address creator,\n uint256 supply,\n uint40 packId,\n uint16 numFTs,\n uint16 packIndex\n ) internal pure returns (uint256) {\n require(supply > 0 && supply <= MAX_SUPPLY, \"invalid supply\");\n\n return\n uint256(creator) * CREATOR_OFFSET_MULTIPLIER + // CREATOR\n (supply == 1 ? uint256(1) * IS_NFT_OFFSET_MULTIPLIER : 0) + // minted as NFT (1) or FT (0) // IS_NFT\n uint256(packId) * PACK_ID_OFFSET_MULTIPLIER + // packId (unique pack) // PACk_ID\n numFTs * PACK_NUM_FT_TYPES_OFFSET_MULTIPLIER + // number of fungible token in the pack // PACK_NUM_FT_TYPES\n packIndex; // packIndex (position in the pack) // PACK_INDEX\n }\n\n function _mint(\n bytes32 hash,\n uint256 supply,\n uint8 rarity,\n address operator,\n address owner,\n uint256 id,\n bytes memory data,\n bool extraction\n ) internal {\n uint256 uriId = id & URI_ID;\n if (!extraction) {\n require(uint256(_metadataHash[uriId]) == 0, \"id already used\");\n _metadataHash[uriId] = hash;\n require(rarity < 4, \"rarity >= 4\");\n bytes memory pack = new bytes(1);\n pack[0] = bytes1(rarity * 64);\n _rarityPacks[uriId] = pack;\n }\n if (supply == 1) {\n // ERC721\n _numNFTPerAddress[owner]++;\n _owners[id] = uint256(owner);\n emit Transfer(address(0), owner, id);\n } else {\n (uint256 bin, uint256 index) = id.getTokenBinIndex();\n _packedTokenBalance[owner][bin] = _packedTokenBalance[owner][bin]\n .updateTokenBalance(\n index,\n supply,\n ObjectLib32.Operations.REPLACE\n );\n }\n\n emit TransferSingle(operator, address(0), owner, id, supply);\n require(\n _checkERC1155AndCallSafeTransfer(\n operator,\n address(0),\n owner,\n id,\n supply,\n data,\n false,\n false\n ),\n \"transfer rejected\"\n );\n }\n\n /// @notice Mint multiple token types for `creator` on slot `packId`.\n /// @param creator address of the creator of the tokens.\n /// @param packId unique packId for the tokens.\n /// @param hash hash of an IPFS cidv1 folder that contains the metadata of each token type in the files: 0.json, 1.json, 2.json, etc...\n /// @param supplies number of tokens minted for each token type.\n /// @param rarityPack rarity power of each token types packed into 2 bits each.\n /// @param owner address that will receive the tokens.\n /// @param data extra data to accompany the minting call.\n /// @return the ids of each newly minted token types.\n function mintMultiple(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256[] calldata supplies,\n bytes calldata rarityPack,\n address owner,\n bytes calldata data\n ) external returns (uint256[] memory ids) {\n require(hash != 0, \"hash is zero\");\n require(_bouncers[msg.sender], \"only bouncer allowed to mint\");\n require(owner != address(0), \"destination is zero address\");\n uint16 numNFTs;\n (ids, numNFTs) = allocateIds(\n creator,\n supplies,\n rarityPack,\n packId,\n hash\n );\n _mintBatches(supplies, owner, ids, numNFTs);\n completeMultiMint(msg.sender, owner, ids, supplies, data);\n }\n\n function allocateIds(\n address creator,\n uint256[] memory supplies,\n bytes memory rarityPack,\n uint40 packId,\n bytes32 hash\n ) internal returns (uint256[] memory ids, uint16 numNFTs) {\n require(supplies.length > 0, \"supplies.length == 0\");\n require(supplies.length <= MAX_PACK_SIZE, \"too big batch\");\n (ids, numNFTs) = generateTokenIds(creator, supplies, packId);\n uint256 uriId = ids[0] & URI_ID;\n require(uint256(_metadataHash[uriId]) == 0, \"id already used\");\n _metadataHash[uriId] = hash;\n _rarityPacks[uriId] = rarityPack;\n }\n\n function generateTokenIds(\n address creator,\n uint256[] memory supplies,\n uint40 packId\n ) internal pure returns (uint256[] memory, uint16) {\n uint16 numTokenTypes = uint16(supplies.length);\n uint256[] memory ids = new uint256[](numTokenTypes);\n uint16 numNFTs = 0;\n for (uint16 i = 0; i < numTokenTypes; i++) {\n if (numNFTs == 0) {\n if (supplies[i] == 1) {\n numNFTs = uint16(numTokenTypes - i);\n }\n } else {\n require(supplies[i] == 1, \"NFTs need to be put at the end\");\n }\n }\n uint16 numFTs = numTokenTypes - numNFTs;\n for (uint16 i = 0; i < numTokenTypes; i++) {\n ids[i] = generateTokenId(creator, supplies[i], packId, numFTs, i);\n }\n return (ids, numNFTs);\n }\n\n function completeMultiMint(\n address operator,\n address owner,\n uint256[] memory ids,\n uint256[] memory supplies,\n bytes memory data\n ) internal {\n emit TransferBatch(operator, address(0), owner, ids, supplies);\n require(\n _checkERC1155AndCallSafeBatchTransfer(\n operator,\n address(0),\n owner,\n ids,\n supplies,\n data\n ),\n \"transfer rejected\"\n );\n }\n\n function _mintBatches(\n uint256[] memory supplies,\n address owner,\n uint256[] memory ids,\n uint16 numNFTs\n ) internal {\n uint16 offset = 0;\n while (offset < supplies.length - numNFTs) {\n _mintBatch(offset, supplies, owner, ids);\n offset += 8;\n }\n // deal with NFT last. they do not care of balance packing\n if (numNFTs > 0) {\n _mintNFTs(\n uint16(supplies.length - numNFTs),\n numNFTs,\n owner,\n ids\n );\n }\n }\n\n function _mintNFTs(\n uint16 offset,\n uint32 numNFTs,\n address owner,\n uint256[] memory ids\n ) internal {\n for (uint16 i = 0; i < numNFTs; i++) {\n uint256 id = ids[i + offset];\n _owners[id] = uint256(owner);\n emit Transfer(address(0), owner, id);\n }\n _numNFTPerAddress[owner] += numNFTs;\n }\n\n function _mintBatch(\n uint16 offset,\n uint256[] memory supplies,\n address owner,\n uint256[] memory ids\n ) internal {\n uint256 firstId = ids[offset];\n (uint256 bin, uint256 index) = firstId.getTokenBinIndex();\n uint256 balances = _packedTokenBalance[owner][bin];\n for (uint256 i = 0; i < 8 && offset + i < supplies.length; i++) {\n uint256 j = offset + i;\n if (supplies[j] > 1) {\n balances = balances.updateTokenBalance(\n index + i,\n supplies[j],\n ObjectLib32.Operations.REPLACE\n );\n } else {\n break;\n }\n }\n _packedTokenBalance[owner][bin] = balances;\n }\n\n function _transferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value\n ) internal {\n require(to != address(0), \"destination is zero address\");\n require(from != address(0), \"from is zero address\");\n bool authorized = from == msg.sender ||\n _superOperators[msg.sender] ||\n _operatorsForAll[from][msg.sender] ||\n _metaTransactionContracts[msg.sender]; // solium-disable-line max-len\n\n if (id & IS_NFT > 0) {\n require(\n authorized || _erc721operators[id] == msg.sender,\n \"Operator not approved\"\n );\n if(value > 0) {\n require(value == 1, \"cannot transfer nft if amount not 1\");\n _numNFTPerAddress[from]--;\n _numNFTPerAddress[to]++;\n _owners[id] = uint256(to);\n if (_erc721operators[id] != address(0)) { // TODO operatorEnabled flag optimization (like in ERC721BaseToken)\n _erc721operators[id] = address(0);\n }\n emit Transfer(from, to, id);\n }\n } else {\n require(authorized, \"Operator not approved\");\n if(value > 0) {\n // if different owners it will fails\n (uint256 bin, uint256 index) = id.getTokenBinIndex();\n _packedTokenBalance[from][bin] = _packedTokenBalance[from][bin]\n .updateTokenBalance(index, value, ObjectLib32.Operations.SUB);\n _packedTokenBalance[to][bin] = _packedTokenBalance[to][bin]\n .updateTokenBalance(index, value, ObjectLib32.Operations.ADD);\n }\n }\n\n emit TransferSingle(\n _metaTransactionContracts[msg.sender] ? from : msg.sender,\n from,\n to,\n id,\n value\n );\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param value amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external {\n if (id & IS_NFT > 0) {\n require(_ownerOf(id) == from, \"not owner\");\n }\n _transferFrom(from, to, id, value);\n require(\n _checkERC1155AndCallSafeTransfer(\n _metaTransactionContracts[msg.sender] ? from : msg.sender,\n from,\n to,\n id,\n value,\n data,\n false,\n false\n ),\n \"erc1155 transfer rejected\"\n );\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @dev call data should be optimized to order ids so packedBalance can be used efficiently.\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param values amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external {\n require(\n ids.length == values.length,\n \"Inconsistent array length between args\"\n );\n require(to != address(0), \"destination is zero address\");\n require(from != address(0), \"from is zero address\");\n bool authorized = from == msg.sender ||\n _superOperators[msg.sender] ||\n _operatorsForAll[from][msg.sender] ||\n _metaTransactionContracts[msg.sender]; // solium-disable-line max-len\n\n _changeBalancesFor(from, to, ids, values, ObjectLib32.Operations.SUB, authorized);\n _changeBalancesFor(from, to, ids, values, ObjectLib32.Operations.ADD, authorized);\n // if (from == to) {\n // _batchTransferToSelf(from, ids, values, authorized);\n // } else {\n // _batchTransferFrom(from, to, ids, values, authorized);\n // }\n emit TransferBatch(\n _metaTransactionContracts[msg.sender] ? from : msg.sender,\n from,\n to,\n ids,\n values\n );\n require(\n _checkERC1155AndCallSafeBatchTransfer(\n _metaTransactionContracts[msg.sender] ? from : msg.sender,\n from,\n to,\n ids,\n values,\n data\n ),\n \"erc1155 transfer rejected\"\n );\n }\n\n // mapping(address => mapping(uint256 => uint256)) private _selfPackedTokenBalance;\n // function _batchTransferToSelf(\n // address from,\n // uint256[] memory ids,\n // uint256[] memory values,\n // bool authorized\n // ) internal {\n // uint256 numItems = ids.length;\n\n // uint256 bin;\n // uint256 index;\n // uint256 numTokensTransferedPerType;\n // uint256 lastBin;\n // for (uint256 i = 0; i < numItems; i++) {\n // bool isNFT = ids[i] & IS_NFT > 0;\n // require(authorized || (isNFT && _erc721operators[ids[i]] == msg.sender), \"Operator not approved\");\n // if(values[i] > 0) {\n // (bin, index) = ids[i].getTokenBinIndex();\n // if (lastBin == 0) {\n // lastBin = bin;\n // numTokensTransferedPerType = ObjectLib32.updateTokenBalance(\n // _selfPackedTokenBalance[from][bin],\n // index,\n // values[i],\n // ObjectLib32.Operations.ADD\n // );\n // } else {\n // if (bin != lastBin) {\n // _selfPackedTokenBalance[from][lastBin] = numTokensTransferedPerType;\n // numTokensTransferedPerType = _selfPackedTokenBalance[from][bin];\n // lastBin = bin;\n // }\n // numTokensTransferedPerType = numTokensTransferedPerType.updateTokenBalance(\n // index,\n // values[i],\n // ObjectLib32.Operations.ADD\n // );\n // }\n // if (isNFT) {\n // require(numTokensTransferedPerType.getValueInBin(index) == 1, \"cannot transfer an NFT more than once\");\n // require(_ownerOf(ids[i]) == from, \"not owner\");\n // if (_erc721operators[ids[i]] != address(0)) { // TODO operatorEnabled flag optimization (like in ERC721BaseToken)\n // _erc721operators[ids[i]] = address(0);\n // }\n // emit Transfer(from, from, ids[i]);\n // } else {\n // require(numTokensTransferedPerType.getValueInBin(index) <= _packedTokenBalance[from][bin].getValueInBin(index), \"too many transfered\");\n // }\n // }\n // }\n // for (uint256 i = 0; i < numItems; i++) {\n // (uint256 binToErase, ) = ids[i].getTokenBinIndex();\n // _selfPackedTokenBalance[from][binToErase] = 0;\n // }\n // }\n\n function _changeBalancesFor(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory values,\n ObjectLib32.Operations operation,\n bool authorized\n ) internal {\n address current = operation == ObjectLib32.Operations.SUB ? from : to;\n uint256 numItems = ids.length;\n uint256 bin;\n uint256 index;\n uint256 bal;\n uint256 lastBin;\n uint256 numNFTs = 0;\n for (uint256 i = 0; i < numItems; i++) {\n if (ids[i] & IS_NFT > 0) {\n if(operation == ObjectLib32.Operations.SUB) {\n require(\n authorized || _erc721operators[ids[i]] == msg.sender,\n \"Operator not approved\"\n );\n }\n if(values[i] > 0) {\n numNFTs++;\n if (operation == ObjectLib32.Operations.SUB) {\n require(values[i] == 1, \"cannot transfer nft if amount not 1\");\n if(from == to) {\n require(_ownerOf(ids[i]) == from, \"not owner in batch\");\n _owners[ids[i]] = 0;\n }\n if (_erc721operators[ids[i]] != address(0)) { // TODO operatorEnabled flag optimization (like in ERC721BaseToken)\n _erc721operators[ids[i]] = address(0);\n }\n } else { // assume it will be only ADD\n if(from != to) {\n require(_ownerOf(ids[i]) == from, \"not owner in batch\");\n }\n _owners[ids[i]] = uint256(to);\n emit Transfer(from, to, ids[i]);\n }\n }\n } else {\n require(authorized, \"Operator not approved\");\n if(values[i] > 0) {\n (bin, index) = ids[i].getTokenBinIndex();\n if (lastBin == 0) {\n lastBin = bin;\n bal = ObjectLib32.updateTokenBalance(\n _packedTokenBalance[current][bin],\n index,\n values[i],\n operation\n );\n } else {\n if (bin != lastBin) {\n _packedTokenBalance[current][lastBin] = bal;\n bal = _packedTokenBalance[current][bin];\n lastBin = bin;\n }\n bal = bal.updateTokenBalance(\n index,\n values[i],\n operation\n );\n }\n }\n }\n }\n if (numNFTs > 0) {\n if (operation == ObjectLib32.Operations.SUB) {\n _numNFTPerAddress[current] -= numNFTs;\n } else { // assume it will be only ADD\n _numNFTPerAddress[current] += numNFTs;\n }\n }\n\n if (bin != 0) {\n _packedTokenBalance[current][bin] = bal;\n }\n }\n\n // function _batchTransferFrom(\n // address from,\n // address to,\n // uint256[] memory ids,\n // uint256[] memory values,\n // bool authorized\n // ) internal {\n // uint256 numItems = ids.length;\n // uint256 bin;\n // uint256 index;\n // uint256 balFrom;\n // uint256 balTo;\n\n // uint256 lastBin;\n // uint256 numNFTs = 0;\n // for (uint256 i = 0; i < numItems; i++) {\n // if (ids[i] & IS_NFT > 0) {\n // require(\n // authorized || _erc721operators[ids[i]] == msg.sender,\n // \"Operator not approved\"\n // );\n // if(values[i] > 0) {\n // require(values[i] == 1, \"cannot transfer nft if amount not 1\");\n // require(_ownerOf(ids[i]) == from, \"not owner\");\n // numNFTs++;\n // _owners[ids[i]] = uint256(to);\n // if (_erc721operators[ids[i]] != address(0)) { // TODO operatorEnabled flag optimization (like in ERC721BaseToken)\n // _erc721operators[ids[i]] = address(0);\n // }\n // emit Transfer(from, to, ids[i]);\n // }\n // } else {\n // require(authorized, \"Operator not approved\");\n // if(values[i] > 0) {\n // (bin, index) = ids[i].getTokenBinIndex();\n // if (lastBin == 0) {\n // lastBin = bin;\n // balFrom = ObjectLib32.updateTokenBalance(\n // _packedTokenBalance[from][bin],\n // index,\n // values[i],\n // ObjectLib32.Operations.SUB\n // );\n // balTo = ObjectLib32.updateTokenBalance(\n // _packedTokenBalance[to][bin],\n // index,\n // values[i],\n // ObjectLib32.Operations.ADD\n // );\n // } else {\n // if (bin != lastBin) {\n // _packedTokenBalance[from][lastBin] = balFrom;\n // _packedTokenBalance[to][lastBin] = balTo;\n // balFrom = _packedTokenBalance[from][bin];\n // balTo = _packedTokenBalance[to][bin];\n // lastBin = bin;\n // }\n\n // balFrom = balFrom.updateTokenBalance(\n // index,\n // values[i],\n // ObjectLib32.Operations.SUB\n // );\n // balTo = balTo.updateTokenBalance(\n // index,\n // values[i],\n // ObjectLib32.Operations.ADD\n // );\n // }\n // }\n // }\n // }\n // if (numNFTs > 0) {\n // _numNFTPerAddress[from] -= numNFTs;\n // _numNFTPerAddress[to] += numNFTs;\n // }\n\n // if (bin != 0) {\n // _packedTokenBalance[from][bin] = balFrom;\n // _packedTokenBalance[to][bin] = balTo;\n // }\n // }\n\n /// @notice Get the balance of `owner` for the token type `id`.\n /// @param owner The address of the token holder.\n /// @param id the token type of which to get the balance of.\n /// @return the balance of `owner` for the token type `id`.\n function balanceOf(address owner, uint256 id)\n public\n view\n returns (uint256)\n {\n // do not check for existence, balance is zero if never minted\n // require(wasEverMinted(id), \"token was never minted\");\n if (id & IS_NFT > 0) {\n if (_ownerOf(id) == owner) {\n return 1;\n } else {\n return 0;\n }\n }\n (uint256 bin, uint256 index) = id.getTokenBinIndex();\n return _packedTokenBalance[owner][bin].getValueInBin(index);\n }\n\n /// @notice Get the balance of `owners` for each token type `ids`.\n /// @param owners the addresses of the token holders queried.\n /// @param ids ids of each token type to query.\n /// @return the balance of each `owners` for each token type `ids`.\n function balanceOfBatch(\n address[] calldata owners,\n uint256[] calldata ids\n ) external view returns (uint256[] memory) {\n require(\n owners.length == ids.length,\n \"Inconsistent array length between args\"\n );\n uint256[] memory balances = new uint256[](ids.length);\n for (uint256 i = 0; i < ids.length; i++) {\n balances[i] = balanceOf(owners[i], ids[i]);\n }\n return balances;\n }\n\n /// @notice Get the creator of the token type `id`.\n /// @param id the id of the token to get the creator of.\n /// @return the creator of the token type `id`.\n function creatorOf(uint256 id) external view returns (address) {\n require(wasEverMinted(id), \"token was never minted\");\n address originalCreator = address(id / CREATOR_OFFSET_MULTIPLIER);\n address newCreator = _creatorship[originalCreator];\n if (newCreator != address(0)) {\n return newCreator;\n }\n return originalCreator;\n }\n\n /// @notice Transfers creatorship of `original` from `sender` to `to`.\n /// @param sender address of current registered creator.\n /// @param original address of the original creator whose creation are saved in the ids themselves.\n /// @param to address which will be given creatorship for all tokens originally minted by `original`.\n function transferCreatorship(\n address sender,\n address original,\n address to\n ) external {\n require(\n msg.sender == sender ||\n _metaTransactionContracts[msg.sender] ||\n _superOperators[msg.sender],\n \"require meta approval\"\n );\n require(sender != address(0), \"sender is zero address\");\n require(to != address(0), \"destination is zero address\");\n address current = _creatorship[original];\n if (current == address(0)) {\n current = original;\n }\n require(current != to, \"current == to\");\n require(current == sender, \"current != sender\");\n if (to == original) {\n _creatorship[original] = address(0);\n } else {\n _creatorship[original] = to;\n }\n emit CreatorshipTransfer(original, current, to);\n }\n\n /// @notice Enable or disable approval for `operator` to manage all `sender`'s tokens.\n /// @dev used for Meta Transaction (from metaTransactionContract).\n /// @param sender address which grant approval.\n /// @param operator address which will be granted rights to transfer all token owned by `sender`.\n /// @param approved whether to approve or revoke.\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) external {\n require(\n msg.sender == sender ||\n _metaTransactionContracts[msg.sender] ||\n _superOperators[msg.sender],\n \"require meta approval\"\n );\n _setApprovalForAll(sender, operator, approved);\n }\n\n /// @notice Enable or disable approval for `operator` to manage all of the caller's tokens.\n /// @param operator address which will be granted rights to transfer all tokens of the caller.\n /// @param approved whether to approve or revoke\n function setApprovalForAll(address operator, bool approved) external {\n _setApprovalForAll(msg.sender, operator, approved);\n }\n\n function _setApprovalForAll(\n address sender,\n address operator,\n bool approved\n ) internal {\n require(sender != address(0), \"sender is zero address\");\n require(sender != operator, \"sender = operator\");\n require(operator != address(0), \"operator is zero address\");\n require(\n !_superOperators[operator],\n \"super operator can't have their approvalForAll changed\"\n );\n _operatorsForAll[sender][operator] = approved;\n emit ApprovalForAll(sender, operator, approved);\n }\n\n /// @notice Queries the approval status of `operator` for owner `owner`.\n /// @param owner the owner of the tokens.\n /// @param operator address of authorized operator.\n /// @return true if the operator is approved, false if not.\n function isApprovedForAll(address owner, address operator)\n external\n view\n returns (bool isOperator)\n {\n require(owner != address(0), \"owner is zero address\");\n require(operator != address(0), \"operator is zero address\");\n return _operatorsForAll[owner][operator] || _superOperators[operator];\n }\n\n /// @notice Count all NFTs assigned to `owner`.\n /// @param owner address for whom to query the balance.\n /// @return the number of NFTs owned by `owner`, possibly zero.\n function balanceOf(address owner)\n external\n view\n returns (uint256 balance)\n {\n require(owner != address(0), \"owner is zero address\");\n return _numNFTPerAddress[owner];\n }\n\n /// @notice Find the owner of an NFT.\n /// @param id the identifier for an NFT.\n /// @return the address of the owner of the NFT.\n function ownerOf(uint256 id) external view returns (address owner) {\n owner = _ownerOf(id);\n require(owner != address(0), \"NFT does not exist\");\n }\n\n function _ownerOf(uint256 id) internal view returns (address) {\n return address(_owners[id]);\n }\n\n /// @notice Change or reaffirm the approved address for an NFT for `sender`.\n /// @dev used for Meta Transaction (from metaTransactionContract).\n /// @param sender the sender granting control.\n /// @param operator the address to approve as NFT controller.\n /// @param id the NFT to approve.\n function approveFor(address sender, address operator, uint256 id)\n external\n {\n address owner = _ownerOf(id);\n require(sender != address(0), \"sender is zero address\");\n require(\n msg.sender == sender ||\n _metaTransactionContracts[msg.sender] ||\n _superOperators[msg.sender] ||\n _operatorsForAll[sender][msg.sender],\n \"require operators\"\n ); // solium-disable-line max-len\n require(owner == sender, \"not owner\");\n _erc721operators[id] = operator;\n emit Approval(owner, operator, id);\n }\n\n /// @notice Change or reaffirm the approved address for an NFT.\n /// @param operator the address to approve as NFT controller.\n /// @param id the id of the NFT to approve.\n function approve(address operator, uint256 id) external {\n address owner = _ownerOf(id);\n require(owner != address(0), \"NFT does not exist\");\n require(\n owner == msg.sender ||\n _superOperators[msg.sender] ||\n _operatorsForAll[owner][msg.sender],\n \"not authorized\"\n );\n _erc721operators[id] = operator;\n emit Approval(owner, operator, id);\n }\n\n /// @notice Get the approved address for a single NFT.\n /// @param id the NFT to find the approved address for.\n /// @return the approved address for this NFT, or the zero address if there is none.\n function getApproved(uint256 id)\n external\n view\n returns (address operator)\n {\n require(_ownerOf(id) != address(0), \"NFT does not exist\");\n return _erc721operators[id];\n }\n\n /// @notice Transfers ownership of an NFT.\n /// @param from the current owner of the NFT.\n /// @param to the new owner.\n /// @param id the NFT to transfer.\n function transferFrom(address from, address to, uint256 id) external {\n require(_ownerOf(id) == from, \"not owner\");\n _transferFrom(from, to, id, 1);\n require(\n _checkERC1155AndCallSafeTransfer(\n _metaTransactionContracts[msg.sender] ? from : msg.sender,\n from,\n to,\n id,\n 1,\n \"\",\n true,\n false\n ),\n \"erc1155 transfer rejected\"\n );\n }\n\n /// @notice Transfers the ownership of an NFT from one address to another address.\n /// @param from the current owner of the NFT.\n /// @param to the new owner.\n /// @param id the NFT to transfer.\n function safeTransferFrom(address from, address to, uint256 id)\n external\n {\n safeTransferFrom(from, to, id, \"\");\n }\n\n /// @notice Transfers the ownership of an NFT from one address to another address.\n /// @param from the current owner of the NFT.\n /// @param to the new owner.\n /// @param id the NFT to transfer.\n /// @param data additional data with no specified format, sent in call to `to`.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) public {\n require(_ownerOf(id) == from, \"not owner\");\n _transferFrom(from, to, id, 1);\n require(\n _checkERC1155AndCallSafeTransfer(\n _metaTransactionContracts[msg.sender] ? from : msg.sender,\n from,\n to,\n id,\n 1,\n data,\n true,\n true\n ),\n \"erc721/erc1155 transfer rejected\"\n );\n }\n\n /// @notice A descriptive name for the collection of tokens in this contract.\n /// @return the name of the tokens.\n function name() external pure returns (string memory _name) {\n return \"Sandbox's ASSETs\";\n }\n\n /// @notice An abbreviated name for the collection of tokens in this contract.\n /// @return the symbol of the tokens.\n function symbol() external pure returns (string memory _symbol) {\n return \"ASSET\";\n }\n\n /// @notice Gives the rarity power of a particular token type.\n /// @param id the token type to get the rarity of.\n /// @return the rarity power(between 0 and 3).\n function rarity(uint256 id) public view returns (uint256) {\n require(wasEverMinted(id), \"token was never minted\");\n bytes storage rarityPack = _rarityPacks[id & URI_ID];\n uint256 packIndex = id & PACK_INDEX;\n if (packIndex / 4 >= rarityPack.length) {\n return 0;\n } else {\n uint8 pack = uint8(rarityPack[packIndex / 4]);\n uint8 i = (3 - uint8(packIndex % 4)) * 2;\n return (pack / (uint8(2)**i)) % 4;\n }\n }\n\n /// @notice Gives the collection a specific token belongs to.\n /// @param id the token to get the collection of.\n /// @return the collection the NFT is part of.\n function collectionOf(uint256 id) public view returns (uint256) {\n require(_ownerOf(id) != address(0), \"NFT does not exist\");\n uint256 collectionId = id & NOT_NFT_INDEX & NOT_IS_NFT;\n require(wasEverMinted(collectionId), \"no collection ever minted for that token\");\n return collectionId;\n }\n\n /// @notice Return wether the id is a collection\n /// @param id collectionId to check.\n /// @return whether the id is a collection.\n function isCollection(uint256 id) public view returns (bool) {\n uint256 collectionId = id & NOT_NFT_INDEX & NOT_IS_NFT;\n return wasEverMinted(collectionId);\n }\n\n /// @notice Gives the index at which an NFT was minted in a collection : first of a collection get the zero index.\n /// @param id the token to get the index of.\n /// @return the index/order at which the token `id` was minted in a collection.\n function collectionIndexOf(uint256 id) public view returns (uint256) {\n collectionOf(id); // this check if id and collection indeed was ever minted\n return uint32((id & NFT_INDEX) >> NFT_INDEX_OFFSET);\n }\n\n function toFullURI(bytes32 hash, uint256 id)\n internal\n pure\n returns (string memory)\n {\n return\n string(\n abi.encodePacked(\n \"ipfs://bafybei\",\n hash2base32(hash),\n \"/\",\n uint2str(id & PACK_INDEX),\n \".json\"\n )\n );\n }\n\n function wasEverMinted(uint256 id) public view returns(bool) {\n if ((id & IS_NFT) > 0) {\n return _owners[id] != 0;\n } else {\n return\n ((id & PACK_INDEX) < ((id & PACK_NUM_FT_TYPES) / PACK_NUM_FT_TYPES_OFFSET_MULTIPLIER)) &&\n _metadataHash[id & URI_ID] != 0;\n }\n }\n\n /// @notice A distinct Uniform Resource Identifier (URI) for a given token.\n /// @param id token to get the uri of.\n /// @return URI string\n function uri(uint256 id) public view returns (string memory) {\n require(wasEverMinted(id), \"token was never minted\"); // prevent returning invalid uri\n return toFullURI(_metadataHash[id & URI_ID], id);\n }\n\n /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.\n /// @param id token to get the uri of.\n /// @return URI string\n function tokenURI(uint256 id) public view returns (string memory) {\n require(_ownerOf(id) != address(0), \"NFT does not exist\");\n return toFullURI(_metadataHash[id & URI_ID], id);\n }\n\n bytes32 private constant base32Alphabet = 0x6162636465666768696A6B6C6D6E6F707172737475767778797A323334353637;\n // solium-disable-next-line security/no-assign-params\n function hash2base32(bytes32 hash)\n private\n pure\n returns (string memory _uintAsString)\n {\n uint256 _i = uint256(hash);\n uint256 k = 52;\n bytes memory bstr = new bytes(k);\n bstr[--k] = base32Alphabet[uint8((_i % 8) << 2)]; // uint8 s = uint8((256 - skip) % 5); // (_i % (2**s)) << (5-s)\n _i /= 8;\n while (k > 0) {\n bstr[--k] = base32Alphabet[_i % 32];\n _i /= 32;\n }\n return string(bstr);\n }\n\n // solium-disable-next-line security/no-assign-params\n function uint2str(uint256 _i)\n private\n pure\n returns (string memory _uintAsString)\n {\n if (_i == 0) {\n return \"0\";\n }\n\n uint256 j = _i;\n uint256 len;\n while (j != 0) {\n len++;\n j /= 10;\n }\n\n bytes memory bstr = new bytes(len);\n uint256 k = len - 1;\n while (_i != 0) {\n bstr[k--] = bytes1(uint8(48 + (_i % 10)));\n _i /= 10;\n }\n\n return string(bstr);\n }\n\n /// @notice Query if a contract implements interface `id`.\n /// @param id the interface identifier, as specified in ERC-165.\n /// @return `true` if the contract implements `id`.\n function supportsInterface(bytes4 id) external view returns (bool) {\n return\n id == 0x01ffc9a7 || //ERC165\n id == 0xd9b67a26 || // ERC1155\n id == 0x80ac58cd || // ERC721\n id == 0x5b5e139f || // ERC721 metadata\n id == 0x0e89341c; // ERC1155 metadata\n }\n\n bytes4 constant ERC165ID = 0x01ffc9a7;\n function checkIsERC1155Receiver(address _contract)\n internal\n view\n returns (bool)\n {\n bool success;\n bool result;\n bytes memory call_data = abi.encodeWithSelector(\n ERC165ID,\n ERC1155_IS_RECEIVER\n );\n // solium-disable-next-line security/no-inline-assembly\n assembly {\n let call_ptr := add(0x20, call_data)\n let call_size := mload(call_data)\n let output := mload(0x40) // Find empty storage location using \"free memory pointer\"\n mstore(output, 0x0)\n success := staticcall(\n 10000,\n _contract,\n call_ptr,\n call_size,\n output,\n 0x20\n ) // 32 bytes\n result := mload(output)\n }\n // (10000 / 63) \"not enough for supportsInterface(...)\" // consume all gas, so caller can potentially know that there was not enough gas\n assert(gasleft() > 158);\n return success && result;\n }\n\n function _checkERC1155AndCallSafeTransfer(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes memory data,\n bool erc721,\n bool erc721Safe\n ) internal returns (bool) {\n if (!to.isContract()) {\n return true;\n }\n if (erc721) {\n if (!checkIsERC1155Receiver(to)) {\n if (erc721Safe) {\n return\n _checkERC721AndCallSafeTransfer(\n operator,\n from,\n to,\n id,\n data\n );\n } else {\n return true;\n }\n }\n }\n return\n ERC1155TokenReceiver(to).onERC1155Received(\n operator,\n from,\n id,\n value,\n data\n ) == ERC1155_RECEIVED;\n }\n\n function _checkERC1155AndCallSafeBatchTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory values,\n bytes memory data\n ) internal returns (bool) {\n if (!to.isContract()) {\n return true;\n }\n bytes4 retval = ERC1155TokenReceiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n values,\n data\n );\n return (retval == ERC1155_BATCH_RECEIVED);\n }\n\n function _checkERC721AndCallSafeTransfer(\n address operator,\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) internal returns (bool) {\n // following not required as this function is always called as part of ERC1155 checks that include such check already\n // if (!to.isContract()) {\n // return true;\n // }\n return (ERC721TokenReceiver(to).onERC721Received(\n operator,\n from,\n id,\n data\n ) ==\n ERC721_RECEIVED);\n }\n\n event Extraction(uint256 indexed fromId, uint256 toId);\n event AssetUpdate(uint256 indexed fromId, uint256 toId);\n\n function _burnERC1155(\n address operator,\n address from,\n uint256 id,\n uint32 amount\n ) internal {\n (uint256 bin, uint256 index) = (id).getTokenBinIndex();\n _packedTokenBalance[from][bin] = _packedTokenBalance[from][bin]\n .updateTokenBalance(index, amount, ObjectLib32.Operations.SUB);\n emit TransferSingle(operator, from, address(0), id, amount);\n }\n\n function _burnERC721(address operator, address from, uint256 id)\n internal\n {\n require(from == _ownerOf(id), \"not owner\");\n _owners[id] = 2**160; // equivalent to zero address when casted but ensure we track minted status\n _numNFTPerAddress[from]--;\n emit Transfer(from, address(0), id);\n emit TransferSingle(operator, from, address(0), id, 1);\n }\n\n /// @notice Burns `amount` tokens of type `id`.\n /// @param id token type which will be burnt.\n /// @param amount amount of token to burn.\n function burn(uint256 id, uint256 amount) external {\n _burn(msg.sender, id, amount);\n }\n\n /// @notice Burns `amount` tokens of type `id` from `from`.\n /// @param from address whose token is to be burnt.\n /// @param id token type which will be burnt.\n /// @param amount amount of token to burn.\n function burnFrom(address from, uint256 id, uint256 amount) external {\n require(from != address(0), \"from is zero address\");\n require(\n msg.sender == from ||\n _metaTransactionContracts[msg.sender] ||\n _superOperators[msg.sender] ||\n _operatorsForAll[from][msg.sender],\n \"require meta approval\"\n );\n _burn(from, id, amount);\n }\n\n function _burn(address from, uint256 id, uint256 amount) internal {\n if ((id & IS_NFT) > 0) {\n require(amount == 1, \"can only burn one NFT\");\n _burnERC721(\n _metaTransactionContracts[msg.sender] ? from : msg.sender,\n from,\n id\n );\n } else {\n require(amount > 0 && amount <= MAX_SUPPLY, \"invalid amount\");\n _burnERC1155(\n _metaTransactionContracts[msg.sender] ? from : msg.sender,\n from,\n id,\n uint32(amount)\n );\n }\n }\n\n /// @notice Upgrades an NFT with new metadata and rarity.\n /// @param from address which own the NFT to be upgraded.\n /// @param id the NFT that will be burnt to be upgraded.\n /// @param packId unqiue packId for the token.\n /// @param hash hash of an IPFS cidv1 folder that contains the metadata of the new token type in the file 0.json.\n /// @param newRarity rarity power of the new NFT.\n /// @param to address which will receive the NFT.\n /// @param data bytes to be transmitted as part of the minted token.\n /// @return the id of the newly minted NFT.\n function updateERC721(\n address from,\n uint256 id,\n uint40 packId,\n bytes32 hash,\n uint8 newRarity,\n address to,\n bytes calldata data\n ) external returns(uint256) {\n require(hash != 0, \"hash is zero\");\n require(\n _bouncers[msg.sender],\n \"only bouncer allowed to mint via update\"\n );\n require(to != address(0), \"destination is zero address\");\n require(from != address(0), \"from is zero address\");\n\n _burnERC721(msg.sender, from, id);\n\n uint256 newId = generateTokenId(from, 1, packId, 0, 0);\n _mint(hash, 1, newRarity, msg.sender, to, newId, data, false);\n emit AssetUpdate(id, newId);\n return newId;\n }\n\n /// @notice Extracts an EIP-721 NFT from an EIP-1155 token.\n /// @param id the token type to extract from.\n /// @param to address which will receive the token.\n /// @return the id of the newly minted NFT.\n function extractERC721(uint256 id, address to)\n external\n returns (uint256 newId)\n {\n return _extractERC721From(msg.sender, msg.sender, id, to);\n }\n\n /// @notice Extracts an EIP-721 NFT from an EIP-1155 token.\n /// @param sender address which own the token to be extracted.\n /// @param id the token type to extract from.\n /// @param to address which will receive the token.\n /// @return the id of the newly minted NFT.\n function extractERC721From(address sender, uint256 id, address to)\n external\n returns (uint256 newId)\n {\n require(\n msg.sender == sender ||\n _metaTransactionContracts[msg.sender] ||\n _superOperators[msg.sender] ||\n _operatorsForAll[sender][msg.sender],\n \"require meta approval\"\n );\n address operator = _metaTransactionContracts[msg.sender]\n ? sender\n : msg.sender;\n return _extractERC721From(operator, sender, id, to);\n }\n\n function _extractERC721From(address operator, address sender, uint256 id, address to)\n internal\n returns (uint256 newId)\n {\n require(to != address(0), \"destination is zero address\");\n require(id & IS_NFT == 0, \"Not an ERC1155 Token\");\n uint32 tokenCollectionIndex = _nextCollectionIndex[id];\n newId = id +\n IS_NFT +\n (tokenCollectionIndex) *\n 2**NFT_INDEX_OFFSET;\n _nextCollectionIndex[id] = tokenCollectionIndex + 1;\n _burnERC1155(operator, sender, id, 1);\n _mint(\n _metadataHash[id & URI_ID],\n 1,\n 0,\n operator,\n to,\n newId,\n \"\",\n true\n );\n emit Extraction(id, newId);\n }\n}\n" + }, + "src/solc_0.5/Asset/GenesisBouncer.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"./ERC1155ERC721.sol\";\nimport \"../contracts_common/BaseWithStorage/Admin.sol\";\n\ncontract GenesisBouncer is Admin {\n ERC1155ERC721 _asset;\n mapping(address => bool) _minters;\n\n constructor(ERC1155ERC721 asset, address genesisAdmin, address firstMinter)\n public\n {\n _asset = asset;\n _admin = genesisAdmin;\n _setMinter(firstMinter, true);\n }\n\n event MinterUpdated(address minter, bool allowed);\n function _setMinter(address minter, bool allowed) internal {\n _minters[minter] = allowed;\n emit MinterUpdated(minter, allowed);\n }\n function setMinter(address minter, bool allowed) external {\n require(msg.sender == _admin, \"only admin can allocate minter\");\n _setMinter(minter, allowed);\n }\n\n function mintFor(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint32 supply,\n uint8 rarity,\n address owner\n ) public returns (uint256 tokenId) {\n require(_minters[msg.sender], \"not authorized\");\n return\n _asset.mint(creator, packId, hash, supply, rarity, owner, \"\");\n }\n\n function mintMultipleFor(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256[] memory supplies,\n bytes memory rarityPack,\n address owner\n ) public returns (uint256[] memory ids) {\n require(_minters[msg.sender], \"not authorized\");\n return\n _asset.mintMultiple(\n creator,\n packId,\n hash,\n supplies,\n rarityPack,\n owner,\n \"\"\n );\n }\n}\n" + }, + "src/solc_0.5/Asset/Interfaces/AssetBouncer.sol": { + "content": "pragma solidity 0.5.9;\n\ncontract AssetBouncer {}\n" + }, + "src/solc_0.5/Asset/Interfaces/MintingFeeCollector.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../../contracts_common/Interfaces/ERC20.sol\";\n\ninterface MintingFeeCollector {\n function newFee(ERC20 _newFeeToken, uint256 _newFee) external;\n function multiple_minted(uint256[] calldata tokenIds) external;\n function single_minted(uint256 tokenId) external;\n}\n" + }, + "src/solc_0.5/Auctions/AssetSignedAuction.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../contracts_common/Libraries/SigUtil.sol\";\nimport \"../contracts_common/Libraries/PriceUtil.sol\";\nimport \"../Sand.sol\";\nimport \"../Asset.sol\";\nimport \"../contracts_common/Interfaces/ERC20.sol\";\nimport \"../TheSandbox712.sol\";\nimport \"../contracts_common/BaseWithStorage/MetaTransactionReceiver.sol\";\n\nimport \"../contracts_common/Interfaces/ERC1271.sol\";\nimport \"../contracts_common/Interfaces/ERC1271Constants.sol\";\nimport \"../contracts_common/Interfaces/ERC1654.sol\";\nimport \"../contracts_common/Interfaces/ERC1654Constants.sol\";\nimport \"../contracts_common/Libraries/SafeMathWithRequire.sol\";\n\ncontract AssetSignedAuction is ERC1654Constants, ERC1271Constants, TheSandbox712, MetaTransactionReceiver {\n using SafeMathWithRequire for uint256;\n\n enum SignatureType { DIRECT, EIP1654, EIP1271 }\n\n bytes32 constant AUCTION_TYPEHASH = keccak256(\n \"Auction(address from,address token,uint256 offerId,uint256 startingPrice,uint256 endingPrice,uint256 startedAt,uint256 duration,uint256 packs,bytes ids,bytes amounts)\"\n );\n\n event OfferClaimed(\n address indexed seller,\n address indexed buyer,\n uint256 indexed offerId,\n uint256 amount,\n uint256 pricePaid,\n uint256 feePaid\n );\n event OfferCancelled(address indexed seller, uint256 indexed offerId);\n\n uint256 constant MAX_UINT256 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;\n\n // Stack too deep, grouping parameters\n // AuctionData:\n uint256 constant AuctionData_OfferId = 0;\n uint256 constant AuctionData_StartingPrice = 1;\n uint256 constant AuctionData_EndingPrice = 2;\n uint256 constant AuctionData_StartedAt = 3;\n uint256 constant AuctionData_Duration = 4;\n uint256 constant AuctionData_Packs = 5;\n\n mapping(address => mapping(uint256 => uint256)) claimed;\n\n Asset _asset;\n uint256 _fee10000th = 0;\n address payable _feeCollector;\n\n event FeeSetup(address feeCollector, uint256 fee10000th);\n\n constructor(Asset asset, address admin, address initialMetaTx, address payable feeCollector, uint256 fee10000th) public {\n _asset = asset;\n _feeCollector = feeCollector;\n _fee10000th = fee10000th;\n emit FeeSetup(feeCollector, fee10000th);\n _admin = admin;\n _setMetaTransactionProcessor(initialMetaTx, true);\n init712();\n }\n\n /// @notice set fee parameters\n /// @param feeCollector address receiving the fee\n /// @param fee10000th fee in 10,000th\n function setFee(address payable feeCollector, uint256 fee10000th) external {\n require(msg.sender == _admin, \"only admin can change fee\");\n _feeCollector = feeCollector;\n _fee10000th = fee10000th;\n emit FeeSetup(feeCollector, fee10000th);\n }\n\n function _verifyParameters(\n address buyer,\n address payable seller,\n address token,\n uint256 buyAmount,\n uint256[] memory auctionData,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal view {\n require(ids.length == amounts.length, \"ids and amounts length not matching\");\n require(buyer == msg.sender || (token != address(0) && _metaTransactionContracts[msg.sender]), \"not authorized\");\n uint256 amountAlreadyClaimed = claimed[seller][auctionData[AuctionData_OfferId]];\n require(amountAlreadyClaimed != MAX_UINT256, \"Auction cancelled\");\n\n uint256 total = amountAlreadyClaimed.add(buyAmount);\n require(total >= amountAlreadyClaimed, \"overflow\");\n require(total <= auctionData[AuctionData_Packs], \"Buy amount exceeds sell amount\");\n\n require(\n auctionData[AuctionData_StartedAt] <= block.timestamp,\n \"Auction didn't start yet\"\n );\n require(\n auctionData[AuctionData_StartedAt].add(auctionData[AuctionData_Duration]) > block.timestamp,\n \"Auction finished\"\n );\n\n }\n\n /// @notice claim offer using EIP712\n /// @param buyer address paying for the offer\n /// @param seller address of the seller\n /// @param token token used for payment\n /// @param purchase buyAmount, maxTokenAmount\n /// @param auctionData offerId, startingPrice, endingPrice, startedAt, duration, packs\n /// @param ids ids of the Assets being sold\n /// @param amounts amounts of Assets per pack\n /// @param signature signature of seller\n function claimSellerOffer(\n address buyer,\n address payable seller,\n address token,\n uint256[] calldata purchase, // buyAmount, maxTokenAmount\n uint256[] calldata auctionData,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata signature\n ) external payable {\n _verifyParameters(\n buyer,\n seller,\n token,\n purchase[0],\n auctionData,\n ids,\n amounts\n );\n _ensureCorrectSigner(seller, token, auctionData, ids, amounts, signature, SignatureType.DIRECT, true);\n _executeDeal(\n token,\n purchase,\n buyer,\n seller,\n auctionData,\n ids,\n amounts\n );\n }\n\n /// @notice claim offer using EIP712 and EIP1271 signature verification scheme\n /// @param buyer address paying for the offer\n /// @param seller address of the seller\n /// @param token token used for payment\n /// @param purchase buyAmount, maxTokenAmount\n /// @param auctionData offerId, startingPrice, endingPrice, startedAt, duration, packs\n /// @param ids ids of the Assets being sold\n /// @param amounts amounts of Assets per pack\n /// @param signature signature of seller\n function claimSellerOfferViaEIP1271(\n address buyer,\n address payable seller,\n address token,\n uint256[] calldata purchase, // buyAmount, maxTokenAmount\n uint256[] calldata auctionData,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata signature\n ) external payable {\n _verifyParameters(\n buyer,\n seller,\n token,\n purchase[0],\n auctionData,\n ids,\n amounts\n );\n _ensureCorrectSigner(seller, token, auctionData, ids, amounts, signature, SignatureType.EIP1271, true);\n _executeDeal(\n token,\n purchase,\n buyer,\n seller,\n auctionData,\n ids,\n amounts\n );\n }\n\n /// @notice claim offer using EIP712 and EIP1654 signature verification scheme\n /// @param buyer address paying for the offer\n /// @param seller address of the seller\n /// @param token token used for payment\n /// @param purchase buyAmount, maxTokenAmount\n /// @param auctionData offerId, startingPrice, endingPrice, startedAt, duration, packs\n /// @param ids ids of the Assets being sold\n /// @param amounts amounts of Assets per pack\n /// @param signature signature of seller\n function claimSellerOfferViaEIP1654(\n address buyer,\n address payable seller,\n address token,\n uint256[] calldata purchase, // buyAmount, maxTokenAmount\n uint256[] calldata auctionData,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata signature\n ) external payable {\n _verifyParameters(\n buyer,\n seller,\n token,\n purchase[0],\n auctionData,\n ids,\n amounts\n );\n _ensureCorrectSigner(seller, token, auctionData, ids, amounts, signature, SignatureType.EIP1654, true);\n _executeDeal(\n token,\n purchase,\n buyer,\n seller,\n auctionData,\n ids,\n amounts\n );\n }\n\n /// @notice claim offer using Basic Signature\n /// @param buyer address paying for the offer\n /// @param seller address of the seller\n /// @param token token used for payment\n /// @param purchase buyAmount, maxTokenAmount\n /// @param auctionData offerId, startingPrice, endingPrice, startedAt, duration, packs\n /// @param ids ids of the Assets being sold\n /// @param amounts amounts of Assets per pack\n /// @param signature signature of seller\n function claimSellerOfferUsingBasicSig(\n address buyer,\n address payable seller,\n address token,\n uint256[] calldata purchase, // buyAmount, maxTokenAmount\n uint256[] calldata auctionData,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata signature\n ) external payable {\n _verifyParameters(\n buyer,\n seller,\n token,\n purchase[0],\n auctionData,\n ids,\n amounts\n );\n _ensureCorrectSigner(seller, token, auctionData, ids, amounts, signature, SignatureType.DIRECT, false);\n _executeDeal(\n token,\n purchase,\n buyer,\n seller,\n auctionData,\n ids,\n amounts\n );\n }\n\n /// @notice claim offer using Basic Signature and EIP1271 signature verification scheme\n /// @param buyer address paying for the offer\n /// @param seller address of the seller\n /// @param token token used for payment\n /// @param purchase buyAmount, maxTokenAmount\n /// @param auctionData offerId, startingPrice, endingPrice, startedAt, duration, packs\n /// @param ids ids of the Assets being sold\n /// @param amounts amounts of Assets per pack\n /// @param signature signature of seller\n function claimSellerOfferUsingBasicSigViaEIP1271(\n address buyer,\n address payable seller,\n address token,\n uint256[] calldata purchase, // buyAmount, maxTokenAmount\n uint256[] calldata auctionData,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata signature\n ) external payable {\n _verifyParameters(\n buyer,\n seller,\n token,\n purchase[0],\n auctionData,\n ids,\n amounts\n );\n _ensureCorrectSigner(seller, token, auctionData, ids, amounts, signature, SignatureType.EIP1271, false);\n _executeDeal(\n token,\n purchase,\n buyer,\n seller,\n auctionData,\n ids,\n amounts\n );\n }\n\n /// @notice claim offer using Basic Signature and EIP1654 signature verification scheme\n /// @param buyer address paying for the offer\n /// @param seller address of the seller\n /// @param token token used for payment\n /// @param purchase buyAmount, maxTokenAmount\n /// @param auctionData offerId, startingPrice, endingPrice, startedAt, duration, packs\n /// @param ids ids of the Assets being sold\n /// @param amounts amounts of Assets per pack\n /// @param signature signature of seller\n function claimSellerOfferUsingBasicSigViaEIP1654(\n address buyer,\n address payable seller,\n address token,\n uint256[] calldata purchase, // buyAmount, maxTokenAmount\n uint256[] calldata auctionData,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata signature\n ) external payable {\n _verifyParameters(\n buyer,\n seller,\n token,\n purchase[0],\n auctionData,\n ids,\n amounts\n );\n _ensureCorrectSigner(seller, token, auctionData, ids, amounts, signature, SignatureType.EIP1654, false);\n _executeDeal(\n token,\n purchase,\n buyer,\n seller,\n auctionData,\n ids,\n amounts\n );\n }\n\n function _executeDeal(\n address token,\n uint256[] memory purchase,\n address buyer,\n address payable seller,\n uint256[] memory auctionData,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal {\n uint256 offer = PriceUtil.calculateCurrentPrice(\n auctionData[AuctionData_StartingPrice],\n auctionData[AuctionData_EndingPrice],\n auctionData[AuctionData_Duration],\n block.timestamp.sub(auctionData[AuctionData_StartedAt])\n ).mul(purchase[0]);\n claimed[seller][auctionData[AuctionData_OfferId]] = claimed[seller][auctionData[AuctionData_OfferId]].add(purchase[0]);\n\n uint256 fee = 0;\n if(_fee10000th > 0) {\n fee = PriceUtil.calculateFee(offer, _fee10000th);\n }\n\n uint256 total = offer.add(fee);\n require(total <= purchase[1], \"offer exceeds max amount to spend\");\n\n if (token != address(0)) {\n require(ERC20(token).transferFrom(buyer, seller, offer), \"failed to transfer token price\");\n if(fee > 0) {\n require(ERC20(token).transferFrom(buyer, _feeCollector, fee), \"failed to collect fee\");\n }\n } else {\n require(msg.value >= total, \"ETH < offer+fee\");\n if(msg.value > total) {\n msg.sender.transfer(msg.value.sub(total));\n }\n seller.transfer(offer);\n if(fee > 0) {\n _feeCollector.transfer(fee);\n }\n }\n\n uint256[] memory packAmounts = new uint256[](amounts.length);\n for (uint256 i = 0; i < packAmounts.length; i++) {\n packAmounts[i] = amounts[i].mul(purchase[0]);\n }\n _asset.safeBatchTransferFrom(seller, buyer, ids, packAmounts, \"\");\n emit OfferClaimed(\n seller,\n buyer,\n auctionData[AuctionData_OfferId],\n purchase[0],\n offer,\n fee\n );\n }\n\n /// @notice cancel a offer previously signed, new offer need to use a id not used yet\n /// @param offerId offer to cancel\n function cancelSellerOffer(uint256 offerId) external {\n claimed[msg.sender][offerId] = MAX_UINT256;\n emit OfferCancelled(msg.sender, offerId);\n }\n\n function _ensureCorrectSigner(\n address from,\n address token,\n uint256[] memory auctionData,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory signature,\n SignatureType signatureType,\n bool eip712\n ) internal view returns (address) {\n bytes memory dataToHash;\n\n if(eip712) {\n dataToHash = abi.encodePacked(\n \"\\x19\\x01\",\n domainSeparator(),\n _hashAuction(from, token, auctionData, ids, amounts)\n );\n } else {\n dataToHash = _encodeBasicSignatureHash(from, token, auctionData, ids, amounts);\n }\n\n if (signatureType == SignatureType.EIP1271) {\n require(\n ERC1271(from).isValidSignature(dataToHash, signature) == ERC1271_MAGICVALUE,\n \"invalid 1271 signature\"\n );\n } else if(signatureType == SignatureType.EIP1654){\n require(\n ERC1654(from).isValidSignature(keccak256(dataToHash), signature) == ERC1654_MAGICVALUE,\n \"invalid 1654 signature\"\n );\n } else {\n address signer = SigUtil.recover(keccak256(dataToHash), signature);\n require(signer == from, \"signer != from\");\n }\n }\n\n function _encodeBasicSignatureHash(\n address from,\n address token,\n uint256[] memory auctionData,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal view returns (bytes memory) {\n return SigUtil.prefixed(keccak256(abi.encodePacked(\n address(this),\n AUCTION_TYPEHASH,\n from,\n token,\n auctionData[AuctionData_OfferId],\n auctionData[AuctionData_StartingPrice],\n auctionData[AuctionData_EndingPrice],\n auctionData[AuctionData_StartedAt],\n auctionData[AuctionData_Duration],\n auctionData[AuctionData_Packs],\n keccak256(abi.encodePacked(ids)),\n keccak256(abi.encodePacked(amounts))\n )));\n }\n\n function _hashAuction(\n address from,\n address token,\n uint256[] memory auctionData,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encode(\n AUCTION_TYPEHASH,\n from,\n token,\n auctionData[AuctionData_OfferId],\n auctionData[AuctionData_StartingPrice],\n auctionData[AuctionData_EndingPrice],\n auctionData[AuctionData_StartedAt],\n auctionData[AuctionData_Duration],\n auctionData[AuctionData_Packs],\n keccak256(abi.encodePacked(ids)),\n keccak256(abi.encodePacked(amounts))\n )\n );\n }\n}\n" + }, + "src/solc_0.5/BaseWithStorage/ERC2771Handler.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.5.9;\n\n/// @dev minimal ERC2771 handler to keep bytecode-size down\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.6.0/contracts/metatx/ERC2771Context.sol\n/// with an initializer for proxies, no _msgData function and a mutable forwarder\n\ncontract ERC2771Handler {\n address internal _trustedForwarder;\n\n function __ERC2771Handler_initialize(address forwarder) internal {\n _trustedForwarder = forwarder;\n }\n\n function isTrustedForwarder(address forwarder) public view returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n function getTrustedForwarder() external view returns (address trustedForwarder) {\n return _trustedForwarder;\n }\n\n function _msgSender() internal view returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return msg.sender;\n }\n }\n}\n" + }, + "src/solc_0.5/BaseWithStorage/ERC721BaseToken.sol": { + "content": "/* solhint-disable func-order, code-complexity */\npragma solidity 0.5.9;\n\nimport \"../contracts_common/Libraries/AddressUtils.sol\";\nimport \"../contracts_common/Interfaces/ERC721TokenReceiver.sol\";\nimport \"../contracts_common/Interfaces/ERC721Events.sol\";\nimport \"../contracts_common/BaseWithStorage/SuperOperators.sol\";\nimport \"../contracts_common/BaseWithStorage/MetaTransactionReceiver.sol\";\nimport \"../contracts_common/Interfaces/ERC721MandatoryTokenReceiver.sol\";\n\ncontract ERC721BaseToken is ERC721Events, SuperOperators, MetaTransactionReceiver {\n using AddressUtils for address;\n\n bytes4 internal constant _ERC721_RECEIVED = 0x150b7a02;\n bytes4 internal constant _ERC721_BATCH_RECEIVED = 0x4b808c46;\n\n bytes4 internal constant ERC165ID = 0x01ffc9a7;\n bytes4 internal constant ERC721_MANDATORY_RECEIVER = 0x5e8bf644;\n\n mapping (address => uint256) public _numNFTPerAddress;\n mapping (uint256 => uint256) public _owners;\n mapping (address => mapping(address => bool)) public _operatorsForAll;\n mapping (uint256 => address) public _operators;\n\n constructor(\n address metaTransactionContract,\n address admin\n ) internal {\n _admin = admin;\n _setMetaTransactionProcessor(metaTransactionContract, true);\n }\n\n function _transferFrom(address from, address to, uint256 id) internal {\n _numNFTPerAddress[from]--;\n _numNFTPerAddress[to]++;\n _owners[id] = uint256(to);\n emit Transfer(from, to, id);\n }\n\n /**\n * @notice Return the number of Land owned by an address\n * @param owner The address to look for\n * @return The number of Land token owned by the address\n */\n function balanceOf(address owner) external view returns (uint256) {\n require(owner != address(0), \"owner is zero address\");\n return _numNFTPerAddress[owner];\n }\n\n\n function _ownerOf(uint256 id) internal view returns (address) {\n return address(_owners[id]);\n }\n\n function _ownerAndOperatorEnabledOf(uint256 id) internal view returns (address owner, bool operatorEnabled) {\n uint256 data = _owners[id];\n owner = address(data);\n operatorEnabled = (data / 2**255) == 1;\n }\n\n /**\n * @notice Return the owner of a Land\n * @param id The id of the Land\n * @return The address of the owner\n */\n function ownerOf(uint256 id) external view returns (address owner) {\n owner = _ownerOf(id);\n require(owner != address(0), \"token does not exist\");\n }\n\n function _approveFor(address owner, address operator, uint256 id) internal {\n if(operator == address(0)) {\n _owners[id] = uint256(owner); // no need to resset the operator, it will be overriden next time\n } else {\n _owners[id] = uint256(owner) + 2**255;\n _operators[id] = operator;\n }\n emit Approval(owner, operator, id);\n }\n\n /**\n * @notice Approve an operator to spend tokens on the sender behalf\n * @param sender The address giving the approval\n * @param operator The address receiving the approval\n * @param id The id of the token\n */\n function approveFor(\n address sender,\n address operator,\n uint256 id\n ) external {\n address owner = _ownerOf(id);\n require(sender != address(0), \"sender is zero address\");\n require(\n msg.sender == sender ||\n _metaTransactionContracts[msg.sender] ||\n _superOperators[msg.sender] ||\n _operatorsForAll[sender][msg.sender],\n \"not authorized to approve\"\n );\n require(owner == sender, \"owner != sender\");\n _approveFor(owner, operator, id);\n }\n\n /**\n * @notice Approve an operator to spend tokens on the sender behalf\n * @param operator The address receiving the approval\n * @param id The id of the token\n */\n function approve(address operator, uint256 id) external {\n address owner = _ownerOf(id);\n require(owner != address(0), \"token does not exist\");\n require(\n owner == msg.sender ||\n _superOperators[msg.sender] ||\n _operatorsForAll[owner][msg.sender],\n \"not authorized to approve\"\n );\n _approveFor(owner, operator, id);\n }\n\n /**\n * @notice Get the approved operator for a specific token\n * @param id The id of the token\n * @return The address of the operator\n */\n function getApproved(uint256 id) external view returns (address) {\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(owner != address(0), \"token does not exist\");\n if (operatorEnabled) {\n return _operators[id];\n } else {\n return address(0);\n }\n }\n\n function _checkTransfer(address from, address to, uint256 id) internal view returns (bool isMetaTx) {\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(owner != address(0), \"token does not exist\");\n require(owner == from, \"not owner in _checkTransfer\");\n require(to != address(0), \"can't send to zero address\");\n isMetaTx = msg.sender != from && _metaTransactionContracts[msg.sender];\n if (msg.sender != from && !isMetaTx) {\n require(\n _superOperators[msg.sender] ||\n _operatorsForAll[from][msg.sender] ||\n (operatorEnabled && _operators[id] == msg.sender),\n \"not approved to transfer\"\n );\n }\n }\n\n function _checkInterfaceWith10000Gas(address _contract, bytes4 interfaceId)\n internal\n view\n returns (bool)\n {\n bool success;\n bool result;\n bytes memory call_data = abi.encodeWithSelector(\n ERC165ID,\n interfaceId\n );\n // solium-disable-next-line security/no-inline-assembly\n assembly {\n let call_ptr := add(0x20, call_data)\n let call_size := mload(call_data)\n let output := mload(0x40) // Find empty storage location using \"free memory pointer\"\n mstore(output, 0x0)\n success := staticcall(\n 10000,\n _contract,\n call_ptr,\n call_size,\n output,\n 0x20\n ) // 32 bytes\n result := mload(output)\n }\n // (10000 / 63) \"not enough for supportsInterface(...)\" // consume all gas, so caller can potentially know that there was not enough gas\n assert(gasleft() > 158);\n return success && result;\n }\n\n /**\n * @notice Transfer a token between 2 addresses\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param id The id of the token\n */\n function transferFrom(address from, address to, uint256 id) external {\n bool metaTx = _checkTransfer(from, to, id);\n _transferFrom(from, to, id);\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n require(\n _checkOnERC721Received(metaTx ? from : msg.sender, from, to, id, \"\"),\n \"erc721 transfer rejected by to\"\n );\n }\n }\n\n /**\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param id The id of the token\n * @param data Additional data\n */\n function safeTransferFrom(address from, address to, uint256 id, bytes memory data) public {\n bool metaTx = _checkTransfer(from, to, id);\n _transferFrom(from, to, id);\n if (to.isContract()) {\n require(\n _checkOnERC721Received(metaTx ? from : msg.sender, from, to, id, data),\n \"ERC721: transfer rejected by to\"\n );\n }\n }\n\n /**\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\n * @param from The send of the token\n * @param to The recipient of the token\n * @param id The id of the token\n */\n function safeTransferFrom(address from, address to, uint256 id) external {\n safeTransferFrom(from, to, id, \"\");\n }\n\n /**\n * @notice Transfer many tokens between 2 addresses\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param ids The ids of the tokens\n * @param data additional data\n */\n function batchTransferFrom(address from, address to, uint256[] calldata ids, bytes calldata data) external {\n _batchTransferFrom(from, to, ids, data, false);\n }\n\n function _batchTransferFrom(address from, address to, uint256[] memory ids, bytes memory data, bool safe) internal {\n bool metaTx = msg.sender != from && _metaTransactionContracts[msg.sender];\n bool authorized = msg.sender == from ||\n metaTx ||\n _superOperators[msg.sender] ||\n _operatorsForAll[from][msg.sender];\n\n require(from != address(0), \"from is zero address\");\n require(to != address(0), \"can't send to zero address\");\n\n uint256 numTokens = ids.length;\n for(uint256 i = 0; i < numTokens; i ++) {\n uint256 id = ids[i];\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(owner == from, \"not owner in batchTransferFrom\");\n require(authorized || (operatorEnabled && _operators[id] == msg.sender), \"not authorized\");\n _owners[id] = uint256(to);\n emit Transfer(from, to, id);\n }\n if (from != to) {\n _numNFTPerAddress[from] -= numTokens;\n _numNFTPerAddress[to] += numTokens;\n }\n\n if (to.isContract() && (safe || _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER))) {\n require(\n _checkOnERC721BatchReceived(metaTx ? from : msg.sender, from, to, ids, data),\n \"erc721 batch transfer rejected by to\"\n );\n }\n }\n\n /**\n * @notice Transfer many tokens between 2 addresses ensuring the receiving contract has a receiver method\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param ids The ids of the tokens\n * @param data additional data\n */\n function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, bytes calldata data) external {\n _batchTransferFrom(from, to, ids, data, true);\n }\n\n /**\n * @notice Check if the contract supports an interface\n * 0x01ffc9a7 is ERC-165\n * 0x80ac58cd is ERC-721\n * @param id The id of the interface\n * @return True if the interface is supported\n */\n function supportsInterface(bytes4 id) external pure returns (bool) {\n return id == 0x01ffc9a7 || id == 0x80ac58cd;\n }\n\n /**\n * @notice Set the approval for an operator to manage all the tokens of the sender\n * @param sender The address giving the approval\n * @param operator The address receiving the approval\n * @param approved The determination of the approval\n */\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) external {\n require(sender != address(0), \"Invalid sender address\");\n require(\n msg.sender == sender ||\n _metaTransactionContracts[msg.sender] ||\n _superOperators[msg.sender],\n \"not authorized to approve for all\"\n );\n\n _setApprovalForAll(sender, operator, approved);\n }\n\n /**\n * @notice Set the approval for an operator to manage all the tokens of the sender\n * @param operator The address receiving the approval\n * @param approved The determination of the approval\n */\n function setApprovalForAll(address operator, bool approved) external {\n _setApprovalForAll(msg.sender, operator, approved);\n }\n\n\n function _setApprovalForAll(\n address sender,\n address operator,\n bool approved\n ) internal {\n require(\n !_superOperators[operator],\n \"super operator can't have their approvalForAll changed\"\n );\n _operatorsForAll[sender][operator] = approved;\n\n emit ApprovalForAll(sender, operator, approved);\n }\n\n /**\n * @notice Check if the sender approved the operator\n * @param owner The address of the owner\n * @param operator The address of the operator\n * @return The status of the approval\n */\n function isApprovedForAll(address owner, address operator)\n external\n view\n returns (bool isOperator)\n {\n return _operatorsForAll[owner][operator] || _superOperators[operator];\n }\n\n function _burn(address from, address owner, uint256 id) internal {\n require(from == owner, \"not owner\");\n _owners[id] = 2**160; // cannot mint it again\n _numNFTPerAddress[from]--;\n emit Transfer(from, address(0), id);\n }\n\n /// @notice Burns token `id`.\n /// @param id token which will be burnt.\n function burn(uint256 id) external {\n _burn(msg.sender, _ownerOf(id), id);\n }\n\n /// @notice Burn token`id` from `from`.\n /// @param from address whose token is to be burnt.\n /// @param id token which will be burnt.\n function burnFrom(address from, uint256 id) external {\n require(from != address(0), \"Invalid sender address\");\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(\n msg.sender == from ||\n _metaTransactionContracts[msg.sender] ||\n (operatorEnabled && _operators[id] == msg.sender) ||\n _superOperators[msg.sender] ||\n _operatorsForAll[from][msg.sender],\n \"not authorized to burn\"\n );\n _burn(from, owner, id);\n }\n\n function _checkOnERC721Received(address operator, address from, address to, uint256 tokenId, bytes memory _data)\n internal returns (bool)\n {\n bytes4 retval = ERC721TokenReceiver(to).onERC721Received(operator, from, tokenId, _data);\n return (retval == _ERC721_RECEIVED);\n }\n\n function _checkOnERC721BatchReceived(address operator, address from, address to, uint256[] memory ids, bytes memory _data)\n internal returns (bool)\n {\n bytes4 retval = ERC721MandatoryTokenReceiver(to).onERC721BatchReceived(operator, from, ids, _data);\n return (retval == _ERC721_BATCH_RECEIVED);\n }\n}\n" + }, + "src/solc_0.5/BundleSandSale/BundleSandSale.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../contracts_common/Libraries/SafeMathWithRequire.sol\";\nimport \"../contracts_common/Interfaces/ERC20.sol\";\nimport \"../contracts_common/Interfaces/Medianizer.sol\";\nimport \"../contracts_common/BaseWithStorage/Admin.sol\";\nimport \"../Asset/ERC1155ERC721.sol\";\n\n\ncontract BundleSandSale is Admin {\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n event BundleSale(\n uint256 indexed saleId,\n uint256[] ids,\n uint256[] amounts,\n uint256 sandAmount,\n uint256 priceUSD,\n uint256 numPacks\n );\n\n event BundleSold(\n uint256 indexed saleId,\n address indexed buyer,\n uint256 numPacks,\n address token,\n uint256 tokenAmount\n );\n\n using SafeMathWithRequire for uint256;\n\n Medianizer private _medianizer;\n ERC20 private _dai;\n ERC20 private _sand;\n ERC1155ERC721 private _asset;\n\n address payable private _receivingWallet;\n\n struct Sale {\n uint256[] ids;\n uint256[] amounts;\n uint256 sandAmount;\n uint256 priceUSD;\n uint256 numPacksLeft;\n }\n\n Sale[] private sales;\n\n constructor(\n address sandTokenContractAddress,\n address assetTokenContractAddress,\n address medianizerContractAddress,\n address daiTokenContractAddress,\n address admin,\n address payable receivingWallet\n ) public {\n require(receivingWallet != address(0), \"need a wallet to receive funds\");\n _medianizer = Medianizer(medianizerContractAddress);\n _sand = ERC20(sandTokenContractAddress);\n _asset = ERC1155ERC721(assetTokenContractAddress);\n _dai = ERC20(daiTokenContractAddress);\n _admin = admin;\n _receivingWallet = receivingWallet;\n }\n\n /// @notice set the wallet receiving the proceeds\n /// @param newWallet address of the new receiving wallet\n function setReceivingWallet(address payable newWallet) external {\n require(newWallet != address(0), \"receiving wallet cannot be zero address\");\n require(msg.sender == _admin, \"only admin can change the receiving wallet\");\n _receivingWallet = newWallet;\n }\n\n function _transferPack(uint256 saleIndex, uint256 numPacks, address to) internal {\n uint256 sandAmountPerPack = sales[saleIndex].sandAmount;\n require(\n _sand.transferFrom(address(this), to, sandAmountPerPack.mul(numPacks)),\n \"Sand Transfer failed\"\n );\n uint256[] memory ids = sales[saleIndex].ids;\n uint256[] memory amounts = sales[saleIndex].amounts;\n uint256 numIds = ids.length;\n for (uint256 i = 0; i < numIds; i++) {\n amounts[i] = amounts[i].mul(numPacks);\n }\n _asset.safeBatchTransferFrom(address(this), to, ids, amounts, \"\");\n }\n\n /**\n * @notice Buys Sand Bundle with Ether\n * @param saleId id of the bundle\n * @param numPacks the amount of packs to buy\n * @param to The address that will receive the SAND\n */\n function buyBundleWithEther(uint256 saleId, uint256 numPacks, address to) external payable {\n require(saleId > 0, \"invalid saleId\");\n uint256 saleIndex = saleId - 1;\n uint256 numPacksLeft = sales[saleIndex].numPacksLeft;\n require(numPacksLeft >= numPacks, \"not enough packs on sale\");\n sales[saleIndex].numPacksLeft = numPacksLeft - numPacks;\n\n uint256 USDRequired = numPacks.mul(sales[saleIndex].priceUSD);\n uint256 ETHRequired = getEtherAmountWithUSD(USDRequired);\n require(msg.value >= ETHRequired, \"not enough ether sent\");\n uint256 leftOver = msg.value - ETHRequired;\n if(leftOver > 0) {\n msg.sender.transfer(leftOver); // refund extra\n }\n address(_receivingWallet).transfer(ETHRequired);\n _transferPack(saleIndex, numPacks, to);\n\n emit BundleSold(saleId, msg.sender, numPacks, address(0), ETHRequired);\n }\n\n /**\n * @notice Buys Sand Bundle with DAI\n * @param saleId id of the bundle\n * @param numPacks the amount of packs to buy\n * @param to The address that will receive the SAND\n */\n function buyBundleWithDai(uint256 saleId, uint256 numPacks, address to) external {\n require(saleId > 0, \"invalid saleId\");\n uint256 saleIndex = saleId - 1;\n uint256 numPacksLeft = sales[saleIndex].numPacksLeft;\n require(numPacksLeft >= numPacks, \"not enough packs on sale\");\n sales[saleIndex].numPacksLeft = numPacksLeft - numPacks;\n\n uint256 USDRequired = numPacks.mul(sales[saleIndex].priceUSD);\n require(_dai.transferFrom(msg.sender, _receivingWallet, USDRequired), \"failed to transfer dai\");\n _transferPack(saleIndex, numPacks, to);\n\n emit BundleSold(saleId, msg.sender, numPacks, address(_dai), USDRequired);\n }\n\n function getSaleInfo(uint256 saleId) external view returns(uint256 priceUSD, uint256 numPacksLeft) {\n require(saleId > 0, \"invalid saleId\");\n uint256 saleIndex = saleId - 1;\n priceUSD = sales[saleIndex].priceUSD;\n numPacksLeft = sales[saleIndex].numPacksLeft;\n }\n\n function withdrawSale(uint256 saleId, address to) external onlyAdmin() {\n require(saleId > 0, \"invalid saleId\");\n uint256 saleIndex = saleId - 1;\n uint256 numPacksLeft = sales[saleIndex].numPacksLeft;\n sales[saleIndex].numPacksLeft = 0;\n\n uint256[] memory ids = sales[saleIndex].ids;\n uint256[] memory amounts = sales[saleIndex].amounts;\n uint256 numIds = ids.length;\n for (uint256 i = 0; i < numIds; i++) {\n amounts[i] = amounts[i].mul(numPacksLeft);\n }\n require(_sand.transferFrom(address(this), to, numPacksLeft.mul(sales[saleIndex].sandAmount)), \"transfer fo Sand failed\");\n _asset.safeBatchTransferFrom(address(this), to, ids, amounts, \"\");\n }\n\n /**\n * @notice Returns the amount of ETH for a specific amount of USD\n * @param usdAmount An amount of USD\n * @return The amount of ETH\n */\n function getEtherAmountWithUSD(uint256 usdAmount) public view returns (uint256) {\n uint256 ethUsdPair = getEthUsdPair();\n return usdAmount.mul(1000000000000000000).div(ethUsdPair);\n }\n\n /**\n * @notice Gets the ETHUSD pair from the Medianizer contract\n * @return The pair as an uint256\n */\n function getEthUsdPair() internal view returns (uint256) {\n bytes32 pair = _medianizer.read();\n return uint256(pair);\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4) {\n require(\n address(_asset) == msg.sender,\n \"only accept asset as sender\"\n );\n require(from == operator, \"only self executed transfer allowed\");\n require(value > 0, \"no Asset transfered\");\n require(data.length > 0, \"data need to contains the sale data\");\n\n (\n uint256 numPacks,\n uint256 sandAmountPerPack,\n uint256 priceUSDPerPack\n ) = abi.decode(data, (uint256, uint256, uint256));\n\n uint256 amount = value.div(numPacks);\n require(amount.mul(numPacks) == value, \"invalid amounts, not divisible by numPacks\");\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = amount;\n uint256[] memory ids = new uint256[](1);\n ids[0] = id;\n _setupBundle(from, sandAmountPerPack, numPacks, ids, amounts, priceUSDPerPack);\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4) {\n require(\n address(_asset) == msg.sender,\n \"only accept asset as sender\"\n );\n require(from == operator, \"only self executed transfer allowed\");\n require(ids.length > 0, \"need to contains Asset\");\n require(data.length > 0, \"data need to contains the sale data\");\n\n (\n uint256 numPacks,\n uint256 sandAmountPerPack,\n uint256 priceUSDPerPack\n ) = abi.decode(data, (uint256, uint256, uint256));\n\n uint256[] memory amounts = new uint256[](ids.length); // TODO\n for(uint256 i = 0; i < amounts.length; i ++) {\n require(values[i] > 0, \"asset transfer with zero values\");\n uint256 amount = values[i].div(numPacks);\n require(amount.mul(numPacks) == values[i], \"invalid amounts, not divisible by numPacks\");\n amounts[i] = amount;\n }\n\n _setupBundle(from, sandAmountPerPack, numPacks, ids, amounts, priceUSDPerPack);\n return ERC1155_BATCH_RECEIVED;\n }\n\n function _setupBundle(\n address from,\n uint256 sandAmountPerPack,\n uint256 numPacks,\n uint256[] memory ids,\n uint256[] memory amounts,\n uint256 priceUSDPerPack\n ) internal {\n require(_sand.transferFrom(from, address(this), sandAmountPerPack.mul(numPacks)), \"failed to transfer Sand\");\n uint256 saleId = sales.push(Sale({\n ids: ids,\n amounts : amounts,\n sandAmount: sandAmountPerPack,\n priceUSD: priceUSDPerPack,\n numPacksLeft: numPacks\n }));\n emit BundleSale(saleId, ids, amounts, sandAmountPerPack, priceUSDPerPack, numPacks);\n }\n}\n" + }, + "src/solc_0.5/contracts_common/Base/ERC820Implementer.sol": { + "content": "pragma solidity ^0.5.2;\n\ncontract ERC820Registry {\n function getManager(address addr) public view returns (address);\n function setManager(address addr, address newManager) public;\n function getInterfaceImplementer(address addr, bytes32 iHash)\n public\n view\n returns (address);\n function setInterfaceImplementer(\n address addr,\n bytes32 iHash,\n address implementer\n ) public;\n}\n\ncontract ERC820Implementer {\n ERC820Registry constant erc820Registry = ERC820Registry(\n 0x820b586C8C28125366C998641B09DCbE7d4cBF06\n );\n\n function setInterfaceImplementation(string memory ifaceLabel, address impl)\n internal\n {\n bytes32 ifaceHash = keccak256(bytes(ifaceLabel));\n erc820Registry.setInterfaceImplementer(address(this), ifaceHash, impl);\n }\n\n function interfaceAddr(address addr, string memory ifaceLabel)\n internal\n view\n returns (address)\n {\n bytes32 ifaceHash = keccak256(bytes(ifaceLabel));\n return erc820Registry.getInterfaceImplementer(addr, ifaceHash);\n }\n\n function delegateManagement(address newManager) internal {\n erc820Registry.setManager(address(this), newManager);\n }\n}\n" + }, + "src/solc_0.5/contracts_common/BaseWithStorage/Admin.sol": { + "content": "pragma solidity ^0.5.2;\n\ncontract Admin {\n\n address internal _admin;\n\n event AdminChanged(address oldAdmin, address newAdmin);\n\n /// @notice gives the current administrator of this contract.\n /// @return the current administrator of this contract.\n function getAdmin() external view returns (address) {\n return _admin;\n }\n\n /// @notice change the administrator to be `newAdmin`.\n /// @param newAdmin address of the new administrator.\n function changeAdmin(address newAdmin) external {\n require(msg.sender == _admin, \"only admin can change admin\");\n emit AdminChanged(_admin, newAdmin);\n _admin = newAdmin;\n }\n\n modifier onlyAdmin() {\n require (msg.sender == _admin, \"only admin allowed\");\n _;\n }\n\n}\n" + }, + "src/solc_0.5/contracts_common/BaseWithStorage/AdminV2.sol": { + "content": "pragma solidity 0.5.9;\n\ncontract AdminV2 {\n\n address internal _admin;\n\n event AdminChanged(address oldAdmin, address newAdmin);\n\n /// @notice gives the current administrator of this contract.\n /// @return the current administrator of this contract.\n function getAdmin() external view returns (address) {\n return _admin;\n }\n\n /// @notice change the administrator to be `newAdmin`.\n /// @param newAdmin address of the new administrator.\n function changeAdmin(address newAdmin) external {\n address admin = _admin;\n require(msg.sender == admin, \"only admin can change admin\");\n require(newAdmin != admin, \"it can be only changed to a new admin\");\n emit AdminChanged(admin, newAdmin);\n _admin = newAdmin;\n }\n\n modifier onlyAdmin() {\n require (msg.sender == _admin, \"only admin allowed\");\n _;\n }\n\n}\n" + }, + "src/solc_0.5/contracts_common/BaseWithStorage/MetaTransactionReceiver.sol": { + "content": "pragma solidity ^0.5.2;\n\nimport \"./Admin.sol\";\n\ncontract MetaTransactionReceiver is Admin{\n\n mapping(address => bool) internal _metaTransactionContracts;\n event MetaTransactionProcessor(address metaTransactionProcessor, bool enabled);\n\n /// @notice Enable or disable the ability of `metaTransactionProcessor` to perform meta-tx (metaTransactionProcessor rights).\n /// @param metaTransactionProcessor address that will be given/removed metaTransactionProcessor rights.\n /// @param enabled set whether the metaTransactionProcessor is enabled or disabled.\n function setMetaTransactionProcessor(address metaTransactionProcessor, bool enabled) public {\n require(\n msg.sender == _admin,\n \"only admin can setup metaTransactionProcessors\"\n );\n _setMetaTransactionProcessor(metaTransactionProcessor, enabled);\n }\n\n function _setMetaTransactionProcessor(address metaTransactionProcessor, bool enabled) internal {\n _metaTransactionContracts[metaTransactionProcessor] = enabled;\n emit MetaTransactionProcessor(metaTransactionProcessor, enabled);\n }\n\n /// @notice check whether address `who` is given meta-transaction execution rights.\n /// @param who The address to query.\n /// @return whether the address has meta-transaction execution rights.\n function isMetaTransactionProcessor(address who) external view returns(bool) {\n return _metaTransactionContracts[who];\n }\n}" + }, + "src/solc_0.5/contracts_common/BaseWithStorage/MetaTransactionReceiverV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.5.9;\n\nimport {AdminV2} from \"./AdminV2.sol\";\nimport {AddressUtils} from \"../../contracts_common/Libraries/AddressUtils.sol\";\n\n/// @title MetaTransactionReceiverV2\n/// @author The Sandbox\n/// @notice Implements meta-transactions\n/// @dev This contract permits to give an address the capacity to perform meta-transactions on behalf of any address\ncontract MetaTransactionReceiverV2 is AdminV2 {\n using AddressUtils for address;\n\n mapping(address => bool) internal _metaTransactionContracts;\n event MetaTransactionProcessor(address indexed metaTransactionProcessor, bool enabled);\n\n /// @notice Enable or disable the ability of `metaTransactionProcessor` to perform meta-tx (metaTransactionProcessor rights).\n /// @param metaTransactionProcessor address that will be given/removed metaTransactionProcessor rights.\n /// @param enabled set whether the metaTransactionProcessor is enabled or disabled.\n function setMetaTransactionProcessor(address metaTransactionProcessor, bool enabled) public onlyAdmin {\n require(\n metaTransactionProcessor.isContract(),\n \"only contracts can be meta transaction processor\"\n );\n _setMetaTransactionProcessor(metaTransactionProcessor, enabled);\n }\n\n /// @param metaTransactionProcessor address of the operator\n /// @param enabled is it enabled\n function _setMetaTransactionProcessor(address metaTransactionProcessor, bool enabled) internal {\n _metaTransactionContracts[metaTransactionProcessor] = enabled;\n emit MetaTransactionProcessor(metaTransactionProcessor, enabled);\n }\n\n /// @notice check whether address `who` is given meta-transaction execution rights.\n /// @param who The address to query.\n /// @return whether the address has meta-transaction execution rights.\n function isMetaTransactionProcessor(address who) external view returns(bool) {\n return _metaTransactionContracts[who];\n }\n}\n" + }, + "src/solc_0.5/contracts_common/BaseWithStorage/Ownable.sol": { + "content": "pragma solidity ^0.5.2;\n\n/**\n * @title Ownable\n * @dev The Ownable contract has an owner address, and provides basic authorization control\n * functions, this simplifies the implementation of \"user permissions\".\n */\ncontract Ownable {\n address payable public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n /**\n * @dev The Ownable constructor sets the original `owner` of the contract to the sender\n * account.\n */\n constructor() public {\n owner = msg.sender;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(msg.sender == owner);\n _;\n }\n\n // /**\n // * @dev Allows the current owner to relinquish control of the contract.\n // * @notice Renouncing to ownership will leave the contract without an owner.\n // * It will not be possible to call the functions with the `onlyOwner`\n // * modifier anymore.\n // */\n // function renounceOwnership() public onlyOwner {\n // emit OwnershipRenounced(owner);\n // owner = address(0);\n // }\n\n /**\n * @dev Allows the current owner to transfer control of the contract to a newOwner.\n * @param _newOwner The address to transfer ownership to.\n */\n function transferOwnership(address payable _newOwner) public onlyOwner {\n _transferOwnership(_newOwner);\n }\n\n /**\n * @dev Transfers control of the contract to a newOwner.\n * @param _newOwner The address to transfer ownership to.\n */\n function _transferOwnership(address payable _newOwner) internal {\n require(_newOwner != address(0));\n emit OwnershipTransferred(owner, _newOwner);\n owner = _newOwner;\n }\n}\n" + }, + "src/solc_0.5/contracts_common/BaseWithStorage/Pausable.sol": { + "content": "pragma solidity ^0.5.2;\n\nimport \"./Ownable.sol\";\n\n/**\n * @title Pausable\n * @dev Base contract which allows children to implement an emergency stop mechanism.\n */\ncontract Pausable is Ownable {\n event Pause();\n event Unpause();\n\n bool public paused = false;\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n */\n modifier whenNotPaused() {\n require(!paused);\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n */\n modifier whenPaused() {\n require(paused);\n _;\n }\n\n /**\n * @dev called by the owner to pause, triggers stopped state\n */\n function pause() public onlyOwner whenNotPaused {\n paused = true;\n emit Pause();\n }\n\n /**\n * @dev called by the owner to unpause, returns to normal state\n */\n function unpause() public onlyOwner whenPaused {\n paused = false;\n emit Unpause();\n }\n}\n" + }, + "src/solc_0.5/contracts_common/BaseWithStorage/PausableWithAdmin.sol": { + "content": "pragma solidity ^0.5.2;\n\nimport \"./Admin.sol\";\n\n/**\n * @title PausableWithAdmin\n * @dev Base contract which allows children to implement an emergency stop mechanism.\n */\ncontract PausableWithAdmin is Admin {\n event Pause();\n event Unpause();\n\n bool public paused = false;\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n */\n modifier whenNotPaused() {\n require(!paused);\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n */\n modifier whenPaused() {\n require(paused);\n _;\n }\n\n /**\n * @dev called by the admin to pause, triggers stopped state\n */\n function pause() public onlyAdmin whenNotPaused {\n paused = true;\n emit Pause();\n }\n\n /**\n * @dev called by the admin to unpause, returns to normal state\n */\n function unpause() public onlyAdmin whenPaused {\n paused = false;\n emit Unpause();\n }\n}\n" + }, + "src/solc_0.5/contracts_common/BaseWithStorage/ProxyImplementation.sol": { + "content": "pragma solidity ^0.5.2;\n\ncontract ProxyImplementation {\n mapping(string => bool) _initialised;\n\n modifier phase(string memory phaseName) {\n if (!_initialised[phaseName]) {\n _initialised[phaseName] = true;\n _;\n }\n }\n}\n" + }, + "src/solc_0.5/contracts_common/BaseWithStorage/ReferrableSale.sol": { + "content": "pragma solidity ^0.5.2;\n\nimport \"./Ownable.sol\";\n\n/**\n * @title ReferrableSale\n * @dev Implements the base elements for a sales referral system.\n * It is supposed to be inherited by a sales contract.\n * The referrals are expressed in percentage * 100, for example 1000 represents 10% and 555 represents 5.55%.\n */\ncontract ReferrableSale is Ownable {\n\n event DefaultReferralSet(\n uint256 percentage\n );\n\n event CustomReferralSet(\n address indexed referrer,\n uint256 percentage\n );\n\n uint256 public defaultReferralPercentage;\n mapping (address => uint256) public customReferralPercentages;\n\n function setDefaultReferral(uint256 _defaultReferralPercentage) public onlyOwner {\n require(_defaultReferralPercentage < 10000, \"Referral must be less than 100 percent\");\n require(_defaultReferralPercentage != defaultReferralPercentage, \"New referral must be different from the previous\");\n defaultReferralPercentage = _defaultReferralPercentage;\n emit DefaultReferralSet(_defaultReferralPercentage);\n }\n\n function setCustomReferral(address _referrer, uint256 _customReferralPercentage) public onlyOwner {\n require(_customReferralPercentage < 10000, \"Referral must be less than 100 percent\");\n require(_customReferralPercentage != customReferralPercentages[_referrer], \"New referral must be different from the previous\");\n customReferralPercentages[_referrer] = _customReferralPercentage;\n emit CustomReferralSet(_referrer, _customReferralPercentage);\n }\n}\n" + }, + "src/solc_0.5/contracts_common/BaseWithStorage/SuperOperators.sol": { + "content": "pragma solidity ^0.5.2;\n\nimport \"./Admin.sol\";\n\ncontract SuperOperators is Admin {\n\n mapping(address => bool) internal _superOperators;\n\n event SuperOperator(address superOperator, bool enabled);\n\n /// @notice Enable or disable the ability of `superOperator` to transfer tokens of all (superOperator rights).\n /// @param superOperator address that will be given/removed superOperator right.\n /// @param enabled set whether the superOperator is enabled or disabled.\n function setSuperOperator(address superOperator, bool enabled) external {\n require(\n msg.sender == _admin,\n \"only admin is allowed to add super operators\"\n );\n _superOperators[superOperator] = enabled;\n emit SuperOperator(superOperator, enabled);\n }\n\n /// @notice check whether address `who` is given superOperator rights.\n /// @param who The address to query.\n /// @return whether the address has superOperator rights.\n function isSuperOperator(address who) public view returns (bool) {\n return _superOperators[who];\n }\n}\n" + }, + "src/solc_0.5/contracts_common/BaseWithStorage/SuperOperatorsV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.5.9;\n\nimport {AdminV2} from \"./AdminV2.sol\";\n\n/// @title SuperOperatorsV2\n/// @author The Sandbox\n/// @notice Implements a super operator role on the contract\n/// @dev The contract inheriting SuperOperatorsV2 is able to use a super operator role\ncontract SuperOperatorsV2 is AdminV2 {\n\n mapping(address => bool) internal _superOperators;\n\n event SuperOperator(address indexed superOperator, bool enabled);\n\n /// @notice Enable or disable the ability of `superOperator` to transfer tokens of all (superOperator rights).\n /// @param superOperator address that will be given/removed superOperator right.\n /// @param enabled set whether the superOperator is enabled or disabled.\n function setSuperOperator(address superOperator, bool enabled) external onlyAdmin {\n require(\n superOperator != address(0),\n \"address 0 is not allowed as super operator\"\n );\n require(\n enabled != _superOperators[superOperator],\n \"the status should be different than the current one\"\n );\n _superOperators[superOperator] = enabled;\n emit SuperOperator(superOperator, enabled);\n }\n\n /// @notice check whether address `who` is given superOperator rights.\n /// @param who The address to query.\n /// @return whether the address has superOperator rights.\n function isSuperOperator(address who) public view returns (bool) {\n return _superOperators[who];\n }\n}\n" + }, + "src/solc_0.5/contracts_common/BaseWithStorage/Withdrawable.sol": { + "content": "pragma solidity ^0.5.2;\n\nimport \"./Ownable.sol\";\nimport \"../Interfaces/ERC20.sol\";\n\ncontract Withdrawable is Ownable {\n function withdrawEther(address payable _destination) external onlyOwner {\n _destination.transfer(address(this).balance);\n }\n\n function withdrawToken(ERC20 _token, address _destination) external onlyOwner {\n require(_token.transfer(_destination, _token.balanceOf(address(this))), \"Transfer failed\");\n }\n}" + }, + "src/solc_0.5/contracts_common/Interfaces/ERC1155.sol": { + "content": "pragma solidity ^0.5.2;\n\n/**\n @title ERC-1155 Multi Token Standard\n @dev See https://eips.ethereum.org/EIPS/eip-1155\n Note: The ERC-165 identifier for this interface is 0xd9b67a26.\n */\ninterface ERC1155 {\n\n event TransferSingle(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 id,\n uint256 value\n );\n\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n event URI(string value, uint256 indexed id);\n\n /**\n @notice Transfers `value` amount of an `id` from `from` to `to` (with safety call).\n @dev Caller must be approved to manage the tokens being transferred out of the `from` account (see \"Approval\" section of the standard).\n MUST revert if `to` is the zero address.\n MUST revert if balance of holder for token `id` is lower than the `value` sent.\n MUST revert on any other error.\n MUST emit the `TransferSingle` event to reflect the balance change (see \"Safe Transfer Rules\" section of the standard).\n After the above conditions are met, this function MUST check if `to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `to` and act appropriately (see \"Safe Transfer Rules\" section of the standard).\n @param from Source address\n @param to Target address\n @param id ID of the token type\n @param value Transfer amount\n @param data Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `to`\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external;\n\n /**\n @notice Transfers `values` amount(s) of `ids` from the `from` address to the `to` address specified (with safety call).\n @dev Caller must be approved to manage the tokens being transferred out of the `from` account (see \"Approval\" section of the standard).\n MUST revert if `to` is the zero address.\n MUST revert if length of `ids` is not the same as length of `values`.\n MUST revert if any of the balance(s) of the holder(s) for token(s) in `ids` is lower than the respective amount(s) in `values` sent to the recipient.\n MUST revert on any other error.\n MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see \"Safe Transfer Rules\" section of the standard).\n Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).\n After the above conditions for the transfer(s) in the batch are met, this function MUST check if `to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `to` and act appropriately (see \"Safe Transfer Rules\" section of the standard).\n @param from Source address\n @param to Target address\n @param ids IDs of each token type (order and length must match _values array)\n @param values Transfer amounts per token type (order and length must match _ids array)\n @param data Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `to`\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external;\n\n /**\n @notice Get the balance of an account's tokens.\n @param owner The address of the token holder\n @param id ID of the token\n @return The _owner's balance of the token type requested\n */\n function balanceOf(address owner, uint256 id)\n external\n view\n returns (uint256);\n\n /**\n @notice Get the balance of multiple account/token pairs\n @param owners The addresses of the token holders\n @param ids ID of the tokens\n @return The _owner's balance of the token types requested (i.e. balance for each (owner, id) pair)\n */\n function balanceOfBatch(address[] calldata owners, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n @notice Enable or disable approval for a third party (\"operator\") to manage all of the caller's tokens.\n @dev MUST emit the ApprovalForAll event on success.\n @param operator Address to add to the set of authorized operators\n @param approved True if the operator is approved, false to revoke approval\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n @notice Queries the approval status of an operator for a given owner.\n @param owner The owner of the tokens\n @param operator Address of authorized operator\n @return True if the operator is approved, false if not\n */\n function isApprovedForAll(address owner, address operator)\n external\n view\n returns (bool);\n}\n" + }, + "src/solc_0.5/contracts_common/Interfaces/ERC1155TokenReceiver.sol": { + "content": "pragma solidity ^0.5.2;\n\n/**\n Note: The ERC-165 identifier for this interface is 0x4e2312e0.\n*/\ninterface ERC1155TokenReceiver {\n /**\n @notice Handle the receipt of a single ERC1155 token type.\n @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.\n This function MUST return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` (i.e. 0xf23a6e61) if it accepts the transfer.\n This function MUST revert if it rejects the transfer.\n Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller.\n @param operator The address which initiated the transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param id The ID of the token being transferred\n @param value The amount of tokens being transferred\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n @notice Handle the receipt of multiple ERC1155 token types.\n @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.\n This function MUST return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` (i.e. 0xbc197c81) if it accepts the transfer(s).\n This function MUST revert if it rejects the transfer(s).\n Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller.\n @param operator The address which initiated the batch transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param ids An array containing ids of each token being transferred (order and length must match _values array)\n @param values An array containing amounts of each token being transferred (order and length must match _ids array)\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "src/solc_0.5/contracts_common/Interfaces/ERC1271.sol": { + "content": "pragma solidity ^0.5.2;\n\ncontract ERC1271 {\n\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param data Arbitrary length data signed on the behalf of address(this)\n * @param signature Signature byte array associated with _data\n *\n * MUST return the bytes4 magic value 0x20c13b0b when function passes.\n * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5)\n * MUST allow external calls\n */\n function isValidSignature(bytes memory data, bytes memory signature)\n public\n view\n returns (bytes4 magicValue);\n}\n" + }, + "src/solc_0.5/contracts_common/Interfaces/ERC1271Constants.sol": { + "content": "pragma solidity ^0.5.2;\n\ncontract ERC1271Constants {\n bytes4 internal constant ERC1271_MAGICVALUE = 0x20c13b0b;\n}\n" + }, + "src/solc_0.5/contracts_common/Interfaces/ERC165.sol": { + "content": "pragma solidity ^0.5.2;\n\n/**\n * @title ERC165\n * @dev https://eips.ethereum.org/EIPS/eip-165\n */\ninterface ERC165 {\n /**\n * @notice Query if a contract implements interface `interfaceId`\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @dev Interface identification is specified in ERC-165. This function\n * uses less than 30,000 gas.\n */\n function supportsInterface(bytes4 interfaceId)\n external\n view\n returns (bool);\n}\n" + }, + "src/solc_0.5/contracts_common/Interfaces/ERC1654.sol": { + "content": "pragma solidity ^0.5.2;\n\ncontract ERC1654 {\n\n /**\n * @dev Should return whether the signature provided is valid for the provided hash\n * @param hash 32 bytes hash to be signed\n * @param signature Signature byte array associated with hash\n * @return 0x1626ba7e if valid else 0x00000000\n */\n function isValidSignature(bytes32 hash, bytes memory signature)\n public\n view\n returns (bytes4 magicValue);\n}\n" + }, + "src/solc_0.5/contracts_common/Interfaces/ERC1654Constants.sol": { + "content": "pragma solidity ^0.5.2;\n\ncontract ERC1654Constants {\n bytes4 internal constant ERC1654_MAGICVALUE = 0x1626ba7e;\n}\n" + }, + "src/solc_0.5/contracts_common/Interfaces/ERC20.sol": { + "content": "pragma solidity ^0.5.2;\n\nimport \"./ERC20Basic.sol\";\n\n/**\n * @title ERC20 interface\n * @dev see https://eips.ethereum.org/EIPS/eip-20\n */\n/* interface */\ncontract ERC20 is ERC20Basic {\n function transferFrom(address from, address to, uint256 value)\n public\n returns (bool);\n function approve(address spender, uint256 value) public returns (bool);\n function allowance(address owner, address spender)\n public\n view\n returns (uint256);\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n" + }, + "src/solc_0.5/contracts_common/Interfaces/ERC20Basic.sol": { + "content": "pragma solidity ^0.5.2;\n\n/**\n * @title ERC20Basic DRAFT\n * @dev Simpler version of ERC20 interface\n * See https://github.com/ethereum/EIPs/issues/179\n */\n/* interface */\ncontract ERC20Basic {\n function totalSupply() public view returns (uint256);\n function balanceOf(address who) public view returns (uint256);\n function transfer(address to, uint256 value) public returns (bool);\n event Transfer(address indexed from, address indexed to, uint256 value);\n}\n" + }, + "src/solc_0.5/contracts_common/Interfaces/ERC20Events.sol": { + "content": "pragma solidity ^0.5.2;\n\n/* interface */\ncontract ERC20Events {\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n" + }, + "src/solc_0.5/contracts_common/Interfaces/ERC20WithMetadata.sol": { + "content": "/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n *\n * This code has not been reviewed.\n * Do not use or deploy this code before reviewing it personally first.\n */\n// solhint-disable-next-line compiler-fixed\npragma solidity ^0.5.2;\n\nimport \"./ERC20.sol\";\n\n/* interface */\ncontract ERC20WithMetadata is ERC20 {\n function name() public view returns (string memory);\n function symbol() public view returns (string memory);\n function decimals() public view returns (uint8);\n}\n" + }, + "src/solc_0.5/contracts_common/Interfaces/ERC721.sol": { + "content": "pragma solidity ^0.5.2;\n\nimport \"./ERC165.sol\";\nimport \"./ERC721Events.sol\";\n\n/**\n * @title ERC721 Non-Fungible Token Standard basic interface\n * @dev see https://eips.ethereum.org/EIPS/eip-721\n */\n/*interface*/\ncontract ERC721 is ERC165, ERC721Events {\n function balanceOf(address owner) external view returns (uint256 balance);\n function ownerOf(uint256 tokenId) external view returns (address owner);\n // function exists(uint256 tokenId) external view returns (bool exists);\n\n function approve(address to, uint256 tokenId) external;\n function getApproved(uint256 tokenId)\n external\n view\n returns (address operator);\n\n function setApprovalForAll(address operator, bool approved) external;\n function isApprovedForAll(address owner, address operator)\n external\n view\n returns (bool);\n\n function transferFrom(address from, address to, uint256 tokenId)\n external;\n function safeTransferFrom(address from, address to, uint256 tokenId)\n external;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n" + }, + "src/solc_0.5/contracts_common/Interfaces/ERC721Events.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.5.9;\n\n/**\n * @title ERC721 Non-Fungible Token Standard basic interface\n * @dev see https://eips.ethereum.org/EIPS/eip-721\n */\ninterface ERC721Events {\n event Transfer(\n address indexed _from,\n address indexed _to,\n uint256 indexed _tokenId\n );\n event Approval(\n address indexed _owner,\n address indexed _approved,\n uint256 indexed _tokenId\n );\n event ApprovalForAll(\n address indexed _owner,\n address indexed _operator,\n bool _approved\n );\n}\n" + }, + "src/solc_0.5/contracts_common/Interfaces/ERC721MandatoryTokenReceiver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.5.9;\n\n/**\n * @title ERC721MandatoryTokenReceiver\n * @author The Sandbox\n * @notice Interface for any contract that wants to support safeBatchTransfers\n * from ERC721 asset contracts.\n * @dev The ERC-165 identifier for this interface is 0x5e8bf644.\n */\ninterface ERC721MandatoryTokenReceiver {\n /**\n * @notice Whenever tokens are transferred to this contract via {IERC721-safeBatchTransferFrom}\n * by `operator` from `from`, this function is called.\n * @param operator sender\n * @param from owner of the tokens\n * @param ids token ids\n * @param data extra data\n * @return 0x4b808c46 if the transfer is a success\n */\n function onERC721BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n bytes calldata data\n ) external returns (bytes4); // needs to return 0x4b808c46\n\n /**\n * @notice Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n * @param operator sender\n * @param from owner of the token\n * @param tokenId token id\n * @param data extra data\n * @return 0x150b7a02 if the transfer is a success\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4); // needs to return 0x150b7a02\n}\n" + }, + "src/solc_0.5/contracts_common/Interfaces/ERC721TokenReceiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-fixed\npragma solidity 0.5.9;\n\n/**\n * @title ERC721TokenReceiver\n * @author The Sandbox\n * @notice Handle the receipt of an NFT\n */\ninterface ERC721TokenReceiver {\n /**\n * @notice Handle the receipt of an NFT\n * @dev The ERC721 smart contract calls this function on the recipient\n * after a `transfer`. This function MAY throw to revert and reject the\n * transfer. Return of other than the magic value MUST result in the\n * transaction being reverted.\n * Note: the contract address is always the message sender.\n * @param operator The address which called `safeTransferFrom` function\n * @param from The address which previously owned the token\n * @param tokenId The NFT identifier which is being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))` unless throwing\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "src/solc_0.5/contracts_common/Interfaces/ERC777Token.sol": { + "content": "/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n *\n * This code has not been reviewed.\n * Do not use or deploy this code before reviewing it personally first.\n */\n// solhint-disable-next-line compiler-fixed\npragma solidity ^0.5.2;\n\n/* interface */\ncontract ERC777Token {\n function name() public view returns (string memory);\n function symbol() public view returns (string memory);\n function totalSupply() public view returns (uint256);\n function balanceOf(address owner) public view returns (uint256);\n function granularity() public view returns (uint256);\n\n function defaultOperators() public view returns (address[] memory);\n function isOperatorFor(address operator, address tokenHolder)\n public\n view\n returns (bool);\n function authorizeOperator(address operator) public;\n function revokeOperator(address operator) public;\n\n function send(address to, uint256 amount, bytes memory data) public;\n function operatorSend(\n address from,\n address to,\n uint256 amount,\n bytes memory data,\n bytes memory operatorData\n ) public;\n\n // function burn(uint256 amount, bytes data) public;\n // function operatorBurn(address from, uint256 amount, bytes data, bytes operatorData) public;\n\n event Sent(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 amount,\n bytes data,\n bytes operatorData\n ); // solhint-disable-next-line separate-by-one-line-in-contract\n event Minted(\n address indexed operator,\n address indexed to,\n uint256 amount,\n bytes operatorData\n );\n event Burned(\n address indexed operator,\n address indexed from,\n uint256 amount,\n bytes data,\n bytes operatorData\n );\n event AuthorizedOperator(\n address indexed operator,\n address indexed tokenHolder\n );\n event RevokedOperator(\n address indexed operator,\n address indexed tokenHolder\n );\n}\n" + }, + "src/solc_0.5/contracts_common/Interfaces/ERC777TokensRecipient.sol": { + "content": "/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n *\n * This code has not been reviewed.\n * Do not use or deploy this code before reviewing it personally first.\n */\n// solhint-disable-next-line compiler-fixed\npragma solidity ^0.5.2;\n\n/* interface */\ncontract ERC777TokensRecipient {\n function tokensReceived(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes memory data,\n bytes memory operatorData\n ) public;\n}\n" + }, + "src/solc_0.5/contracts_common/Interfaces/Medianizer.sol": { + "content": "pragma solidity ^0.5.2;\n\n\n/**\n * @title Medianizer contract\n * @dev From MakerDAO (https://etherscan.io/address/0x729D19f657BD0614b4985Cf1D82531c67569197B#code)\n */\ninterface Medianizer {\n function read() external view returns (bytes32);\n}\n" + }, + "src/solc_0.5/contracts_common/Libraries/AddressUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.5.9;\n\n/**\n * @title AddressUtils\n * @author The Sandbox\n * @notice Helper to manipulate addresses\n */\nlibrary AddressUtils {\n\n /**\n * @dev Cast the address to be payable\n * @param _address target address\n * @return a payable address\n */\n function toPayable(address _address) internal pure returns (address payable) {\n return address(uint160(_address));\n }\n\n /**\n * @dev Check if the address is a contract\n * @param addr target address\n * @return is it a contract\n */\n function isContract(address addr) internal view returns (bool) {\n // for accounts without code, i.e. `keccak256('')`:\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\n\n bytes32 codehash;\n // solium-disable-next-line security/no-inline-assembly\n assembly {\n codehash := extcodehash(addr)\n }\n return (codehash != 0x0 && codehash != accountHash);\n }\n}\n" + }, + "src/solc_0.5/contracts_common/Libraries/BytesUtil.sol": { + "content": "pragma solidity ^0.5.2;\n\nlibrary BytesUtil {\n function memcpy(uint256 dest, uint256 src, uint256 len) internal pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n uint256 mask = 256**(32 - len) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n function pointerToBytes(uint256 src, uint256 len)\n internal\n pure\n returns (bytes memory)\n {\n bytes memory ret = new bytes(len);\n uint256 retptr;\n assembly {\n retptr := add(ret, 32)\n }\n\n memcpy(retptr, src, len);\n return ret;\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n assembly {\n let m := mload(0x40)\n mstore(\n add(m, 20),\n xor(0x140000000000000000000000000000000000000000, a)\n )\n mstore(0x40, add(m, 52))\n b := m\n }\n }\n\n function uint256ToBytes(uint256 a) internal pure returns (bytes memory b) {\n assembly {\n let m := mload(0x40)\n mstore(add(m, 32), a)\n mstore(0x40, add(m, 64))\n b := m\n }\n }\n\n function doFirstParamEqualsAddress(bytes memory data, address _address)\n internal\n pure\n returns (bool)\n {\n if (data.length < (36 + 32)) {\n return false;\n }\n uint256 value;\n assembly {\n value := mload(add(data, 36))\n }\n return value == uint256(_address);\n }\n\n function doParamEqualsUInt256(bytes memory data, uint256 i, uint256 value)\n internal\n pure\n returns (bool)\n {\n if (data.length < (36 + (i + 1) * 32)) {\n return false;\n }\n uint256 offset = 36 + i * 32;\n uint256 valuePresent;\n assembly {\n valuePresent := mload(add(data, offset))\n }\n return valuePresent == value;\n }\n\n function overrideFirst32BytesWithAddress(\n bytes memory data,\n address _address\n ) internal pure returns (bytes memory) {\n uint256 dest;\n assembly {\n dest := add(data, 48)\n } // 48 = 32 (offset) + 4 (func sig) + 12 (address is only 20 bytes)\n\n bytes memory addressBytes = addressToBytes(_address);\n uint256 src;\n assembly {\n src := add(addressBytes, 32)\n }\n\n memcpy(dest, src, 20);\n return data;\n }\n\n function overrideFirstTwo32BytesWithAddressAndInt(\n bytes memory data,\n address _address,\n uint256 _value\n ) internal pure returns (bytes memory) {\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(data, 48)\n } // 48 = 32 (offset) + 4 (func sig) + 12 (address is only 20 bytes)\n bytes memory bbytes = addressToBytes(_address);\n assembly {\n src := add(bbytes, 32)\n }\n memcpy(dest, src, 20);\n\n assembly {\n dest := add(data, 68)\n } // 48 = 32 (offset) + 4 (func sig) + 32 (next slot)\n bbytes = uint256ToBytes(_value);\n assembly {\n src := add(bbytes, 32)\n }\n memcpy(dest, src, 32);\n\n return data;\n }\n}\n" + }, + "src/solc_0.5/contracts_common/Libraries/ObjectLib.sol": { + "content": "pragma solidity ^0.5.2;\n\nimport \"./SafeMathWithRequire.sol\";\n\nlibrary ObjectLib {\n using SafeMathWithRequire for uint256;\n enum Operations {ADD, SUB, REPLACE}\n // Constants regarding bin or chunk sizes for balance packing\n uint256 constant TYPES_BITS_SIZE = 16; // Max size of each object\n uint256 constant TYPES_PER_UINT256 = 256 / TYPES_BITS_SIZE; // Number of types per uint256\n\n //\n // Objects and Tokens Functions\n //\n\n /**\n * @dev Return the bin number and index within that bin where ID is\n * @param _tokenId Object type\n * @return (Bin number, ID's index within that bin)\n */\n function getTokenBinIndex(uint256 _tokenId)\n internal\n pure\n returns (uint256 bin, uint256 index)\n {\n bin = (_tokenId * TYPES_BITS_SIZE) / 256;\n index = _tokenId % TYPES_PER_UINT256;\n return (bin, index);\n }\n\n /**\n * @dev update the balance of a type provided in _binBalances\n * @param _binBalances Uint256 containing the balances of objects\n * @param _index Index of the object in the provided bin\n * @param _amount Value to update the type balance\n * @param _operation Which operation to conduct :\n * Operations.REPLACE : Replace type balance with _amount\n * Operations.ADD : ADD _amount to type balance\n * Operations.SUB : Substract _amount from type balance\n */\n function updateTokenBalance(\n uint256 _binBalances,\n uint256 _index,\n uint256 _amount,\n Operations _operation\n ) internal pure returns (uint256 newBinBalance) {\n uint256 objectBalance = 0;\n if (_operation == Operations.ADD) {\n objectBalance = getValueInBin(_binBalances, _index);\n newBinBalance = writeValueInBin(\n _binBalances,\n _index,\n objectBalance.add(_amount)\n );\n } else if (_operation == Operations.SUB) {\n objectBalance = getValueInBin(_binBalances, _index);\n newBinBalance = writeValueInBin(\n _binBalances,\n _index,\n objectBalance.sub(_amount)\n );\n } else if (_operation == Operations.REPLACE) {\n newBinBalance = writeValueInBin(_binBalances, _index, _amount);\n } else {\n revert(\"Invalid operation\"); // Bad operation\n }\n\n return newBinBalance;\n }\n /*\n * @dev return value in _binValue at position _index\n * @param _binValue uint256 containing the balances of TYPES_PER_UINT256 types\n * @param _index index at which to retrieve value\n * @return Value at given _index in _bin\n */\n function getValueInBin(uint256 _binValue, uint256 _index)\n internal\n pure\n returns (uint256)\n {\n // Mask to retrieve data for a given binData\n uint256 mask = (uint256(1) << TYPES_BITS_SIZE) - 1;\n\n // Shift amount\n uint256 rightShift = 256 - TYPES_BITS_SIZE * (_index + 1);\n return (_binValue >> rightShift) & mask;\n }\n\n /**\n * @dev return the updated _binValue after writing _amount at _index\n * @param _binValue uint256 containing the balances of TYPES_PER_UINT256 types\n * @param _index Index at which to retrieve value\n * @param _amount Value to store at _index in _bin\n * @return Value at given _index in _bin\n */\n function writeValueInBin(uint256 _binValue, uint256 _index, uint256 _amount)\n internal\n pure\n returns (uint256)\n {\n require(\n _amount < 2**TYPES_BITS_SIZE,\n \"Amount to write in bin is too large\"\n );\n\n // Mask to retrieve data for a given binData\n uint256 mask = (uint256(1) << TYPES_BITS_SIZE) - 1;\n\n // Shift amount\n uint256 leftShift = 256 - TYPES_BITS_SIZE * (_index + 1);\n return (_binValue & ~(mask << leftShift)) | (_amount << leftShift);\n }\n\n}\n" + }, + "src/solc_0.5/contracts_common/Libraries/ObjectLib32.sol": { + "content": "pragma solidity ^0.5.2;\n\nimport \"./SafeMathWithRequire.sol\";\n\nlibrary ObjectLib32 {\n using SafeMathWithRequire for uint256;\n enum Operations {ADD, SUB, REPLACE}\n // Constants regarding bin or chunk sizes for balance packing\n uint256 constant TYPES_BITS_SIZE = 32; // Max size of each object\n uint256 constant TYPES_PER_UINT256 = 256 / TYPES_BITS_SIZE; // Number of types per uint256\n\n //\n // Objects and Tokens Functions\n //\n\n /**\n * @dev Return the bin number and index within that bin where ID is\n * @param tokenId Object type\n * @return (Bin number, ID's index within that bin)\n */\n function getTokenBinIndex(uint256 tokenId)\n internal\n pure\n returns (uint256 bin, uint256 index)\n {\n bin = (tokenId * TYPES_BITS_SIZE) / 256;\n index = tokenId % TYPES_PER_UINT256;\n return (bin, index);\n }\n\n /**\n * @dev update the balance of a type provided in binBalances\n * @param binBalances Uint256 containing the balances of objects\n * @param index Index of the object in the provided bin\n * @param amount Value to update the type balance\n * @param operation Which operation to conduct :\n * Operations.REPLACE : Replace type balance with amount\n * Operations.ADD : ADD amount to type balance\n * Operations.SUB : Substract amount from type balance\n */\n function updateTokenBalance(\n uint256 binBalances,\n uint256 index,\n uint256 amount,\n Operations operation\n ) internal pure returns (uint256 newBinBalance) {\n uint256 objectBalance = 0;\n if (operation == Operations.ADD) {\n objectBalance = getValueInBin(binBalances, index);\n newBinBalance = writeValueInBin(\n binBalances,\n index,\n objectBalance.add(amount)\n );\n } else if (operation == Operations.SUB) {\n objectBalance = getValueInBin(binBalances, index);\n require(objectBalance >= amount, \"can't substract more than there is\");\n newBinBalance = writeValueInBin(\n binBalances,\n index,\n objectBalance.sub(amount)\n );\n } else if (operation == Operations.REPLACE) {\n newBinBalance = writeValueInBin(binBalances, index, amount);\n } else {\n revert(\"Invalid operation\"); // Bad operation\n }\n\n return newBinBalance;\n }\n /*\n * @dev return value in binValue at position index\n * @param binValue uint256 containing the balances of TYPES_PER_UINT256 types\n * @param index index at which to retrieve value\n * @return Value at given index in bin\n */\n function getValueInBin(uint256 binValue, uint256 index)\n internal\n pure\n returns (uint256)\n {\n // Mask to retrieve data for a given binData\n uint256 mask = (uint256(1) << TYPES_BITS_SIZE) - 1;\n\n // Shift amount\n uint256 rightShift = 256 - TYPES_BITS_SIZE * (index + 1);\n return (binValue >> rightShift) & mask;\n }\n\n /**\n * @dev return the updated binValue after writing amount at index\n * @param binValue uint256 containing the balances of TYPES_PER_UINT256 types\n * @param index Index at which to retrieve value\n * @param amount Value to store at index in bin\n * @return Value at given index in bin\n */\n function writeValueInBin(uint256 binValue, uint256 index, uint256 amount)\n internal\n pure\n returns (uint256)\n {\n require(\n amount < 2**TYPES_BITS_SIZE,\n \"Amount to write in bin is too large\"\n );\n\n // Mask to retrieve data for a given binData\n uint256 mask = (uint256(1) << TYPES_BITS_SIZE) - 1;\n\n // Shift amount\n uint256 leftShift = 256 - TYPES_BITS_SIZE * (index + 1);\n return (binValue & ~(mask << leftShift)) | (amount << leftShift);\n }\n\n}\n" + }, + "src/solc_0.5/contracts_common/Libraries/ObjectLib64.sol": { + "content": "pragma solidity ^0.5.2;\n\nimport \"./SafeMathWithRequire.sol\";\n\nlibrary ObjectLib64 {\n using SafeMathWithRequire for uint256;\n enum Operations {ADD, SUB, REPLACE}\n // Constants regarding bin or chunk sizes for balance packing\n uint256 constant TYPES_BITS_SIZE = 64; // Max size of each object\n uint256 constant TYPES_PER_UINT256 = 256 / TYPES_BITS_SIZE; // Number of types per uint256\n\n //\n // Objects and Tokens Functions\n //\n\n /**\n * @dev Return the bin number and index within that bin where ID is\n * @param _tokenId Object type\n * @return (Bin number, ID's index within that bin)\n */\n function getTokenBinIndex(uint256 _tokenId)\n internal\n pure\n returns (uint256 bin, uint256 index)\n {\n bin = (_tokenId * TYPES_BITS_SIZE) / 256;\n index = _tokenId % TYPES_PER_UINT256;\n return (bin, index);\n }\n\n /**\n * @dev update the balance of a type provided in _binBalances\n * @param _binBalances Uint256 containing the balances of objects\n * @param _index Index of the object in the provided bin\n * @param _amount Value to update the type balance\n * @param _operation Which operation to conduct :\n * Operations.REPLACE : Replace type balance with _amount\n * Operations.ADD : ADD _amount to type balance\n * Operations.SUB : Substract _amount from type balance\n */\n function updateTokenBalance(\n uint256 _binBalances,\n uint256 _index,\n uint256 _amount,\n Operations _operation\n ) internal pure returns (uint256 newBinBalance) {\n uint256 objectBalance = 0;\n if (_operation == Operations.ADD) {\n objectBalance = getValueInBin(_binBalances, _index);\n newBinBalance = writeValueInBin(\n _binBalances,\n _index,\n objectBalance.add(_amount)\n );\n } else if (_operation == Operations.SUB) {\n objectBalance = getValueInBin(_binBalances, _index);\n newBinBalance = writeValueInBin(\n _binBalances,\n _index,\n objectBalance.sub(_amount)\n );\n } else if (_operation == Operations.REPLACE) {\n newBinBalance = writeValueInBin(_binBalances, _index, _amount);\n } else {\n revert(\"Invalid operation\"); // Bad operation\n }\n\n return newBinBalance;\n }\n /*\n * @dev return value in _binValue at position _index\n * @param _binValue uint256 containing the balances of TYPES_PER_UINT256 types\n * @param _index index at which to retrieve value\n * @return Value at given _index in _bin\n */\n function getValueInBin(uint256 _binValue, uint256 _index)\n internal\n pure\n returns (uint256)\n {\n // Mask to retrieve data for a given binData\n uint256 mask = (uint256(1) << TYPES_BITS_SIZE) - 1;\n\n // Shift amount\n uint256 rightShift = 256 - TYPES_BITS_SIZE * (_index + 1);\n return (_binValue >> rightShift) & mask;\n }\n\n /**\n * @dev return the updated _binValue after writing _amount at _index\n * @param _binValue uint256 containing the balances of TYPES_PER_UINT256 types\n * @param _index Index at which to retrieve value\n * @param _amount Value to store at _index in _bin\n * @return Value at given _index in _bin\n */\n function writeValueInBin(uint256 _binValue, uint256 _index, uint256 _amount)\n internal\n pure\n returns (uint256)\n {\n require(\n _amount < 2**TYPES_BITS_SIZE,\n \"Amount to write in bin is too large\"\n );\n\n // Mask to retrieve data for a given binData\n uint256 mask = (uint256(1) << TYPES_BITS_SIZE) - 1;\n\n // Shift amount\n uint256 leftShift = 256 - TYPES_BITS_SIZE * (_index + 1);\n return (_binValue & ~(mask << leftShift)) | (_amount << leftShift);\n }\n\n}\n" + }, + "src/solc_0.5/contracts_common/Libraries/PriceUtil.sol": { + "content": "pragma solidity ^0.5.2;\n\nimport \"./SafeMathWithRequire.sol\";\n\nlibrary PriceUtil {\n using SafeMathWithRequire for uint256;\n\n function calculateCurrentPrice(\n uint256 startingPrice,\n uint256 endingPrice,\n uint256 duration,\n uint256 secondsPassed\n ) internal pure returns (uint256) {\n if (secondsPassed > duration) {\n return endingPrice;\n }\n if (endingPrice == startingPrice) {\n return endingPrice;\n } else if (endingPrice > startingPrice) {\n return startingPrice.add(\n (endingPrice.sub(startingPrice)).mul(secondsPassed).div(duration)\n );\n } else {\n return startingPrice.sub(\n (startingPrice.sub(endingPrice)).mul(secondsPassed).div(duration)\n );\n }\n }\n\n function calculateFee(uint256 price, uint256 fee10000th)\n internal\n pure\n returns (uint256)\n {\n // _fee < 10000, so the result will be <= price\n return (price.mul(fee10000th)) / 10000;\n }\n\n}\n" + }, + "src/solc_0.5/contracts_common/Libraries/SafeMathWithRequire.sol": { + "content": "pragma solidity ^0.5.2;\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that revert\n */\nlibrary SafeMathWithRequire {\n /**\n * @dev Multiplies two numbers, throws on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {\n // Gas optimization: this is cheaper than asserting 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n c = a * b;\n require(c / a == b, \"overflow\");\n return c;\n }\n\n /**\n * @dev Integer division of two numbers, truncating the quotient.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // assert(b > 0); // Solidity automatically throws when dividing by 0\n // uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n return a / b;\n }\n\n /**\n * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a, \"undeflow\");\n return a - b;\n }\n\n /**\n * @dev Adds two numbers, throws on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256 c) {\n c = a + b;\n require(c >= a, \"overflow\");\n return c;\n }\n}\n" + }, + "src/solc_0.5/contracts_common/Libraries/SigUtil.sol": { + "content": "pragma solidity ^0.5.2;\n\nlibrary SigUtil {\n function recover(bytes32 hash, bytes memory sig)\n internal\n pure\n returns (address recovered)\n {\n require(sig.length == 65);\n\n bytes32 r;\n bytes32 s;\n uint8 v;\n assembly {\n r := mload(add(sig, 32))\n s := mload(add(sig, 64))\n v := byte(0, mload(add(sig, 96)))\n }\n\n // Version of signature should be 27 or 28, but 0 and 1 are also possible versions\n if (v < 27) {\n v += 27;\n }\n require(v == 27 || v == 28);\n\n recovered = ecrecover(hash, v, r, s);\n require(recovered != address(0));\n }\n\n function recoverWithZeroOnFailure(bytes32 hash, bytes memory sig)\n internal\n pure\n returns (address)\n {\n if (sig.length != 65) {\n return (address(0));\n }\n\n bytes32 r;\n bytes32 s;\n uint8 v;\n assembly {\n r := mload(add(sig, 32))\n s := mload(add(sig, 64))\n v := byte(0, mload(add(sig, 96)))\n }\n\n // Version of signature should be 27 or 28, but 0 and 1 are also possible versions\n if (v < 27) {\n v += 27;\n }\n\n if (v != 27 && v != 28) {\n return (address(0));\n } else {\n return ecrecover(hash, v, r, s);\n }\n }\n\n // Builds a prefixed hash to mimic the behavior of eth_sign.\n function prefixed(bytes32 hash) internal pure returns (bytes memory) {\n return abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash);\n }\n}\n" + }, + "src/solc_0.5/contracts_common/UpgradableProxy/AdminUpgradeabilityProxy.sol": { + "content": "// from https://github.com/zeppelinos/zos/blob/1cea266a672a1efc31915420af5eb5185173837c/packages/lib/contracts/upgradeability/AdminUpgradeabilityProxy.sol\npragma solidity ^0.5.2;\n\nimport \"./UpgradeabilityProxy.sol\";\nimport \"./ProxyAdmin.sol\";\n\n/**\n * @title AdminUpgradeabilityProxy\n * @dev This contract combines an upgradeability proxy with an authorization\n * mechanism for administrative tasks.\n * All external functions in this contract must be guarded by the\n * `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity\n * feature proposal that would enable this to be done automatically.\n */\ncontract AdminUpgradeabilityProxy is UpgradeabilityProxy {\n /**\n * @dev Emitted when the administration has been transferred.\n * @param previousAdmin Address of the previous admin.\n * @param newAdmin Address of the new admin.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"org.zeppelinos.proxy.admin\", and is\n * validated in the constructor.\n */\n bytes32 private constant ADMIN_SLOT = 0x10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b;\n\n /**\n * @dev Modifier to check whether the `msg.sender` is the admin.\n * If it is, it will run the function. Otherwise, it will delegate the call\n * to the implementation.\n */\n modifier ifAdmin() {\n if (msg.sender == _admin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * Contract constructor.\n * It sets the `msg.sender` as the proxy administrator.\n * @param _implementation address of the initial implementation.\n * @param _data Data to send as msg.data to the implementation to initialize the proxied contract.\n * It should include the signature and the parameters of the function to be called, as described in\n * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.\n * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.\n */\n constructor(\n address payable _owner,\n address _implementation,\n bytes memory _data\n ) public payable UpgradeabilityProxy(_implementation, _data) {\n assert(ADMIN_SLOT == keccak256(\"org.zeppelinos.proxy.admin\"));\n\n ProxyAdmin proxyAdmin = new ProxyAdmin(this, _owner); // TODO cheaper creation : https://eips.ethereum.org/EIPS/eip-1167\n emit AdminChanged(address(0), address(proxyAdmin));\n _setAdmin(address(proxyAdmin));\n }\n\n /**\n * @return The address of the proxy admin.\n */\n function admin() external ifAdmin returns (address) {\n return _admin();\n }\n\n /**\n * @return The address of the implementation.\n */\n function implementation() external ifAdmin returns (address) {\n return _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n * Only the current admin can call this function.\n * @param newAdmin Address to transfer proxy administration to.\n */\n function changeAdmin(address newAdmin) external ifAdmin {\n require(\n newAdmin != address(0),\n \"Cannot change the admin of a proxy to the zero address\"\n );\n emit AdminChanged(_admin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the backing implementation of the proxy.\n * Only the admin can call this function.\n * @param newImplementation Address of the new implementation.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeTo(newImplementation);\n }\n\n /**\n * @dev Upgrade the backing implementation of the proxy and call a function\n * on the new implementation.\n * This is useful to initialize the proxied contract.\n * @param newImplementation Address of the new implementation.\n * @param data Data to send as msg.data in the low level call.\n * It should include the signature and the parameters of the function to be called, as described in\n * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data)\n external\n payable\n ifAdmin\n {\n _upgradeTo(newImplementation);\n (bool success, bytes memory _) = newImplementation.delegatecall(data);\n require(success, \"failed to call newImplementation\");\n }\n\n /**\n * @return The admin slot.\n */\n function _admin() internal view returns (address adm) {\n bytes32 slot = ADMIN_SLOT;\n assembly {\n adm := sload(slot)\n }\n }\n\n /**\n * @dev Sets the address of the proxy admin.\n * @param newAdmin Address of the new proxy admin.\n */\n function _setAdmin(address newAdmin) internal {\n bytes32 slot = ADMIN_SLOT;\n\n assembly {\n sstore(slot, newAdmin)\n }\n }\n\n /**\n * @dev Only fall back when the sender is not the admin.\n */\n function _willFallback() internal {\n require(\n msg.sender != _admin(),\n \"Cannot call fallback function from the proxy admin\"\n );\n super._willFallback();\n }\n}\n" + }, + "src/solc_0.5/contracts_common/UpgradableProxy/ProxyAdmin.sol": { + "content": "pragma solidity ^0.5.2;\n\nimport \"./AdminUpgradeabilityProxy.sol\";\nimport \"../BaseWithStorage/Ownable.sol\";\n\ncontract ProxyAdmin is Ownable {\n AdminUpgradeabilityProxy proxy;\n constructor(AdminUpgradeabilityProxy _proxy, address payable _owner)\n public\n {\n proxy = _proxy;\n owner = _owner;\n }\n\n function proxyAddress() public view returns (address) {\n return address(proxy);\n }\n\n function admin() public returns (address) {\n return proxy.admin();\n }\n\n function changeAdmin(address newAdmin) public onlyOwner {\n proxy.changeAdmin(newAdmin);\n }\n\n function upgradeTo(address implementation) public onlyOwner {\n proxy.upgradeTo(implementation);\n }\n\n function upgradeToAndCall(address implementation, bytes memory data)\n public\n payable\n onlyOwner\n {\n proxy.upgradeToAndCall.value(msg.value)(implementation, data);\n }\n\n}\n" + }, + "src/solc_0.5/contracts_common/UpgradableProxy/ProxyBase.sol": { + "content": "// from https://github.com/zeppelinos/zos/blob/1cea266a672a1efc31915420af5eb5185173837c/packages/lib/contracts/upgradeability/Proxy.sol\npragma solidity ^0.5.2;\n\n/**\n * @title ProxyBase\n * @dev Implements delegation of calls to other contracts, with proper\n * forwarding of return values and bubbling of failures.\n * It defines a fallback function that delegates all calls to the address\n * returned by the abstract _implementation() internal function.\n */\ncontract ProxyBase {\n /**\n * @dev Fallback function.\n * Implemented entirely in `_fallback`.\n */\n function() external payable {\n _fallback();\n }\n\n /**\n * @return The Address of the implementation.\n */\n function _implementation() internal view returns (address);\n\n /**\n * @dev Delegates execution to an implementation contract.\n * This is a low level function that doesn't return to its internal call site.\n * It will return to the external caller whatever the implementation returns.\n * @param implementation Address to delegate.\n */\n function _delegate(address implementation) internal {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize)\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(\n gas,\n implementation,\n 0,\n calldatasize,\n 0,\n 0\n )\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize)\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize)\n }\n default {\n return(0, returndatasize)\n }\n }\n }\n\n /**\n * @dev Function that is run as the first thing in the fallback function.\n * Can be redefined in derived contracts to add functionality.\n * Redefinitions must call super._willFallback().\n */\n function _willFallback() internal {}\n\n /**\n * @dev fallback implementation.\n * Extracted to enable manual triggering.\n */\n function _fallback() internal {\n _willFallback();\n _delegate(_implementation());\n }\n}\n" + }, + "src/solc_0.5/contracts_common/UpgradableProxy/UpgradeabilityProxy.sol": { + "content": "// from https://github.com/zeppelinos/zos/blob/1cea266a672a1efc31915420af5eb5185173837c/packages/lib/contracts/upgradeability/UpgradeabilityProxy.sol\npragma solidity ^0.5.2;\n\nimport \"./ProxyBase.sol\";\nimport \"../Libraries/AddressUtils.sol\";\n\n/**\n * @title UpgradeabilityProxy\n * @dev This contract implements a proxy that allows to change the\n * implementation address to which it will delegate.\n * Such a change is called an implementation upgrade.\n */\ncontract UpgradeabilityProxy is ProxyBase {\n /**\n * @dev Emitted when the implementation is upgraded.\n * @param implementation Address of the new implementation.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"org.zeppelinos.proxy.implementation\", and is\n * validated in the constructor.\n */\n bytes32 private constant IMPLEMENTATION_SLOT = 0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3;\n\n /**\n * @dev Contract constructor.\n * @param _implementation Address of the initial implementation.\n * @param _data Data to send as msg.data to the implementation to initialize the proxied contract.\n * It should include the signature and the parameters of the function to be called, as described in\n * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.\n * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.\n */\n constructor(address _implementation, bytes memory _data) public payable {\n assert(\n IMPLEMENTATION_SLOT ==\n keccak256(\"org.zeppelinos.proxy.implementation\")\n );\n _setImplementation(_implementation);\n if (_data.length > 0) {\n (bool success, bytes memory _) = _implementation.delegatecall(\n _data\n );\n require(success, \"could not call the contract\");\n }\n }\n\n /**\n * @dev Returns the current implementation.\n * @return Address of the current implementation\n */\n function _implementation() internal view returns (address impl) {\n bytes32 slot = IMPLEMENTATION_SLOT;\n assembly {\n impl := sload(slot)\n }\n }\n\n /**\n * @dev Upgrades the proxy to a new implementation.\n * @param newImplementation Address of the new implementation.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Sets the implementation address of the proxy.\n * @param newImplementation Address of the new implementation.\n */\n function _setImplementation(address newImplementation) private {\n require(\n AddressUtils.isContract(newImplementation),\n \"Cannot set a proxy implementation to a non-contract address\"\n );\n\n bytes32 slot = IMPLEMENTATION_SLOT;\n\n assembly {\n sstore(slot, newImplementation)\n }\n }\n}\n" + }, + "src/solc_0.5/Estate.sol": { + "content": "/* solhint-disable no-empty-blocks */\n\npragma solidity 0.5.9;\n\nimport \"./Estate/EstateBaseToken.sol\";\n\ncontract Estate is EstateBaseToken {\n constructor(\n address metaTransactionContract,\n address admin,\n LandToken land\n ) public EstateBaseToken(\n metaTransactionContract,\n admin,\n land\n ) {\n }\n\n /**\n * @notice Return the name of the token contract\n * @return The name of the token contract\n */\n function name() external pure returns (string memory) {\n return \"Sandbox's ESTATEs\";\n }\n\n /**\n * @notice Return the symbol of the token contract\n * @return The symbol of the token contract\n */\n function symbol() external pure returns (string memory) {\n return \"ESTATE\";\n }\n\n // solium-disable-next-line security/no-assign-params\n function uint2str(uint _i) internal pure returns (string memory) {\n if (_i == 0) {\n return \"0\";\n }\n uint j = _i;\n uint len;\n while (j != 0) {\n len++;\n j /= 10;\n }\n bytes memory bstr = new bytes(len);\n uint k = len - 1;\n while (_i != 0) {\n bstr[k--] = byte(uint8(48 + _i % 10));\n _i /= 10;\n }\n return string(bstr);\n }\n\n /**\n * @notice Return the URI of a specific token\n * @param id The id of the token\n * @return The URI of the token\n */\n function tokenURI(uint256 id) public view returns (string memory) {\n require(_ownerOf(id) != address(0), \"Id does not exist\");\n return\n string(\n abi.encodePacked(\n \"https://api.sandbox.game/estate/\",\n uint2str(id),\n \"/metadata.json\"\n )\n );\n }\n\n /**\n * @notice Check if the contract supports an interface\n * 0x01ffc9a7 is ERC-165\n * 0x80ac58cd is ERC-721\n * 0x5b5e139f is ERC-721 metadata\n * @param id The id of the interface\n * @return True if the interface is supported\n */\n function supportsInterface(bytes4 id) external pure returns (bool) {\n return id == 0x01ffc9a7 || id == 0x80ac58cd || id == 0x5b5e139f; // TODO\n }\n\n function burn(uint256 id) external {\n revert(\"burning is disabled\");\n }\n\n function burnFrom(address from, uint256 id) external {\n revert(\"burning is disabled\");\n }\n}\n" + }, + "src/solc_0.5/Estate/EstateBaseToken.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../BaseWithStorage/ERC721BaseToken.sol\";\nimport \"../Interfaces/LandToken.sol\";\nimport \"../contracts_common/Interfaces/ERC721MandatoryTokenReceiver.sol\";\n\ncontract EstateBaseToken is ERC721BaseToken {\n uint8 internal constant OWNER = 0;\n uint8 internal constant ADD = 1;\n uint8 internal constant BREAK = 2;\n uint8 internal constant WITHDRAWAL = 3;\n\n uint16 internal constant GRID_SIZE = 408;\n\n uint256 _nextId = 1;\n mapping(uint256 => uint24[]) _quadsInEstate;\n LandToken _land;\n address _minter;\n address _breaker;\n\n event QuadsAddedInEstate(uint256 indexed id, uint24[] list);\n\n constructor(\n address metaTransactionContract,\n address admin,\n LandToken land\n ) public ERC721BaseToken(metaTransactionContract, admin) {\n _land = land;\n }\n\n function createFromQuad(address sender, address to, uint256 size, uint256 x, uint256 y) external returns (uint256) {\n _check_authorized(sender, ADD);\n uint256 estateId = _mintEstate(to);\n _addSingleQuad(sender, estateId, size, x, y);\n return estateId;\n }\n\n function addQuad(address sender, uint256 estateId, uint256 size, uint256 x, uint256 y) external {\n _check_authorized(sender, ADD);\n _check_hasOwnerRights(sender, estateId);\n _addSingleQuad(sender, estateId, size, x, y);\n }\n\n function createFromMultipleLands(\n address sender,\n address to,\n uint256[] calldata ids,\n uint256[] calldata junctions\n ) external returns (uint256) {\n _check_authorized(sender, ADD);\n uint256 estateId = _mintEstate(to);\n _addLands(sender, estateId, ids, junctions, true);\n return estateId;\n }\n\n // TODO addSingleLand\n\n function addMultipleLands(\n address sender,\n uint256 estateId,\n uint256[] calldata ids,\n uint256[] calldata junctions\n ) external {\n _check_authorized(sender, ADD);\n _check_hasOwnerRights(sender, estateId);\n _addLands(sender, estateId, ids, junctions, false);\n }\n\n function createFromMultipleQuads(\n address sender,\n address to,\n uint256[] calldata sizes,\n uint256[] calldata xs,\n uint256[] calldata ys,\n uint256[] calldata junctions\n ) external returns (uint256) {\n _check_authorized(sender, ADD);\n uint256 estateId = _mintEstate(to);\n _addQuads(sender, estateId, sizes, xs, ys, junctions, true);\n return estateId;\n }\n\n function addMultipleQuads(\n address sender,\n uint256 estateId,\n uint256[] calldata sizes,\n uint256[] calldata xs,\n uint256[] calldata ys,\n uint256[] calldata junctions\n ) external {\n _check_authorized(sender, ADD);\n _check_hasOwnerRights(sender, estateId);\n _addQuads(sender, estateId, sizes, xs, ys, junctions, false);\n }\n\n function destroy(address sender, uint256 estateId) external {\n _check_authorized(sender, BREAK);\n _check_hasOwnerRights(sender, estateId);\n _owners[estateId] = 0; // TODO keep track of it so it can transfer Land back\n _numNFTPerAddress[sender]--;\n emit Transfer(sender, address(0), estateId);\n }\n\n function transferFromDestroyedEstate(address sender, address to, uint256 num) external {\n _check_authorized(sender, WITHDRAWAL);\n // TODO\n // require(sender != address(this), \"from itself\");\n // require(sender != address(0), \"sender is zero address\");\n // require(msg.sender == sender ||\n // _metaTransactionContracts[msg.sender] ||\n // _superOperators[msg.sender],\n // \"not _check_authorized\");\n // require(sender == _pastOwnerOf(estateId), \"only owner can transfer land from destroyed estate\");\n // TODO\n }\n\n\n // //////////////////////////////////////////////////////////////////////////////////////////////////////\n\n function _check_authorized(address sender, uint8 action) internal {\n require(sender != address(0), \"sender is zero address\");\n if (action == ADD) {\n address minter = _minter;\n if (minter == address(0)) {\n require(msg.sender == sender || _metaTransactionContracts[msg.sender], \"not _check_authorized\");\n } else {\n require(msg.sender == minter, \"only minter allowed\");\n }\n } else if (action == BREAK) {\n address breaker = _breaker;\n if (breaker == address(0)) {\n require(msg.sender == sender || _metaTransactionContracts[msg.sender], \"not _check_authorized\");\n } else {\n require(msg.sender == breaker, \"only breaker allowed\");\n }\n } else {\n require(msg.sender == sender || _metaTransactionContracts[msg.sender], \"not _check_authorized\");\n }\n }\n\n function _check_hasOwnerRights(address sender, uint256 estateId) internal {\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(estateId);\n require(owner != address(0), \"token does not exist\");\n require(owner == sender, \"not owner\");\n require(\n _superOperators[msg.sender] ||\n _operatorsForAll[sender][msg.sender] ||\n (operatorEnabled && _operators[estateId] == msg.sender),\n \"not approved\"\n );\n }\n\n // //////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n function _encode(uint16 x, uint16 y, uint8 size) internal pure returns (uint24) {\n return uint24(size) * uint24(2**18) + (uint24(x) + uint24(y) * GRID_SIZE);\n }\n\n function _decode(uint24 data) internal pure returns (uint16 x, uint16 y, uint8 size) {\n size = uint8(data / (2**18));\n y = uint16(data % (2**18) / GRID_SIZE);\n x = uint16(data % GRID_SIZE);\n }\n\n function _mintEstate(address to) internal returns (uint256) {\n require(to != address(0), \"can't send to zero address\");\n uint256 estateId = _nextId++;\n _owners[estateId] = uint256(to);\n _numNFTPerAddress[to]++;\n emit Transfer(address(0), to, estateId);\n return estateId;\n }\n\n function _addSingleQuad(\n address sender,\n uint256 estateId,\n uint256 size,\n uint256 x,\n uint256 y\n ) internal {\n _land.transferQuad(sender, address(this), size, x, y, \"\");\n uint24[] memory list = new uint24[](1);\n list[0] = _encode(uint16(x),uint16(y),uint8(size));\n // TODO check adjacency\n _quadsInEstate[estateId].push(list[0]);\n emit QuadsAddedInEstate(estateId, list);\n }\n\n function _addQuads(\n address sender,\n uint256 estateId,\n uint256[] memory sizes,\n uint256[] memory xs,\n uint256[] memory ys,\n uint256[] memory junctions,\n bool justCreated\n ) internal {\n _land.batchTransferQuad(sender, address(this), sizes, xs, ys, \"\");\n uint24[] memory list = new uint24[](sizes.length);\n for (uint256 i = 0; i < list.length; i++) {\n list[i] = _encode(uint16(xs[i]), uint16(ys[i]), uint8(sizes[i]));\n }\n // TODO check adjacency\n if (justCreated) {\n _quadsInEstate[estateId] = list;\n } else {\n for (uint256 i = 0; i < list.length; i++) {\n _quadsInEstate[estateId].push(list[i]);\n }\n }\n emit QuadsAddedInEstate(estateId, list);\n }\n\n function _adjacent(uint16 x1, uint16 y1, uint16 x2, uint16 y2) internal pure returns(bool) {\n return (\n (x1 == x2 && y1 == y2 - 1) ||\n (x1 == x2 && y1 == y2 + 1) ||\n (x1 == x2 - 1 && y1 == y2) ||\n (x1 == x2 + 1 && y1 == y2)\n );\n }\n\n function _adjacent(uint16 x1, uint16 y1, uint16 x2, uint16 y2, uint8 s2) internal pure returns(bool) {\n return (\n (x1 >= x2 && x1 < x2 + s2 && y1 == y2 - 1) ||\n (x1 >= x2 && x1 < x2 + s2 && y1 == y2 + s2) ||\n (x1 == x2 - 1 && y1 >= y2 && y1 < y2 + s2) ||\n (x1 == x2 - s2 && y1 >= y2 && y1 < y2 + s2)\n );\n }\n\n function _addLands(\n address sender,\n uint256 estateId,\n uint256[] memory ids,\n uint256[] memory junctions,\n bool justCreated\n ) internal {\n _land.batchTransferFrom(sender, address(this), ids, \"\");\n uint24[] memory list = new uint24[](ids.length);\n for (uint256 i = 0; i < list.length; i++) {\n uint16 x = uint16(ids[i] % GRID_SIZE);\n uint16 y = uint16(ids[i] / GRID_SIZE);\n list[i] = _encode(x, y, 1);\n }\n\n uint256 l = _quadsInEstate[estateId].length;\n uint16 lastX = 409;\n uint16 lastY = 409;\n if (!justCreated) {\n uint24 d = _quadsInEstate[estateId][l-1];\n lastX = uint16(d % GRID_SIZE);\n lastY = uint16(d % GRID_SIZE);\n }\n uint256 j = 0;\n for (uint256 i = 0; i < list.length; i++) {\n uint16 x = uint16(ids[i] % GRID_SIZE);\n uint16 y = uint16(ids[i] / GRID_SIZE);\n if (lastX != 409 && !_adjacent(x, y, lastX, lastY)) {\n uint256 index = junctions[j];\n j++;\n uint24 data;\n if (index >= l) {\n require(index -l < j, \"junctions need to refers to previously accepted land\");\n data = list[index - l];\n } else {\n data = _quadsInEstate[estateId][j];\n }\n (uint16 jx, uint16 jy, uint8 jsize) = _decode(data);\n if (jsize == 1) {\n require(_adjacent(x, y, jx, jy), \"need junctions to be adjacent\");\n } else {\n require(_adjacent(x, y, jx, jy, jsize), \"need junctions to be adjacent\");\n }\n }\n lastX = x;\n lastY = y;\n }\n if (justCreated) {\n _quadsInEstate[estateId] = list;\n } else {\n for (uint256 i = 0; i < list.length; i++) {\n _quadsInEstate[estateId].push(list[i]);\n }\n }\n emit QuadsAddedInEstate(estateId, list);\n }\n\n // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n function onERC721BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n bytes calldata data\n ) external returns (bytes4) {\n revert(\"please call add* or createFrom* functions\");\n }\n\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4) {\n revert(\"please call add* or createFrom* functions\");\n }\n}\n" + }, + "src/solc_0.5/Interfaces/LandToken.sol": { + "content": "pragma solidity 0.5.9;\n\ncontract LandToken {\n function batchTransferQuad(\n address from,\n address to,\n uint256[] calldata sizes,\n uint256[] calldata xs,\n uint256[] calldata ys,\n bytes calldata data\n ) external;\n\n function transferQuad(address from, address to, uint256 size, uint256 x, uint256 y, bytes calldata data) external;\n\n function batchTransferFrom(address from, address to, uint256[] calldata ids, bytes calldata data) external;\n}\n" + }, + "src/solc_0.5/Land.sol": { + "content": "/* solhint-disable no-empty-blocks */\n\npragma solidity 0.5.9;\n\nimport \"./Land/erc721/LandBaseToken.sol\";\n\ncontract Land is LandBaseToken {\n /**\n * @notice Return the name of the token contract\n * @return The name of the token contract\n */\n function name() external pure returns (string memory) {\n return \"Sandbox's LANDs\";\n }\n\n /**\n * @notice Return the symbol of the token contract\n * @return The symbol of the token contract\n */\n function symbol() external pure returns (string memory) {\n return \"LAND\";\n }\n\n // solium-disable-next-line security/no-assign-params\n function uint2str(uint _i) internal pure returns (string memory) {\n if (_i == 0) {\n return \"0\";\n }\n uint j = _i;\n uint len;\n while (j != 0) {\n len++;\n j /= 10;\n }\n bytes memory bstr = new bytes(len);\n uint k = len - 1;\n while (_i != 0) {\n bstr[k--] = byte(uint8(48 + _i % 10));\n _i /= 10;\n }\n return string(bstr);\n }\n\n /**\n * @notice Return the URI of a specific token\n * @param id The id of the token\n * @return The URI of the token\n */\n function tokenURI(uint256 id) public view returns (string memory) {\n require(_ownerOf(id) != address(0), \"Id does not exist\");\n return\n string(\n abi.encodePacked(\n \"https://api.sandbox.game/lands/\",\n uint2str(id),\n \"/metadata.json\"\n )\n );\n }\n\n /**\n * @notice Check if the contract supports an interface\n * 0x01ffc9a7 is ERC-165\n * 0x80ac58cd is ERC-721\n * 0x5b5e139f is ERC-721 metadata\n * @param id The id of the interface\n * @return True if the interface is supported\n */\n function supportsInterface(bytes4 id) external pure returns (bool) {\n return id == 0x01ffc9a7 || id == 0x80ac58cd || id == 0x5b5e139f;\n }\n}\n" + }, + "src/solc_0.5/Land/erc721/ERC721BaseToken.sol": { + "content": "/* solhint-disable func-order, code-complexity */\npragma solidity 0.5.9;\n\nimport \"../../contracts_common/Libraries/AddressUtils.sol\";\nimport \"../../contracts_common/Interfaces/ERC721TokenReceiver.sol\";\nimport \"../../contracts_common/Interfaces/ERC721Events.sol\";\nimport \"../../contracts_common/BaseWithStorage/SuperOperators.sol\";\nimport \"../../contracts_common/BaseWithStorage/MetaTransactionReceiver.sol\";\nimport \"../../contracts_common/Interfaces/ERC721MandatoryTokenReceiver.sol\";\n\ncontract ERC721BaseToken is ERC721Events, SuperOperators, MetaTransactionReceiver {\n using AddressUtils for address;\n\n bytes4 internal constant _ERC721_RECEIVED = 0x150b7a02;\n bytes4 internal constant _ERC721_BATCH_RECEIVED = 0x4b808c46;\n\n bytes4 internal constant ERC165ID = 0x01ffc9a7;\n bytes4 internal constant ERC721_MANDATORY_RECEIVER = 0x5e8bf644;\n\n mapping (address => uint256) public _numNFTPerAddress;\n mapping (uint256 => uint256) public _owners;\n mapping (address => mapping(address => bool)) public _operatorsForAll;\n mapping (uint256 => address) public _operators;\n\n bool internal _initialized;\n\n modifier initializer() {\n require(!_initialized, \"ERC721BaseToken: Contract already initialized\");\n _;\n }\n\n function initialize (\n address metaTransactionContract,\n address admin\n ) public initializer {\n _admin = admin;\n _setMetaTransactionProcessor(metaTransactionContract, true);\n _initialized = true;\n }\n\n function _transferFrom(address from, address to, uint256 id) internal {\n _numNFTPerAddress[from]--;\n _numNFTPerAddress[to]++;\n _owners[id] = uint256(to);\n emit Transfer(from, to, id);\n }\n\n /**\n * @notice Return the number of Land owned by an address\n * @param owner The address to look for\n * @return The number of Land token owned by the address\n */\n function balanceOf(address owner) external view returns (uint256) {\n require(owner != address(0), \"owner is zero address\");\n return _numNFTPerAddress[owner];\n }\n\n\n function _ownerOf(uint256 id) internal view returns (address) {\n return address(_owners[id]);\n }\n\n function _ownerAndOperatorEnabledOf(uint256 id) internal view returns (address owner, bool operatorEnabled) {\n uint256 data = _owners[id];\n owner = address(data);\n operatorEnabled = (data / 2**255) == 1;\n }\n\n /**\n * @notice Return the owner of a Land\n * @param id The id of the Land\n * @return The address of the owner\n */\n function ownerOf(uint256 id) external view returns (address owner) {\n owner = _ownerOf(id);\n require(owner != address(0), \"token does not exist\");\n }\n\n function _approveFor(address owner, address operator, uint256 id) internal {\n if(operator == address(0)) {\n _owners[id] = uint256(owner); // no need to resset the operator, it will be overriden next time\n } else {\n _owners[id] = uint256(owner) + 2**255;\n _operators[id] = operator;\n }\n emit Approval(owner, operator, id);\n }\n\n /**\n * @notice Approve an operator to spend tokens on the sender behalf\n * @param sender The address giving the approval\n * @param operator The address receiving the approval\n * @param id The id of the token\n */\n function approveFor(\n address sender,\n address operator,\n uint256 id\n ) external {\n address owner = _ownerOf(id);\n require(sender != address(0), \"sender is zero address\");\n require(\n msg.sender == sender ||\n _metaTransactionContracts[msg.sender] ||\n _superOperators[msg.sender] ||\n _operatorsForAll[sender][msg.sender],\n \"not authorized to approve\"\n );\n require(owner == sender, \"owner != sender\");\n _approveFor(owner, operator, id);\n }\n\n /**\n * @notice Approve an operator to spend tokens on the sender behalf\n * @param operator The address receiving the approval\n * @param id The id of the token\n */\n function approve(address operator, uint256 id) external {\n address owner = _ownerOf(id);\n require(owner != address(0), \"token does not exist\");\n require(\n owner == msg.sender ||\n _superOperators[msg.sender] ||\n _operatorsForAll[owner][msg.sender],\n \"not authorized to approve\"\n );\n _approveFor(owner, operator, id);\n }\n\n /**\n * @notice Get the approved operator for a specific token\n * @param id The id of the token\n * @return The address of the operator\n */\n function getApproved(uint256 id) external view returns (address) {\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(owner != address(0), \"token does not exist\");\n if (operatorEnabled) {\n return _operators[id];\n } else {\n return address(0);\n }\n }\n\n function _checkTransfer(address from, address to, uint256 id) internal view returns (bool isMetaTx) {\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(owner != address(0), \"token does not exist\");\n require(owner == from, \"not owner in _checkTransfer\");\n require(to != address(0), \"can't send to zero address\");\n isMetaTx = msg.sender != from && _metaTransactionContracts[msg.sender];\n if (msg.sender != from && !isMetaTx) {\n require(\n _superOperators[msg.sender] ||\n _operatorsForAll[from][msg.sender] ||\n (operatorEnabled && _operators[id] == msg.sender),\n \"not approved to transfer\"\n );\n }\n }\n\n function _checkInterfaceWith10000Gas(address _contract, bytes4 interfaceId)\n internal\n view\n returns (bool)\n {\n bool success;\n bool result;\n bytes memory call_data = abi.encodeWithSelector(\n ERC165ID,\n interfaceId\n );\n // solium-disable-next-line security/no-inline-assembly\n assembly {\n let call_ptr := add(0x20, call_data)\n let call_size := mload(call_data)\n let output := mload(0x40) // Find empty storage location using \"free memory pointer\"\n mstore(output, 0x0)\n success := staticcall(\n 10000,\n _contract,\n call_ptr,\n call_size,\n output,\n 0x20\n ) // 32 bytes\n result := mload(output)\n }\n // (10000 / 63) \"not enough for supportsInterface(...)\" // consume all gas, so caller can potentially know that there was not enough gas\n assert(gasleft() > 158);\n return success && result;\n }\n\n /**\n * @notice Transfer a token between 2 addresses\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param id The id of the token\n */\n function transferFrom(address from, address to, uint256 id) external {\n bool metaTx = _checkTransfer(from, to, id);\n _transferFrom(from, to, id);\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n require(\n _checkOnERC721Received(metaTx ? from : msg.sender, from, to, id, \"\"),\n \"erc721 transfer rejected by to\"\n );\n }\n }\n\n /**\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param id The id of the token\n * @param data Additional data\n */\n function safeTransferFrom(address from, address to, uint256 id, bytes memory data) public {\n bool metaTx = _checkTransfer(from, to, id);\n _transferFrom(from, to, id);\n if (to.isContract()) {\n require(\n _checkOnERC721Received(metaTx ? from : msg.sender, from, to, id, data),\n \"ERC721: transfer rejected by to\"\n );\n }\n }\n\n /**\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\n * @param from The send of the token\n * @param to The recipient of the token\n * @param id The id of the token\n */\n function safeTransferFrom(address from, address to, uint256 id) external {\n safeTransferFrom(from, to, id, \"\");\n }\n\n /**\n * @notice Transfer many tokens between 2 addresses\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param ids The ids of the tokens\n * @param data additional data\n */\n function batchTransferFrom(address from, address to, uint256[] calldata ids, bytes calldata data) external {\n _batchTransferFrom(from, to, ids, data, false);\n }\n\n function _batchTransferFrom(address from, address to, uint256[] memory ids, bytes memory data, bool safe) internal {\n bool metaTx = msg.sender != from && _metaTransactionContracts[msg.sender];\n bool authorized = msg.sender == from ||\n metaTx ||\n _superOperators[msg.sender] ||\n _operatorsForAll[from][msg.sender];\n\n require(from != address(0), \"from is zero address\");\n require(to != address(0), \"can't send to zero address\");\n\n uint256 numTokens = ids.length;\n for(uint256 i = 0; i < numTokens; i ++) {\n uint256 id = ids[i];\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(owner == from, \"not owner in batchTransferFrom\");\n require(authorized || (operatorEnabled && _operators[id] == msg.sender), \"not authorized\");\n _owners[id] = uint256(to);\n emit Transfer(from, to, id);\n }\n if (from != to) {\n _numNFTPerAddress[from] -= numTokens;\n _numNFTPerAddress[to] += numTokens;\n }\n\n if (to.isContract() && (safe || _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER))) {\n require(\n _checkOnERC721BatchReceived(metaTx ? from : msg.sender, from, to, ids, data),\n \"erc721 batch transfer rejected by to\"\n );\n }\n }\n\n /**\n * @notice Transfer many tokens between 2 addresses ensuring the receiving contract has a receiver method\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param ids The ids of the tokens\n * @param data additional data\n */\n function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, bytes calldata data) external {\n _batchTransferFrom(from, to, ids, data, true);\n }\n\n /**\n * @notice Check if the contract supports an interface\n * 0x01ffc9a7 is ERC-165\n * 0x80ac58cd is ERC-721\n * @param id The id of the interface\n * @return True if the interface is supported\n */\n function supportsInterface(bytes4 id) external pure returns (bool) {\n return id == 0x01ffc9a7 || id == 0x80ac58cd;\n }\n\n /**\n * @notice Set the approval for an operator to manage all the tokens of the sender\n * @param sender The address giving the approval\n * @param operator The address receiving the approval\n * @param approved The determination of the approval\n */\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) external {\n require(sender != address(0), \"Invalid sender address\");\n require(\n msg.sender == sender ||\n _metaTransactionContracts[msg.sender] ||\n _superOperators[msg.sender],\n \"not authorized to approve for all\"\n );\n\n _setApprovalForAll(sender, operator, approved);\n }\n\n /**\n * @notice Set the approval for an operator to manage all the tokens of the sender\n * @param operator The address receiving the approval\n * @param approved The determination of the approval\n */\n function setApprovalForAll(address operator, bool approved) external {\n _setApprovalForAll(msg.sender, operator, approved);\n }\n\n\n function _setApprovalForAll(\n address sender,\n address operator,\n bool approved\n ) internal {\n require(\n !_superOperators[operator],\n \"super operator can't have their approvalForAll changed\"\n );\n _operatorsForAll[sender][operator] = approved;\n\n emit ApprovalForAll(sender, operator, approved);\n }\n\n /**\n * @notice Check if the sender approved the operator\n * @param owner The address of the owner\n * @param operator The address of the operator\n * @return The status of the approval\n */\n function isApprovedForAll(address owner, address operator)\n external\n view\n returns (bool isOperator)\n {\n return _operatorsForAll[owner][operator] || _superOperators[operator];\n }\n\n function _burn(address from, address owner, uint256 id) internal {\n require(from == owner, \"not owner\");\n _owners[id] = 2**160; // cannot mint it again\n _numNFTPerAddress[from]--;\n emit Transfer(from, address(0), id);\n }\n\n /// @notice Burns token `id`.\n /// @param id token which will be burnt.\n function burn(uint256 id) external {\n _burn(msg.sender, _ownerOf(id), id);\n }\n\n /// @notice Burn token`id` from `from`.\n /// @param from address whose token is to be burnt.\n /// @param id token which will be burnt.\n function burnFrom(address from, uint256 id) external {\n require(from != address(0), \"Invalid sender address\");\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(\n msg.sender == from ||\n _metaTransactionContracts[msg.sender] ||\n (operatorEnabled && _operators[id] == msg.sender) ||\n _superOperators[msg.sender] ||\n _operatorsForAll[from][msg.sender],\n \"not authorized to burn\"\n );\n _burn(from, owner, id);\n }\n\n function _checkOnERC721Received(address operator, address from, address to, uint256 tokenId, bytes memory _data)\n internal returns (bool)\n {\n bytes4 retval = ERC721TokenReceiver(to).onERC721Received(operator, from, tokenId, _data);\n return (retval == _ERC721_RECEIVED);\n }\n\n function _checkOnERC721BatchReceived(address operator, address from, address to, uint256[] memory ids, bytes memory _data)\n internal returns (bool)\n {\n bytes4 retval = ERC721MandatoryTokenReceiver(to).onERC721BatchReceived(operator, from, ids, _data);\n return (retval == _ERC721_BATCH_RECEIVED);\n }\n\n // Empty storage space in contracts for future enhancements\n // ref: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/issues/13)\n uint256[49] private __gap;\n}\n" + }, + "src/solc_0.5/Land/erc721/ERC721BaseTokenV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n/* solhint-disable func-order, code-complexity */\npragma solidity 0.5.9;\n\nimport {AddressUtils} from \"../../contracts_common/Libraries/AddressUtils.sol\";\nimport {ERC721TokenReceiver} from \"../../contracts_common/Interfaces/ERC721TokenReceiver.sol\";\nimport {ERC721Events} from \"../../contracts_common/Interfaces/ERC721Events.sol\";\nimport {SuperOperatorsV2} from \"../../contracts_common/BaseWithStorage/SuperOperatorsV2.sol\";\nimport {MetaTransactionReceiverV2} from \"../../contracts_common/BaseWithStorage/MetaTransactionReceiverV2.sol\";\nimport {ERC721MandatoryTokenReceiver} from \"../../contracts_common/Interfaces/ERC721MandatoryTokenReceiver.sol\";\n\n/**\n * @title ERC721BaseTokenV2\n * @author The Sandbox\n * @notice Basic functionalities of a NFT\n * @dev ERC721 implementation that supports meta-transactions and super operators\n */\ncontract ERC721BaseTokenV2 is ERC721Events, SuperOperatorsV2, MetaTransactionReceiverV2 {\n using AddressUtils for address;\n\n bytes4 internal constant _ERC721_RECEIVED = 0x150b7a02;\n bytes4 internal constant _ERC721_BATCH_RECEIVED = 0x4b808c46;\n\n bytes4 internal constant ERC165ID = 0x01ffc9a7;\n bytes4 internal constant ERC721_MANDATORY_RECEIVER = 0x5e8bf644;\n\n /// @notice Number of NFT an address own\n mapping (address => uint256) public _numNFTPerAddress;\n\n /// @notice Token ids per address\n mapping (uint256 => uint256) public _owners;\n\n /// @notice Operators for each owner address for all tokens\n mapping (address => mapping(address => bool)) public _operatorsForAll;\n\n /// @notice Operator for each token id\n mapping (uint256 => address) public _operators;\n\n bool internal _initialized;\n\n modifier initializer() {\n require(!_initialized, \"ERC721BaseToken: Contract already initialized\");\n _;\n }\n\n /**\n * @notice Initializes the contract with the meta-transaction contract & admin\n * @param metaTransactionContract Authorized contract for meta-transactions\n * @param admin Admin of the contract\n */\n function initialize (\n address metaTransactionContract,\n address admin\n ) public initializer {\n _admin = admin;\n _setMetaTransactionProcessor(metaTransactionContract, true);\n _initialized = true;\n emit AdminChanged(address(0), _admin);\n }\n\n /**\n * @param from Sender address\n * @param to Recipient address\n * @param id Token id to transfer\n */\n function _transferFrom(\n address from,\n address to,\n uint256 id\n ) internal {\n _numNFTPerAddress[from]--;\n _numNFTPerAddress[to]++;\n _owners[id] = uint256(to);\n emit Transfer(from, to, id);\n }\n\n /**\n * @notice Return the number of Land owned by an address\n * @param owner The address to look for\n * @return The number of Land token owned by the address\n */\n function balanceOf(address owner) external view returns (uint256) {\n require(owner != address(0), \"owner is zero address\");\n return _numNFTPerAddress[owner];\n }\n\n /**\n * @param id token id\n * @return address of the owner\n */\n function _ownerOf(uint256 id) internal view returns (address) {\n return address(_owners[id]);\n }\n\n /**\n * @param id Token id\n * @return owner Address of the token's owner\n * @return operatorEnabled Is he an operator\n */\n function _ownerAndOperatorEnabledOf(uint256 id) internal view returns (address owner, bool operatorEnabled) {\n uint256 data = _owners[id];\n owner = address(data);\n operatorEnabled = (data / 2**255) == 1;\n }\n\n /**\n * @notice Return the owner of a Land\n * @param id The id of the Land\n * @return The address of the owner\n */\n function ownerOf(uint256 id) external view returns (address owner) {\n owner = _ownerOf(id);\n require(owner != address(0), \"token does not exist\");\n }\n\n /**\n * @param owner The address giving the approval\n * @param operator The address receiving the approval\n * @param id The id of the token\n */\n function _approveFor(\n address owner,\n address operator,\n uint256 id\n ) internal {\n if (operator == address(0)) {\n _owners[id] = uint256(owner); // no need to resset the operator, it will be overriden next time\n } else {\n _owners[id] = uint256(owner) + 2**255;\n _operators[id] = operator;\n }\n emit Approval(owner, operator, id);\n }\n\n /**\n * @notice Approve an operator to spend tokens on the sender behalf\n * @param sender The address giving the approval\n * @param operator The address receiving the approval\n * @param id The id of the token\n */\n function approveFor(\n address sender,\n address operator,\n uint256 id\n ) public {\n address owner = _ownerOf(id);\n require(sender != address(0), \"sender is zero address\");\n require(\n msg.sender == sender ||\n _metaTransactionContracts[msg.sender] ||\n _operatorsForAll[sender][msg.sender] ||\n _superOperators[msg.sender],\n \"not authorized to approve\"\n );\n require(owner == sender, \"owner != sender\");\n _approveFor(owner, operator, id);\n }\n\n /**\n * @notice Approve an operator to spend tokens on the sender behalf\n * @param operator The address receiving the approval\n * @param id The id of the token\n */\n function approve(address operator, uint256 id) public {\n address owner = _ownerOf(id);\n require(owner != address(0), \"token does not exist\");\n require(\n owner == msg.sender || _operatorsForAll[owner][msg.sender] || _superOperators[msg.sender],\n \"not authorized to approve\"\n );\n _approveFor(owner, operator, id);\n }\n\n /**\n * @notice Get the approved operator for a specific token\n * @param id The id of the token\n * @return The address of the operator\n */\n function getApproved(uint256 id) external view returns (address) {\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(owner != address(0), \"token does not exist\");\n if (operatorEnabled) {\n return _operators[id];\n } else {\n return address(0);\n }\n }\n\n /**\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param id The id of the token\n * @return is it a meta-tx\n */\n function _checkTransfer(\n address from,\n address to,\n uint256 id\n ) internal view returns (bool isMetaTx) {\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(owner != address(0), \"token does not exist\");\n require(owner == from, \"not owner in _checkTransfer\");\n require(to != address(0), \"can't send to zero address\");\n if (msg.sender != from) {\n if(_metaTransactionContracts[msg.sender]) {\n return true;\n }\n require(\n _operatorsForAll[from][msg.sender] ||\n (operatorEnabled && _operators[id] == msg.sender) ||\n _superOperators[msg.sender],\n \"not approved to transfer\"\n );\n }\n }\n\n /**\n * @dev Checks if the target contract supports the given interface & doesn't exceed 10000 gas\n * @param _contract The target contract\n * @param interfaceId The interface id\n * @return if the call is a success\n */\n function _checkInterfaceWith10000Gas(address _contract, bytes4 interfaceId)\n internal\n view\n returns (bool)\n {\n bool success;\n bool result;\n bytes memory call_data = abi.encodeWithSelector(ERC165ID, interfaceId);\n // solium-disable-next-line security/no-inline-assembly\n assembly {\n let call_ptr := add(0x20, call_data)\n let call_size := mload(call_data)\n let output := mload(0x40) // Find empty storage location using \"free memory pointer\"\n mstore(output, 0x0)\n success := staticcall(10000, _contract, call_ptr, call_size, output, 0x20) // 32 bytes\n result := mload(output)\n }\n // (10000 / 63) \"not enough for supportsInterface(...)\" // consume all gas, so caller can potentially know that there was not enough gas\n assert(gasleft() > 158);\n return success && result;\n }\n\n /**\n * @notice Transfer a token between 2 addresses\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param id The id of the token\n */\n function transferFrom(\n address from,\n address to,\n uint256 id\n ) public {\n bool metaTx = _checkTransfer(from, to, id);\n _transferFrom(from, to, id);\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n require(\n _checkOnERC721Received(metaTx ? from : msg.sender, from, to, id, \"\"),\n \"erc721 transfer rejected by to\"\n );\n }\n }\n\n /**\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param id The id of the token\n * @param data Additional data\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) public {\n bool metaTx = _checkTransfer(from, to, id);\n _transferFrom(from, to, id);\n if (to.isContract()) {\n require(\n _checkOnERC721Received(metaTx ? from : msg.sender, from, to, id, data),\n \"ERC721: transfer rejected by to\"\n );\n }\n }\n\n /**\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\n * @param from The send of the token\n * @param to The recipient of the token\n * @param id The id of the token\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id\n ) external {\n safeTransferFrom(from, to, id, \"\");\n }\n\n /**\n * @notice Transfer many tokens between 2 addresses\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param ids The ids of the tokens\n * @param data additional data\n */\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external {\n _batchTransferFrom(from, to, ids, data, false);\n }\n\n /**\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param ids The ids of the tokens\n * @param data additional data\n * @param safe checks the target contract\n */\n function _batchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n bytes memory data,\n bool safe\n ) internal {\n bool metaTx = msg.sender != from && _metaTransactionContracts[msg.sender];\n bool authorized =\n msg.sender == from || metaTx || _operatorsForAll[from][msg.sender] || _superOperators[msg.sender];\n\n require(from != address(0), \"from is zero address\");\n require(to != address(0), \"can't send to zero address\");\n\n uint256 numTokens = ids.length;\n for (uint256 i = 0; i < numTokens; i++) {\n uint256 id = ids[i];\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(owner == from, \"not owner in batchTransferFrom\");\n require(authorized || (operatorEnabled && _operators[id] == msg.sender), \"not authorized\");\n _owners[id] = uint256(to);\n emit Transfer(from, to, id);\n }\n if (from != to) {\n _numNFTPerAddress[from] -= numTokens;\n _numNFTPerAddress[to] += numTokens;\n }\n\n if (to.isContract()) {\n if (_checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n require(\n _checkOnERC721BatchReceived(metaTx ? from : msg.sender, from, to, ids, data),\n \"erc721 batch transfer rejected by to\"\n );\n } else if (safe) {\n for (uint256 i = 0; i < numTokens; i++) {\n require(\n _checkOnERC721Received(metaTx ? from : msg.sender, from, to, ids[i], \"\"),\n \"erc721 transfer rejected by to\"\n );\n }\n }\n }\n }\n\n /**\n * @notice Transfer many tokens between 2 addresses ensuring the receiving contract has a receiver method\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param ids The ids of the tokens\n * @param data additional data\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external {\n _batchTransferFrom(from, to, ids, data, true);\n }\n\n /**\n * @notice Check if the contract supports an interface\n * 0x01ffc9a7 is ERC-165\n * 0x80ac58cd is ERC-721\n * @param id The id of the interface\n * @return True if the interface is supported\n */\n function supportsInterface(bytes4 id) external pure returns (bool) {\n return id == 0x01ffc9a7 || id == 0x80ac58cd;\n }\n\n /**\n * @notice Set the approval for an operator to manage all the tokens of the sender\n * @param sender The address giving the approval\n * @param operator The address receiving the approval\n * @param approved The determination of the approval\n */\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) public {\n require(sender != address(0), \"Invalid sender address\");\n require(\n msg.sender == sender || _metaTransactionContracts[msg.sender] || _superOperators[msg.sender],\n \"not authorized to approve for all\"\n );\n\n _setApprovalForAll(sender, operator, approved);\n }\n\n /**\n * @notice Set the approval for an operator to manage all the tokens of the sender\n * @param operator The address receiving the approval\n * @param approved The determination of the approval\n */\n function setApprovalForAll(address operator, bool approved) public {\n _setApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @param sender Sender address\n * @param operator The address receiving the approval\n * @param approved The determination of the approval\n */\n function _setApprovalForAll(\n address sender,\n address operator,\n bool approved\n ) internal {\n require(!_superOperators[operator], \"super operator can't have their approvalForAll changed\");\n _operatorsForAll[sender][operator] = approved;\n\n emit ApprovalForAll(sender, operator, approved);\n }\n\n /**\n * @notice Check if the sender approved the operator\n * @param owner The address of the owner\n * @param operator The address of the operator\n * @return The status of the approval\n */\n function isApprovedForAll(address owner, address operator)\n external\n view\n returns (bool)\n {\n return _operatorsForAll[owner][operator] || _superOperators[operator];\n }\n\n /**\n * @param from sender address\n * @param owner owner address of the token\n * @param id token id to burn\n */\n function _burn(\n address from,\n address owner,\n uint256 id\n ) internal {\n require(from == owner, \"not owner\");\n _owners[id] = 2**160; // cannot mint it again\n _numNFTPerAddress[from]--;\n emit Transfer(from, address(0), id);\n }\n\n /// @notice Burns token `id`.\n /// @param id token which will be burnt.\n function burn(uint256 id) external {\n _burn(msg.sender, _ownerOf(id), id);\n }\n\n /// @notice Burn token`id` from `from`.\n /// @param from address whose token is to be burnt.\n /// @param id token which will be burnt.\n function burnFrom(address from, uint256 id) external {\n require(from != address(0), \"Invalid sender address\");\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(\n msg.sender == from ||\n _metaTransactionContracts[msg.sender] ||\n (operatorEnabled && _operators[id] == msg.sender) ||\n _operatorsForAll[from][msg.sender] ||\n _superOperators[msg.sender],\n \"not authorized to burn\"\n );\n _burn(from, owner, id);\n }\n\n /**\n * @param operator Sender of the tx\n * @param from Owner of the token\n * @param to Recipient\n * @param tokenId Token id\n * @param _data extra data\n */\n function _checkOnERC721Received(\n address operator,\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal returns (bool) {\n bytes4 retval = ERC721TokenReceiver(to).onERC721Received(operator, from, tokenId, _data);\n return (retval == _ERC721_RECEIVED);\n }\n\n /**\n * @dev Check if receiving contract accepts erc721 batch transfers.\n * @param operator Sender of the tx\n * @param from Owner of the token\n * @param to Recipient\n * @param ids Token ids\n * @param _data extra data\n * @return Whether the expected value of 0x4b808c46 is returned.\n */\n function _checkOnERC721BatchReceived(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n bytes memory _data\n ) internal returns (bool) {\n bytes4 retval = ERC721MandatoryTokenReceiver(to).onERC721BatchReceived(operator, from, ids, _data);\n return (retval == _ERC721_BATCH_RECEIVED);\n }\n\n // Empty storage space in contracts for future enhancements\n // ref: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/issues/13)\n uint256[49] private __gap;\n}\n" + }, + "src/solc_0.5/Land/erc721/LandBaseToken.sol": { + "content": "/* solhint-disable func-order, code-complexity */\npragma solidity 0.5.9;\n\nimport \"./ERC721BaseToken.sol\";\n\ncontract LandBaseToken is ERC721BaseToken {\n // Our grid is 408 x 408 lands\n uint256 internal constant GRID_SIZE = 408;\n\n uint256 internal constant LAYER = 0xFF00000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_1x1 = 0x0000000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_3x3 = 0x0100000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_6x6 = 0x0200000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_12x12 = 0x0300000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_24x24 = 0x0400000000000000000000000000000000000000000000000000000000000000;\n\n mapping(address => bool) internal _minters;\n event Minter(address superOperator, bool enabled);\n\n /// @notice Enable or disable the ability of `minter` to mint tokens\n /// @param minter address that will be given/removed minter right.\n /// @param enabled set whether the minter is enabled or disabled.\n function setMinter(address minter, bool enabled) external {\n require(\n msg.sender == _admin,\n \"only admin is allowed to add minters\"\n );\n _minters[minter] = enabled;\n emit Minter(minter, enabled);\n }\n\n /// @notice check whether address `who` is given minter rights.\n /// @param who The address to query.\n /// @return whether the address has minter rights.\n function isMinter(address who) public view returns (bool) {\n return _minters[who];\n }\n\n /// @notice total width of the map\n /// @return width\n function width() external returns(uint256) {\n return GRID_SIZE;\n }\n\n /// @notice total height of the map\n /// @return height\n function height() external returns(uint256) {\n return GRID_SIZE;\n }\n\n /// @notice x coordinate of Land token\n /// @param id tokenId\n /// @return the x coordinates\n function x(uint256 id) external returns(uint256) {\n require(_ownerOf(id) != address(0), \"token does not exist\");\n return id % GRID_SIZE;\n }\n\n /// @notice y coordinate of Land token\n /// @param id tokenId\n /// @return the y coordinates\n function y(uint256 id) external returns(uint256) {\n require(_ownerOf(id) != address(0), \"token does not exist\");\n return id / GRID_SIZE;\n }\n\n /**\n * @notice Mint a new quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\n * @param to The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintQuad(address to, uint256 size, uint256 x, uint256 y, bytes calldata data) external {\n require(to != address(0), \"to is zero address\");\n require(\n isMinter(msg.sender),\n \"Only a minter can mint\"\n );\n require(x % size == 0 && y % size == 0, \"Invalid coordinates\");\n require(x <= GRID_SIZE - size && y <= GRID_SIZE - size, \"Out of bounds\");\n\n uint256 quadId;\n uint256 id = x + y * GRID_SIZE;\n\n if (size == 1) {\n quadId = id;\n } else if (size == 3) {\n quadId = LAYER_3x3 + id;\n } else if (size == 6) {\n quadId = LAYER_6x6 + id;\n } else if (size == 12) {\n quadId = LAYER_12x12 + id;\n } else if (size == 24) {\n quadId = LAYER_24x24 + id;\n } else {\n require(false, \"Invalid size\");\n }\n\n require(_owners[LAYER_24x24 + (x/24) * 24 + ((y/24) * 24) * GRID_SIZE] == 0, \"Already minted as 24x24\");\n\n uint256 toX = x+size;\n uint256 toY = y+size;\n if (size <= 12) {\n require(\n _owners[LAYER_12x12 + (x/12) * 12 + ((y/12) * 12) * GRID_SIZE] == 0,\n \"Already minted as 12x12\"\n );\n } else {\n for (uint256 x12i = x; x12i < toX; x12i += 12) {\n for (uint256 y12i = y; y12i < toY; y12i += 12) {\n uint256 id12x12 = LAYER_12x12 + x12i + y12i * GRID_SIZE;\n require(_owners[id12x12] == 0, \"Already minted as 12x12\");\n }\n }\n }\n\n if (size <= 6) {\n require(_owners[LAYER_6x6 + (x/6) * 6 + ((y/6) * 6) * GRID_SIZE] == 0, \"Already minted as 6x6\");\n } else {\n for (uint256 x6i = x; x6i < toX; x6i += 6) {\n for (uint256 y6i = y; y6i < toY; y6i += 6) {\n uint256 id6x6 = LAYER_6x6 + x6i + y6i * GRID_SIZE;\n require(_owners[id6x6] == 0, \"Already minted as 6x6\");\n }\n }\n }\n\n if (size <= 3) {\n require(_owners[LAYER_3x3 + (x/3) * 3 + ((y/3) * 3) * GRID_SIZE] == 0, \"Already minted as 3x3\");\n } else {\n for (uint256 x3i = x; x3i < toX; x3i += 3) {\n for (uint256 y3i = y; y3i < toY; y3i += 3) {\n uint256 id3x3 = LAYER_3x3 + x3i + y3i * GRID_SIZE;\n require(_owners[id3x3] == 0, \"Already minted as 3x3\");\n }\n }\n }\n\n for (uint256 i = 0; i < size*size; i++) {\n uint256 id = _idInPath(i, size, x, y);\n require(_owners[id] == 0, \"Already minted\");\n emit Transfer(address(0), to, id);\n }\n\n _owners[quadId] = uint256(to);\n _numNFTPerAddress[to] += size * size;\n\n _checkBatchReceiverAcceptQuad(msg.sender, address(0), to, size, x, y, data);\n }\n\n function _idInPath(uint256 i, uint256 size, uint256 x, uint256 y) internal pure returns(uint256) {\n uint256 row = i / size;\n if(row % 2 == 0) { // alow ids to follow a path in a quad\n return (x + (i%size)) + ((y + row) * GRID_SIZE);\n } else {\n return ((x + size) - (1 + i%size)) + ((y + row) * GRID_SIZE);\n }\n }\n\n /// @notice transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\n /// @param from current owner of the quad\n /// @param to destination\n /// @param size size of the quad\n /// @param x The top left x coordinate of the quad\n /// @param y The top left y coordinate of the quad\n /// @param data additional data\n function transferQuad(address from, address to, uint256 size, uint256 x, uint256 y, bytes calldata data) external {\n require(from != address(0), \"from is zero address\");\n require(to != address(0), \"can't send to zero address\");\n bool metaTx = msg.sender != from && _metaTransactionContracts[msg.sender];\n if (msg.sender != from && !metaTx) {\n require(\n _superOperators[msg.sender] ||\n _operatorsForAll[from][msg.sender],\n \"not authorized to transferQuad\"\n );\n }\n _transferQuad(from, to, size, x, y);\n _numNFTPerAddress[from] -= size * size;\n _numNFTPerAddress[to] += size * size;\n\n _checkBatchReceiverAcceptQuad(metaTx ? from : msg.sender, from, to, size, x, y, data);\n }\n\n function _checkBatchReceiverAcceptQuad(\n address operator,\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) internal {\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n uint256[] memory ids = new uint256[](size*size);\n for (uint256 i = 0; i < size*size; i++) {\n ids[i] = _idInPath(i, size, x, y);\n }\n require(\n _checkOnERC721BatchReceived(operator, from, to, ids, data),\n \"erc721 batch transfer rejected by to\"\n );\n }\n }\n\n /// @notice transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\n /// @param from current owner of the quad\n /// @param to destination\n /// @param sizes list of sizes for each quad\n /// @param xs list of top left x coordinates for each quad\n /// @param ys list of top left y coordinates for each quad\n /// @param data additional data\n function batchTransferQuad(\n address from,\n address to,\n uint256[] calldata sizes,\n uint256[] calldata xs,\n uint256[] calldata ys,\n bytes calldata data\n ) external {\n require(from != address(0), \"from is zero address\");\n require(to != address(0), \"can't send to zero address\");\n require(sizes.length == xs.length && xs.length == ys.length, \"invalid data\");\n bool metaTx = msg.sender != from && _metaTransactionContracts[msg.sender];\n if (msg.sender != from && !metaTx) {\n require(\n _superOperators[msg.sender] ||\n _operatorsForAll[from][msg.sender],\n \"not authorized to transferMultiQuads\"\n );\n }\n uint256 numTokensTransfered = 0;\n for (uint256 i = 0; i < sizes.length; i++) {\n uint256 size = sizes[i];\n _transferQuad(from, to, size, xs[i], ys[i]);\n numTokensTransfered += size * size;\n }\n _numNFTPerAddress[from] -= numTokensTransfered;\n _numNFTPerAddress[to] += numTokensTransfered;\n\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n uint256[] memory ids = new uint256[](numTokensTransfered);\n uint256 counter = 0;\n for (uint256 j = 0; j < sizes.length; j++) {\n uint256 size = sizes[j];\n for (uint256 i = 0; i < size*size; i++) {\n ids[counter] = _idInPath(i, size, xs[j], ys[j]);\n counter++;\n }\n }\n require(\n _checkOnERC721BatchReceived(metaTx ? from : msg.sender, from, to, ids, data),\n \"erc721 batch transfer rejected by to\"\n );\n }\n }\n\n function _transferQuad(address from, address to, uint256 size, uint256 x, uint256 y) internal {\n if (size == 1) {\n uint256 id1x1 = x + y * GRID_SIZE;\n address owner = _ownerOf(id1x1);\n require(owner != address(0), \"token does not exist\");\n require(owner == from, \"not owner in _transferQuad\");\n _owners[id1x1] = uint256(to);\n } else {\n _regroup(from, to, size, x, y);\n }\n for (uint256 i = 0; i < size*size; i++) {\n emit Transfer(from, to, _idInPath(i, size, x, y));\n }\n }\n\n function _checkAndClear(address from, uint256 id) internal returns(bool) {\n uint256 owner = _owners[id];\n if (owner != 0) {\n require(address(owner) == from, \"not owner\");\n _owners[id] = 0;\n return true;\n }\n return false;\n }\n\n function _regroup(address from, address to, uint256 size, uint256 x, uint256 y) internal {\n require(x % size == 0 && y % size == 0, \"Invalid coordinates\");\n require(x <= GRID_SIZE - size && y <= GRID_SIZE - size, \"Out of bounds\");\n\n if (size == 3) {\n _regroup3x3(from, to, x, y, true);\n } else if (size == 6) {\n _regroup6x6(from, to, x, y, true);\n } else if (size == 12) {\n _regroup12x12(from, to, x, y, true);\n } else if (size == 24) {\n _regroup24x24(from, to, x, y, true);\n } else {\n require(false, \"Invalid size\");\n }\n }\n\n function _regroup3x3(address from, address to, uint256 x, uint256 y, bool set) internal returns (bool) {\n uint256 id = x + y * GRID_SIZE;\n uint256 quadId = LAYER_3x3 + id;\n bool ownerOfAll = true;\n for (uint256 xi = x; xi < x+3; xi++) {\n for (uint256 yi = y; yi < y+3; yi++) {\n ownerOfAll = _checkAndClear(from, xi + yi * GRID_SIZE) && ownerOfAll;\n }\n }\n if(set) {\n if(!ownerOfAll) {\n require(\n _owners[quadId] == uint256(from) ||\n _owners[LAYER_6x6 + (x/6) * 6 + ((y/6) * 6) * GRID_SIZE] == uint256(from) ||\n _owners[LAYER_12x12 + (x/12) * 12 + ((y/12) * 12) * GRID_SIZE] == uint256(from) ||\n _owners[LAYER_24x24 + (x/24) * 24 + ((y/24) * 24) * GRID_SIZE] == uint256(from),\n \"not owner of all sub quads nor parent quads\"\n );\n }\n _owners[quadId] = uint256(to);\n return true;\n }\n return ownerOfAll;\n }\n function _regroup6x6(address from, address to, uint256 x, uint256 y, bool set) internal returns (bool) {\n uint256 id = x + y * GRID_SIZE;\n uint256 quadId = LAYER_6x6 + id;\n bool ownerOfAll = true;\n for (uint256 xi = x; xi < x+6; xi += 3) {\n for (uint256 yi = y; yi < y+6; yi += 3) {\n bool ownAllIndividual = _regroup3x3(from, to, xi, yi, false);\n uint256 id3x3 = LAYER_3x3 + xi + yi * GRID_SIZE;\n uint256 owner3x3 = _owners[id3x3];\n if (owner3x3 != 0) {\n if(!ownAllIndividual) {\n require(owner3x3 == uint256(from), \"not owner of 3x3 quad\");\n }\n _owners[id3x3] = 0;\n }\n ownerOfAll = (ownAllIndividual || owner3x3 != 0) && ownerOfAll;\n }\n }\n if(set) {\n if(!ownerOfAll) {\n require(\n _owners[quadId] == uint256(from) ||\n _owners[LAYER_12x12 + (x/12) * 12 + ((y/12) * 12) * GRID_SIZE] == uint256(from) ||\n _owners[LAYER_24x24 + (x/24) * 24 + ((y/24) * 24) * GRID_SIZE] == uint256(from),\n \"not owner of all sub quads nor parent quads\"\n );\n }\n _owners[quadId] = uint256(to);\n return true;\n }\n return ownerOfAll;\n }\n function _regroup12x12(address from, address to, uint256 x, uint256 y, bool set) internal returns (bool) {\n uint256 id = x + y * GRID_SIZE;\n uint256 quadId = LAYER_12x12 + id;\n bool ownerOfAll = true;\n for (uint256 xi = x; xi < x+12; xi += 6) {\n for (uint256 yi = y; yi < y+12; yi += 6) {\n bool ownAllIndividual = _regroup6x6(from, to, xi, yi, false);\n uint256 id6x6 = LAYER_6x6 + xi + yi * GRID_SIZE;\n uint256 owner6x6 = _owners[id6x6];\n if (owner6x6 != 0) {\n if(!ownAllIndividual) {\n require(owner6x6 == uint256(from), \"not owner of 6x6 quad\");\n }\n _owners[id6x6] = 0;\n }\n ownerOfAll = (ownAllIndividual || owner6x6 != 0) && ownerOfAll;\n }\n }\n if(set) {\n if(!ownerOfAll) {\n require(\n _owners[quadId] == uint256(from) ||\n _owners[LAYER_24x24 + (x/24) * 24 + ((y/24) * 24) * GRID_SIZE] == uint256(from),\n \"not owner of all sub quads nor parent quads\"\n );\n }\n _owners[quadId] = uint256(to);\n return true;\n }\n return ownerOfAll;\n }\n function _regroup24x24(address from, address to, uint256 x, uint256 y, bool set) internal returns (bool) {\n uint256 id = x + y * GRID_SIZE;\n uint256 quadId = LAYER_24x24 + id;\n bool ownerOfAll = true;\n for (uint256 xi = x; xi < x+24; xi += 12) {\n for (uint256 yi = y; yi < y+24; yi += 12) {\n bool ownAllIndividual = _regroup12x12(from, to, xi, yi, false);\n uint256 id12x12 = LAYER_12x12 + xi + yi * GRID_SIZE;\n uint256 owner12x12 = _owners[id12x12];\n if (owner12x12 != 0) {\n if(!ownAllIndividual) {\n require(owner12x12 == uint256(from), \"not owner of 12x12 quad\");\n }\n _owners[id12x12] = 0;\n }\n ownerOfAll = (ownAllIndividual || owner12x12 != 0) && ownerOfAll;\n }\n }\n if(set) {\n if(!ownerOfAll) {\n require(\n _owners[quadId] == uint256(from),\n \"not owner of all sub quads not parent quad\"\n );\n }\n _owners[quadId] = uint256(to);\n return true;\n }\n return ownerOfAll || _owners[quadId] == uint256(from);\n }\n\n function _ownerOf(uint256 id) internal view returns (address) {\n require(id & LAYER == 0, \"Invalid token id\");\n uint256 x = id % GRID_SIZE;\n uint256 y = id / GRID_SIZE;\n uint256 owner1x1 = _owners[id];\n\n if (owner1x1 != 0) {\n return address(owner1x1); // cast to zero\n } else {\n address owner3x3 = address(_owners[LAYER_3x3 + (x/3) * 3 + ((y/3) * 3) * GRID_SIZE]);\n if (owner3x3 != address(0)) {\n return owner3x3;\n } else {\n address owner6x6 = address(_owners[LAYER_6x6 + (x/6) * 6 + ((y/6) * 6) * GRID_SIZE]);\n if (owner6x6 != address(0)) {\n return owner6x6;\n } else {\n address owner12x12 = address(_owners[LAYER_12x12 + (x/12) * 12 + ((y/12) * 12) * GRID_SIZE]);\n if (owner12x12 != address(0)) {\n return owner12x12;\n } else {\n return address(_owners[LAYER_24x24 + (x/24) * 24 + ((y/24) * 24) * GRID_SIZE]);\n }\n }\n }\n }\n }\n\n function _ownerAndOperatorEnabledOf(uint256 id) internal view returns (address owner, bool operatorEnabled) {\n require(id & LAYER == 0, \"Invalid token id\");\n uint256 x = id % GRID_SIZE;\n uint256 y = id / GRID_SIZE;\n uint256 owner1x1 = _owners[id];\n\n if (owner1x1 != 0) {\n owner = address(owner1x1);\n operatorEnabled = (owner1x1 / 2**255) == 1;\n } else {\n address owner3x3 = address(_owners[LAYER_3x3 + (x/3) * 3 + ((y/3) * 3) * GRID_SIZE]);\n if (owner3x3 != address(0)) {\n owner = owner3x3;\n operatorEnabled = false;\n } else {\n address owner6x6 = address(_owners[LAYER_6x6 + (x/6) * 6 + ((y/6) * 6) * GRID_SIZE]);\n if (owner6x6 != address(0)) {\n owner = owner6x6;\n operatorEnabled = false;\n } else {\n address owner12x12 = address(_owners[LAYER_12x12 + (x/12) * 12 + ((y/12) * 12) * GRID_SIZE]);\n if (owner12x12 != address(0)) {\n owner = owner12x12;\n operatorEnabled = false;\n } else {\n owner = address(_owners[LAYER_24x24 + (x/24) * 24 + ((y/24) * 24) * GRID_SIZE]);\n operatorEnabled = false;\n }\n }\n }\n }\n }\n\n}\n" + }, + "src/solc_0.5/Land/erc721/LandBaseTokenV2.sol": { + "content": "/* solhint-disable func-order, code-complexity */\npragma solidity 0.5.9;\n\nimport \"./ERC721BaseTokenV2.sol\";\n\ncontract LandBaseTokenV2 is ERC721BaseTokenV2 {\n // Our grid is 408 x 408 lands\n uint256 internal constant GRID_SIZE = 408;\n\n uint256 internal constant LAYER = 0xFF00000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_1x1 = 0x0000000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_3x3 = 0x0100000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_6x6 = 0x0200000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_12x12 = 0x0300000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_24x24 = 0x0400000000000000000000000000000000000000000000000000000000000000;\n\n mapping(address => bool) internal _minters;\n event Minter(address superOperator, bool enabled);\n\n /// @notice Enable or disable the ability of `minter` to mint tokens\n /// @param minter address that will be given/removed minter right.\n /// @param enabled set whether the minter is enabled or disabled.\n function setMinter(address minter, bool enabled) external onlyAdmin {\n require(minter != address(0), \"address 0 is not allowed as minter\");\n require(enabled != _minters[minter], \"the status should be different than the current one\");\n _minters[minter] = enabled;\n emit Minter(minter, enabled);\n }\n\n /// @notice check whether address `who` is given minter rights.\n /// @param who The address to query.\n /// @return whether the address has minter rights.\n function isMinter(address who) public view returns (bool) {\n return _minters[who];\n }\n\n /// @notice total width of the map\n /// @return width\n function width() external returns (uint256) {\n return GRID_SIZE;\n }\n\n /// @notice total height of the map\n /// @return height\n function height() external returns (uint256) {\n return GRID_SIZE;\n }\n\n /// @notice x coordinate of Land token\n /// @param id tokenId\n /// @return the x coordinates\n function x(uint256 id) external returns (uint256) {\n require(_ownerOf(id) != address(0), \"token does not exist\");\n return id % GRID_SIZE;\n }\n\n /// @notice y coordinate of Land token\n /// @param id tokenId\n /// @return the y coordinates\n function y(uint256 id) external returns (uint256) {\n require(_ownerOf(id) != address(0), \"token does not exist\");\n return id / GRID_SIZE;\n }\n\n /**\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\n * @param to The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external {\n require(to != address(0), \"to is zero address\");\n require(isMinter(msg.sender), \"Only a minter can mint\");\n require(x % size == 0 && y % size == 0, \"Invalid coordinates\");\n require(x <= GRID_SIZE - size && y <= GRID_SIZE - size, \"Out of bounds\");\n\n uint256 quadId;\n uint256 id = x + y * GRID_SIZE;\n\n if (size == 1) {\n quadId = id;\n } else if (size == 3) {\n quadId = LAYER_3x3 + id;\n } else if (size == 6) {\n quadId = LAYER_6x6 + id;\n } else if (size == 12) {\n quadId = LAYER_12x12 + id;\n } else if (size == 24) {\n quadId = LAYER_24x24 + id;\n } else {\n require(false, \"Invalid size\");\n }\n\n require(_owners[LAYER_24x24 + (x / 24) * 24 + ((y / 24) * 24) * GRID_SIZE] == 0, \"Already minted as 24x24\");\n\n uint256 toX = x + size;\n uint256 toY = y + size;\n if (size <= 12) {\n require(_owners[LAYER_12x12 + (x / 12) * 12 + ((y / 12) * 12) * GRID_SIZE] == 0, \"Already minted as 12x12\");\n } else {\n for (uint256 x12i = x; x12i < toX; x12i += 12) {\n for (uint256 y12i = y; y12i < toY; y12i += 12) {\n uint256 id12x12 = LAYER_12x12 + x12i + y12i * GRID_SIZE;\n require(_owners[id12x12] == 0, \"Already minted as 12x12\");\n }\n }\n }\n\n if (size <= 6) {\n require(_owners[LAYER_6x6 + (x / 6) * 6 + ((y / 6) * 6) * GRID_SIZE] == 0, \"Already minted as 6x6\");\n } else {\n for (uint256 x6i = x; x6i < toX; x6i += 6) {\n for (uint256 y6i = y; y6i < toY; y6i += 6) {\n uint256 id6x6 = LAYER_6x6 + x6i + y6i * GRID_SIZE;\n require(_owners[id6x6] == 0, \"Already minted as 6x6\");\n }\n }\n }\n\n if (size <= 3) {\n require(_owners[LAYER_3x3 + (x / 3) * 3 + ((y / 3) * 3) * GRID_SIZE] == 0, \"Already minted as 3x3\");\n } else {\n for (uint256 x3i = x; x3i < toX; x3i += 3) {\n for (uint256 y3i = y; y3i < toY; y3i += 3) {\n uint256 id3x3 = LAYER_3x3 + x3i + y3i * GRID_SIZE;\n require(_owners[id3x3] == 0, \"Already minted as 3x3\");\n }\n }\n }\n\n for (uint256 i = 0; i < size * size; i++) {\n uint256 id = _idInPath(i, size, x, y);\n require(_owners[id] == 0, \"Already minted\");\n emit Transfer(address(0), to, id);\n }\n\n _owners[quadId] = uint256(to);\n _numNFTPerAddress[to] += size * size;\n\n _checkBatchReceiverAcceptQuad(msg.sender, address(0), to, size, x, y, data);\n }\n\n function _idInPath(\n uint256 i,\n uint256 size,\n uint256 x,\n uint256 y\n ) internal pure returns (uint256) {\n uint256 row = i / size;\n if (row % 2 == 0) {\n // allow ids to follow a path in a quad\n return (x + (i % size)) + ((y + row) * GRID_SIZE);\n } else {\n return ((x + size) - (1 + (i % size))) + ((y + row) * GRID_SIZE);\n }\n }\n\n /// @notice transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\n /// @param from current owner of the quad\n /// @param to destination\n /// @param size size of the quad\n /// @param x The top left x coordinate of the quad\n /// @param y The top left y coordinate of the quad\n /// @param data additional data\n function transferQuad(\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external {\n require(from != address(0), \"from is zero address\");\n require(to != address(0), \"can't send to zero address\");\n bool metaTx = msg.sender != from && _metaTransactionContracts[msg.sender];\n if (msg.sender != from && !metaTx) {\n require(\n _operatorsForAll[from][msg.sender] || _superOperators[msg.sender],\n \"not authorized to transferQuad\"\n );\n }\n _transferQuad(from, to, size, x, y);\n _numNFTPerAddress[from] -= size * size;\n _numNFTPerAddress[to] += size * size;\n\n _checkBatchReceiverAcceptQuad(metaTx ? from : msg.sender, from, to, size, x, y, data);\n }\n\n function _checkBatchReceiverAcceptQuad(\n address operator,\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) internal {\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n uint256[] memory ids = new uint256[](size * size);\n for (uint256 i = 0; i < size * size; i++) {\n ids[i] = _idInPath(i, size, x, y);\n }\n require(_checkOnERC721BatchReceived(operator, from, to, ids, data), \"erc721 batch transfer rejected by to\");\n }\n }\n\n /// @notice transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\n /// @param from current owner of the quad\n /// @param to destination\n /// @param sizes list of sizes for each quad\n /// @param xs list of top left x coordinates for each quad\n /// @param ys list of top left y coordinates for each quad\n /// @param data additional data\n function batchTransferQuad(\n address from,\n address to,\n uint256[] calldata sizes,\n uint256[] calldata xs,\n uint256[] calldata ys,\n bytes calldata data\n ) external {\n require(from != address(0), \"from is zero address\");\n require(to != address(0), \"can't send to zero address\");\n require(sizes.length == xs.length && xs.length == ys.length, \"invalid data\");\n bool metaTx = msg.sender != from && _metaTransactionContracts[msg.sender];\n if (msg.sender != from && !metaTx) {\n require(\n _operatorsForAll[from][msg.sender] || _superOperators[msg.sender],\n \"not authorized to transferMultiQuads\"\n );\n }\n uint256 numTokensTransfered = 0;\n for (uint256 i = 0; i < sizes.length; i++) {\n uint256 size = sizes[i];\n _transferQuad(from, to, size, xs[i], ys[i]);\n numTokensTransfered += size * size;\n }\n _numNFTPerAddress[from] -= numTokensTransfered;\n _numNFTPerAddress[to] += numTokensTransfered;\n\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n uint256[] memory ids = new uint256[](numTokensTransfered);\n uint256 counter = 0;\n for (uint256 j = 0; j < sizes.length; j++) {\n uint256 size = sizes[j];\n for (uint256 i = 0; i < size * size; i++) {\n ids[counter] = _idInPath(i, size, xs[j], ys[j]);\n counter++;\n }\n }\n require(\n _checkOnERC721BatchReceived(metaTx ? from : msg.sender, from, to, ids, data),\n \"erc721 batch transfer rejected by to\"\n );\n }\n }\n\n function _transferQuad(\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y\n ) internal {\n if (size == 1) {\n uint256 id1x1 = x + y * GRID_SIZE;\n address owner = _ownerOf(id1x1);\n require(owner != address(0), \"token does not exist\");\n require(owner == from, \"not owner in _transferQuad\");\n _owners[id1x1] = uint256(to);\n } else {\n _regroup(from, to, size, x, y);\n }\n for (uint256 i = 0; i < size * size; i++) {\n emit Transfer(from, to, _idInPath(i, size, x, y));\n }\n }\n\n function _checkAndClear(address from, uint256 id) internal returns (bool) {\n uint256 owner = _owners[id];\n if (owner != 0) {\n require(address(owner) == from, \"not owner\");\n _owners[id] = 0;\n return true;\n }\n return false;\n }\n\n function _regroup(\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y\n ) internal {\n require(x % size == 0 && y % size == 0, \"Invalid coordinates\");\n require(x <= GRID_SIZE - size && y <= GRID_SIZE - size, \"Out of bounds\");\n\n if (size == 3) {\n _regroup3x3(from, to, x, y, true);\n } else if (size == 6) {\n _regroup6x6(from, to, x, y, true);\n } else if (size == 12) {\n _regroup12x12(from, to, x, y, true);\n } else if (size == 24) {\n _regroup24x24(from, to, x, y, true);\n } else {\n require(false, \"Invalid size\");\n }\n }\n\n function _regroup3x3(\n address from,\n address to,\n uint256 x,\n uint256 y,\n bool set\n ) internal returns (bool) {\n uint256 id = x + y * GRID_SIZE;\n uint256 quadId = LAYER_3x3 + id;\n bool ownerOfAll = true;\n for (uint256 xi = x; xi < x + 3; xi++) {\n for (uint256 yi = y; yi < y + 3; yi++) {\n ownerOfAll = _checkAndClear(from, xi + yi * GRID_SIZE) && ownerOfAll;\n }\n }\n if (set) {\n if (!ownerOfAll) {\n require(_ownerOfQuad(3, x, y) == from, \"not owner of all sub quads nor parent quads\");\n }\n _owners[quadId] = uint256(to);\n return true;\n }\n return ownerOfAll;\n }\n\n function _ownerOfQuad(\n uint256 size,\n uint256 x,\n uint256 y\n ) internal returns (address) {\n uint256 layer;\n uint256 parentSize = size * 2;\n if (size == 3) {\n layer = LAYER_3x3;\n } else if (size == 6) {\n layer = LAYER_6x6;\n } else if (size == 12) {\n layer = LAYER_12x12;\n } else if (size == 24) {\n layer = LAYER_24x24;\n } else {\n require(false, \"Invalid size\");\n }\n address owner = address(_owners[layer + (x / size) * size + ((y / size) * size) * GRID_SIZE]);\n if (owner != address(0)) {\n return owner;\n } else if (size < 24) {\n return _ownerOfQuad(parentSize, x, y);\n }\n return address(0);\n }\n\n function _regroup6x6(\n address from,\n address to,\n uint256 x,\n uint256 y,\n bool set\n ) internal returns (bool) {\n uint256 id = x + y * GRID_SIZE;\n uint256 quadId = LAYER_6x6 + id;\n bool ownerOfAll = true;\n for (uint256 xi = x; xi < x + 6; xi += 3) {\n for (uint256 yi = y; yi < y + 6; yi += 3) {\n bool ownAllIndividual = _regroup3x3(from, to, xi, yi, false);\n uint256 id3x3 = LAYER_3x3 + xi + yi * GRID_SIZE;\n uint256 owner3x3 = _owners[id3x3];\n if (owner3x3 != 0) {\n if (!ownAllIndividual) {\n require(owner3x3 == uint256(from), \"not owner of 3x3 quad\");\n }\n _owners[id3x3] = 0;\n }\n ownerOfAll = (ownAllIndividual || owner3x3 != 0) && ownerOfAll;\n }\n }\n if (set) {\n if (!ownerOfAll) {\n require(_ownerOfQuad(6, x, y) == from, \"not owner of all sub quads nor parent quads\");\n }\n _owners[quadId] = uint256(to);\n return true;\n }\n return ownerOfAll;\n }\n\n function _regroup12x12(\n address from,\n address to,\n uint256 x,\n uint256 y,\n bool set\n ) internal returns (bool) {\n uint256 id = x + y * GRID_SIZE;\n uint256 quadId = LAYER_12x12 + id;\n bool ownerOfAll = true;\n for (uint256 xi = x; xi < x + 12; xi += 6) {\n for (uint256 yi = y; yi < y + 12; yi += 6) {\n bool ownAllIndividual = _regroup6x6(from, to, xi, yi, false);\n uint256 id6x6 = LAYER_6x6 + xi + yi * GRID_SIZE;\n uint256 owner6x6 = _owners[id6x6];\n if (owner6x6 != 0) {\n if (!ownAllIndividual) {\n require(owner6x6 == uint256(from), \"not owner of 6x6 quad\");\n }\n _owners[id6x6] = 0;\n }\n ownerOfAll = (ownAllIndividual || owner6x6 != 0) && ownerOfAll;\n }\n }\n if (set) {\n if (!ownerOfAll) {\n require(_ownerOfQuad(12, x, y) == from, \"not owner of all sub quads nor parent quads\");\n }\n _owners[quadId] = uint256(to);\n return true;\n }\n return ownerOfAll;\n }\n\n function _regroup24x24(\n address from,\n address to,\n uint256 x,\n uint256 y,\n bool set\n ) internal returns (bool) {\n uint256 id = x + y * GRID_SIZE;\n uint256 quadId = LAYER_24x24 + id;\n bool ownerOfAll = true;\n for (uint256 xi = x; xi < x + 24; xi += 12) {\n for (uint256 yi = y; yi < y + 24; yi += 12) {\n bool ownAllIndividual = _regroup12x12(from, to, xi, yi, false);\n uint256 id12x12 = LAYER_12x12 + xi + yi * GRID_SIZE;\n uint256 owner12x12 = _owners[id12x12];\n if (owner12x12 != 0) {\n if (!ownAllIndividual) {\n require(owner12x12 == uint256(from), \"not owner of 12x12 quad\");\n }\n _owners[id12x12] = 0;\n }\n ownerOfAll = (ownAllIndividual || owner12x12 != 0) && ownerOfAll;\n }\n }\n if (set) {\n if (!ownerOfAll) {\n require(_ownerOfQuad(24, x, y) == from, \"not owner of all sub quads not parent quad\");\n }\n _owners[quadId] = uint256(to);\n return true;\n }\n return ownerOfAll || _owners[quadId] == uint256(from);\n }\n\n function _ownerOf(uint256 id) internal view returns (address) {\n require(id & LAYER == 0, \"Invalid token id\");\n uint256 x = id % GRID_SIZE;\n uint256 y = id / GRID_SIZE;\n uint256 owner1x1 = _owners[id];\n\n if (owner1x1 != 0) {\n return address(owner1x1); // cast to zero\n } else {\n address owner3x3 = address(_owners[LAYER_3x3 + (x / 3) * 3 + ((y / 3) * 3) * GRID_SIZE]);\n if (owner3x3 != address(0)) {\n return owner3x3;\n } else {\n address owner6x6 = address(_owners[LAYER_6x6 + (x / 6) * 6 + ((y / 6) * 6) * GRID_SIZE]);\n if (owner6x6 != address(0)) {\n return owner6x6;\n } else {\n address owner12x12 = address(_owners[LAYER_12x12 + (x / 12) * 12 + ((y / 12) * 12) * GRID_SIZE]);\n if (owner12x12 != address(0)) {\n return owner12x12;\n } else {\n return address(_owners[LAYER_24x24 + (x / 24) * 24 + ((y / 24) * 24) * GRID_SIZE]);\n }\n }\n }\n }\n }\n\n function _ownerAndOperatorEnabledOf(uint256 id) internal view returns (address owner, bool operatorEnabled) {\n require(id & LAYER == 0, \"Invalid token id\");\n uint256 x = id % GRID_SIZE;\n uint256 y = id / GRID_SIZE;\n uint256 owner1x1 = _owners[id];\n\n if (owner1x1 != 0) {\n owner = address(owner1x1);\n operatorEnabled = (owner1x1 / 2**255) == 1;\n } else {\n address owner3x3 = address(_owners[LAYER_3x3 + (x / 3) * 3 + ((y / 3) * 3) * GRID_SIZE]);\n if (owner3x3 != address(0)) {\n owner = owner3x3;\n operatorEnabled = false;\n } else {\n address owner6x6 = address(_owners[LAYER_6x6 + (x / 6) * 6 + ((y / 6) * 6) * GRID_SIZE]);\n if (owner6x6 != address(0)) {\n owner = owner6x6;\n operatorEnabled = false;\n } else {\n address owner12x12 = address(_owners[LAYER_12x12 + (x / 12) * 12 + ((y / 12) * 12) * GRID_SIZE]);\n if (owner12x12 != address(0)) {\n owner = owner12x12;\n operatorEnabled = false;\n } else {\n owner = address(_owners[LAYER_24x24 + (x / 24) * 24 + ((y / 24) * 24) * GRID_SIZE]);\n operatorEnabled = false;\n }\n }\n }\n }\n }\n}\n" + }, + "src/solc_0.5/Land/erc721/LandBaseTokenV3.sol": { + "content": "// SPDX-License-Identifier: MIT\n/* solhint-disable func-order, code-complexity */\npragma solidity 0.5.9;\n\nimport {ERC721BaseTokenV2} from \"./ERC721BaseTokenV2.sol\";\n\n/**\n * @title LandBaseTokenV3\n * @author The Sandbox\n * @notice Implement LAND and quad functionalities on top of an ERC721 token\n * @dev This contract implements a quad tree structure to handle groups of ERC721 tokens at once\n */\ncontract LandBaseTokenV3 is ERC721BaseTokenV2 {\n // Our grid is 408 x 408 lands\n uint256 internal constant GRID_SIZE = 408;\n\n uint256 internal constant LAYER = 0xFF00000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_1x1 = 0x0000000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_3x3 = 0x0100000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_6x6 = 0x0200000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_12x12 = 0x0300000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_24x24 = 0x0400000000000000000000000000000000000000000000000000000000000000;\n\n mapping(address => bool) internal _minters;\n event Minter(address indexed superOperator, bool enabled);\n\n struct Land {\n uint256 x;\n uint256 y;\n uint256 size;\n }\n\n /**\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\n * @param to The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external {\n require(to != address(0), \"to is zero address\");\n require(size != 0, \"size cannot be zero\");\n require(isMinter(msg.sender), \"Only a minter can mint\");\n\n _isValidQuad(size, x, y);\n\n (uint256 layer, , ) = _getQuadLayer(size);\n uint256 quadId = _getQuadId(layer, x, y);\n\n _checkOwner(size, x, y, 24);\n for (uint256 i = 0; i < size * size; i++) {\n uint256 _id = _idInPath(i, size, x, y);\n require(_owners[_id] == 0, \"Already minted\");\n emit Transfer(address(0), to, _id);\n }\n\n _owners[quadId] = uint256(to);\n _numNFTPerAddress[to] += size * size;\n\n _checkBatchReceiverAcceptQuad(msg.sender, address(0), to, size, x, y, data);\n }\n\n /**\n * @notice Checks if a parent quad has child quads already minted.\n * Then mints the rest child quads and transfers the parent quad.\n * Should only be called by the tunnel.\n * @param to The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintAndTransferQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external {\n require(to != address(0), \"to is zero address\");\n require(isMinter(msg.sender), \"Only a minter can mint\");\n\n if (exists(size, x, y) == true) {\n _transferQuad(msg.sender, to, size, x, y);\n _numNFTPerAddress[msg.sender] -= size * size;\n _numNFTPerAddress[to] += size * size;\n _checkBatchReceiverAcceptQuad(msg.sender, msg.sender, to, size, x, y, data);\n } else {\n _mintAndTransferQuad(to, size, x, y, data);\n }\n }\n\n /// @notice transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\n /// @param from current owner of the quad\n /// @param to destination\n /// @param size size of the quad\n /// @param x The top left x coordinate of the quad\n /// @param y The top left y coordinate of the quad\n /// @param data additional data\n function transferQuad(\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external {\n require(from != address(0), \"from is zero address\");\n require(to != address(0), \"can't send to zero address\");\n bool metaTx = msg.sender != from && _metaTransactionContracts[msg.sender];\n if (msg.sender != from && !metaTx) {\n require(\n _operatorsForAll[from][msg.sender] || _superOperators[msg.sender],\n \"not authorized to transferQuad\"\n );\n }\n _transferQuad(from, to, size, x, y);\n _numNFTPerAddress[from] -= size * size;\n _numNFTPerAddress[to] += size * size;\n\n _checkBatchReceiverAcceptQuad(metaTx ? from : msg.sender, from, to, size, x, y, data);\n }\n\n /// @notice transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\n /// @param from current owner of the quad\n /// @param to destination\n /// @param sizes list of sizes for each quad\n /// @param xs list of top left x coordinates for each quad\n /// @param ys list of top left y coordinates for each quad\n /// @param data additional data\n function batchTransferQuad(\n address from,\n address to,\n uint256[] calldata sizes,\n uint256[] calldata xs,\n uint256[] calldata ys,\n bytes calldata data\n ) external {\n require(from != address(0), \"from is zero address\");\n require(to != address(0), \"can't send to zero address\");\n require(sizes.length == xs.length, \"LandBaseTokenV3: sizes's and x's length are different\");\n require(xs.length == ys.length, \"LandBaseTokenV3: x's and y's length are different\");\n bool metaTx = msg.sender != from && _metaTransactionContracts[msg.sender];\n if (msg.sender != from && !metaTx) {\n require(\n _operatorsForAll[from][msg.sender] || _superOperators[msg.sender],\n \"not authorized to transferMultiQuads\"\n );\n }\n uint256 numTokensTransfered = 0;\n for (uint256 i = 0; i < sizes.length; i++) {\n uint256 size = sizes[i];\n _transferQuad(from, to, size, xs[i], ys[i]);\n numTokensTransfered += size * size;\n }\n _numNFTPerAddress[from] -= numTokensTransfered;\n _numNFTPerAddress[to] += numTokensTransfered;\n\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n uint256[] memory ids = new uint256[](numTokensTransfered);\n uint256 counter = 0;\n for (uint256 j = 0; j < sizes.length; j++) {\n uint256 size = sizes[j];\n for (uint256 i = 0; i < size * size; i++) {\n ids[counter] = _idInPath(i, size, xs[j], ys[j]);\n counter++;\n }\n }\n require(\n _checkOnERC721BatchReceived(metaTx ? from : msg.sender, from, to, ids, data),\n \"erc721 batch transfer rejected by to\"\n );\n }\n }\n\n /// @notice Enable or disable the ability of `minter` to mint tokens\n /// @param minter address that will be given/removed minter right.\n /// @param enabled set whether the minter is enabled or disabled.\n function setMinter(address minter, bool enabled) external onlyAdmin {\n require(minter != address(0), \"address 0 is not allowed as minter\");\n require(enabled != _minters[minter], \"the status should be different than the current one\");\n _minters[minter] = enabled;\n emit Minter(minter, enabled);\n }\n\n /// @notice total width of the map\n /// @return width\n function width() external pure returns (uint256) {\n return GRID_SIZE;\n }\n\n /// @notice total height of the map\n /// @return height\n function height() external pure returns (uint256) {\n return GRID_SIZE;\n }\n\n /// @notice x coordinate of Land token\n /// @param id tokenId\n /// @return the x coordinates\n function getX(uint256 id) external pure returns (uint256) {\n return _getX(id);\n }\n\n /// @notice y coordinate of Land token\n /// @param id tokenId\n /// @return the y coordinates\n function getY(uint256 id) external pure returns (uint256) {\n return _getY(id);\n }\n\n /// @notice check whether address `who` is given minter rights.\n /// @param who The address to query.\n /// @return whether the address has minter rights.\n function isMinter(address who) public view returns (bool) {\n return _minters[who];\n }\n\n /// @notice checks if Land has been minted or not\n /// @param size size of the quad\n /// @param x x coordinate of the quad\n /// @param y y coordinate of the quad\n /// @return bool for if Land has been minted or not\n function exists(\n uint256 size,\n uint256 x,\n uint256 y\n ) public view returns (bool) {\n _isValidQuad(size, x, y);\n return _ownerOfQuad(size, x, y) != address(0);\n }\n\n function _isValidQuad(uint256 size, uint256 x, uint256 y) internal pure {\n require(size == 1 || size == 3 || size == 6 || size == 12 || size == 24, \"Invalid size\");\n require(x % size == 0, \"Invalid x coordinate\");\n require(y % size == 0, \"Invalid y coordinate\");\n require(x <= GRID_SIZE - size, \"x out of bounds\");\n require(y <= GRID_SIZE - size, \"y out of bounds\");\n }\n\n /**\n * @dev checks if the child quads in the parent quad (size, x, y) are owned by msg.sender.\n * It recursively checks child quad of every size(exculding Lands of 1x1 size) are minted or not.\n * Quad which are minted are pushed into quadMinted to also check if every Land of size 1x1 in the parent quad is minted or not.\n * While checking if the every child Quad and Land is minted it also checks and clear the owner for quads which are minted.\n * Finally it checks if the new owner if is a contract can handle ERC721 tokens or not and transfers the parent quad to new owner.\n * @param to The address to which the ownership of the quad will be transferred\n * @param size The size of the quad being minted and transfered\n * @param x The x-coordinate of the top-left corner of the quad being minted.\n * @param y The y-coordinate of the top-left corner of the quad being minted.\n * @param data extra data to pass to the transfer\n */\n function _mintAndTransferQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) internal {\n (uint256 layer, , ) = _getQuadLayer(size);\n uint256 quadId = _getQuadId(layer, x, y);\n\n // Length of array is equal to number of 3x3 child quad a 24x24 quad can have. Would be used to push the minted Quads.\n Land[] memory quadMinted = new Land[](64);\n // index of last minted quad pushed on quadMinted Array\n uint256 index;\n uint256 numLandMinted;\n\n // if size of the Quad in land struct to be transfered is greater than 3 we check recursivly if the child quads are minted or not.\n if (size > 3) {\n (index, numLandMinted) = _checkAndClearOwner(\n Land({x: x, y: y, size: size}),\n quadMinted,\n numLandMinted,\n index,\n size / 2\n );\n }\n\n // Lopping around the Quad in land struct to generate ids of 1x1 land token and checking if they are owned by msg.sender\n {\n for (uint256 i = 0; i < size * size; i++) {\n uint256 _id = _idInPath(i, size, x, y);\n // checking land with token id \"_id\" is in the quadMinted array.\n bool isAlreadyMinted = _isQuadMinted(quadMinted, Land({x: _getX(_id), y: _getY(_id), size: 1}), index);\n if (isAlreadyMinted) {\n // if land is in the quadMinted array there just emitting transfer event.\n emit Transfer(msg.sender, to, _id);\n } else {\n if (address(uint160(_owners[_id])) == msg.sender) {\n if (_operators[_id] != address(0)) _operators[_id] = address(0);\n numLandMinted += 1;\n emit Transfer(msg.sender, to, _id);\n } else {\n // else is checked if owned by the msg.sender or not. If it is not owned by msg.sender it should not have an owner.\n require(_owners[_id] == 0, \"Already minted\");\n\n emit Transfer(address(0), to, _id);\n }\n }\n }\n }\n\n // checking if the new owner \"to\" is a contract. If yes, checking if it could handle ERC721 tokens.\n _checkBatchReceiverAcceptQuadAndClearOwner(quadMinted, index, numLandMinted, to, size, x, y, data);\n\n _owners[quadId] = uint256(to);\n _numNFTPerAddress[to] += size * size;\n _numNFTPerAddress[msg.sender] -= numLandMinted;\n }\n\n /// @param operator sender of the tx\n /// @param from owner of the token\n /// @param to recipient\n /// @param size The size of the new quad\n /// @param x The top left x coordinate of the new quad\n /// @param y The top left y coordinate of the new quad\n /// @param data extra data\n function _checkBatchReceiverAcceptQuad(\n address operator,\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) internal {\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n uint256[] memory ids = new uint256[](size * size);\n for (uint256 i = 0; i < size * size; i++) {\n ids[i] = _idInPath(i, size, x, y);\n }\n require(_checkOnERC721BatchReceived(operator, from, to, ids, data), \"erc721 batch transfer rejected by to\");\n }\n }\n\n /// @dev checks if the receiver of the quad(size, x, y) is a contact. If yes can it handle ERC721 tokens.\n /// It also clears owner of 1x1 land's owned by msg.sender.\n /// @param quadMinted array of lands\n /// @param index array size\n /// @param numLandMinted number of lands transferred\n /// @param to recipient\n /// @param size The size of the new quad\n /// @param x The top left x coordinate of the new quad\n /// @param y The top left y coordinate of the new quad\n /// @param data extra data\n function _checkBatchReceiverAcceptQuadAndClearOwner(\n Land[] memory quadMinted,\n uint256 index,\n uint256 numLandMinted,\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) internal {\n // checks if to is a contract and supports ERC721_MANDATORY_RECEIVER interfaces.\n // if it doesn't it just clears the owner of 1x1 lands in quad(size, x, y)\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n // array to push minted 1x1 land\n uint256[] memory idsToTransfer = new uint256[](numLandMinted);\n // index of last land pushed in idsToTransfer array\n uint256 transferIndex;\n // array to push ids to be minted\n uint256[] memory idsToMint = new uint256[]((size * size) - numLandMinted);\n // index of last land pushed in idsToMint array\n uint256 mintIndex;\n // iterating over every 1x1 land in the quad to be pushed in the above arrays\n for (uint256 i = 0; i < size * size; i++) {\n uint256 id = _idInPath(i, size, x, y);\n\n if (_isQuadMinted(quadMinted, Land({x: _getX(id), y: _getY(id), size: 1}), index)) {\n // if land is in the quads already minted it just pushed in to the idsToTransfer array\n idsToTransfer[transferIndex] = id;\n transferIndex++;\n } else if (address(uint160(_owners[id])) == msg.sender) {\n _owners[id] = 0;\n idsToTransfer[transferIndex] = id;\n transferIndex++;\n } else {\n // else it is not owned by any one and and pushed in teh idsToMint array\n idsToMint[mintIndex] = id;\n mintIndex++;\n }\n }\n\n // checking if \"to\" contact can handle ERC721 tokens\n require(\n _checkOnERC721BatchReceived(msg.sender, address(0), to, idsToMint, data),\n \"erc721 batch transfer rejected by to\"\n );\n require(\n _checkOnERC721BatchReceived(msg.sender, msg.sender, to, idsToTransfer, data),\n \"erc721 batch transfer rejected by to\"\n );\n } else {\n for (uint256 i = 0; i < size * size; i++) {\n uint256 id = _idInPath(i, size, x, y);\n if (address(uint160(_owners[id])) == msg.sender) _owners[id] = 0;\n }\n }\n }\n\n /// @param from current owner of the quad\n /// @param to destination\n /// @param size size of the quad\n /// @param x The top left x coordinate of the quad\n /// @param y The top left y coordinate of the quad\n function _transferQuad(\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y\n ) internal {\n _isValidQuad(size, x, y);\n if (size == 1) {\n uint256 id1x1 = _getQuadId(LAYER_1x1, x, y);\n address owner = _ownerOf(id1x1);\n require(owner != address(0), \"token does not exist\");\n require(owner == from, \"not owner in _transferQuad\");\n _owners[id1x1] = uint256(to);\n } else {\n _regroupQuad(from, to, Land({x: x, y: y, size: size}), true, size / 2);\n }\n for (uint256 i = 0; i < size * size; i++) {\n emit Transfer(from, to, _idInPath(i, size, x, y));\n }\n }\n\n /// @dev checks if the quad is already minted compared to another quad size\n /// @param size size of the quad\n /// @param x The top left x coordinate of the quad\n /// @param y The top left y coordinate of the quad\n /// @param quadCompareSize size to compare with\n function _checkOwner(\n uint256 size,\n uint256 x,\n uint256 y,\n uint256 quadCompareSize\n ) internal view {\n (uint256 layer, , ) = _getQuadLayer(quadCompareSize);\n\n if (size <= quadCompareSize) {\n // when the size of the quad is smaller than the quadCompareSize(size to be compared with),\n // then it is checked if the bigger quad which encapsulates the quad to be minted\n // of with size equals the quadCompareSize has been minted or not\n require(\n _owners[\n _getQuadId(layer, (x / quadCompareSize) * quadCompareSize, (y / quadCompareSize) * quadCompareSize)\n ] == 0,\n \"Already minted\"\n );\n } else {\n // when the size is bigger than the quadCompare size the owner of all the smaller quads with size\n // quadCompare size in the quad to be minted are checked if they are minted or not\n uint256 toX = x + size;\n uint256 toY = y + size;\n for (uint256 xi = x; xi < toX; xi += quadCompareSize) {\n for (uint256 yi = y; yi < toY; yi += quadCompareSize) {\n require(_owners[_getQuadId(layer, xi, yi)] == 0, \"Already minted\");\n }\n }\n }\n\n quadCompareSize = quadCompareSize / 2;\n if (quadCompareSize >= 3) _checkOwner(size, x, y, quadCompareSize);\n }\n\n /// @dev checks the owner of land of token id 'id' to be 'from' and clears it\n /// @param from owner of the token\n /// @param tokenId token id\n /// @return if the address is the owner of the token\n function _checkAndClearLandOwner(address from, uint256 tokenId) internal returns (bool) {\n uint256 currentOwner = _owners[tokenId];\n if (currentOwner != 0) {\n require(address(currentOwner) == from, \"not owner\");\n _owners[tokenId] = 0;\n return true;\n }\n return false;\n }\n\n /** @dev recursivly checks if the child quads are minted in land and push them to the quadMinted array.\n * if a child quad is minted in land such quads child quads will be skipped such that there is no\n * overlapping in quads which are minted. it clears the minted child quads owners.\n * @param land the stuct which has the size x and y co-ordinate of Quad to be checked\n * @param quadMinted array in which the minted child quad would be pushed\n * @param numLandMinted number of lands transferred\n * @param index index of last element of quadMinted array\n * @param quadCompareSize the size of the child quads to be checked.\n * @return the index of last quad pushed in quadMinted array and the total land already minted\n * @return the number of lands minted\n */\n function _checkAndClearOwner(\n Land memory land,\n Land[] memory quadMinted,\n uint256 numLandMinted,\n uint256 index,\n uint256 quadCompareSize\n ) internal returns (uint256, uint256) {\n (uint256 layer, , ) = _getQuadLayer(quadCompareSize);\n uint256 toX = land.x + land.size;\n uint256 toY = land.y + land.size;\n\n //Lopping around the Quad in land struct to check if the child quad are minted or not\n for (uint256 xi = land.x; xi < toX; xi += quadCompareSize) {\n for (uint256 yi = land.y; yi < toY; yi += quadCompareSize) {\n //checking if the child Quad is minted or not. i.e Checks if the quad is in the quadMinted array.\n bool isQuadChecked = _isQuadMinted(quadMinted, Land({x: xi, y: yi, size: quadCompareSize}), index);\n // if child quad is not already in the quadMinted array.\n if (!isQuadChecked) {\n uint256 id = _getQuadId(layer, xi, yi);\n address owner = address(uint160(_owners[id]));\n // owner of the child quad is checked to be owned by msg.sender else should not be owned by anyone.\n if (owner == msg.sender) {\n // if child quad is minted it would be pushed in quadMinted array.\n quadMinted[index] = Land({x: xi, y: yi, size: quadCompareSize});\n // index of quadMinted is increased\n index++;\n // total land minted is increase by the number if land of 1x1 in child quad\n numLandMinted += quadCompareSize * quadCompareSize;\n //owner is cleared\n _owners[id] = 0;\n } else {\n require(owner == address(0), \"Already minted\");\n }\n }\n }\n }\n\n // size of the child quad is set to be the next smaller child quad size (12 => 6 => 3)\n quadCompareSize = quadCompareSize / 2;\n // if child quad size is greater than 3 _checkAndClearOwner is checked for new child quads in the quad in land struct.\n if (quadCompareSize >= 3)\n (index, numLandMinted) = _checkAndClearOwner(land, quadMinted, numLandMinted, index, quadCompareSize);\n return (index, numLandMinted);\n }\n\n /// @dev checks if the Land's child quads are owned by the from address and clears all the previous owners\n /// if all the child quads are not owned by the \"from\" address then the owner of parent quad to the land\n /// is checked if owned by the \"from\" address. If from is the owner then land owner is set to \"to\" address\n /// @param from address of the previous owner\n /// @param to address of the new owner\n /// @param land the quad to be regrouped and transferred\n /// @param set for setting the new owner\n /// @param childQuadSize size of the child quad to be checked for owner in the regrouping\n function _regroupQuad(\n address from,\n address to,\n Land memory land,\n bool set,\n uint256 childQuadSize\n ) internal returns (bool) {\n (uint256 layer, , uint256 childLayer) = _getQuadLayer(land.size);\n uint256 quadId = _getQuadId(layer, land.x, land.y);\n bool ownerOfAll = true;\n\n {\n // double for loop iterates and checks owner of all the smaller quads in land\n for (uint256 xi = land.x; xi < land.x + land.size; xi += childQuadSize) {\n for (uint256 yi = land.y; yi < land.y + land.size; yi += childQuadSize) {\n uint256 ownerChild;\n bool ownAllIndividual;\n if (childQuadSize < 3) {\n // case when the smaller quad is 1x1,\n ownAllIndividual = _checkAndClearLandOwner(from, _getQuadId(LAYER_1x1, xi, yi)) && ownerOfAll;\n } else {\n // recursively calling the _regroupQuad function to check the owner of child quads.\n ownAllIndividual = _regroupQuad(\n from,\n to,\n Land({x: xi, y: yi, size: childQuadSize}),\n false,\n childQuadSize / 2\n );\n uint256 idChild = _getQuadId(childLayer, xi, yi);\n ownerChild = _owners[idChild];\n if (ownerChild != 0) {\n if (!ownAllIndividual) {\n // checking the owner of child quad\n require(ownerChild == uint256(from), \"not owner of child Quad\");\n }\n // clearing owner of child quad\n _owners[idChild] = 0;\n }\n }\n // ownerOfAll should be true if \"from\" is owner of all the child quads iterated over\n ownerOfAll = (ownAllIndividual || ownerChild != 0) && ownerOfAll;\n }\n }\n }\n\n // if set is true it check if the \"from\" is owner of all else checks for the owner of parent quad is\n // owned by \"from\" and sets the owner for the id of land to \"to\" address.\n if (set) {\n if (!ownerOfAll) {\n require(_ownerOfQuad(land.size, land.x, land.y) == from, \"not owner of all sub quads nor parent quads\");\n }\n _owners[quadId] = uint256(to);\n return true;\n }\n\n return ownerOfAll;\n }\n\n /// @notice Goes through every token id of a quad id\n /// @param i ith token of the quad\n /// @param size size of the quad\n /// @param x The top left x coordinate of the quad\n /// @param y The top left y coordinate of the quad\n /// @return the \"ith\" token id of the quad\n function _idInPath(\n uint256 i,\n uint256 size,\n uint256 x,\n uint256 y\n ) internal pure returns (uint256) {\n uint256 row = i / size;\n if (row % 2 == 0) {\n // allow ids to follow a path in a quad\n return _getQuadId(LAYER_1x1, (x + (i % size)), (y + row));\n } else {\n return _getQuadId(LAYER_1x1, (x + size) - (1 + (i % size)), (y + row));\n }\n }\n\n /// @param mintedLand array of lands\n /// @param quad quad to check\n /// @param index size of the array\n /// @return is the quad minted\n function _isQuadMinted(\n Land[] memory mintedLand,\n Land memory quad,\n uint256 index\n ) internal pure returns (bool) {\n for (uint256 i = 0; i < index; i++) {\n Land memory land = mintedLand[i];\n if (\n land.size > quad.size &&\n quad.x >= land.x &&\n quad.x < land.x + land.size &&\n quad.y >= land.y &&\n quad.y < land.y + land.size\n ) {\n return true;\n }\n }\n return false;\n }\n\n /// @param id token id\n /// @return the x coordinate\n function _getX(uint256 id) internal pure returns (uint256) {\n return (id & ~LAYER) % GRID_SIZE;\n }\n\n /// @param id token id\n /// @return the y coordinate\n function _getY(uint256 id) internal pure returns (uint256) {\n return (id & ~LAYER) / GRID_SIZE;\n }\n\n /// @param size of the quad\n /// @return layer the layer associated to that quad size\n /// @return parentSize size of the parent quad\n /// @return childLayer layer of the child quad size\n function _getQuadLayer(uint256 size)\n internal\n pure\n returns (\n uint256 layer,\n uint256 parentSize,\n uint256 childLayer\n )\n {\n if (size == 1) {\n layer = LAYER_1x1;\n parentSize = 3;\n } else if (size == 3) {\n layer = LAYER_3x3;\n parentSize = 6;\n } else if (size == 6) {\n layer = LAYER_6x6;\n parentSize = 12;\n childLayer = LAYER_3x3;\n } else if (size == 12) {\n layer = LAYER_12x12;\n parentSize = 24;\n childLayer = LAYER_6x6;\n } else if (size == 24) {\n layer = LAYER_24x24;\n childLayer = LAYER_12x12;\n } else {\n require(false, \"Invalid size\");\n }\n }\n\n /// @param layer of the quad size\n /// @param x coordinate of the quad\n /// @param y coordinate of the quad\n /// @return the quad id\n function _getQuadId(\n uint256 layer,\n uint256 x,\n uint256 y\n ) internal pure returns (uint256) {\n return layer + x + y * GRID_SIZE;\n }\n\n /// @param size of the quad\n /// @param x coordinate of the quad\n /// @param y coordinate of the quad\n /// @return address of the owner of the quad\n function _ownerOfQuad(\n uint256 size,\n uint256 x,\n uint256 y\n ) internal view returns (address) {\n (uint256 layer, uint256 parentSize, ) = _getQuadLayer(size);\n address owner = address(_owners[_getQuadId(layer, (x / size) * size, (y / size) * size)]);\n if (owner != address(0)) {\n return owner;\n } else if (size < 24) {\n return _ownerOfQuad(parentSize, x, y);\n }\n return address(0);\n }\n\n /// @param id quad id\n /// @return size of the quad\n /// @return x coordinate\n /// @return y coordinate\n function _getQuadById(uint256 id)\n internal\n pure\n returns (\n uint256 size,\n uint256 x,\n uint256 y\n )\n {\n x = _getX(id);\n y = _getY(id);\n uint256 layer = id & LAYER;\n if (layer == LAYER_1x1) {\n size = 1;\n } else if (layer == LAYER_3x3) {\n size = 3;\n } else if (layer == LAYER_6x6) {\n size = 6;\n } else if (layer == LAYER_12x12) {\n size = 12;\n } else if (layer == LAYER_24x24) {\n size = 24;\n } else {\n require(false, \"Invalid token id\");\n }\n }\n\n /// @param id quad id\n /// @return address of the owner\n function _ownerOf(uint256 id) internal view returns (address) {\n require(id & LAYER == 0, \"Invalid token id\");\n (uint256 size, uint256 x, uint256 y) = _getQuadById(id);\n require(x % size == 0, \"x coordinate: Invalid token id\");\n require(y % size == 0, \"y coordinate: Invalid token id\");\n return _ownerOfQuad(size, x, y);\n }\n\n /// @param id token id\n /// @return owner owner of the token\n /// @return operatorEnabled is operator enabled\n function _ownerAndOperatorEnabledOf(uint256 id) internal view returns (address owner, bool operatorEnabled) {\n require(id & LAYER == 0, \"Invalid token id\");\n uint256 x = _getX(id);\n uint256 y = _getY(id);\n uint256 owner1x1 = _owners[id];\n\n if (owner1x1 != 0) {\n owner = address(owner1x1);\n operatorEnabled = (owner1x1 / 2**255) == 1;\n } else {\n owner = _ownerOfQuad(3, (x * 3) / 3, (y * 3) / 3);\n operatorEnabled = false;\n }\n }\n}\n" + }, + "src/solc_0.5/LandSale/LandSale.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../Land.sol\";\nimport \"../contracts_common/Interfaces/ERC20.sol\";\nimport \"../contracts_common/BaseWithStorage/MetaTransactionReceiver.sol\";\n\n\n/**\n * @title Land Sale contract\n * @notice This contract mananges the sale of our lands\n */\ncontract LandSale is MetaTransactionReceiver {\n\n uint256 internal constant GRID_SIZE = 408; // 408 is the size of the Land\n\n Land internal _land;\n ERC20 internal _sand;\n address payable internal _wallet;\n uint256 internal _expiryTime;\n bytes32 internal _merkleRoot;\n\n event LandQuadPurchased(\n address indexed buyer,\n address indexed to,\n uint256 indexed topCornerId,\n uint256 size,\n uint256 price\n );\n\n constructor(\n address landAddress,\n address sandContractAddress,\n address initialMetaTx,\n address admin,\n address payable initialWalletAddress,\n bytes32 merkleRoot,\n uint256 expiryTime\n ) public {\n _land = Land(landAddress);\n _sand = ERC20(sandContractAddress);\n _setMetaTransactionProcessor(initialMetaTx, true);\n _admin = admin;\n _wallet = initialWalletAddress;\n _merkleRoot = merkleRoot;\n _expiryTime = expiryTime;\n }\n\n /// @notice set the wallet receiving the proceeds\n /// @param newWallet address of the new receiving wallet\n function setReceivingWallet(address payable newWallet) external{\n require(newWallet != address(0), \"receiving wallet cannot be zero address\");\n require(msg.sender == _admin, \"only admin can change the receiving wallet\");\n _wallet = newWallet;\n }\n\n /**\n * @notice buy Land using the merkle proof associated with it\n * @param buyer address that perform the payment\n * @param to address that will own the purchased Land\n * @param reserved the reserved address (if any)\n * @param x x coordinate of the Land\n * @param y y coordinate of the Land\n * @param size size of the pack of Land to purchase\n * @param price amount of Sand to purchase that Land\n * @param proof merkleProof for that particular Land\n * @return The address of the operator\n */\n function buyLandWithSand(\n address buyer,\n address to,\n address reserved,\n uint256 x,\n uint256 y,\n uint256 size,\n uint256 price,\n bytes32 salt,\n bytes32[] calldata proof\n ) external {\n /* solhint-disable-next-line not-rely-on-time */\n require(block.timestamp < _expiryTime, \"sale is over\");\n require(buyer == msg.sender || _metaTransactionContracts[msg.sender], \"not authorized\");\n require(reserved == address(0) || reserved == buyer, \"cannot buy reserved Land\");\n bytes32 leaf = _generateLandHash(x, y, size, price, reserved, salt);\n\n require(\n _verify(proof, leaf),\n \"Invalid land provided\"\n );\n\n require(\n _sand.transferFrom(\n buyer,\n _wallet,\n price\n ),\n \"sand transfer failed\"\n );\n\n _land.mintQuad(to, size, x, y, \"\");\n emit LandQuadPurchased(buyer, to, x + (y * GRID_SIZE), size, price);\n }\n\n /**\n * @notice Gets the expiry time for the current sale\n * @return The expiry time, as a unix epoch\n */\n function getExpiryTime() external view returns(uint256) {\n return _expiryTime;\n }\n\n /**\n * @notice Gets the Merkle root associated with the current sale\n * @return The Merkle root, as a bytes32 hash\n */\n function merkleRoot() external view returns(bytes32) {\n return _merkleRoot;\n }\n\n function _generateLandHash(\n uint256 x,\n uint256 y,\n uint256 size,\n uint256 price,\n address reserved,\n bytes32 salt\n ) internal pure returns (\n bytes32\n ) {\n return keccak256(\n abi.encodePacked(\n x,\n y,\n size,\n price,\n reserved,\n salt\n )\n );\n }\n\n function _verify(bytes32[] memory proof, bytes32 leaf) internal view returns (bool) {\n bytes32 computedHash = leaf;\n\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n\n if (computedHash < proofElement) {\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\n } else {\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\n }\n }\n\n return computedHash == _merkleRoot;\n }\n}\n" + }, + "src/solc_0.5/LandSale/LandSaleWithETHAndDAI.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../contracts_common/Libraries/SafeMathWithRequire.sol\";\nimport \"../Land.sol\";\nimport \"../contracts_common/Interfaces/ERC20.sol\";\nimport \"../contracts_common/BaseWithStorage/MetaTransactionReceiver.sol\";\nimport \"../contracts_common/Interfaces/Medianizer.sol\";\n\n/**\n * @title Land Sale contract that supports also DAI and ETH as payment\n * @notice This contract mananges the sale of our lands\n */\ncontract LandSaleWithETHAndDAI is MetaTransactionReceiver {\n using SafeMathWithRequire for uint256;\n\n uint256 internal constant GRID_SIZE = 408; // 408 is the size of the Land\n uint256 internal constant daiPrice = 14400000000000000;\n\n Land internal _land;\n ERC20 internal _sand;\n Medianizer private _medianizer;\n ERC20 private _dai;\n\n address payable internal _wallet;\n uint256 internal _expiryTime;\n bytes32 internal _merkleRoot;\n\n bool _sandEnabled = false;\n bool _etherEnabled = true;\n bool _daiEnabled = false;\n\n event LandQuadPurchased(\n address indexed buyer,\n address indexed to,\n uint256 indexed topCornerId,\n uint256 size,\n uint256 price,\n address token,\n uint256 amountPaid\n );\n\n constructor(\n address landAddress,\n address sandContractAddress,\n address initialMetaTx,\n address admin,\n address payable initialWalletAddress,\n bytes32 merkleRoot,\n uint256 expiryTime,\n address medianizerContractAddress,\n address daiTokenContractAddress\n ) public {\n _land = Land(landAddress);\n _sand = ERC20(sandContractAddress);\n _setMetaTransactionProcessor(initialMetaTx, true);\n _admin = admin;\n _wallet = initialWalletAddress;\n _merkleRoot = merkleRoot;\n _expiryTime = expiryTime;\n _medianizer = Medianizer(medianizerContractAddress);\n _dai = ERC20(daiTokenContractAddress);\n }\n\n /// @notice set the wallet receiving the proceeds\n /// @param newWallet address of the new receiving wallet\n function setReceivingWallet(address payable newWallet) external{\n require(newWallet != address(0), \"receiving wallet cannot be zero address\");\n require(msg.sender == _admin, \"only admin can change the receiving wallet\");\n _wallet = newWallet;\n }\n\n /// @notice enable/disable DAI payment for Lands\n /// @param enabled whether to enable or disable\n function setDAIEnabled(bool enabled) external {\n require(msg.sender == _admin, \"only admin can enable/disable DAI\");\n _daiEnabled = enabled;\n }\n\n /// @notice return whether DAI payments are enabled\n /// @return whether DAI payments are enabled\n function isDAIEnabled() external view returns (bool) {\n return _daiEnabled;\n }\n\n /// @notice enable/disable ETH payment for Lands\n /// @param enabled whether to enable or disable\n function setETHEnabled(bool enabled) external {\n require(msg.sender == _admin, \"only admin can enable/disable ETH\");\n _etherEnabled = enabled;\n }\n\n /// @notice return whether ETH payments are enabled\n /// @return whether ETH payments are enabled\n function isETHEnabled() external view returns (bool) {\n return _etherEnabled;\n }\n\n /// @notice enable/disable the specific SAND payment for Lands\n /// @param enabled whether to enable or disable\n function setSANDEnabled(bool enabled) external {\n require(msg.sender == _admin, \"only admin can enable/disable SAND\");\n _sandEnabled = enabled;\n }\n\n /// @notice return whether the specific SAND payments are enabled\n /// @return whether the specific SAND payments are enabled\n function isSANDEnabled() external view returns (bool) {\n return _sandEnabled;\n }\n\n function _checkValidity(\n address buyer,\n address reserved,\n uint256 x,\n uint256 y,\n uint256 size,\n uint256 price,\n bytes32 salt,\n bytes32[] memory proof\n ) internal view {\n /* solium-disable-next-line security/no-block-members */\n require(block.timestamp < _expiryTime, \"sale is over\");\n require(buyer == msg.sender || _metaTransactionContracts[msg.sender], \"not authorized\");\n require(reserved == address(0) || reserved == buyer, \"cannot buy reserved Land\");\n bytes32 leaf = _generateLandHash(x, y, size, price, reserved, salt);\n\n require(\n _verify(proof, leaf),\n \"Invalid land provided\"\n );\n }\n\n function _mint(address buyer, address to, uint256 x, uint256 y, uint256 size, uint256 price, address token, uint256 tokenAmount) internal {\n _land.mintQuad(to, size, x, y, \"\");\n emit LandQuadPurchased(buyer, to, x + (y * GRID_SIZE), size, price, token, tokenAmount);\n }\n\n /**\n * @notice buy Land with SAND using the merkle proof associated with it\n * @param buyer address that perform the payment\n * @param to address that will own the purchased Land\n * @param reserved the reserved address (if any)\n * @param x x coordinate of the Land\n * @param y y coordinate of the Land\n * @param size size of the pack of Land to purchase\n * @param priceInSand price in SAND to purchase that Land\n * @param proof merkleProof for that particular Land\n * @return The address of the operator\n */\n function buyLandWithSand(\n address buyer,\n address to,\n address reserved,\n uint256 x,\n uint256 y,\n uint256 size,\n uint256 priceInSand,\n bytes32 salt,\n bytes32[] calldata proof\n ) external {\n require(_sandEnabled, \"sand payments not enabled\");\n _checkValidity(buyer, reserved, x, y, size, priceInSand, salt, proof);\n require(\n _sand.transferFrom(\n buyer,\n _wallet,\n priceInSand\n ),\n \"sand token transfer failed\"\n );\n _mint(buyer, to, x, y, size, priceInSand, address(_sand), priceInSand);\n }\n\n /**\n * @notice buy Land with ETH using the merkle proof associated with it\n * @param buyer address that perform the payment\n * @param to address that will own the purchased Land\n * @param reserved the reserved address (if any)\n * @param x x coordinate of the Land\n * @param y y coordinate of the Land\n * @param size size of the pack of Land to purchase\n * @param priceInSand price in SAND to purchase that Land\n * @param proof merkleProof for that particular Land\n * @return The address of the operator\n */\n function buyLandWithETH(\n address buyer,\n address to,\n address reserved,\n uint256 x,\n uint256 y,\n uint256 size,\n uint256 priceInSand,\n bytes32 salt,\n bytes32[] calldata proof\n ) external payable {\n require(_etherEnabled, \"ether payments not enabled\");\n _checkValidity(buyer, reserved, x, y, size, priceInSand, salt, proof);\n\n uint256 ETHRequired = getEtherAmountWithSAND(priceInSand);\n require(msg.value >= ETHRequired, \"not enough ether sent\");\n uint256 leftOver = msg.value - ETHRequired;\n if(leftOver > 0) {\n msg.sender.transfer(leftOver); // refund extra\n }\n address(_wallet).transfer(ETHRequired);\n\n _mint(buyer, to, x, y, size, priceInSand, address(0), ETHRequired);\n }\n\n /**\n * @notice buy Land with DAI using the merkle proof associated with it\n * @param buyer address that perform the payment\n * @param to address that will own the purchased Land\n * @param reserved the reserved address (if any)\n * @param x x coordinate of the Land\n * @param y y coordinate of the Land\n * @param size size of the pack of Land to purchase\n * @param priceInSand price in SAND to purchase that Land\n * @param proof merkleProof for that particular Land\n * @return The address of the operator\n */\n function buyLandWithDAI(\n address buyer,\n address to,\n address reserved,\n uint256 x,\n uint256 y,\n uint256 size,\n uint256 priceInSand,\n bytes32 salt,\n bytes32[] calldata proof\n ) external {\n require(_daiEnabled, \"dai payments not enabled\");\n _checkValidity(buyer, reserved, x, y, size, priceInSand, salt, proof);\n\n uint256 DAIRequired = priceInSand.mul(daiPrice).div(1000000000000000000);\n require(_dai.transferFrom(msg.sender, _wallet, DAIRequired), \"failed to transfer dai\");\n\n _mint(buyer, to, x, y, size, priceInSand, address(_dai), DAIRequired);\n }\n\n /**\n * @notice Gets the expiry time for the current sale\n * @return The expiry time, as a unix epoch\n */\n function getExpiryTime() external view returns(uint256) {\n return _expiryTime;\n }\n\n /**\n * @notice Gets the Merkle root associated with the current sale\n * @return The Merkle root, as a bytes32 hash\n */\n function merkleRoot() external view returns(bytes32) {\n return _merkleRoot;\n }\n\n function _generateLandHash(\n uint256 x,\n uint256 y,\n uint256 size,\n uint256 price,\n address reserved,\n bytes32 salt\n ) internal pure returns (\n bytes32\n ) {\n return keccak256(\n abi.encodePacked(\n x,\n y,\n size,\n price,\n reserved,\n salt\n )\n );\n }\n\n function _verify(bytes32[] memory proof, bytes32 leaf) internal view returns (bool) {\n bytes32 computedHash = leaf;\n\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n\n if (computedHash < proofElement) {\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\n } else {\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\n }\n }\n\n return computedHash == _merkleRoot;\n }\n\n /**\n * @notice Returns the amount of ETH for a specific amount of SAND\n * @param sandAmount An amount of SAND\n * @return The amount of ETH\n */\n function getEtherAmountWithSAND(uint256 sandAmount) public view returns (uint256) {\n uint256 ethUsdPair = getEthUsdPair();\n return sandAmount.mul(daiPrice).div(ethUsdPair);\n }\n\n /**\n * @notice Gets the ETHUSD pair from the Medianizer contract\n * @return The pair as an uint256\n */\n function getEthUsdPair() internal view returns (uint256) {\n bytes32 pair = _medianizer.read();\n return uint256(pair);\n }\n}\n" + }, + "src/solc_0.5/LandSale/LandSaleWithReferral.sol": { + "content": "/* solhint-disable not-rely-on-time, func-order */\n\npragma solidity 0.5.9;\n\nimport \"../contracts_common/Libraries/SafeMathWithRequire.sol\";\nimport \"../Land.sol\";\nimport \"../contracts_common/Interfaces/ERC20.sol\";\nimport \"../contracts_common/BaseWithStorage/MetaTransactionReceiver.sol\";\nimport \"../contracts_common/Interfaces/Medianizer.sol\";\nimport \"../ReferralValidator/ReferralValidator.sol\";\n\n\n/**\n * @title Land Sale contract with referral that supports also DAI and ETH as payment\n * @notice This contract mananges the sale of our lands\n */\ncontract LandSaleWithReferral is MetaTransactionReceiver, ReferralValidator {\n using SafeMathWithRequire for uint256;\n\n uint256 internal constant GRID_SIZE = 408; // 408 is the size of the Land\n uint256 internal constant daiPrice = 14400000000000000;\n\n Land internal _land;\n ERC20 internal _sand;\n Medianizer private _medianizer;\n ERC20 private _dai;\n\n address payable internal _wallet;\n uint256 internal _expiryTime;\n bytes32 internal _merkleRoot;\n\n bool _sandEnabled = false;\n bool _etherEnabled = true;\n bool _daiEnabled = false;\n\n event LandQuadPurchased(\n address indexed buyer,\n address indexed to,\n uint256 indexed topCornerId,\n uint256 size,\n uint256 price,\n address token,\n uint256 amountPaid\n );\n\n constructor(\n address landAddress,\n address sandContractAddress,\n address initialMetaTx,\n address admin,\n address payable initialWalletAddress,\n bytes32 merkleRoot,\n uint256 expiryTime,\n address medianizerContractAddress,\n address daiTokenContractAddress,\n address initialSigningWallet,\n uint256 initialMaxCommissionRate\n ) public ReferralValidator(\n initialSigningWallet,\n initialMaxCommissionRate\n ) {\n _land = Land(landAddress);\n _sand = ERC20(sandContractAddress);\n _setMetaTransactionProcessor(initialMetaTx, true);\n _wallet = initialWalletAddress;\n _merkleRoot = merkleRoot;\n _expiryTime = expiryTime;\n _medianizer = Medianizer(medianizerContractAddress);\n _dai = ERC20(daiTokenContractAddress);\n _admin = admin;\n }\n\n /// @notice set the wallet receiving the proceeds\n /// @param newWallet address of the new receiving wallet\n function setReceivingWallet(address payable newWallet) external{\n require(newWallet != address(0), \"receiving wallet cannot be zero address\");\n require(msg.sender == _admin, \"only admin can change the receiving wallet\");\n _wallet = newWallet;\n }\n\n /// @notice enable/disable DAI payment for Lands\n /// @param enabled whether to enable or disable\n function setDAIEnabled(bool enabled) external {\n require(msg.sender == _admin, \"only admin can enable/disable DAI\");\n _daiEnabled = enabled;\n }\n\n /// @notice return whether DAI payments are enabled\n /// @return whether DAI payments are enabled\n function isDAIEnabled() external view returns (bool) {\n return _daiEnabled;\n }\n\n /// @notice enable/disable ETH payment for Lands\n /// @param enabled whether to enable or disable\n function setETHEnabled(bool enabled) external {\n require(msg.sender == _admin, \"only admin can enable/disable ETH\");\n _etherEnabled = enabled;\n }\n\n /// @notice return whether ETH payments are enabled\n /// @return whether ETH payments are enabled\n function isETHEnabled() external view returns (bool) {\n return _etherEnabled;\n }\n\n /// @notice enable/disable the specific SAND payment for Lands\n /// @param enabled whether to enable or disable\n function setSANDEnabled(bool enabled) external {\n require(msg.sender == _admin, \"only admin can enable/disable SAND\");\n _sandEnabled = enabled;\n }\n\n /// @notice return whether the specific SAND payments are enabled\n /// @return whether the specific SAND payments are enabled\n function isSANDEnabled() external view returns (bool) {\n return _sandEnabled;\n }\n\n function _checkValidity(\n address buyer,\n address reserved,\n uint256 x,\n uint256 y,\n uint256 size,\n uint256 price,\n bytes32 salt,\n bytes32[] memory proof\n ) internal view {\n /* solium-disable-next-line security/no-block-members */\n require(block.timestamp < _expiryTime, \"sale is over\");\n require(buyer == msg.sender || _metaTransactionContracts[msg.sender], \"not authorized\");\n require(reserved == address(0) || reserved == buyer, \"cannot buy reserved Land\");\n bytes32 leaf = _generateLandHash(x, y, size, price, reserved, salt);\n\n require(\n _verify(proof, leaf),\n \"Invalid land provided\"\n );\n }\n\n function _mint(address buyer, address to, uint256 x, uint256 y, uint256 size, uint256 price, address token, uint256 tokenAmount) internal {\n uint256[] memory junctions = new uint256[](0);\n _land.mintQuad(to, size, x, y, abi.encode(to, junctions)); // TODO audit\n emit LandQuadPurchased(buyer, to, x + (y * GRID_SIZE), size, price, token, tokenAmount);\n }\n\n /**\n * @notice buy Land with SAND using the merkle proof associated with it\n * @param buyer address that perform the payment\n * @param to address that will own the purchased Land\n * @param reserved the reserved address (if any)\n * @param x x coordinate of the Land\n * @param y y coordinate of the Land\n * @param size size of the pack of Land to purchase\n * @param priceInSand price in SAND to purchase that Land\n * @param proof merkleProof for that particular Land\n * @return The address of the operator\n */\n function buyLandWithSand(\n address buyer,\n address to,\n address reserved,\n uint256 x,\n uint256 y,\n uint256 size,\n uint256 priceInSand,\n bytes32 salt,\n bytes32[] calldata proof,\n bytes calldata referral\n ) external {\n require(_sandEnabled, \"sand payments not enabled\");\n _checkValidity(buyer, reserved, x, y, size, priceInSand, salt, proof);\n\n handleReferralWithERC20(\n buyer,\n priceInSand,\n referral,\n _wallet,\n address(_sand)\n );\n\n _mint(buyer, to, x, y, size, priceInSand, address(_sand), priceInSand);\n }\n\n /**\n * @notice buy Land with ETH using the merkle proof associated with it\n * @param buyer address that perform the payment\n * @param to address that will own the purchased Land\n * @param reserved the reserved address (if any)\n * @param x x coordinate of the Land\n * @param y y coordinate of the Land\n * @param size size of the pack of Land to purchase\n * @param priceInSand price in SAND to purchase that Land\n * @param proof merkleProof for that particular Land\n * @param referral the referral used by the buyer\n * @return The address of the operator\n */\n function buyLandWithETH(\n address buyer,\n address to,\n address reserved,\n uint256 x,\n uint256 y,\n uint256 size,\n uint256 priceInSand,\n bytes32 salt,\n bytes32[] calldata proof,\n bytes calldata referral\n ) external payable {\n require(_etherEnabled, \"ether payments not enabled\");\n _checkValidity(buyer, reserved, x, y, size, priceInSand, salt, proof);\n\n uint256 ETHRequired = getEtherAmountWithSAND(priceInSand);\n require(msg.value >= ETHRequired, \"not enough ether sent\");\n\n if (msg.value - ETHRequired > 0) {\n msg.sender.transfer(msg.value - ETHRequired); // refund extra\n }\n\n handleReferralWithETH(\n ETHRequired,\n referral,\n _wallet\n );\n\n _mint(buyer, to, x, y, size, priceInSand, address(0), ETHRequired);\n }\n\n /**\n * @notice buy Land with DAI using the merkle proof associated with it\n * @param buyer address that perform the payment\n * @param to address that will own the purchased Land\n * @param reserved the reserved address (if any)\n * @param x x coordinate of the Land\n * @param y y coordinate of the Land\n * @param size size of the pack of Land to purchase\n * @param priceInSand price in SAND to purchase that Land\n * @param proof merkleProof for that particular Land\n * @return The address of the operator\n */\n function buyLandWithDAI(\n address buyer,\n address to,\n address reserved,\n uint256 x,\n uint256 y,\n uint256 size,\n uint256 priceInSand,\n bytes32 salt,\n bytes32[] calldata proof,\n bytes calldata referral\n ) external {\n require(_daiEnabled, \"dai payments not enabled\");\n _checkValidity(buyer, reserved, x, y, size, priceInSand, salt, proof);\n\n uint256 DAIRequired = priceInSand.mul(daiPrice).div(1000000000000000000);\n\n handleReferralWithERC20(\n buyer,\n DAIRequired,\n referral,\n _wallet,\n address(_dai)\n );\n\n _mint(buyer, to, x, y, size, priceInSand, address(_dai), DAIRequired);\n }\n\n /**\n * @notice Gets the expiry time for the current sale\n * @return The expiry time, as a unix epoch\n */\n function getExpiryTime() external view returns(uint256) {\n return _expiryTime;\n }\n\n /**\n * @notice Gets the Merkle root associated with the current sale\n * @return The Merkle root, as a bytes32 hash\n */\n function merkleRoot() external view returns(bytes32) {\n return _merkleRoot;\n }\n\n function _generateLandHash(\n uint256 x,\n uint256 y,\n uint256 size,\n uint256 price,\n address reserved,\n bytes32 salt\n ) internal pure returns (\n bytes32\n ) {\n return keccak256(\n abi.encodePacked(\n x,\n y,\n size,\n price,\n reserved,\n salt\n )\n );\n }\n\n function _verify(bytes32[] memory proof, bytes32 leaf) internal view returns (bool) {\n bytes32 computedHash = leaf;\n\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n\n if (computedHash < proofElement) {\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\n } else {\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\n }\n }\n\n return computedHash == _merkleRoot;\n }\n\n /**\n * @notice Returns the amount of ETH for a specific amount of SAND\n * @param sandAmount An amount of SAND\n * @return The amount of ETH\n */\n function getEtherAmountWithSAND(uint256 sandAmount) public view returns (uint256) {\n uint256 ethUsdPair = getEthUsdPair();\n return sandAmount.mul(daiPrice).div(ethUsdPair);\n }\n\n /**\n * @notice Gets the ETHUSD pair from the Medianizer contract\n * @return The pair as an uint256\n */\n function getEthUsdPair() internal view returns (uint256) {\n bytes32 pair = _medianizer.read();\n return uint256(pair);\n }\n}\n" + }, + "src/solc_0.5/LandV2.sol": { + "content": "/* solhint-disable no-empty-blocks */\n\npragma solidity 0.5.9;\n\nimport \"./Land/erc721/LandBaseTokenV2.sol\";\n\ncontract LandV2 is LandBaseTokenV2 {\n /**\n * @notice Return the name of the token contract\n * @return The name of the token contract\n */\n function name() external pure returns (string memory) {\n return \"Sandbox's LANDs\";\n }\n\n /**\n * @notice Return the symbol of the token contract\n * @return The symbol of the token contract\n */\n function symbol() external pure returns (string memory) {\n return \"LAND\";\n }\n\n // solium-disable-next-line security/no-assign-params\n function uint2str(uint _i) internal pure returns (string memory) {\n if (_i == 0) {\n return \"0\";\n }\n uint j = _i;\n uint len;\n while (j != 0) {\n len++;\n j /= 10;\n }\n bytes memory bstr = new bytes(len);\n uint k = len - 1;\n while (_i != 0) {\n bstr[k--] = byte(uint8(48 + _i % 10));\n _i /= 10;\n }\n return string(bstr);\n }\n\n /**\n * @notice Return the URI of a specific token\n * @param id The id of the token\n * @return The URI of the token\n */\n function tokenURI(uint256 id) public view returns (string memory) {\n require(_ownerOf(id) != address(0), \"Id does not exist\");\n return\n string(\n abi.encodePacked(\n \"https://api.sandbox.game/lands/\",\n uint2str(id),\n \"/metadata.json\"\n )\n );\n }\n\n /**\n * @notice Check if the contract supports an interface\n * 0x01ffc9a7 is ERC-165\n * 0x80ac58cd is ERC-721\n * 0x5b5e139f is ERC-721 metadata\n * @param id The id of the interface\n * @return True if the interface is supported\n */\n function supportsInterface(bytes4 id) external pure returns (bool) {\n return id == 0x01ffc9a7 || id == 0x80ac58cd || id == 0x5b5e139f;\n }\n}\n" + }, + "src/solc_0.5/LandV3.sol": { + "content": "// SPDX-License-Identifier: MIT\n/* solhint-disable no-empty-blocks */\npragma solidity 0.5.9;\n\nimport {LandBaseTokenV3} from \"./Land/erc721/LandBaseTokenV3.sol\";\nimport {OperatorFiltererUpgradeable, IOperatorFilterRegistry} from \"./OperatorFilterer/contracts/upgradeable/OperatorFiltererUpgradeable.sol\";\n\n/**\n * @title LandV3\n * @author The Sandbox\n * @notice LAND contract\n * @dev LAND contract implements ERC721, quad and marketplace filtering functionalities\n */\ncontract LandV3 is LandBaseTokenV3, OperatorFiltererUpgradeable {\n event OperatorRegistrySet(address indexed registry);\n\n /**\n * @notice Return the name of the token contract\n * @return The name of the token contract\n */\n function name() external pure returns (string memory) {\n return \"Sandbox's LANDs\";\n }\n\n /**\n * @notice Return the symbol of the token contract\n * @return The symbol of the token contract\n */\n function symbol() external pure returns (string memory) {\n return \"LAND\";\n }\n\n // solium-disable-next-line security/no-assign-params\n function uint2str(uint256 _i) internal pure returns (string memory) {\n if (_i == 0) {\n return \"0\";\n }\n uint256 j = _i;\n uint256 len;\n while (j != 0) {\n len++;\n j /= 10;\n }\n bytes memory bstr = new bytes(len);\n uint256 k = len - 1;\n while (_i != 0) {\n bstr[k--] = byte(uint8(48 + (_i % 10)));\n _i /= 10;\n }\n return string(bstr);\n }\n\n /**\n * @notice Return the URI of a specific token\n * @param id The id of the token\n * @return The URI of the token\n */\n function tokenURI(uint256 id) public view returns (string memory) {\n require(_ownerOf(id) != address(0), \"LandV3: Id does not exist\");\n return string(abi.encodePacked(\"https://api.sandbox.game/lands/\", uint2str(id), \"/metadata.json\"));\n }\n\n /**\n * @notice Check if the contract supports an interface\n * 0x01ffc9a7 is ERC-165\n * 0x80ac58cd is ERC-721\n * 0x5b5e139f is ERC-721 metadata\n * @param id The id of the interface\n * @return True if the interface is supported\n */\n function supportsInterface(bytes4 id) external pure returns (bool) {\n return id == 0x01ffc9a7 || id == 0x80ac58cd || id == 0x5b5e139f;\n }\n\n /// @notice This function is used to register Land contract on the Operator Filterer Registry of Opensea.can only be called by admin.\n /// @dev used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.\n /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe.\n /// @param subscribe bool to signify subscription \"true\"\" or to copy the list \"false\".\n function register(address subscriptionOrRegistrantToCopy, bool subscribe) external onlyAdmin {\n require(subscriptionOrRegistrantToCopy != address(0), \"LandV3: subscription can't be zero address\");\n _register(subscriptionOrRegistrantToCopy, subscribe);\n }\n\n /// @notice sets filter registry address deployed in test\n /// @param registry the address of the registry\n function setOperatorRegistry(address registry) external onlyAdmin {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n emit OperatorRegistrySet(registry);\n }\n\n /**\n * @notice Approve an operator to spend tokens on the sender behalf\n * @param sender The address giving the approval\n * @param operator The address receiving the approval\n * @param id The id of the token\n */\n function approveFor(\n address sender,\n address operator,\n uint256 id\n ) public onlyAllowedOperatorApproval(operator) {\n super.approveFor(sender, operator, id);\n }\n\n /**\n * @notice Set the approval for an operator to manage all the tokens of the sender\n * @param operator The address receiving the approval\n * @param approved The determination of the approval\n */\n function setApprovalForAll(address operator, bool approved) public onlyAllowedOperatorApproval(operator) {\n super.setApprovalForAll(operator, approved);\n }\n\n /**\n * @notice Set the approval for an operator to manage all the tokens of the sender\n * @param sender The address giving the approval\n * @param operator The address receiving the approval\n * @param approved The determination of the approval\n */\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) public onlyAllowedOperatorApproval(operator) {\n super.setApprovalForAllFor(sender, operator, approved);\n }\n\n /**\n * @notice Approve an operator to spend tokens on the sender behalf\n * @param operator The address receiving the approval\n * @param id The id of the token\n */\n function approve(address operator, uint256 id) public onlyAllowedOperatorApproval(operator) {\n super.approve(operator, id);\n }\n\n /**\n * @notice Transfer a token between 2 addresses\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param id The id of the token\n */\n function transferFrom(\n address from,\n address to,\n uint256 id\n ) public onlyAllowedOperator(from) {\n super.transferFrom(from, to, id);\n }\n\n /**\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param id The id of the token\n * @param data Additional data\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) public onlyAllowedOperator(from) {\n super.safeTransferFrom(from, to, id, data);\n }\n\n /**\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\n * @param from The send of the token\n * @param to The recipient of the token\n * @param id The id of the token\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id\n ) external onlyAllowedOperator(from) {\n super.safeTransferFrom(from, to, id, \"\");\n }\n}\n" + }, + "src/solc_0.5/OperatorFilterer/contracts/upgradeable/DefaultOperatorFiltererUpgradeable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.5.9;\n\nimport {OperatorFiltererUpgradeable} from \"./OperatorFiltererUpgradeable.sol\";\n\n/// @title DefaultOperatorFiltererUpgradeable\n/// @notice This contract is ment to be imported in Token contracts to subscribe to the default Black list of Opensea.\ncontract DefaultOperatorFiltererUpgradeable is OperatorFiltererUpgradeable {\n // Registration address of the default subscription list.\n address public constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);\n\n function __DefaultOperatorFilterer_init(bool subscribe) internal {\n _register(DEFAULT_SUBSCRIPTION, subscribe);\n }\n}\n" + }, + "src/solc_0.5/OperatorFilterer/contracts/upgradeable/OperatorFiltererUpgradeable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.5.9;\n\nimport {IOperatorFilterRegistry} from \"../../interfaces/IOperatorFilterRegistry.sol\";\nimport {AddressUtils} from \"../../../contracts_common/Libraries/AddressUtils.sol\";\n\n/// @title OperatorFiltererUpgradeable\n/// @author The Sandbox\n/// @notice This contract would subscibe or copy or just to the subscription provided or just register to default subscription list\n/// @dev This contract is the upgradeable version of the OpenSea implementation https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/OperatorFilterer.sol and adapted to the 0.5.9 solidity version\ncontract OperatorFiltererUpgradeable {\n using AddressUtils for address;\n IOperatorFilterRegistry public operatorFilterRegistry;\n\n event ContractRegistered(address indexed subscriptionOrRegistrant, bool subscribe);\n\n /**\n * @notice Register this contract into the registry\n * @param subscriptionOrRegistrantToCopy address to subscribe or copy entries from\n * @param subscribe should it subscribe\n */\n function _register(address subscriptionOrRegistrantToCopy, bool subscribe) internal {\n // If an inheriting token contract is deployed to a network without the registry deployed, the modifier\n // will not revert, but the contract will need to be registered with the registry once it is deployed in\n // order for the modifier to filter addresses.\n if (address(operatorFilterRegistry).isContract()) {\n if (!operatorFilterRegistry.isRegistered(address(this))) {\n if (subscribe) {\n operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);\n } else {\n if (subscriptionOrRegistrantToCopy != address(0)) {\n operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);\n } else {\n operatorFilterRegistry.register(address(this));\n }\n }\n }\n }\n emit ContractRegistered(subscriptionOrRegistrantToCopy, subscribe);\n }\n\n modifier onlyAllowedOperator(address from) {\n // Check registry code length to facilitate testing in environments without a deployed registry.\n if (address(operatorFilterRegistry).isContract()) {\n // Allow spending tokens from addresses with balance\n // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred\n // from an EOA.\n if (from == msg.sender) {\n _;\n return;\n }\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), msg.sender)) {\n revert(\"Operator Not Allowed\");\n }\n }\n _;\n }\n\n modifier onlyAllowedOperatorApproval(address operator) {\n // Check registry code length to facilitate testing in environments without a deployed registry.\n if (address(operatorFilterRegistry).isContract()) {\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), operator)) {\n revert(\"Operator Not Allowed\");\n }\n }\n _;\n }\n}\n" + }, + "src/solc_0.5/OperatorFilterer/interfaces/IOperatorFilterRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.5.9;\n\n/**\n * @title IOperatorFilterRegistry\n * @author OpenSea\n * @notice Interface of the operator filter registry\n * @dev This interface comes from OpenSea https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/IOperatorFilterRegistry.sol and adapted to the 0.5.9 solidity version\n */\ninterface IOperatorFilterRegistry {\n /**\n * @notice Check if the operator is allowed for the given registrant\n * @param registrant address of the registrant\n * @param operator operator address to check\n * @return is the operator allowed\n */\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\n\n /**\n * @notice Register a new address\n * @param registrant address to register\n */\n function register(address registrant) external;\n\n /**\n * @notice Register a new address & subscribe to an address\n * @param registrant address of the registrant\n * @param subscription address where the registrant is subscribed to\n */\n function registerAndSubscribe(address registrant, address subscription) external;\n\n /**\n * @notice Register and copy entries of another registrant\n * @param registrant address of the registrant\n * @param registrantToCopy address to copy from\n */\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\n\n /**\n * @notice update the operator for a registrant\n * @param registrant address of the registrant\n * @param operator operator to be updated\n * @param filtered is it filtered\n */\n function updateOperator(\n address registrant,\n address operator,\n bool filtered\n ) external;\n\n /**\n * @notice Update operators for a registrant\n * @param registrant address of the registrant\n * @param operators addresses of the operators\n * @param filtered is it filtered\n */\n function updateOperators(\n address registrant,\n address[] calldata operators,\n bool filtered\n ) external;\n\n /**\n * @notice Update code hash\n * @param registrant address of the registrant\n * @param codehash code hash\n * @param filtered is it filtered\n */\n function updateCodeHash(\n address registrant,\n bytes32 codehash,\n bool filtered\n ) external;\n\n /**\n * @notice Update code hashes\n * @param registrant address of the registrant\n * @param codeHashes code hashes\n * @param filtered is it filtered\n */\n function updateCodeHashes(\n address registrant,\n bytes32[] calldata codeHashes,\n bool filtered\n ) external;\n\n /**\n * @notice Subscribe a registrant\n * @param registrant address of the registrant\n * @param registrantToSubscribe address to subscribe with\n */\n function subscribe(address registrant, address registrantToSubscribe) external;\n\n /**\n * @notice Unsubscribe a registrant\n * @param registrant address of the registrant\n * @param copyExistingEntries copy existing entries\n */\n function unsubscribe(address registrant, bool copyExistingEntries) external;\n\n /**\n * @notice Get the subscription of an address\n * @param addr address to check\n * @return the registrant address\n */\n function subscriptionOf(address addr) external returns (address registrant);\n\n /**\n * @notice Get the subscribers of the registrant\n * @param registrant address of the registrant\n * @return the subscribers addresses\n */\n function subscribers(address registrant) external returns (address[] memory);\n\n /**\n * @notice Get a specific subscriber\n * @param registrant address of the registrant\n * @param index index to check\n * @return the ith subscriber of the registrant\n */\n function subscriberAt(address registrant, uint256 index) external returns (address);\n\n /**\n * @notice Copy the entries of a registrant\n * @param registrant address of the registrant\n * @param registrantToCopy address to copy\n */\n function copyEntriesOf(address registrant, address registrantToCopy) external;\n\n /**\n * @notice Is a registrant filtered\n * @param registrant address of the registrant\n * @param operator operator address to check\n * @return is it filtered\n */\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\n\n /**\n * @notice Is the code hash of an operator filtered\n * @param registrant address of the registrant\n * @param operatorWithCode operator address to check\n * @return is it filtered\n */\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\n\n /**\n * @notice Is the code hash filtered\n * @param registrant address of the registrant\n * @param codeHash code hash\n * @return is it filtered\n */\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\n\n /**\n * @notice Get the filtered operators\n * @param addr address to check\n * @return filtered operators\n */\n function filteredOperators(address addr) external returns (address[] memory);\n\n /**\n * @notice Get the filtered code hashes\n * @param addr address to check\n * @return filtered code hashes\n */\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\n\n /**\n * @notice Get a specific operator\n * @param registrant address of the registrant\n * @param index index to check\n * @return address of the operator\n */\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\n\n /**\n * @notice Get the ith filtered code hash\n * @param registrant address of the registrant\n * @param index index to check\n * @return the code hash\n */\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\n\n /**\n * @notice Is the address registered\n * @param addr address to check\n * @return is it registered\n */\n function isRegistered(address addr) external returns (bool);\n\n /**\n * @notice Get the code hash for this address\n * @param addr address to check\n * @return the code hash\n */\n function codeHashOf(address addr) external returns (bytes32);\n}\n" + }, + "src/solc_0.5/ReferralValidator/ReferralValidator.sol": { + "content": "/* solhint-disable not-rely-on-time, func-order */\n\npragma solidity 0.5.9;\n\nimport \"../contracts_common/Libraries/SigUtil.sol\";\nimport \"../contracts_common/Libraries/SafeMathWithRequire.sol\";\nimport \"../contracts_common/Interfaces/ERC20.sol\";\nimport \"../contracts_common/BaseWithStorage/Admin.sol\";\n\n\n/**\n * @title Referral Validator\n * @notice This contract verifies if a referral is valid\n */\ncontract ReferralValidator is Admin {\n address private _signingWallet;\n uint256 private _maxCommissionRate;\n\n mapping (address => uint256) private _previousSigningWallets;\n uint256 private _previousSigningDelay = 60 * 60 * 24 * 10;\n\n event ReferralUsed(\n address indexed referrer,\n address indexed referee,\n address indexed token,\n uint256 amount,\n uint256 commission,\n uint256 commissionRate\n );\n\n constructor(\n address initialSigningWallet,\n uint256 initialMaxCommissionRate\n ) public {\n _signingWallet = initialSigningWallet;\n _maxCommissionRate = initialMaxCommissionRate;\n }\n\n /**\n * @notice Update the signing wallet\n * @param newSigningWallet The new address of the signing wallet\n */\n function updateSigningWallet(address newSigningWallet) external {\n require(_admin == msg.sender, \"Sender not admin\");\n _previousSigningWallets[_signingWallet] = now + _previousSigningDelay;\n _signingWallet = newSigningWallet;\n }\n\n // TODO: Check if this function is really useful\n /**\n * @notice Update the maximum commission rate\n * @param newMaxCommissionRate The new maximum commission rate\n */\n function updateMaxCommissionRate(uint256 newMaxCommissionRate) external {\n require(_admin == msg.sender, \"Sender not admin\");\n _maxCommissionRate = newMaxCommissionRate;\n }\n\n function handleReferralWithETH(\n uint256 amount,\n bytes memory referral,\n address payable destination\n ) internal {\n uint256 amountForDestination = amount;\n\n if (referral.length > 0) {\n (\n bytes memory signature,\n address referrer,\n address referee,\n uint256 expiryTime,\n uint256 commissionRate\n ) = decodeReferral(referral);\n\n uint256 commission = 0;\n\n if (isReferralValid(signature, referrer, referee, expiryTime, commissionRate)) {\n commission = SafeMathWithRequire.div(\n SafeMathWithRequire.mul(amount, commissionRate),\n 10000\n );\n\n emit ReferralUsed(\n referrer,\n referee,\n address(0),\n amount,\n commission,\n commissionRate\n );\n amountForDestination = SafeMathWithRequire.sub(\n amountForDestination,\n commission\n );\n }\n\n if (commission > 0) {\n address(uint160(referrer)).transfer(commission);\n }\n }\n\n destination.transfer(amountForDestination);\n }\n\n function handleReferralWithERC20(\n address buyer,\n uint256 amount,\n bytes memory referral,\n address payable destination,\n address tokenAddress\n ) internal {\n ERC20 token = ERC20(tokenAddress);\n uint256 amountForDestination = amount;\n\n if (referral.length > 0) {\n (\n bytes memory signature,\n address referrer,\n address referee,\n uint256 expiryTime,\n uint256 commissionRate\n ) = decodeReferral(referral);\n\n uint256 commission = 0;\n\n if (isReferralValid(signature, referrer, referee, expiryTime, commissionRate)) {\n commission = SafeMathWithRequire.div(\n SafeMathWithRequire.mul(amount, commissionRate),\n 10000\n );\n\n emit ReferralUsed(\n referrer,\n referee,\n tokenAddress,\n amount,\n commission,\n commissionRate\n );\n amountForDestination = SafeMathWithRequire.sub(\n amountForDestination,\n commission\n );\n }\n\n if (commission > 0) {\n require(token.transferFrom(buyer, referrer, commission), \"commision transfer failed\");\n }\n }\n\n require(token.transferFrom(buyer, destination, amountForDestination), \"payment transfer failed\");\n }\n\n /**\n * @notice Check if a referral is valid\n * @param signature The signature to check (signed referral)\n * @param referrer The address of the referrer\n * @param referee The address of the referee\n * @param expiryTime The expiry time of the referral\n * @param commissionRate The commissionRate of the referral\n * @return True if the referral is valid\n */\n function isReferralValid(\n bytes memory signature,\n address referrer,\n address referee,\n uint256 expiryTime,\n uint256 commissionRate\n ) public view returns (\n bool\n ) {\n if (commissionRate > _maxCommissionRate || referrer == referee || now > expiryTime) {\n return false;\n }\n\n bytes32 hashedData = keccak256(\n abi.encodePacked(\n referrer,\n referee,\n expiryTime,\n commissionRate\n )\n );\n\n address signer = SigUtil.recover(\n keccak256(\n abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hashedData)\n ),\n signature\n );\n\n if (_previousSigningWallets[signer] >= now) {\n return true;\n }\n\n return _signingWallet == signer;\n }\n\n function decodeReferral(\n bytes memory referral\n ) public pure returns (\n bytes memory,\n address,\n address,\n uint256,\n uint256\n ) {\n (\n bytes memory signature,\n address referrer,\n address referee,\n uint256 expiryTime,\n uint256 commissionRate\n ) = abi.decode(referral, (bytes, address, address, uint256, uint256));\n\n return (\n signature,\n referrer,\n referee,\n expiryTime,\n commissionRate\n );\n }\n}\n" + }, + "src/solc_0.5/Sand.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"./Sand/erc20/ERC20ExecuteExtension.sol\";\nimport \"./Sand/erc20/ERC20BaseToken.sol\";\nimport \"./Sand/erc20/ERC20BasicApproveExtension.sol\";\n\ncontract Sand is ERC20BasicApproveExtension,ERC20ExecuteExtension, ERC20BaseToken {\n\n constructor(address sandAdmin, address executionAdmin, address beneficiary) public {\n _admin = sandAdmin;\n _executionAdmin = executionAdmin;\n _mint(beneficiary, 3000000000000000000000000000);\n }\n\n /// @notice A descriptive name for the tokens\n /// @return name of the tokens\n function name() public view returns (string memory) {\n return \"SAND\";\n }\n\n /// @notice An abbreviated name for the tokens\n /// @return symbol of the tokens\n function symbol() public view returns (string memory) {\n return \"SAND\";\n }\n\n}\n" + }, + "src/solc_0.5/Sand/erc20/ERC20BaseToken.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../../contracts_common/Interfaces/ERC20Events.sol\";\nimport \"../../contracts_common/BaseWithStorage/SuperOperators.sol\";\n\ncontract ERC20BaseToken is SuperOperators, ERC20Events {\n\n uint256 internal _totalSupply;\n mapping(address => uint256) internal _balances;\n mapping(address => mapping(address => uint256)) internal _allowances;\n\n /// @notice Gets the total number of tokens in existence.\n /// @return the total number of tokens in existence.\n function totalSupply() public view returns (uint256) {\n return _totalSupply;\n }\n\n /// @notice Gets the balance of `owner`.\n /// @param owner The address to query the balance of.\n /// @return The amount owned by `owner`.\n function balanceOf(address owner) public view returns (uint256) {\n return _balances[owner];\n }\n\n /// @notice gets allowance of `spender` for `owner`'s tokens.\n /// @param owner address whose token is allowed.\n /// @param spender address allowed to transfer.\n /// @return the amount of token `spender` is allowed to transfer on behalf of `owner`.\n function allowance(address owner, address spender)\n public\n view\n returns (uint256 remaining)\n {\n return _allowances[owner][spender];\n }\n\n /// @notice returns the number of decimals for that token.\n /// @return the number of decimals.\n function decimals() public view returns (uint8) {\n return uint8(18);\n }\n\n /// @notice Transfer `amount` tokens to `to`.\n /// @param to the recipient address of the tokens transfered.\n /// @param amount the number of tokens transfered.\n /// @return true if success.\n function transfer(address to, uint256 amount)\n public\n returns (bool success)\n {\n _transfer(msg.sender, to, amount);\n return true;\n }\n\n /// @notice Transfer `amount` tokens from `from` to `to`.\n /// @param from whose token it is transferring from.\n /// @param to the recipient address of the tokens transfered.\n /// @param amount the number of tokens transfered.\n /// @return true if success.\n function transferFrom(address from, address to, uint256 amount)\n public\n returns (bool success)\n {\n if (msg.sender != from && !_superOperators[msg.sender]) {\n uint256 currentAllowance = _allowances[from][msg.sender];\n if (currentAllowance != (2**256) - 1) {\n // save gas when allowance is maximal by not reducing it (see https://github.com/ethereum/EIPs/issues/717)\n require(currentAllowance >= amount, \"Not enough funds allowed\");\n _allowances[from][msg.sender] = currentAllowance - amount;\n }\n }\n _transfer(from, to, amount);\n return true;\n }\n\n /// @notice burn `amount` tokens.\n /// @param amount the number of tokens to burn.\n /// @return true if success.\n function burn(uint256 amount) external returns (bool) {\n _burn(msg.sender, amount);\n return true;\n }\n\n /// @notice burn `amount` tokens from `owner`.\n /// @param owner address whose token is to burn.\n /// @param amount the number of token to burn.\n /// @return true if success.\n function burnFor(address owner, uint256 amount) external returns (bool) {\n _burn(owner, amount);\n return true;\n }\n\n /// @notice approve `spender` to transfer `amount` tokens.\n /// @param spender address to be given rights to transfer.\n /// @param amount the number of tokens allowed.\n /// @return true if success.\n function approve(address spender, uint256 amount)\n public\n returns (bool success)\n {\n _approveFor(msg.sender, spender, amount);\n return true;\n }\n\n /// @notice approve `spender` to transfer `amount` tokens from `owner`.\n /// @param owner address whose token is allowed.\n /// @param spender address to be given rights to transfer.\n /// @param amount the number of tokens allowed.\n /// @return true if success.\n function approveFor(address owner, address spender, uint256 amount)\n public\n returns (bool success)\n {\n require(\n msg.sender == owner || _superOperators[msg.sender],\n \"msg.sender != owner && !superOperator\"\n );\n _approveFor(owner, spender, amount);\n return true;\n }\n\n function addAllowanceIfNeeded(address owner, address spender, uint256 amountNeeded)\n public\n returns (bool success)\n {\n require(\n msg.sender == owner || _superOperators[msg.sender],\n \"msg.sender != owner && !superOperator\"\n );\n _addAllowanceIfNeeded(owner, spender, amountNeeded);\n return true;\n }\n\n function _addAllowanceIfNeeded(address owner, address spender, uint256 amountNeeded)\n internal\n {\n if(amountNeeded > 0 && !isSuperOperator(spender)) {\n uint256 currentAllowance = _allowances[owner][spender];\n if(currentAllowance < amountNeeded) {\n _approveFor(owner, spender, amountNeeded);\n }\n }\n }\n\n function _approveFor(address owner, address spender, uint256 amount)\n internal\n {\n require(\n owner != address(0) && spender != address(0),\n \"Cannot approve with 0x0\"\n );\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n function _transfer(address from, address to, uint256 amount) internal {\n require(to != address(0), \"Cannot send to 0x0\");\n uint256 currentBalance = _balances[from];\n require(currentBalance >= amount, \"not enough fund\");\n _balances[from] = currentBalance - amount;\n _balances[to] += amount;\n emit Transfer(from, to, amount);\n }\n\n function _mint(address to, uint256 amount) internal {\n require(to != address(0), \"Cannot mint to 0x0\");\n require(amount > 0, \"cannot mint 0 tokens\");\n uint256 currentTotalSupply = _totalSupply;\n uint256 newTotalSupply = currentTotalSupply + amount;\n require(newTotalSupply > currentTotalSupply, \"overflow\");\n _totalSupply = newTotalSupply;\n _balances[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n function _burn(address from, uint256 amount) internal {\n require(amount > 0, \"cannot burn 0 tokens\");\n if (msg.sender != from && !_superOperators[msg.sender]) {\n uint256 currentAllowance = _allowances[from][msg.sender];\n require(\n currentAllowance >= amount,\n \"Not enough funds allowed\"\n );\n if (currentAllowance != (2**256) - 1) {\n // save gas when allowance is maximal by not reducing it (see https://github.com/ethereum/EIPs/issues/717)\n _allowances[from][msg.sender] = currentAllowance - amount;\n }\n }\n\n uint256 currentBalance = _balances[from];\n require(currentBalance >= amount, \"Not enough funds\");\n _balances[from] = currentBalance - amount;\n _totalSupply -= amount;\n emit Transfer(from, address(0), amount);\n }\n}\n" + }, + "src/solc_0.5/Sand/erc20/ERC20BasicApproveExtension.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../../contracts_common/Libraries/BytesUtil.sol\";\n\ncontract ERC20BasicApproveExtension {\n\n /// @notice approve `target` to spend `amount` and call it with data.\n /// @param target address to be given rights to transfer and destination of the call.\n /// @param amount the number of tokens allowed.\n /// @param data bytes for the call.\n /// @return data of the call.\n function approveAndCall(\n address target,\n uint256 amount,\n bytes calldata data\n ) external payable returns (bytes memory) {\n require(\n BytesUtil.doFirstParamEqualsAddress(data, msg.sender),\n \"first param != sender\"\n );\n\n _approveFor(msg.sender, target, amount);\n\n // solium-disable-next-line security/no-call-value\n (bool success, bytes memory returnData) = target.call.value(msg.value)(data);\n require(success, string(returnData));\n return returnData;\n }\n\n /// @notice temporarly approve `target` to spend `amount` and call it with data. Previous approvals remains unchanged.\n /// @param target destination of the call, allowed to spend the amount specified\n /// @param amount the number of tokens allowed to spend.\n /// @param data bytes for the call.\n /// @return data of the call.\n function paidCall(\n address target,\n uint256 amount,\n bytes calldata data\n ) external payable returns (bytes memory) {\n require(\n BytesUtil.doFirstParamEqualsAddress(data, msg.sender),\n \"first param != sender\"\n );\n\n if (amount > 0) {\n _addAllowanceIfNeeded(msg.sender, target, amount);\n }\n\n // solium-disable-next-line security/no-call-value\n (bool success, bytes memory returnData) = target.call.value(msg.value)(data);\n require(success, string(returnData));\n\n return returnData;\n }\n\n function _approveFor(address owner, address target, uint256 amount) internal;\n function _addAllowanceIfNeeded(address owner, address spender, uint256 amountNeeded) internal;\n}\n" + }, + "src/solc_0.5/Sand/erc20/ERC20ExecuteExtension.sol": { + "content": "pragma solidity 0.5.9;\n\n\ncontract ERC20ExecuteExtension {\n\n /// @dev _executionAdmin != _admin so that this super power can be disabled independently\n address internal _executionAdmin;\n\n event ExecutionAdminAdminChanged(address oldAdmin, address newAdmin);\n\n /// @notice give the address responsible for adding execution rights.\n /// @return address of the execution administrator.\n function getExecutionAdmin() external view returns (address) {\n return _executionAdmin;\n }\n\n /// @notice change the execution adminstrator to be `newAdmin`.\n /// @param newAdmin address of the new administrator.\n function changeExecutionAdmin(address newAdmin) external {\n require(msg.sender == _executionAdmin, \"only executionAdmin can change executionAdmin\");\n emit ExecutionAdminAdminChanged(_executionAdmin, newAdmin);\n _executionAdmin = newAdmin;\n }\n\n mapping(address => bool) internal _executionOperators;\n event ExecutionOperator(address executionOperator, bool enabled);\n\n /// @notice set `executionOperator` as executionOperator: `enabled`.\n /// @param executionOperator address that will be given/removed executionOperator right.\n /// @param enabled set whether the executionOperator is enabled or disabled.\n function setExecutionOperator(address executionOperator, bool enabled) external {\n require(\n msg.sender == _executionAdmin,\n \"only execution admin is allowed to add execution operators\"\n );\n _executionOperators[executionOperator] = enabled;\n emit ExecutionOperator(executionOperator, enabled);\n }\n\n /// @notice check whether address `who` is given executionOperator rights.\n /// @param who The address to query.\n /// @return whether the address has executionOperator rights.\n function isExecutionOperator(address who) public view returns (bool) {\n return _executionOperators[who];\n }\n\n /// @notice execute on behalf of the contract.\n /// @param to destination address fo the call.\n /// @param gasLimit exact amount of gas to be passed to the call.\n /// @param data the bytes sent to the destination address.\n /// @return success whether the execution was successful.\n /// @return returnData data resulting from the execution.\n function executeWithSpecificGas(address to, uint256 gasLimit, bytes calldata data) external returns (bool success, bytes memory returnData) {\n require(_executionOperators[msg.sender], \"only execution operators allowed to execute on SAND behalf\");\n (success, returnData) = to.call.gas(gasLimit)(data);\n assert(gasleft() > gasLimit / 63); // not enough gas provided, assert to throw all gas // TODO use EIP-1930\n }\n\n /// @notice approve a specific amount of token for `from` and execute on behalf of the contract.\n /// @param from address of which token will be transfered.\n /// @param to destination address fo the call.\n /// @param amount number of tokens allowed that can be transfer by the code at `to`.\n /// @param gasLimit exact amount of gas to be passed to the call.\n /// @param data the bytes sent to the destination address.\n /// @return success whether the execution was successful.\n /// @return returnData data resulting from the execution.\n function approveAndExecuteWithSpecificGas(\n address from,\n address to,\n uint256 amount,\n uint256 gasLimit,\n bytes calldata data\n ) external returns (bool success, bytes memory returnData) {\n require(_executionOperators[msg.sender], \"only execution operators allowed to execute on SAND behalf\");\n return _approveAndExecuteWithSpecificGas(from, to, amount, gasLimit, data);\n }\n\n /// @dev the reason for this function is that charging for gas here is more gas-efficient than doing it in the caller.\n /// @notice approve a specific amount of token for `from` and execute on behalf of the contract. Plus charge the gas required to perform it.\n /// @param from address of which token will be transfered.\n /// @param to destination address fo the call.\n /// @param amount number of tokens allowed that can be transfer by the code at `to`.\n /// @param gasLimit exact amount of gas to be passed to the call.\n /// @param tokenGasPrice price in token for the gas to be charged.\n /// @param baseGasCharge amount of gas charged on top of the gas used for the call.\n /// @param tokenReceiver recipient address of the token charged for the gas used.\n /// @param data the bytes sent to the destination address.\n /// @return success whether the execution was successful.\n /// @return returnData data resulting from the execution.\n function approveAndExecuteWithSpecificGasAndChargeForIt(\n address from,\n address to,\n uint256 amount,\n uint256 gasLimit,\n uint256 tokenGasPrice,\n uint256 baseGasCharge,\n address tokenReceiver,\n bytes calldata data\n ) external returns (bool success, bytes memory returnData) {\n uint256 initialGas = gasleft();\n require(_executionOperators[msg.sender], \"only execution operators allowed to execute on SAND behalf\");\n (success, returnData) = _approveAndExecuteWithSpecificGas(from, to, amount, gasLimit, data);\n if (tokenGasPrice > 0) {\n _charge(from, gasLimit, tokenGasPrice, initialGas, baseGasCharge, tokenReceiver);\n }\n }\n\n /// @notice transfer 1amount1 token from `from` to `to` and charge the gas required to perform that transfer.\n /// @param from address of which token will be transfered.\n /// @param to destination address fo the call.\n /// @param amount number of tokens allowed that can be transfer by the code at `to`.\n /// @param gasLimit exact amount of gas to be passed to the call.\n /// @param tokenGasPrice price in token for the gas to be charged.\n /// @param baseGasCharge amount of gas charged on top of the gas used for the call.\n /// @param tokenReceiver recipient address of the token charged for the gas used.\n /// @return whether the transfer was successful.\n function transferAndChargeForGas(\n address from,\n address to,\n uint256 amount,\n uint256 gasLimit,\n uint256 tokenGasPrice,\n uint256 baseGasCharge,\n address tokenReceiver\n ) external returns (bool) {\n uint256 initialGas = gasleft();\n require(_executionOperators[msg.sender], \"only execution operators allowed to perfrom transfer and charge\");\n _transfer(from, to, amount);\n if (tokenGasPrice > 0) {\n _charge(from, gasLimit, tokenGasPrice, initialGas, baseGasCharge, tokenReceiver);\n }\n return true;\n }\n\n function _charge(\n address from,\n uint256 gasLimit,\n uint256 tokenGasPrice,\n uint256 initialGas,\n uint256 baseGasCharge,\n address tokenReceiver\n ) internal {\n uint256 gasCharge = initialGas - gasleft();\n if(gasCharge > gasLimit) {\n gasCharge = gasLimit;\n }\n gasCharge += baseGasCharge;\n uint256 tokensToCharge = gasCharge * tokenGasPrice;\n require(tokensToCharge / gasCharge == tokenGasPrice, \"overflow\");\n _transfer(from, tokenReceiver, tokensToCharge);\n }\n\n function _approveAndExecuteWithSpecificGas(\n address from,\n address to,\n uint256 amount,\n uint256 gasLimit,\n bytes memory data\n ) internal returns (bool success, bytes memory returnData) {\n\n if (amount > 0) {\n _addAllowanceIfNeeded(from, to, amount);\n }\n (success, returnData) = to.call.gas(gasLimit)(data);\n assert(gasleft() > gasLimit / 63); // not enough gas provided, assert to throw all gas // TODO use EIP-1930\n }\n\n\n function _transfer(address from, address to, uint256 amount) internal;\n function _addAllowanceIfNeeded(address owner, address spender, uint256 amountNeeded) internal;\n}" + }, + "src/solc_0.5/Swap/LandSwap.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.5.9;\n\nimport \"../Land/erc721/LandBaseToken.sol\";\nimport \"../contracts_common/Interfaces/ERC721MandatoryTokenReceiver.sol\";\nimport \"../BaseWithStorage/ERC2771Handler.sol\";\nimport \"../contracts_common/BaseWithStorage/PausableWithAdmin.sol\";\n\ncontract LandSwap is ERC721MandatoryTokenReceiver, ERC2771Handler, PausableWithAdmin {\n bytes4 internal constant _ERC721_RECEIVED = 0x150b7a02;\n bytes4 internal constant _ERC721_BATCH_RECEIVED = 0x4b808c46;\n\n LandBaseToken public _oldLand;\n LandBaseToken public _newLand;\n\n bool internal _initialized;\n\n modifier initializer() {\n require(!_initialized, \"LandSwap: Contract already initialized\");\n _;\n }\n\n function initialize (address admin, address trustedForwarder, address oldLand, address newLand) public initializer {\n _admin = admin;\n __ERC2771Handler_initialize(trustedForwarder);\n _oldLand = LandBaseToken(oldLand);\n _newLand = LandBaseToken(newLand);\n _initialized = true;\n }\n\n function onERC721BatchReceived(address, address, uint256[] calldata, bytes calldata) external returns (bytes4) {\n require(msg.sender == address(_oldLand), \"NOT_OLD_LAND\");\n return _ERC721_BATCH_RECEIVED;\n }\n\n function onERC721Received(address, address, uint256, bytes calldata) external returns (bytes4) {\n require(msg.sender == address(_oldLand), \"NOT_OLD_LAND\");\n return _ERC721_RECEIVED;\n }\n\n function swap(uint256[] calldata sizes, uint256[] calldata xs, uint256[] calldata ys, bytes calldata data) external whenNotPaused {\n address from = _msgSender();\n _oldLand.batchTransferQuad(from, address(this), sizes, xs, ys, data);\n for (uint256 i = 0; i < sizes.length; i++) {\n _newLand.mintQuad(from, sizes[i], xs[i], ys[i], data);\n }\n }\n\n function burn(uint256[] calldata ids) external whenNotPaused {\n for (uint256 i = 0; i < ids.length; i++) {\n _oldLand.burn(ids[i]);\n }\n }\n\n function supportsInterface(bytes4 id) external pure returns (bool) {\n return id == 0x01ffc9a7 || id == 0x5e8bf644;\n }\n\n // Empty storage space in contracts for future enhancements\n // ref: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/issues/13)\n uint256[49] private __gap;\n}\n" + }, + "src/solc_0.5/Swap/LandSwapV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.5.9;\n\nimport \"../Land/erc721/LandBaseToken.sol\";\nimport \"../contracts_common/Interfaces/ERC721MandatoryTokenReceiver.sol\";\nimport \"../BaseWithStorage/ERC2771Handler.sol\";\nimport \"../contracts_common/BaseWithStorage/PausableWithAdmin.sol\";\n\ncontract LandSwapV2 is ERC721MandatoryTokenReceiver, ERC2771Handler, PausableWithAdmin {\n bytes4 internal constant _ERC721_RECEIVED = 0x150b7a02;\n bytes4 internal constant _ERC721_BATCH_RECEIVED = 0x4b808c46;\n\n LandBaseToken public _oldLand;\n LandBaseToken public _newLand;\n\n bool internal _initialized;\n\n address public _batchMigration;\n\n modifier initializer() {\n require(!_initialized, \"LandSwap: Contract already initialized\");\n _;\n }\n\n function initialize (address admin, address trustedForwarder, address oldLand, address newLand, address batchMigration) public initializer {\n _admin = admin;\n __ERC2771Handler_initialize(trustedForwarder);\n _oldLand = LandBaseToken(oldLand);\n _newLand = LandBaseToken(newLand);\n _batchMigration = batchMigration;\n _initialized = true;\n }\n\n function onERC721BatchReceived(address, address, uint256[] calldata, bytes calldata) external returns (bytes4) {\n require(msg.sender == address(_oldLand), \"NOT_OLD_LAND\");\n return _ERC721_BATCH_RECEIVED;\n }\n\n function onERC721Received(address, address, uint256, bytes calldata) external returns (bytes4) {\n require(msg.sender == address(_oldLand), \"NOT_OLD_LAND\");\n return _ERC721_RECEIVED;\n }\n\n function swap(uint256[] calldata sizes, uint256[] calldata xs, uint256[] calldata ys, bytes calldata data) external whenNotPaused {\n address from = _msgSender();\n _oldLand.batchTransferQuad(from, address(this), sizes, xs, ys, data);\n for (uint256 i = 0; i < sizes.length; i++) {\n _newLand.mintQuad(from, sizes[i], xs[i], ys[i], data);\n }\n }\n\n function migrate(uint256[] calldata sizes, uint256[] calldata xs, uint256[] calldata ys, bytes calldata data) external whenNotPaused {\n require(msg.sender == _batchMigration, \"LandSwap.migrate: NOT_BATCH_MIGRATION\");\n address from = _oldLand.ownerOf(xs[0] + ys[0] * 408);\n for (uint256 index = 0; index < sizes.length; index++) {\n for (uint256 i = 0; i < sizes[index]; i++) {\n for (uint256 j = 0; j < sizes[index]; j++) {\n uint256 x = xs[index] + i;\n uint256 y = ys[index] + j;\n uint256 id = x + y * 408;\n require(from == _oldLand.ownerOf(id), \"LandSwap.migrate: NOT_OWNER\");\n }\n }\n }\n _oldLand.batchTransferQuad(from, address(this), sizes, xs, ys, data);\n for (uint256 i = 0; i < sizes.length; i++) {\n _newLand.mintQuad(from, sizes[i], xs[i], ys[i], data);\n }\n }\n\n function burn(uint256[] calldata ids) external whenNotPaused {\n for (uint256 i = 0; i < ids.length; i++) {\n _oldLand.burn(ids[i]);\n }\n }\n\n function supportsInterface(bytes4 id) external pure returns (bool) {\n return id == 0x01ffc9a7 || id == 0x5e8bf644;\n }\n\n function setBatchMigration(address batchMigration) external onlyAdmin {\n _batchMigration = batchMigration;\n }\n\n // Empty storage space in contracts for future enhancements\n // ref: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/issues/13)\n uint256[49] private __gap;\n}\n" + }, + "src/solc_0.5/Test/ERC1271Wallet.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../contracts_common/Interfaces/ERC1271.sol\";\nimport \"../contracts_common/Interfaces/ERC1271Constants.sol\";\nimport \"../contracts_common/Libraries/SigUtil.sol\";\n\ncontract ERC1271Wallet is ERC1271, ERC1271Constants {\n address owner;\n mapping(address => bool) authorizedSigners;\n\n constructor(address _signer) public {\n owner = msg.sender;\n authorizedSigners[_signer] = true;\n }\n\n function isValidSignature(bytes memory _data, bytes memory _signature)\n public\n view\n returns (bytes4 magicValue)\n {\n address signer = SigUtil.recoverWithZeroOnFailure(\n keccak256(_data),\n _signature\n );\n if (authorizedSigners[signer]) {\n return ERC1271_MAGICVALUE;\n }\n }\n}\n" + }, + "src/solc_0.5/Test/ERC1271WalletWithERC1155Receiver.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../contracts_common/Interfaces/ERC1271.sol\";\nimport \"../contracts_common/Interfaces/ERC1271Constants.sol\";\nimport \"../contracts_common/Libraries/SigUtil.sol\";\n\ncontract ERC1271WalletWithERC1155Receiver is ERC1271, ERC1271Constants {\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n address owner;\n mapping(address => bool) authorizedSigners;\n\n constructor(address _signer) public {\n owner = msg.sender;\n authorizedSigners[_signer] = true;\n }\n\n function isValidSignature(bytes memory _data, bytes memory _signature)\n public\n view\n returns (bytes4 magicValue)\n {\n address signer = SigUtil.recoverWithZeroOnFailure(\n keccak256(_data),\n _signature\n );\n if (authorizedSigners[signer]) {\n return ERC1271_MAGICVALUE;\n }\n }\n\n function onERC1155Received(\n address _operator,\n address _from,\n uint256 _id,\n uint256 _value,\n bytes calldata _data\n ) external returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address _operator,\n address _from,\n uint256[] calldata _ids,\n uint256[] calldata _values,\n bytes calldata _data\n ) external returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n}\n" + }, + "src/solc_0.5/Test/ERC1654Wallet.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../contracts_common/Interfaces/ERC1654.sol\";\nimport \"../contracts_common/Interfaces/ERC1654Constants.sol\";\nimport \"../contracts_common/Libraries/SigUtil.sol\";\n\ncontract ERC1654Wallet is ERC1654, ERC1654Constants {\n address owner;\n mapping(address => bool) authorizedSigners;\n\n constructor(address _signer) public {\n owner = msg.sender;\n authorizedSigners[_signer] = true;\n }\n\n function isValidSignature(bytes32 _hash, bytes memory _signature)\n public\n view\n returns (bytes4 magicValue)\n {\n address signer = SigUtil.recoverWithZeroOnFailure(\n _hash,\n _signature\n );\n if (authorizedSigners[signer]) {\n return ERC1654_MAGICVALUE;\n }\n }\n}\n" + }, + "src/solc_0.5/Test/ERC20Fund.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../contracts_common/Interfaces/ERC20.sol\";\n\ncontract ERC20Fund {\n ERC20 token;\n address owner;\n\n constructor(ERC20 _token) public {\n token = _token;\n owner = msg.sender;\n }\n\n function take(address _from, uint256 _amount) public returns (bool) {\n return token.transferFrom(_from, address(this), _amount);\n }\n\n function give(address _to, uint256 _amount) public returns (bool) {\n require(msg.sender == owner, \"only onwer can give\");\n return token.transfer(_to, _amount);\n }\n\n function fail() external pure {\n require(false, \"fail\");\n }\n}\n" + }, + "src/solc_0.5/Test/ERC20MetaTxReceiver.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../contracts_common/Interfaces/ERC20.sol\";\n\ncontract ERC20MetaTxReceiver {\n ERC20 token;\n address owner;\n uint256 price;\n uint256 balance;\n\n event Received(address sender, uint256 value, string name, uint256 test);\n\n constructor(ERC20 _token, uint256 _price) public {\n token = _token;\n price = _price;\n owner = msg.sender;\n }\n\n function receiveMeta(\n address sender,\n uint256 value,\n string calldata name,\n uint256 test\n ) external {\n require(\n msg.sender == sender || msg.sender == address(token),\n \"sender != msg.sender || token\"\n );\n require(value == price, \"not enough value\");\n token.transferFrom(sender, address(this), value);\n\n balance += value;\n emit Received(sender, value, name, test);\n }\n\n function withdrawnAll() external {\n require(owner == msg.sender, \"only owner can withdraw\");\n uint256 tmpBalance = balance;\n balance = 0;\n token.transfer(msg.sender, tmpBalance);\n }\n}\n" + }, + "src/solc_0.5/Test/FakeDai.sol": { + "content": "pragma solidity 0.5.9;\n\nimport '../Sand/erc20/ERC20BaseToken.sol';\n\n\ncontract FakeDai is ERC20BaseToken {\n constructor() public {\n _mint(msg.sender, 3000000000 * 10 ** 18);\n }\n}\n" + }, + "src/solc_0.5/Test/GenericERC20MetaTxReceiver.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../contracts_common/Interfaces/ERC20.sol\";\n\ncontract GenericERC20MetaTxReceiver {\n address metaTxContract;\n ERC20 token;\n address owner;\n uint256 price;\n uint256 balance;\n\n event Received(address sender, uint256 value);\n\n constructor(address _metaTxContract, ERC20 _token, uint256 _price) public {\n token = _token;\n owner = msg.sender;\n price = _price;\n metaTxContract = _metaTxContract;\n }\n\n function erc20_tokensReceived(\n address from,\n address tokenContract,\n uint256 amount,\n bytes calldata data\n ) external {\n // TODO check token being given\n require(\n msg.sender == address(metaTxContract) ||\n msg.sender == tokenContract,\n \"sender != metaTxContract && != tokenContract\"\n );\n require(amount == price, \"not enough value\");\n balance += amount;\n emit Received(from, amount);\n }\n\n function meta_transaction_received(address sender, bytes calldata data)\n external\n {\n (address addr, uint256 value) = abi.decode(data, (address, uint256));\n require(\n sender == msg.sender || msg.sender == address(metaTxContract),\n \"sender != sender && != metaTxContract\"\n );\n emit Received(addr, value);\n }\n\n function withdrawnAll() external {\n require(owner == msg.sender, \"only owner can withdraw\");\n uint256 tmpBalance = balance;\n balance = 0;\n token.transfer(msg.sender, tmpBalance);\n }\n}\n" + }, + "src/solc_0.5/Test/MockLandV3.sol": { + "content": "/* solhint-disable no-empty-blocks */\n\npragma solidity 0.5.9;\n\nimport {LandV3} from \"../LandV3.sol\";\nimport {IOperatorFilterRegistry} from \"../OperatorFilterer/interfaces/IOperatorFilterRegistry.sol\";\n\ncontract MockLandV3 is LandV3 {\n /// @notice sets filter registry address deployed in test\n /// @param registry the address of the registry\n function setOperatorRegistry(address registry) external {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n }\n\n /// @notice sets Approvals with operator filterer check in case to test the transfer.\n /// @param operator address of the operator to be approved\n /// @param approved bool value denoting approved (true) or not Approved(false)\n function setApprovalForAllWithOutFilter(address operator, bool approved) external {\n super._setApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\n * @param to The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintQuadWithOutMinterCheck(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external {\n require(to != address(0), \"to is zero address\");\n require(x % size == 0 && y % size == 0, \"Invalid coordinates\");\n require(x <= GRID_SIZE - size && y <= GRID_SIZE - size, \"Out of bounds\");\n\n (uint256 layer, , ) = _getQuadLayer(size);\n uint256 quadId = _getQuadId(layer, x, y);\n\n _checkOwner(size, x, y, 24);\n for (uint256 i = 0; i < size * size; i++) {\n uint256 _id = _idInPath(i, size, x, y);\n require(_owners[_id] == 0, \"Already minted\");\n emit Transfer(address(0), to, _id);\n }\n\n _owners[quadId] = uint256(to);\n _numNFTPerAddress[to] += size * size;\n\n _checkBatchReceiverAcceptQuad(msg.sender, address(0), to, size, x, y, data);\n }\n\n /// @notice This function is used to register Land contract on the Operator Filterer Registry of Opensea.can only be called by admin.\n /// @dev used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.\n /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe.\n /// @param subscribe bool to signify subscription \"true\"\" or to copy the list \"false\".\n function registerFilterer(address subscriptionOrRegistrantToCopy, bool subscribe) external {\n _register(subscriptionOrRegistrantToCopy, subscribe);\n }\n}" + }, + "src/solc_0.5/Test/Sand777Receiver.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../contracts_common/Interfaces/ERC777TokensRecipient.sol\";\nimport \"../contracts_common/Interfaces/ERC777Token.sol\";\nimport \"../contracts_common/Interfaces/ERC20.sol\";\nimport {\n ERC820Implementer\n} from \"../contracts_common/Base/ERC820Implementer.sol\";\n\ncontract Sand777Receiver is ERC777TokensRecipient, ERC820Implementer {\n bool private allowTokensReceived;\n\n address private owner;\n ERC777Token private tokenContract;\n uint256 private tokenBalance;\n\n constructor(ERC777Token _tokenContract, bool _allowTokensReceived) public {\n tokenContract = _tokenContract;\n allowTokensReceived = _allowTokensReceived;\n owner = msg.sender;\n\n setInterfaceImplementation(\"ERC777TokensRecipient\", address(this));\n }\n\n modifier onlyOwner() {\n require(msg.sender == owner);\n _;\n }\n\n function send(address _to, uint256 _amount) public {\n tokenContract.send(_to, _amount, \"\");\n }\n\n function transfer(address _to, uint256 _amount) public {\n ERC20(address(tokenContract)).transfer(_to, _amount);\n }\n\n function tokensReceived(\n address, // operator,\n address, // from,\n address, // to,\n uint256 amount,\n bytes memory, // data,\n bytes memory // operatorData\n ) public {\n require(\n address(tokenContract) == msg.sender,\n \"only accept tokenContract as sender\"\n );\n require(allowTokensReceived, \"Receive not allowed\");\n tokenBalance += amount;\n }\n\n function acceptTokens() public onlyOwner {\n allowTokensReceived = true;\n }\n function rejectTokens() public onlyOwner {\n allowTokensReceived = false;\n }\n\n function receiveMeta(\n address sender,\n string calldata name,\n uint256 value,\n uint256 test\n ) external {\n // for test matching erc20Receiver\n }\n}\n" + }, + "src/solc_0.5/Test/Sand777Sender.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../contracts_common/Interfaces/ERC777TokensRecipient.sol\";\nimport \"../contracts_common/Interfaces/ERC777Token.sol\";\nimport \"../contracts_common/Interfaces/ERC20.sol\";\nimport {\n ERC820Implementer\n} from \"../contracts_common/Base/ERC820Implementer.sol\";\n\ncontract Sand777Sender is ERC777TokensRecipient, ERC820Implementer {\n bool private allowTokensSent;\n\n address private owner;\n ERC777Token private tokenContract;\n uint256 private tokenBalance;\n\n constructor(ERC777Token _tokenContract, bool _allowTokensSent) public {\n tokenContract = _tokenContract;\n allowTokensSent = _allowTokensSent;\n owner = msg.sender;\n\n setInterfaceImplementation(\"ERC777TokensSender\", address(this));\n setInterfaceImplementation(\"ERC777TokensRecipient\", address(this));\n }\n\n modifier onlyOwner() {\n require(msg.sender == owner);\n _;\n }\n\n function send(address _to, uint256 _amount) public {\n tokenContract.send(_to, _amount, \"\");\n }\n\n function transfer(address _to, uint256 _amount) public {\n ERC20(address(tokenContract)).transfer(_to, _amount);\n }\n\n function tokensReceived(\n address, // operator,\n address, // from,\n address, // to,\n uint256 amount,\n bytes memory, // data,\n bytes memory // operatorData\n ) public {\n require(\n address(tokenContract) == msg.sender,\n \"only accept tokenContract as sender\"\n );\n tokenBalance += amount;\n }\n\n function tokensToSend(\n address, // operator,\n address, // from,\n address, // to,\n uint256 amount,\n bytes memory, // data,\n bytes memory // operatorData\n ) public {\n require(\n address(tokenContract) == msg.sender,\n \"only accept tokenContract as sender\"\n );\n require(allowTokensSent, \"Sending not allowed\");\n tokenBalance -= amount;\n }\n\n function acceptTokens() public onlyOwner {\n allowTokensSent = true;\n }\n function rejectTokens() public onlyOwner {\n allowTokensSent = false;\n }\n\n}\n" + }, + "src/solc_0.5/Test/TestBouncer.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../Asset/Interfaces/AssetBouncer.sol\";\nimport \"../Asset/ERC1155ERC721.sol\";\n\ncontract TestBouncer is AssetBouncer {\n ERC1155ERC721 asset;\n\n constructor(ERC1155ERC721 _asset)\n public\n {\n asset = _asset;\n }\n\n function mintFor(\n address _creator,\n uint40 _packId,\n bytes32 _hash,\n uint32 _supply,\n uint8 _rarity,\n address _owner\n ) public returns (uint256 tokenId) {\n return\n asset.mint(_creator, _packId, _hash, _supply, _rarity, _owner, \"\");\n }\n\n function mintMultipleFor(\n address _creator,\n uint40 _packId,\n bytes32 _hash,\n uint256[] memory _supplies,\n bytes memory _rarityPack,\n address _owner\n ) public returns (uint256[] memory tokenIds) {\n return\n asset.mintMultiple(\n _creator,\n _packId,\n _hash,\n _supplies,\n _rarityPack,\n _owner,\n \"\"\n );\n }\n\n function updateERC721(\n address _from,\n uint256 _tokenId,\n uint40 _packId,\n bytes32 _hash,\n uint8 _newRarity,\n address _to\n ) external returns(uint256) {\n return\n asset.updateERC721(\n _from,\n _tokenId,\n _packId,\n _hash,\n _newRarity,\n _to,\n \"\"\n );\n }\n}\n" + }, + "src/solc_0.5/Test/TestMintingFeeCollector.sol": { + "content": "pragma solidity 0.5.9;\n\nimport \"../Asset/Interfaces/MintingFeeCollector.sol\";\nimport \"../Asset/Interfaces/AssetBouncer.sol\";\n\nimport \"../Asset.sol\";\nimport \"../contracts_common/Interfaces/ERC20.sol\";\n\ncontract TestMintingFeeCollector is MintingFeeCollector {\n mapping(uint256 => uint256) stakes;\n\n AssetBouncer from;\n address owner;\n uint256 feePerToken;\n ERC20 acceptedFeeToken;\n constructor(address _owner, AssetBouncer _from, ERC20 _acceptedFeeToken)\n public\n {\n from = _from;\n owner = _owner;\n acceptedFeeToken = _acceptedFeeToken;\n }\n\n function newFee(ERC20 _newFeeToken, uint256 _newFee) external {\n require(msg.sender == address(from), \"only accepting from Asset\");\n require(_newFeeToken == acceptedFeeToken, \"token type not accepted\");\n feePerToken = _newFee;\n }\n\n function multiple_minted(uint256[] calldata tokenIds) external {\n require(msg.sender == address(from), \"only accepting from Asset\");\n for (uint256 i = 0; i < tokenIds.length; i++) {\n stakes[tokenIds[i]] = feePerToken;\n }\n }\n\n function single_minted(uint256 tokenId) external {\n require(msg.sender == address(from), \"only accepting from Asset\");\n stakes[tokenId] = feePerToken;\n }\n\n // TODO ? or remove FeeCollector entirely, bouncer will be doing the job. what is needed is a\n // function setFeeCollection(address newCollector, ERC20 newFeeToken, uint256 newFee) external {\n // require(msg.sender == owner);\n // from.setFeeCollection(newCollector, newFeeToken, newFee);\n // }\n\n}\n" + }, + "src/solc_0.5/TheSandbox712.sol": { + "content": "pragma solidity 0.5.9;\n\nimport {\n ProxyImplementation\n} from \"./contracts_common/BaseWithStorage/ProxyImplementation.sol\";\n\ncontract TheSandbox712 is ProxyImplementation {\n bytes32 constant EIP712DOMAIN_TYPEHASH = keccak256(\n \"EIP712Domain(string name,string version,address verifyingContract)\"\n );\n bytes32 DOMAIN_SEPARATOR;\n\n function init712() public phase(\"712\") {\n DOMAIN_SEPARATOR = keccak256(\n abi.encode(\n EIP712DOMAIN_TYPEHASH,\n keccak256(\"The Sandbox 3D\"),\n keccak256(\"1\"),\n address(this)\n )\n );\n }\n\n function domainSeparator() internal view returns (bytes32) {\n return DOMAIN_SEPARATOR;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 2000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/core/deployments/polygon/PolygonLand.json b/packages/core/deployments/polygon/PolygonLand.json index b8adb692ea..637fdcce4e 100644 --- a/packages/core/deployments/polygon/PolygonLand.json +++ b/packages/core/deployments/polygon/PolygonLand.json @@ -164,8 +164,27 @@ { "anonymous": false, "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "subscriptionOrRegistrant", + "type": "address" + }, { "indexed": false, + "internalType": "bool", + "name": "subscribe", + "type": "bool" + } + ], + "name": "ContractRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, "internalType": "address", "name": "minter", "type": "address" @@ -180,6 +199,19 @@ "name": "Minter", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "registry", + "type": "address" + } + ], + "name": "OperatorRegistrySet", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -224,6 +256,19 @@ "name": "Transfer", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newForwarder", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, { "inputs": [ { @@ -448,7 +493,7 @@ "outputs": [ { "internalType": "address", - "name": "trustedForwarder", + "name": "", "type": "address" } ], @@ -471,7 +516,7 @@ "type": "uint256" } ], - "stateMutability": "view", + "stateMutability": "pure", "type": "function" }, { @@ -490,7 +535,7 @@ "type": "uint256" } ], - "stateMutability": "view", + "stateMutability": "pure", "type": "function" }, { @@ -536,7 +581,7 @@ "outputs": [ { "internalType": "bool", - "name": "isOperator", + "name": "", "type": "bool" } ], @@ -600,6 +645,39 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "size", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "x", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "y", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "mintAndTransferQuad", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -646,6 +724,19 @@ "stateMutability": "pure", "type": "function" }, + { + "inputs": [], + "name": "operatorFilterRegistry", + "outputs": [ + { + "internalType": "contract IOperatorFilterRegistry", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -665,6 +756,24 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "subscriptionOrRegistrantToCopy", + "type": "address" + }, + { + "internalType": "bool", + "name": "subscribe", + "type": "bool" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -803,6 +912,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "registry", + "type": "address" + } + ], + "name": "setOperatorRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -1018,18 +1140,12 @@ "0x29BeE877F756952cC810c0cF93bF0fC2bF036Fdb", "0xc4d66de8000000000000000000000000f0511f123164602042ab2bcf02111fa5d3fe97cd" ], - "numDeployments": 1, + "numDeployments": 2, "solcInputHash": "1635d55d57a0a2552952c0d22586ed23", "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialLogic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAdmin\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\",\"events\":{\"AdminChanged(address,address)\":{\"details\":\"Emitted when the admin account has changed.\"}},\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"stateVariables\":{\"_ADMIN_SLOT\":{\"details\":\"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.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.7/openzeppelin/proxy/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.7/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n * \\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n * \\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal virtual view returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n * \\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {\\n }\\n}\\n\",\"keccak256\":\"0xc33f9858a67e34c77831163d5611d21fc627dfd2c303806a98a6c9db5a01b034\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./UpgradeableProxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n * \\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n * \\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n * \\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n * \\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is UpgradeableProxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\\n */\\n constructor(address initialLogic, address initialAdmin, bytes memory _data) payable UpgradeableProxy(initialLogic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _setAdmin(initialAdmin);\\n }\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _admin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n * \\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address) {\\n return _admin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n * \\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address) {\\n return _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n * \\n * Emits an {AdminChanged} event.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external ifAdmin {\\n require(newAdmin != address(0), \\\"TransparentUpgradeableProxy: new admin is the zero address\\\");\\n emit AdminChanged(_admin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeTo(newImplementation);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeTo(newImplementation);\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = newImplementation.delegatecall(data);\\n require(success);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view returns (address adm) {\\n bytes32 slot = _ADMIN_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n adm := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n bytes32 slot = _ADMIN_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newAdmin)\\n }\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal override virtual {\\n require(msg.sender != _admin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xd6cecbe00dc78355aff1a16d83487bb73c54701004d61a2e48cdb81e2bcacc26\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/UpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Proxy.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n * \\n * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see\\n * {TransparentUpgradeableProxy}.\\n */\\ncontract UpgradeableProxy is Proxy {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n * \\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _setImplementation(_logic);\\n if(_data.length > 0) {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = _logic.delegatecall(_data);\\n require(success);\\n }\\n }\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal override view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Upgrades the proxy to a new implementation.\\n * \\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"UpgradeableProxy: new implementation is not a contract\\\");\\n\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newImplementation)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd68f4c11941712db79a61b9dca81a5db663cfacec3d7bb19f8d2c23bb1ab8afe\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\\n // for accounts without code, i.e. `keccak256('')`\\n bytes32 codehash;\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { codehash := extcodehash(account) }\\n return (codehash != accountHash && codehash != 0x0);\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return _functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n return _functionCallWithValue(target, data, value, errorMessage);\\n }\\n\\n function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x698f929f1097637d051976b322a2d532c27df022b09010e8d091e2888a5ebdf8\",\"license\":\"MIT\"}},\"version\":1}", "bytecode": "0x6080604052604051610aaa380380610aaa8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101bf565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b6101b782610231565b505050610291565b6101d28161025560201b6104bb1760201c565b61020d5760405162461bcd60e51b8152600401808060200182810382526036815260200180610a746036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061028957508115155b949350505050565b6107d4806102a06000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104f7565b6101ed6101e861058b565b6105b0565b565b6101f76105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105f9565b610240565b6102406101d5565b50565b61024b6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105f9565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b60006103216105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61058b565b905061036b565b61036b6101d5565b90565b6103766105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806106ed603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e6105d4565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610646565b60006104806105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c6105d4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104ef57508115155b949350505050565b6104ff6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061075d6042913960600191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105cf573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106028161066a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610673816104bb565b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806107276036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a2646970667358221220b141ef72de179b8b56cef31601d40ff2875391088197e73cac39eba1ddcd0fdd64736f6c634300070600335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374", "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104f7565b6101ed6101e861058b565b6105b0565b565b6101f76105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105f9565b610240565b6102406101d5565b50565b61024b6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105f9565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b60006103216105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61058b565b905061036b565b61036b6101d5565b90565b6103766105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806106ed603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e6105d4565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610646565b60006104806105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c6105d4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104ef57508115155b949350505050565b6104ff6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061075d6042913960600191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105cf573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106028161066a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610673816104bb565b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806107276036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a2646970667358221220b141ef72de179b8b56cef31601d40ff2875391088197e73cac39eba1ddcd0fdd64736f6c63430007060033", - "execute": { - "methodName": "initialize", - "args": [ - "0xf0511f123164602042ab2bCF02111fA5D3Fe97CD" - ] - }, - "implementation": "0x16f78D75fABB869835236B5Fb59c2b29f6cBbfcf", + "implementation": "0x95847A1982DB4622Dc9014f6F0beC7Cbc6b9A672", "devdoc": { "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.", "events": { diff --git a/packages/core/deployments/polygon/PolygonLandTunnelMigration.json b/packages/core/deployments/polygon/PolygonLandTunnelMigration.json new file mode 100644 index 0000000000..36cb13925a --- /dev/null +++ b/packages/core/deployments/polygon/PolygonLandTunnelMigration.json @@ -0,0 +1,520 @@ +{ + "address": "0x51c19a3D3851c67F5198532561bFc6F051B9b336", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_polygonLand", + "type": "address" + }, + { + "internalType": "address", + "name": "_newLandTunnel", + "type": "address" + }, + { + "internalType": "address", + "name": "_oldLandTunnel", + "type": "address" + }, + { + "internalType": "address", + "name": "_admin", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldLandTunnel", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newLandTunnel", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + } + ], + "name": "TunnelLandsMigrated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "sizes", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "x", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "y", + "type": "uint256[]" + } + ], + "indexed": true, + "internalType": "struct PolygonLandTunnelMigration.OwnerWithLandIds", + "name": "_ownerWithLandIds", + "type": "tuple" + } + ], + "name": "TunnelLandsMigratedWithWithdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldLandTunnel", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newLandTunnel", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "sizes", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "x", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "y", + "type": "uint256[]" + } + ], + "name": "TunnelQuadsMigrated", + "type": "event" + }, + { + "inputs": [], + "name": "approveNewLandTunnel", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + } + ], + "name": "migrateLandsToTunnel", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "sizes", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "x", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "y", + "type": "uint256[]" + } + ], + "name": "migrateQuadsToTunnel", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "sizes", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "x", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "y", + "type": "uint256[]" + } + ], + "internalType": "struct PolygonLandTunnelMigration.OwnerWithLandIds", + "name": "_ownerWithLandIds", + "type": "tuple" + } + ], + "name": "migrateToTunnelWithWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "newLandTunnel", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oldLandTunnel", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721BatchReceived", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "polygonLand", + "outputs": [ + { + "internalType": "contract IPolygonLandWithSetApproval", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0xc082ae095b26f40a3da1340a99ceb1f1abd67a8481e78f104653f719b7add472", + "receipt": { + "to": null, + "from": "0x7074BB056C53ACC0b6091dd3FAe591aa3A4acC88", + "contractAddress": "0x51c19a3D3851c67F5198532561bFc6F051B9b336", + "transactionIndex": 107, + "gasUsed": "1091019", + "logsBloom": "0x0000000000000000000000000000000000000000000000000000000040000040000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000800000000000400002000100000000004000004000000000000000000008000000000000000400000080000000000000000000000000000400000000000000000000000000000000000000800000000000200000000000000000000200000000000000000000000000000000000000004000000000000000000001000000000000000000000000000000100000000000000000000000100000000000000000000000000800000000000000000000100000", + "blockHash": "0x6a8c66adb6c02dc9140bba9c27da460dca1e7975ae2263f3817ad8ec3c4c604b", + "transactionHash": "0xc082ae095b26f40a3da1340a99ceb1f1abd67a8481e78f104653f719b7add472", + "logs": [ + { + "transactionIndex": 107, + "blockNumber": 45864752, + "transactionHash": "0xc082ae095b26f40a3da1340a99ceb1f1abd67a8481e78f104653f719b7add472", + "address": "0x51c19a3D3851c67F5198532561bFc6F051B9b336", + "topics": [ + "0x7ce7ec0b50378fb6c0186ffb5f48325f6593fcb4ca4386f21861af3129188f5c", + "0x0000000000000000000000007051cb544c4a8d5aad1be46cc9524e48108e60b4" + ], + "data": "0x", + "logIndex": 442, + "blockHash": "0x6a8c66adb6c02dc9140bba9c27da460dca1e7975ae2263f3817ad8ec3c4c604b" + }, + { + "transactionIndex": 107, + "blockNumber": 45864752, + "transactionHash": "0xc082ae095b26f40a3da1340a99ceb1f1abd67a8481e78f104653f719b7add472", + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x0000000000000000000000007074bb056c53acc0b6091dd3fae591aa3a4acc88", + "0x0000000000000000000000007c7379531b2aee82e4ca06d4175d13b9cbeafd49" + ], + "data": "0x0000000000000000000000000000000000000000000000000063a554aa5e180c0000000000000000000000000000000000000000000000011f14d3a6746a113300000000000000000000000000000000000000000002412ce4c38287a20b86560000000000000000000000000000000000000000000000011eb12e51ca0bf92700000000000000000000000000000000000000000002412ce52727dc4c699e62", + "logIndex": 443, + "blockHash": "0x6a8c66adb6c02dc9140bba9c27da460dca1e7975ae2263f3817ad8ec3c4c604b" + } + ], + "blockNumber": 45864752, + "cumulativeGasUsed": "16339111", + "status": 1, + "byzantium": true + }, + "args": [ + "0x9d305a42A3975Ee4c1C57555BeD5919889DCE63F", + "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "0xCd1C7C85113b16A5B9e09576112d162281b5F860", + "0x7051Cb544C4A8d5AAd1Be46Cc9524E48108e60B4" + ], + "numDeployments": 1, + "solcInputHash": "e1aa5651f7645b1641ef34120369a942", + "metadata": "{\"compiler\":{\"version\":\"0.8.2+commit.661d1103\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_polygonLand\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newLandTunnel\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_oldLandTunnel\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldLandTunnel\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newLandTunnel\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"TunnelLandsMigrated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"sizes\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"x\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"y\",\"type\":\"uint256[]\"}],\"indexed\":true,\"internalType\":\"struct PolygonLandTunnelMigration.OwnerWithLandIds\",\"name\":\"_ownerWithLandIds\",\"type\":\"tuple\"}],\"name\":\"TunnelLandsMigratedWithWithdraw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldLandTunnel\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newLandTunnel\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"sizes\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"x\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"y\",\"type\":\"uint256[]\"}],\"name\":\"TunnelQuadsMigrated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"approveNewLandTunnel\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"migrateLandsToTunnel\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"sizes\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"x\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"y\",\"type\":\"uint256[]\"}],\"name\":\"migrateQuadsToTunnel\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"sizes\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"x\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"y\",\"type\":\"uint256[]\"}],\"internalType\":\"struct PolygonLandTunnelMigration.OwnerWithLandIds\",\"name\":\"_ownerWithLandIds\",\"type\":\"tuple\"}],\"name\":\"migrateToTunnelWithWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"newLandTunnel\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oldLandTunnel\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC721BatchReceived\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC721Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"polygonLand\",\"outputs\":[{\"internalType\":\"contract IPolygonLandWithSetApproval\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"The Sandbox\",\"kind\":\"dev\",\"methods\":{\"approveNewLandTunnel()\":{\"details\":\"approves New Land Tunnel to transfer Lands on behalf of this contract\"},\"changeAdmin(address)\":{\"params\":{\"_newAdmin\":\"the new admin to be set\"}},\"constructor\":{\"params\":{\"_admin\":\"admin of the contract\",\"_newLandTunnel\":\"tunnel address to migrate to\",\"_oldLandTunnel\":\"tunnel address to migrate from\",\"_polygonLand\":\"LAND token address on the child chain\"}},\"migrateLandsToTunnel(uint256[])\":{\"details\":\"Transfers all the passed land ids from the old land tunnel to the new land tunnel\",\"params\":{\"ids\":\"of land tokens to be migrated\"}},\"migrateQuadsToTunnel(uint256[],uint256[],uint256[])\":{\"details\":\"Transfers all the passed quads from the old land tunnel to the new land tunnel\",\"params\":{\"sizes\":\"of land quads to be migrated\",\"x\":\"coordinate of land quads to be migrated\",\"y\":\"coordinate of land quads to be migrated\"}},\"migrateToTunnelWithWithdraw((address,uint256[],uint256[],uint256[]))\":{\"details\":\"Fetches locked land ids to this contract and withdraws again through the new tunnel\",\"params\":{\"_ownerWithLandIds\":\"struct containing token owner with their land ids\"}},\"onERC721BatchReceived(address,address,uint256[],bytes)\":{\"details\":\"called on ERC721 batch transfer to this contract\",\"returns\":{\"_0\":\"onERC721BatchReceived function selector\"}},\"onERC721Received(address,address,uint256,bytes)\":{\"details\":\"called on ERC721 transfer to this contract\",\"returns\":{\"_0\":\"onERC721Received function selector\"}},\"supportsInterface(bytes4)\":{\"details\":\"to be called by external contact to check if this contract supports ERC721 token and batch token receive\",\"params\":{\"interfaceId\":\"the interface to be checked if supported by the contract\"},\"returns\":{\"_0\":\"0x5e8bf644 is the interface of IERC721MandatoryTokenReceiver and 0x01ffc9a7 for the Eip 165 supports interface's interface id\"}}},\"title\":\"Tunnel migration on L2\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"changeAdmin(address)\":{\"notice\":\"changes admin to new admin\"},\"constructor\":{\"notice\":\"constructor of the tunnel migration contract\"},\"migrateLandsToTunnel(uint256[])\":{\"notice\":\"This method needs super operator role to execute\"},\"migrateQuadsToTunnel(uint256[],uint256[],uint256[])\":{\"notice\":\"This method needs super operator role to execute\"},\"migrateToTunnelWithWithdraw((address,uint256[],uint256[],uint256[]))\":{\"notice\":\"This method needs super operator role to execute\"}},\"notice\":\"contract handling the migration of LAND tokens from a tunnel to a new one\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/solc_0.8/polygon/child/land/PolygonLandTunnelMigration.sol\":\"PolygonLandTunnelMigration\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"src/solc_0.8/common/interfaces/IERC721MandatoryTokenReceiver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// solhint-disable-next-line compiler-version\\npragma solidity 0.8.2;\\n\\n/**\\n * @title IERC721MandatoryTokenReceiver\\n * @author The Sandbox\\n * @notice Interface for any contract that wants to support safeBatchTransfers\\n * from ERC721 asset contracts.\\n * @dev The ERC-165 identifier for this interface is 0x5e8bf644.\\n */\\ninterface IERC721MandatoryTokenReceiver {\\n /**\\n * @notice Whenever tokens are transferred to this contract via {IERC721-safeBatchTransferFrom}\\n * by `operator` from `from`, this function is called.\\n * @param operator sender\\n * @param from owner of the tokens\\n * @param ids token ids\\n * @param data extra data\\n * @return 0x4b808c46 if the transfer is a success\\n */\\n function onERC721BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) external returns (bytes4); // needs to return 0x4b808c46\\n\\n /**\\n * @notice Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n * @param operator sender\\n * @param from owner of the token\\n * @param tokenId token id\\n * @param data extra data\\n * @return 0x4b808c46 if the transfer is a success\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4); // needs to return 0x150b7a02\\n}\\n\",\"keccak256\":\"0x6e1235c041b7d8747fa458037006e8df72bea62474dd04977e210d19914b7f5d\",\"license\":\"MIT\"},\"src/solc_0.8/common/interfaces/ILandToken.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\n/// @title ILandToken\\n/// @author The Sandbox\\n/// @notice Interface of the LAND token including quad methods\\ninterface ILandToken {\\n /// @notice transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\\n /// @param from current owner of the quad\\n /// @param to destination\\n /// @param sizes list of sizes for each quad\\n /// @param xs list of bottom left x coordinates for each quad\\n /// @param ys list of bottom left y coordinates for each quad\\n /// @param data additional data\\n function batchTransferQuad(\\n address from,\\n address to,\\n uint256[] calldata sizes,\\n uint256[] calldata xs,\\n uint256[] calldata ys,\\n bytes calldata data\\n ) external;\\n\\n /// @notice transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\\n /// @param from current owner of the quad\\n /// @param to destination\\n /// @param size size of the quad\\n /// @param x The top left x coordinate of the quad\\n /// @param y The top left y coordinate of the quad\\n /// @param data additional data\\n function transferQuad(\\n address from,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes calldata data\\n ) external;\\n\\n /// @notice Transfer many tokens between 2 addresses.\\n /// @param from The sender of the token.\\n /// @param to The recipient of the token.\\n /// @param ids The ids of the tokens.\\n /// @param data Additional data.\\n function batchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x5df895e3442904d5f6a6ad3b4b34a2ec61d4a97a4b3feea57d5bb611d14a7e3e\",\"license\":\"MIT\"},\"src/solc_0.8/common/interfaces/IPolygonLand.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\nimport {ILandToken} from \\\"./ILandToken.sol\\\";\\n\\n/**\\n * @title IPolygonLand\\n * @author The Sandbox\\n * @notice Interface of the LAND token on the child chain\\n */\\ninterface IPolygonLand is ILandToken {\\n /**\\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\\n * @param to The recipient of the new quad\\n * @param size The size of the new quad\\n * @param x The top left x coordinate of the new quad\\n * @param y The top left y coordinate of the new quad\\n * @param data extra data to pass to the transfer\\n */\\n function mintQuad(\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes memory data\\n ) external;\\n\\n /**\\n * @notice Checks if a LAND exists by its coordinates\\n * @param size size of the quad\\n * @param x x coordinate\\n * @param y y coordinate\\n * @return does the LAND exist\\n */\\n function exists(\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x725deed21224d8adb2b2cc1dd0615447abee654e519cd9e22ffa505954dfc15d\",\"license\":\"MIT\"},\"src/solc_0.8/common/interfaces/IPolygonLandTunnel.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\n/**\\n * @title IPolygonLandTunnel\\n * @author The Sandbox\\n * @notice Interface of the LAND tunnel on the child chain\\n */\\ninterface IPolygonLandTunnel {\\n /**\\n * @notice Withdraw multiple quads to the root chain\\n * @param to the recipient\\n * @param sizes size of the quads\\n * @param xs x of the quads\\n * @param ys y of the quads\\n * @param data extra data\\n */\\n function batchTransferQuadToL1(\\n address to,\\n uint256[] calldata sizes,\\n uint256[] calldata xs,\\n uint256[] calldata ys,\\n bytes memory data\\n ) external;\\n}\\n\",\"keccak256\":\"0xe6263367256f19d373491fe5367a694c5cee3d246fa8a0eb05c415047fc7a3da\",\"license\":\"MIT\"},\"src/solc_0.8/common/interfaces/IPolygonLandWithSetApproval.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\nimport {IPolygonLand} from \\\"./IPolygonLand.sol\\\";\\n\\n/**\\n * @title IPolygonLandWithSetApproval\\n * @author The Sandbox\\n * @notice Approve for all interface for the LAND on the chain root\\n */\\ninterface IPolygonLandWithSetApproval is IPolygonLand {\\n /**\\n * @notice Approve or disapprove the operator for all the tokens\\n * @param operator address to approve\\n * @param approved should it be approved or not\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n}\\n\",\"keccak256\":\"0x1a14df8699b329c65a72659968c9330aaa31ec4b17d944c3256ae7ecedbbf7a1\",\"license\":\"MIT\"},\"src/solc_0.8/polygon/child/land/PolygonLandTunnelMigration.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\nimport {IPolygonLandWithSetApproval} from \\\"../../../common/interfaces/IPolygonLandWithSetApproval.sol\\\";\\nimport {IPolygonLandTunnel} from \\\"../../../common/interfaces/IPolygonLandTunnel.sol\\\";\\nimport {IERC721MandatoryTokenReceiver} from \\\"../../../common/interfaces/IERC721MandatoryTokenReceiver.sol\\\";\\n\\n/// @title Tunnel migration on L2\\n/// @author The Sandbox\\n/// @notice contract handling the migration of LAND tokens from a tunnel to a new one\\ncontract PolygonLandTunnelMigration is IERC721MandatoryTokenReceiver {\\n struct OwnerWithLandIds {\\n address owner;\\n uint256[] sizes;\\n uint256[] x;\\n uint256[] y;\\n }\\n\\n IPolygonLandWithSetApproval public immutable polygonLand;\\n address public immutable newLandTunnel;\\n address public immutable oldLandTunnel;\\n address private admin;\\n\\n event TunnelLandsMigrated(address indexed oldLandTunnel, address indexed newLandTunnel, uint256[] ids);\\n event TunnelLandsMigratedWithWithdraw(OwnerWithLandIds indexed _ownerWithLandIds);\\n event TunnelQuadsMigrated(\\n address indexed oldLandTunnel,\\n address indexed newLandTunnel,\\n uint256[] sizes,\\n uint256[] x,\\n uint256[] y\\n );\\n event AdminChanged(address indexed _newAdmin);\\n\\n modifier isAdmin() {\\n require(admin == msg.sender, \\\"PolygonLandTunnelMigration: !AUTHORISED\\\");\\n _;\\n }\\n\\n /// @notice constructor of the tunnel migration contract\\n /// @param _polygonLand LAND token address on the child chain\\n /// @param _newLandTunnel tunnel address to migrate to\\n /// @param _oldLandTunnel tunnel address to migrate from\\n /// @param _admin admin of the contract\\n constructor(\\n address _polygonLand,\\n address _newLandTunnel,\\n address _oldLandTunnel,\\n address _admin\\n ) {\\n require(_admin != address(0), \\\"PolygonLandTunnelMigration: admin can't be zero address\\\");\\n require(_polygonLand != address(0), \\\"PolygonLandTunnelMigration: polygonLand can't be zero address\\\");\\n require(_newLandTunnel != address(0), \\\"PolygonLandTunnelMigration: new Tunnel can't be zero address\\\");\\n require(_oldLandTunnel != address(0), \\\"PolygonLandTunnelMigration: old Tunnel can't be zero address\\\");\\n admin = _admin;\\n polygonLand = IPolygonLandWithSetApproval(_polygonLand);\\n newLandTunnel = _newLandTunnel;\\n oldLandTunnel = _oldLandTunnel;\\n\\n emit AdminChanged(_admin);\\n }\\n\\n /// @dev Transfers all the passed land ids from the old land tunnel to the new land tunnel\\n /// @notice This method needs super operator role to execute\\n /// @param ids of land tokens to be migrated\\n function migrateLandsToTunnel(uint256[] memory ids) external isAdmin {\\n polygonLand.batchTransferFrom(oldLandTunnel, newLandTunnel, ids, \\\"\\\");\\n emit TunnelLandsMigrated(oldLandTunnel, newLandTunnel, ids);\\n }\\n\\n /// @dev Fetches locked land ids to this contract and withdraws again through the new tunnel\\n /// @notice This method needs super operator role to execute\\n /// @param _ownerWithLandIds struct containing token owner with their land ids\\n function migrateToTunnelWithWithdraw(OwnerWithLandIds memory _ownerWithLandIds) external isAdmin {\\n // check for gas limits based on the number of locked tokens\\n // Fetch locked tokens to this contract address\\n polygonLand.batchTransferQuad(\\n oldLandTunnel,\\n address(this),\\n _ownerWithLandIds.sizes,\\n _ownerWithLandIds.x,\\n _ownerWithLandIds.y,\\n \\\"\\\"\\n );\\n // Withdraw tokens to L1\\n IPolygonLandTunnel(newLandTunnel).batchTransferQuadToL1(\\n _ownerWithLandIds.owner,\\n _ownerWithLandIds.sizes,\\n _ownerWithLandIds.x,\\n _ownerWithLandIds.y,\\n \\\"\\\"\\n );\\n\\n emit TunnelLandsMigratedWithWithdraw(_ownerWithLandIds);\\n }\\n\\n ///@dev approves New Land Tunnel to transfer Lands on behalf of this contract\\n function approveNewLandTunnel() external isAdmin {\\n polygonLand.setApprovalForAll(newLandTunnel, true);\\n }\\n\\n /// @dev Transfers all the passed quads from the old land tunnel to the new land tunnel\\n /// @notice This method needs super operator role to execute\\n /// @param sizes of land quads to be migrated\\n /// @param x coordinate of land quads to be migrated\\n /// @param y coordinate of land quads to be migrated\\n function migrateQuadsToTunnel(\\n uint256[] memory sizes,\\n uint256[] memory x,\\n uint256[] memory y\\n ) external isAdmin {\\n polygonLand.batchTransferQuad(oldLandTunnel, newLandTunnel, sizes, x, y, \\\"\\\");\\n emit TunnelQuadsMigrated(oldLandTunnel, newLandTunnel, sizes, x, y);\\n }\\n\\n /// @notice changes admin to new admin\\n /// @param _newAdmin the new admin to be set\\n function changeAdmin(address _newAdmin) external isAdmin {\\n require(_newAdmin != address(0), \\\"PolygonLandTunnelMigration: admin can't be zero address\\\");\\n admin = _newAdmin;\\n emit AdminChanged(_newAdmin);\\n }\\n\\n /// @dev called on ERC721 transfer to this contract\\n /// @return onERC721Received function selector\\n function onERC721Received(\\n address, /* operator */\\n address, /* from */\\n uint256, /* tokenId */\\n bytes calldata /* data */\\n ) external pure override returns (bytes4) {\\n return this.onERC721Received.selector;\\n }\\n\\n /// @dev called on ERC721 batch transfer to this contract\\n /// @return onERC721BatchReceived function selector\\n function onERC721BatchReceived(\\n address, /* operator */\\n address, /* from */\\n uint256[] calldata, /* ids */\\n bytes calldata /* data */\\n ) external pure override returns (bytes4) {\\n return this.onERC721BatchReceived.selector;\\n }\\n\\n /// @dev to be called by external contact to check if this contract supports ERC721 token and batch token receive\\n /// @param interfaceId the interface to be checked if supported by the contract\\n /// @return 0x5e8bf644 is the interface of IERC721MandatoryTokenReceiver and 0x01ffc9a7 for the Eip 165 supports interface's interface id\\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\\n return interfaceId == 0x5e8bf644 || interfaceId == 0x01ffc9a7;\\n }\\n}\\n\",\"keccak256\":\"0xb5b91278bd529f57d1dd735285a2545060ad5cd4942b347f9e9de48f578d5956\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60e06040523480156200001157600080fd5b50604051620015ff380380620015ff8339810160408190526200003491620002bf565b6001600160a01b038116620000b65760405162461bcd60e51b815260206004820152603760248201527f506f6c79676f6e4c616e6454756e6e656c4d6967726174696f6e3a2061646d6960448201527f6e2063616e2774206265207a65726f206164647265737300000000000000000060648201526084015b60405180910390fd5b6001600160a01b038416620001345760405162461bcd60e51b815260206004820152603d60248201527f506f6c79676f6e4c616e6454756e6e656c4d6967726174696f6e3a20706f6c7960448201527f676f6e4c616e642063616e2774206265207a65726f20616464726573730000006064820152608401620000ad565b6001600160a01b038316620001b25760405162461bcd60e51b815260206004820152603c60248201527f506f6c79676f6e4c616e6454756e6e656c4d6967726174696f6e3a206e65772060448201527f54756e6e656c2063616e2774206265207a65726f2061646472657373000000006064820152608401620000ad565b6001600160a01b038216620002305760405162461bcd60e51b815260206004820152603c60248201527f506f6c79676f6e4c616e6454756e6e656c4d6967726174696f6e3a206f6c642060448201527f54756e6e656c2063616e2774206265207a65726f2061646472657373000000006064820152608401620000ad565b600080546001600160a01b0383166001600160a01b0319909116811782556001600160601b0319606087811b821660805286811b821660a05285901b1660c05260405190917f7ce7ec0b50378fb6c0186ffb5f48325f6593fcb4ca4386f21861af3129188f5c91a2505050506200031b565b80516001600160a01b0381168114620002ba57600080fd5b919050565b60008060008060808587031215620002d5578384fd5b620002e085620002a2565b9350620002f060208601620002a2565b92506200030060408601620002a2565b91506200031060608601620002a2565b905092959194509250565b60805160601c60a05160601c60c05160601c611242620003bd600039600081816101f1015281816103e20152818161048c01528181610822015281816108d00152610a0e0152600081816101640152818161040401528181610462015281816106ce01528181610844015281816108a60152610aab015260008181610233015281816103b5015281816106fd015281816107f501526109e101526112426000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c806386f4779211610081578063df6324291161005b578063df6324291461022e578063ebe9483414610255578063ff9bb14514610268576100c9565b806386f47792146101ec5780638f28397014610213578063c62fbdea14610226576100c9565b80633b2fd458116100b25780633b2fd4581461015f5780634b808c461461019e57806376926076146101d7576100c9565b806301ffc9a7146100ce578063150b7a02146100f6575b600080fd5b6100e16100dc366004610e3e565b61027b565b60405190151581526020015b60405180910390f35b61012e610104366004610d12565b7f150b7a020000000000000000000000000000000000000000000000000000000095945050505050565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016100ed565b6101867f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100ed565b61012e6101ac366004610c57565b7f4b808c46000000000000000000000000000000000000000000000000000000009695505050505050565b6101ea6101e5366004610d7f565b610316565b005b6101867f000000000000000000000000000000000000000000000000000000000000000081565b6101ea610221366004610c36565b6104ee565b6101ea610634565b6101867f000000000000000000000000000000000000000000000000000000000000000081565b6101ea610263366004610dba565b61075b565b6101ea610276366004610e7e565b610938565b60007f5e8bf644000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316148061030e57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b90505b919050565b6000546001600160a01b031633146103855760405162461bcd60e51b815260206004820152602760248201527f506f6c79676f6e4c616e6454756e6e656c4d6967726174696f6e3a20214155546044820152661213d49254d15160ca1b60648201526084015b60405180910390fd5b6040517f15ddc5350000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906315ddc5359061042e907f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090869060040161109c565b600060405180830381600087803b15801561044857600080fd5b505af115801561045c573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167ff3c8a06d9bf1d976109b76dbbd7e869f76aa4af071573fe465e2b3b8f5b421f4836040516104e39190611142565b60405180910390a350565b6000546001600160a01b031633146105585760405162461bcd60e51b815260206004820152602760248201527f506f6c79676f6e4c616e6454756e6e656c4d6967726174696f6e3a20214155546044820152661213d49254d15160ca1b606482015260840161037c565b6001600160a01b0381166105d45760405162461bcd60e51b815260206004820152603760248201527f506f6c79676f6e4c616e6454756e6e656c4d6967726174696f6e3a2061646d6960448201527f6e2063616e2774206265207a65726f2061646472657373000000000000000000606482015260840161037c565b600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038316908117825560405190917f7ce7ec0b50378fb6c0186ffb5f48325f6593fcb4ca4386f21861af3129188f5c91a250565b6000546001600160a01b0316331461069e5760405162461bcd60e51b815260206004820152602760248201527f506f6c79676f6e4c616e6454756e6e656c4d6967726174696f6e3a20214155546044820152661213d49254d15160ca1b606482015260840161037c565b6040517fa22cb4650000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152600160248301527f0000000000000000000000000000000000000000000000000000000000000000169063a22cb46590604401600060405180830381600087803b15801561074157600080fd5b505af1158015610755573d6000803e3d6000fd5b50505050565b6000546001600160a01b031633146107c55760405162461bcd60e51b815260206004820152602760248201527f506f6c79676f6e4c616e6454756e6e656c4d6967726174696f6e3a20214155546044820152661213d49254d15160ca1b606482015260840161037c565b6040517feaa5e0670000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063eaa5e06790610872907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009088908890889060040161102f565b600060405180830381600087803b15801561088c57600080fd5b505af11580156108a0573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f5925ea9cd1b8a825a990df684ca7e1da5ce4c4dfbc2271a8470b8f2a31dcc12785858560405161092b93929190611155565b60405180910390a3505050565b6000546001600160a01b031633146109a25760405162461bcd60e51b815260206004820152602760248201527f506f6c79676f6e4c616e6454756e6e656c4d6967726174696f6e3a20214155546044820152661213d49254d15160ca1b606482015260840161037c565b6020810151604080830151606084015191517feaa5e0670000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169363eaa5e06793610a3a937f0000000000000000000000000000000000000000000000000000000000000000933093929060040161102f565b600060405180830381600087803b158015610a5457600080fd5b505af1158015610a68573d6000803e3d6000fd5b505082516020840151604080860151606087015191517f3f360a400000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169650633f360a409550610ae3949392906004016110e0565b600060405180830381600087803b158015610afd57600080fd5b505af1158015610b11573d6000803e3d6000fd5b5050505080604051610b239190610f9f565b604051908190038120907f62c9f2bdf46e0b85b03dabe7d78361cc7dc14ca10dda2527d405e3a57a218c0190600090a250565b80356001600160a01b038116811461031157600080fd5b600082601f830112610b7d578081fd5b8135602067ffffffffffffffff821115610b9957610b996111dd565b808202610ba782820161118e565b838152828101908684018388018501891015610bc1578687fd5b8693505b85841015610be3578035835260019390930192918401918401610bc5565b50979650505050505050565b60008083601f840112610c00578182fd5b50813567ffffffffffffffff811115610c17578182fd5b602083019150836020828501011115610c2f57600080fd5b9250929050565b600060208284031215610c47578081fd5b610c5082610b56565b9392505050565b60008060008060008060808789031215610c6f578182fd5b610c7887610b56565b9550610c8660208801610b56565b9450604087013567ffffffffffffffff80821115610ca2578384fd5b818901915089601f830112610cb5578384fd5b813581811115610cc3578485fd5b8a60208083028501011115610cd6578485fd5b602083019650809550506060890135915080821115610cf3578384fd5b50610d0089828a01610bef565b979a9699509497509295939492505050565b600080600080600060808688031215610d29578081fd5b610d3286610b56565b9450610d4060208701610b56565b935060408601359250606086013567ffffffffffffffff811115610d62578182fd5b610d6e88828901610bef565b969995985093965092949392505050565b600060208284031215610d90578081fd5b813567ffffffffffffffff811115610da6578182fd5b610db284828501610b6d565b949350505050565b600080600060608486031215610dce578283fd5b833567ffffffffffffffff80821115610de5578485fd5b610df187838801610b6d565b94506020860135915080821115610e06578384fd5b610e1287838801610b6d565b93506040860135915080821115610e27578283fd5b50610e3486828701610b6d565b9150509250925092565b600060208284031215610e4f578081fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610c50578182fd5b600060208284031215610e8f578081fd5b813567ffffffffffffffff80821115610ea6578283fd5b9083019060808286031215610eb9578283fd5b610ec3608061118e565b610ecc83610b56565b8152602083013582811115610edf578485fd5b610eeb87828601610b6d565b602083015250604083013582811115610f02578485fd5b610f0e87828601610b6d565b604083015250606083013582811115610f25578485fd5b610f3187828601610b6d565b60608301525095945050505050565b6000815180845260208085019450808401835b83811015610f6f57815187529582019590820190600101610f53565b509495945050505050565b80516000906020808401838315610f6f57815187529582019590820190600101610f53565b81516001600160a01b031681526020808301518051600092918201908390838601905b80831015610fe25783518252928401926001929092019190840190610fc2565b5060408701518051908501935090915084905b808210156110155783518352928401929184019160019190910190610ff5565b5050611025816060880151610f7a565b9695505050505050565b60006001600160a01b03808816835280871660208401525060c0604083015261105b60c0830186610f40565b828103606084015261106d8186610f40565b905082810360808401526110818185610f40565b83810360a09094019390935250815260200195945050505050565b60006001600160a01b038086168352808516602084015250608060408301526110c86080830184610f40565b82810360609093019290925281526020019392505050565b60006001600160a01b038616825260a0602083015261110260a0830186610f40565b82810360408401526111148186610f40565b905082810360608401526111288185610f40565b838103608090940193909352508152602001949350505050565b600060208252610c506020830184610f40565b6000606082526111686060830186610f40565b828103602084015261117a8186610f40565b905082810360408401526110258185610f40565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156111d5576111d56111dd565b604052919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea2646970667358221220fb57950404fd5e9de7c33d8df02df870e277812983cfd067b74fe9c45b330ddc64736f6c63430008020033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100c95760003560e01c806386f4779211610081578063df6324291161005b578063df6324291461022e578063ebe9483414610255578063ff9bb14514610268576100c9565b806386f47792146101ec5780638f28397014610213578063c62fbdea14610226576100c9565b80633b2fd458116100b25780633b2fd4581461015f5780634b808c461461019e57806376926076146101d7576100c9565b806301ffc9a7146100ce578063150b7a02146100f6575b600080fd5b6100e16100dc366004610e3e565b61027b565b60405190151581526020015b60405180910390f35b61012e610104366004610d12565b7f150b7a020000000000000000000000000000000000000000000000000000000095945050505050565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016100ed565b6101867f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100ed565b61012e6101ac366004610c57565b7f4b808c46000000000000000000000000000000000000000000000000000000009695505050505050565b6101ea6101e5366004610d7f565b610316565b005b6101867f000000000000000000000000000000000000000000000000000000000000000081565b6101ea610221366004610c36565b6104ee565b6101ea610634565b6101867f000000000000000000000000000000000000000000000000000000000000000081565b6101ea610263366004610dba565b61075b565b6101ea610276366004610e7e565b610938565b60007f5e8bf644000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316148061030e57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b90505b919050565b6000546001600160a01b031633146103855760405162461bcd60e51b815260206004820152602760248201527f506f6c79676f6e4c616e6454756e6e656c4d6967726174696f6e3a20214155546044820152661213d49254d15160ca1b60648201526084015b60405180910390fd5b6040517f15ddc5350000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906315ddc5359061042e907f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090869060040161109c565b600060405180830381600087803b15801561044857600080fd5b505af115801561045c573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167ff3c8a06d9bf1d976109b76dbbd7e869f76aa4af071573fe465e2b3b8f5b421f4836040516104e39190611142565b60405180910390a350565b6000546001600160a01b031633146105585760405162461bcd60e51b815260206004820152602760248201527f506f6c79676f6e4c616e6454756e6e656c4d6967726174696f6e3a20214155546044820152661213d49254d15160ca1b606482015260840161037c565b6001600160a01b0381166105d45760405162461bcd60e51b815260206004820152603760248201527f506f6c79676f6e4c616e6454756e6e656c4d6967726174696f6e3a2061646d6960448201527f6e2063616e2774206265207a65726f2061646472657373000000000000000000606482015260840161037c565b600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038316908117825560405190917f7ce7ec0b50378fb6c0186ffb5f48325f6593fcb4ca4386f21861af3129188f5c91a250565b6000546001600160a01b0316331461069e5760405162461bcd60e51b815260206004820152602760248201527f506f6c79676f6e4c616e6454756e6e656c4d6967726174696f6e3a20214155546044820152661213d49254d15160ca1b606482015260840161037c565b6040517fa22cb4650000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152600160248301527f0000000000000000000000000000000000000000000000000000000000000000169063a22cb46590604401600060405180830381600087803b15801561074157600080fd5b505af1158015610755573d6000803e3d6000fd5b50505050565b6000546001600160a01b031633146107c55760405162461bcd60e51b815260206004820152602760248201527f506f6c79676f6e4c616e6454756e6e656c4d6967726174696f6e3a20214155546044820152661213d49254d15160ca1b606482015260840161037c565b6040517feaa5e0670000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063eaa5e06790610872907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009088908890889060040161102f565b600060405180830381600087803b15801561088c57600080fd5b505af11580156108a0573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f5925ea9cd1b8a825a990df684ca7e1da5ce4c4dfbc2271a8470b8f2a31dcc12785858560405161092b93929190611155565b60405180910390a3505050565b6000546001600160a01b031633146109a25760405162461bcd60e51b815260206004820152602760248201527f506f6c79676f6e4c616e6454756e6e656c4d6967726174696f6e3a20214155546044820152661213d49254d15160ca1b606482015260840161037c565b6020810151604080830151606084015191517feaa5e0670000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169363eaa5e06793610a3a937f0000000000000000000000000000000000000000000000000000000000000000933093929060040161102f565b600060405180830381600087803b158015610a5457600080fd5b505af1158015610a68573d6000803e3d6000fd5b505082516020840151604080860151606087015191517f3f360a400000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169650633f360a409550610ae3949392906004016110e0565b600060405180830381600087803b158015610afd57600080fd5b505af1158015610b11573d6000803e3d6000fd5b5050505080604051610b239190610f9f565b604051908190038120907f62c9f2bdf46e0b85b03dabe7d78361cc7dc14ca10dda2527d405e3a57a218c0190600090a250565b80356001600160a01b038116811461031157600080fd5b600082601f830112610b7d578081fd5b8135602067ffffffffffffffff821115610b9957610b996111dd565b808202610ba782820161118e565b838152828101908684018388018501891015610bc1578687fd5b8693505b85841015610be3578035835260019390930192918401918401610bc5565b50979650505050505050565b60008083601f840112610c00578182fd5b50813567ffffffffffffffff811115610c17578182fd5b602083019150836020828501011115610c2f57600080fd5b9250929050565b600060208284031215610c47578081fd5b610c5082610b56565b9392505050565b60008060008060008060808789031215610c6f578182fd5b610c7887610b56565b9550610c8660208801610b56565b9450604087013567ffffffffffffffff80821115610ca2578384fd5b818901915089601f830112610cb5578384fd5b813581811115610cc3578485fd5b8a60208083028501011115610cd6578485fd5b602083019650809550506060890135915080821115610cf3578384fd5b50610d0089828a01610bef565b979a9699509497509295939492505050565b600080600080600060808688031215610d29578081fd5b610d3286610b56565b9450610d4060208701610b56565b935060408601359250606086013567ffffffffffffffff811115610d62578182fd5b610d6e88828901610bef565b969995985093965092949392505050565b600060208284031215610d90578081fd5b813567ffffffffffffffff811115610da6578182fd5b610db284828501610b6d565b949350505050565b600080600060608486031215610dce578283fd5b833567ffffffffffffffff80821115610de5578485fd5b610df187838801610b6d565b94506020860135915080821115610e06578384fd5b610e1287838801610b6d565b93506040860135915080821115610e27578283fd5b50610e3486828701610b6d565b9150509250925092565b600060208284031215610e4f578081fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610c50578182fd5b600060208284031215610e8f578081fd5b813567ffffffffffffffff80821115610ea6578283fd5b9083019060808286031215610eb9578283fd5b610ec3608061118e565b610ecc83610b56565b8152602083013582811115610edf578485fd5b610eeb87828601610b6d565b602083015250604083013582811115610f02578485fd5b610f0e87828601610b6d565b604083015250606083013582811115610f25578485fd5b610f3187828601610b6d565b60608301525095945050505050565b6000815180845260208085019450808401835b83811015610f6f57815187529582019590820190600101610f53565b509495945050505050565b80516000906020808401838315610f6f57815187529582019590820190600101610f53565b81516001600160a01b031681526020808301518051600092918201908390838601905b80831015610fe25783518252928401926001929092019190840190610fc2565b5060408701518051908501935090915084905b808210156110155783518352928401929184019160019190910190610ff5565b5050611025816060880151610f7a565b9695505050505050565b60006001600160a01b03808816835280871660208401525060c0604083015261105b60c0830186610f40565b828103606084015261106d8186610f40565b905082810360808401526110818185610f40565b83810360a09094019390935250815260200195945050505050565b60006001600160a01b038086168352808516602084015250608060408301526110c86080830184610f40565b82810360609093019290925281526020019392505050565b60006001600160a01b038616825260a0602083015261110260a0830186610f40565b82810360408401526111148186610f40565b905082810360608401526111288185610f40565b838103608090940193909352508152602001949350505050565b600060208252610c506020830184610f40565b6000606082526111686060830186610f40565b828103602084015261117a8186610f40565b905082810360408401526110258185610f40565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156111d5576111d56111dd565b604052919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea2646970667358221220fb57950404fd5e9de7c33d8df02df870e277812983cfd067b74fe9c45b330ddc64736f6c63430008020033", + "devdoc": { + "author": "The Sandbox", + "kind": "dev", + "methods": { + "approveNewLandTunnel()": { + "details": "approves New Land Tunnel to transfer Lands on behalf of this contract" + }, + "changeAdmin(address)": { + "params": { + "_newAdmin": "the new admin to be set" + } + }, + "constructor": { + "params": { + "_admin": "admin of the contract", + "_newLandTunnel": "tunnel address to migrate to", + "_oldLandTunnel": "tunnel address to migrate from", + "_polygonLand": "LAND token address on the child chain" + } + }, + "migrateLandsToTunnel(uint256[])": { + "details": "Transfers all the passed land ids from the old land tunnel to the new land tunnel", + "params": { + "ids": "of land tokens to be migrated" + } + }, + "migrateQuadsToTunnel(uint256[],uint256[],uint256[])": { + "details": "Transfers all the passed quads from the old land tunnel to the new land tunnel", + "params": { + "sizes": "of land quads to be migrated", + "x": "coordinate of land quads to be migrated", + "y": "coordinate of land quads to be migrated" + } + }, + "migrateToTunnelWithWithdraw((address,uint256[],uint256[],uint256[]))": { + "details": "Fetches locked land ids to this contract and withdraws again through the new tunnel", + "params": { + "_ownerWithLandIds": "struct containing token owner with their land ids" + } + }, + "onERC721BatchReceived(address,address,uint256[],bytes)": { + "details": "called on ERC721 batch transfer to this contract", + "returns": { + "_0": "onERC721BatchReceived function selector" + } + }, + "onERC721Received(address,address,uint256,bytes)": { + "details": "called on ERC721 transfer to this contract", + "returns": { + "_0": "onERC721Received function selector" + } + }, + "supportsInterface(bytes4)": { + "details": "to be called by external contact to check if this contract supports ERC721 token and batch token receive", + "params": { + "interfaceId": "the interface to be checked if supported by the contract" + }, + "returns": { + "_0": "0x5e8bf644 is the interface of IERC721MandatoryTokenReceiver and 0x01ffc9a7 for the Eip 165 supports interface's interface id" + } + } + }, + "title": "Tunnel migration on L2", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "changeAdmin(address)": { + "notice": "changes admin to new admin" + }, + "constructor": { + "notice": "constructor of the tunnel migration contract" + }, + "migrateLandsToTunnel(uint256[])": { + "notice": "This method needs super operator role to execute" + }, + "migrateQuadsToTunnel(uint256[],uint256[],uint256[])": { + "notice": "This method needs super operator role to execute" + }, + "migrateToTunnelWithWithdraw((address,uint256[],uint256[],uint256[]))": { + "notice": "This method needs super operator role to execute" + } + }, + "notice": "contract handling the migration of LAND tokens from a tunnel to a new one", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 64304, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandTunnelMigration.sol:PolygonLandTunnelMigration", + "label": "admin", + "offset": 0, + "slot": "0", + "type": "t_address" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/packages/core/deployments/polygon/PolygonLandTunnelV2.json b/packages/core/deployments/polygon/PolygonLandTunnelV2.json new file mode 100644 index 0000000000..5f541cbc58 --- /dev/null +++ b/packages/core/deployments/polygon/PolygonLandTunnelV2.json @@ -0,0 +1,951 @@ +{ + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "size", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "x", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "y", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "name": "MessageSent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint8", + "name": "size", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "uint32", + "name": "limit", + "type": "uint32" + } + ], + "name": "SetGasLimit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "maxLands", + "type": "uint256" + } + ], + "name": "SetMaxAllowedLands", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "maxGasLimit", + "type": "uint32" + } + ], + "name": "SetMaxGasLimit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newForwarder", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "size", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "x", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "y", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "sizes", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "xs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "ys", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "batchTransferQuadToL1", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "childToken", + "outputs": [ + { + "internalType": "contract IPolygonLandV2", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fxChild", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fxRootTunnel", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "gasLimits", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTrustedForwarder", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_fxChild", + "type": "address" + }, + { + "internalType": "contract IPolygonLandV2", + "name": "_childToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_trustedForwarder", + "type": "address" + }, + { + "internalType": "uint32", + "name": "_maxGasLimit", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "_maxAllowedLands", + "type": "uint256" + }, + { + "internalType": "uint32[5]", + "name": "limits", + "type": "uint32[5]" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "forwarder", + "type": "address" + } + ], + "name": "isTrustedForwarder", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxAllowedLands", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxGasLimitOnL1", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721BatchReceived", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "stateId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "rootMessageSender", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "processMessageFromRoot", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_fxRootTunnel", + "type": "address" + } + ], + "name": "setFxRootTunnel", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "size", + "type": "uint8" + }, + { + "internalType": "uint32", + "name": "limit", + "type": "uint32" + } + ], + "name": "setGasLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_maxAllowedLands", + "type": "uint256" + } + ], + "name": "setMaxAllowedLands", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_maxGasLimit", + "type": "uint32" + } + ], + "name": "setMaxLimitOnL1", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "trustedForwarder", + "type": "address" + } + ], + "name": "setTrustedForwarder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32[5]", + "name": "limits", + "type": "uint32[5]" + } + ], + "name": "setupGasLimits", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "initialLogic", + "type": "address" + }, + { + "internalType": "address", + "name": "initialAdmin", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "receipt": { + "to": null, + "from": "0x7074BB056C53ACC0b6091dd3FAe591aa3A4acC88", + "contractAddress": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "transactionIndex": 49, + "gasUsed": "715107", + "logsBloom": "0x0002000080000000000000000000000000000200000000000080000040000000000000000000020000000000000002000000a000060400000020000000040000000010000002000000000000000000880041000000040000000100000000000000000000020000080000000000000800000000000100000080000000000000400000004400100000010000000400005000000800000400000410000000000000200000000100000020000000000000820000000000800000000020080400404000100022000000000001100000000004000000000000010024500000000060200000000000000008000000000000000000000800000000000000000000100080", + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c", + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "logs": [ + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007074bb056c53acc0b6091dd3fae591aa3a4acc88" + ], + "data": "0x", + "logIndex": 225, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + }, + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "topics": [ + "0x59750b13637aff7a39455c6fb86108b91deab78a6d1046f7bd72cfdfae2f4d90" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000001f4", + "logIndex": 226, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + }, + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "topics": [ + "0x6a3bbca20bd7b0c5d945e5bb9afef92d4dccb8dcee37b78dc8e333e847569f80" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000090", + "logIndex": 227, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + }, + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "topics": [ + "0xfc6e32fc7effd308d33dfd4879e53051d8b83cb5d4b7826ff3e38473c0e57dd9", + "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000005" + ], + "data": "0x", + "logIndex": 228, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + }, + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "topics": [ + "0xfc6e32fc7effd308d33dfd4879e53051d8b83cb5d4b7826ff3e38473c0e57dd9", + "0x0000000000000000000000000000000000000000000000000000000000000003", + "0x000000000000000000000000000000000000000000000000000000000000000a" + ], + "data": "0x", + "logIndex": 229, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + }, + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "topics": [ + "0xfc6e32fc7effd308d33dfd4879e53051d8b83cb5d4b7826ff3e38473c0e57dd9", + "0x0000000000000000000000000000000000000000000000000000000000000006", + "0x0000000000000000000000000000000000000000000000000000000000000014" + ], + "data": "0x", + "logIndex": 230, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + }, + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "topics": [ + "0xfc6e32fc7effd308d33dfd4879e53051d8b83cb5d4b7826ff3e38473c0e57dd9", + "0x000000000000000000000000000000000000000000000000000000000000000c", + "0x000000000000000000000000000000000000000000000000000000000000005a" + ], + "data": "0x", + "logIndex": 231, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + }, + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "topics": [ + "0xfc6e32fc7effd308d33dfd4879e53051d8b83cb5d4b7826ff3e38473c0e57dd9", + "0x0000000000000000000000000000000000000000000000000000000000000018", + "0x0000000000000000000000000000000000000000000000000000000000000154" + ], + "data": "0x", + "logIndex": 232, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + }, + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "topics": [ + "0xd91237492a9e30cd2faf361fc103998a382ff0ec2b1b07dc1cbebb76ae2f1ea2", + "0x000000000000000000000000f0511f123164602042ab2bcf02111fa5d3fe97cd" + ], + "data": "0x", + "logIndex": 233, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + }, + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x0000000000000000000000007074bb056c53acc0b6091dd3fae591aa3a4acc88", + "0x000000000000000000000000eedba2484aaf940f37cd3cd21a5d7c4a7dafbfc0" + ], + "data": "0x000000000000000000000000000000000000000000000000004d981e917aff9200000000000000000000000000000000000000000000000120363207a150011b00000000000000000000000000000000000000000000888d6ba8154ab56465d20000000000000000000000000000000000000000000000011fe899e90fd5018900000000000000000000000000000000000000000000888d6bf5ad6946df6564", + "logIndex": 234, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + } + ], + "blockNumber": 45862699, + "cumulativeGasUsed": "9160298", + "status": 1, + "byzantium": true + }, + "args": [ + "0xaA85fc97F9AdBCbdCf6Aded88491bfc6cf8aB49A", + "0x29BeE877F756952cC810c0cF93bF0fC2bF036Fdb", + "0xc7fd66250000000000000000000000008397259c983751daf40400790063935a11afa28a0000000000000000000000009d305a42a3975ee4c1c57555bed5919889dce63f000000000000000000000000f0511f123164602042ab2bcf02111fa5d3fe97cd00000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000154" + ], + "numDeployments": 1, + "solcInputHash": "1635d55d57a0a2552952c0d22586ed23", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialLogic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAdmin\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"stateVariables\":{\"_ADMIN_SLOT\":{\"details\":\"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.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.7/proxy/OptimizedTransparentUpgradeableProxy.sol\":\"OptimizedTransparentUpgradeableProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.7/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n * \\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n * \\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal virtual view returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n * \\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {\\n }\\n}\\n\",\"keccak256\":\"0xc33f9858a67e34c77831163d5611d21fc627dfd2c303806a98a6c9db5a01b034\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/UpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Proxy.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n * \\n * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see\\n * {TransparentUpgradeableProxy}.\\n */\\ncontract UpgradeableProxy is Proxy {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n * \\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _setImplementation(_logic);\\n if(_data.length > 0) {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = _logic.delegatecall(_data);\\n require(success);\\n }\\n }\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal override view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Upgrades the proxy to a new implementation.\\n * \\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"UpgradeableProxy: new implementation is not a contract\\\");\\n\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newImplementation)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd68f4c11941712db79a61b9dca81a5db663cfacec3d7bb19f8d2c23bb1ab8afe\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\\n // for accounts without code, i.e. `keccak256('')`\\n bytes32 codehash;\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { codehash := extcodehash(account) }\\n return (codehash != accountHash && codehash != 0x0);\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return _functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n return _functionCallWithValue(target, data, value, errorMessage);\\n }\\n\\n function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x698f929f1097637d051976b322a2d532c27df022b09010e8d091e2888a5ebdf8\",\"license\":\"MIT\"},\"solc_0.7/proxy/OptimizedTransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.7.0;\\n\\nimport \\\"../openzeppelin/proxy/UpgradeableProxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\\n */\\ncontract OptimizedTransparentUpgradeableProxy is UpgradeableProxy {\\n address internal immutable _ADMIN;\\n\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\\n */\\n constructor(\\n address initialLogic,\\n address initialAdmin,\\n bytes memory _data\\n ) payable UpgradeableProxy(initialLogic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 slot = _ADMIN_SLOT;\\n\\n _ADMIN = initialAdmin;\\n\\n // still store it to work with EIP-1967\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, initialAdmin)\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _admin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address) {\\n return _admin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address) {\\n return _implementation();\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeTo(newImplementation);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeTo(newImplementation);\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, ) = newImplementation.delegatecall(data);\\n require(success);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view returns (address adm) {\\n return _ADMIN;\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _admin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x076456d71495e22183c672db71d719bd2dc7cb3b35e5bba21ce37eea1ec30347\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040526040516108fc3803806108fc8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101e9565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b506001600160601b0319606082901b166080527fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035550610297565b6101fc8161025b60201b6103581760201c565b6102375760405162461bcd60e51b81526004018080602001828103825260368152602001806108c66036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061028f57508115155b949350505050565b60805160601c6106126102b46000398061047352506106126000f3fe6080604052600436106100435760003560e01c80633659cfe61461005a5780634f1ef2861461009a5780635c60da1b14610127578063f851a4401461016557610052565b366100525761005061017a565b005b61005061017a565b34801561006657600080fd5b506100506004803603602081101561007d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610194565b610050600480360360408110156100b057600080fd5b73ffffffffffffffffffffffffffffffffffffffff82351691908101906040810160208201356401000000008111156100e857600080fd5b8201836020820111156100fa57600080fd5b8035906020019184600183028401116401000000008311171561011c57600080fd5b5090925090506101e8565b34801561013357600080fd5b5061013c6102bc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561017157600080fd5b5061013c610313565b610182610394565b61019261018d610428565b61044d565b565b61019c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101dd576101d881610495565b6101e5565b6101e561017a565b50565b6101f0610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102af5761022c83610495565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610296576040519150601f19603f3d011682016040523d82523d6000602084013e61029b565b606091505b50509050806102a957600080fd5b506102b7565b6102b761017a565b505050565b60006102c6610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610428565b9050610310565b61031061017a565b90565b600061031d610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610471565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061038c57508115155b949350505050565b61039c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061059b6042913960600191505060405180910390fd5b610192610192565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561046c573d6000f35b3d6000fd5b7f000000000000000000000000000000000000000000000000000000000000000090565b61049e816104e2565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6104eb81610358565b610540576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806105656036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200f42fc9d1f991236ae26e240c8505def958528031655d7dd335d3988cc0c88f564736f6c634300070600335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374", + "deployedBytecode": "0x6080604052600436106100435760003560e01c80633659cfe61461005a5780634f1ef2861461009a5780635c60da1b14610127578063f851a4401461016557610052565b366100525761005061017a565b005b61005061017a565b34801561006657600080fd5b506100506004803603602081101561007d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610194565b610050600480360360408110156100b057600080fd5b73ffffffffffffffffffffffffffffffffffffffff82351691908101906040810160208201356401000000008111156100e857600080fd5b8201836020820111156100fa57600080fd5b8035906020019184600183028401116401000000008311171561011c57600080fd5b5090925090506101e8565b34801561013357600080fd5b5061013c6102bc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561017157600080fd5b5061013c610313565b610182610394565b61019261018d610428565b61044d565b565b61019c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101dd576101d881610495565b6101e5565b6101e561017a565b50565b6101f0610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102af5761022c83610495565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610296576040519150601f19603f3d011682016040523d82523d6000602084013e61029b565b606091505b50509050806102a957600080fd5b506102b7565b6102b761017a565b505050565b60006102c6610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610428565b9050610310565b61031061017a565b90565b600061031d610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610471565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061038c57508115155b949350505050565b61039c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061059b6042913960600191505060405180910390fd5b610192610192565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561046c573d6000f35b3d6000fd5b7f000000000000000000000000000000000000000000000000000000000000000090565b61049e816104e2565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6104eb81610358565b610540576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806105656036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200f42fc9d1f991236ae26e240c8505def958528031655d7dd335d3988cc0c88f564736f6c63430007060033", + "execute": { + "methodName": "initialize", + "args": [ + "0x8397259c983751DAf40400790063935a11afa28a", + "0x9d305a42A3975Ee4c1C57555BeD5919889DCE63F", + "0xf0511f123164602042ab2bCF02111fA5D3Fe97CD", + 500, + 144, + [ + 5, + 10, + 20, + 90, + 340 + ] + ] + }, + "implementation": "0xaA85fc97F9AdBCbdCf6Aded88491bfc6cf8aB49A", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`" + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "stateVariables": { + "_ADMIN_SLOT": { + "details": "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." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/core/deployments/polygon/PolygonLandTunnelV2_Implementation.json b/packages/core/deployments/polygon/PolygonLandTunnelV2_Implementation.json new file mode 100644 index 0000000000..12008ed8c3 --- /dev/null +++ b/packages/core/deployments/polygon/PolygonLandTunnelV2_Implementation.json @@ -0,0 +1,1016 @@ +{ + "address": "0xaA85fc97F9AdBCbdCf6Aded88491bfc6cf8aB49A", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "size", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "x", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "y", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "name": "MessageSent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint8", + "name": "size", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "uint32", + "name": "limit", + "type": "uint32" + } + ], + "name": "SetGasLimit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "maxLands", + "type": "uint256" + } + ], + "name": "SetMaxAllowedLands", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "maxGasLimit", + "type": "uint32" + } + ], + "name": "SetMaxGasLimit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newForwarder", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "size", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "x", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "y", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "sizes", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "xs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "ys", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "batchTransferQuadToL1", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "childToken", + "outputs": [ + { + "internalType": "contract IPolygonLandV2", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fxChild", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fxRootTunnel", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "gasLimits", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTrustedForwarder", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_fxChild", + "type": "address" + }, + { + "internalType": "contract IPolygonLandV2", + "name": "_childToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_trustedForwarder", + "type": "address" + }, + { + "internalType": "uint32", + "name": "_maxGasLimit", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "_maxAllowedLands", + "type": "uint256" + }, + { + "internalType": "uint32[5]", + "name": "limits", + "type": "uint32[5]" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "forwarder", + "type": "address" + } + ], + "name": "isTrustedForwarder", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxAllowedLands", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxGasLimitOnL1", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721BatchReceived", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "stateId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "rootMessageSender", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "processMessageFromRoot", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_fxRootTunnel", + "type": "address" + } + ], + "name": "setFxRootTunnel", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "size", + "type": "uint8" + }, + { + "internalType": "uint32", + "name": "limit", + "type": "uint32" + } + ], + "name": "setGasLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_maxAllowedLands", + "type": "uint256" + } + ], + "name": "setMaxAllowedLands", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_maxGasLimit", + "type": "uint32" + } + ], + "name": "setMaxLimitOnL1", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "trustedForwarder", + "type": "address" + } + ], + "name": "setTrustedForwarder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32[5]", + "name": "limits", + "type": "uint32[5]" + } + ], + "name": "setupGasLimits", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x95399327a0c107aae40ba523d6404ddccee5c285219629f725096d5b411db32a", + "receipt": { + "to": null, + "from": "0x7074BB056C53ACC0b6091dd3FAe591aa3A4acC88", + "contractAddress": "0xaA85fc97F9AdBCbdCf6Aded88491bfc6cf8aB49A", + "transactionIndex": 59, + "gasUsed": "2228256", + "logsBloom": "0x0000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000800000000000000000000100000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000004000000000000000000001000000000000080000000000000000100000000000000000000000000000000000000000000000000800000004000000000000100020", + "blockHash": "0x5b3fa2561a9f11562775a35283c310c4e0fde6a35db188b8fae044e2a15d57ef", + "transactionHash": "0x95399327a0c107aae40ba523d6404ddccee5c285219629f725096d5b411db32a", + "logs": [ + { + "transactionIndex": 59, + "blockNumber": 45862639, + "transactionHash": "0x95399327a0c107aae40ba523d6404ddccee5c285219629f725096d5b411db32a", + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x0000000000000000000000007074bb056c53acc0b6091dd3fae591aa3a4acc88", + "0x000000000000000000000000127685d6dd6683085da4b6a041efcef1681e5c9c" + ], + "data": "0x00000000000000000000000000000000000000000000000000eb4402c727648000000000000000000000000000000000000000000000000123cd2f5c28f3a35b000000000000000000000000000000000000000000000fc412b0e81ca6e3dfb100000000000000000000000000000000000000000000000122e1eb5961cc3edb000000000000000000000000000000000000000000000fc4139c2c1f6e0b4431", + "logIndex": 270, + "blockHash": "0x5b3fa2561a9f11562775a35283c310c4e0fde6a35db188b8fae044e2a15d57ef" + } + ], + "blockNumber": 45862639, + "cumulativeGasUsed": "11481236", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e1aa5651f7645b1641ef34120369a942", + "metadata": "{\"compiler\":{\"version\":\"0.8.2+commit.661d1103\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"size\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"MessageSent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint8\",\"name\":\"size\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"limit\",\"type\":\"uint32\"}],\"name\":\"SetGasLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxLands\",\"type\":\"uint256\"}],\"name\":\"SetMaxAllowedLands\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"maxGasLimit\",\"type\":\"uint32\"}],\"name\":\"SetMaxGasLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newForwarder\",\"type\":\"address\"}],\"name\":\"TrustedForwarderSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"size\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"sizes\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"xs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"ys\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"batchTransferQuadToL1\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"childToken\",\"outputs\":[{\"internalType\":\"contract IPolygonLandV2\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fxChild\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fxRootTunnel\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"gasLimits\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTrustedForwarder\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fxChild\",\"type\":\"address\"},{\"internalType\":\"contract IPolygonLandV2\",\"name\":\"_childToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_trustedForwarder\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"_maxGasLimit\",\"type\":\"uint32\"},{\"internalType\":\"uint256\",\"name\":\"_maxAllowedLands\",\"type\":\"uint256\"},{\"internalType\":\"uint32[5]\",\"name\":\"limits\",\"type\":\"uint32[5]\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"}],\"name\":\"isTrustedForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxAllowedLands\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxGasLimitOnL1\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC721BatchReceived\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC721Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"stateId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"rootMessageSender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"processMessageFromRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fxRootTunnel\",\"type\":\"address\"}],\"name\":\"setFxRootTunnel\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"size\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"limit\",\"type\":\"uint32\"}],\"name\":\"setGasLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxAllowedLands\",\"type\":\"uint256\"}],\"name\":\"setMaxAllowedLands\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_maxGasLimit\",\"type\":\"uint32\"}],\"name\":\"setMaxLimitOnL1\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"name\":\"setTrustedForwarder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32[5]\",\"name\":\"limits\",\"type\":\"uint32[5]\"}],\"name\":\"setupGasLimits\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"The Sandbox\",\"kind\":\"dev\",\"methods\":{\"batchTransferQuadToL1(address,uint256[],uint256[],uint256[],bytes)\":{\"params\":{\"data\":\"data send to the receiver onERC721BatchReceived on L1\",\"sizes\":\"sizes of quad\",\"to\":\"address of the receiver on L1\",\"xs\":\"x coordinates of quads\",\"ys\":\"y coordinates of quads\"}},\"getTrustedForwarder()\":{\"returns\":{\"_0\":\"trustedForwarder address of the trusted forwarder\"}},\"initialize(address,address,address,uint32,uint256,uint32[5])\":{\"params\":{\"_childToken\":\"address of the token on the child chain\",\"_fxChild\":\"child contract for state receiver\",\"_maxAllowedLands\":\"maximum number of Lands accepted\",\"_maxGasLimit\":\"maximum accepted gas limit\",\"_trustedForwarder\":\"address of an ERC2771 meta transaction sender contract\",\"limits\":\"the estimated gas that the L1 tx will use per quad size\"}},\"isTrustedForwarder(address)\":{\"params\":{\"forwarder\":\"address to check\"},\"returns\":{\"_0\":\"is trusted\"}},\"onERC721BatchReceived(address,address,uint256[],bytes)\":{\"details\":\"called on ERC721 batch transfer to this contract\",\"params\":{\"operator\":\"address of the one sending the ERC721 Token\"},\"returns\":{\"_0\":\"onERC721BatchReceived function selector\"}},\"onERC721Received(address,address,uint256,bytes)\":{\"details\":\"called on ERC721 transfer to this contract\",\"params\":{\"operator\":\"address of the one sending the ERC721 Token\"},\"returns\":{\"_0\":\"onERC721Received function selector\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pause()\":{\"details\":\"Pauses all token transfers across bridge\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setFxRootTunnel(address)\":{\"details\":\"only owner can call this funtion\",\"params\":{\"_fxRootTunnel\":\"address of the fx-root tunnel\"}},\"setGasLimit(uint8,uint32)\":{\"params\":{\"limit\":\"the estimated gas that the L1 tx will use\",\"size\":\"the size of the quad\"}},\"setMaxAllowedLands(uint256)\":{\"params\":{\"_maxAllowedLands\":\"maximum number of lands accepted\"}},\"setMaxLimitOnL1(uint32)\":{\"params\":{\"_maxGasLimit\":\"maximum accepted gas limit\"}},\"setTrustedForwarder(address)\":{\"details\":\"Change the address of the trusted forwarder for meta-TX\",\"params\":{\"trustedForwarder\":\"The new trustedForwarder\"}},\"setupGasLimits(uint32[5])\":{\"params\":{\"limits\":\"the estimated gas that the L1 tx will use per quad size\"}},\"supportsInterface(bytes4)\":{\"details\":\"to be called by external contact to check if this contract supports ERC721 token and batch token receive\",\"params\":{\"interfaceId\":\"the interface to be checked if supported by the contract\"},\"returns\":{\"_0\":\"0x5e8bf644 is the interface of IERC721MandatoryTokenReceiver and 0x01ffc9a7 for the Eip 165 supports interface's interface id\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"unpause()\":{\"details\":\"Unpauses all token transfers across bridge\"}},\"title\":\"PolygonLandTunnelV2\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"batchTransferQuadToL1(address,uint256[],uint256[],uint256[],bytes)\":{\"notice\":\"send a batch of quads to L1\"},\"getTrustedForwarder()\":{\"notice\":\"Get the current trusted forwarder\"},\"initialize(address,address,address,uint32,uint256,uint32[5])\":{\"notice\":\"initialize the contract\"},\"isTrustedForwarder(address)\":{\"notice\":\"Checks if an address is a trusted forwarder\"},\"setFxRootTunnel(address)\":{\"notice\":\"sets the fx-root tunnel\"},\"setGasLimit(uint8,uint32)\":{\"notice\":\"set the estimate of gas that the L1 transaction will use per quad size\"},\"setMaxAllowedLands(uint256)\":{\"notice\":\"set the limit of lands we can send in one tx to L1\"},\"setMaxLimitOnL1(uint32)\":{\"notice\":\"set the limit of estimated gas we accept when sending a batch of quads to L1\"},\"setupGasLimits(uint32[5])\":{\"notice\":\"set the estimate of gas that the L1 transaction will use per quad size\"}},\"notice\":\"LAND tunnel on the child chain\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol\":\"PolygonLandTunnelV2\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@maticnetwork/fx-portal/contracts/tunnel/FxBaseChildTunnel.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\n// IFxMessageProcessor represents interface to process message\\ninterface IFxMessageProcessor {\\n function processMessageFromRoot(\\n uint256 stateId,\\n address rootMessageSender,\\n bytes calldata data\\n ) external;\\n}\\n\\n/**\\n * @notice Mock child tunnel contract to receive and send message from L2\\n */\\nabstract contract FxBaseChildTunnel is IFxMessageProcessor {\\n // MessageTunnel on L1 will get data from this event\\n event MessageSent(bytes message);\\n\\n // fx child\\n address public fxChild;\\n\\n // fx root tunnel\\n address public fxRootTunnel;\\n\\n constructor(address _fxChild) {\\n fxChild = _fxChild;\\n }\\n\\n // Sender must be fxRootTunnel in case of ERC20 tunnel\\n modifier validateSender(address sender) {\\n require(sender == fxRootTunnel, \\\"FxBaseChildTunnel: INVALID_SENDER_FROM_ROOT\\\");\\n _;\\n }\\n\\n // set fxRootTunnel if not set already\\n function setFxRootTunnel(address _fxRootTunnel) external virtual {\\n require(fxRootTunnel == address(0x0), \\\"FxBaseChildTunnel: ROOT_TUNNEL_ALREADY_SET\\\");\\n fxRootTunnel = _fxRootTunnel;\\n }\\n\\n function processMessageFromRoot(\\n uint256 stateId,\\n address rootMessageSender,\\n bytes calldata data\\n ) external override {\\n require(msg.sender == fxChild, \\\"FxBaseChildTunnel: INVALID_SENDER\\\");\\n _processMessageFromRoot(stateId, rootMessageSender, data);\\n }\\n\\n /**\\n * @notice Emit message that can be received on Root Tunnel\\n * @dev Call the internal function when need to emit message\\n * @param message bytes message that will be sent to Root Tunnel\\n * some message examples -\\n * abi.encode(tokenId);\\n * abi.encode(tokenId, tokenMetadata);\\n * abi.encode(messageType, messageData);\\n */\\n function _sendMessageToRoot(bytes memory message) internal {\\n emit MessageSent(message);\\n }\\n\\n /**\\n * @notice Process message received from Root Tunnel\\n * @dev function needs to be implemented to handle message as per requirement\\n * This is called by onStateReceive function.\\n * Since it is called via a system call, any event will not be emitted during its execution.\\n * @param stateId unique state id\\n * @param sender root message sender\\n * @param message bytes message that was sent from Root Tunnel\\n */\\n function _processMessageFromRoot(\\n uint256 stateId,\\n address sender,\\n bytes memory message\\n ) internal virtual;\\n}\\n\",\"keccak256\":\"0x4e102fe11245e851e0f581b1fd4d5a3de2a86254a39e25d7ecc6d4a5947bcbd8\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Context_init_unchained();\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x9ffedb33e192f8821cbaead72596c79ea87fb28a73f8d3a9f5004449799f8e1b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the\\n * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() initializer {}\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n bool private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Modifier to protect an initializer function from being invoked twice.\\n */\\n modifier initializer() {\\n // If the contract is initializing we ignore whether _initialized is set in order to support multiple\\n // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the\\n // contract may have been reentered.\\n require(_initializing ? _isConstructor() : !_initialized, \\\"Initializable: contract is already initialized\\\");\\n\\n bool isTopLevelCall = !_initializing;\\n if (isTopLevelCall) {\\n _initializing = true;\\n _initialized = true;\\n }\\n\\n _;\\n\\n if (isTopLevelCall) {\\n _initializing = false;\\n }\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} modifier, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n function _isConstructor() private view returns (bool) {\\n return !AddressUpgradeable.isContract(address(this));\\n }\\n}\\n\",\"keccak256\":\"0x68861bcc80cacbd498efde75aab6c74a486cc48262660d326c8d7530d9752097\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n function __Pausable_init() internal onlyInitializing {\\n __Context_init_unchained();\\n __Pausable_init_unchained();\\n }\\n\\n function __Pausable_init_unchained() internal onlyInitializing {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n require(!paused(), \\\"Pausable: paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n require(paused(), \\\"Pausable: not paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xf93da311a3b34a8363a759c404d575746fa38351fb29ecd646c608e27219ebec\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3f0f878c796dfc7feba6d3c4e3e526c14c7deae8b7bfc71088e3f38fab0d77b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n __Context_init_unchained();\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x0b0d548f6381370d394f7a434f994dc678b3ef3e755de106109d61343a685ea7\",\"license\":\"MIT\"},\"src/solc_0.8/common/BaseWithStorage/ERC2771Handler.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// solhint-disable-next-line compiler-version\\npragma solidity 0.8.2;\\n\\n/**\\n * @title ERC2771Handler\\n * @author The Sandbox\\n * @notice Handle meta-transactions\\n * @dev minimal ERC2771 handler to keep bytecode-size down\\n * based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.6.0/contracts/metatx/ERC2771Context.sol\\n * with an initializer for proxies and a mutable forwarder\\n */\\nabstract contract ERC2771Handler {\\n address internal _trustedForwarder;\\n\\n event TrustedForwarderSet(address indexed newForwarder);\\n\\n /**\\n * @dev Initializes the contract\\n * @param forwarder trusted forwarder address\\n */\\n function __ERC2771Handler_initialize(address forwarder) internal {\\n _trustedForwarder = forwarder;\\n emit TrustedForwarderSet(_trustedForwarder);\\n }\\n\\n /**\\n * @notice Checks if an address is a trusted forwarder\\n * @param forwarder address to check\\n * @return is trusted\\n */\\n function isTrustedForwarder(address forwarder) public view returns (bool) {\\n return forwarder == _trustedForwarder;\\n }\\n\\n /**\\n * @notice Get the current trusted forwarder\\n * @return trustedForwarder address of the trusted forwarder\\n */\\n function getTrustedForwarder() external view returns (address) {\\n return _trustedForwarder;\\n }\\n\\n /**\\n * @dev if the call comes from the trusted forwarder, it gets the real sender by checking the encoded address in the data\\n * @return sender address of the real sender\\n */\\n function _msgSender() internal view virtual returns (address sender) {\\n if (isTrustedForwarder(msg.sender)) {\\n // The assembly code is more direct than the Solidity version using `abi.decode`.\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\\n }\\n } else {\\n return msg.sender;\\n }\\n }\\n\\n /**\\n * @dev if the call comes from the trusted forwarder, it substracts the sender address from `msg.data` to get the real `msg.data`\\n * @return the real `msg.data`\\n */\\n function _msgData() internal view virtual returns (bytes calldata) {\\n if (isTrustedForwarder(msg.sender)) {\\n return msg.data[:msg.data.length - 20];\\n } else {\\n return msg.data;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x33482ab5e863b2f5cc22fb9e77f8eff3484e08601326989da02ae1b147245669\",\"license\":\"MIT\"},\"src/solc_0.8/common/fx-portal/FxBaseChildTunnelUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\nimport {FxBaseChildTunnel} from \\\"@maticnetwork/fx-portal/contracts/tunnel/FxBaseChildTunnel.sol\\\";\\n\\n/**\\n * @title FxBaseChildTunnelUpgradeable\\n * @author The Sandbox\\n * @dev Upgradeable version of the fx-portal tunnel for the child chain\\n */\\nabstract contract FxBaseChildTunnelUpgradeable is FxBaseChildTunnel {\\n // solhint-disable-next-line no-empty-blocks\\n constructor() FxBaseChildTunnel(address(0)) {}\\n\\n /**\\n * @dev Initializes the contract\\n * @param _fxChild fx child\\n */\\n function __FxBaseChildTunnelUpgradeable_initialize(address _fxChild) internal {\\n fxChild = _fxChild;\\n }\\n\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x2b424e57064c2ca157bd7f12d55b75f87b0d2b3d85c787abcf10cf548b823b4f\",\"license\":\"MIT\"},\"src/solc_0.8/common/interfaces/IERC721MandatoryTokenReceiver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// solhint-disable-next-line compiler-version\\npragma solidity 0.8.2;\\n\\n/**\\n * @title IERC721MandatoryTokenReceiver\\n * @author The Sandbox\\n * @notice Interface for any contract that wants to support safeBatchTransfers\\n * from ERC721 asset contracts.\\n * @dev The ERC-165 identifier for this interface is 0x5e8bf644.\\n */\\ninterface IERC721MandatoryTokenReceiver {\\n /**\\n * @notice Whenever tokens are transferred to this contract via {IERC721-safeBatchTransferFrom}\\n * by `operator` from `from`, this function is called.\\n * @param operator sender\\n * @param from owner of the tokens\\n * @param ids token ids\\n * @param data extra data\\n * @return 0x4b808c46 if the transfer is a success\\n */\\n function onERC721BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) external returns (bytes4); // needs to return 0x4b808c46\\n\\n /**\\n * @notice Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n * @param operator sender\\n * @param from owner of the token\\n * @param tokenId token id\\n * @param data extra data\\n * @return 0x4b808c46 if the transfer is a success\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4); // needs to return 0x150b7a02\\n}\\n\",\"keccak256\":\"0x6e1235c041b7d8747fa458037006e8df72bea62474dd04977e210d19914b7f5d\",\"license\":\"MIT\"},\"src/solc_0.8/common/interfaces/ILandToken.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\n/// @title ILandToken\\n/// @author The Sandbox\\n/// @notice Interface of the LAND token including quad methods\\ninterface ILandToken {\\n /// @notice transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\\n /// @param from current owner of the quad\\n /// @param to destination\\n /// @param sizes list of sizes for each quad\\n /// @param xs list of bottom left x coordinates for each quad\\n /// @param ys list of bottom left y coordinates for each quad\\n /// @param data additional data\\n function batchTransferQuad(\\n address from,\\n address to,\\n uint256[] calldata sizes,\\n uint256[] calldata xs,\\n uint256[] calldata ys,\\n bytes calldata data\\n ) external;\\n\\n /// @notice transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\\n /// @param from current owner of the quad\\n /// @param to destination\\n /// @param size size of the quad\\n /// @param x The top left x coordinate of the quad\\n /// @param y The top left y coordinate of the quad\\n /// @param data additional data\\n function transferQuad(\\n address from,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes calldata data\\n ) external;\\n\\n /// @notice Transfer many tokens between 2 addresses.\\n /// @param from The sender of the token.\\n /// @param to The recipient of the token.\\n /// @param ids The ids of the tokens.\\n /// @param data Additional data.\\n function batchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x5df895e3442904d5f6a6ad3b4b34a2ec61d4a97a4b3feea57d5bb611d14a7e3e\",\"license\":\"MIT\"},\"src/solc_0.8/common/interfaces/IPolygonLand.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\nimport {ILandToken} from \\\"./ILandToken.sol\\\";\\n\\n/**\\n * @title IPolygonLand\\n * @author The Sandbox\\n * @notice Interface of the LAND token on the child chain\\n */\\ninterface IPolygonLand is ILandToken {\\n /**\\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\\n * @param to The recipient of the new quad\\n * @param size The size of the new quad\\n * @param x The top left x coordinate of the new quad\\n * @param y The top left y coordinate of the new quad\\n * @param data extra data to pass to the transfer\\n */\\n function mintQuad(\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes memory data\\n ) external;\\n\\n /**\\n * @notice Checks if a LAND exists by its coordinates\\n * @param size size of the quad\\n * @param x x coordinate\\n * @param y y coordinate\\n * @return does the LAND exist\\n */\\n function exists(\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x725deed21224d8adb2b2cc1dd0615447abee654e519cd9e22ffa505954dfc15d\",\"license\":\"MIT\"},\"src/solc_0.8/common/interfaces/IPolygonLandV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\nimport \\\"./IPolygonLand.sol\\\";\\n\\n/**\\n * @title IPolygonLandV2\\n * @author The Sandbox\\n * @notice interface of the LAND v2 based on IPolygonLand\\n */\\ninterface IPolygonLandV2 is IPolygonLand {\\n /**\\n * @notice checks if an address if an operator\\n * @param who address checked\\n * @return is it super operator\\n */\\n function isSuperOperator(address who) external view returns (bool);\\n\\n /**\\n * @notice checks if a parent quad has child quads already minted.\\n * Then mints the rest child quads and transfers the parent quad.\\n * Should only be called by the tunnel.\\n * @param to The recipient of the new quad\\n * @param size The size of the new quad\\n * @param x The top left x coordinate of the new quad\\n * @param y The top left y coordinate of the new quad\\n * @param data extra data to pass to the transfer\\n */\\n function mintAndTransferQuad(\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xe22361fa285d86bb8986dc25bf0263b2f413eaf99cdf3d616de318541cb8afdc\",\"license\":\"MIT\"},\"src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\nimport {FxBaseChildTunnelUpgradeable} from \\\"../../../common/fx-portal/FxBaseChildTunnelUpgradeable.sol\\\";\\nimport {\\n OwnableUpgradeable,\\n ContextUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {PausableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\\\";\\nimport {IPolygonLandV2} from \\\"../../../common/interfaces/IPolygonLandV2.sol\\\";\\nimport {IERC721MandatoryTokenReceiver} from \\\"../../../common/interfaces/IERC721MandatoryTokenReceiver.sol\\\";\\nimport {ERC2771Handler} from \\\"../../../common/BaseWithStorage/ERC2771Handler.sol\\\";\\n\\n/**\\n * @title PolygonLandTunnelV2\\n * @author The Sandbox\\n * @notice LAND tunnel on the child chain\\n */\\ncontract PolygonLandTunnelV2 is\\n FxBaseChildTunnelUpgradeable,\\n IERC721MandatoryTokenReceiver,\\n ERC2771Handler,\\n OwnableUpgradeable,\\n PausableUpgradeable\\n{\\n bool internal transferringToL1;\\n uint32 public maxGasLimitOnL1;\\n uint256 public maxAllowedLands;\\n IPolygonLandV2 public childToken;\\n\\n mapping(uint8 => uint32) public gasLimits;\\n\\n event SetGasLimit(uint8 indexed size, uint32 indexed limit);\\n event SetMaxGasLimit(uint32 maxGasLimit);\\n event SetMaxAllowedLands(uint256 maxLands);\\n event Deposit(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\\n event Withdraw(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\\n\\n /// @notice initialize the contract\\n /// @param _fxChild child contract for state receiver\\n /// @param _childToken address of the token on the child chain\\n /// @param _trustedForwarder address of an ERC2771 meta transaction sender contract\\n /// @param _maxGasLimit maximum accepted gas limit\\n /// @param _maxAllowedLands maximum number of Lands accepted\\n /// @param limits the estimated gas that the L1 tx will use per quad size\\n function initialize(\\n address _fxChild,\\n IPolygonLandV2 _childToken,\\n address _trustedForwarder,\\n uint32 _maxGasLimit,\\n uint256 _maxAllowedLands,\\n uint32[5] memory limits\\n ) public initializer {\\n __Ownable_init();\\n __Pausable_init();\\n childToken = _childToken;\\n _setMaxLimitOnL1(_maxGasLimit);\\n _setMaxAllowedLands(_maxAllowedLands);\\n setupGasLimits(limits);\\n __FxBaseChildTunnelUpgradeable_initialize(_fxChild);\\n __ERC2771Handler_initialize(_trustedForwarder);\\n }\\n\\n /// @notice set the limit of lands we can send in one tx to L1\\n /// @param _maxAllowedLands maximum number of lands accepted\\n function setMaxAllowedLands(uint256 _maxAllowedLands) external onlyOwner {\\n require(_maxAllowedLands > 0, \\\"PolygonLandTunnelV2: max allowed value cannot be zero\\\");\\n maxAllowedLands = _maxAllowedLands;\\n emit SetMaxAllowedLands(_maxAllowedLands);\\n }\\n\\n /// @notice set the estimate of gas that the L1 transaction will use per quad size\\n /// @param size the size of the quad\\n /// @param limit the estimated gas that the L1 tx will use\\n function setGasLimit(uint8 size, uint32 limit) external onlyOwner {\\n require(size == 1 || size == 3 || size == 6 || size == 12 || size == 24, \\\"PolygonLandTunnelV2: invalid data\\\");\\n\\n _setGasLimit(size, limit);\\n }\\n\\n /// @notice set the estimate of gas that the L1 transaction will use per quad size\\n /// @param limits the estimated gas that the L1 tx will use per quad size\\n function setupGasLimits(uint32[5] memory limits) public onlyOwner {\\n _setGasLimit(1, limits[0]);\\n _setGasLimit(3, limits[1]);\\n _setGasLimit(6, limits[2]);\\n _setGasLimit(12, limits[3]);\\n _setGasLimit(24, limits[4]);\\n }\\n\\n /// @notice send a batch of quads to L1\\n /// @param to address of the receiver on L1\\n /// @param sizes sizes of quad\\n /// @param xs x coordinates of quads\\n /// @param ys y coordinates of quads\\n /// @param data data send to the receiver onERC721BatchReceived on L1\\n function batchTransferQuadToL1(\\n address to,\\n uint256[] calldata sizes,\\n uint256[] calldata xs,\\n uint256[] calldata ys,\\n bytes memory data\\n ) external whenNotPaused() {\\n require(to != address(0), \\\"PolygonLandTunnelV2: can't send to zero address\\\");\\n require(sizes.length == xs.length, \\\"PolygonLandTunnelV2: sizes's and x's length are different\\\");\\n require(sizes.length == ys.length, \\\"PolygonLandTunnelV2: x's and y's length are different\\\");\\n\\n uint32 totalGasLimit = 0;\\n uint256 lands = 0;\\n for (uint256 i = 0; i < sizes.length; i++) {\\n totalGasLimit += gasLimits[uint8(sizes[i])];\\n lands += sizes[i] * sizes[i];\\n }\\n\\n require(lands <= maxAllowedLands, \\\"PolygonLandTunnelV2: Exceeds max allowed lands.\\\");\\n require(totalGasLimit < maxGasLimitOnL1, \\\"PolygonLandTunnelV2: Exceeds gas limit on L1.\\\");\\n transferringToL1 = true;\\n for (uint256 i = 0; i < sizes.length; i++) {\\n childToken.transferQuad(_msgSender(), address(this), sizes[i], xs[i], ys[i], data);\\n emit Withdraw(to, sizes[i], xs[i], ys[i], data);\\n }\\n _sendMessageToRoot(abi.encode(to, sizes, xs, ys, data));\\n transferringToL1 = false;\\n }\\n\\n /// @notice sets the fx-root tunnel\\n /// @dev only owner can call this funtion\\n /// @param _fxRootTunnel address of the fx-root tunnel\\n function setFxRootTunnel(address _fxRootTunnel) external override onlyOwner {\\n require(fxRootTunnel == address(0), \\\"PolygonLandTunnelV2: ROOT_TUNNEL_ALREADY_SET\\\");\\n\\n fxRootTunnel = _fxRootTunnel;\\n }\\n\\n /// @dev Change the address of the trusted forwarder for meta-TX\\n /// @param trustedForwarder The new trustedForwarder\\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\\n _trustedForwarder = trustedForwarder;\\n\\n emit TrustedForwarderSet(trustedForwarder);\\n }\\n\\n /// @notice set the limit of estimated gas we accept when sending a batch of quads to L1\\n /// @param _maxGasLimit maximum accepted gas limit\\n function setMaxLimitOnL1(uint32 _maxGasLimit) external onlyOwner {\\n _setMaxLimitOnL1(_maxGasLimit);\\n }\\n\\n /// @dev Pauses all token transfers across bridge\\n function pause() external onlyOwner {\\n _pause();\\n }\\n\\n /// @dev Unpauses all token transfers across bridge\\n function unpause() external onlyOwner {\\n _unpause();\\n }\\n\\n /// @dev called on ERC721 transfer to this contract\\n /// @param operator address of the one sending the ERC721 Token\\n /// @return onERC721Received function selector\\n function onERC721Received(\\n address operator,\\n address,\\n uint256,\\n bytes calldata\\n ) external view override returns (bytes4) {\\n require(transferringToL1 || childToken.isSuperOperator(operator), \\\"PolygonLandTunnelV2: !BRIDGING\\\");\\n return this.onERC721Received.selector;\\n }\\n\\n /// @dev called on ERC721 batch transfer to this contract\\n /// @param operator address of the one sending the ERC721 Token\\n /// @return onERC721BatchReceived function selector\\n function onERC721BatchReceived(\\n address operator,\\n address,\\n uint256[] calldata,\\n bytes calldata\\n ) external view override returns (bytes4) {\\n require(transferringToL1 || childToken.isSuperOperator(operator), \\\"PolygonLandTunnelV2: !BRIDGING\\\");\\n return this.onERC721BatchReceived.selector;\\n }\\n\\n /// @dev to be called by external contact to check if this contract supports ERC721 token and batch token receive\\n /// @param interfaceId the interface to be checked if supported by the contract\\n /// @return 0x5e8bf644 is the interface of IERC721MandatoryTokenReceiver and 0x01ffc9a7 for the Eip 165 supports interface's interface id\\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\\n return interfaceId == 0x5e8bf644 || interfaceId == 0x01ffc9a7;\\n }\\n\\n function _processMessageFromRoot(\\n uint256,\\n address sender,\\n bytes memory data\\n ) internal override validateSender(sender) {\\n _syncDeposit(data);\\n }\\n\\n function _setMaxLimitOnL1(uint32 _maxGasLimit) internal {\\n maxGasLimitOnL1 = _maxGasLimit;\\n emit SetMaxGasLimit(_maxGasLimit);\\n }\\n\\n function _setMaxAllowedLands(uint256 _maxAllowedLands) internal {\\n require(_maxAllowedLands > 0, \\\"PolygonLandTunnelV2: max allowed value cannot be zero\\\");\\n maxAllowedLands = _maxAllowedLands;\\n emit SetMaxAllowedLands(_maxAllowedLands);\\n }\\n\\n function _syncDeposit(bytes memory syncData) internal {\\n (address to, uint256 size, uint256 x, uint256 y, bytes memory data) =\\n abi.decode(syncData, (address, uint256, uint256, uint256, bytes));\\n childToken.mintAndTransferQuad(to, size, x, y, data);\\n emit Deposit(to, size, x, y, data);\\n }\\n\\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address) {\\n return ERC2771Handler._msgSender();\\n }\\n\\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\\n return ERC2771Handler._msgData();\\n }\\n\\n function _setGasLimit(uint8 size, uint32 limit) internal {\\n gasLimits[size] = limit;\\n emit SetGasLimit(size, limit);\\n }\\n\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x9326c0d24efccdbdc4f6d84ca0d8554c8720deaea27f995326ac9250f575e242\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50600080546001600160a01b031916905561276a806100306000396000f3fe608060405234801561001057600080fd5b50600436106101ae5760003560e01c8063715018a6116100ee578063ac0007de11610097578063da74222811610071578063da742228146103c0578063ee89d41c146103d3578063f2fde38b146103e8578063fe8138c7146103fb576101ae565b8063ac0007de14610389578063c7fd66251461039c578063ce1b815f146103af576101ae565b806388837094116100c857806388837094146103525780638da5cb5b146103655780639a7c4b7114610376576101ae565b8063715018a61461032f5780637f1e9cb0146103375780638456cb591461034a576101ae565b80633f360a401161015b5780634b808c46116101355780634b808c46146102df578063572b6c05146102f25780635c975abb1461031457806366142f371461031c576101ae565b80633f360a40146102995780633f4ba83a146102ac578063450d11f0146102b4576101ae565b8063150b7a021161018c578063150b7a02146102075780631e00b31a1461024b57806321f599f21461025e576101ae565b806301ffc9a7146101b357806308311f1f146101db5780630c9e0557146101f2575b600080fd5b6101c66101c136600461232a565b61040e565b60405190151581526020015b60405180910390f35b6101e460cc5481565b6040519081526020016101d2565b61020561020036600461236a565b6104a9565b005b61021a610215366004612104565b6105d9565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016101d2565b6102056102593660046123dc565b6106f5565b61028461026c3660046123f6565b60ce6020526000908152604090205463ffffffff1681565b60405163ffffffff90911681526020016101d2565b6102056102a7366004612175565b61077a565b610205610d1e565b6000546102c7906001600160a01b031681565b6040516001600160a01b0390911681526020016101d2565b61021a6102ed366004612072565b610da1565b6101c6610300366004611fa3565b6034546001600160a01b0390811691161490565b6101c6610ebe565b61020561032a366004612410565b610ec8565b610205611000565b6001546102c7906001600160a01b031681565b610205611083565b610205610360366004611fa3565b611104565b6067546001600160a01b03166102c7565b610205610384366004612382565b61122b565b60cd546102c7906001600160a01b031681565b6102056103aa36600461227b565b6112f2565b6034546001600160a01b03166102c7565b6102056103ce366004611fa3565b6114d7565b60cb5461028490610100900463ffffffff1681565b6102056103f6366004611fa3565b6115a7565b6102056104093660046122ef565b6116a5565b60007f5e8bf644000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614806104a157507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b90505b919050565b6104b1611765565b6001600160a01b03166104cc6067546001600160a01b031690565b6001600160a01b0316146105275760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6000811161059d5760405162461bcd60e51b815260206004820152603560248201527f506f6c79676f6e4c616e6454756e6e656c56323a206d617820616c6c6f77656460448201527f2076616c75652063616e6e6f74206265207a65726f0000000000000000000000606482015260840161051e565b60cc8190556040518181527f6a3bbca20bd7b0c5d945e5bb9afef92d4dccb8dcee37b78dc8e333e847569f80906020015b60405180910390a150565b60cb5460009060ff168061067e575060cd546040517f654b748a0000000000000000000000000000000000000000000000000000000081526001600160a01b0388811660048301529091169063654b748a9060240160206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067e919061230a565b6106ca5760405162461bcd60e51b815260206004820152601e60248201527f506f6c79676f6e4c616e6454756e6e656c56323a20214252494447494e470000604482015260640161051e565b507f150b7a020000000000000000000000000000000000000000000000000000000095945050505050565b6106fd611765565b6001600160a01b03166107186067546001600160a01b031690565b6001600160a01b03161461076e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051e565b61077781611774565b50565b610782610ebe565b156107cf5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161051e565b6001600160a01b03881661084b5760405162461bcd60e51b815260206004820152602f60248201527f506f6c79676f6e4c616e6454756e6e656c56323a2063616e27742073656e642060448201527f746f207a65726f20616464726573730000000000000000000000000000000000606482015260840161051e565b8584146108c05760405162461bcd60e51b815260206004820152603960248201527f506f6c79676f6e4c616e6454756e6e656c56323a2073697a6573277320616e6460448201527f20782773206c656e6774682061726520646966666572656e7400000000000000606482015260840161051e565b8582146109355760405162461bcd60e51b815260206004820152603560248201527f506f6c79676f6e4c616e6454756e6e656c56323a2078277320616e642079277360448201527f206c656e6774682061726520646966666572656e740000000000000000000000606482015260840161051e565b60008060005b88811015610a0c5760ce60008b8b8481811061096757634e487b7160e01b600052603260045260246000fd5b6020908102929092013560ff16835250810191909152604001600020546109949063ffffffff1684612665565b92508989828181106109b657634e487b7160e01b600052603260045260246000fd5b905060200201358a8a838181106109dd57634e487b7160e01b600052603260045260246000fd5b905060200201356109ee919061268d565b6109f8908361264d565b915080610a04816126d8565b91505061093b565b5060cc54811115610a855760405162461bcd60e51b815260206004820152602f60248201527f506f6c79676f6e4c616e6454756e6e656c56323a2045786365656473206d617860448201527f20616c6c6f776564206c616e64732e0000000000000000000000000000000000606482015260840161051e565b60cb5463ffffffff610100909104811690831610610b0b5760405162461bcd60e51b815260206004820152602d60248201527f506f6c79676f6e4c616e6454756e6e656c56323a20457863656564732067617360448201527f206c696d6974206f6e204c312e00000000000000000000000000000000000000606482015260840161051e565b60cb805460ff1916600117905560005b88811015610cd15760cd546001600160a01b03166338bb305a610b3c611765565b308d8d86818110610b5d57634e487b7160e01b600052603260045260246000fd5b905060200201358c8c87818110610b8457634e487b7160e01b600052603260045260246000fd5b905060200201358b8b88818110610bab57634e487b7160e01b600052603260045260246000fd5b905060200201358a6040518763ffffffff1660e01b8152600401610bd4969594939291906124bb565b600060405180830381600087803b158015610bee57600080fd5b505af1158015610c02573d6000803e3d6000fd5b505050508a6001600160a01b03167f91ee42a3ae048785d7370790775b6bf02c58c5d7bfb5de80f6d7cb27e46a207e8b8b84818110610c5157634e487b7160e01b600052603260045260246000fd5b905060200201358a8a85818110610c7857634e487b7160e01b600052603260045260246000fd5b90506020020135898986818110610c9f57634e487b7160e01b600052603260045260246000fd5b9050602002013588604051610cb794939291906125c5565b60405180910390a280610cc9816126d8565b915050610b1b565b50610d088a8a8a8a8a8a8a8a604051602001610cf4989796959493929190612505565b6040516020818303038152906040526117de565b505060cb805460ff191690555050505050505050565b610d26611765565b6001600160a01b0316610d416067546001600160a01b031690565b6001600160a01b031614610d975760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051e565b610d9f61180d565b565b60cb5460009060ff1680610e46575060cd546040517f654b748a0000000000000000000000000000000000000000000000000000000081526001600160a01b0389811660048301529091169063654b748a9060240160206040518083038186803b158015610e0e57600080fd5b505afa158015610e22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e46919061230a565b610e925760405162461bcd60e51b815260206004820152601e60248201527f506f6c79676f6e4c616e6454756e6e656c56323a20214252494447494e470000604482015260640161051e565b507f4b808c46000000000000000000000000000000000000000000000000000000009695505050505050565b60995460ff165b90565b610ed0611765565b6001600160a01b0316610eeb6067546001600160a01b031690565b6001600160a01b031614610f415760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051e565b8160ff1660011480610f5657508160ff166003145b80610f6457508160ff166006145b80610f7257508160ff16600c145b80610f8057508160ff166018145b610ff25760405162461bcd60e51b815260206004820152602160248201527f506f6c79676f6e4c616e6454756e6e656c56323a20696e76616c69642064617460448201527f6100000000000000000000000000000000000000000000000000000000000000606482015260840161051e565b610ffc82826118b1565b5050565b611008611765565b6001600160a01b03166110236067546001600160a01b031690565b6001600160a01b0316146110795760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051e565b610d9f6000611921565b61108b611765565b6001600160a01b03166110a66067546001600160a01b031690565b6001600160a01b0316146110fc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051e565b610d9f611980565b61110c611765565b6001600160a01b03166111276067546001600160a01b031690565b6001600160a01b03161461117d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051e565b6001546001600160a01b0316156111fc5760405162461bcd60e51b815260206004820152602c60248201527f506f6c79676f6e4c616e6454756e6e656c56323a20524f4f545f54554e4e454c60448201527f5f414c52454144595f5345540000000000000000000000000000000000000000606482015260840161051e565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546001600160a01b031633146112ab5760405162461bcd60e51b815260206004820152602160248201527f4678426173654368696c6454756e6e656c3a20494e56414c49445f53454e444560448201527f5200000000000000000000000000000000000000000000000000000000000000606482015260840161051e565b6112ec848484848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a0b92505050565b50505050565b603454600160a81b900460ff166113275760345474010000000000000000000000000000000000000000900460ff161561132b565b303b155b61139d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161051e565b603454600160a81b900460ff1615801561141b57603480547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff909116600160a81b1716740100000000000000000000000000000000000000001790555b611423611a99565b61142b611b16565b60cd805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03881617905561145c84611774565b61146583610527565b61146e826116a5565b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03891617905561149f85611b93565b80156114ce57603480547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff1690555b50505050505050565b6114df611765565b6001600160a01b03166114fa6067546001600160a01b031690565b6001600160a01b0316146115505760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051e565b6034805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517fd91237492a9e30cd2faf361fc103998a382ff0ec2b1b07dc1cbebb76ae2f1ea290600090a250565b6115af611765565b6001600160a01b03166115ca6067546001600160a01b031690565b6001600160a01b0316146116205760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051e565b6001600160a01b03811661169c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161051e565b61077781611921565b6116ad611765565b6001600160a01b03166116c86067546001600160a01b031690565b6001600160a01b03161461171e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051e565b61173160018260005b60200201516118b1565b61173e6003826001611727565b61174b6006826002611727565b611758600c826003611727565b6107776018826004611727565b600061176f611bf0565b905090565b60cb80547fffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000ff1661010063ffffffff8416908102919091179091556040519081527f59750b13637aff7a39455c6fb86108b91deab78a6d1046f7bd72cfdfae2f4d90906020016105ce565b7f8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036816040516105ce91906125b2565b611815610ebe565b6118615760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161051e565b6099805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611894611765565b6040516001600160a01b03909116815260200160405180910390a1565b60ff8216600081815260ce602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff861690811790915590519092917ffc6e32fc7effd308d33dfd4879e53051d8b83cb5d4b7826ff3e38473c0e57dd991a35050565b606780546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611988610ebe565b156119d55760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161051e565b6099805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611894611765565b60015482906001600160a01b03808316911614611a905760405162461bcd60e51b815260206004820152602b60248201527f4678426173654368696c6454756e6e656c3a20494e56414c49445f53454e444560448201527f525f46524f4d5f524f4f54000000000000000000000000000000000000000000606482015260840161051e565b6112ec82611c3a565b603454600160a81b900460ff16611b065760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161051e565b611b0e611d33565b610d9f611da0565b603454600160a81b900460ff16611b835760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161051e565b611b8b611d33565b610d9f611e1d565b6034805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383811691909117918290556040519116907fd91237492a9e30cd2faf361fc103998a382ff0ec2b1b07dc1cbebb76ae2f1ea290600090a250565b6034546000906001600160a01b0316331415611c3357507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c610ec5565b5033610ec5565b600080600080600085806020019051810190611c569190611fc6565b60cd546040517f4e6a0f44000000000000000000000000000000000000000000000000000000008152959a50939850919650945092506001600160a01b031690634e6a0f4490611cb29088908890889088908890600401612573565b600060405180830381600087803b158015611ccc57600080fd5b505af1158015611ce0573d6000803e3d6000fd5b50505050846001600160a01b03167f86beac9ed9e1aa4efb77b948567a4c352c177bb58b134f4c9d0d92c2c8ffbfb185858585604051611d2394939291906125c5565b60405180910390a2505050505050565b603454600160a81b900460ff16610d9f5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161051e565b603454600160a81b900460ff16611e0d5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161051e565b610d9f611e18611765565b611921565b603454600160a81b900460ff16611e8a5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161051e565b6099805460ff19169055565b60008083601f840112611ea7578182fd5b50813567ffffffffffffffff811115611ebe578182fd5b6020830191508360208083028501011115611ed857600080fd5b9250929050565b600082601f830112611eef578081fd5b611ef960a06125f4565b80838560a086011115611f0a578384fd5b835b6005811015611f3357611f1e82611f7e565b84526020938401939190910190600101611f0c565b509095945050505050565b60008083601f840112611f4f578182fd5b50813567ffffffffffffffff811115611f66578182fd5b602083019150836020828501011115611ed857600080fd5b803563ffffffff811681146104a457600080fd5b803560ff811681146104a457600080fd5b600060208284031215611fb4578081fd5b8135611fbf8161271f565b9392505050565b600080600080600060a08688031215611fdd578081fd5b8551611fe88161271f565b80955050602086015193506040860151925060608601519150608086015167ffffffffffffffff81111561201a578182fd5b8601601f8101881361202a578182fd5b805161203d61203882612625565b6125f4565b818152896020838501011115612051578384fd5b6120628260208301602086016126ac565b8093505050509295509295909350565b6000806000806000806080878903121561208a578081fd5b86356120958161271f565b955060208701356120a58161271f565b9450604087013567ffffffffffffffff808211156120c1578283fd5b6120cd8a838b01611e96565b909650945060608901359150808211156120e5578283fd5b506120f289828a01611f3e565b979a9699509497509295939492505050565b60008060008060006080868803121561211b578081fd5b85356121268161271f565b945060208601356121368161271f565b935060408601359250606086013567ffffffffffffffff811115612158578182fd5b61216488828901611f3e565b969995985093965092949392505050565b60008060008060008060008060a0898b031215612190578182fd5b883561219b8161271f565b9750602089013567ffffffffffffffff808211156121b7578384fd5b6121c38c838d01611e96565b909950975060408b01359150808211156121db578384fd5b6121e78c838d01611e96565b909750955060608b01359150808211156121ff578384fd5b61220b8c838d01611e96565b909550935060808b0135915080821115612223578283fd5b508901601f81018b13612234578182fd5b803561224261203882612625565b8181528c6020838501011115612256578384fd5b8160208401602083013783602083830101528093505050509295985092959890939650565b6000806000806000806101408789031215612294578384fd5b863561229f8161271f565b955060208701356122af8161271f565b945060408701356122bf8161271f565b93506122cd60608801611f7e565b9250608087013591506122e38860a08901611edf565b90509295509295509295565b600060a08284031215612300578081fd5b611fbf8383611edf565b60006020828403121561231b578081fd5b81518015158114611fbf578182fd5b60006020828403121561233b578081fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611fbf578182fd5b60006020828403121561237b578081fd5b5035919050565b60008060008060608587031215612397578182fd5b8435935060208501356123a98161271f565b9250604085013567ffffffffffffffff8111156123c4578283fd5b6123d087828801611f3e565b95989497509550505050565b6000602082840312156123ed578081fd5b611fbf82611f7e565b600060208284031215612407578081fd5b611fbf82611f92565b60008060408385031215612422578182fd5b61242b83611f92565b915061243960208401611f7e565b90509250929050565b60008284527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115612473578081fd5b6020830280836020870137939093016020019283525090919050565b600081518084526124a78160208601602086016126ac565b601f01601f19169290920160200192915050565b60006001600160a01b03808916835280881660208401525085604083015284606083015283608083015260c060a08301526124f960c083018461248f565b98975050505050505050565b60006001600160a01b038a16825260a0602083015261252860a08301898b612442565b828103604084015261253b81888a612442565b90508281036060840152612550818688612442565b90508281036080840152612564818561248f565b9b9a5050505050505050505050565b60006001600160a01b038716825285602083015284604083015283606083015260a060808301526125a760a083018461248f565b979650505050505050565b600060208252611fbf602083018461248f565b6000858252846020830152836040830152608060608301526125ea608083018461248f565b9695505050505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561261d5761261d612709565b604052919050565b600067ffffffffffffffff82111561263f5761263f612709565b50601f01601f191660200190565b60008219821115612660576126606126f3565b500190565b600063ffffffff808316818516808303821115612684576126846126f3565b01949350505050565b60008160001904831182151516156126a7576126a76126f3565b500290565b60005b838110156126c75781810151838201526020016126af565b838111156112ec5750506000910152565b60006000198214156126ec576126ec6126f3565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461077757600080fdfea2646970667358221220a8653a7d556bc5df1758492a85ebf04c8af9ce6be964608ffa4d9183c31e966764736f6c63430008020033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101ae5760003560e01c8063715018a6116100ee578063ac0007de11610097578063da74222811610071578063da742228146103c0578063ee89d41c146103d3578063f2fde38b146103e8578063fe8138c7146103fb576101ae565b8063ac0007de14610389578063c7fd66251461039c578063ce1b815f146103af576101ae565b806388837094116100c857806388837094146103525780638da5cb5b146103655780639a7c4b7114610376576101ae565b8063715018a61461032f5780637f1e9cb0146103375780638456cb591461034a576101ae565b80633f360a401161015b5780634b808c46116101355780634b808c46146102df578063572b6c05146102f25780635c975abb1461031457806366142f371461031c576101ae565b80633f360a40146102995780633f4ba83a146102ac578063450d11f0146102b4576101ae565b8063150b7a021161018c578063150b7a02146102075780631e00b31a1461024b57806321f599f21461025e576101ae565b806301ffc9a7146101b357806308311f1f146101db5780630c9e0557146101f2575b600080fd5b6101c66101c136600461232a565b61040e565b60405190151581526020015b60405180910390f35b6101e460cc5481565b6040519081526020016101d2565b61020561020036600461236a565b6104a9565b005b61021a610215366004612104565b6105d9565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016101d2565b6102056102593660046123dc565b6106f5565b61028461026c3660046123f6565b60ce6020526000908152604090205463ffffffff1681565b60405163ffffffff90911681526020016101d2565b6102056102a7366004612175565b61077a565b610205610d1e565b6000546102c7906001600160a01b031681565b6040516001600160a01b0390911681526020016101d2565b61021a6102ed366004612072565b610da1565b6101c6610300366004611fa3565b6034546001600160a01b0390811691161490565b6101c6610ebe565b61020561032a366004612410565b610ec8565b610205611000565b6001546102c7906001600160a01b031681565b610205611083565b610205610360366004611fa3565b611104565b6067546001600160a01b03166102c7565b610205610384366004612382565b61122b565b60cd546102c7906001600160a01b031681565b6102056103aa36600461227b565b6112f2565b6034546001600160a01b03166102c7565b6102056103ce366004611fa3565b6114d7565b60cb5461028490610100900463ffffffff1681565b6102056103f6366004611fa3565b6115a7565b6102056104093660046122ef565b6116a5565b60007f5e8bf644000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614806104a157507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b90505b919050565b6104b1611765565b6001600160a01b03166104cc6067546001600160a01b031690565b6001600160a01b0316146105275760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6000811161059d5760405162461bcd60e51b815260206004820152603560248201527f506f6c79676f6e4c616e6454756e6e656c56323a206d617820616c6c6f77656460448201527f2076616c75652063616e6e6f74206265207a65726f0000000000000000000000606482015260840161051e565b60cc8190556040518181527f6a3bbca20bd7b0c5d945e5bb9afef92d4dccb8dcee37b78dc8e333e847569f80906020015b60405180910390a150565b60cb5460009060ff168061067e575060cd546040517f654b748a0000000000000000000000000000000000000000000000000000000081526001600160a01b0388811660048301529091169063654b748a9060240160206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067e919061230a565b6106ca5760405162461bcd60e51b815260206004820152601e60248201527f506f6c79676f6e4c616e6454756e6e656c56323a20214252494447494e470000604482015260640161051e565b507f150b7a020000000000000000000000000000000000000000000000000000000095945050505050565b6106fd611765565b6001600160a01b03166107186067546001600160a01b031690565b6001600160a01b03161461076e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051e565b61077781611774565b50565b610782610ebe565b156107cf5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161051e565b6001600160a01b03881661084b5760405162461bcd60e51b815260206004820152602f60248201527f506f6c79676f6e4c616e6454756e6e656c56323a2063616e27742073656e642060448201527f746f207a65726f20616464726573730000000000000000000000000000000000606482015260840161051e565b8584146108c05760405162461bcd60e51b815260206004820152603960248201527f506f6c79676f6e4c616e6454756e6e656c56323a2073697a6573277320616e6460448201527f20782773206c656e6774682061726520646966666572656e7400000000000000606482015260840161051e565b8582146109355760405162461bcd60e51b815260206004820152603560248201527f506f6c79676f6e4c616e6454756e6e656c56323a2078277320616e642079277360448201527f206c656e6774682061726520646966666572656e740000000000000000000000606482015260840161051e565b60008060005b88811015610a0c5760ce60008b8b8481811061096757634e487b7160e01b600052603260045260246000fd5b6020908102929092013560ff16835250810191909152604001600020546109949063ffffffff1684612665565b92508989828181106109b657634e487b7160e01b600052603260045260246000fd5b905060200201358a8a838181106109dd57634e487b7160e01b600052603260045260246000fd5b905060200201356109ee919061268d565b6109f8908361264d565b915080610a04816126d8565b91505061093b565b5060cc54811115610a855760405162461bcd60e51b815260206004820152602f60248201527f506f6c79676f6e4c616e6454756e6e656c56323a2045786365656473206d617860448201527f20616c6c6f776564206c616e64732e0000000000000000000000000000000000606482015260840161051e565b60cb5463ffffffff610100909104811690831610610b0b5760405162461bcd60e51b815260206004820152602d60248201527f506f6c79676f6e4c616e6454756e6e656c56323a20457863656564732067617360448201527f206c696d6974206f6e204c312e00000000000000000000000000000000000000606482015260840161051e565b60cb805460ff1916600117905560005b88811015610cd15760cd546001600160a01b03166338bb305a610b3c611765565b308d8d86818110610b5d57634e487b7160e01b600052603260045260246000fd5b905060200201358c8c87818110610b8457634e487b7160e01b600052603260045260246000fd5b905060200201358b8b88818110610bab57634e487b7160e01b600052603260045260246000fd5b905060200201358a6040518763ffffffff1660e01b8152600401610bd4969594939291906124bb565b600060405180830381600087803b158015610bee57600080fd5b505af1158015610c02573d6000803e3d6000fd5b505050508a6001600160a01b03167f91ee42a3ae048785d7370790775b6bf02c58c5d7bfb5de80f6d7cb27e46a207e8b8b84818110610c5157634e487b7160e01b600052603260045260246000fd5b905060200201358a8a85818110610c7857634e487b7160e01b600052603260045260246000fd5b90506020020135898986818110610c9f57634e487b7160e01b600052603260045260246000fd5b9050602002013588604051610cb794939291906125c5565b60405180910390a280610cc9816126d8565b915050610b1b565b50610d088a8a8a8a8a8a8a8a604051602001610cf4989796959493929190612505565b6040516020818303038152906040526117de565b505060cb805460ff191690555050505050505050565b610d26611765565b6001600160a01b0316610d416067546001600160a01b031690565b6001600160a01b031614610d975760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051e565b610d9f61180d565b565b60cb5460009060ff1680610e46575060cd546040517f654b748a0000000000000000000000000000000000000000000000000000000081526001600160a01b0389811660048301529091169063654b748a9060240160206040518083038186803b158015610e0e57600080fd5b505afa158015610e22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e46919061230a565b610e925760405162461bcd60e51b815260206004820152601e60248201527f506f6c79676f6e4c616e6454756e6e656c56323a20214252494447494e470000604482015260640161051e565b507f4b808c46000000000000000000000000000000000000000000000000000000009695505050505050565b60995460ff165b90565b610ed0611765565b6001600160a01b0316610eeb6067546001600160a01b031690565b6001600160a01b031614610f415760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051e565b8160ff1660011480610f5657508160ff166003145b80610f6457508160ff166006145b80610f7257508160ff16600c145b80610f8057508160ff166018145b610ff25760405162461bcd60e51b815260206004820152602160248201527f506f6c79676f6e4c616e6454756e6e656c56323a20696e76616c69642064617460448201527f6100000000000000000000000000000000000000000000000000000000000000606482015260840161051e565b610ffc82826118b1565b5050565b611008611765565b6001600160a01b03166110236067546001600160a01b031690565b6001600160a01b0316146110795760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051e565b610d9f6000611921565b61108b611765565b6001600160a01b03166110a66067546001600160a01b031690565b6001600160a01b0316146110fc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051e565b610d9f611980565b61110c611765565b6001600160a01b03166111276067546001600160a01b031690565b6001600160a01b03161461117d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051e565b6001546001600160a01b0316156111fc5760405162461bcd60e51b815260206004820152602c60248201527f506f6c79676f6e4c616e6454756e6e656c56323a20524f4f545f54554e4e454c60448201527f5f414c52454144595f5345540000000000000000000000000000000000000000606482015260840161051e565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546001600160a01b031633146112ab5760405162461bcd60e51b815260206004820152602160248201527f4678426173654368696c6454756e6e656c3a20494e56414c49445f53454e444560448201527f5200000000000000000000000000000000000000000000000000000000000000606482015260840161051e565b6112ec848484848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a0b92505050565b50505050565b603454600160a81b900460ff166113275760345474010000000000000000000000000000000000000000900460ff161561132b565b303b155b61139d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161051e565b603454600160a81b900460ff1615801561141b57603480547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff909116600160a81b1716740100000000000000000000000000000000000000001790555b611423611a99565b61142b611b16565b60cd805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03881617905561145c84611774565b61146583610527565b61146e826116a5565b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03891617905561149f85611b93565b80156114ce57603480547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff1690555b50505050505050565b6114df611765565b6001600160a01b03166114fa6067546001600160a01b031690565b6001600160a01b0316146115505760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051e565b6034805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517fd91237492a9e30cd2faf361fc103998a382ff0ec2b1b07dc1cbebb76ae2f1ea290600090a250565b6115af611765565b6001600160a01b03166115ca6067546001600160a01b031690565b6001600160a01b0316146116205760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051e565b6001600160a01b03811661169c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161051e565b61077781611921565b6116ad611765565b6001600160a01b03166116c86067546001600160a01b031690565b6001600160a01b03161461171e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051e565b61173160018260005b60200201516118b1565b61173e6003826001611727565b61174b6006826002611727565b611758600c826003611727565b6107776018826004611727565b600061176f611bf0565b905090565b60cb80547fffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000ff1661010063ffffffff8416908102919091179091556040519081527f59750b13637aff7a39455c6fb86108b91deab78a6d1046f7bd72cfdfae2f4d90906020016105ce565b7f8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036816040516105ce91906125b2565b611815610ebe565b6118615760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161051e565b6099805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611894611765565b6040516001600160a01b03909116815260200160405180910390a1565b60ff8216600081815260ce602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff861690811790915590519092917ffc6e32fc7effd308d33dfd4879e53051d8b83cb5d4b7826ff3e38473c0e57dd991a35050565b606780546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611988610ebe565b156119d55760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161051e565b6099805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611894611765565b60015482906001600160a01b03808316911614611a905760405162461bcd60e51b815260206004820152602b60248201527f4678426173654368696c6454756e6e656c3a20494e56414c49445f53454e444560448201527f525f46524f4d5f524f4f54000000000000000000000000000000000000000000606482015260840161051e565b6112ec82611c3a565b603454600160a81b900460ff16611b065760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161051e565b611b0e611d33565b610d9f611da0565b603454600160a81b900460ff16611b835760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161051e565b611b8b611d33565b610d9f611e1d565b6034805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383811691909117918290556040519116907fd91237492a9e30cd2faf361fc103998a382ff0ec2b1b07dc1cbebb76ae2f1ea290600090a250565b6034546000906001600160a01b0316331415611c3357507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c610ec5565b5033610ec5565b600080600080600085806020019051810190611c569190611fc6565b60cd546040517f4e6a0f44000000000000000000000000000000000000000000000000000000008152959a50939850919650945092506001600160a01b031690634e6a0f4490611cb29088908890889088908890600401612573565b600060405180830381600087803b158015611ccc57600080fd5b505af1158015611ce0573d6000803e3d6000fd5b50505050846001600160a01b03167f86beac9ed9e1aa4efb77b948567a4c352c177bb58b134f4c9d0d92c2c8ffbfb185858585604051611d2394939291906125c5565b60405180910390a2505050505050565b603454600160a81b900460ff16610d9f5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161051e565b603454600160a81b900460ff16611e0d5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161051e565b610d9f611e18611765565b611921565b603454600160a81b900460ff16611e8a5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161051e565b6099805460ff19169055565b60008083601f840112611ea7578182fd5b50813567ffffffffffffffff811115611ebe578182fd5b6020830191508360208083028501011115611ed857600080fd5b9250929050565b600082601f830112611eef578081fd5b611ef960a06125f4565b80838560a086011115611f0a578384fd5b835b6005811015611f3357611f1e82611f7e565b84526020938401939190910190600101611f0c565b509095945050505050565b60008083601f840112611f4f578182fd5b50813567ffffffffffffffff811115611f66578182fd5b602083019150836020828501011115611ed857600080fd5b803563ffffffff811681146104a457600080fd5b803560ff811681146104a457600080fd5b600060208284031215611fb4578081fd5b8135611fbf8161271f565b9392505050565b600080600080600060a08688031215611fdd578081fd5b8551611fe88161271f565b80955050602086015193506040860151925060608601519150608086015167ffffffffffffffff81111561201a578182fd5b8601601f8101881361202a578182fd5b805161203d61203882612625565b6125f4565b818152896020838501011115612051578384fd5b6120628260208301602086016126ac565b8093505050509295509295909350565b6000806000806000806080878903121561208a578081fd5b86356120958161271f565b955060208701356120a58161271f565b9450604087013567ffffffffffffffff808211156120c1578283fd5b6120cd8a838b01611e96565b909650945060608901359150808211156120e5578283fd5b506120f289828a01611f3e565b979a9699509497509295939492505050565b60008060008060006080868803121561211b578081fd5b85356121268161271f565b945060208601356121368161271f565b935060408601359250606086013567ffffffffffffffff811115612158578182fd5b61216488828901611f3e565b969995985093965092949392505050565b60008060008060008060008060a0898b031215612190578182fd5b883561219b8161271f565b9750602089013567ffffffffffffffff808211156121b7578384fd5b6121c38c838d01611e96565b909950975060408b01359150808211156121db578384fd5b6121e78c838d01611e96565b909750955060608b01359150808211156121ff578384fd5b61220b8c838d01611e96565b909550935060808b0135915080821115612223578283fd5b508901601f81018b13612234578182fd5b803561224261203882612625565b8181528c6020838501011115612256578384fd5b8160208401602083013783602083830101528093505050509295985092959890939650565b6000806000806000806101408789031215612294578384fd5b863561229f8161271f565b955060208701356122af8161271f565b945060408701356122bf8161271f565b93506122cd60608801611f7e565b9250608087013591506122e38860a08901611edf565b90509295509295509295565b600060a08284031215612300578081fd5b611fbf8383611edf565b60006020828403121561231b578081fd5b81518015158114611fbf578182fd5b60006020828403121561233b578081fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611fbf578182fd5b60006020828403121561237b578081fd5b5035919050565b60008060008060608587031215612397578182fd5b8435935060208501356123a98161271f565b9250604085013567ffffffffffffffff8111156123c4578283fd5b6123d087828801611f3e565b95989497509550505050565b6000602082840312156123ed578081fd5b611fbf82611f7e565b600060208284031215612407578081fd5b611fbf82611f92565b60008060408385031215612422578182fd5b61242b83611f92565b915061243960208401611f7e565b90509250929050565b60008284527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115612473578081fd5b6020830280836020870137939093016020019283525090919050565b600081518084526124a78160208601602086016126ac565b601f01601f19169290920160200192915050565b60006001600160a01b03808916835280881660208401525085604083015284606083015283608083015260c060a08301526124f960c083018461248f565b98975050505050505050565b60006001600160a01b038a16825260a0602083015261252860a08301898b612442565b828103604084015261253b81888a612442565b90508281036060840152612550818688612442565b90508281036080840152612564818561248f565b9b9a5050505050505050505050565b60006001600160a01b038716825285602083015284604083015283606083015260a060808301526125a760a083018461248f565b979650505050505050565b600060208252611fbf602083018461248f565b6000858252846020830152836040830152608060608301526125ea608083018461248f565b9695505050505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561261d5761261d612709565b604052919050565b600067ffffffffffffffff82111561263f5761263f612709565b50601f01601f191660200190565b60008219821115612660576126606126f3565b500190565b600063ffffffff808316818516808303821115612684576126846126f3565b01949350505050565b60008160001904831182151516156126a7576126a76126f3565b500290565b60005b838110156126c75781810151838201526020016126af565b838111156112ec5750506000910152565b60006000198214156126ec576126ec6126f3565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461077757600080fdfea2646970667358221220a8653a7d556bc5df1758492a85ebf04c8af9ce6be964608ffa4d9183c31e966764736f6c63430008020033", + "devdoc": { + "author": "The Sandbox", + "kind": "dev", + "methods": { + "batchTransferQuadToL1(address,uint256[],uint256[],uint256[],bytes)": { + "params": { + "data": "data send to the receiver onERC721BatchReceived on L1", + "sizes": "sizes of quad", + "to": "address of the receiver on L1", + "xs": "x coordinates of quads", + "ys": "y coordinates of quads" + } + }, + "getTrustedForwarder()": { + "returns": { + "_0": "trustedForwarder address of the trusted forwarder" + } + }, + "initialize(address,address,address,uint32,uint256,uint32[5])": { + "params": { + "_childToken": "address of the token on the child chain", + "_fxChild": "child contract for state receiver", + "_maxAllowedLands": "maximum number of Lands accepted", + "_maxGasLimit": "maximum accepted gas limit", + "_trustedForwarder": "address of an ERC2771 meta transaction sender contract", + "limits": "the estimated gas that the L1 tx will use per quad size" + } + }, + "isTrustedForwarder(address)": { + "params": { + "forwarder": "address to check" + }, + "returns": { + "_0": "is trusted" + } + }, + "onERC721BatchReceived(address,address,uint256[],bytes)": { + "details": "called on ERC721 batch transfer to this contract", + "params": { + "operator": "address of the one sending the ERC721 Token" + }, + "returns": { + "_0": "onERC721BatchReceived function selector" + } + }, + "onERC721Received(address,address,uint256,bytes)": { + "details": "called on ERC721 transfer to this contract", + "params": { + "operator": "address of the one sending the ERC721 Token" + }, + "returns": { + "_0": "onERC721Received function selector" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pause()": { + "details": "Pauses all token transfers across bridge" + }, + "paused()": { + "details": "Returns true if the contract is paused, and false otherwise." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "setFxRootTunnel(address)": { + "details": "only owner can call this funtion", + "params": { + "_fxRootTunnel": "address of the fx-root tunnel" + } + }, + "setGasLimit(uint8,uint32)": { + "params": { + "limit": "the estimated gas that the L1 tx will use", + "size": "the size of the quad" + } + }, + "setMaxAllowedLands(uint256)": { + "params": { + "_maxAllowedLands": "maximum number of lands accepted" + } + }, + "setMaxLimitOnL1(uint32)": { + "params": { + "_maxGasLimit": "maximum accepted gas limit" + } + }, + "setTrustedForwarder(address)": { + "details": "Change the address of the trusted forwarder for meta-TX", + "params": { + "trustedForwarder": "The new trustedForwarder" + } + }, + "setupGasLimits(uint32[5])": { + "params": { + "limits": "the estimated gas that the L1 tx will use per quad size" + } + }, + "supportsInterface(bytes4)": { + "details": "to be called by external contact to check if this contract supports ERC721 token and batch token receive", + "params": { + "interfaceId": "the interface to be checked if supported by the contract" + }, + "returns": { + "_0": "0x5e8bf644 is the interface of IERC721MandatoryTokenReceiver and 0x01ffc9a7 for the Eip 165 supports interface's interface id" + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "unpause()": { + "details": "Unpauses all token transfers across bridge" + } + }, + "title": "PolygonLandTunnelV2", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "batchTransferQuadToL1(address,uint256[],uint256[],uint256[],bytes)": { + "notice": "send a batch of quads to L1" + }, + "getTrustedForwarder()": { + "notice": "Get the current trusted forwarder" + }, + "initialize(address,address,address,uint32,uint256,uint32[5])": { + "notice": "initialize the contract" + }, + "isTrustedForwarder(address)": { + "notice": "Checks if an address is a trusted forwarder" + }, + "setFxRootTunnel(address)": { + "notice": "sets the fx-root tunnel" + }, + "setGasLimit(uint8,uint32)": { + "notice": "set the estimate of gas that the L1 transaction will use per quad size" + }, + "setMaxAllowedLands(uint256)": { + "notice": "set the limit of lands we can send in one tx to L1" + }, + "setMaxLimitOnL1(uint32)": { + "notice": "set the limit of estimated gas we accept when sending a batch of quads to L1" + }, + "setupGasLimits(uint32[5])": { + "notice": "set the estimate of gas that the L1 transaction will use per quad size" + } + }, + "notice": "LAND tunnel on the child chain", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 1933, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol:PolygonLandTunnelV2", + "label": "fxChild", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 1935, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol:PolygonLandTunnelV2", + "label": "fxRootTunnel", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 40323, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol:PolygonLandTunnelV2", + "label": "__gap", + "offset": 0, + "slot": "2", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 35420, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol:PolygonLandTunnelV2", + "label": "_trustedForwarder", + "offset": 0, + "slot": "52", + "type": "t_address" + }, + { + "astId": 10217, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol:PolygonLandTunnelV2", + "label": "_initialized", + "offset": 20, + "slot": "52", + "type": "t_bool" + }, + { + "astId": 10220, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol:PolygonLandTunnelV2", + "label": "_initializing", + "offset": 21, + "slot": "52", + "type": "t_bool" + }, + { + "astId": 12276, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol:PolygonLandTunnelV2", + "label": "__gap", + "offset": 0, + "slot": "53", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 9994, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol:PolygonLandTunnelV2", + "label": "_owner", + "offset": 0, + "slot": "103", + "type": "t_address" + }, + { + "astId": 10108, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol:PolygonLandTunnelV2", + "label": "__gap", + "offset": 0, + "slot": "104", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 10305, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol:PolygonLandTunnelV2", + "label": "_paused", + "offset": 0, + "slot": "153", + "type": "t_bool" + }, + { + "astId": 10396, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol:PolygonLandTunnelV2", + "label": "__gap", + "offset": 0, + "slot": "154", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 64658, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol:PolygonLandTunnelV2", + "label": "transferringToL1", + "offset": 0, + "slot": "203", + "type": "t_bool" + }, + { + "astId": 64660, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol:PolygonLandTunnelV2", + "label": "maxGasLimitOnL1", + "offset": 1, + "slot": "203", + "type": "t_uint32" + }, + { + "astId": 64662, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol:PolygonLandTunnelV2", + "label": "maxAllowedLands", + "offset": 0, + "slot": "204", + "type": "t_uint256" + }, + { + "astId": 64665, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol:PolygonLandTunnelV2", + "label": "childToken", + "offset": 0, + "slot": "205", + "type": "t_contract(IPolygonLandV2)42767" + }, + { + "astId": 64669, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol:PolygonLandTunnelV2", + "label": "gasLimits", + "offset": 0, + "slot": "206", + "type": "t_mapping(t_uint8,t_uint32)" + }, + { + "astId": 65343, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol:PolygonLandTunnelV2", + "label": "__gap", + "offset": 0, + "slot": "207", + "type": "t_array(t_uint256)50_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IPolygonLandV2)42767": { + "encoding": "inplace", + "label": "contract IPolygonLandV2", + "numberOfBytes": "20" + }, + "t_mapping(t_uint8,t_uint32)": { + "encoding": "mapping", + "key": "t_uint8", + "label": "mapping(uint8 => uint32)", + "numberOfBytes": "32", + "value": "t_uint32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/core/deployments/polygon/PolygonLandTunnelV2_Proxy.json b/packages/core/deployments/polygon/PolygonLandTunnelV2_Proxy.json new file mode 100644 index 0000000000..fc58c7c175 --- /dev/null +++ b/packages/core/deployments/polygon/PolygonLandTunnelV2_Proxy.json @@ -0,0 +1,303 @@ +{ + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "initialLogic", + "type": "address" + }, + { + "internalType": "address", + "name": "initialAdmin", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "receipt": { + "to": null, + "from": "0x7074BB056C53ACC0b6091dd3FAe591aa3A4acC88", + "contractAddress": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "transactionIndex": 49, + "gasUsed": "715107", + "logsBloom": "0x0002000080000000000000000000000000000200000000000080000040000000000000000000020000000000000002000000a000060400000020000000040000000010000002000000000000000000880041000000040000000100000000000000000000020000080000000000000800000000000100000080000000000000400000004400100000010000000400005000000800000400000410000000000000200000000100000020000000000000820000000000800000000020080400404000100022000000000001100000000004000000000000010024500000000060200000000000000008000000000000000000000800000000000000000000100080", + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c", + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "logs": [ + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007074bb056c53acc0b6091dd3fae591aa3a4acc88" + ], + "data": "0x", + "logIndex": 225, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + }, + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "topics": [ + "0x59750b13637aff7a39455c6fb86108b91deab78a6d1046f7bd72cfdfae2f4d90" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000001f4", + "logIndex": 226, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + }, + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "topics": [ + "0x6a3bbca20bd7b0c5d945e5bb9afef92d4dccb8dcee37b78dc8e333e847569f80" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000090", + "logIndex": 227, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + }, + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "topics": [ + "0xfc6e32fc7effd308d33dfd4879e53051d8b83cb5d4b7826ff3e38473c0e57dd9", + "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000005" + ], + "data": "0x", + "logIndex": 228, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + }, + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "topics": [ + "0xfc6e32fc7effd308d33dfd4879e53051d8b83cb5d4b7826ff3e38473c0e57dd9", + "0x0000000000000000000000000000000000000000000000000000000000000003", + "0x000000000000000000000000000000000000000000000000000000000000000a" + ], + "data": "0x", + "logIndex": 229, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + }, + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "topics": [ + "0xfc6e32fc7effd308d33dfd4879e53051d8b83cb5d4b7826ff3e38473c0e57dd9", + "0x0000000000000000000000000000000000000000000000000000000000000006", + "0x0000000000000000000000000000000000000000000000000000000000000014" + ], + "data": "0x", + "logIndex": 230, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + }, + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "topics": [ + "0xfc6e32fc7effd308d33dfd4879e53051d8b83cb5d4b7826ff3e38473c0e57dd9", + "0x000000000000000000000000000000000000000000000000000000000000000c", + "0x000000000000000000000000000000000000000000000000000000000000005a" + ], + "data": "0x", + "logIndex": 231, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + }, + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "topics": [ + "0xfc6e32fc7effd308d33dfd4879e53051d8b83cb5d4b7826ff3e38473c0e57dd9", + "0x0000000000000000000000000000000000000000000000000000000000000018", + "0x0000000000000000000000000000000000000000000000000000000000000154" + ], + "data": "0x", + "logIndex": 232, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + }, + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x21B083e128fa7BcC31214a0c000B56Fd4372EEa8", + "topics": [ + "0xd91237492a9e30cd2faf361fc103998a382ff0ec2b1b07dc1cbebb76ae2f1ea2", + "0x000000000000000000000000f0511f123164602042ab2bcf02111fa5d3fe97cd" + ], + "data": "0x", + "logIndex": 233, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + }, + { + "transactionIndex": 49, + "blockNumber": 45862699, + "transactionHash": "0x9def4a967b010728e53f7c99a55b4b1dfd2c2f677cde9d7f3a4ddc1002edc4d3", + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x0000000000000000000000007074bb056c53acc0b6091dd3fae591aa3a4acc88", + "0x000000000000000000000000eedba2484aaf940f37cd3cd21a5d7c4a7dafbfc0" + ], + "data": "0x000000000000000000000000000000000000000000000000004d981e917aff9200000000000000000000000000000000000000000000000120363207a150011b00000000000000000000000000000000000000000000888d6ba8154ab56465d20000000000000000000000000000000000000000000000011fe899e90fd5018900000000000000000000000000000000000000000000888d6bf5ad6946df6564", + "logIndex": 234, + "blockHash": "0x0c354ffacad6f2e52558e5a53c38fae8cd258340ef5ccab477dbdb206947fa9c" + } + ], + "blockNumber": 45862699, + "cumulativeGasUsed": "9160298", + "status": 1, + "byzantium": true + }, + "args": [ + "0xaA85fc97F9AdBCbdCf6Aded88491bfc6cf8aB49A", + "0x29BeE877F756952cC810c0cF93bF0fC2bF036Fdb", + "0xc7fd66250000000000000000000000008397259c983751daf40400790063935a11afa28a0000000000000000000000009d305a42a3975ee4c1c57555bed5919889dce63f000000000000000000000000f0511f123164602042ab2bcf02111fa5d3fe97cd00000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000154" + ], + "numDeployments": 1, + "solcInputHash": "1635d55d57a0a2552952c0d22586ed23", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialLogic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAdmin\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"stateVariables\":{\"_ADMIN_SLOT\":{\"details\":\"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.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.7/proxy/OptimizedTransparentUpgradeableProxy.sol\":\"OptimizedTransparentUpgradeableProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.7/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n * \\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n * \\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal virtual view returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n * \\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {\\n }\\n}\\n\",\"keccak256\":\"0xc33f9858a67e34c77831163d5611d21fc627dfd2c303806a98a6c9db5a01b034\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/UpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Proxy.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n * \\n * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see\\n * {TransparentUpgradeableProxy}.\\n */\\ncontract UpgradeableProxy is Proxy {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n * \\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _setImplementation(_logic);\\n if(_data.length > 0) {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = _logic.delegatecall(_data);\\n require(success);\\n }\\n }\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal override view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Upgrades the proxy to a new implementation.\\n * \\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"UpgradeableProxy: new implementation is not a contract\\\");\\n\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newImplementation)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd68f4c11941712db79a61b9dca81a5db663cfacec3d7bb19f8d2c23bb1ab8afe\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\\n // for accounts without code, i.e. `keccak256('')`\\n bytes32 codehash;\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { codehash := extcodehash(account) }\\n return (codehash != accountHash && codehash != 0x0);\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return _functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n return _functionCallWithValue(target, data, value, errorMessage);\\n }\\n\\n function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x698f929f1097637d051976b322a2d532c27df022b09010e8d091e2888a5ebdf8\",\"license\":\"MIT\"},\"solc_0.7/proxy/OptimizedTransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.7.0;\\n\\nimport \\\"../openzeppelin/proxy/UpgradeableProxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\\n */\\ncontract OptimizedTransparentUpgradeableProxy is UpgradeableProxy {\\n address internal immutable _ADMIN;\\n\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\\n */\\n constructor(\\n address initialLogic,\\n address initialAdmin,\\n bytes memory _data\\n ) payable UpgradeableProxy(initialLogic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 slot = _ADMIN_SLOT;\\n\\n _ADMIN = initialAdmin;\\n\\n // still store it to work with EIP-1967\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, initialAdmin)\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _admin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address) {\\n return _admin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address) {\\n return _implementation();\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeTo(newImplementation);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeTo(newImplementation);\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, ) = newImplementation.delegatecall(data);\\n require(success);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view returns (address adm) {\\n return _ADMIN;\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _admin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x076456d71495e22183c672db71d719bd2dc7cb3b35e5bba21ce37eea1ec30347\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040526040516108fc3803806108fc8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101e9565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b506001600160601b0319606082901b166080527fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035550610297565b6101fc8161025b60201b6103581760201c565b6102375760405162461bcd60e51b81526004018080602001828103825260368152602001806108c66036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061028f57508115155b949350505050565b60805160601c6106126102b46000398061047352506106126000f3fe6080604052600436106100435760003560e01c80633659cfe61461005a5780634f1ef2861461009a5780635c60da1b14610127578063f851a4401461016557610052565b366100525761005061017a565b005b61005061017a565b34801561006657600080fd5b506100506004803603602081101561007d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610194565b610050600480360360408110156100b057600080fd5b73ffffffffffffffffffffffffffffffffffffffff82351691908101906040810160208201356401000000008111156100e857600080fd5b8201836020820111156100fa57600080fd5b8035906020019184600183028401116401000000008311171561011c57600080fd5b5090925090506101e8565b34801561013357600080fd5b5061013c6102bc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561017157600080fd5b5061013c610313565b610182610394565b61019261018d610428565b61044d565b565b61019c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101dd576101d881610495565b6101e5565b6101e561017a565b50565b6101f0610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102af5761022c83610495565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610296576040519150601f19603f3d011682016040523d82523d6000602084013e61029b565b606091505b50509050806102a957600080fd5b506102b7565b6102b761017a565b505050565b60006102c6610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610428565b9050610310565b61031061017a565b90565b600061031d610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610471565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061038c57508115155b949350505050565b61039c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061059b6042913960600191505060405180910390fd5b610192610192565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561046c573d6000f35b3d6000fd5b7f000000000000000000000000000000000000000000000000000000000000000090565b61049e816104e2565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6104eb81610358565b610540576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806105656036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200f42fc9d1f991236ae26e240c8505def958528031655d7dd335d3988cc0c88f564736f6c634300070600335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374", + "deployedBytecode": "0x6080604052600436106100435760003560e01c80633659cfe61461005a5780634f1ef2861461009a5780635c60da1b14610127578063f851a4401461016557610052565b366100525761005061017a565b005b61005061017a565b34801561006657600080fd5b506100506004803603602081101561007d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610194565b610050600480360360408110156100b057600080fd5b73ffffffffffffffffffffffffffffffffffffffff82351691908101906040810160208201356401000000008111156100e857600080fd5b8201836020820111156100fa57600080fd5b8035906020019184600183028401116401000000008311171561011c57600080fd5b5090925090506101e8565b34801561013357600080fd5b5061013c6102bc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561017157600080fd5b5061013c610313565b610182610394565b61019261018d610428565b61044d565b565b61019c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101dd576101d881610495565b6101e5565b6101e561017a565b50565b6101f0610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102af5761022c83610495565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610296576040519150601f19603f3d011682016040523d82523d6000602084013e61029b565b606091505b50509050806102a957600080fd5b506102b7565b6102b761017a565b505050565b60006102c6610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610428565b9050610310565b61031061017a565b90565b600061031d610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610471565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061038c57508115155b949350505050565b61039c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061059b6042913960600191505060405180910390fd5b610192610192565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561046c573d6000f35b3d6000fd5b7f000000000000000000000000000000000000000000000000000000000000000090565b61049e816104e2565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6104eb81610358565b610540576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806105656036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200f42fc9d1f991236ae26e240c8505def958528031655d7dd335d3988cc0c88f564736f6c63430007060033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`" + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "stateVariables": { + "_ADMIN_SLOT": { + "details": "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." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/core/deployments/polygon/PolygonLand_Implementation.json b/packages/core/deployments/polygon/PolygonLand_Implementation.json index 2da9c21ef0..0d82624e60 100644 --- a/packages/core/deployments/polygon/PolygonLand_Implementation.json +++ b/packages/core/deployments/polygon/PolygonLand_Implementation.json @@ -1,5 +1,5 @@ { - "address": "0x16f78D75fABB869835236B5Fb59c2b29f6cBbfcf", + "address": "0x95847A1982DB4622Dc9014f6F0beC7Cbc6b9A672", "abi": [ { "anonymous": false, @@ -73,8 +73,27 @@ { "anonymous": false, "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "subscriptionOrRegistrant", + "type": "address" + }, { "indexed": false, + "internalType": "bool", + "name": "subscribe", + "type": "bool" + } + ], + "name": "ContractRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, "internalType": "address", "name": "minter", "type": "address" @@ -89,6 +108,19 @@ "name": "Minter", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "registry", + "type": "address" + } + ], + "name": "OperatorRegistrySet", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -133,6 +165,19 @@ "name": "Transfer", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newForwarder", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, { "inputs": [ { @@ -370,7 +415,7 @@ "outputs": [ { "internalType": "address", - "name": "trustedForwarder", + "name": "", "type": "address" } ], @@ -393,7 +438,7 @@ "type": "uint256" } ], - "stateMutability": "view", + "stateMutability": "pure", "type": "function" }, { @@ -412,7 +457,7 @@ "type": "uint256" } ], - "stateMutability": "view", + "stateMutability": "pure", "type": "function" }, { @@ -458,7 +503,7 @@ "outputs": [ { "internalType": "bool", - "name": "isOperator", + "name": "", "type": "bool" } ], @@ -522,6 +567,39 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "size", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "x", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "y", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "mintAndTransferQuad", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -568,6 +646,19 @@ "stateMutability": "pure", "type": "function" }, + { + "inputs": [], + "name": "operatorFilterRegistry", + "outputs": [ + { + "internalType": "contract IOperatorFilterRegistry", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -587,6 +678,24 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "subscriptionOrRegistrantToCopy", + "type": "address" + }, + { + "internalType": "bool", + "name": "subscribe", + "type": "bool" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -725,6 +834,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "registry", + "type": "address" + } + ], + "name": "setOperatorRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -882,58 +1004,58 @@ "type": "function" } ], - "transactionHash": "0x56d51c9f2715e58e166597b8d23b32015e98666c9af082c3d3ef25d672c0e798", + "transactionHash": "0x9e05a4014230defa0ffe3f0dd59cfb811c77ee2ba6889c715d9edf85e781eb73", "receipt": { "to": null, "from": "0x7074BB056C53ACC0b6091dd3FAe591aa3A4acC88", - "contractAddress": "0x16f78D75fABB869835236B5Fb59c2b29f6cBbfcf", - "transactionIndex": 41, - "gasUsed": "4486081", - "logsBloom": "0x0000000000000000000000000000000000000000000000000000000040000000000000000000000002000000000000000000a000000000000000000000000000000000000000000000000000000000800000000000000000000100000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000008000000000000000000000000000200000000000000000000000000000000000000000000000000000000000004000000000000000000081000000000000000000000000000000100000000000000000000000000000000000000000000000000800000000000000000000100000", - "blockHash": "0x89bc3f755f7293daf81d11942ce16355cf0ad02c46d2f23f9add1cf0c2c20c3c", - "transactionHash": "0x56d51c9f2715e58e166597b8d23b32015e98666c9af082c3d3ef25d672c0e798", + "contractAddress": "0x95847A1982DB4622Dc9014f6F0beC7Cbc6b9A672", + "transactionIndex": 81, + "gasUsed": "5269856", + "logsBloom": "0x0000000000000000000000000000000000000000000000000000000040000040000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000800000000000400000000100000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000004000000000000000000001000000000000000000000000000000100000000000000000000000000000000000000000000000000800000000000000000000100000", + "blockHash": "0xc5df748fd4bfd912c3b4c400ab6efd79f4ca5f58db1f316e2c2c86288f6feaa4", + "transactionHash": "0x9e05a4014230defa0ffe3f0dd59cfb811c77ee2ba6889c715d9edf85e781eb73", "logs": [ { - "transactionIndex": 41, - "blockNumber": 29533333, - "transactionHash": "0x56d51c9f2715e58e166597b8d23b32015e98666c9af082c3d3ef25d672c0e798", + "transactionIndex": 81, + "blockNumber": 45861202, + "transactionHash": "0x9e05a4014230defa0ffe3f0dd59cfb811c77ee2ba6889c715d9edf85e781eb73", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x0000000000000000000000007074bb056c53acc0b6091dd3fae591aa3a4acc88", - "0x000000000000000000000000e7e2cb8c81c10ff191a73fe266788c9ce62ec754" + "0x0000000000000000000000007c7379531b2aee82e4ca06d4175d13b9cbeafd49" ], - "data": "0x00000000000000000000000000000000000000000000000001ea224bc014398d0000000000000000000000000000000000000000000000055c3dd4800bd6b6bc000000000000000000000000000000000000000000001f4c3a490b6582f1eb110000000000000000000000000000000000000000000000055a53b2344bc27d2f000000000000000000000000000000000000000000001f4c3c332db14306249e", - "logIndex": 194, - "blockHash": "0x89bc3f755f7293daf81d11942ce16355cf0ad02c46d2f23f9add1cf0c2c20c3c" + "data": "0x0000000000000000000000000000000000000000000000000077fae1e4e5dae000000000000000000000000000000000000000000000000129048e5fb00ad51300000000000000000000000000000000000000000002412112e2dbc0cacb5746000000000000000000000000000000000000000000000001288c937dcb24fa33000000000000000000000000000000000000000000024121135ad6a2afb13226", + "logIndex": 799, + "blockHash": "0xc5df748fd4bfd912c3b4c400ab6efd79f4ca5f58db1f316e2c2c86288f6feaa4" } ], - "blockNumber": 29533333, - "cumulativeGasUsed": "11168472", + "blockNumber": 45861202, + "cumulativeGasUsed": "26156593", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 1, - "solcInputHash": "b324cd7389fb25cfd4aeba7aeca25d0f", - "metadata": "{\"compiler\":{\"version\":\"0.8.2+commit.661d1103\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldAdmin\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"Minter\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"superOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"SuperOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"approveFor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"batchTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"sizes\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"xs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"ys\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"batchTransferQuad\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"burnFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"size\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"name\":\"exists\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTrustedForwarder\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getX\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"height\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isOperator\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"}],\"name\":\"isMinter\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"}],\"name\":\"isSuperOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"}],\"name\":\"isTrustedForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"size\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"mintQuad\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeBatchTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAllFor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setMinter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"superOperator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setSuperOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"name\":\"setTrustedForwarder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"id\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"size\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"transferQuad\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"width\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"approve(address,uint256)\":{\"params\":{\"id\":\"The id of the token.\",\"operator\":\"The address receiving the approval.\"}},\"approveFor(address,address,uint256)\":{\"params\":{\"id\":\"The id of the token.\",\"operator\":\"The address receiving the approval.\",\"sender\":\"The address giving the approval.\"}},\"balanceOf(address)\":{\"params\":{\"owner\":\"The address to look for.\"},\"returns\":{\"_0\":\"The number of tokens owned by the address.\"}},\"burn(uint256)\":{\"params\":{\"id\":\"The token which will be burnt.\"}},\"burnFrom(address,uint256)\":{\"params\":{\"from\":\"address whose token is to be burnt.\",\"id\":\"The token which will be burnt.\"}},\"changeAdmin(address)\":{\"details\":\"Change the administrator to be `newAdmin`.\",\"params\":{\"newAdmin\":\"The address of the new administrator.\"}},\"getAdmin()\":{\"details\":\"Get the current administrator of this contract.\",\"returns\":{\"_0\":\"The current administrator of this contract.\"}},\"getApproved(uint256)\":{\"params\":{\"id\":\"The id of the token.\"},\"returns\":{\"_0\":\"The address of the operator.\"}},\"getX(uint256)\":{\"params\":{\"id\":\"tokenId\"},\"returns\":{\"_0\":\"the x coordinates\"}},\"getY(uint256)\":{\"params\":{\"id\":\"tokenId\"},\"returns\":{\"_0\":\"the y coordinates\"}},\"height()\":{\"returns\":{\"_0\":\"height\"}},\"isApprovedForAll(address,address)\":{\"params\":{\"operator\":\"The address of the operator.\",\"owner\":\"The address of the owner.\"},\"returns\":{\"isOperator\":\"The status of the approval.\"}},\"isMinter(address)\":{\"params\":{\"who\":\"The address to query.\"},\"returns\":{\"_0\":\"whether the address has minter rights.\"}},\"isSuperOperator(address)\":{\"params\":{\"who\":\"The address to query.\"},\"returns\":{\"_0\":\"whether the address has superOperator rights.\"}},\"mintQuad(address,uint256,uint256,uint256,bytes)\":{\"params\":{\"data\":\"extra data to pass to the transfer\",\"size\":\"The size of the new quad\",\"user\":\"The recipient of the new quad\",\"x\":\"The top left x coordinate of the new quad\",\"y\":\"The top left y coordinate of the new quad\"}},\"name()\":{\"returns\":{\"_0\":\"The name of the token contract\"}},\"ownerOf(uint256)\":{\"params\":{\"id\":\"The id of the token.\"},\"returns\":{\"owner\":\"The address of the token owner.\"}},\"safeBatchTransferFrom(address,address,uint256[],bytes)\":{\"params\":{\"data\":\"Additional data.\",\"from\":\"The sender of the token.\",\"ids\":\"The ids of the tokens.\",\"to\":\"The recipient of the token.\"}},\"safeTransferFrom(address,address,uint256)\":{\"params\":{\"from\":\"The send of the token.\",\"id\":\"The id of the token.\",\"to\":\"The recipient of the token.\"}},\"safeTransferFrom(address,address,uint256,bytes)\":{\"params\":{\"data\":\"Additional data.\",\"from\":\"The sender of the token.\",\"id\":\"The id of the token.\",\"to\":\"The recipient of the token.\"}},\"setApprovalForAll(address,bool)\":{\"params\":{\"approved\":\"The determination of the approval.\",\"operator\":\"The address receiving the approval.\"}},\"setApprovalForAllFor(address,address,bool)\":{\"params\":{\"approved\":\"The determination of the approval.\",\"operator\":\"The address receiving the approval.\",\"sender\":\"The address giving the approval.\"}},\"setMinter(address,bool)\":{\"params\":{\"enabled\":\"set whether the minter is enabled or disabled.\",\"minter\":\"address that will be given/removed minter right.\"}},\"setSuperOperator(address,bool)\":{\"params\":{\"enabled\":\"set whether the superOperator is enabled or disabled.\",\"superOperator\":\"address that will be given/removed superOperator right.\"}},\"setTrustedForwarder(address)\":{\"details\":\"Change the address of the trusted forwarder for meta-TX\",\"params\":{\"trustedForwarder\":\"The new trustedForwarder\"}},\"supportsInterface(bytes4)\":{\"params\":{\"id\":\"The id of the interface\"},\"returns\":{\"_0\":\"True if the interface is supported\"}},\"symbol()\":{\"returns\":{\"_0\":\"The symbol of the token contract\"}},\"tokenURI(uint256)\":{\"params\":{\"id\":\"The id of the token\"},\"returns\":{\"_0\":\"The URI of the token\"}},\"transferFrom(address,address,uint256)\":{\"params\":{\"from\":\"The sender of the token.\",\"id\":\"The id of the token.\",\"to\":\"The recipient of the token.\"}},\"width()\":{\"returns\":{\"_0\":\"width\"}}},\"title\":\"LAND token on L2\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"approve(address,uint256)\":{\"notice\":\"Approve an operator to spend tokens on the senders behalf.\"},\"approveFor(address,address,uint256)\":{\"notice\":\"Approve an operator to spend tokens on the sender behalf.\"},\"balanceOf(address)\":{\"notice\":\"Get the number of tokens owned by an address.\"},\"burn(uint256)\":{\"notice\":\"Burns token `id`.\"},\"burnFrom(address,uint256)\":{\"notice\":\"Burn token`id` from `from`.\"},\"getApproved(uint256)\":{\"notice\":\"Get the approved operator for a specific token.\"},\"getX(uint256)\":{\"notice\":\"x coordinate of Land token\"},\"getY(uint256)\":{\"notice\":\"y coordinate of Land token\"},\"height()\":{\"notice\":\"total height of the map\"},\"isApprovedForAll(address,address)\":{\"notice\":\"Check if the sender approved the operator.\"},\"isMinter(address)\":{\"notice\":\"check whether address `who` is given minter rights.\"},\"isSuperOperator(address)\":{\"notice\":\"check whether address `who` is given superOperator rights.\"},\"mintQuad(address,uint256,uint256,uint256,bytes)\":{\"notice\":\"Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\"},\"name()\":{\"notice\":\"Return the name of the token contract\"},\"ownerOf(uint256)\":{\"notice\":\"Get the owner of a token.\"},\"safeBatchTransferFrom(address,address,uint256[],bytes)\":{\"notice\":\"Transfer many tokens between 2 addresses, while ensuring the receiving contract has a receiver method.\"},\"safeTransferFrom(address,address,uint256)\":{\"notice\":\"Transfer a token between 2 addresses letting the receiver know of the transfer.\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"notice\":\"Transfer a token between 2 addresses letting the receiver knows of the transfer.\"},\"setApprovalForAll(address,bool)\":{\"notice\":\"Set the approval for an operator to manage all the tokens of the sender.\"},\"setApprovalForAllFor(address,address,bool)\":{\"notice\":\"Set the approval for an operator to manage all the tokens of the sender.\"},\"setMinter(address,bool)\":{\"notice\":\"Enable or disable the ability of `minter` to transfer tokens of all (minter rights).\"},\"setSuperOperator(address,bool)\":{\"notice\":\"Enable or disable the ability of `superOperator` to transfer tokens of all (superOperator rights).\"},\"supportsInterface(bytes4)\":{\"notice\":\"Check if the contract supports an interface 0x01ffc9a7 is ERC-165 0x80ac58cd is ERC-721 0x5b5e139f is ERC-721 metadata\"},\"symbol()\":{\"notice\":\"Return the symbol of the token contract\"},\"tokenURI(uint256)\":{\"notice\":\"Return the URI of a specific token\"},\"transferFrom(address,address,uint256)\":{\"notice\":\"Transfer a token between 2 addresses.\"},\"width()\":{\"notice\":\"total width of the map\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/solc_0.8/polygon/child/land/PolygonLandV1.sol\":\"PolygonLandV1\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the\\n * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() initializer {}\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n bool private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Modifier to protect an initializer function from being invoked twice.\\n */\\n modifier initializer() {\\n // If the contract is initializing we ignore whether _initialized is set in order to support multiple\\n // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the\\n // contract may have been reentered.\\n require(_initializing ? _isConstructor() : !_initialized, \\\"Initializable: contract is already initialized\\\");\\n\\n bool isTopLevelCall = !_initializing;\\n if (isTopLevelCall) {\\n _initializing = true;\\n _initialized = true;\\n }\\n\\n _;\\n\\n if (isTopLevelCall) {\\n _initializing = false;\\n }\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} modifier, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n function _isConstructor() private view returns (bool) {\\n return !AddressUpgradeable.isContract(address(this));\\n }\\n}\\n\",\"keccak256\":\"0x68861bcc80cacbd498efde75aab6c74a486cc48262660d326c8d7530d9752097\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721ReceiverUpgradeable {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0x2f359f9d5c56394e60d74401487ab55d8ef0012907b07c9abbb8f998bf5ddfec\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x714a33fd66816f608f6eda908da24eb6009eee50adf4062c86639d4fe508a7b6\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3f0f878c796dfc7feba6d3c4e3e526c14c7deae8b7bfc71088e3f38fab0d77b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n __Context_init_unchained();\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x0b0d548f6381370d394f7a434f994dc678b3ef3e755de106109d61343a685ea7\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n}\\n\",\"keccak256\":\"0x398d3323c1932a5986bf36be7c57593e121e69d5db5b6574b4ee0d031443de37\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"src/solc_0.8/common/BaseWithStorage/ERC2771Handler.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// solhint-disable-next-line compiler-version\\npragma solidity 0.8.2;\\n\\n/// @dev minimal ERC2771 handler to keep bytecode-size down\\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.6.0/contracts/metatx/ERC2771Context.sol\\n/// with an initializer for proxies and a mutable forwarder\\n\\ncontract ERC2771Handler {\\n address internal _trustedForwarder;\\n\\n function __ERC2771Handler_initialize(address forwarder) internal {\\n _trustedForwarder = forwarder;\\n }\\n\\n function isTrustedForwarder(address forwarder) public view returns (bool) {\\n return forwarder == _trustedForwarder;\\n }\\n\\n function getTrustedForwarder() external view returns (address trustedForwarder) {\\n return _trustedForwarder;\\n }\\n\\n function _msgSender() internal view virtual returns (address sender) {\\n if (isTrustedForwarder(msg.sender)) {\\n // The assembly code is more direct than the Solidity version using `abi.decode`.\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\\n }\\n } else {\\n return msg.sender;\\n }\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n if (isTrustedForwarder(msg.sender)) {\\n return msg.data[:msg.data.length - 20];\\n } else {\\n return msg.data;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc02a58a6fed654dc6ecd5c0ecb81192eb47daf61d093c5342b5f8d74481c0692\",\"license\":\"MIT\"},\"src/solc_0.8/common/BaseWithStorage/ERC721BaseTokenV2.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n/* solhint-disable func-order, code-complexity */\\n// solhint-disable-next-line compiler-version\\npragma solidity 0.8.2;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\\\";\\nimport \\\"./WithSuperOperatorsV2.sol\\\";\\nimport \\\"../interfaces/IERC721MandatoryTokenReceiver.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\\\";\\n\\ncontract ERC721BaseTokenV2 is ContextUpgradeable, IERC721Upgradeable, WithSuperOperatorsV2 {\\n using AddressUpgradeable for address;\\n\\n bytes4 internal constant _ERC721_RECEIVED = 0x150b7a02;\\n bytes4 internal constant _ERC721_BATCH_RECEIVED = 0x4b808c46;\\n\\n bytes4 internal constant ERC165ID = 0x01ffc9a7;\\n bytes4 internal constant ERC721_MANDATORY_RECEIVER = 0x5e8bf644;\\n\\n uint256 internal constant NOT_ADDRESS = 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000;\\n uint256 internal constant OPERATOR_FLAG = (2**255);\\n uint256 internal constant NOT_OPERATOR_FLAG = OPERATOR_FLAG - 1;\\n uint256 internal constant BURNED_FLAG = (2**160);\\n\\n mapping(address => uint256) internal _numNFTPerAddress;\\n mapping(uint256 => uint256) internal _owners;\\n mapping(address => mapping(address => bool)) internal _operatorsForAll;\\n mapping(uint256 => address) internal _operators;\\n\\n /// @notice Approve an operator to spend tokens on the senders behalf.\\n /// @param operator The address receiving the approval.\\n /// @param id The id of the token.\\n function approve(address operator, uint256 id) external override {\\n uint256 ownerData = _owners[_storageId(id)];\\n address owner = _ownerOf(id);\\n address msgSender = _msgSender();\\n require(owner != address(0), \\\"NONEXISTENT_TOKEN\\\");\\n require(\\n owner == msgSender || _operatorsForAll[owner][msgSender] || _superOperators[msgSender],\\n \\\"UNAUTHORIZED_APPROVAL\\\"\\n );\\n _approveFor(ownerData, operator, id);\\n }\\n\\n /// @notice Approve an operator to spend tokens on the sender behalf.\\n /// @param sender The address giving the approval.\\n /// @param operator The address receiving the approval.\\n /// @param id The id of the token.\\n function approveFor(\\n address sender,\\n address operator,\\n uint256 id\\n ) external {\\n uint256 ownerData = _owners[_storageId(id)];\\n address owner = _ownerOf(id);\\n address msgSender = _msgSender();\\n require(sender != address(0), \\\"ZERO_ADDRESS_SENDER\\\");\\n require(owner != address(0), \\\"NONEXISTENT_TOKEN\\\");\\n require(\\n msgSender == sender || _operatorsForAll[sender][msgSender] || _superOperators[msgSender],\\n \\\"UNAUTHORIZED_APPROVAL\\\"\\n );\\n require(address(uint160(ownerData)) == sender, \\\"OWNER_NOT_SENDER\\\");\\n _approveFor(ownerData, operator, id);\\n }\\n\\n /// @notice Transfer a token between 2 addresses.\\n /// @param from The sender of the token.\\n /// @param to The recipient of the token.\\n /// @param id The id of the token.\\n function transferFrom(\\n address from,\\n address to,\\n uint256 id\\n ) external override {\\n _checkTransfer(from, to, id);\\n _transferFrom(from, to, id);\\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\\n require(_checkOnERC721Received(_msgSender(), from, to, id, \\\"\\\"), \\\"ERC721_TRANSFER_REJECTED\\\");\\n }\\n }\\n\\n /// @notice Transfer a token between 2 addresses letting the receiver know of the transfer.\\n /// @param from The send of the token.\\n /// @param to The recipient of the token.\\n /// @param id The id of the token.\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id\\n ) external override {\\n safeTransferFrom(from, to, id, \\\"\\\");\\n }\\n\\n /// @notice Transfer many tokens between 2 addresses.\\n /// @param from The sender of the token.\\n /// @param to The recipient of the token.\\n /// @param ids The ids of the tokens.\\n /// @param data Additional data.\\n function batchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) public virtual {\\n _batchTransferFrom(from, to, ids, data, false);\\n }\\n\\n /// @notice Transfer many tokens between 2 addresses, while\\n /// ensuring the receiving contract has a receiver method.\\n /// @param from The sender of the token.\\n /// @param to The recipient of the token.\\n /// @param ids The ids of the tokens.\\n /// @param data Additional data.\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) external {\\n _batchTransferFrom(from, to, ids, data, true);\\n }\\n\\n /// @notice Set the approval for an operator to manage all the tokens of the sender.\\n /// @param sender The address giving the approval.\\n /// @param operator The address receiving the approval.\\n /// @param approved The determination of the approval.\\n function setApprovalForAllFor(\\n address sender,\\n address operator,\\n bool approved\\n ) external {\\n require(sender != address(0), \\\"Invalid sender address\\\");\\n address msgSender = _msgSender();\\n require(msgSender == sender || _superOperators[msgSender], \\\"UNAUTHORIZED_APPROVE_FOR_ALL\\\");\\n\\n _setApprovalForAll(sender, operator, approved);\\n }\\n\\n /// @notice Set the approval for an operator to manage all the tokens of the sender.\\n /// @param operator The address receiving the approval.\\n /// @param approved The determination of the approval.\\n function setApprovalForAll(address operator, bool approved) external override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /// @notice Burns token `id`.\\n /// @param id The token which will be burnt.\\n function burn(uint256 id) external virtual {\\n _burn(_msgSender(), _ownerOf(id), id);\\n }\\n\\n /// @notice Burn token`id` from `from`.\\n /// @param from address whose token is to be burnt.\\n /// @param id The token which will be burnt.\\n function burnFrom(address from, uint256 id) external virtual {\\n require(from != address(0), \\\"NOT_FROM_ZEROADDRESS\\\");\\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\\n address msgSender = _msgSender();\\n require(\\n msgSender == from ||\\n (operatorEnabled && _operators[id] == msgSender) ||\\n _superOperators[msgSender] ||\\n _operatorsForAll[from][msgSender],\\n \\\"UNAUTHORIZED_BURN\\\"\\n );\\n _burn(from, owner, id);\\n }\\n\\n /// @notice Get the number of tokens owned by an address.\\n /// @param owner The address to look for.\\n /// @return The number of tokens owned by the address.\\n function balanceOf(address owner) external view override returns (uint256) {\\n require(owner != address(0), \\\"ZERO_ADDRESS_OWNER\\\");\\n return _numNFTPerAddress[owner];\\n }\\n\\n /// @notice Get the owner of a token.\\n /// @param id The id of the token.\\n /// @return owner The address of the token owner.\\n function ownerOf(uint256 id) external view override returns (address owner) {\\n owner = _ownerOf(id);\\n require(owner != address(0), \\\"NONEXISTANT_TOKEN\\\");\\n }\\n\\n /// @notice Get the approved operator for a specific token.\\n /// @param id The id of the token.\\n /// @return The address of the operator.\\n function getApproved(uint256 id) external view override returns (address) {\\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\\n require(owner != address(0), \\\"NONEXISTENT_TOKEN\\\");\\n if (operatorEnabled) {\\n return _operators[id];\\n } else {\\n return address(0);\\n }\\n }\\n\\n /// @notice Check if the sender approved the operator.\\n /// @param owner The address of the owner.\\n /// @param operator The address of the operator.\\n /// @return isOperator The status of the approval.\\n function isApprovedForAll(address owner, address operator) external view override returns (bool isOperator) {\\n return _operatorsForAll[owner][operator] || _superOperators[operator];\\n }\\n\\n /// @notice Transfer a token between 2 addresses letting the receiver knows of the transfer.\\n /// @param from The sender of the token.\\n /// @param to The recipient of the token.\\n /// @param id The id of the token.\\n /// @param data Additional data.\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n bytes memory data\\n ) public override {\\n _checkTransfer(from, to, id);\\n _transferFrom(from, to, id);\\n if (to.isContract()) {\\n require(_checkOnERC721Received(_msgSender(), from, to, id, data), \\\"ERC721_TRANSFER_REJECTED\\\");\\n }\\n }\\n\\n /// @notice Check if the contract supports an interface.\\n /// 0x01ffc9a7 is ERC-165.\\n /// 0x80ac58cd is ERC-721\\n /// @param id The id of the interface.\\n /// @return Whether the interface is supported.\\n function supportsInterface(bytes4 id) public pure virtual override returns (bool) {\\n return id == 0x01ffc9a7 || id == 0x80ac58cd;\\n }\\n\\n /// @dev By overriding this function in an implementation which inherits this contract,\\n /// you can enable versioned tokenIds without the extra overhead of writing to a new storage slot in _owners each time a version is incremented.\\n /// See GameToken._storageId() for an example, where the storageId is the tokenId minus the version number.\\n /// !!! Caution !!! Overriding this function without taking appropriate care could lead to\\n /// ownerOf() returning an owner for non-existent tokens. Tests should be written to\\n /// guard against introducing this bug.\\n /// @param id The id of a token.\\n /// @return The id used for storage mappings.\\n function _storageId(uint256 id) internal view virtual returns (uint256) {\\n return id;\\n }\\n\\n function _updateOwnerData(\\n uint256 id,\\n uint256 oldData,\\n address newOwner,\\n bool hasOperator\\n ) internal virtual {\\n if (hasOperator) {\\n _owners[_storageId(id)] = (oldData & NOT_ADDRESS) | OPERATOR_FLAG | uint256(uint160(newOwner));\\n } else {\\n _owners[_storageId(id)] = ((oldData & NOT_ADDRESS) & NOT_OPERATOR_FLAG) | uint256(uint160(newOwner));\\n }\\n }\\n\\n function _transferFrom(\\n address from,\\n address to,\\n uint256 id\\n ) internal {\\n _numNFTPerAddress[from]--;\\n _numNFTPerAddress[to]++;\\n _updateOwnerData(id, _owners[_storageId(id)], to, false);\\n emit Transfer(from, to, id);\\n }\\n\\n /// @dev See approveFor.\\n function _approveFor(\\n uint256 ownerData,\\n address operator,\\n uint256 id\\n ) internal {\\n address owner = _ownerOf(id);\\n if (operator == address(0)) {\\n _updateOwnerData(id, ownerData, owner, false);\\n } else {\\n _updateOwnerData(id, ownerData, owner, true);\\n _operators[id] = operator;\\n }\\n emit Approval(owner, operator, id);\\n }\\n\\n /// @dev See batchTransferFrom.\\n function _batchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n bytes memory data,\\n bool safe\\n ) internal {\\n address msgSender = _msgSender();\\n bool authorized = msgSender == from || _operatorsForAll[from][msgSender] || _superOperators[msgSender];\\n\\n require(from != address(0), \\\"NOT_FROM_ZEROADDRESS\\\");\\n require(to != address(0), \\\"NOT_TO_ZEROADDRESS\\\");\\n\\n uint256 numTokens = ids.length;\\n for (uint256 i = 0; i < numTokens; i++) {\\n uint256 id = ids[i];\\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\\n require(owner == from, \\\"BATCHTRANSFERFROM_NOT_OWNER\\\");\\n require(authorized || (operatorEnabled && _operators[id] == msgSender), \\\"NOT_AUTHORIZED\\\");\\n _updateOwnerData(id, _owners[_storageId(id)], to, false);\\n emit Transfer(from, to, id);\\n }\\n if (from != to) {\\n _numNFTPerAddress[from] -= numTokens;\\n _numNFTPerAddress[to] += numTokens;\\n }\\n\\n if (to.isContract()) {\\n if (_checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\\n require(_checkOnERC721BatchReceived(msgSender, from, to, ids, data), \\\"ERC721_BATCH_RECEIVED_REJECTED\\\");\\n } else if (safe) {\\n for (uint256 i = 0; i < numTokens; i++) {\\n require(_checkOnERC721Received(msgSender, from, to, ids[i], data), \\\"ERC721_RECEIVED_REJECTED\\\");\\n }\\n }\\n }\\n }\\n\\n /// @dev See setApprovalForAll.\\n function _setApprovalForAll(\\n address sender,\\n address operator,\\n bool approved\\n ) internal {\\n require(!_superOperators[operator], \\\"INVALID_APPROVAL_CHANGE\\\");\\n _operatorsForAll[sender][operator] = approved;\\n\\n emit ApprovalForAll(sender, operator, approved);\\n }\\n\\n /// @dev See burn.\\n function _burn(\\n address from,\\n address owner,\\n uint256 id\\n ) internal {\\n require(from == owner, \\\"NOT_OWNER\\\");\\n uint256 storageId = _storageId(id);\\n _owners[storageId] = (_owners[storageId] & NOT_OPERATOR_FLAG) | BURNED_FLAG; // record as non owner but keep track of last owner\\n _numNFTPerAddress[from]--;\\n emit Transfer(from, address(0), id);\\n }\\n\\n /// @dev Check if receiving contract accepts erc721 transfers.\\n /// @param operator The address of the operator.\\n /// @param from The from address, may be different from msg.sender.\\n /// @param to The adddress we want to transfer to.\\n /// @param tokenId The id of the token we would like to transfer.\\n /// @param _data Any additional data to send with the transfer.\\n /// @return Whether the expected value of 0x150b7a02 is returned.\\n function _checkOnERC721Received(\\n address operator,\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory _data\\n ) internal returns (bool) {\\n bytes4 retval = IERC721ReceiverUpgradeable(to).onERC721Received(operator, from, tokenId, _data);\\n return (retval == _ERC721_RECEIVED);\\n }\\n\\n /// @dev Check if receiving contract accepts erc721 batch transfers.\\n /// @param operator The address of the operator.\\n /// @param from The from address, may be different from msg.sender.\\n /// @param to The adddress we want to transfer to.\\n /// @param ids The ids of the tokens we would like to transfer.\\n /// @param _data Any additional data to send with the transfer.\\n /// @return Whether the expected value of 0x4b808c46 is returned.\\n function _checkOnERC721BatchReceived(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n bytes memory _data\\n ) internal returns (bool) {\\n bytes4 retval = IERC721MandatoryTokenReceiver(to).onERC721BatchReceived(operator, from, ids, _data);\\n return (retval == _ERC721_BATCH_RECEIVED);\\n }\\n\\n /// @dev See ownerOf\\n function _ownerOf(uint256 id) internal view virtual returns (address) {\\n uint256 data = _owners[_storageId(id)];\\n if ((data & BURNED_FLAG) == BURNED_FLAG) {\\n return address(0);\\n }\\n return address(uint160(data));\\n }\\n\\n /// @dev Get the owner and operatorEnabled status of a token.\\n /// @param id The token to query.\\n /// @return owner The owner of the token.\\n /// @return operatorEnabled Whether or not operators are enabled for this token.\\n function _ownerAndOperatorEnabledOf(uint256 id)\\n internal\\n view\\n virtual\\n returns (address owner, bool operatorEnabled)\\n {\\n uint256 data = _owners[_storageId(id)];\\n if ((data & BURNED_FLAG) == BURNED_FLAG) {\\n owner = address(0);\\n } else {\\n owner = address(uint160(data));\\n }\\n operatorEnabled = (data & OPERATOR_FLAG) == OPERATOR_FLAG;\\n }\\n\\n /// @dev Check whether a transfer is a meta Transaction or not.\\n /// @param from The address who initiated the transfer (may differ from msg.sender).\\n /// @param to The address recieving the token.\\n /// @param id The token being transferred.\\n /// @return isMetaTx Whether or not the transaction is a MetaTx.\\n function _checkTransfer(\\n address from,\\n address to,\\n uint256 id\\n ) internal view returns (bool isMetaTx) {\\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\\n address msgSender = _msgSender();\\n require(owner != address(0), \\\"NONEXISTENT_TOKEN\\\");\\n require(owner == from, \\\"CHECKTRANSFER_NOT_OWNER\\\");\\n require(to != address(0), \\\"NOT_TO_ZEROADDRESS\\\");\\n require(\\n msgSender == owner ||\\n _superOperators[msgSender] ||\\n _operatorsForAll[from][msgSender] ||\\n (operatorEnabled && _operators[id] == msgSender),\\n \\\"UNAUTHORIZED_TRANSFER\\\"\\n );\\n return true;\\n }\\n\\n /// @dev Check if there was enough gas.\\n /// @param _contract The address of the contract to check.\\n /// @param interfaceId The id of the interface we want to test.\\n /// @return Whether or not this check succeeded.\\n function _checkInterfaceWith10000Gas(address _contract, bytes4 interfaceId) internal view returns (bool) {\\n bool success;\\n bool result;\\n bytes memory callData = abi.encodeWithSelector(ERC165ID, interfaceId);\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let call_ptr := add(0x20, callData)\\n let call_size := mload(callData)\\n let output := mload(0x40) // Find empty storage location using \\\"free memory pointer\\\"\\n mstore(output, 0x0)\\n success := staticcall(10000, _contract, call_ptr, call_size, output, 0x20) // 32 bytes\\n result := mload(output)\\n }\\n // (10000 / 63) \\\"not enough for supportsInterface(...)\\\" // consume all gas, so caller can potentially know that there was not enough gas\\n assert(gasleft() > 158);\\n return success && result;\\n }\\n}\\n\",\"keccak256\":\"0xd12ffc2db922fe9eb99df60b8d84188f57422d3ba52134a1a0c59f137b1d33e0\",\"license\":\"MIT\"},\"src/solc_0.8/common/BaseWithStorage/WithAdminV2.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// solhint-disable-next-line compiler-version\\npragma solidity 0.8.2;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\\\";\\n\\ncontract WithAdminV2 is ContextUpgradeable {\\n address internal _admin;\\n\\n /// @dev Emits when the contract administrator is changed.\\n /// @param oldAdmin The address of the previous administrator.\\n /// @param newAdmin The address of the new administrator.\\n event AdminChanged(address indexed oldAdmin, address indexed newAdmin);\\n\\n modifier onlyAdmin() {\\n require(_msgSender() == _admin, \\\"ADMIN_ONLY\\\");\\n _;\\n }\\n\\n /// @dev Get the current administrator of this contract.\\n /// @return The current administrator of this contract.\\n function getAdmin() external view returns (address) {\\n return _admin;\\n }\\n\\n /// @dev Change the administrator to be `newAdmin`.\\n /// @param newAdmin The address of the new administrator.\\n function changeAdmin(address newAdmin) external {\\n address admin = _admin;\\n require(_msgSender() == admin, \\\"ADMIN_ACCESS_DENIED\\\");\\n emit AdminChanged(admin, newAdmin);\\n _admin = newAdmin;\\n }\\n}\\n\",\"keccak256\":\"0x25a4e5211a9b8b70e56b497342cf89a7a3f165ebade8f5e5bf33ff7be5d12343\",\"license\":\"MIT\"},\"src/solc_0.8/common/BaseWithStorage/WithSuperOperatorsV2.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// solhint-disable-next-line compiler-version\\npragma solidity 0.8.2;\\n\\nimport \\\"./WithAdminV2.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\\\";\\n\\ncontract WithSuperOperatorsV2 is ContextUpgradeable, WithAdminV2 {\\n mapping(address => bool) internal _superOperators;\\n\\n event SuperOperator(address indexed superOperator, bool indexed enabled);\\n\\n /// @notice Enable or disable the ability of `superOperator` to transfer tokens of all (superOperator rights).\\n /// @param superOperator address that will be given/removed superOperator right.\\n /// @param enabled set whether the superOperator is enabled or disabled.\\n function setSuperOperator(address superOperator, bool enabled) external {\\n require(_msgSender() == _admin, \\\"only admin is allowed to add super operators\\\");\\n _superOperators[superOperator] = enabled;\\n emit SuperOperator(superOperator, enabled);\\n }\\n\\n /// @notice check whether address `who` is given superOperator rights.\\n /// @param who The address to query.\\n /// @return whether the address has superOperator rights.\\n function isSuperOperator(address who) public view returns (bool) {\\n return _superOperators[who];\\n }\\n}\\n\",\"keccak256\":\"0x5761a6f0cfb356d03cb3a96d7c2412621178e22d2510b1e7033aec85f617f3a2\",\"license\":\"MIT\"},\"src/solc_0.8/common/interfaces/IERC721MandatoryTokenReceiver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// solhint-disable-next-line compiler-version\\npragma solidity 0.8.2;\\n\\n/// @dev Note: The ERC-165 identifier for this interface is 0x5e8bf644.\\ninterface IERC721MandatoryTokenReceiver {\\n function onERC721BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) external returns (bytes4); // needs to return 0x4b808c46\\n\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4); // needs to return 0x150b7a02\\n}\\n\",\"keccak256\":\"0x66db07bc53d4c7f6b8f23dfa76874378e01b87a1b81726d5d637942d072203a9\",\"license\":\"MIT\"},\"src/solc_0.8/common/interfaces/ILandToken.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\ninterface ILandToken {\\n function batchTransferQuad(\\n address from,\\n address to,\\n uint256[] calldata sizes,\\n uint256[] calldata xs,\\n uint256[] calldata ys,\\n bytes calldata data\\n ) external;\\n\\n function transferQuad(\\n address from,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes calldata data\\n ) external;\\n\\n function batchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xf1cb108c7274c973356adedb18230b18bdad992b946e0921cc3ebed04f59c92e\",\"license\":\"MIT\"},\"src/solc_0.8/common/interfaces/IPolygonLand.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\nimport \\\"./ILandToken.sol\\\";\\n\\ninterface IPolygonLand is ILandToken {\\n function mintQuad(\\n address user,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes memory data\\n ) external;\\n\\n function exists(\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5a52e567ddb2271b88c5dfe919401036f0f6c15dd7ff7a6eb055e12a6c12f06c\",\"license\":\"MIT\"},\"src/solc_0.8/polygon/child/land/PolygonLandBaseToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// solhint-disable code-complexity\\n\\npragma solidity 0.8.2;\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\\\";\\nimport \\\"../../../common/BaseWithStorage/ERC721BaseTokenV2.sol\\\";\\nimport \\\"../../../common/interfaces/IPolygonLand.sol\\\";\\n\\nabstract contract PolygonLandBaseToken is IPolygonLand, Initializable, ERC721BaseTokenV2 {\\n using AddressUpgradeable for address;\\n\\n uint256 internal constant GRID_SIZE = 408;\\n\\n uint256 internal constant LAYER = 0xFF00000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_1x1 = 0x0000000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_3x3 = 0x0100000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_6x6 = 0x0200000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_12x12 = 0x0300000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_24x24 = 0x0400000000000000000000000000000000000000000000000000000000000000;\\n\\n mapping(address => bool) internal _minters;\\n\\n event Minter(address minter, bool enabled);\\n\\n modifier validQuad(\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) {\\n require(size == 1 || size == 3 || size == 6 || size == 12 || size == 24, \\\"Invalid size\\\");\\n require(x % size == 0 && y % size == 0, \\\"Invalid coordinates\\\");\\n require(x <= GRID_SIZE - size && y <= GRID_SIZE - size, \\\"Out of bounds\\\");\\n\\n _;\\n }\\n\\n /**\\n * @notice Return the name of the token contract\\n * @return The name of the token contract\\n */\\n function name() public pure returns (string memory) {\\n return \\\"Sandbox's LANDs\\\";\\n }\\n\\n /**\\n * @notice Return the symbol of the token contract\\n * @return The symbol of the token contract\\n */\\n function symbol() public pure returns (string memory) {\\n return \\\"LAND\\\";\\n }\\n\\n /// @notice total width of the map\\n /// @return width\\n function width() public pure returns (uint256) {\\n return GRID_SIZE;\\n }\\n\\n /// @notice total height of the map\\n /// @return height\\n function height() public pure returns (uint256) {\\n return GRID_SIZE;\\n }\\n\\n /// @notice x coordinate of Land token\\n /// @param id tokenId\\n /// @return the x coordinates\\n function getX(uint256 id) external view returns (uint256) {\\n require(_ownerOf(id) != address(0), \\\"token does not exist\\\");\\n return id % GRID_SIZE;\\n }\\n\\n /// @notice y coordinate of Land token\\n /// @param id tokenId\\n /// @return the y coordinates\\n function getY(uint256 id) external view returns (uint256) {\\n require(_ownerOf(id) != address(0), \\\"token does not exist\\\");\\n return id / GRID_SIZE;\\n }\\n\\n /**\\n * @notice Return the URI of a specific token\\n * @param id The id of the token\\n * @return The URI of the token\\n */\\n function tokenURI(uint256 id) public view returns (string memory) {\\n require(_ownerOf(id) != address(0), \\\"Id does not exist\\\");\\n return\\n string(\\n abi.encodePacked(\\\"https://api.sandbox.game/lands/\\\", StringsUpgradeable.toString(id), \\\"/metadata.json\\\")\\n );\\n }\\n\\n /**\\n * @notice Check if the contract supports an interface\\n * 0x01ffc9a7 is ERC-165\\n * 0x80ac58cd is ERC-721\\n * 0x5b5e139f is ERC-721 metadata\\n * @param id The id of the interface\\n * @return True if the interface is supported\\n */\\n function supportsInterface(bytes4 id) public pure override returns (bool) {\\n return id == 0x01ffc9a7 || id == 0x80ac58cd || id == 0x5b5e139f;\\n }\\n\\n /**\\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\\n * @param user The recipient of the new quad\\n * @param size The size of the new quad\\n * @param x The top left x coordinate of the new quad\\n * @param y The top left y coordinate of the new quad\\n * @param data extra data to pass to the transfer\\n */\\n function mintQuad(\\n address user,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes memory data\\n ) external virtual override {\\n require(isMinter(_msgSender()), \\\"!AUTHORIZED\\\");\\n _mintQuad(user, size, x, y, data);\\n }\\n\\n function _mintQuad(\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes memory data\\n ) internal {\\n require(to != address(0), \\\"to is zero address\\\");\\n require(!exists(size, x, y), \\\"Already minted\\\");\\n\\n uint256 quadId;\\n uint256 id = x + y * GRID_SIZE;\\n\\n if (size == 1) {\\n quadId = id;\\n } else if (size == 3) {\\n quadId = LAYER_3x3 + id;\\n } else if (size == 6) {\\n quadId = LAYER_6x6 + id;\\n } else if (size == 12) {\\n quadId = LAYER_12x12 + id;\\n } else if (size == 24) {\\n quadId = LAYER_24x24 + id;\\n }\\n\\n for (uint256 i = 0; i < size * size; i++) {\\n emit Transfer(address(0), to, _idInPath(i, size, x, y));\\n }\\n\\n _owners[quadId] = uint256(uint160(address(to)));\\n _numNFTPerAddress[to] += size * size;\\n\\n _checkBatchReceiverAcceptQuad(_msgSender(), address(0), to, size, x, y, data);\\n }\\n\\n function batchTransferQuad(\\n address from,\\n address to,\\n uint256[] calldata sizes,\\n uint256[] calldata xs,\\n uint256[] calldata ys,\\n bytes calldata data\\n ) external override {\\n require(from != address(0), \\\"from is zero address\\\");\\n require(to != address(0), \\\"can't send to zero address\\\");\\n require(sizes.length == xs.length && xs.length == ys.length, \\\"invalid data\\\");\\n if (_msgSender() != from) {\\n require(\\n _operatorsForAll[from][_msgSender()] || _superOperators[_msgSender()],\\n \\\"not authorized to transferMultiQuads\\\"\\n );\\n }\\n uint256 numTokensTransfered = 0;\\n for (uint256 i = 0; i < sizes.length; i++) {\\n uint256 size = sizes[i];\\n _transferQuad(from, to, size, xs[i], ys[i]);\\n numTokensTransfered += size * size;\\n }\\n _numNFTPerAddress[from] -= numTokensTransfered;\\n _numNFTPerAddress[to] += numTokensTransfered;\\n\\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\\n uint256[] memory ids = new uint256[](numTokensTransfered);\\n uint256 counter = 0;\\n for (uint256 j = 0; j < sizes.length; j++) {\\n uint256 size = sizes[j];\\n for (uint256 i = 0; i < size * size; i++) {\\n ids[counter] = _idInPath(i, size, xs[j], ys[j]);\\n counter++;\\n }\\n }\\n require(\\n _checkOnERC721BatchReceived(_msgSender(), from, to, ids, data),\\n \\\"erc721 batch transfer rejected by to\\\"\\n );\\n }\\n }\\n\\n function transferQuad(\\n address from,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes calldata data\\n ) external override {\\n require(from != address(0), \\\"from is zero address\\\");\\n require(to != address(0), \\\"can't send to zero address\\\");\\n if (_msgSender() != from) {\\n require(\\n _operatorsForAll[from][_msgSender()] || _superOperators[_msgSender()],\\n \\\"not authorized to transferQuad\\\"\\n );\\n }\\n _transferQuad(from, to, size, x, y);\\n _numNFTPerAddress[from] -= size * size;\\n _numNFTPerAddress[to] += size * size;\\n\\n _checkBatchReceiverAcceptQuad(_msgSender(), from, to, size, x, y, data);\\n }\\n\\n function batchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) public override(ILandToken, ERC721BaseTokenV2) {\\n super.batchTransferFrom(from, to, ids, data);\\n }\\n\\n function exists(\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) public view override validQuad(size, x, y) returns (bool) {\\n if (_owners[LAYER_24x24 + (x / 24) * 24 + ((y / 24) * 24) * GRID_SIZE] != 0) return true;\\n uint256 toX = x + size;\\n uint256 toY = y + size;\\n if (size <= 12) {\\n if (_owners[LAYER_12x12 + (x / 12) * 12 + ((y / 12) * 12) * GRID_SIZE] != 0) return true;\\n } else {\\n for (uint256 x12i = x; x12i < toX; x12i += 12) {\\n for (uint256 y12i = y; y12i < toY; y12i += 12) {\\n uint256 id12x12 = LAYER_12x12 + x12i + y12i * GRID_SIZE;\\n if (_owners[id12x12] != 0) return true;\\n }\\n }\\n }\\n\\n if (size <= 6) {\\n if (_owners[LAYER_6x6 + (x / 6) * 6 + ((y / 6) * 6) * GRID_SIZE] != 0) return true;\\n } else {\\n for (uint256 x6i = x; x6i < toX; x6i += 6) {\\n for (uint256 y6i = y; y6i < toY; y6i += 6) {\\n uint256 id6x6 = LAYER_6x6 + x6i + y6i * GRID_SIZE;\\n if (_owners[id6x6] != 0) return true;\\n }\\n }\\n }\\n\\n if (size <= 3) {\\n if (_owners[LAYER_3x3 + (x / 3) * 3 + ((y / 3) * 3) * GRID_SIZE] != 0) return true;\\n } else {\\n for (uint256 x3i = x; x3i < toX; x3i += 3) {\\n for (uint256 y3i = y; y3i < toY; y3i += 3) {\\n uint256 id3x3 = LAYER_3x3 + x3i + y3i * GRID_SIZE;\\n if (_owners[id3x3] != 0) return true;\\n }\\n }\\n }\\n\\n for (uint256 i = 0; i < size * size; i++) {\\n if (_owners[_idInPath(i, size, x, y)] != 0) return true;\\n }\\n\\n return false;\\n }\\n\\n /// @notice Enable or disable the ability of `minter` to transfer tokens of all (minter rights).\\n /// @param minter address that will be given/removed minter right.\\n /// @param enabled set whether the minter is enabled or disabled.\\n function setMinter(address minter, bool enabled) external {\\n require(_msgSender() == _admin, \\\"only admin is allowed to add minters\\\");\\n require(minter != address(0), \\\"PolygonLand: Invalid address\\\");\\n _minters[minter] = enabled;\\n emit Minter(minter, enabled);\\n }\\n\\n /// @notice check whether address `who` is given minter rights.\\n /// @param who The address to query.\\n /// @return whether the address has minter rights.\\n function isMinter(address who) public view returns (bool) {\\n return _minters[who];\\n }\\n\\n function _transferQuad(\\n address from,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) internal validQuad(size, x, y) {\\n if (size == 1) {\\n uint256 id1x1 = x + y * GRID_SIZE;\\n address owner = _ownerOf(id1x1);\\n require(owner != address(0), \\\"token does not exist\\\");\\n require(owner == from, \\\"not owner in _transferQuad\\\");\\n _owners[id1x1] = uint256(uint160(address(to)));\\n } else {\\n _regroup(from, to, size, x, y);\\n }\\n for (uint256 i = 0; i < size * size; i++) {\\n emit Transfer(from, to, _idInPath(i, size, x, y));\\n }\\n }\\n\\n function _idInPath(\\n uint256 i,\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) internal pure returns (uint256) {\\n uint256 row = i / size;\\n if (row % 2 == 0) {\\n // allow ids to follow a path in a quad\\n return (x + (i % size)) + ((y + row) * GRID_SIZE);\\n } else {\\n return ((x + size) - (1 + (i % size))) + ((y + row) * GRID_SIZE);\\n }\\n }\\n\\n function _regroup(\\n address from,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) internal {\\n if (size == 3) {\\n _regroup3x3(from, to, x, y, true);\\n } else if (size == 6) {\\n _regroup6x6(from, to, x, y, true);\\n } else if (size == 12) {\\n _regroup12x12(from, to, x, y, true);\\n } else if (size == 24) {\\n _regroup24x24(from, to, x, y, true);\\n }\\n }\\n\\n function _regroup3x3(\\n address from,\\n address to,\\n uint256 x,\\n uint256 y,\\n bool set\\n ) internal returns (bool) {\\n uint256 id = x + y * GRID_SIZE;\\n uint256 quadId = LAYER_3x3 + id;\\n bool ownerOfAll = true;\\n for (uint256 xi = x; xi < x + 3; xi++) {\\n for (uint256 yi = y; yi < y + 3; yi++) {\\n ownerOfAll = _checkAndClear(from, xi + yi * GRID_SIZE) && ownerOfAll;\\n }\\n }\\n if (set) {\\n if (!ownerOfAll) {\\n require(_ownerOfQuad(3, x, y) == from, \\\"not owner of all sub quads nor parent quads\\\");\\n }\\n _owners[quadId] = uint256(uint160(address(to)));\\n return true;\\n }\\n return ownerOfAll;\\n }\\n\\n function _regroup6x6(\\n address from,\\n address to,\\n uint256 x,\\n uint256 y,\\n bool set\\n ) internal returns (bool) {\\n uint256 id = x + y * GRID_SIZE;\\n uint256 quadId = LAYER_6x6 + id;\\n bool ownerOfAll = true;\\n for (uint256 xi = x; xi < x + 6; xi += 3) {\\n for (uint256 yi = y; yi < y + 6; yi += 3) {\\n bool ownAllIndividual = _regroup3x3(from, to, xi, yi, false);\\n uint256 id3x3 = LAYER_3x3 + xi + yi * GRID_SIZE;\\n uint256 owner3x3 = _owners[id3x3];\\n if (owner3x3 != 0) {\\n if (!ownAllIndividual) {\\n require(owner3x3 == uint256(uint160(address(from))), \\\"not owner of 3x3 quad\\\");\\n }\\n _owners[id3x3] = 0;\\n }\\n ownerOfAll = (ownAllIndividual || owner3x3 != 0) && ownerOfAll;\\n }\\n }\\n if (set) {\\n if (!ownerOfAll) {\\n require(_ownerOfQuad(6, x, y) == from, \\\"not owner of all sub quads nor parent quads\\\");\\n }\\n _owners[quadId] = uint256(uint160(address(to)));\\n return true;\\n }\\n return ownerOfAll;\\n }\\n\\n function _regroup12x12(\\n address from,\\n address to,\\n uint256 x,\\n uint256 y,\\n bool set\\n ) internal returns (bool) {\\n uint256 id = x + y * GRID_SIZE;\\n uint256 quadId = LAYER_12x12 + id;\\n bool ownerOfAll = true;\\n for (uint256 xi = x; xi < x + 12; xi += 6) {\\n for (uint256 yi = y; yi < y + 12; yi += 6) {\\n bool ownAllIndividual = _regroup6x6(from, to, xi, yi, false);\\n uint256 id6x6 = LAYER_6x6 + xi + yi * GRID_SIZE;\\n uint256 owner6x6 = _owners[id6x6];\\n if (owner6x6 != 0) {\\n if (!ownAllIndividual) {\\n require(owner6x6 == uint256(uint160(address(from))), \\\"not owner of 6x6 quad\\\");\\n }\\n _owners[id6x6] = 0;\\n }\\n ownerOfAll = (ownAllIndividual || owner6x6 != 0) && ownerOfAll;\\n }\\n }\\n if (set) {\\n if (!ownerOfAll) {\\n require(_ownerOfQuad(12, x, y) == from, \\\"not owner of all sub quads nor parent quads\\\");\\n }\\n _owners[quadId] = uint256(uint160(address(to)));\\n return true;\\n }\\n return ownerOfAll;\\n }\\n\\n function _regroup24x24(\\n address from,\\n address to,\\n uint256 x,\\n uint256 y,\\n bool set\\n ) internal returns (bool) {\\n uint256 id = x + y * GRID_SIZE;\\n uint256 quadId = LAYER_24x24 + id;\\n bool ownerOfAll = true;\\n for (uint256 xi = x; xi < x + 24; xi += 12) {\\n for (uint256 yi = y; yi < y + 24; yi += 12) {\\n bool ownAllIndividual = _regroup12x12(from, to, xi, yi, false);\\n uint256 id12x12 = LAYER_12x12 + xi + yi * GRID_SIZE;\\n uint256 owner12x12 = _owners[id12x12];\\n if (owner12x12 != 0) {\\n if (!ownAllIndividual) {\\n require(owner12x12 == uint256(uint160(address(from))), \\\"not owner of 12x12 quad\\\");\\n }\\n _owners[id12x12] = 0;\\n }\\n ownerOfAll = (ownAllIndividual || owner12x12 != 0) && ownerOfAll;\\n }\\n }\\n if (set) {\\n if (!ownerOfAll) {\\n require(\\n _owners[quadId] == uint256(uint160(address(from))),\\n \\\"not owner of all sub quads not parent quad\\\"\\n );\\n }\\n _owners[quadId] = uint256(uint160(address(to)));\\n return true;\\n }\\n return ownerOfAll || _owners[quadId] == uint256(uint160(address(from)));\\n }\\n\\n function _ownerOfQuad(\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) internal returns (address) {\\n uint256 layer;\\n uint256 parentSize = size * 2;\\n if (size == 3) {\\n layer = LAYER_3x3;\\n } else if (size == 6) {\\n layer = LAYER_6x6;\\n } else if (size == 12) {\\n layer = LAYER_12x12;\\n } else if (size == 24) {\\n layer = LAYER_24x24;\\n } else {\\n require(false, \\\"Invalid size\\\");\\n }\\n\\n address owner = address(uint160(_owners[layer + (x / size) * size + ((y / size) * size) * GRID_SIZE]));\\n if (owner != address(0)) {\\n return owner;\\n } else if (size < 24) {\\n return _ownerOfQuad(parentSize, x, y);\\n }\\n return address(0);\\n }\\n\\n function _ownerOf(uint256 id) internal view override returns (address) {\\n require(id & LAYER == 0, \\\"Invalid token id\\\");\\n uint256 x = id % GRID_SIZE;\\n uint256 y = id / GRID_SIZE;\\n uint256 owner1x1 = _owners[id];\\n\\n if ((owner1x1 & BURNED_FLAG) == BURNED_FLAG) {\\n return address(0);\\n }\\n\\n if (owner1x1 != 0) {\\n return address(uint160(owner1x1)); //we check if the quad exists as an 1x1 quad, then 3x3, and so on..\\n } else {\\n address owner3x3 = address(uint160(_owners[LAYER_3x3 + (x / 3) * 3 + ((y / 3) * 3) * GRID_SIZE]));\\n if (owner3x3 != address(0)) {\\n return owner3x3;\\n } else {\\n address owner6x6 = address(uint160(_owners[LAYER_6x6 + (x / 6) * 6 + ((y / 6) * 6) * GRID_SIZE]));\\n if (owner6x6 != address(0)) {\\n return owner6x6;\\n } else {\\n address owner12x12 =\\n address(uint160(_owners[LAYER_12x12 + (x / 12) * 12 + ((y / 12) * 12) * GRID_SIZE]));\\n if (owner12x12 != address(0)) {\\n return owner12x12;\\n } else {\\n return address(uint160(_owners[LAYER_24x24 + (x / 24) * 24 + ((y / 24) * 24) * GRID_SIZE]));\\n }\\n }\\n }\\n }\\n }\\n\\n function _checkAndClear(address from, uint256 id) internal returns (bool) {\\n uint256 owner = _owners[id];\\n if (owner != 0) {\\n require((owner & BURNED_FLAG) != BURNED_FLAG, \\\"not owner\\\");\\n require(address(uint160(owner)) == from, \\\"not owner\\\");\\n _owners[id] = 0;\\n return true;\\n }\\n return false;\\n }\\n\\n function _checkBatchReceiverAcceptQuad(\\n address operator,\\n address from,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes memory data\\n ) internal {\\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\\n uint256[] memory ids = new uint256[](size * size);\\n for (uint256 i = 0; i < size * size; i++) {\\n ids[i] = _idInPath(i, size, x, y);\\n }\\n require(_checkOnERC721BatchReceived(operator, from, to, ids, data), \\\"erc721 batch transfer rejected by to\\\");\\n }\\n }\\n\\n function _ownerAndOperatorEnabledOf(uint256 id)\\n internal\\n view\\n override\\n returns (address owner, bool operatorEnabled)\\n {\\n require(id & LAYER == 0, \\\"Invalid token id\\\");\\n uint256 x = id % GRID_SIZE;\\n uint256 y = id / GRID_SIZE;\\n uint256 owner1x1 = _owners[id];\\n\\n if ((owner1x1 & BURNED_FLAG) == BURNED_FLAG) {\\n owner = address(0);\\n operatorEnabled = (owner1x1 & OPERATOR_FLAG) == OPERATOR_FLAG;\\n return (owner, operatorEnabled);\\n }\\n\\n if (owner1x1 != 0) {\\n owner = address(uint160(owner1x1));\\n operatorEnabled = (owner1x1 & OPERATOR_FLAG) == OPERATOR_FLAG;\\n } else {\\n address owner3x3 = address(uint160(_owners[LAYER_3x3 + (x / 3) * 3 + ((y / 3) * 3) * GRID_SIZE]));\\n if (owner3x3 != address(uint160(0))) {\\n owner = owner3x3;\\n operatorEnabled = false;\\n } else {\\n address owner6x6 = address(uint160(_owners[LAYER_6x6 + (x / 6) * 6 + ((y / 6) * 6) * GRID_SIZE]));\\n if (owner6x6 != address(uint160(0))) {\\n owner = owner6x6;\\n operatorEnabled = false;\\n } else {\\n address owner12x12 =\\n address(uint160(_owners[LAYER_12x12 + (x / 12) * 12 + ((y / 12) * 12) * GRID_SIZE]));\\n if (owner12x12 != address(uint160(0))) {\\n owner = owner12x12;\\n operatorEnabled = false;\\n } else {\\n owner = address(uint160(_owners[LAYER_24x24 + (x / 24) * 24 + ((y / 24) * 24) * GRID_SIZE]));\\n operatorEnabled = false;\\n }\\n }\\n }\\n }\\n }\\n\\n // Empty storage space in contracts for future enhancements\\n // ref: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/issues/13)\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x7f44e877c28d361beafd85ab185f52f674cc1d889a48620e317ce24f6c0643aa\",\"license\":\"MIT\"},\"src/solc_0.8/polygon/child/land/PolygonLandV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.2;\\n\\nimport \\\"./PolygonLandBaseToken.sol\\\";\\nimport \\\"../../../common/BaseWithStorage/ERC2771Handler.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\\\";\\n\\n/// @title LAND token on L2\\ncontract PolygonLandV1 is PolygonLandBaseToken, ERC2771Handler {\\n function initialize(address trustedForwarder) external initializer {\\n _admin = _msgSender();\\n __ERC2771Handler_initialize(trustedForwarder);\\n }\\n\\n /// @dev Change the address of the trusted forwarder for meta-TX\\n /// @param trustedForwarder The new trustedForwarder\\n function setTrustedForwarder(address trustedForwarder) external onlyAdmin {\\n _trustedForwarder = trustedForwarder;\\n }\\n\\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address sender) {\\n return ERC2771Handler._msgSender();\\n }\\n\\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\\n return ERC2771Handler._msgData();\\n }\\n}\\n\",\"keccak256\":\"0xd869ff5c43cab1adf6b75fb43b18a997319c994bcfbd6e48ad283296cb4724ae\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b5061506d806100206000396000f3fe608060405234801561001057600080fd5b50600436106102775760003560e01c806370a0823111610160578063ac9fe421116100d8578063cf456ae71161008c578063e985e9c511610071578063e985e9c514610582578063eaa5e06714610595578063eeb5a5d1146105a857610277565b8063cf456ae71461055c578063da7422281461056f57610277565b8063c4d66de8116100bd578063c4d66de814610525578063c87b56dd14610538578063ce1b815f1461054b57610277565b8063ac9fe421146104ff578063b88d4fde1461051257610277565b80638f2839701161012f5780639ededf77116101145780639ededf77146102f9578063a22cb465146104c0578063aa271e1a146104d357610277565b80638f2839701461047457806395d89b411461048757610277565b806370a082311461042857806379cc67901461043b578063845a46971461044e5780638e5cb5f61461046157610277565b806338bb305a116101f3578063572b6c05116101c2578063654b748a116101a7578063654b748a146103d85780636e1e3bbf146104045780636e9960c31461041757610277565b8063572b6c05146103a35780636352211e146103c557610277565b806338bb305a1461035757806342842e0e1461036a57806342966c681461037d57806355064d851461039057610277565b80630ef267431161024a57806323b872dd1161022f57806323b872dd1461031e57806328cfbd46146103315780632b9917461461034457610277565b80630ef26743146102f957806315ddc5351461030b57610277565b806301ffc9a71461027c57806306fdde03146102a4578063081812fc146102b9578063095ea7b3146102e4575b600080fd5b61028f61028a366004614d4a565b6105bb565b60405190151581526020015b60405180910390f35b6102ac61065a565b60405161029b9190614ef8565b6102cc6102c7366004614d82565b610692565b6040516001600160a01b03909116815260200161029b565b6102f76102f2366004614cb8565b610731565b005b6101985b60405190815260200161029b565b6102f7610319366004614a9e565b610874565b6102f761032c366004614b6e565b61088a565b6102f761033f366004614a9e565b61093f565b6102f7610352366004614b6e565b6109b4565b6102f7610365366004614c0f565b610ba7565b6102f7610378366004614b6e565b610dff565b6102f761038b366004614d82565b610e1a565b61028f61039e366004614d9a565b610e37565b61028f6103b136600461496f565b606b546001600160a01b0390811691161490565b6102cc6103d3366004614d82565b6113ac565b61028f6103e636600461496f565b6001600160a01b031660009081526034602052604090205460ff1690565b6102f7610412366004614ce1565b61140f565b6033546001600160a01b03166102cc565b6102fd61043636600461496f565b611473565b6102f7610449366004614cb8565b6114e7565b6102fd61045c366004614d82565b611644565b6102fd61046f366004614d82565b6116b3565b6102f761048236600461496f565b611722565b60408051808201909152600481527f4c414e440000000000000000000000000000000000000000000000000000000060208201526102ac565b6102f76104ce366004614c8f565b6117fd565b61028f6104e136600461496f565b6001600160a01b031660009081526039602052604090205460ff1690565b6102f761050d366004614c8f565b611813565b6102f7610520366004614ba9565b6118f7565b6102f761053336600461496f565b611984565b6102ac610546366004614d82565b611a99565b606b546001600160a01b03166102cc565b6102f761056a366004614c8f565b611b2c565b6102f761057d36600461496f565b611c74565b61028f610590366004614989565b611d0d565b6102f76105a33660046149bb565b611d64565b6102f76105b6366004614b2c565b6122cc565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316148061061e57507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b8061065257507f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b90505b919050565b60408051808201909152600f81527f53616e64626f782773204c414e4473000000000000000000000000000000000060208201525b90565b60008060006106a0846123bd565b90925090506001600160a01b0382166107005760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e00000000000000000000000000000060448201526064015b60405180910390fd5b8015610726575050506000818152603860205260409020546001600160a01b0316610655565b600092505050610655565b6000818152603660205260408120549061074a836126a4565b9050600061075661296d565b90506001600160a01b0382166107ae5760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e00000000000000000000000000000060448201526064016106f7565b806001600160a01b0316826001600160a01b031614806107f357506001600160a01b0380831660009081526037602090815260408083209385168352929052205460ff165b8061081657506001600160a01b03811660009081526034602052604090205460ff165b6108625760405162461bcd60e51b815260206004820152601560248201527f554e415554484f52495a45445f415050524f56414c000000000000000000000060448201526064016106f7565b61086d83868661297c565b5050505050565b610882868686868686612a32565b505050505050565b610895838383612aa4565b506108a1838383612cbe565b6001600160a01b0382163b151580156108c657506108c6826317a2fd9160e21b612d7c565b1561093a576108ee6108d661296d565b84848460405180602001604052806000815250612e43565b61093a5760405162461bcd60e51b815260206004820152601860248201527f4552433732315f5452414e534645525f52454a4543544544000000000000000060448201526064016106f7565b505050565b610882868686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8a01819004810282018101909252888152925088915087908190840183828082843760009201919091525060019250612f03915050565b600081815260366020526040812054906109cd836126a4565b905060006109d961296d565b90506001600160a01b038616610a315760405162461bcd60e51b815260206004820152601360248201527f5a45524f5f414444524553535f53454e4445520000000000000000000000000060448201526064016106f7565b6001600160a01b038216610a875760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e00000000000000000000000000000060448201526064016106f7565b856001600160a01b0316816001600160a01b03161480610acc57506001600160a01b0380871660009081526037602090815260408083209385168352929052205460ff165b80610aef57506001600160a01b03811660009081526034602052604090205460ff165b610b3b5760405162461bcd60e51b815260206004820152601560248201527f554e415554484f52495a45445f415050524f56414c000000000000000000000060448201526064016106f7565b856001600160a01b0316836001600160a01b031614610b9c5760405162461bcd60e51b815260206004820152601060248201527f4f574e45525f4e4f545f53454e4445520000000000000000000000000000000060448201526064016106f7565b61088283868661297c565b6001600160a01b038716610bfd5760405162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f206164647265737300000000000000000000000060448201526064016106f7565b6001600160a01b038616610c535760405162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f206164647265737300000000000060448201526064016106f7565b866001600160a01b0316610c6561296d565b6001600160a01b031614610d2d576001600160a01b038716600090815260376020526040812090610c9461296d565b6001600160a01b0316815260208101919091526040016000205460ff1680610ce1575060346000610cc361296d565b6001600160a01b0316815260208101919091526040016000205460ff165b610d2d5760405162461bcd60e51b815260206004820152601e60248201527f6e6f7420617574686f72697a656420746f207472616e7366657251756164000060448201526064016106f7565b610d3a8787878787613366565b610d448580614f37565b6001600160a01b03881660009081526035602052604081208054909190610d6c908490614f56565b90915550610d7c90508580614f37565b6001600160a01b03871660009081526035602052604081208054909190610da4908490614f0b565b90915550610df69050610db561296d565b888888888888888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061364792505050565b50505050505050565b61093a838383604051806020016040528060008152506118f7565b610e34610e2561296d565b610e2e836126a4565b836137ab565b50565b60008383838260011480610e4b5750826003145b80610e565750826006145b80610e61575082600c145b80610e6c5750826018145b610eb85760405162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a65000000000000000000000000000000000000000060448201526064016106f7565b610ec28383614fcb565b158015610ed65750610ed48382614fcb565b155b610f225760405162461bcd60e51b815260206004820152601360248201527f496e76616c696420636f6f7264696e617465730000000000000000000000000060448201526064016106f7565b610f2e83610198614f56565b8211158015610f485750610f4483610198614f56565b8111155b610f945760405162461bcd60e51b815260206004820152600d60248201527f4f7574206f6620626f756e64730000000000000000000000000000000000000060448201526064016106f7565b60366000610198610fa6601889614f23565b610fb1906018614f37565b610fbb9190614f37565b610fc660188a614f23565b610fd1906018614f37565b610fdf90600160fa1b614f0b565b610fe99190614f0b565b81526020019081526020016000205460001461100857600193506113a2565b60006110148888614f0b565b905060006110228988614f0b565b9050600c89116110a7576036600061019861103e600c8b614f23565b61104990600c614f37565b6110539190614f37565b61105e600c8c614f23565b61106990600c614f37565b61107790600360f81b614f0b565b6110819190614f0b565b8152602001908152602001600020546000146110a2576001955050506113a2565b61112e565b875b8281101561112c57875b828110156111195760006110c961019883614f37565b6110d784600360f81b614f0b565b6110e19190614f0b565b60008181526036602052604090205490915015611106576001985050505050506113a2565b50611112600c82614f0b565b90506110b3565b50611125600c82614f0b565b90506110a9565b505b600689116111b1576036600061019861114860068b614f23565b611153906006614f37565b61115d9190614f37565b61116860068c614f23565b611173906006614f37565b61118190600160f91b614f0b565b61118b9190614f0b565b8152602001908152602001600020546000146111ac576001955050506113a2565b611238565b875b8281101561123657875b828110156112235760006111d361019883614f37565b6111e184600160f91b614f0b565b6111eb9190614f0b565b60008181526036602052604090205490915015611210576001985050505050506113a2565b5061121c600682614f0b565b90506111bd565b5061122f600682614f0b565b90506111b3565b505b600389116112bb576036600061019861125260038b614f23565b61125d906003614f37565b6112679190614f37565b61127260038c614f23565b61127d906003614f37565b61128b90600160f81b614f0b565b6112959190614f0b565b8152602001908152602001600020546000146112b6576001955050506113a2565b611342565b875b8281101561134057875b8281101561132d5760006112dd61019883614f37565b6112eb84600160f81b614f0b565b6112f59190614f0b565b6000818152603660205260409020549091501561131a576001985050505050506113a2565b50611326600382614f0b565b90506112c7565b50611339600382614f0b565b90506112bd565b505b60005b61134f8a80614f37565b81101561139a5760366000611366838d8d8d6138a2565b81526020019081526020016000205460001461138857600196505050506113a2565b8061139281614fb0565b915050611345565b506000955050505b5050509392505050565b60006113b7826126a4565b90506001600160a01b0381166106555760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354414e545f544f4b454e00000000000000000000000000000060448201526064016106f7565b61141a6104e161296d565b6114665760405162461bcd60e51b815260206004820152600b60248201527f21415554484f52495a454400000000000000000000000000000000000000000060448201526064016106f7565b61086d8585858585613945565b60006001600160a01b0382166114cb5760405162461bcd60e51b815260206004820152601260248201527f5a45524f5f414444524553535f4f574e4552000000000000000000000000000060448201526064016106f7565b506001600160a01b031660009081526035602052604090205490565b6001600160a01b03821661153d5760405162461bcd60e51b815260206004820152601460248201527f4e4f545f46524f4d5f5a45524f4144445245535300000000000000000000000060448201526064016106f7565b600080611549836123bd565b91509150600061155761296d565b9050846001600160a01b0316816001600160a01b0316148061159a575081801561159a57506000848152603860205260409020546001600160a01b038281169116145b806115bd57506001600160a01b03811660009081526034602052604090205460ff165b806115ed57506001600160a01b0380861660009081526037602090815260408083209385168352929052205460ff165b6116395760405162461bcd60e51b815260206004820152601160248201527f554e415554484f52495a45445f4255524e00000000000000000000000000000060448201526064016106f7565b61086d8584866137ab565b600080611650836126a4565b6001600160a01b031614156116a75760405162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f7420657869737400000000000000000000000060448201526064016106f7565b61065261019883614f23565b6000806116bf836126a4565b6001600160a01b031614156117165760405162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f7420657869737400000000000000000000000060448201526064016106f7565b61065261019883614fcb565b6033546001600160a01b03168061173761296d565b6001600160a01b03161461178d5760405162461bcd60e51b815260206004820152601360248201527f41444d494e5f4143434553535f44454e4945440000000000000000000000000060448201526064016106f7565b816001600160a01b0316816001600160a01b03167f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f60405160405180910390a3506033805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b61180f61180861296d565b8383613b57565b5050565b6033546001600160a01b031661182761296d565b6001600160a01b0316146118a35760405162461bcd60e51b815260206004820152602c60248201527f6f6e6c792061646d696e20697320616c6c6f77656420746f206164642073757060448201527f6572206f70657261746f7273000000000000000000000000000000000000000060648201526084016106f7565b6001600160a01b038216600081815260346020526040808220805460ff191685151590811790915590519092917f44f92d27abdf4cfb6a7d712c3af68f3be086d4ca747ab802c36f67d6790060d891a35050565b611902848484612aa4565b5061190e848484612cbe565b6001600160a01b0383163b1561197e5761193261192961296d565b85858585612e43565b61197e5760405162461bcd60e51b815260206004820152601860248201527f4552433732315f5452414e534645525f52454a4543544544000000000000000060448201526064016106f7565b50505050565b600054610100900460ff1661199f5760005460ff16156119a3565b303b155b611a155760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016106f7565b600054610100900460ff16158015611a40576000805460ff1961ff0019909116610100171660011790555b611a4861296d565b6033805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b0393841617909155606b8054909116918416919091179055801561180f576000805461ff00191690555050565b60606000611aa6836126a4565b6001600160a01b03161415611afd5760405162461bcd60e51b815260206004820152601160248201527f496420646f6573206e6f7420657869737400000000000000000000000000000060448201526064016106f7565b611b0682613c2d565b604051602001611b169190614df1565b6040516020818303038152906040529050919050565b6033546001600160a01b0316611b4061296d565b6001600160a01b031614611bbb5760405162461bcd60e51b8152602060048201526024808201527f6f6e6c792061646d696e20697320616c6c6f77656420746f20616464206d696e60448201527f746572730000000000000000000000000000000000000000000000000000000060648201526084016106f7565b6001600160a01b038216611c115760405162461bcd60e51b815260206004820152601c60248201527f506f6c79676f6e4c616e643a20496e76616c696420616464726573730000000060448201526064016106f7565b6001600160a01b038216600081815260396020908152604091829020805460ff19168515159081179091558251938452908301527fff452b3b9159b024a9098f0058c63eccd90d36b3584608202800d662f962bb60910160405180910390a15050565b6033546001600160a01b0316611c8861296d565b6001600160a01b031614611cde5760405162461bcd60e51b815260206004820152600a60248201527f41444d494e5f4f4e4c590000000000000000000000000000000000000000000060448201526064016106f7565b606b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001600160a01b03808316600090815260376020908152604080832093851683529290529081205460ff1680611d5b57506001600160a01b03821660009081526034602052604090205460ff165b90505b92915050565b6001600160a01b038a16611dba5760405162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f206164647265737300000000000000000000000060448201526064016106f7565b6001600160a01b038916611e105760405162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f206164647265737300000000000060448201526064016106f7565b8685148015611e1e57508483145b611e6a5760405162461bcd60e51b815260206004820152600c60248201527f696e76616c69642064617461000000000000000000000000000000000000000060448201526064016106f7565b896001600160a01b0316611e7c61296d565b6001600160a01b031614611f69576001600160a01b038a16600090815260376020526040812090611eab61296d565b6001600160a01b0316815260208101919091526040016000205460ff1680611ef8575060346000611eda61296d565b6001600160a01b0316815260208101919091526040016000205460ff165b611f695760405162461bcd60e51b8152602060048201526024808201527f6e6f7420617574686f72697a656420746f207472616e736665724d756c74695160448201527f756164730000000000000000000000000000000000000000000000000000000060648201526084016106f7565b6000805b888110156120235760008a8a83818110611f9757634e487b7160e01b600052603260045260246000fd5b905060200201359050611ff98d8d838c8c87818110611fc657634e487b7160e01b600052603260045260246000fd5b905060200201358b8b88818110611fed57634e487b7160e01b600052603260045260246000fd5b90506020020135613366565b6120038180614f37565b61200d9084614f0b565b925050808061201b90614fb0565b915050611f6d565b506001600160a01b038b166000908152603560205260408120805483929061204c908490614f56565b90915550506001600160a01b038a1660009081526035602052604081208054839290612079908490614f0b565b90915550506001600160a01b038a163b151580156120a357506120a38a6317a2fd9160e21b612d7c565b156122bf5760008167ffffffffffffffff8111156120d157634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156120fa578160200160208202803683370190505b5090506000805b8a8110156122005760008c8c8381811061212b57634e487b7160e01b600052603260045260246000fd5b90506020020135905060005b6121418280614f37565b8110156121eb576121a081838e8e8781811061216d57634e487b7160e01b600052603260045260246000fd5b905060200201358d8d8881811061219457634e487b7160e01b600052603260045260246000fd5b905060200201356138a2565b8585815181106121c057634e487b7160e01b600052603260045260246000fd5b6020908102919091010152836121d581614fb0565b94505080806121e390614fb0565b915050612137565b505080806121f890614fb0565b915050612101565b5061224b61220c61296d565b8e8e8589898080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613d7c92505050565b6122bc5760405162461bcd60e51b8152602060048201526024808201527f657263373231206261746368207472616e736665722072656a6563746564206260448201527f7920746f0000000000000000000000000000000000000000000000000000000060648201526084016106f7565b50505b5050505050505050505050565b6001600160a01b0383166123225760405162461bcd60e51b815260206004820152601660248201527f496e76616c69642073656e64657220616464726573730000000000000000000060448201526064016106f7565b600061232c61296d565b9050836001600160a01b0316816001600160a01b0316148061236657506001600160a01b03811660009081526034602052604090205460ff165b6123b25760405162461bcd60e51b815260206004820152601c60248201527f554e415554484f52495a45445f415050524f56455f464f525f414c4c0000000060448201526064016106f7565b61197e848484613b57565b6000807fff000000000000000000000000000000000000000000000000000000000000008316156124305760405162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e2069640000000000000000000000000000000060448201526064016106f7565b600061243e61019885614fcb565b9050600061244e61019886614f23565b600086815260366020526040902054909150600160a01b80821614156124855760009450600160ff1b80821614935050505061269f565b801561249e57809450600160ff1b80821614935061269b565b60006036816101986124b1600387614f23565b6124bc906003614f37565b6124c69190614f37565b6124d1600388614f23565b6124dc906003614f37565b6124ea90600160f81b614f0b565b6124f49190614f0b565b815260208101919091526040016000205490506001600160a01b038116156125225780955060009450612699565b6000603681610198612535600688614f23565b612540906006614f37565b61254a9190614f37565b612555600689614f23565b612560906006614f37565b61256e90600160f91b614f0b565b6125789190614f0b565b815260208101919091526040016000205490506001600160a01b038116156125a65780965060009550612697565b60006036816101986125b9600c89614f23565b6125c490600c614f37565b6125ce9190614f37565b6125d9600c8a614f23565b6125e490600c614f37565b6125f290600360f81b614f0b565b6125fc9190614f0b565b815260208101919091526040016000205490506001600160a01b0381161561262a5780975060009650612695565b6036600061019861263c601889614f23565b612647906018614f37565b6126519190614f37565b61265c60188a614f23565b612667906018614f37565b61267590600160fa1b614f0b565b61267f9190614f0b565b8152602001908152602001600020549750600096505b505b505b505b5050505b915091565b60007fff000000000000000000000000000000000000000000000000000000000000008216156127165760405162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e2069640000000000000000000000000000000060448201526064016106f7565b600061272461019884614fcb565b9050600061273461019885614f23565b600085815260366020526040902054909150600160a01b80821614156127605760009350505050610655565b8015612770579250610655915050565b6000603681610198612783600387614f23565b61278e906003614f37565b6127989190614f37565b6127a3600388614f23565b6127ae906003614f37565b6127bc90600160f81b614f0b565b6127c69190614f0b565b815260208101919091526040016000205490506001600160a01b038116156127f357935061065592505050565b6000603681610198612806600688614f23565b612811906006614f37565b61281b9190614f37565b612826600689614f23565b612831906006614f37565b61283f90600160f91b614f0b565b6128499190614f0b565b815260208101919091526040016000205490506001600160a01b038116156128775794506106559350505050565b600060368161019861288a600c89614f23565b61289590600c614f37565b61289f9190614f37565b6128aa600c8a614f23565b6128b590600c614f37565b6128c390600360f81b614f0b565b6128cd9190614f0b565b815260208101919091526040016000205490506001600160a01b038116156128fc579550610655945050505050565b6036600061019861290e601889614f23565b612919906018614f37565b6129239190614f37565b61292e60188a614f23565b612939906018614f37565b61294790600160fa1b614f0b565b6129519190614f0b565b8152602001908152602001600020549650505050505050610655565b6000612977613e3b565b905090565b6000612987826126a4565b90506001600160a01b0383166129a9576129a48285836000613e85565b6129eb565b6129b68285836001613e85565b6000828152603860205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385161790555b81836001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a450505050565b610882868686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8a01819004810282018101909252888152925088915087908190840183828082843760009201829052509250612f03915050565b6000806000612ab2846123bd565b915091506000612ac061296d565b90506001600160a01b038316612b185760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e00000000000000000000000000000060448201526064016106f7565b866001600160a01b0316836001600160a01b031614612b795760405162461bcd60e51b815260206004820152601760248201527f434845434b5452414e534645525f4e4f545f4f574e455200000000000000000060448201526064016106f7565b6001600160a01b038616612bcf5760405162461bcd60e51b815260206004820152601260248201527f4e4f545f544f5f5a45524f41444452455353000000000000000000000000000060448201526064016106f7565b826001600160a01b0316816001600160a01b03161480612c0757506001600160a01b03811660009081526034602052604090205460ff165b80612c3757506001600160a01b0380881660009081526037602090815260408083209385168352929052205460ff165b80612c635750818015612c6357506000858152603860205260409020546001600160a01b038281169116145b612caf5760405162461bcd60e51b815260206004820152601560248201527f554e415554484f52495a45445f5452414e53464552000000000000000000000060448201526064016106f7565b600193505050505b9392505050565b6001600160a01b0383166000908152603560205260408120805491612ce283614f99565b90915550506001600160a01b0382166000908152603560205260408120805491612d0b83614fb0565b9190505550612d368160366000612d1f8590565b815260200190815260200160002054846000613e85565b80826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b604080516001600160e01b031983166024808301919091528251808303909101815260449091018252602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001781528251935160008082529485948594909392908183858c612710fa955080519450505050609e5a11612e2f57634e487b7160e01b600052600160045260246000fd5b828015612e395750815b9695505050505050565b600080846001600160a01b031663150b7a02888887876040518563ffffffff1660e01b8152600401612e789493929190614ec6565b602060405180830381600087803b158015612e9257600080fd5b505af1158015612ea6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612eca9190614d66565b6001600160e01b0319167f150b7a0200000000000000000000000000000000000000000000000000000000149150505b95945050505050565b6000612f0d61296d565b90506000866001600160a01b0316826001600160a01b03161480612f5657506001600160a01b0380881660009081526037602090815260408083209386168352929052205460ff165b80612f7957506001600160a01b03821660009081526034602052604090205460ff165b90506001600160a01b038716612fd15760405162461bcd60e51b815260206004820152601460248201527f4e4f545f46524f4d5f5a45524f4144445245535300000000000000000000000060448201526064016106f7565b6001600160a01b0386166130275760405162461bcd60e51b815260206004820152601260248201527f4e4f545f544f5f5a45524f41444452455353000000000000000000000000000060448201526064016106f7565b845160005b818110156131be57600087828151811061305657634e487b7160e01b600052603260045260246000fd5b6020026020010151905060008061306c836123bd565b915091508b6001600160a01b0316826001600160a01b0316146130d15760405162461bcd60e51b815260206004820152601b60248201527f42415443485452414e5346455246524f4d5f4e4f545f4f574e4552000000000060448201526064016106f7565b85806130fe57508080156130fe57506000838152603860205260409020546001600160a01b038881169116145b61314a5760405162461bcd60e51b815260206004820152600e60248201527f4e4f545f415554484f52495a454400000000000000000000000000000000000060448201526064016106f7565b600083815260366020526040812054613167918591908e90613e85565b828b6001600160a01b03168d6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a450505080806131b690614fb0565b91505061302c565b50866001600160a01b0316886001600160a01b031614613233576001600160a01b03881660009081526035602052604081208054839290613200908490614f56565b90915550506001600160a01b0387166000908152603560205260408120805483929061322d908490614f0b565b90915550505b6001600160a01b0387163b1561335c57613254876317a2fd9160e21b612d7c565b156132b7576132668389898989613d7c565b6132b25760405162461bcd60e51b815260206004820152601e60248201527f4552433732315f42415443485f52454345495645445f52454a4543544544000060448201526064016106f7565b61335c565b831561335c5760005b8181101561335a576132fc848a8a8a85815181106132ee57634e487b7160e01b600052603260045260246000fd5b60200260200101518a612e43565b6133485760405162461bcd60e51b815260206004820152601860248201527f4552433732315f52454345495645445f52454a4543544544000000000000000060448201526064016106f7565b8061335281614fb0565b9150506132c0565b505b5050505050505050565b82828282600114806133785750826003145b806133835750826006145b8061338e575082600c145b806133995750826018145b6133e55760405162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a65000000000000000000000000000000000000000060448201526064016106f7565b6133ef8383614fcb565b15801561340357506134018382614fcb565b155b61344f5760405162461bcd60e51b815260206004820152601360248201527f496e76616c696420636f6f7264696e617465730000000000000000000000000060448201526064016106f7565b61345b83610198614f56565b8211158015613475575061347183610198614f56565b8111155b6134c15760405162461bcd60e51b815260206004820152600d60248201527f4f7574206f6620626f756e64730000000000000000000000000000000000000060448201526064016106f7565b85600114156135c85760006134d861019886614f37565b6134e29087614f0b565b905060006134ef826126a4565b90506001600160a01b0381166135475760405162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f7420657869737400000000000000000000000060448201526064016106f7565b896001600160a01b0316816001600160a01b0316146135a85760405162461bcd60e51b815260206004820152601a60248201527f6e6f74206f776e657220696e205f7472616e736665725175616400000000000060448201526064016106f7565b5060009081526036602052604090206001600160a01b03881690556135d5565b6135d58888888888613f18565b60005b6135e28780614f37565b81101561335a576135f5818888886138a2565b886001600160a01b03168a6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a48061363f81614fb0565b9150506135d8565b6001600160a01b0385163b1515801561366c575061366c856317a2fd9160e21b612d7c565b15610df657600061367d8580614f37565b67ffffffffffffffff8111156136a357634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156136cc578160200160208202803683370190505b50905060005b6136dc8680614f37565b81101561372c576136ef818787876138a2565b82828151811061370f57634e487b7160e01b600052603260045260246000fd5b60209081029190910101528061372481614fb0565b9150506136d2565b5061373a8888888486613d7c565b61335c5760405162461bcd60e51b8152602060048201526024808201527f657263373231206261746368207472616e736665722072656a6563746564206260448201527f7920746f0000000000000000000000000000000000000000000000000000000060648201526084016106f7565b816001600160a01b0316836001600160a01b03161461380c5760405162461bcd60e51b815260206004820152600960248201527f4e4f545f4f574e4552000000000000000000000000000000000000000000000060448201526064016106f7565b80600160a01b6138216001600160ff1b614f56565b6000838152603660209081526040808320805494909416949094179092556001600160a01b0387168152603590915290812080549161385f83614f99565b909155505060405182906000906001600160a01b038716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a450505050565b6000806138af8587614f23565b90506138bc600282614fcb565b6138fd576101986138cd8285614f0b565b6138d79190614f37565b6138e18688614fcb565b6138eb9086614f0b565b6138f59190614f0b565b91505061393d565b61019861390a8285614f0b565b6139149190614f37565b61391e8688614fcb565b613929906001614f0b565b6139338787614f0b565b6138eb9190614f56565b949350505050565b6001600160a01b03851661399b5760405162461bcd60e51b815260206004820152601260248201527f746f206973207a65726f2061646472657373000000000000000000000000000060448201526064016106f7565b6139a6848484610e37565b156139f35760405162461bcd60e51b815260206004820152600e60248201527f416c7265616479206d696e74656400000000000000000000000000000000000060448201526064016106f7565b600080613a0261019885614f37565b613a0c9086614f0b565b90508560011415613a1f57809150613a85565b8560031415613a3d57613a3681600160f81b614f0b565b9150613a85565b8560061415613a5457613a3681600160f91b614f0b565b85600c1415613a6b57613a3681600360f81b614f0b565b8560181415613a8557613a8281600160fa1b614f0b565b91505b60005b613a928780614f37565b811015613aed57613aa5818888886138a2565b6040516001600160a01b038a16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a480613ae581614fb0565b915050613a88565b5060008281526036602052604090206001600160a01b0388169055613b128680614f37565b6001600160a01b03881660009081526035602052604081208054909190613b3a908490614f0b565b90915550610df69050613b4b61296d565b60008989898989613647565b6001600160a01b03821660009081526034602052604090205460ff1615613bc05760405162461bcd60e51b815260206004820152601760248201527f494e56414c49445f415050524f56414c5f4348414e474500000000000000000060448201526064016106f7565b6001600160a01b03838116600081815260376020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b606081613c6e575060408051808201909152600181527f30000000000000000000000000000000000000000000000000000000000000006020820152610655565b8160005b8115613c985780613c8281614fb0565b9150613c919050600a83614f23565b9150613c72565b60008167ffffffffffffffff811115613cc157634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613ceb576020820181803683370190505b5090505b841561393d57613d00600183614f56565b9150613d0d600a86614fcb565b613d18906030614f0b565b60f81b818381518110613d3b57634e487b7160e01b600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350613d75600a86614f23565b9450613cef565b600080846001600160a01b0316634b808c46888887876040518563ffffffff1660e01b8152600401613db19493929190614e5d565b602060405180830381600087803b158015613dcb57600080fd5b505af1158015613ddf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e039190614d66565b6001600160e01b0319167f4b808c46000000000000000000000000000000000000000000000000000000001491505095945050505050565b606b546000906001600160a01b0316331415613e7e57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c61068f565b503361068f565b8015613ec9576000848152603660205260409020600160ff1b6001600160a01b03841673ffffffffffffffffffffffffffffffffffffffff1986161717905561197e565b6001600160a01b038216613ee26001600160ff1b614f56565b841673ffffffffffffffffffffffffffffffffffffffff1916176036600086815260208101919091526040016000205550505050565b8260031415613f3557613f2f858584846001613f7a565b5061086d565b8260061415613f4c57613f2f8585848460016140ef565b82600c1415613f6357613f2f858584846001614265565b826018141561086d576108828585848460016143db565b600080613f8961019885614f37565b613f939086614f0b565b90506000613fa582600160f81b614f0b565b90506001865b613fb6886003614f0b565b81101561402057865b613fca886003614f0b565b81101561400d57613ff08b613fe161019884614f37565b613feb9085614f0b565b6145f6565b8015613ff95750825b92508061400581614fb0565b915050613fbf565b508061401881614fb0565b915050613fab565b5084156140e357806140be57886001600160a01b0316614042600389896146e4565b6001600160a01b0316146140be5760405162461bcd60e51b815260206004820152602b60248201527f6e6f74206f776e6572206f6620616c6c20737562207175616473206e6f72207060448201527f6172656e7420717561647300000000000000000000000000000000000000000060648201526084016106f7565b5060009081526036602052604090206001600160a01b03871690555060019050612efa565b98975050505050505050565b6000806140fe61019885614f37565b6141089086614f0b565b9050600061411a82600160f91b614f0b565b90506001865b61412b886006614f0b565b81101561424357865b61413f886006614f0b565b8110156142305760006141568c8c85856000613f7a565b9050600061416661019884614f37565b61417485600160f81b614f0b565b61417e9190614f0b565b600081815260366020526040902054909150801561420357826141f3578d6001600160a01b031681146141f35760405162461bcd60e51b815260206004820152601560248201527f6e6f74206f776e6572206f66203378332071756164000000000000000000000060448201526064016106f7565b6000828152603660205260408120555b828061420e57508015155b80156142175750855b95505050506003816142299190614f0b565b9050614134565b5061423c600382614f0b565b9050614120565b5084156140e357806140be57886001600160a01b0316614042600689896146e4565b60008061427461019885614f37565b61427e9086614f0b565b9050600061429082600360f81b614f0b565b90506001865b6142a188600c614f0b565b8110156143b957865b6142b588600c614f0b565b8110156143a65760006142cc8c8c858560006140ef565b905060006142dc61019884614f37565b6142ea85600160f91b614f0b565b6142f49190614f0b565b60008181526036602052604090205490915080156143795782614369578d6001600160a01b031681146143695760405162461bcd60e51b815260206004820152601560248201527f6e6f74206f776e6572206f66203678362071756164000000000000000000000060448201526064016106f7565b6000828152603660205260408120555b828061438457508015155b801561438d5750855b955050505060068161439f9190614f0b565b90506142aa565b506143b2600682614f0b565b9050614296565b5084156140e357806140be57886001600160a01b0316614042600c89896146e4565b6000806143ea61019885614f37565b6143f49086614f0b565b9050600061440682600160fa1b614f0b565b90506001865b614417886018614f0b565b81101561452f57865b61442b886018614f0b565b81101561451c5760006144428c8c85856000614265565b9050600061445261019884614f37565b61446085600360f81b614f0b565b61446a9190614f0b565b60008181526036602052604090205490915080156144ef57826144df578d6001600160a01b031681146144df5760405162461bcd60e51b815260206004820152601760248201527f6e6f74206f776e6572206f66203132783132207175616400000000000000000060448201526064016106f7565b6000828152603660205260408120555b82806144fa57508015155b80156145035750855b9550505050600c816145159190614f0b565b9050614420565b50614528600c82614f0b565b905061440c565b5084156145c757806140be576000828152603660205260409020546001600160a01b038a16146140be5760405162461bcd60e51b815260206004820152602a60248201527f6e6f74206f776e6572206f6620616c6c20737562207175616473206e6f74207060448201527f6172656e7420717561640000000000000000000000000000000000000000000060648201526084016106f7565b80806145e957506000828152603660205260409020546001600160a01b038a16145b9998505050505050505050565b60008181526036602052604081205480156146da57600160a01b80821614156146615760405162461bcd60e51b815260206004820152600960248201527f6e6f74206f776e6572000000000000000000000000000000000000000000000060448201526064016106f7565b836001600160a01b0316816001600160a01b0316146146c25760405162461bcd60e51b815260206004820152600960248201527f6e6f74206f776e6572000000000000000000000000000000000000000000000060448201526064016106f7565b50506000818152603660205260408120556001611d5e565b5060009392505050565b600080806146f3866002614f37565b9050856003141561470a57600160f81b9150614791565b856006141561471f57600160f91b9150614791565b85600c141561473457600360f81b9150614791565b856018141561474957600160fa1b9150614791565b60405162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a65000000000000000000000000000000000000000060448201526064016106f7565b6000603681610198896147a4818a614f23565b6147ae9190614f37565b6147b89190614f37565b896147c3818b614f23565b6147cd9190614f37565b6147d79087614f0b565b6147e19190614f0b565b815260208101919091526040016000205490506001600160a01b0381161561480d579250612cb7915050565b601887101561482b576148218287876146e4565b9350505050612cb7565b5060009695505050505050565b80356001600160a01b038116811461065557600080fd5b60008083601f840112614860578081fd5b50813567ffffffffffffffff811115614877578182fd5b602083019150836020808302850101111561489157600080fd5b9250929050565b8035801515811461065557600080fd5b60008083601f8401126148b9578182fd5b50813567ffffffffffffffff8111156148d0578182fd5b60208301915083602082850101111561489157600080fd5b600082601f8301126148f8578081fd5b813567ffffffffffffffff808211156149135761491361500b565b604051601f8301601f19908116603f0116810190828211818310171561493b5761493b61500b565b81604052838152866020858801011115614953578485fd5b8360208701602083013792830160200193909352509392505050565b600060208284031215614980578081fd5b611d5b82614838565b6000806040838503121561499b578081fd5b6149a483614838565b91506149b260208401614838565b90509250929050565b60008060008060008060008060008060c08b8d0312156149d9578586fd5b6149e28b614838565b99506149f060208c01614838565b985060408b013567ffffffffffffffff80821115614a0c578788fd5b614a188e838f0161484f565b909a50985060608d0135915080821115614a30578788fd5b614a3c8e838f0161484f565b909850965060808d0135915080821115614a54578586fd5b614a608e838f0161484f565b909650945060a08d0135915080821115614a78578384fd5b50614a858d828e016148a8565b915080935050809150509295989b9194979a5092959850565b60008060008060008060808789031215614ab6578182fd5b614abf87614838565b9550614acd60208801614838565b9450604087013567ffffffffffffffff80821115614ae9578384fd5b614af58a838b0161484f565b90965094506060890135915080821115614b0d578384fd5b50614b1a89828a016148a8565b979a9699509497509295939492505050565b600080600060608486031215614b40578283fd5b614b4984614838565b9250614b5760208501614838565b9150614b6560408501614898565b90509250925092565b600080600060608486031215614b82578283fd5b614b8b84614838565b9250614b9960208501614838565b9150604084013590509250925092565b60008060008060808587031215614bbe578384fd5b614bc785614838565b9350614bd560208601614838565b925060408501359150606085013567ffffffffffffffff811115614bf7578182fd5b614c03878288016148e8565b91505092959194509250565b600080600080600080600060c0888a031215614c29578283fd5b614c3288614838565b9650614c4060208901614838565b955060408801359450606088013593506080880135925060a088013567ffffffffffffffff811115614c70578283fd5b614c7c8a828b016148a8565b989b979a50959850939692959293505050565b60008060408385031215614ca1578182fd5b614caa83614838565b91506149b260208401614898565b60008060408385031215614cca578182fd5b614cd383614838565b946020939093013593505050565b600080600080600060a08688031215614cf8578283fd5b614d0186614838565b9450602086013593506040860135925060608601359150608086013567ffffffffffffffff811115614d31578182fd5b614d3d888289016148e8565b9150509295509295909350565b600060208284031215614d5b578081fd5b8135612cb781615021565b600060208284031215614d77578081fd5b8151612cb781615021565b600060208284031215614d93578081fd5b5035919050565b600080600060608486031215614dae578081fd5b505081359360208301359350604090920135919050565b60008151808452614ddd816020860160208601614f6d565b601f01601f19169290920160200192915050565b60007f68747470733a2f2f6170692e73616e64626f782e67616d652f6c616e64732f0082528251614e2981601f850160208701614f6d565b7f2f6d657461646174612e6a736f6e000000000000000000000000000000000000601f939091019283015250602d01919050565b6000608082016001600160a01b03808816845260208188168186015260806040860152829150865180845260a0860192508188019350845b81811015614eb157845184529382019392820192600101614e95565b50505083810360608501526140e38186614dc5565b60006001600160a01b03808716835280861660208401525083604083015260806060830152612e396080830184614dc5565b600060208252611d5b6020830184614dc5565b60008219821115614f1e57614f1e614fdf565b500190565b600082614f3257614f32614ff5565b500490565b6000816000190483118215151615614f5157614f51614fdf565b500290565b600082821015614f6857614f68614fdf565b500390565b60005b83811015614f88578181015183820152602001614f70565b8381111561197e5750506000910152565b600081614fa857614fa8614fdf565b506000190190565b6000600019821415614fc457614fc4614fdf565b5060010190565b600082614fda57614fda614ff5565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114610e3457600080fdfea26469706673582212204ea03adcbb50584bef3739879e001155077df5902cb5604c3277c30ee7f4ac8964736f6c63430008020033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102775760003560e01c806370a0823111610160578063ac9fe421116100d8578063cf456ae71161008c578063e985e9c511610071578063e985e9c514610582578063eaa5e06714610595578063eeb5a5d1146105a857610277565b8063cf456ae71461055c578063da7422281461056f57610277565b8063c4d66de8116100bd578063c4d66de814610525578063c87b56dd14610538578063ce1b815f1461054b57610277565b8063ac9fe421146104ff578063b88d4fde1461051257610277565b80638f2839701161012f5780639ededf77116101145780639ededf77146102f9578063a22cb465146104c0578063aa271e1a146104d357610277565b80638f2839701461047457806395d89b411461048757610277565b806370a082311461042857806379cc67901461043b578063845a46971461044e5780638e5cb5f61461046157610277565b806338bb305a116101f3578063572b6c05116101c2578063654b748a116101a7578063654b748a146103d85780636e1e3bbf146104045780636e9960c31461041757610277565b8063572b6c05146103a35780636352211e146103c557610277565b806338bb305a1461035757806342842e0e1461036a57806342966c681461037d57806355064d851461039057610277565b80630ef267431161024a57806323b872dd1161022f57806323b872dd1461031e57806328cfbd46146103315780632b9917461461034457610277565b80630ef26743146102f957806315ddc5351461030b57610277565b806301ffc9a71461027c57806306fdde03146102a4578063081812fc146102b9578063095ea7b3146102e4575b600080fd5b61028f61028a366004614d4a565b6105bb565b60405190151581526020015b60405180910390f35b6102ac61065a565b60405161029b9190614ef8565b6102cc6102c7366004614d82565b610692565b6040516001600160a01b03909116815260200161029b565b6102f76102f2366004614cb8565b610731565b005b6101985b60405190815260200161029b565b6102f7610319366004614a9e565b610874565b6102f761032c366004614b6e565b61088a565b6102f761033f366004614a9e565b61093f565b6102f7610352366004614b6e565b6109b4565b6102f7610365366004614c0f565b610ba7565b6102f7610378366004614b6e565b610dff565b6102f761038b366004614d82565b610e1a565b61028f61039e366004614d9a565b610e37565b61028f6103b136600461496f565b606b546001600160a01b0390811691161490565b6102cc6103d3366004614d82565b6113ac565b61028f6103e636600461496f565b6001600160a01b031660009081526034602052604090205460ff1690565b6102f7610412366004614ce1565b61140f565b6033546001600160a01b03166102cc565b6102fd61043636600461496f565b611473565b6102f7610449366004614cb8565b6114e7565b6102fd61045c366004614d82565b611644565b6102fd61046f366004614d82565b6116b3565b6102f761048236600461496f565b611722565b60408051808201909152600481527f4c414e440000000000000000000000000000000000000000000000000000000060208201526102ac565b6102f76104ce366004614c8f565b6117fd565b61028f6104e136600461496f565b6001600160a01b031660009081526039602052604090205460ff1690565b6102f761050d366004614c8f565b611813565b6102f7610520366004614ba9565b6118f7565b6102f761053336600461496f565b611984565b6102ac610546366004614d82565b611a99565b606b546001600160a01b03166102cc565b6102f761056a366004614c8f565b611b2c565b6102f761057d36600461496f565b611c74565b61028f610590366004614989565b611d0d565b6102f76105a33660046149bb565b611d64565b6102f76105b6366004614b2c565b6122cc565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316148061061e57507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b8061065257507f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b90505b919050565b60408051808201909152600f81527f53616e64626f782773204c414e4473000000000000000000000000000000000060208201525b90565b60008060006106a0846123bd565b90925090506001600160a01b0382166107005760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e00000000000000000000000000000060448201526064015b60405180910390fd5b8015610726575050506000818152603860205260409020546001600160a01b0316610655565b600092505050610655565b6000818152603660205260408120549061074a836126a4565b9050600061075661296d565b90506001600160a01b0382166107ae5760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e00000000000000000000000000000060448201526064016106f7565b806001600160a01b0316826001600160a01b031614806107f357506001600160a01b0380831660009081526037602090815260408083209385168352929052205460ff165b8061081657506001600160a01b03811660009081526034602052604090205460ff165b6108625760405162461bcd60e51b815260206004820152601560248201527f554e415554484f52495a45445f415050524f56414c000000000000000000000060448201526064016106f7565b61086d83868661297c565b5050505050565b610882868686868686612a32565b505050505050565b610895838383612aa4565b506108a1838383612cbe565b6001600160a01b0382163b151580156108c657506108c6826317a2fd9160e21b612d7c565b1561093a576108ee6108d661296d565b84848460405180602001604052806000815250612e43565b61093a5760405162461bcd60e51b815260206004820152601860248201527f4552433732315f5452414e534645525f52454a4543544544000000000000000060448201526064016106f7565b505050565b610882868686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8a01819004810282018101909252888152925088915087908190840183828082843760009201919091525060019250612f03915050565b600081815260366020526040812054906109cd836126a4565b905060006109d961296d565b90506001600160a01b038616610a315760405162461bcd60e51b815260206004820152601360248201527f5a45524f5f414444524553535f53454e4445520000000000000000000000000060448201526064016106f7565b6001600160a01b038216610a875760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e00000000000000000000000000000060448201526064016106f7565b856001600160a01b0316816001600160a01b03161480610acc57506001600160a01b0380871660009081526037602090815260408083209385168352929052205460ff165b80610aef57506001600160a01b03811660009081526034602052604090205460ff165b610b3b5760405162461bcd60e51b815260206004820152601560248201527f554e415554484f52495a45445f415050524f56414c000000000000000000000060448201526064016106f7565b856001600160a01b0316836001600160a01b031614610b9c5760405162461bcd60e51b815260206004820152601060248201527f4f574e45525f4e4f545f53454e4445520000000000000000000000000000000060448201526064016106f7565b61088283868661297c565b6001600160a01b038716610bfd5760405162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f206164647265737300000000000000000000000060448201526064016106f7565b6001600160a01b038616610c535760405162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f206164647265737300000000000060448201526064016106f7565b866001600160a01b0316610c6561296d565b6001600160a01b031614610d2d576001600160a01b038716600090815260376020526040812090610c9461296d565b6001600160a01b0316815260208101919091526040016000205460ff1680610ce1575060346000610cc361296d565b6001600160a01b0316815260208101919091526040016000205460ff165b610d2d5760405162461bcd60e51b815260206004820152601e60248201527f6e6f7420617574686f72697a656420746f207472616e7366657251756164000060448201526064016106f7565b610d3a8787878787613366565b610d448580614f37565b6001600160a01b03881660009081526035602052604081208054909190610d6c908490614f56565b90915550610d7c90508580614f37565b6001600160a01b03871660009081526035602052604081208054909190610da4908490614f0b565b90915550610df69050610db561296d565b888888888888888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061364792505050565b50505050505050565b61093a838383604051806020016040528060008152506118f7565b610e34610e2561296d565b610e2e836126a4565b836137ab565b50565b60008383838260011480610e4b5750826003145b80610e565750826006145b80610e61575082600c145b80610e6c5750826018145b610eb85760405162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a65000000000000000000000000000000000000000060448201526064016106f7565b610ec28383614fcb565b158015610ed65750610ed48382614fcb565b155b610f225760405162461bcd60e51b815260206004820152601360248201527f496e76616c696420636f6f7264696e617465730000000000000000000000000060448201526064016106f7565b610f2e83610198614f56565b8211158015610f485750610f4483610198614f56565b8111155b610f945760405162461bcd60e51b815260206004820152600d60248201527f4f7574206f6620626f756e64730000000000000000000000000000000000000060448201526064016106f7565b60366000610198610fa6601889614f23565b610fb1906018614f37565b610fbb9190614f37565b610fc660188a614f23565b610fd1906018614f37565b610fdf90600160fa1b614f0b565b610fe99190614f0b565b81526020019081526020016000205460001461100857600193506113a2565b60006110148888614f0b565b905060006110228988614f0b565b9050600c89116110a7576036600061019861103e600c8b614f23565b61104990600c614f37565b6110539190614f37565b61105e600c8c614f23565b61106990600c614f37565b61107790600360f81b614f0b565b6110819190614f0b565b8152602001908152602001600020546000146110a2576001955050506113a2565b61112e565b875b8281101561112c57875b828110156111195760006110c961019883614f37565b6110d784600360f81b614f0b565b6110e19190614f0b565b60008181526036602052604090205490915015611106576001985050505050506113a2565b50611112600c82614f0b565b90506110b3565b50611125600c82614f0b565b90506110a9565b505b600689116111b1576036600061019861114860068b614f23565b611153906006614f37565b61115d9190614f37565b61116860068c614f23565b611173906006614f37565b61118190600160f91b614f0b565b61118b9190614f0b565b8152602001908152602001600020546000146111ac576001955050506113a2565b611238565b875b8281101561123657875b828110156112235760006111d361019883614f37565b6111e184600160f91b614f0b565b6111eb9190614f0b565b60008181526036602052604090205490915015611210576001985050505050506113a2565b5061121c600682614f0b565b90506111bd565b5061122f600682614f0b565b90506111b3565b505b600389116112bb576036600061019861125260038b614f23565b61125d906003614f37565b6112679190614f37565b61127260038c614f23565b61127d906003614f37565b61128b90600160f81b614f0b565b6112959190614f0b565b8152602001908152602001600020546000146112b6576001955050506113a2565b611342565b875b8281101561134057875b8281101561132d5760006112dd61019883614f37565b6112eb84600160f81b614f0b565b6112f59190614f0b565b6000818152603660205260409020549091501561131a576001985050505050506113a2565b50611326600382614f0b565b90506112c7565b50611339600382614f0b565b90506112bd565b505b60005b61134f8a80614f37565b81101561139a5760366000611366838d8d8d6138a2565b81526020019081526020016000205460001461138857600196505050506113a2565b8061139281614fb0565b915050611345565b506000955050505b5050509392505050565b60006113b7826126a4565b90506001600160a01b0381166106555760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354414e545f544f4b454e00000000000000000000000000000060448201526064016106f7565b61141a6104e161296d565b6114665760405162461bcd60e51b815260206004820152600b60248201527f21415554484f52495a454400000000000000000000000000000000000000000060448201526064016106f7565b61086d8585858585613945565b60006001600160a01b0382166114cb5760405162461bcd60e51b815260206004820152601260248201527f5a45524f5f414444524553535f4f574e4552000000000000000000000000000060448201526064016106f7565b506001600160a01b031660009081526035602052604090205490565b6001600160a01b03821661153d5760405162461bcd60e51b815260206004820152601460248201527f4e4f545f46524f4d5f5a45524f4144445245535300000000000000000000000060448201526064016106f7565b600080611549836123bd565b91509150600061155761296d565b9050846001600160a01b0316816001600160a01b0316148061159a575081801561159a57506000848152603860205260409020546001600160a01b038281169116145b806115bd57506001600160a01b03811660009081526034602052604090205460ff165b806115ed57506001600160a01b0380861660009081526037602090815260408083209385168352929052205460ff165b6116395760405162461bcd60e51b815260206004820152601160248201527f554e415554484f52495a45445f4255524e00000000000000000000000000000060448201526064016106f7565b61086d8584866137ab565b600080611650836126a4565b6001600160a01b031614156116a75760405162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f7420657869737400000000000000000000000060448201526064016106f7565b61065261019883614f23565b6000806116bf836126a4565b6001600160a01b031614156117165760405162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f7420657869737400000000000000000000000060448201526064016106f7565b61065261019883614fcb565b6033546001600160a01b03168061173761296d565b6001600160a01b03161461178d5760405162461bcd60e51b815260206004820152601360248201527f41444d494e5f4143434553535f44454e4945440000000000000000000000000060448201526064016106f7565b816001600160a01b0316816001600160a01b03167f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f60405160405180910390a3506033805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b61180f61180861296d565b8383613b57565b5050565b6033546001600160a01b031661182761296d565b6001600160a01b0316146118a35760405162461bcd60e51b815260206004820152602c60248201527f6f6e6c792061646d696e20697320616c6c6f77656420746f206164642073757060448201527f6572206f70657261746f7273000000000000000000000000000000000000000060648201526084016106f7565b6001600160a01b038216600081815260346020526040808220805460ff191685151590811790915590519092917f44f92d27abdf4cfb6a7d712c3af68f3be086d4ca747ab802c36f67d6790060d891a35050565b611902848484612aa4565b5061190e848484612cbe565b6001600160a01b0383163b1561197e5761193261192961296d565b85858585612e43565b61197e5760405162461bcd60e51b815260206004820152601860248201527f4552433732315f5452414e534645525f52454a4543544544000000000000000060448201526064016106f7565b50505050565b600054610100900460ff1661199f5760005460ff16156119a3565b303b155b611a155760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016106f7565b600054610100900460ff16158015611a40576000805460ff1961ff0019909116610100171660011790555b611a4861296d565b6033805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b0393841617909155606b8054909116918416919091179055801561180f576000805461ff00191690555050565b60606000611aa6836126a4565b6001600160a01b03161415611afd5760405162461bcd60e51b815260206004820152601160248201527f496420646f6573206e6f7420657869737400000000000000000000000000000060448201526064016106f7565b611b0682613c2d565b604051602001611b169190614df1565b6040516020818303038152906040529050919050565b6033546001600160a01b0316611b4061296d565b6001600160a01b031614611bbb5760405162461bcd60e51b8152602060048201526024808201527f6f6e6c792061646d696e20697320616c6c6f77656420746f20616464206d696e60448201527f746572730000000000000000000000000000000000000000000000000000000060648201526084016106f7565b6001600160a01b038216611c115760405162461bcd60e51b815260206004820152601c60248201527f506f6c79676f6e4c616e643a20496e76616c696420616464726573730000000060448201526064016106f7565b6001600160a01b038216600081815260396020908152604091829020805460ff19168515159081179091558251938452908301527fff452b3b9159b024a9098f0058c63eccd90d36b3584608202800d662f962bb60910160405180910390a15050565b6033546001600160a01b0316611c8861296d565b6001600160a01b031614611cde5760405162461bcd60e51b815260206004820152600a60248201527f41444d494e5f4f4e4c590000000000000000000000000000000000000000000060448201526064016106f7565b606b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001600160a01b03808316600090815260376020908152604080832093851683529290529081205460ff1680611d5b57506001600160a01b03821660009081526034602052604090205460ff165b90505b92915050565b6001600160a01b038a16611dba5760405162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f206164647265737300000000000000000000000060448201526064016106f7565b6001600160a01b038916611e105760405162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f206164647265737300000000000060448201526064016106f7565b8685148015611e1e57508483145b611e6a5760405162461bcd60e51b815260206004820152600c60248201527f696e76616c69642064617461000000000000000000000000000000000000000060448201526064016106f7565b896001600160a01b0316611e7c61296d565b6001600160a01b031614611f69576001600160a01b038a16600090815260376020526040812090611eab61296d565b6001600160a01b0316815260208101919091526040016000205460ff1680611ef8575060346000611eda61296d565b6001600160a01b0316815260208101919091526040016000205460ff165b611f695760405162461bcd60e51b8152602060048201526024808201527f6e6f7420617574686f72697a656420746f207472616e736665724d756c74695160448201527f756164730000000000000000000000000000000000000000000000000000000060648201526084016106f7565b6000805b888110156120235760008a8a83818110611f9757634e487b7160e01b600052603260045260246000fd5b905060200201359050611ff98d8d838c8c87818110611fc657634e487b7160e01b600052603260045260246000fd5b905060200201358b8b88818110611fed57634e487b7160e01b600052603260045260246000fd5b90506020020135613366565b6120038180614f37565b61200d9084614f0b565b925050808061201b90614fb0565b915050611f6d565b506001600160a01b038b166000908152603560205260408120805483929061204c908490614f56565b90915550506001600160a01b038a1660009081526035602052604081208054839290612079908490614f0b565b90915550506001600160a01b038a163b151580156120a357506120a38a6317a2fd9160e21b612d7c565b156122bf5760008167ffffffffffffffff8111156120d157634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156120fa578160200160208202803683370190505b5090506000805b8a8110156122005760008c8c8381811061212b57634e487b7160e01b600052603260045260246000fd5b90506020020135905060005b6121418280614f37565b8110156121eb576121a081838e8e8781811061216d57634e487b7160e01b600052603260045260246000fd5b905060200201358d8d8881811061219457634e487b7160e01b600052603260045260246000fd5b905060200201356138a2565b8585815181106121c057634e487b7160e01b600052603260045260246000fd5b6020908102919091010152836121d581614fb0565b94505080806121e390614fb0565b915050612137565b505080806121f890614fb0565b915050612101565b5061224b61220c61296d565b8e8e8589898080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613d7c92505050565b6122bc5760405162461bcd60e51b8152602060048201526024808201527f657263373231206261746368207472616e736665722072656a6563746564206260448201527f7920746f0000000000000000000000000000000000000000000000000000000060648201526084016106f7565b50505b5050505050505050505050565b6001600160a01b0383166123225760405162461bcd60e51b815260206004820152601660248201527f496e76616c69642073656e64657220616464726573730000000000000000000060448201526064016106f7565b600061232c61296d565b9050836001600160a01b0316816001600160a01b0316148061236657506001600160a01b03811660009081526034602052604090205460ff165b6123b25760405162461bcd60e51b815260206004820152601c60248201527f554e415554484f52495a45445f415050524f56455f464f525f414c4c0000000060448201526064016106f7565b61197e848484613b57565b6000807fff000000000000000000000000000000000000000000000000000000000000008316156124305760405162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e2069640000000000000000000000000000000060448201526064016106f7565b600061243e61019885614fcb565b9050600061244e61019886614f23565b600086815260366020526040902054909150600160a01b80821614156124855760009450600160ff1b80821614935050505061269f565b801561249e57809450600160ff1b80821614935061269b565b60006036816101986124b1600387614f23565b6124bc906003614f37565b6124c69190614f37565b6124d1600388614f23565b6124dc906003614f37565b6124ea90600160f81b614f0b565b6124f49190614f0b565b815260208101919091526040016000205490506001600160a01b038116156125225780955060009450612699565b6000603681610198612535600688614f23565b612540906006614f37565b61254a9190614f37565b612555600689614f23565b612560906006614f37565b61256e90600160f91b614f0b565b6125789190614f0b565b815260208101919091526040016000205490506001600160a01b038116156125a65780965060009550612697565b60006036816101986125b9600c89614f23565b6125c490600c614f37565b6125ce9190614f37565b6125d9600c8a614f23565b6125e490600c614f37565b6125f290600360f81b614f0b565b6125fc9190614f0b565b815260208101919091526040016000205490506001600160a01b0381161561262a5780975060009650612695565b6036600061019861263c601889614f23565b612647906018614f37565b6126519190614f37565b61265c60188a614f23565b612667906018614f37565b61267590600160fa1b614f0b565b61267f9190614f0b565b8152602001908152602001600020549750600096505b505b505b505b5050505b915091565b60007fff000000000000000000000000000000000000000000000000000000000000008216156127165760405162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e2069640000000000000000000000000000000060448201526064016106f7565b600061272461019884614fcb565b9050600061273461019885614f23565b600085815260366020526040902054909150600160a01b80821614156127605760009350505050610655565b8015612770579250610655915050565b6000603681610198612783600387614f23565b61278e906003614f37565b6127989190614f37565b6127a3600388614f23565b6127ae906003614f37565b6127bc90600160f81b614f0b565b6127c69190614f0b565b815260208101919091526040016000205490506001600160a01b038116156127f357935061065592505050565b6000603681610198612806600688614f23565b612811906006614f37565b61281b9190614f37565b612826600689614f23565b612831906006614f37565b61283f90600160f91b614f0b565b6128499190614f0b565b815260208101919091526040016000205490506001600160a01b038116156128775794506106559350505050565b600060368161019861288a600c89614f23565b61289590600c614f37565b61289f9190614f37565b6128aa600c8a614f23565b6128b590600c614f37565b6128c390600360f81b614f0b565b6128cd9190614f0b565b815260208101919091526040016000205490506001600160a01b038116156128fc579550610655945050505050565b6036600061019861290e601889614f23565b612919906018614f37565b6129239190614f37565b61292e60188a614f23565b612939906018614f37565b61294790600160fa1b614f0b565b6129519190614f0b565b8152602001908152602001600020549650505050505050610655565b6000612977613e3b565b905090565b6000612987826126a4565b90506001600160a01b0383166129a9576129a48285836000613e85565b6129eb565b6129b68285836001613e85565b6000828152603860205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385161790555b81836001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a450505050565b610882868686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8a01819004810282018101909252888152925088915087908190840183828082843760009201829052509250612f03915050565b6000806000612ab2846123bd565b915091506000612ac061296d565b90506001600160a01b038316612b185760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e00000000000000000000000000000060448201526064016106f7565b866001600160a01b0316836001600160a01b031614612b795760405162461bcd60e51b815260206004820152601760248201527f434845434b5452414e534645525f4e4f545f4f574e455200000000000000000060448201526064016106f7565b6001600160a01b038616612bcf5760405162461bcd60e51b815260206004820152601260248201527f4e4f545f544f5f5a45524f41444452455353000000000000000000000000000060448201526064016106f7565b826001600160a01b0316816001600160a01b03161480612c0757506001600160a01b03811660009081526034602052604090205460ff165b80612c3757506001600160a01b0380881660009081526037602090815260408083209385168352929052205460ff165b80612c635750818015612c6357506000858152603860205260409020546001600160a01b038281169116145b612caf5760405162461bcd60e51b815260206004820152601560248201527f554e415554484f52495a45445f5452414e53464552000000000000000000000060448201526064016106f7565b600193505050505b9392505050565b6001600160a01b0383166000908152603560205260408120805491612ce283614f99565b90915550506001600160a01b0382166000908152603560205260408120805491612d0b83614fb0565b9190505550612d368160366000612d1f8590565b815260200190815260200160002054846000613e85565b80826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b604080516001600160e01b031983166024808301919091528251808303909101815260449091018252602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001781528251935160008082529485948594909392908183858c612710fa955080519450505050609e5a11612e2f57634e487b7160e01b600052600160045260246000fd5b828015612e395750815b9695505050505050565b600080846001600160a01b031663150b7a02888887876040518563ffffffff1660e01b8152600401612e789493929190614ec6565b602060405180830381600087803b158015612e9257600080fd5b505af1158015612ea6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612eca9190614d66565b6001600160e01b0319167f150b7a0200000000000000000000000000000000000000000000000000000000149150505b95945050505050565b6000612f0d61296d565b90506000866001600160a01b0316826001600160a01b03161480612f5657506001600160a01b0380881660009081526037602090815260408083209386168352929052205460ff165b80612f7957506001600160a01b03821660009081526034602052604090205460ff165b90506001600160a01b038716612fd15760405162461bcd60e51b815260206004820152601460248201527f4e4f545f46524f4d5f5a45524f4144445245535300000000000000000000000060448201526064016106f7565b6001600160a01b0386166130275760405162461bcd60e51b815260206004820152601260248201527f4e4f545f544f5f5a45524f41444452455353000000000000000000000000000060448201526064016106f7565b845160005b818110156131be57600087828151811061305657634e487b7160e01b600052603260045260246000fd5b6020026020010151905060008061306c836123bd565b915091508b6001600160a01b0316826001600160a01b0316146130d15760405162461bcd60e51b815260206004820152601b60248201527f42415443485452414e5346455246524f4d5f4e4f545f4f574e4552000000000060448201526064016106f7565b85806130fe57508080156130fe57506000838152603860205260409020546001600160a01b038881169116145b61314a5760405162461bcd60e51b815260206004820152600e60248201527f4e4f545f415554484f52495a454400000000000000000000000000000000000060448201526064016106f7565b600083815260366020526040812054613167918591908e90613e85565b828b6001600160a01b03168d6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a450505080806131b690614fb0565b91505061302c565b50866001600160a01b0316886001600160a01b031614613233576001600160a01b03881660009081526035602052604081208054839290613200908490614f56565b90915550506001600160a01b0387166000908152603560205260408120805483929061322d908490614f0b565b90915550505b6001600160a01b0387163b1561335c57613254876317a2fd9160e21b612d7c565b156132b7576132668389898989613d7c565b6132b25760405162461bcd60e51b815260206004820152601e60248201527f4552433732315f42415443485f52454345495645445f52454a4543544544000060448201526064016106f7565b61335c565b831561335c5760005b8181101561335a576132fc848a8a8a85815181106132ee57634e487b7160e01b600052603260045260246000fd5b60200260200101518a612e43565b6133485760405162461bcd60e51b815260206004820152601860248201527f4552433732315f52454345495645445f52454a4543544544000000000000000060448201526064016106f7565b8061335281614fb0565b9150506132c0565b505b5050505050505050565b82828282600114806133785750826003145b806133835750826006145b8061338e575082600c145b806133995750826018145b6133e55760405162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a65000000000000000000000000000000000000000060448201526064016106f7565b6133ef8383614fcb565b15801561340357506134018382614fcb565b155b61344f5760405162461bcd60e51b815260206004820152601360248201527f496e76616c696420636f6f7264696e617465730000000000000000000000000060448201526064016106f7565b61345b83610198614f56565b8211158015613475575061347183610198614f56565b8111155b6134c15760405162461bcd60e51b815260206004820152600d60248201527f4f7574206f6620626f756e64730000000000000000000000000000000000000060448201526064016106f7565b85600114156135c85760006134d861019886614f37565b6134e29087614f0b565b905060006134ef826126a4565b90506001600160a01b0381166135475760405162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f7420657869737400000000000000000000000060448201526064016106f7565b896001600160a01b0316816001600160a01b0316146135a85760405162461bcd60e51b815260206004820152601a60248201527f6e6f74206f776e657220696e205f7472616e736665725175616400000000000060448201526064016106f7565b5060009081526036602052604090206001600160a01b03881690556135d5565b6135d58888888888613f18565b60005b6135e28780614f37565b81101561335a576135f5818888886138a2565b886001600160a01b03168a6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a48061363f81614fb0565b9150506135d8565b6001600160a01b0385163b1515801561366c575061366c856317a2fd9160e21b612d7c565b15610df657600061367d8580614f37565b67ffffffffffffffff8111156136a357634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156136cc578160200160208202803683370190505b50905060005b6136dc8680614f37565b81101561372c576136ef818787876138a2565b82828151811061370f57634e487b7160e01b600052603260045260246000fd5b60209081029190910101528061372481614fb0565b9150506136d2565b5061373a8888888486613d7c565b61335c5760405162461bcd60e51b8152602060048201526024808201527f657263373231206261746368207472616e736665722072656a6563746564206260448201527f7920746f0000000000000000000000000000000000000000000000000000000060648201526084016106f7565b816001600160a01b0316836001600160a01b03161461380c5760405162461bcd60e51b815260206004820152600960248201527f4e4f545f4f574e4552000000000000000000000000000000000000000000000060448201526064016106f7565b80600160a01b6138216001600160ff1b614f56565b6000838152603660209081526040808320805494909416949094179092556001600160a01b0387168152603590915290812080549161385f83614f99565b909155505060405182906000906001600160a01b038716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a450505050565b6000806138af8587614f23565b90506138bc600282614fcb565b6138fd576101986138cd8285614f0b565b6138d79190614f37565b6138e18688614fcb565b6138eb9086614f0b565b6138f59190614f0b565b91505061393d565b61019861390a8285614f0b565b6139149190614f37565b61391e8688614fcb565b613929906001614f0b565b6139338787614f0b565b6138eb9190614f56565b949350505050565b6001600160a01b03851661399b5760405162461bcd60e51b815260206004820152601260248201527f746f206973207a65726f2061646472657373000000000000000000000000000060448201526064016106f7565b6139a6848484610e37565b156139f35760405162461bcd60e51b815260206004820152600e60248201527f416c7265616479206d696e74656400000000000000000000000000000000000060448201526064016106f7565b600080613a0261019885614f37565b613a0c9086614f0b565b90508560011415613a1f57809150613a85565b8560031415613a3d57613a3681600160f81b614f0b565b9150613a85565b8560061415613a5457613a3681600160f91b614f0b565b85600c1415613a6b57613a3681600360f81b614f0b565b8560181415613a8557613a8281600160fa1b614f0b565b91505b60005b613a928780614f37565b811015613aed57613aa5818888886138a2565b6040516001600160a01b038a16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a480613ae581614fb0565b915050613a88565b5060008281526036602052604090206001600160a01b0388169055613b128680614f37565b6001600160a01b03881660009081526035602052604081208054909190613b3a908490614f0b565b90915550610df69050613b4b61296d565b60008989898989613647565b6001600160a01b03821660009081526034602052604090205460ff1615613bc05760405162461bcd60e51b815260206004820152601760248201527f494e56414c49445f415050524f56414c5f4348414e474500000000000000000060448201526064016106f7565b6001600160a01b03838116600081815260376020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b606081613c6e575060408051808201909152600181527f30000000000000000000000000000000000000000000000000000000000000006020820152610655565b8160005b8115613c985780613c8281614fb0565b9150613c919050600a83614f23565b9150613c72565b60008167ffffffffffffffff811115613cc157634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613ceb576020820181803683370190505b5090505b841561393d57613d00600183614f56565b9150613d0d600a86614fcb565b613d18906030614f0b565b60f81b818381518110613d3b57634e487b7160e01b600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350613d75600a86614f23565b9450613cef565b600080846001600160a01b0316634b808c46888887876040518563ffffffff1660e01b8152600401613db19493929190614e5d565b602060405180830381600087803b158015613dcb57600080fd5b505af1158015613ddf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e039190614d66565b6001600160e01b0319167f4b808c46000000000000000000000000000000000000000000000000000000001491505095945050505050565b606b546000906001600160a01b0316331415613e7e57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c61068f565b503361068f565b8015613ec9576000848152603660205260409020600160ff1b6001600160a01b03841673ffffffffffffffffffffffffffffffffffffffff1986161717905561197e565b6001600160a01b038216613ee26001600160ff1b614f56565b841673ffffffffffffffffffffffffffffffffffffffff1916176036600086815260208101919091526040016000205550505050565b8260031415613f3557613f2f858584846001613f7a565b5061086d565b8260061415613f4c57613f2f8585848460016140ef565b82600c1415613f6357613f2f858584846001614265565b826018141561086d576108828585848460016143db565b600080613f8961019885614f37565b613f939086614f0b565b90506000613fa582600160f81b614f0b565b90506001865b613fb6886003614f0b565b81101561402057865b613fca886003614f0b565b81101561400d57613ff08b613fe161019884614f37565b613feb9085614f0b565b6145f6565b8015613ff95750825b92508061400581614fb0565b915050613fbf565b508061401881614fb0565b915050613fab565b5084156140e357806140be57886001600160a01b0316614042600389896146e4565b6001600160a01b0316146140be5760405162461bcd60e51b815260206004820152602b60248201527f6e6f74206f776e6572206f6620616c6c20737562207175616473206e6f72207060448201527f6172656e7420717561647300000000000000000000000000000000000000000060648201526084016106f7565b5060009081526036602052604090206001600160a01b03871690555060019050612efa565b98975050505050505050565b6000806140fe61019885614f37565b6141089086614f0b565b9050600061411a82600160f91b614f0b565b90506001865b61412b886006614f0b565b81101561424357865b61413f886006614f0b565b8110156142305760006141568c8c85856000613f7a565b9050600061416661019884614f37565b61417485600160f81b614f0b565b61417e9190614f0b565b600081815260366020526040902054909150801561420357826141f3578d6001600160a01b031681146141f35760405162461bcd60e51b815260206004820152601560248201527f6e6f74206f776e6572206f66203378332071756164000000000000000000000060448201526064016106f7565b6000828152603660205260408120555b828061420e57508015155b80156142175750855b95505050506003816142299190614f0b565b9050614134565b5061423c600382614f0b565b9050614120565b5084156140e357806140be57886001600160a01b0316614042600689896146e4565b60008061427461019885614f37565b61427e9086614f0b565b9050600061429082600360f81b614f0b565b90506001865b6142a188600c614f0b565b8110156143b957865b6142b588600c614f0b565b8110156143a65760006142cc8c8c858560006140ef565b905060006142dc61019884614f37565b6142ea85600160f91b614f0b565b6142f49190614f0b565b60008181526036602052604090205490915080156143795782614369578d6001600160a01b031681146143695760405162461bcd60e51b815260206004820152601560248201527f6e6f74206f776e6572206f66203678362071756164000000000000000000000060448201526064016106f7565b6000828152603660205260408120555b828061438457508015155b801561438d5750855b955050505060068161439f9190614f0b565b90506142aa565b506143b2600682614f0b565b9050614296565b5084156140e357806140be57886001600160a01b0316614042600c89896146e4565b6000806143ea61019885614f37565b6143f49086614f0b565b9050600061440682600160fa1b614f0b565b90506001865b614417886018614f0b565b81101561452f57865b61442b886018614f0b565b81101561451c5760006144428c8c85856000614265565b9050600061445261019884614f37565b61446085600360f81b614f0b565b61446a9190614f0b565b60008181526036602052604090205490915080156144ef57826144df578d6001600160a01b031681146144df5760405162461bcd60e51b815260206004820152601760248201527f6e6f74206f776e6572206f66203132783132207175616400000000000000000060448201526064016106f7565b6000828152603660205260408120555b82806144fa57508015155b80156145035750855b9550505050600c816145159190614f0b565b9050614420565b50614528600c82614f0b565b905061440c565b5084156145c757806140be576000828152603660205260409020546001600160a01b038a16146140be5760405162461bcd60e51b815260206004820152602a60248201527f6e6f74206f776e6572206f6620616c6c20737562207175616473206e6f74207060448201527f6172656e7420717561640000000000000000000000000000000000000000000060648201526084016106f7565b80806145e957506000828152603660205260409020546001600160a01b038a16145b9998505050505050505050565b60008181526036602052604081205480156146da57600160a01b80821614156146615760405162461bcd60e51b815260206004820152600960248201527f6e6f74206f776e6572000000000000000000000000000000000000000000000060448201526064016106f7565b836001600160a01b0316816001600160a01b0316146146c25760405162461bcd60e51b815260206004820152600960248201527f6e6f74206f776e6572000000000000000000000000000000000000000000000060448201526064016106f7565b50506000818152603660205260408120556001611d5e565b5060009392505050565b600080806146f3866002614f37565b9050856003141561470a57600160f81b9150614791565b856006141561471f57600160f91b9150614791565b85600c141561473457600360f81b9150614791565b856018141561474957600160fa1b9150614791565b60405162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a65000000000000000000000000000000000000000060448201526064016106f7565b6000603681610198896147a4818a614f23565b6147ae9190614f37565b6147b89190614f37565b896147c3818b614f23565b6147cd9190614f37565b6147d79087614f0b565b6147e19190614f0b565b815260208101919091526040016000205490506001600160a01b0381161561480d579250612cb7915050565b601887101561482b576148218287876146e4565b9350505050612cb7565b5060009695505050505050565b80356001600160a01b038116811461065557600080fd5b60008083601f840112614860578081fd5b50813567ffffffffffffffff811115614877578182fd5b602083019150836020808302850101111561489157600080fd5b9250929050565b8035801515811461065557600080fd5b60008083601f8401126148b9578182fd5b50813567ffffffffffffffff8111156148d0578182fd5b60208301915083602082850101111561489157600080fd5b600082601f8301126148f8578081fd5b813567ffffffffffffffff808211156149135761491361500b565b604051601f8301601f19908116603f0116810190828211818310171561493b5761493b61500b565b81604052838152866020858801011115614953578485fd5b8360208701602083013792830160200193909352509392505050565b600060208284031215614980578081fd5b611d5b82614838565b6000806040838503121561499b578081fd5b6149a483614838565b91506149b260208401614838565b90509250929050565b60008060008060008060008060008060c08b8d0312156149d9578586fd5b6149e28b614838565b99506149f060208c01614838565b985060408b013567ffffffffffffffff80821115614a0c578788fd5b614a188e838f0161484f565b909a50985060608d0135915080821115614a30578788fd5b614a3c8e838f0161484f565b909850965060808d0135915080821115614a54578586fd5b614a608e838f0161484f565b909650945060a08d0135915080821115614a78578384fd5b50614a858d828e016148a8565b915080935050809150509295989b9194979a5092959850565b60008060008060008060808789031215614ab6578182fd5b614abf87614838565b9550614acd60208801614838565b9450604087013567ffffffffffffffff80821115614ae9578384fd5b614af58a838b0161484f565b90965094506060890135915080821115614b0d578384fd5b50614b1a89828a016148a8565b979a9699509497509295939492505050565b600080600060608486031215614b40578283fd5b614b4984614838565b9250614b5760208501614838565b9150614b6560408501614898565b90509250925092565b600080600060608486031215614b82578283fd5b614b8b84614838565b9250614b9960208501614838565b9150604084013590509250925092565b60008060008060808587031215614bbe578384fd5b614bc785614838565b9350614bd560208601614838565b925060408501359150606085013567ffffffffffffffff811115614bf7578182fd5b614c03878288016148e8565b91505092959194509250565b600080600080600080600060c0888a031215614c29578283fd5b614c3288614838565b9650614c4060208901614838565b955060408801359450606088013593506080880135925060a088013567ffffffffffffffff811115614c70578283fd5b614c7c8a828b016148a8565b989b979a50959850939692959293505050565b60008060408385031215614ca1578182fd5b614caa83614838565b91506149b260208401614898565b60008060408385031215614cca578182fd5b614cd383614838565b946020939093013593505050565b600080600080600060a08688031215614cf8578283fd5b614d0186614838565b9450602086013593506040860135925060608601359150608086013567ffffffffffffffff811115614d31578182fd5b614d3d888289016148e8565b9150509295509295909350565b600060208284031215614d5b578081fd5b8135612cb781615021565b600060208284031215614d77578081fd5b8151612cb781615021565b600060208284031215614d93578081fd5b5035919050565b600080600060608486031215614dae578081fd5b505081359360208301359350604090920135919050565b60008151808452614ddd816020860160208601614f6d565b601f01601f19169290920160200192915050565b60007f68747470733a2f2f6170692e73616e64626f782e67616d652f6c616e64732f0082528251614e2981601f850160208701614f6d565b7f2f6d657461646174612e6a736f6e000000000000000000000000000000000000601f939091019283015250602d01919050565b6000608082016001600160a01b03808816845260208188168186015260806040860152829150865180845260a0860192508188019350845b81811015614eb157845184529382019392820192600101614e95565b50505083810360608501526140e38186614dc5565b60006001600160a01b03808716835280861660208401525083604083015260806060830152612e396080830184614dc5565b600060208252611d5b6020830184614dc5565b60008219821115614f1e57614f1e614fdf565b500190565b600082614f3257614f32614ff5565b500490565b6000816000190483118215151615614f5157614f51614fdf565b500290565b600082821015614f6857614f68614fdf565b500390565b60005b83811015614f88578181015183820152602001614f70565b8381111561197e5750506000910152565b600081614fa857614fa8614fdf565b506000190190565b6000600019821415614fc457614fc4614fdf565b5060010190565b600082614fda57614fda614ff5565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114610e3457600080fdfea26469706673582212204ea03adcbb50584bef3739879e001155077df5902cb5604c3277c30ee7f4ac8964736f6c63430008020033", + "numDeployments": 2, + "solcInputHash": "e1aa5651f7645b1641ef34120369a942", + "metadata": "{\"compiler\":{\"version\":\"0.8.2+commit.661d1103\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldAdmin\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"subscriptionOrRegistrant\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"subscribe\",\"type\":\"bool\"}],\"name\":\"ContractRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"Minter\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"registry\",\"type\":\"address\"}],\"name\":\"OperatorRegistrySet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"superOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"SuperOperator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newForwarder\",\"type\":\"address\"}],\"name\":\"TrustedForwarderSet\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"approveFor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"batchTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"sizes\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"xs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"ys\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"batchTransferQuad\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"burnFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"size\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"name\":\"exists\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTrustedForwarder\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getX\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"height\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"}],\"name\":\"isMinter\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"}],\"name\":\"isSuperOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"}],\"name\":\"isTrustedForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"size\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"mintAndTransferQuad\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"size\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"mintQuad\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"operatorFilterRegistry\",\"outputs\":[{\"internalType\":\"contract IOperatorFilterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"subscriptionOrRegistrantToCopy\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"subscribe\",\"type\":\"bool\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeBatchTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAllFor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setMinter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"registry\",\"type\":\"address\"}],\"name\":\"setOperatorRegistry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"superOperator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setSuperOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"name\":\"setTrustedForwarder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"id\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"size\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"transferQuad\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"width\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"approve(address,uint256)\":{\"params\":{\"id\":\"The id of the token\",\"operator\":\"The address receiving the approval\"}},\"approveFor(address,address,uint256)\":{\"params\":{\"id\":\"The id of the token\",\"operator\":\"The address receiving the approval\",\"sender\":\"The address giving the approval\"}},\"balanceOf(address)\":{\"params\":{\"owner\":\"The address to look for.\"},\"returns\":{\"_0\":\"The number of tokens owned by the address.\"}},\"batchTransferFrom(address,address,uint256[],bytes)\":{\"params\":{\"data\":\"Additional data.\",\"from\":\"The sender of the token.\",\"ids\":\"The ids of the tokens.\",\"to\":\"The recipient of the token.\"}},\"batchTransferQuad(address,address,uint256[],uint256[],uint256[],bytes)\":{\"params\":{\"data\":\"additional data\",\"from\":\"current owner of the quad\",\"sizes\":\"list of sizes for each quad\",\"to\":\"destination\",\"xs\":\"list of bottom left x coordinates for each quad\",\"ys\":\"list of bottom left y coordinates for each quad\"}},\"burn(uint256)\":{\"params\":{\"id\":\"The token which will be burnt.\"}},\"burnFrom(address,uint256)\":{\"params\":{\"from\":\"address whose token is to be burnt.\",\"id\":\"The token which will be burnt.\"}},\"changeAdmin(address)\":{\"details\":\"Change the administrator to be `newAdmin`.\",\"params\":{\"newAdmin\":\"The address of the new administrator.\"}},\"exists(uint256,uint256,uint256)\":{\"params\":{\"size\":\"size of the\",\"x\":\"x coordinate of the quad\",\"y\":\"y coordinate of the quad\"},\"returns\":{\"_0\":\"bool for if Land has been minted or not\"}},\"getAdmin()\":{\"details\":\"Get the current administrator of this contract.\",\"returns\":{\"_0\":\"The current administrator of this contract.\"}},\"getApproved(uint256)\":{\"params\":{\"id\":\"The id of the token.\"},\"returns\":{\"_0\":\"The address of the operator.\"}},\"getTrustedForwarder()\":{\"returns\":{\"_0\":\"trustedForwarder address of the trusted forwarder\"}},\"getX(uint256)\":{\"params\":{\"id\":\"tokenId\"},\"returns\":{\"_0\":\"the x coordinates\"}},\"getY(uint256)\":{\"params\":{\"id\":\"tokenId\"},\"returns\":{\"_0\":\"the y coordinates\"}},\"height()\":{\"returns\":{\"_0\":\"height\"}},\"isApprovedForAll(address,address)\":{\"params\":{\"operator\":\"The address of the operator.\",\"owner\":\"The address of the owner.\"},\"returns\":{\"_0\":\"isOperator The status of the approval.\"}},\"isMinter(address)\":{\"params\":{\"who\":\"The address to query.\"},\"returns\":{\"_0\":\"whether the address has minter rights.\"}},\"isSuperOperator(address)\":{\"params\":{\"who\":\"The address to query.\"},\"returns\":{\"_0\":\"whether the address has superOperator rights.\"}},\"isTrustedForwarder(address)\":{\"params\":{\"forwarder\":\"address to check\"},\"returns\":{\"_0\":\"is trusted\"}},\"mintAndTransferQuad(address,uint256,uint256,uint256,bytes)\":{\"params\":{\"data\":\"extra data to pass to the transfer\",\"size\":\"The size of the new quad\",\"to\":\"The recipient of the new quad\",\"x\":\"The top left x coordinate of the new quad\",\"y\":\"The top left y coordinate of the new quad\"}},\"mintQuad(address,uint256,uint256,uint256,bytes)\":{\"params\":{\"data\":\"extra data to pass to the transfer\",\"size\":\"The size of the new quad\",\"user\":\"The recipient of the new quad\",\"x\":\"The top left x coordinate of the new quad\",\"y\":\"The top left y coordinate of the new quad\"}},\"name()\":{\"returns\":{\"_0\":\"The name of the token contract\"}},\"ownerOf(uint256)\":{\"params\":{\"id\":\"The id of the token.\"},\"returns\":{\"owner\":\"The address of the token owner.\"}},\"register(address,bool)\":{\"details\":\"can only be called by admin.\",\"params\":{\"subscribe\":\"bool to signify subscription 'true' or to copy the list 'false'.\",\"subscriptionOrRegistrantToCopy\":\"registration address of the list to subscribe.\"}},\"safeBatchTransferFrom(address,address,uint256[],bytes)\":{\"params\":{\"data\":\"Additional data.\",\"from\":\"The sender of the token.\",\"ids\":\"The ids of the tokens.\",\"to\":\"The recipient of the token.\"}},\"safeTransferFrom(address,address,uint256)\":{\"params\":{\"from\":\"The send of the token\",\"id\":\"The id of the token\",\"to\":\"The recipient of the token\"}},\"safeTransferFrom(address,address,uint256,bytes)\":{\"params\":{\"data\":\"Additional data\",\"from\":\"The sender of the token\",\"id\":\"The id of the token\",\"to\":\"The recipient of the token\"}},\"setApprovalForAll(address,bool)\":{\"params\":{\"approved\":\"The determination of the approval\",\"operator\":\"The address receiving the approval\"}},\"setApprovalForAllFor(address,address,bool)\":{\"params\":{\"approved\":\"The determination of the approval\",\"operator\":\"The address receiving the approval\",\"sender\":\"The address giving the approval\"}},\"setMinter(address,bool)\":{\"params\":{\"enabled\":\"set whether the minter is enabled or disabled.\",\"minter\":\"address that will be given/removed minter right.\"}},\"setOperatorRegistry(address)\":{\"params\":{\"registry\":\"the address of the registry\"}},\"setSuperOperator(address,bool)\":{\"params\":{\"enabled\":\"set whether the superOperator is enabled or disabled.\",\"superOperator\":\"address that will be given/removed superOperator right.\"}},\"setTrustedForwarder(address)\":{\"details\":\"Change the address of the trusted forwarder for meta-TX\",\"params\":{\"trustedForwarder\":\"The new trustedForwarder\"}},\"supportsInterface(bytes4)\":{\"params\":{\"id\":\"The id of the interface\"},\"returns\":{\"_0\":\"True if the interface is supported\"}},\"symbol()\":{\"returns\":{\"_0\":\"The symbol of the token contract\"}},\"tokenURI(uint256)\":{\"params\":{\"id\":\"The id of the token\"},\"returns\":{\"_0\":\"The URI of the token\"}},\"transferFrom(address,address,uint256)\":{\"params\":{\"from\":\"The sender of the token\",\"id\":\"The id of the token\",\"to\":\"The recipient of the token\"}},\"transferQuad(address,address,uint256,uint256,uint256,bytes)\":{\"params\":{\"data\":\"additional data for transfer\",\"from\":\"current owner of the quad\",\"size\":\"size of the quad\",\"to\":\"destination\",\"x\":\"The top left x coordinate of the quad\",\"y\":\"The top left y coordinate of the quad\"}},\"width()\":{\"returns\":{\"_0\":\"width\"}}},\"title\":\"LAND token on L2\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"approve(address,uint256)\":{\"notice\":\"Approve an operator to spend tokens on the sender behalf\"},\"approveFor(address,address,uint256)\":{\"notice\":\"Approve an operator to spend tokens on the sender behalf\"},\"balanceOf(address)\":{\"notice\":\"Get the number of tokens owned by an address.\"},\"batchTransferFrom(address,address,uint256[],bytes)\":{\"notice\":\"Transfer many tokens between 2 addresses.\"},\"batchTransferQuad(address,address,uint256[],uint256[],uint256[],bytes)\":{\"notice\":\"transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\"},\"burn(uint256)\":{\"notice\":\"Burns token `id`.\"},\"burnFrom(address,uint256)\":{\"notice\":\"Burn token `id` from `from`.\"},\"changeAdmin(address)\":{\"notice\":\"Change the admin of the contract\"},\"exists(uint256,uint256,uint256)\":{\"notice\":\"checks if Land has been minted or not\"},\"getAdmin()\":{\"notice\":\"Get the current admin\"},\"getApproved(uint256)\":{\"notice\":\"Get the approved operator for a specific token.\"},\"getTrustedForwarder()\":{\"notice\":\"Get the current trusted forwarder\"},\"getX(uint256)\":{\"notice\":\"x coordinate of Land token\"},\"getY(uint256)\":{\"notice\":\"y coordinate of Land token\"},\"height()\":{\"notice\":\"total height of the map\"},\"isApprovedForAll(address,address)\":{\"notice\":\"Check if the sender approved the operator.\"},\"isMinter(address)\":{\"notice\":\"check whether address `who` is given minter rights.\"},\"isSuperOperator(address)\":{\"notice\":\"check whether address `who` is given superOperator rights.\"},\"isTrustedForwarder(address)\":{\"notice\":\"Checks if an address is a trusted forwarder\"},\"mintAndTransferQuad(address,uint256,uint256,uint256,bytes)\":{\"notice\":\"Checks if a parent quad has child quads already minted. Then mints the rest child quads and transfers the parent quad. Should only be called by the tunnel.\"},\"mintQuad(address,uint256,uint256,uint256,bytes)\":{\"notice\":\"Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\"},\"name()\":{\"notice\":\"Return the name of the token contract\"},\"ownerOf(uint256)\":{\"notice\":\"Get the owner of a token.\"},\"register(address,bool)\":{\"notice\":\"This function is used to register Land contract on the Operator Filterer Registry of Opensea.\"},\"safeBatchTransferFrom(address,address,uint256[],bytes)\":{\"notice\":\"Transfer many tokens between 2 addresses, while ensuring the receiving contract has a receiver method.\"},\"safeTransferFrom(address,address,uint256)\":{\"notice\":\"Transfer a token between 2 addresses letting the receiver knows of the transfer\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"notice\":\"Transfer a token between 2 addresses letting the receiver knows of the transfer\"},\"setApprovalForAll(address,bool)\":{\"notice\":\"Set the approval for an operator to manage all the tokens of the sender\"},\"setApprovalForAllFor(address,address,bool)\":{\"notice\":\"Set the approval for an operator to manage all the tokens of the sender\"},\"setMinter(address,bool)\":{\"notice\":\"Enable or disable the ability of `minter` to transfer tokens of all (minter rights).\"},\"setOperatorRegistry(address)\":{\"notice\":\"sets filter registry address deployed in test\"},\"setSuperOperator(address,bool)\":{\"notice\":\"Enable or disable the ability of `superOperator` to transfer tokens of all (superOperator rights).\"},\"supportsInterface(bytes4)\":{\"notice\":\"Check if the contract supports an interface 0x01ffc9a7 is ERC-165 0x80ac58cd is ERC-721 0x5b5e139f is ERC-721 metadata\"},\"symbol()\":{\"notice\":\"Return the symbol of the token contract\"},\"tokenURI(uint256)\":{\"notice\":\"Return the URI of a specific token\"},\"transferFrom(address,address,uint256)\":{\"notice\":\"Transfer a token between 2 addresses\"},\"transferQuad(address,address,uint256,uint256,uint256,bytes)\":{\"notice\":\"transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\"},\"width()\":{\"notice\":\"total width of the map\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/solc_0.8/polygon/child/land/PolygonLandV2.sol\":\"PolygonLandV2\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the\\n * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() initializer {}\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n bool private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Modifier to protect an initializer function from being invoked twice.\\n */\\n modifier initializer() {\\n // If the contract is initializing we ignore whether _initialized is set in order to support multiple\\n // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the\\n // contract may have been reentered.\\n require(_initializing ? _isConstructor() : !_initialized, \\\"Initializable: contract is already initialized\\\");\\n\\n bool isTopLevelCall = !_initializing;\\n if (isTopLevelCall) {\\n _initializing = true;\\n _initialized = true;\\n }\\n\\n _;\\n\\n if (isTopLevelCall) {\\n _initializing = false;\\n }\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} modifier, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n function _isConstructor() private view returns (bool) {\\n return !AddressUpgradeable.isContract(address(this));\\n }\\n}\\n\",\"keccak256\":\"0x68861bcc80cacbd498efde75aab6c74a486cc48262660d326c8d7530d9752097\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721ReceiverUpgradeable {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0x2f359f9d5c56394e60d74401487ab55d8ef0012907b07c9abbb8f998bf5ddfec\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x714a33fd66816f608f6eda908da24eb6009eee50adf4062c86639d4fe508a7b6\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3f0f878c796dfc7feba6d3c4e3e526c14c7deae8b7bfc71088e3f38fab0d77b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n __Context_init_unchained();\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x0b0d548f6381370d394f7a434f994dc678b3ef3e755de106109d61343a685ea7\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n}\\n\",\"keccak256\":\"0x398d3323c1932a5986bf36be7c57593e121e69d5db5b6574b4ee0d031443de37\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"src/solc_0.8/OperatorFilterer/contracts/upgradeable/OperatorFiltererUpgradeable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\nimport {IOperatorFilterRegistry} from \\\"../../interfaces/IOperatorFilterRegistry.sol\\\";\\nimport {ContextUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\\\";\\n\\n///@title OperatorFiltererUpgradeable\\n///@author The Sandbox\\n///@notice This contract would subscibe or copy or just to the subscription provided or just register to default subscription list\\n///@dev This contract is the upgradeable version of the OpenSea implementation https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/OperatorFilterer.sol and adapted to the 0.5.9 solidity version\\nabstract contract OperatorFiltererUpgradeable is ContextUpgradeable {\\n IOperatorFilterRegistry public operatorFilterRegistry;\\n\\n event ContractRegistered(address indexed subscriptionOrRegistrant, bool subscribe);\\n\\n function __OperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe) internal onlyInitializing {\\n _register(subscriptionOrRegistrantToCopy, subscribe);\\n }\\n\\n /**\\n * @notice Register this contract into the registry\\n * @param subscriptionOrRegistrantToCopy address to subscribe or copy entries from\\n * @param subscribe should it subscribe\\n */\\n function _register(address subscriptionOrRegistrantToCopy, bool subscribe) internal {\\n if (address(operatorFilterRegistry).code.length > 0) {\\n if (!operatorFilterRegistry.isRegistered(address(this))) {\\n if (subscribe) {\\n operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);\\n } else {\\n if (subscriptionOrRegistrantToCopy != address(0)) {\\n operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);\\n } else {\\n operatorFilterRegistry.register(address(this));\\n }\\n }\\n }\\n }\\n emit ContractRegistered(subscriptionOrRegistrantToCopy, subscribe);\\n }\\n\\n modifier onlyAllowedOperator(address from) virtual {\\n // Check registry code length to facilitate testing in environments without a deployed registry.\\n if (address(operatorFilterRegistry).code.length > 0) {\\n // Allow spending tokens from addresses with balance\\n // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred\\n // from an EOA.\\n if (from == _msgSender()) {\\n _;\\n return;\\n }\\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), _msgSender())) {\\n revert(\\\"Operator Not Allowed\\\");\\n }\\n }\\n _;\\n }\\n\\n modifier onlyAllowedOperatorApproval(address operator) virtual {\\n // Check registry code length to facilitate testing in environments without a deployed registry.\\n if (address(operatorFilterRegistry).code.length > 0) {\\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), operator)) {\\n revert(\\\"Operator Not Allowed\\\");\\n }\\n }\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x0ceabc23b590c3baccf744a3677118c2ed707055208d35da2bf6ca2308d6ec99\",\"license\":\"MIT\"},\"src/solc_0.8/OperatorFilterer/interfaces/IOperatorFilterRegistry.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\n/**\\n * @title IOperatorFilterRegistry\\n * @author OpenSea\\n * @notice Interface of the operator filter registry\\n * @dev This interface comes from OpenSea https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/IOperatorFilterRegistry.sol and adapted to the 0.5.9 solidity version\\n */\\ninterface IOperatorFilterRegistry {\\n /**\\n * @notice Check if the operator is allowed for the given registrant\\n * @param registrant address of the registrant\\n * @param operator operator address to check\\n * @return is the operator allowed\\n */\\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\\n\\n /**\\n * @notice Register a new address\\n * @param registrant address to register\\n */\\n function register(address registrant) external;\\n\\n /**\\n * @notice Register a new address & subscribe to an address\\n * @param registrant address of the registrant\\n * @param subscription address where the registrant is subscribed to\\n */\\n function registerAndSubscribe(address registrant, address subscription) external;\\n\\n /**\\n * @notice Register and copy entries of another registrant\\n * @param registrant address of the registrant\\n * @param registrantToCopy address to copy from\\n */\\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\\n\\n /**\\n * @notice update the operator for a registrant\\n * @param registrant address of the registrant\\n * @param operator operator to be updated\\n * @param filtered is it filtered\\n */\\n function updateOperator(\\n address registrant,\\n address operator,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update operators for a registrant\\n * @param registrant address of the registrant\\n * @param operators addresses of the operators\\n * @param filtered is it filtered\\n */\\n function updateOperators(\\n address registrant,\\n address[] calldata operators,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update code hash\\n * @param registrant address of the registrant\\n * @param codehash code hash\\n * @param filtered is it filtered\\n */\\n function updateCodeHash(\\n address registrant,\\n bytes32 codehash,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update code hashes\\n * @param registrant address of the registrant\\n * @param codeHashes code hashes\\n * @param filtered is it filtered\\n */\\n function updateCodeHashes(\\n address registrant,\\n bytes32[] calldata codeHashes,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Subscribe a registrant\\n * @param registrant address of the registrant\\n * @param registrantToSubscribe address to subscribe with\\n */\\n function subscribe(address registrant, address registrantToSubscribe) external;\\n\\n /**\\n * @notice Unsubscribe a registrant\\n * @param registrant address of the registrant\\n * @param copyExistingEntries copy existing entries\\n */\\n function unsubscribe(address registrant, bool copyExistingEntries) external;\\n\\n /**\\n * @notice Get the subscription of an address\\n * @param addr address to check\\n * @return registrant the registrant address\\n */\\n function subscriptionOf(address addr) external returns (address registrant);\\n\\n /**\\n * @notice Get the subscribers of the registrant\\n * @param registrant address of the registrant\\n * @return the subscribers addresses\\n */\\n function subscribers(address registrant) external returns (address[] memory);\\n\\n /**\\n * @notice Get a specific subscriber\\n * @param registrant address of the registrant\\n * @param index index to check\\n * @return the ith subscriber of the registrant\\n */\\n function subscriberAt(address registrant, uint256 index) external returns (address);\\n\\n /**\\n * @notice Copy the entries of a registrant\\n * @param registrant address of the registrant\\n * @param registrantToCopy address to copy\\n */\\n function copyEntriesOf(address registrant, address registrantToCopy) external;\\n\\n /**\\n * @notice Is a registrant filtered\\n * @param registrant address of the registrant\\n * @param operator operator address to check\\n * @return is it filtered\\n */\\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\\n\\n /**\\n * @notice Is the code hash of an operator filtered\\n * @param registrant address of the registrant\\n * @param operatorWithCode operator address to check\\n * @return is it filtered\\n */\\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\\n\\n /**\\n * @notice Is the code hash filtered\\n * @param registrant address of the registrant\\n * @param codeHash code hash\\n * @return is it filtered\\n */\\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\\n\\n /**\\n * @notice Get the filtered operators\\n * @param addr address to check\\n * @return filtered operators\\n */\\n function filteredOperators(address addr) external returns (address[] memory);\\n\\n /**\\n * @notice Get the filtered code hashes\\n * @param addr address to check\\n * @return filtered code hashes\\n */\\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\\n\\n /**\\n * @notice Get a specific operator\\n * @param registrant address of the registrant\\n * @param index index to check\\n * @return address of the operator\\n */\\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\\n\\n /**\\n * @notice Get the ith filtered code hash\\n * @param registrant address of the registrant\\n * @param index index to check\\n * @return the code hash\\n */\\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\\n\\n /**\\n * @notice Is the address registered\\n * @param addr address to check\\n * @return is it registered\\n */\\n function isRegistered(address addr) external returns (bool);\\n\\n /**\\n * @notice Get the code hash for this address\\n * @param addr address to check\\n * @return the code hash\\n */\\n function codeHashOf(address addr) external returns (bytes32);\\n}\\n\",\"keccak256\":\"0xe399bf85460967b797bd4d2250b0b6ccbfd1188d3c843e2f29147f8061fc1c8e\",\"license\":\"MIT\"},\"src/solc_0.8/common/BaseWithStorage/ERC2771Handler.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// solhint-disable-next-line compiler-version\\npragma solidity 0.8.2;\\n\\n/**\\n * @title ERC2771Handler\\n * @author The Sandbox\\n * @notice Handle meta-transactions\\n * @dev minimal ERC2771 handler to keep bytecode-size down\\n * based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.6.0/contracts/metatx/ERC2771Context.sol\\n * with an initializer for proxies and a mutable forwarder\\n */\\nabstract contract ERC2771Handler {\\n address internal _trustedForwarder;\\n\\n event TrustedForwarderSet(address indexed newForwarder);\\n\\n /**\\n * @dev Initializes the contract\\n * @param forwarder trusted forwarder address\\n */\\n function __ERC2771Handler_initialize(address forwarder) internal {\\n _trustedForwarder = forwarder;\\n emit TrustedForwarderSet(_trustedForwarder);\\n }\\n\\n /**\\n * @notice Checks if an address is a trusted forwarder\\n * @param forwarder address to check\\n * @return is trusted\\n */\\n function isTrustedForwarder(address forwarder) public view returns (bool) {\\n return forwarder == _trustedForwarder;\\n }\\n\\n /**\\n * @notice Get the current trusted forwarder\\n * @return trustedForwarder address of the trusted forwarder\\n */\\n function getTrustedForwarder() external view returns (address) {\\n return _trustedForwarder;\\n }\\n\\n /**\\n * @dev if the call comes from the trusted forwarder, it gets the real sender by checking the encoded address in the data\\n * @return sender address of the real sender\\n */\\n function _msgSender() internal view virtual returns (address sender) {\\n if (isTrustedForwarder(msg.sender)) {\\n // The assembly code is more direct than the Solidity version using `abi.decode`.\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\\n }\\n } else {\\n return msg.sender;\\n }\\n }\\n\\n /**\\n * @dev if the call comes from the trusted forwarder, it substracts the sender address from `msg.data` to get the real `msg.data`\\n * @return the real `msg.data`\\n */\\n function _msgData() internal view virtual returns (bytes calldata) {\\n if (isTrustedForwarder(msg.sender)) {\\n return msg.data[:msg.data.length - 20];\\n } else {\\n return msg.data;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x33482ab5e863b2f5cc22fb9e77f8eff3484e08601326989da02ae1b147245669\",\"license\":\"MIT\"},\"src/solc_0.8/common/BaseWithStorage/ERC721BaseTokenV2.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n/* solhint-disable func-order, code-complexity */\\n// solhint-disable-next-line compiler-version\\npragma solidity 0.8.2;\\n\\nimport {AddressUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\\\";\\nimport {\\n IERC721ReceiverUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\\\";\\nimport {IERC721Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\\\";\\nimport {WithSuperOperatorsV2} from \\\"./WithSuperOperatorsV2.sol\\\";\\nimport {IERC721MandatoryTokenReceiver} from \\\"../interfaces/IERC721MandatoryTokenReceiver.sol\\\";\\nimport {ContextUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\\\";\\n\\n/// @title ERC721BaseTokenV2\\n/// @author The Sandbox\\n/// @notice Basic functionalities of a NFT\\n/// @dev ERC721 implementation that supports meta-transactions and super operators\\ncontract ERC721BaseTokenV2 is ContextUpgradeable, IERC721Upgradeable, WithSuperOperatorsV2 {\\n using AddressUpgradeable for address;\\n\\n bytes4 internal constant _ERC721_RECEIVED = 0x150b7a02;\\n bytes4 internal constant _ERC721_BATCH_RECEIVED = 0x4b808c46;\\n\\n bytes4 internal constant ERC165ID = 0x01ffc9a7;\\n bytes4 internal constant ERC721_MANDATORY_RECEIVER = 0x5e8bf644;\\n\\n uint256 internal constant NOT_ADDRESS = 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000;\\n uint256 internal constant OPERATOR_FLAG = (2**255);\\n uint256 internal constant NOT_OPERATOR_FLAG = OPERATOR_FLAG - 1;\\n uint256 internal constant BURNED_FLAG = (2**160);\\n\\n mapping(address => uint256) internal _numNFTPerAddress;\\n /**\\n * @dev mapping to store owner of lands and quads.\\n * For 1x1 lands it also the 255 bit is 1 if that land has operator approved and is 0 if no operator is approved.\\n * For burned 1x1 Land 160 bit is set to 1.\\n */\\n mapping(uint256 => uint256) internal _owners;\\n mapping(address => mapping(address => bool)) internal _operatorsForAll;\\n mapping(uint256 => address) internal _operators;\\n\\n /// @notice Approve an operator to spend tokens on the senders behalf.\\n /// @param operator The address receiving the approval.\\n /// @param id The id of the token.\\n function approve(address operator, uint256 id) public virtual override {\\n uint256 ownerData = _owners[_storageId(id)];\\n address owner = _ownerOf(id);\\n address msgSender = _msgSender();\\n require(owner != address(0), \\\"NONEXISTENT_TOKEN\\\");\\n require(\\n owner == msgSender || _operatorsForAll[owner][msgSender] || _superOperators[msgSender],\\n \\\"UNAUTHORIZED_APPROVAL\\\"\\n );\\n _approveFor(ownerData, operator, id);\\n }\\n\\n /// @notice Approve an operator to spend tokens on the sender behalf.\\n /// @param sender The address giving the approval.\\n /// @param operator The address receiving the approval.\\n /// @param id The id of the token.\\n function approveFor(\\n address sender,\\n address operator,\\n uint256 id\\n ) public virtual {\\n uint256 ownerData = _owners[_storageId(id)];\\n address owner = _ownerOf(id);\\n address msgSender = _msgSender();\\n require(sender != address(0), \\\"ZERO_ADDRESS_SENDER\\\");\\n require(owner != address(0), \\\"NONEXISTENT_TOKEN\\\");\\n require(\\n msgSender == sender || _operatorsForAll[sender][msgSender] || _superOperators[msgSender],\\n \\\"UNAUTHORIZED_APPROVAL\\\"\\n );\\n require(address(uint160(ownerData)) == sender, \\\"OWNER_NOT_SENDER\\\");\\n _approveFor(ownerData, operator, id);\\n }\\n\\n /// @notice Transfer a token between 2 addresses.\\n /// @param from The sender of the token.\\n /// @param to The recipient of the token.\\n /// @param id The id of the token.\\n function transferFrom(\\n address from,\\n address to,\\n uint256 id\\n ) public virtual override {\\n _checkTransfer(from, to, id);\\n _transferFrom(from, to, id);\\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\\n require(_checkOnERC721Received(_msgSender(), from, to, id, \\\"\\\"), \\\"ERC721_TRANSFER_REJECTED\\\");\\n }\\n }\\n\\n /// @notice Transfer a token between 2 addresses letting the receiver know of the transfer.\\n /// @param from The sender of the token.\\n /// @param to The recipient of the token.\\n /// @param id The id of the token.\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id\\n ) public virtual override {\\n safeTransferFrom(from, to, id, \\\"\\\");\\n }\\n\\n /// @notice Transfer many tokens between 2 addresses.\\n /// @param from The sender of the token.\\n /// @param to The recipient of the token.\\n /// @param ids The ids of the tokens.\\n /// @param data Additional data.\\n function batchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) public virtual {\\n _batchTransferFrom(from, to, ids, data, false);\\n }\\n\\n /// @notice Transfer many tokens between 2 addresses, while\\n /// ensuring the receiving contract has a receiver method.\\n /// @param from The sender of the token.\\n /// @param to The recipient of the token.\\n /// @param ids The ids of the tokens.\\n /// @param data Additional data.\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) external virtual {\\n _batchTransferFrom(from, to, ids, data, true);\\n }\\n\\n /// @notice Set the approval for an operator to manage all the tokens of the sender.\\n /// @param sender The address giving the approval.\\n /// @param operator The address receiving the approval.\\n /// @param approved The determination of the approval.\\n function setApprovalForAllFor(\\n address sender,\\n address operator,\\n bool approved\\n ) public virtual {\\n require(sender != address(0), \\\"Invalid sender address\\\");\\n address msgSender = _msgSender();\\n require(msgSender == sender || _superOperators[msgSender], \\\"UNAUTHORIZED_APPROVE_FOR_ALL\\\");\\n\\n _setApprovalForAll(sender, operator, approved);\\n }\\n\\n /// @notice Set the approval for an operator to manage all the tokens of the sender.\\n /// @param operator The address receiving the approval.\\n /// @param approved The determination of the approval.\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /// @notice Burns token `id`.\\n /// @param id The token which will be burnt.\\n function burn(uint256 id) external virtual {\\n _burn(_msgSender(), _ownerOf(id), id);\\n }\\n\\n /// @notice Burn token `id` from `from`.\\n /// @param from address whose token is to be burnt.\\n /// @param id The token which will be burnt.\\n function burnFrom(address from, uint256 id) external virtual {\\n require(from != address(0), \\\"NOT_FROM_ZEROADDRESS\\\");\\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\\n address msgSender = _msgSender();\\n require(\\n msgSender == from ||\\n (operatorEnabled && _operators[id] == msgSender) ||\\n _superOperators[msgSender] ||\\n _operatorsForAll[from][msgSender],\\n \\\"UNAUTHORIZED_BURN\\\"\\n );\\n _burn(from, owner, id);\\n }\\n\\n /// @notice Get the number of tokens owned by an address.\\n /// @param owner The address to look for.\\n /// @return The number of tokens owned by the address.\\n function balanceOf(address owner) external view override returns (uint256) {\\n require(owner != address(0), \\\"ZERO_ADDRESS_OWNER\\\");\\n return _numNFTPerAddress[owner];\\n }\\n\\n /// @notice Get the owner of a token.\\n /// @param id The id of the token.\\n /// @return owner The address of the token owner.\\n function ownerOf(uint256 id) external view override returns (address owner) {\\n owner = _ownerOf(id);\\n require(owner != address(0), \\\"NONEXISTANT_TOKEN\\\");\\n }\\n\\n /// @notice Get the approved operator for a specific token.\\n /// @param id The id of the token.\\n /// @return The address of the operator.\\n function getApproved(uint256 id) external view override returns (address) {\\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\\n require(owner != address(0), \\\"NONEXISTENT_TOKEN\\\");\\n if (operatorEnabled) {\\n return _operators[id];\\n } else {\\n return address(0);\\n }\\n }\\n\\n /// @notice Check if the sender approved the operator.\\n /// @param owner The address of the owner.\\n /// @param operator The address of the operator.\\n /// @return isOperator The status of the approval.\\n function isApprovedForAll(address owner, address operator) external view override returns (bool) {\\n return _operatorsForAll[owner][operator] || _superOperators[operator];\\n }\\n\\n /// @notice Transfer a token between 2 addresses letting the receiver knows of the transfer.\\n /// @param from The sender of the token.\\n /// @param to The recipient of the token.\\n /// @param id The id of the token.\\n /// @param data Additional data.\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n bytes memory data\\n ) public virtual override {\\n _checkTransfer(from, to, id);\\n _transferFrom(from, to, id);\\n if (to.isContract()) {\\n require(_checkOnERC721Received(_msgSender(), from, to, id, data), \\\"ERC721_TRANSFER_REJECTED\\\");\\n }\\n }\\n\\n /// @notice Check if the contract supports an interface.\\n /// 0x01ffc9a7 is ERC-165.\\n /// 0x80ac58cd is ERC-721\\n /// @param id The id of the interface.\\n /// @return Whether the interface is supported.\\n function supportsInterface(bytes4 id) public pure virtual override returns (bool) {\\n return id == 0x01ffc9a7 || id == 0x80ac58cd;\\n }\\n\\n /// @dev By overriding this function in an implementation which inherits this contract,\\n /// you can enable versioned tokenIds without the extra overhead of writing to a new storage slot in _owners each time a version is incremented.\\n /// See GameToken._storageId() for an example, where the storageId is the tokenId minus the version number.\\n /// !!! Caution !!! Overriding this function without taking appropriate care could lead to\\n /// ownerOf() returning an owner for non-existent tokens. Tests should be written to\\n /// guard against introducing this bug.\\n /// @param id The id of a token.\\n /// @return The id used for storage mappings.\\n function _storageId(uint256 id) internal view virtual returns (uint256) {\\n return id;\\n }\\n\\n function _updateOwnerData(\\n uint256 id,\\n uint256 oldData,\\n address newOwner,\\n bool hasOperator\\n ) internal virtual {\\n if (hasOperator) {\\n _owners[_storageId(id)] = (oldData & NOT_ADDRESS) | OPERATOR_FLAG | uint256(uint160(newOwner));\\n } else {\\n _owners[_storageId(id)] = ((oldData & NOT_ADDRESS) & NOT_OPERATOR_FLAG) | uint256(uint160(newOwner));\\n }\\n }\\n\\n function _transferFrom(\\n address from,\\n address to,\\n uint256 id\\n ) internal {\\n _numNFTPerAddress[from]--;\\n _numNFTPerAddress[to]++;\\n _updateOwnerData(id, _owners[_storageId(id)], to, false);\\n emit Transfer(from, to, id);\\n }\\n\\n /// @dev See approveFor.\\n function _approveFor(\\n uint256 ownerData,\\n address operator,\\n uint256 id\\n ) internal {\\n address owner = _ownerOf(id);\\n if (operator == address(0)) {\\n _updateOwnerData(id, ownerData, owner, false);\\n } else {\\n _updateOwnerData(id, ownerData, owner, true);\\n _operators[id] = operator;\\n }\\n emit Approval(owner, operator, id);\\n }\\n\\n /// @dev See batchTransferFrom.\\n function _batchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n bytes memory data,\\n bool safe\\n ) internal {\\n address msgSender = _msgSender();\\n bool authorized = msgSender == from || _operatorsForAll[from][msgSender] || _superOperators[msgSender];\\n\\n require(from != address(0), \\\"NOT_FROM_ZEROADDRESS\\\");\\n require(to != address(0), \\\"NOT_TO_ZEROADDRESS\\\");\\n\\n uint256 numTokens = ids.length;\\n for (uint256 i = 0; i < numTokens; i++) {\\n uint256 id = ids[i];\\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\\n require(owner == from, \\\"BATCHTRANSFERFROM_NOT_OWNER\\\");\\n require(authorized || (operatorEnabled && _operators[id] == msgSender), \\\"NOT_AUTHORIZED\\\");\\n _updateOwnerData(id, _owners[_storageId(id)], to, false);\\n emit Transfer(from, to, id);\\n }\\n if (from != to) {\\n _numNFTPerAddress[from] -= numTokens;\\n _numNFTPerAddress[to] += numTokens;\\n }\\n\\n if (to.isContract()) {\\n if (_checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\\n require(_checkOnERC721BatchReceived(msgSender, from, to, ids, data), \\\"ERC721_BATCH_RECEIVED_REJECTED\\\");\\n } else if (safe) {\\n for (uint256 i = 0; i < numTokens; i++) {\\n require(_checkOnERC721Received(msgSender, from, to, ids[i], data), \\\"ERC721_RECEIVED_REJECTED\\\");\\n }\\n }\\n }\\n }\\n\\n /// @dev See setApprovalForAll.\\n function _setApprovalForAll(\\n address sender,\\n address operator,\\n bool approved\\n ) internal {\\n require(!_superOperators[operator], \\\"INVALID_APPROVAL_CHANGE\\\");\\n _operatorsForAll[sender][operator] = approved;\\n\\n emit ApprovalForAll(sender, operator, approved);\\n }\\n\\n /// @dev See burn.\\n function _burn(\\n address from,\\n address owner,\\n uint256 id\\n ) internal {\\n require(from == owner, \\\"NOT_OWNER\\\");\\n uint256 storageId = _storageId(id);\\n _owners[storageId] = (_owners[storageId] & NOT_OPERATOR_FLAG) | BURNED_FLAG; // record as non owner but keep track of last owner\\n _numNFTPerAddress[from]--;\\n emit Transfer(from, address(0), id);\\n }\\n\\n /// @dev Check if receiving contract accepts erc721 transfers.\\n /// @param operator The address of the operator.\\n /// @param from The from address, may be different from msg.sender.\\n /// @param to The address we want to transfer to.\\n /// @param tokenId The id of the token we would like to transfer.\\n /// @param _data Any additional data to send with the transfer.\\n /// @return Whether the expected value of 0x150b7a02 is returned.\\n function _checkOnERC721Received(\\n address operator,\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory _data\\n ) internal returns (bool) {\\n bytes4 retval = IERC721ReceiverUpgradeable(to).onERC721Received(operator, from, tokenId, _data);\\n return (retval == _ERC721_RECEIVED);\\n }\\n\\n /// @dev Check if receiving contract accepts erc721 batch transfers.\\n /// @param operator The address of the operator.\\n /// @param from The from address, may be different from msg.sender.\\n /// @param to The address we want to transfer to.\\n /// @param ids The ids of the tokens we would like to transfer.\\n /// @param _data Any additional data to send with the transfer.\\n /// @return Whether the expected value of 0x4b808c46 is returned.\\n function _checkOnERC721BatchReceived(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n bytes memory _data\\n ) internal returns (bool) {\\n bytes4 retval = IERC721MandatoryTokenReceiver(to).onERC721BatchReceived(operator, from, ids, _data);\\n return (retval == _ERC721_BATCH_RECEIVED);\\n }\\n\\n /// @dev See ownerOf\\n function _ownerOf(uint256 id) internal view virtual returns (address) {\\n uint256 data = _owners[_storageId(id)];\\n if ((data & BURNED_FLAG) == BURNED_FLAG) {\\n return address(0);\\n }\\n return address(uint160(data));\\n }\\n\\n /// @dev Get the owner and operatorEnabled status of a token.\\n /// @param id The token to query.\\n /// @return owner The owner of the token.\\n /// @return operatorEnabled Whether or not operators are enabled for this token.\\n function _ownerAndOperatorEnabledOf(uint256 id)\\n internal\\n view\\n virtual\\n returns (address owner, bool operatorEnabled)\\n {\\n uint256 data = _owners[_storageId(id)];\\n if ((data & BURNED_FLAG) == BURNED_FLAG) {\\n owner = address(0);\\n } else {\\n owner = address(uint160(data));\\n }\\n operatorEnabled = (data & OPERATOR_FLAG) == OPERATOR_FLAG;\\n }\\n\\n /// @dev Check whether a transfer is a meta Transaction or not.\\n /// @param from The address who initiated the transfer (may differ from msg.sender).\\n /// @param to The address receiving the token.\\n /// @param id The token being transferred.\\n function _checkTransfer(\\n address from,\\n address to,\\n uint256 id\\n ) internal view {\\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\\n address msgSender = _msgSender();\\n require(owner != address(0), \\\"NONEXISTENT_TOKEN\\\");\\n require(owner == from, \\\"CHECKTRANSFER_NOT_OWNER\\\");\\n require(to != address(0), \\\"NOT_TO_ZEROADDRESS\\\");\\n require(\\n msgSender == owner ||\\n _superOperators[msgSender] ||\\n _operatorsForAll[from][msgSender] ||\\n (operatorEnabled && _operators[id] == msgSender),\\n \\\"UNAUTHORIZED_TRANSFER\\\"\\n );\\n }\\n\\n /// @dev Check if there was enough gas.\\n /// @param _contract The address of the contract to check.\\n /// @param interfaceId The id of the interface we want to test.\\n /// @return Whether or not this check succeeded.\\n function _checkInterfaceWith10000Gas(address _contract, bytes4 interfaceId) internal view returns (bool) {\\n bool success;\\n bool result;\\n bytes memory callData = abi.encodeWithSelector(ERC165ID, interfaceId);\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let call_ptr := add(0x20, callData)\\n let call_size := mload(callData)\\n let output := mload(0x40) // Find empty storage location using \\\"free memory pointer\\\"\\n mstore(output, 0x0)\\n success := staticcall(10000, _contract, call_ptr, call_size, output, 0x20) // 32 bytes\\n result := mload(output)\\n }\\n // (10000 / 63) \\\"not enough for supportsInterface(...)\\\" // consume all gas, so caller can potentially know that there was not enough gas\\n assert(gasleft() > 158);\\n return success && result;\\n }\\n}\\n\",\"keccak256\":\"0x4bdcda30d7b3e0bc4575b441afe106fa855244f01e755ebd2c55894abb461232\",\"license\":\"MIT\"},\"src/solc_0.8/common/BaseWithStorage/WithAdminV2.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// solhint-disable-next-line compiler-version\\npragma solidity 0.8.2;\\n\\nimport {ContextUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\\\";\\n\\n/// @title WithAdminV2\\n/// @author The Sandbox\\n/// @notice Add an admin to the contract\\ncontract WithAdminV2 is ContextUpgradeable {\\n address internal _admin;\\n\\n /// @dev Emits when the contract administrator is changed.\\n /// @param oldAdmin The address of the previous administrator.\\n /// @param newAdmin The address of the new administrator.\\n event AdminChanged(address indexed oldAdmin, address indexed newAdmin);\\n\\n modifier onlyAdmin() {\\n require(_msgSender() == _admin, \\\"ADMIN_ONLY\\\");\\n _;\\n }\\n\\n /// @notice Get the current admin\\n /// @dev Get the current administrator of this contract.\\n /// @return The current administrator of this contract.\\n function getAdmin() external view returns (address) {\\n return _admin;\\n }\\n\\n /// @notice Change the admin of the contract\\n /// @dev Change the administrator to be `newAdmin`.\\n /// @param newAdmin The address of the new administrator.\\n function changeAdmin(address newAdmin) external {\\n address admin = _admin;\\n require(_msgSender() == admin, \\\"ADMIN_ACCESS_DENIED\\\");\\n emit AdminChanged(admin, newAdmin);\\n _admin = newAdmin;\\n }\\n}\\n\",\"keccak256\":\"0x27262f45048499bbf49b6fc7cc393517a1326c0da1bf50016b19938cea4f5b44\",\"license\":\"MIT\"},\"src/solc_0.8/common/BaseWithStorage/WithSuperOperatorsV2.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// solhint-disable-next-line compiler-version\\npragma solidity 0.8.2;\\n\\nimport {WithAdminV2} from \\\"./WithAdminV2.sol\\\";\\nimport {ContextUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\\\";\\n\\n/// @title WithSuperOperatorsV2\\n/// @author The Sandbox\\n/// @notice Add super operators handled by an admin\\ncontract WithSuperOperatorsV2 is ContextUpgradeable, WithAdminV2 {\\n mapping(address => bool) internal _superOperators;\\n\\n event SuperOperator(address indexed superOperator, bool indexed enabled);\\n\\n /// @notice Enable or disable the ability of `superOperator` to transfer tokens of all (superOperator rights).\\n /// @param superOperator address that will be given/removed superOperator right.\\n /// @param enabled set whether the superOperator is enabled or disabled.\\n function setSuperOperator(address superOperator, bool enabled) external onlyAdmin {\\n require(_msgSender() == _admin, \\\"only admin is allowed to add super operators\\\");\\n _superOperators[superOperator] = enabled;\\n emit SuperOperator(superOperator, enabled);\\n }\\n\\n /// @notice check whether address `who` is given superOperator rights.\\n /// @param who The address to query.\\n /// @return whether the address has superOperator rights.\\n function isSuperOperator(address who) public view returns (bool) {\\n return _superOperators[who];\\n }\\n}\\n\",\"keccak256\":\"0xd15e48c2f1e3a8b70e3f9a1d96e38156207e3f3eaf593cc7f46b6def906f9819\",\"license\":\"MIT\"},\"src/solc_0.8/common/interfaces/IERC721MandatoryTokenReceiver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// solhint-disable-next-line compiler-version\\npragma solidity 0.8.2;\\n\\n/**\\n * @title IERC721MandatoryTokenReceiver\\n * @author The Sandbox\\n * @notice Interface for any contract that wants to support safeBatchTransfers\\n * from ERC721 asset contracts.\\n * @dev The ERC-165 identifier for this interface is 0x5e8bf644.\\n */\\ninterface IERC721MandatoryTokenReceiver {\\n /**\\n * @notice Whenever tokens are transferred to this contract via {IERC721-safeBatchTransferFrom}\\n * by `operator` from `from`, this function is called.\\n * @param operator sender\\n * @param from owner of the tokens\\n * @param ids token ids\\n * @param data extra data\\n * @return 0x4b808c46 if the transfer is a success\\n */\\n function onERC721BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) external returns (bytes4); // needs to return 0x4b808c46\\n\\n /**\\n * @notice Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n * @param operator sender\\n * @param from owner of the token\\n * @param tokenId token id\\n * @param data extra data\\n * @return 0x4b808c46 if the transfer is a success\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4); // needs to return 0x150b7a02\\n}\\n\",\"keccak256\":\"0x6e1235c041b7d8747fa458037006e8df72bea62474dd04977e210d19914b7f5d\",\"license\":\"MIT\"},\"src/solc_0.8/common/interfaces/ILandToken.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\n/// @title ILandToken\\n/// @author The Sandbox\\n/// @notice Interface of the LAND token including quad methods\\ninterface ILandToken {\\n /// @notice transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\\n /// @param from current owner of the quad\\n /// @param to destination\\n /// @param sizes list of sizes for each quad\\n /// @param xs list of bottom left x coordinates for each quad\\n /// @param ys list of bottom left y coordinates for each quad\\n /// @param data additional data\\n function batchTransferQuad(\\n address from,\\n address to,\\n uint256[] calldata sizes,\\n uint256[] calldata xs,\\n uint256[] calldata ys,\\n bytes calldata data\\n ) external;\\n\\n /// @notice transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\\n /// @param from current owner of the quad\\n /// @param to destination\\n /// @param size size of the quad\\n /// @param x The top left x coordinate of the quad\\n /// @param y The top left y coordinate of the quad\\n /// @param data additional data\\n function transferQuad(\\n address from,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes calldata data\\n ) external;\\n\\n /// @notice Transfer many tokens between 2 addresses.\\n /// @param from The sender of the token.\\n /// @param to The recipient of the token.\\n /// @param ids The ids of the tokens.\\n /// @param data Additional data.\\n function batchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x5df895e3442904d5f6a6ad3b4b34a2ec61d4a97a4b3feea57d5bb611d14a7e3e\",\"license\":\"MIT\"},\"src/solc_0.8/common/interfaces/IPolygonLand.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\nimport {ILandToken} from \\\"./ILandToken.sol\\\";\\n\\n/**\\n * @title IPolygonLand\\n * @author The Sandbox\\n * @notice Interface of the LAND token on the child chain\\n */\\ninterface IPolygonLand is ILandToken {\\n /**\\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\\n * @param to The recipient of the new quad\\n * @param size The size of the new quad\\n * @param x The top left x coordinate of the new quad\\n * @param y The top left y coordinate of the new quad\\n * @param data extra data to pass to the transfer\\n */\\n function mintQuad(\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes memory data\\n ) external;\\n\\n /**\\n * @notice Checks if a LAND exists by its coordinates\\n * @param size size of the quad\\n * @param x x coordinate\\n * @param y y coordinate\\n * @return does the LAND exist\\n */\\n function exists(\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x725deed21224d8adb2b2cc1dd0615447abee654e519cd9e22ffa505954dfc15d\",\"license\":\"MIT\"},\"src/solc_0.8/polygon/child/land/PolygonLandBaseTokenV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// solhint-disable code-complexity\\n\\npragma solidity 0.8.2;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\\\";\\nimport \\\"../../../common/BaseWithStorage/ERC721BaseTokenV2.sol\\\";\\nimport \\\"../../../common/interfaces/IPolygonLand.sol\\\";\\n\\n/**\\n * @title PolygonLandBaseTokenV2\\n * @author The Sandbox\\n * @notice Implement LAND and quad functionalities on top of an ERC721 token\\n * @dev This contract implements a quad tree structure to handle groups of ERC721 tokens at once\\n */\\nabstract contract PolygonLandBaseTokenV2 is IPolygonLand, Initializable, ERC721BaseTokenV2 {\\n using AddressUpgradeable for address;\\n\\n uint256 internal constant GRID_SIZE = 408;\\n\\n uint256 internal constant LAYER = 0xFF00000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_1x1 = 0x0000000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_3x3 = 0x0100000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_6x6 = 0x0200000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_12x12 = 0x0300000000000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant LAYER_24x24 = 0x0400000000000000000000000000000000000000000000000000000000000000;\\n\\n mapping(address => bool) internal _minters;\\n\\n event Minter(address indexed minter, bool enabled);\\n\\n struct Land {\\n uint256 x;\\n uint256 y;\\n uint256 size;\\n }\\n\\n /// @notice transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\\n /// @param from current owner of the quad\\n /// @param to destination\\n /// @param sizes list of sizes for each quad\\n /// @param xs list of bottom left x coordinates for each quad\\n /// @param ys list of bottom left y coordinates for each quad\\n /// @param data additional data\\n function batchTransferQuad(\\n address from,\\n address to,\\n uint256[] calldata sizes,\\n uint256[] calldata xs,\\n uint256[] calldata ys,\\n bytes calldata data\\n ) external override {\\n require(from != address(0), \\\"from is zero address\\\");\\n require(to != address(0), \\\"can't send to zero address\\\");\\n require(sizes.length == xs.length, \\\"PolygonLandBaseTokenV2: sizes's and x's length are different\\\");\\n require(xs.length == ys.length, \\\"PolygonLandBaseTokenV2: x's and y's length are different\\\");\\n if (_msgSender() != from) {\\n require(\\n _operatorsForAll[from][_msgSender()] || _superOperators[_msgSender()],\\n \\\"not authorized to transferMultiQuads\\\"\\n );\\n }\\n uint256 numTokensTransfered = 0;\\n for (uint256 i = 0; i < sizes.length; i++) {\\n uint256 size = sizes[i];\\n _transferQuad(from, to, size, xs[i], ys[i]);\\n numTokensTransfered += size * size;\\n }\\n _numNFTPerAddress[from] -= numTokensTransfered;\\n _numNFTPerAddress[to] += numTokensTransfered;\\n\\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\\n uint256[] memory ids = new uint256[](numTokensTransfered);\\n uint256 counter = 0;\\n for (uint256 j = 0; j < sizes.length; j++) {\\n uint256 size = sizes[j];\\n for (uint256 i = 0; i < size * size; i++) {\\n ids[counter] = _idInPath(i, size, xs[j], ys[j]);\\n counter++;\\n }\\n }\\n require(\\n _checkOnERC721BatchReceived(_msgSender(), from, to, ids, data),\\n \\\"erc721 batch transfer rejected by to\\\"\\n );\\n }\\n }\\n\\n /// @notice Enable or disable the ability of `minter` to transfer tokens of all (minter rights).\\n /// @param minter address that will be given/removed minter right.\\n /// @param enabled set whether the minter is enabled or disabled.\\n function setMinter(address minter, bool enabled) external onlyAdmin {\\n require(minter != address(0), \\\"PolygonLand: Invalid address\\\");\\n _minters[minter] = enabled;\\n emit Minter(minter, enabled);\\n }\\n\\n /// @notice transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\\n /// @param from current owner of the quad\\n /// @param to destination\\n /// @param size size of the quad\\n /// @param x The top left x coordinate of the quad\\n /// @param y The top left y coordinate of the quad\\n /// @param data additional data for transfer\\n function transferQuad(\\n address from,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes calldata data\\n ) external override {\\n require(from != address(0), \\\"from is zero address\\\");\\n require(to != address(0), \\\"can't send to zero address\\\");\\n if (_msgSender() != from) {\\n require(\\n _operatorsForAll[from][_msgSender()] || _superOperators[_msgSender()],\\n \\\"not authorized to transferQuad\\\"\\n );\\n }\\n _transferQuad(from, to, size, x, y);\\n _numNFTPerAddress[from] -= size * size;\\n _numNFTPerAddress[to] += size * size;\\n\\n _checkBatchReceiverAcceptQuad(_msgSender(), from, to, size, x, y, data);\\n }\\n\\n /**\\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\\n * @param user The recipient of the new quad\\n * @param size The size of the new quad\\n * @param x The top left x coordinate of the new quad\\n * @param y The top left y coordinate of the new quad\\n * @param data extra data to pass to the transfer\\n */\\n function mintQuad(\\n address user,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes memory data\\n ) external virtual override {\\n _isValidQuad(size, x, y);\\n require(isMinter(_msgSender()), \\\"!AUTHORIZED\\\");\\n _mintQuad(user, size, x, y, data);\\n }\\n\\n /**\\n * @notice Checks if a parent quad has child quads already minted.\\n * Then mints the rest child quads and transfers the parent quad.\\n * Should only be called by the tunnel.\\n * @param to The recipient of the new quad\\n * @param size The size of the new quad\\n * @param x The top left x coordinate of the new quad\\n * @param y The top left y coordinate of the new quad\\n * @param data extra data to pass to the transfer\\n */\\n function mintAndTransferQuad(\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes calldata data\\n ) external virtual {\\n require(isMinter(msg.sender), \\\"!AUTHORIZED\\\");\\n require(to != address(0), \\\"to is zero address\\\");\\n\\n if (exists(size, x, y)) {\\n _transferQuad(msg.sender, to, size, x, y);\\n _numNFTPerAddress[msg.sender] -= size * size;\\n _numNFTPerAddress[to] += size * size;\\n _checkBatchReceiverAcceptQuad(msg.sender, msg.sender, to, size, x, y, data);\\n } else {\\n _mintAndTransferQuad(to, size, x, y, data);\\n }\\n }\\n\\n /// @notice x coordinate of Land token\\n /// @param id tokenId\\n /// @return the x coordinates\\n function getX(uint256 id) external pure returns (uint256) {\\n return _getX(id);\\n }\\n\\n /// @inheritdoc ERC721BaseTokenV2\\n function batchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n bytes calldata data\\n ) public virtual override(ILandToken, ERC721BaseTokenV2) {\\n super.batchTransferFrom(from, to, ids, data);\\n }\\n\\n /// @notice y coordinate of Land token\\n /// @param id tokenId\\n /// @return the y coordinates\\n function getY(uint256 id) external pure returns (uint256) {\\n return _getY(id);\\n }\\n\\n /**\\n * @notice Check if the contract supports an interface\\n * 0x01ffc9a7 is ERC-165\\n * 0x80ac58cd is ERC-721\\n * 0x5b5e139f is ERC-721 metadata\\n * @param id The id of the interface\\n * @return True if the interface is supported\\n */\\n function supportsInterface(bytes4 id) public pure override returns (bool) {\\n return id == 0x01ffc9a7 || id == 0x80ac58cd || id == 0x5b5e139f;\\n }\\n\\n /**\\n * @notice Return the name of the token contract\\n * @return The name of the token contract\\n */\\n function name() public pure returns (string memory) {\\n return \\\"Sandbox's LANDs\\\";\\n }\\n\\n /// @notice check whether address `who` is given minter rights.\\n /// @param who The address to query.\\n /// @return whether the address has minter rights.\\n function isMinter(address who) public view returns (bool) {\\n return _minters[who];\\n }\\n\\n /// @notice checks if Land has been minted or not\\n /// @param size size of the\\n /// @param x x coordinate of the quad\\n /// @param y y coordinate of the quad\\n /// @return bool for if Land has been minted or not\\n function exists(\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) public view override returns (bool) {\\n _isValidQuad(size, x, y);\\n return _ownerOfQuad(size, x, y) != address(0);\\n }\\n\\n /**\\n * @notice Return the symbol of the token contract\\n * @return The symbol of the token contract\\n */\\n function symbol() public pure returns (string memory) {\\n return \\\"LAND\\\";\\n }\\n\\n /// @notice total width of the map\\n /// @return width\\n function width() public pure returns (uint256) {\\n return GRID_SIZE;\\n }\\n\\n /// @notice total height of the map\\n /// @return height\\n function height() public pure returns (uint256) {\\n return GRID_SIZE;\\n }\\n\\n /**\\n * @notice Return the URI of a specific token\\n * @param id The id of the token\\n * @return The URI of the token\\n */\\n function tokenURI(uint256 id) public view returns (string memory) {\\n require(_ownerOf(id) != address(0), \\\"Id does not exist\\\");\\n return\\n string(\\n abi.encodePacked(\\\"https://api.sandbox.game/lands/\\\", StringsUpgradeable.toString(id), \\\"/metadata.json\\\")\\n );\\n }\\n\\n function _isValidQuad(\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) internal pure {\\n require(size == 1 || size == 3 || size == 6 || size == 12 || size == 24, \\\"Invalid size\\\");\\n require(x % size == 0, \\\"Invalid x coordinate\\\");\\n require(y % size == 0, \\\"Invalid y coordinate\\\");\\n require(x <= GRID_SIZE - size, \\\"x out of bounds\\\");\\n require(y <= GRID_SIZE - size, \\\"y out of bounds\\\");\\n }\\n\\n function _transferQuad(\\n address from,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) internal {\\n _isValidQuad(size, x, y);\\n if (size == 1) {\\n uint256 id1x1 = _getQuadId(LAYER_1x1, x, y);\\n address owner = _ownerOf(id1x1);\\n require(owner != address(0), \\\"token does not exist\\\");\\n require(owner == from, \\\"not owner in _transferQuad\\\");\\n _owners[id1x1] = uint256(uint160(address(to)));\\n } else {\\n _regroupQuad(from, to, Land({x: x, y: y, size: size}), true, size / 2);\\n }\\n for (uint256 i = 0; i < size * size; i++) {\\n emit Transfer(from, to, _idInPath(i, size, x, y));\\n }\\n }\\n\\n function _mintQuad(\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes memory data\\n ) internal {\\n require(to != address(0), \\\"to is zero address\\\");\\n\\n (uint256 layer, , ) = _getQuadLayer(size);\\n uint256 quadId = _getQuadId(layer, x, y);\\n\\n _checkOwner(size, x, y, 24);\\n for (uint256 i = 0; i < size * size; i++) {\\n uint256 _id = _idInPath(i, size, x, y);\\n require(_owners[_id] == 0, \\\"Already minted\\\");\\n emit Transfer(address(0), to, _id);\\n }\\n\\n _owners[quadId] = uint256(uint160(to));\\n _numNFTPerAddress[to] += size * size;\\n\\n _checkBatchReceiverAcceptQuad(msg.sender, address(0), to, size, x, y, data);\\n }\\n\\n /**\\n * @dev checks if the child quads in the parent quad (size, x, y) are owned by msg.sender.\\n * It recursively checks child quad of every size(exculding Lands of 1x1 size) are minted or not.\\n * Quad which are minted are pushed into quadMinted to also check if every Land of size 1x1 in\\n * the parent quad is minted or not. While checking if the every child Quad and Land is minted it\\n * also checks and clear the owner for quads which are minted. Finally it checks if the new owner\\n * if is a contract can handle ERC721 tokens or not and transfers the parent quad to new owner.\\n * @param to The address to which the ownership of the quad will be transferred\\n * @param size The size of the quad being minted and transfered\\n * @param x The x-coordinate of the top-left corner of the quad being minted.\\n * @param y The y-coordinate of the top-left corner of the quad being minted.\\n * @param y The y-coordinate of the top-left corner of the quad being minted.\\n */\\n function _mintAndTransferQuad(\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes memory data\\n ) internal {\\n (uint256 layer, , ) = _getQuadLayer(size);\\n uint256 quadId = _getQuadId(layer, x, y);\\n\\n // Length of array is equal to number of 3x3 child quad a 24x24 quad can have. Would be used to push the minted Quads.\\n Land[] memory quadMinted = new Land[](64);\\n // index of last minted quad pushed on quadMinted Array\\n uint256 index;\\n uint256 landMinted;\\n\\n // if size of the Quad in land struct to be transfered is greater than 3 we check recursivly if the child quads are minted or not.\\n if (size > 3) {\\n (index, landMinted) = _checkAndClearOwner(\\n Land({x: x, y: y, size: size}),\\n quadMinted,\\n landMinted,\\n index,\\n size / 2\\n );\\n }\\n\\n // Lopping around the Quad in land struct to generate ids of 1x1 land token and checking if they are owned by msg.sender\\n {\\n for (uint256 i = 0; i < size * size; i++) {\\n uint256 _id = _idInPath(i, size, x, y);\\n // checking land with token id \\\"_id\\\" is in the quadMinted array.\\n bool isAlreadyMinted = _isQuadMinted(quadMinted, Land({x: _getX(_id), y: _getY(_id), size: 1}), index);\\n if (isAlreadyMinted) {\\n // if land is in the quadMinted array there just emitting transfer event\\n emit Transfer(msg.sender, to, _id);\\n } else {\\n if (address(uint160(_owners[_id])) == msg.sender) {\\n if (_operators[_id] != address(0)) _operators[_id] = address(0);\\n landMinted += 1;\\n emit Transfer(msg.sender, to, _id);\\n } else {\\n // else is checked if owned by the msg.sender or not. If it is not owned by msg.sender it should not have an owner.\\n require(_owners[_id] == 0, \\\"Already minted\\\");\\n\\n emit Transfer(address(0), to, _id);\\n }\\n }\\n }\\n }\\n\\n // checking if the new owner \\\"to\\\" is a contract. If yes, checking if it could handle ERC721 tokens.\\n _checkBatchReceiverAcceptQuadAndClearOwner(quadMinted, index, landMinted, to, size, x, y, data);\\n\\n _owners[quadId] = uint256(uint160(to));\\n _numNFTPerAddress[to] += size * size;\\n _numNFTPerAddress[msg.sender] -= landMinted;\\n }\\n\\n /**\\n * @dev recursivly checks if the child quads are minted in land and push them to the quadMinted array.\\n * if a child quad is minted in land such quads child quads will be skipped such that there is no overlapping\\n * in quads which are minted. it clears the minted child quads owners.\\n * @param land the stuct which has the size x and y co-ordinate of Quad to be checked\\n * @param quadMinted array in which the minted child quad would be pushed\\n * @param landMinted total 1x1 land already minted\\n * @param index index of last element of quadMinted array\\n * @param quadCompareSize the size of the child quads to be checked.\\n * @return the index of last quad pushed in quadMinted array and the total land already minted\\n */\\n function _checkAndClearOwner(\\n Land memory land,\\n Land[] memory quadMinted,\\n uint256 landMinted,\\n uint256 index,\\n uint256 quadCompareSize\\n ) internal returns (uint256, uint256) {\\n (uint256 layer, , ) = _getQuadLayer(quadCompareSize);\\n uint256 toX = land.x + land.size;\\n uint256 toY = land.y + land.size;\\n\\n //Lopping around the Quad in land struct to check if the child quad are minted or not\\n for (uint256 xi = land.x; xi < toX; xi += quadCompareSize) {\\n for (uint256 yi = land.y; yi < toY; yi += quadCompareSize) {\\n //checking if the child Quad is minted or not. i.e Checks if the quad is in the quadMinted array.\\n bool isQuadChecked = _isQuadMinted(quadMinted, Land({x: xi, y: yi, size: quadCompareSize}), index);\\n // if child quad is not already in the quadMinted array.\\n if (!isQuadChecked) {\\n uint256 id = _getQuadId(layer, xi, yi);\\n address owner = address(uint160(_owners[id]));\\n // owner of the child quad is checked to be owned by msg.sender else should not be owned by anyone.\\n if (owner == msg.sender) {\\n // if child quad is minted it would be pushed in quadMinted array.\\n quadMinted[index] = Land({x: xi, y: yi, size: quadCompareSize});\\n // index of quadMinted is increased\\n index++;\\n // total land minted is increase by the number if land of 1x1 in child quad\\n landMinted += quadCompareSize * quadCompareSize;\\n //owner is cleared\\n _owners[id] = 0;\\n } else {\\n require(owner == address(0), \\\"Already minted\\\");\\n }\\n }\\n }\\n }\\n\\n // size of the child quad is set to be the next smaller child quad size (12 => 6 => 3)\\n quadCompareSize = quadCompareSize / 2;\\n // if child quad size is greater than 3 _checkAndClearOwner is checked for new child quads in the quad in land struct.\\n if (quadCompareSize >= 3)\\n (index, landMinted) = _checkAndClearOwner(land, quadMinted, landMinted, index, quadCompareSize);\\n return (index, landMinted);\\n }\\n\\n /// @dev checks the owner of land with 'tokenId' to be 'from' and clears it\\n /// @param from the address to be checked agains the owner of the land\\n /// @param tokenId th id of land\\n /// @return bool for if land is owned by 'from' or not.\\n function _checkAndClearLandOwner(address from, uint256 tokenId) internal returns (bool) {\\n uint256 currentOwner = _owners[tokenId];\\n if (currentOwner != 0) {\\n require((currentOwner & BURNED_FLAG) != BURNED_FLAG, \\\"not owner\\\");\\n require(address(uint160(currentOwner)) == from, \\\"not owner\\\");\\n _owners[tokenId] = 0;\\n return true;\\n }\\n return false;\\n }\\n\\n function _checkBatchReceiverAcceptQuad(\\n address operator,\\n address from,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes memory data\\n ) internal {\\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\\n uint256[] memory ids = new uint256[](size * size);\\n for (uint256 i = 0; i < size * size; i++) {\\n ids[i] = _idInPath(i, size, x, y);\\n }\\n require(_checkOnERC721BatchReceived(operator, from, to, ids, data), \\\"erc721 batch transfer rejected by to\\\");\\n }\\n }\\n\\n /// @dev checks if the receiver of the quad(size, x, y) is a contact. If yes can it handle ERC721 tokens. It also clears owner of 1x1 land's owned by msg.sender.\\n /// @param quadMinted - an array of Land structs in which the minted child quad or Quad to be transfered are.\\n /// @param landMinted - the total amount of land that has been minted\\n /// @param index - the index of the last element in the quadMinted array\\n /// @param to the address of the new owner of Quad to be transfered\\n /// @param size The size of the quad being minted and transfered\\n /// @param x The x-coordinate of the top-left corner of the quad being minted.\\n /// @param y The y-coordinate of the top-left corner of the quad being minted.\\n /// @param y The y-coordinate of the top-left corner of the quad being minted.\\n function _checkBatchReceiverAcceptQuadAndClearOwner(\\n Land[] memory quadMinted,\\n uint256 index,\\n uint256 landMinted,\\n address to,\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n bytes memory data\\n ) internal {\\n // checks if to is a contract and supports ERC721_MANDATORY_RECEIVER interfaces. if it doesn't it just clears the owner of 1x1 lands in quad(size, x, y)\\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\\n // array to push minted 1x1 land\\n uint256[] memory idsToTransfer = new uint256[](landMinted);\\n // index of last land pushed in idsToTransfer array\\n uint256 transferIndex;\\n // array to push ids to be minted\\n uint256[] memory idsToMint = new uint256[]((size * size) - landMinted);\\n // index of last land pushed in idsToMint array\\n uint256 mintIndex;\\n\\n // iterating over every 1x1 land in the quad to be pushed in the above arrays\\n for (uint256 i = 0; i < size * size; i++) {\\n uint256 id = _idInPath(i, size, x, y);\\n\\n if (_isQuadMinted(quadMinted, Land({x: _getX(id), y: _getY(id), size: 1}), index)) {\\n // if land is in the quads already minted it just pushed in to the idsToTransfer array\\n idsToTransfer[transferIndex] = id;\\n transferIndex++;\\n } else if (address(uint160(_owners[id])) == msg.sender) {\\n // if it is owned by the msg.sender owner data is removed and it is pused in to idsToTransfer array\\n _owners[id] = 0;\\n idsToTransfer[transferIndex] = id;\\n transferIndex++;\\n } else {\\n // else it is not owned by any one and and pushed in teh idsToMint array\\n idsToMint[mintIndex] = id;\\n mintIndex++;\\n }\\n }\\n\\n // checking if \\\"to\\\" contact can handle ERC721 tokens\\n require(\\n _checkOnERC721BatchReceived(msg.sender, address(0), to, idsToMint, data),\\n \\\"erc721 batch transfer rejected by to\\\"\\n );\\n require(\\n _checkOnERC721BatchReceived(msg.sender, msg.sender, to, idsToTransfer, data),\\n \\\"erc721 batch transfer rejected by to\\\"\\n );\\n } else {\\n for (uint256 i = 0; i < size * size; i++) {\\n uint256 id = _idInPath(i, size, x, y);\\n if (address(uint160(_owners[id])) == msg.sender) _owners[id] = 0;\\n }\\n }\\n }\\n\\n function _getX(uint256 id) internal pure returns (uint256) {\\n return (id & ~LAYER) % GRID_SIZE;\\n }\\n\\n function _getY(uint256 id) internal pure returns (uint256) {\\n return (id & ~LAYER) / GRID_SIZE;\\n }\\n\\n function _isQuadMinted(\\n Land[] memory mintedLand,\\n Land memory quad,\\n uint256 index\\n ) internal pure returns (bool) {\\n for (uint256 i = 0; i < index; i++) {\\n Land memory land = mintedLand[i];\\n if (\\n land.size > quad.size &&\\n quad.x >= land.x &&\\n quad.x < land.x + land.size &&\\n quad.y >= land.y &&\\n quad.y < land.y + land.size\\n ) {\\n return true;\\n }\\n }\\n return false;\\n }\\n\\n function _getQuadLayer(uint256 size)\\n internal\\n pure\\n returns (\\n uint256 layer,\\n uint256 parentSize,\\n uint256 childLayer\\n )\\n {\\n if (size == 1) {\\n layer = LAYER_1x1;\\n parentSize = 3;\\n } else if (size == 3) {\\n layer = LAYER_3x3;\\n parentSize = 6;\\n } else if (size == 6) {\\n layer = LAYER_6x6;\\n parentSize = 12;\\n childLayer = LAYER_3x3;\\n } else if (size == 12) {\\n layer = LAYER_12x12;\\n parentSize = 24;\\n childLayer = LAYER_6x6;\\n } else if (size == 24) {\\n layer = LAYER_24x24;\\n childLayer = LAYER_12x12;\\n } else {\\n require(false, \\\"Invalid size\\\");\\n }\\n }\\n\\n function _getQuadId(\\n uint256 layer,\\n uint256 x,\\n uint256 y\\n ) internal pure returns (uint256) {\\n return layer + x + y * GRID_SIZE;\\n }\\n\\n function _checkOwner(\\n uint256 size,\\n uint256 x,\\n uint256 y,\\n uint256 quadCompareSize\\n ) internal view {\\n (uint256 layer, , ) = _getQuadLayer(quadCompareSize);\\n\\n if (size <= quadCompareSize) {\\n // when the size of the quad is smaller than the quadCompareSize(size to be compared with),\\n // then it is checked if the bigger quad which encapsulates the quad to be minted\\n // of with size equals the quadCompareSize has been minted or not\\n require(\\n _owners[\\n _getQuadId(layer, (x / quadCompareSize) * quadCompareSize, (y / quadCompareSize) * quadCompareSize)\\n ] == 0,\\n \\\"Already minted\\\"\\n );\\n } else {\\n // when the size is smaller than the quadCompare size the owner of all the smaller quads with size\\n // quadCompare size in the quad to be minted are checked if they are minted or not\\n uint256 toX = x + size;\\n uint256 toY = y + size;\\n for (uint256 xi = x; xi < toX; xi += quadCompareSize) {\\n for (uint256 yi = y; yi < toY; yi += quadCompareSize) {\\n require(_owners[_getQuadId(layer, xi, yi)] == 0, \\\"Already minted\\\");\\n }\\n }\\n }\\n\\n quadCompareSize = quadCompareSize / 2;\\n if (quadCompareSize >= 3) _checkOwner(size, x, y, quadCompareSize);\\n }\\n\\n function _idInPath(\\n uint256 i,\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) internal pure returns (uint256) {\\n uint256 row = i / size;\\n if (row % 2 == 0) {\\n // allow ids to follow a path in a quad\\n return _getQuadId(LAYER_1x1, (x + (i % size)), (y + row));\\n } else {\\n return _getQuadId(LAYER_1x1, (x + size) - (1 + (i % size)), (y + row));\\n }\\n }\\n\\n /// @dev checks if the Land's child quads are owned by the from address and clears all the previous owners\\n /// if all the child quads are not owned by the \\\"from\\\" address then the owner of parent quad to the land\\n /// is checked if owned by the \\\"from\\\" address. If from is the owner then land owner is set to \\\"to\\\" address\\n /// @param from address of the previous owner\\n /// @param to address of the new owner\\n /// @param land the quad to be regrouped and transferred\\n /// @param set for setting the new owner\\n /// @param childQuadSize size of the child quad to be checked for owner in the regrouping\\n function _regroupQuad(\\n address from,\\n address to,\\n Land memory land,\\n bool set,\\n uint256 childQuadSize\\n ) internal returns (bool) {\\n (uint256 layer, , uint256 childLayer) = _getQuadLayer(land.size);\\n uint256 quadId = _getQuadId(layer, land.x, land.y);\\n bool ownerOfAll = true;\\n\\n {\\n // double for loop iterates and checks owner of all the smaller quads in land\\n for (uint256 xi = land.x; xi < land.x + land.size; xi += childQuadSize) {\\n for (uint256 yi = land.y; yi < land.y + land.size; yi += childQuadSize) {\\n uint256 ownerChild;\\n bool ownAllIndividual;\\n if (childQuadSize < 3) {\\n // case when the smaller quad is 1x1,\\n ownAllIndividual = _checkAndClearLandOwner(from, _getQuadId(LAYER_1x1, xi, yi)) && ownerOfAll;\\n } else {\\n // recursively calling the _regroupQuad function to check the owner of child quads.\\n ownAllIndividual = _regroupQuad(\\n from,\\n to,\\n Land({x: xi, y: yi, size: childQuadSize}),\\n false,\\n childQuadSize / 2\\n );\\n uint256 idChild = _getQuadId(childLayer, xi, yi);\\n ownerChild = _owners[idChild];\\n if (ownerChild != 0) {\\n // checking the owner of child quad\\n if (!ownAllIndividual) {\\n require(ownerChild == uint256(uint160(from)), \\\"not owner of child Quad\\\");\\n }\\n // clearing owner of child quad\\n _owners[idChild] = 0;\\n }\\n }\\n // ownerOfAll should be true if \\\"from\\\" is owner of all the child quads itereated over\\n ownerOfAll = (ownAllIndividual || ownerChild != 0) && ownerOfAll;\\n }\\n }\\n }\\n\\n // if set is true it check if the \\\"from\\\" is owner of all else checks for the owner of parent quad is\\n // owned by \\\"from\\\" and sets the owner for the id of land to \\\"to\\\" address.\\n if (set) {\\n if (!ownerOfAll) {\\n require(_ownerOfQuad(land.size, land.x, land.y) == from, \\\"not owner of all sub quads nor parent quads\\\");\\n }\\n _owners[quadId] = uint256(uint160(to));\\n return true;\\n }\\n\\n return ownerOfAll;\\n }\\n\\n function _ownerOfQuad(\\n uint256 size,\\n uint256 x,\\n uint256 y\\n ) internal view returns (address) {\\n (uint256 layer, uint256 parentSize, ) = _getQuadLayer(size);\\n address owner = address(uint160(_owners[_getQuadId(layer, (x / size) * size, (y / size) * size)]));\\n if (owner != address(0)) {\\n return owner;\\n } else if (size < 24) {\\n return _ownerOfQuad(parentSize, x, y);\\n }\\n return address(0);\\n }\\n\\n function _getQuadById(uint256 id)\\n internal\\n pure\\n returns (\\n uint256 size,\\n uint256 x,\\n uint256 y\\n )\\n {\\n x = _getX(id);\\n y = _getY(id);\\n uint256 layer = id & LAYER;\\n if (layer == LAYER_1x1) {\\n size = 1;\\n } else if (layer == LAYER_3x3) {\\n size = 3;\\n } else if (layer == LAYER_6x6) {\\n size = 6;\\n } else if (layer == LAYER_12x12) {\\n size = 12;\\n } else if (layer == LAYER_24x24) {\\n size = 24;\\n } else {\\n require(false, \\\"Invalid token id\\\");\\n }\\n }\\n\\n function _ownerOf(uint256 id) internal view override returns (address) {\\n require(id & LAYER == 0, \\\"Invalid token id\\\");\\n (uint256 size, uint256 x, uint256 y) = _getQuadById(id);\\n require(x % size == 0, \\\"x coordinate: Invalid token id\\\");\\n require(y % size == 0, \\\"y coordinate: Invalid token id\\\");\\n if (size == 1) {\\n uint256 owner1x1 = _owners[id];\\n return (owner1x1 & BURNED_FLAG) == BURNED_FLAG ? address(0) : _ownerOfQuad(size, x, y);\\n }\\n return _ownerOfQuad(size, x, y);\\n }\\n\\n function _ownerAndOperatorEnabledOf(uint256 id)\\n internal\\n view\\n override\\n returns (address owner, bool operatorEnabled)\\n {\\n require(id & LAYER == 0, \\\"Invalid token id\\\");\\n uint256 x = id % GRID_SIZE;\\n uint256 y = id / GRID_SIZE;\\n uint256 owner1x1 = _owners[id];\\n\\n if ((owner1x1 & BURNED_FLAG) == BURNED_FLAG) {\\n owner = address(0);\\n operatorEnabled = (owner1x1 & OPERATOR_FLAG) == OPERATOR_FLAG;\\n return (owner, operatorEnabled);\\n }\\n\\n if (owner1x1 != 0) {\\n owner = address(uint160(owner1x1));\\n operatorEnabled = (owner1x1 & OPERATOR_FLAG) == OPERATOR_FLAG;\\n } else {\\n owner = _ownerOfQuad(3, (x * 3) / 3, (y * 3) / 3);\\n operatorEnabled = false;\\n }\\n }\\n\\n // Empty storage space in contracts for future enhancements\\n // ref: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/issues/13)\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x1bf685dad5d80a36d1a31631749112b1c2d2e1037bedf7fb3f815ed2fa506158\",\"license\":\"MIT\"},\"src/solc_0.8/polygon/child/land/PolygonLandV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.2;\\n\\nimport \\\"./PolygonLandBaseTokenV2.sol\\\";\\nimport \\\"../../../common/BaseWithStorage/ERC2771Handler.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../../OperatorFilterer/contracts/upgradeable/OperatorFiltererUpgradeable.sol\\\";\\n\\n/// @title LAND token on L2\\ncontract PolygonLandV2 is PolygonLandBaseTokenV2, ERC2771Handler, OperatorFiltererUpgradeable {\\n using AddressUpgradeable for address;\\n\\n event OperatorRegistrySet(address indexed registry);\\n\\n function initialize(address trustedForwarder) external initializer {\\n _admin = _msgSender();\\n __ERC2771Handler_initialize(trustedForwarder);\\n emit AdminChanged(address(0), _admin);\\n }\\n\\n /// @dev Change the address of the trusted forwarder for meta-TX\\n /// @param trustedForwarder The new trustedForwarder\\n function setTrustedForwarder(address trustedForwarder) external onlyAdmin {\\n _trustedForwarder = trustedForwarder;\\n emit TrustedForwarderSet(trustedForwarder);\\n }\\n\\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address) {\\n return ERC2771Handler._msgSender();\\n }\\n\\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\\n return ERC2771Handler._msgData();\\n }\\n\\n /**\\n * @notice Approve an operator to spend tokens on the sender behalf\\n * @param sender The address giving the approval\\n * @param operator The address receiving the approval\\n * @param id The id of the token\\n */\\n function approveFor(\\n address sender,\\n address operator,\\n uint256 id\\n ) public override onlyAllowedOperatorApproval(operator) {\\n super.approveFor(sender, operator, id);\\n }\\n\\n /**\\n * @notice Approve an operator to spend tokens on the sender behalf\\n * @param operator The address receiving the approval\\n * @param id The id of the token\\n */\\n function approve(address operator, uint256 id) public override onlyAllowedOperatorApproval(operator) {\\n super.approve(operator, id);\\n }\\n\\n /**\\n * @notice Transfer a token between 2 addresses\\n * @param from The sender of the token\\n * @param to The recipient of the token\\n * @param id The id of the token\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 id\\n ) public override onlyAllowedOperator(from) {\\n super.transferFrom(from, to, id);\\n }\\n\\n /**\\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\\n * @param from The sender of the token\\n * @param to The recipient of the token\\n * @param id The id of the token\\n * @param data Additional data\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n bytes memory data\\n ) public override onlyAllowedOperator(from) {\\n super.safeTransferFrom(from, to, id, data);\\n }\\n\\n /**\\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\\n * @param from The send of the token\\n * @param to The recipient of the token\\n * @param id The id of the token\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id\\n ) public override onlyAllowedOperator(from) {\\n super.safeTransferFrom(from, to, id);\\n }\\n\\n /**\\n * @notice Set the approval for an operator to manage all the tokens of the sender\\n * @param operator The address receiving the approval\\n * @param approved The determination of the approval\\n */\\n function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {\\n super.setApprovalForAll(operator, approved);\\n }\\n\\n /**\\n * @notice Set the approval for an operator to manage all the tokens of the sender\\n * @param sender The address giving the approval\\n * @param operator The address receiving the approval\\n * @param approved The determination of the approval\\n */\\n function setApprovalForAllFor(\\n address sender,\\n address operator,\\n bool approved\\n ) public override onlyAllowedOperatorApproval(operator) {\\n super.setApprovalForAllFor(sender, operator, approved);\\n }\\n\\n /// @notice This function is used to register Land contract on the Operator Filterer Registry of Opensea.\\n /// @dev can only be called by admin.\\n /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe.\\n /// @param subscribe bool to signify subscription 'true' or to copy the list 'false'.\\n function register(address subscriptionOrRegistrantToCopy, bool subscribe) external onlyAdmin {\\n require(subscriptionOrRegistrantToCopy != address(0), \\\"PolygonLandV2: subscription can't be zero address\\\");\\n _register(subscriptionOrRegistrantToCopy, subscribe);\\n }\\n\\n /// @notice sets filter registry address deployed in test\\n /// @param registry the address of the registry\\n function setOperatorRegistry(address registry) external virtual onlyAdmin {\\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\\n emit OperatorRegistrySet(registry);\\n }\\n}\\n\",\"keccak256\":\"0xce01a42936227ae0ec64f3663580ef0985fc666d4205246334393b9f885a9ae1\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50615e9c80620000216000396000f3fe608060405234801561001057600080fd5b50600436106102d35760003560e01c806379cc679011610186578063ac9fe421116100e3578063ce1b815f11610097578063e985e9c511610071578063e985e9c51461062a578063eaa5e0671461063d578063eeb5a5d114610650576102d3565b8063ce1b815f146105f3578063cf456ae714610604578063da74222814610617576102d3565b8063b88d4fde116100c8578063b88d4fde146105ba578063c4d66de8146105cd578063c87b56dd146105e0576102d3565b8063ac9fe42114610594578063b0ccc31e146105a7576102d3565b80639d28fb861161013a578063a22cb4651161011f578063a22cb46514610542578063aa271e1a14610555578063ab01b46914610581576102d3565b80639d28fb861461052f5780639ededf7714610355576102d3565b80638e5cb5f61161016b5780638e5cb5f6146104d05780638f283970146104e357806395d89b41146104f6576102d3565b806379cc6790146104aa578063845a4697146104bd576102d3565b806342842e0e116102345780636352211e116101e85780636e1e3bbf116101cd5780636e1e3bbf146104735780636e9960c31461048657806370a0823114610497576102d3565b80636352211e14610434578063654b748a14610447576102d3565b80634e6a0f44116102195780634e6a0f44146103ec57806355064d85146103ff578063572b6c0514610412576102d3565b806342842e0e146103c657806342966c68146103d9576102d3565b806315ddc5351161028b57806328cfbd461161027057806328cfbd461461038d5780632b991746146103a057806338bb305a146103b3576102d3565b806315ddc5351461036757806323b872dd1461037a576102d3565b8063081812fc116102bc578063081812fc14610315578063095ea7b3146103405780630ef2674314610355576102d3565b806301ffc9a7146102d857806306fdde0314610300575b600080fd5b6102eb6102e6366004615b5f565b610663565b60405190151581526020015b60405180910390f35b610308610702565b6040516102f79190615d19565b610328610323366004615b97565b61073a565b6040516001600160a01b0390911681526020016102f7565b61035361034e366004615a54565b6107d9565b005b6101985b6040519081526020016102f7565b610353610375366004615829565b6108c2565b6103536103883660046158fd565b6108d8565b61035361039b366004615829565b610a09565b6103536103ae3660046158fd565b610a7e565b6103536103c136600461599e565b610b63565b6103536103d43660046158fd565b610dbb565b6103536103e7366004615b97565b610ee1565b6103536103fa366004615a7d565b610efe565b6102eb61040d366004615baf565b6110c5565b6102eb6104203660046156fa565b606b546001600160a01b0390811691161490565b610328610442366004615b97565b6110f4565b6102eb6104553660046156fa565b6001600160a01b031660009081526034602052604090205460ff1690565b610353610481366004615ada565b611157565b6033546001600160a01b0316610328565b6103596104a53660046156fa565b6111cd565b6103536104b8366004615a54565b611241565b6103596104cb366004615b97565b61139e565b6103596104de366004615b97565b6113a9565b6103536104f13660046156fa565b6113b4565b60408051808201909152600481527f4c414e44000000000000000000000000000000000000000000000000000000006020820152610308565b61035361053d3660046156fa565b61148f565b610353610550366004615a1e565b61153d565b6102eb6105633660046156fa565b6001600160a01b031660009081526039602052604090205460ff1690565b61035361058f366004615a1e565b611621565b6103536105a2366004615a1e565b611702565b606c54610328906001600160a01b031681565b6103536105c8366004615938565b61183d565b6103536105db3660046156fa565b61196a565b6103086105ee366004615b97565b611ab3565b606b546001600160a01b0316610328565b610353610612366004615a1e565b611b46565b6103536106253660046156fa565b611c53565b6102eb610638366004615714565b611d01565b61035361064b366004615746565b611d58565b61035361065e3660046158b7565b612337565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b0319831614806106c657507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b806106fa57507f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b90505b919050565b60408051808201909152600f81527f53616e64626f782773204c414e4473000000000000000000000000000000000060208201525b90565b60008060006107488461241c565b90925090506001600160a01b0382166107a85760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e00000000000000000000000000000060448201526064015b60405180910390fd5b80156107ce575050506000818152603860205260409020546001600160a01b03166106fd565b6000925050506106fd565b606c5482906001600160a01b03163b156108b357606c54604051633185c44d60e21b81523060048201526001600160a01b0383811660248301529091169063c61711349060440160206040518083038186803b15801561083857600080fd5b505afa15801561084c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108709190615b43565b6108b35760405162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015260640161079f565b6108bd8383612542565b505050565b6108d086868686868661267e565b505050505050565b606c5483906001600160a01b03163b156109f8576108f46126f0565b6001600160a01b0316816001600160a01b0316141561091d576109188484846126ff565b610a03565b606c546001600160a01b031663c6171134306109376126f0565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260440160206040518083038186803b15801561097d57600080fd5b505afa158015610991573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b59190615b43565b6109f85760405162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015260640161079f565b610a038484846126ff565b50505050565b6108d0868686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8a018190048102820181019092528881529250889150879081908401838280828437600092019190915250600192506127ae915050565b606c5482906001600160a01b03163b15610b5857606c54604051633185c44d60e21b81523060048201526001600160a01b0383811660248301529091169063c61711349060440160206040518083038186803b158015610add57600080fd5b505afa158015610af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b159190615b43565b610b585760405162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015260640161079f565b610a03848484612c11565b6001600160a01b038716610bb95760405162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f2061646472657373000000000000000000000000604482015260640161079f565b6001600160a01b038616610c0f5760405162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015260640161079f565b866001600160a01b0316610c216126f0565b6001600160a01b031614610ce9576001600160a01b038716600090815260376020526040812090610c506126f0565b6001600160a01b0316815260208101919091526040016000205460ff1680610c9d575060346000610c7f6126f0565b6001600160a01b0316815260208101919091526040016000205460ff165b610ce95760405162461bcd60e51b815260206004820152601e60248201527f6e6f7420617574686f72697a656420746f207472616e73666572517561640000604482015260640161079f565b610cf68787878787612e04565b610d008580615d58565b6001600160a01b03881660009081526035602052604081208054909190610d28908490615d77565b90915550610d3890508580615d58565b6001600160a01b03871660009081526035602052604081208054909190610d60908490615d2c565b90915550610db29050610d716126f0565b888888888888888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612fb492505050565b50505050505050565b606c5483906001600160a01b03163b15610ed657610dd76126f0565b6001600160a01b0316816001600160a01b03161415610dfb576109188484846130ff565b606c546001600160a01b031663c617113430610e156126f0565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260440160206040518083038186803b158015610e5b57600080fd5b505afa158015610e6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e939190615b43565b610ed65760405162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015260640161079f565b610a038484846130ff565b610efb610eec6126f0565b610ef58361311a565b836132a6565b50565b3360009081526039602052604090205460ff16610f5d5760405162461bcd60e51b815260206004820152600b60248201527f21415554484f52495a4544000000000000000000000000000000000000000000604482015260640161079f565b6001600160a01b038616610fb35760405162461bcd60e51b815260206004820152601260248201527f746f206973207a65726f20616464726573730000000000000000000000000000604482015260640161079f565b610fbe8585856110c5565b1561108257610fd03387878787612e04565b610fda8580615d58565b3360009081526035602052604081208054909190610ff9908490615d77565b9091555061100990508580615d58565b6001600160a01b03871660009081526035602052604081208054909190611031908490615d2c565b9250508190555061107d33338888888888888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612fb492505050565b6108d0565b6108d08686868686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061339d92505050565b60006110d28484846136d0565b60006110df8585856138b0565b6001600160a01b0316141590505b9392505050565b60006110ff8261311a565b90506001600160a01b0381166106fd5760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354414e545f544f4b454e000000000000000000000000000000604482015260640161079f565b6111628484846136d0565b61116d6105636126f0565b6111b95760405162461bcd60e51b815260206004820152600b60248201527f21415554484f52495a4544000000000000000000000000000000000000000000604482015260640161079f565b6111c68585858585613953565b5050505050565b60006001600160a01b0382166112255760405162461bcd60e51b815260206004820152601260248201527f5a45524f5f414444524553535f4f574e45520000000000000000000000000000604482015260640161079f565b506001600160a01b031660009081526035602052604090205490565b6001600160a01b0382166112975760405162461bcd60e51b815260206004820152601460248201527f4e4f545f46524f4d5f5a45524f41444452455353000000000000000000000000604482015260640161079f565b6000806112a38361241c565b9150915060006112b16126f0565b9050846001600160a01b0316816001600160a01b031614806112f457508180156112f457506000848152603860205260409020546001600160a01b038281169116145b8061131757506001600160a01b03811660009081526034602052604090205460ff165b8061134757506001600160a01b0380861660009081526037602090815260408083209385168352929052205460ff165b6113935760405162461bcd60e51b815260206004820152601160248201527f554e415554484f52495a45445f4255524e000000000000000000000000000000604482015260640161079f565b6111c68584866132a6565b60006106fa82613af4565b60006106fa82613b23565b6033546001600160a01b0316806113c96126f0565b6001600160a01b03161461141f5760405162461bcd60e51b815260206004820152601360248201527f41444d494e5f4143434553535f44454e49454400000000000000000000000000604482015260640161079f565b816001600160a01b0316816001600160a01b03167f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f60405160405180910390a3506033805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6033546001600160a01b03166114a36126f0565b6001600160a01b0316146114e65760405162461bcd60e51b815260206004820152600a60248201526941444d494e5f4f4e4c5960b01b604482015260640161079f565b606c805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517fc6df119c56c99171b170652a3c4750ba46dcaacbdb3b7ab4847a9fa339659bd490600090a250565b606c5482906001600160a01b03163b1561161757606c54604051633185c44d60e21b81523060048201526001600160a01b0383811660248301529091169063c61711349060440160206040518083038186803b15801561159c57600080fd5b505afa1580156115b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d49190615b43565b6116175760405162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015260640161079f565b6108bd8383613b52565b6033546001600160a01b03166116356126f0565b6001600160a01b0316146116785760405162461bcd60e51b815260206004820152600a60248201526941444d494e5f4f4e4c5960b01b604482015260640161079f565b6001600160a01b0382166116f45760405162461bcd60e51b815260206004820152603160248201527f506f6c79676f6e4c616e6456323a20737562736372697074696f6e2063616e2760448201527f74206265207a65726f2061646472657373000000000000000000000000000000606482015260840161079f565b6116fe8282613b64565b5050565b6033546001600160a01b03166117166126f0565b6001600160a01b0316146117595760405162461bcd60e51b815260206004820152600a60248201526941444d494e5f4f4e4c5960b01b604482015260640161079f565b6033546001600160a01b031661176d6126f0565b6001600160a01b0316146117e95760405162461bcd60e51b815260206004820152602c60248201527f6f6e6c792061646d696e20697320616c6c6f77656420746f206164642073757060448201527f6572206f70657261746f72730000000000000000000000000000000000000000606482015260840161079f565b6001600160a01b038216600081815260346020526040808220805460ff191685151590811790915590519092917f44f92d27abdf4cfb6a7d712c3af68f3be086d4ca747ab802c36f67d6790060d891a35050565b606c5484906001600160a01b03163b1561195e576118596126f0565b6001600160a01b0316816001600160a01b031614156118835761187e85858585613dae565b6111c6565b606c546001600160a01b031663c61711343061189d6126f0565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260440160206040518083038186803b1580156118e357600080fd5b505afa1580156118f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191b9190615b43565b61195e5760405162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015260640161079f565b6111c685858585613dae565b600054610100900460ff166119855760005460ff1615611989565b303b155b6119fb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161079f565b600054610100900460ff16158015611a26576000805460ff1961ff0019909116610100171660011790555b611a2e6126f0565b6033805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055611a6482613e34565b6033546040516001600160a01b03909116906000907f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f908290a380156116fe576000805461ff00191690555050565b60606000611ac08361311a565b6001600160a01b03161415611b175760405162461bcd60e51b815260206004820152601160248201527f496420646f6573206e6f74206578697374000000000000000000000000000000604482015260640161079f565b611b2082613e91565b604051602001611b309190615c06565b6040516020818303038152906040529050919050565b6033546001600160a01b0316611b5a6126f0565b6001600160a01b031614611b9d5760405162461bcd60e51b815260206004820152600a60248201526941444d494e5f4f4e4c5960b01b604482015260640161079f565b6001600160a01b038216611bf35760405162461bcd60e51b815260206004820152601c60248201527f506f6c79676f6e4c616e643a20496e76616c6964206164647265737300000000604482015260640161079f565b6001600160a01b038216600081815260396020908152604091829020805460ff191685151590811790915591519182527fff452b3b9159b024a9098f0058c63eccd90d36b3584608202800d662f962bb6091015b60405180910390a25050565b6033546001600160a01b0316611c676126f0565b6001600160a01b031614611caa5760405162461bcd60e51b815260206004820152600a60248201526941444d494e5f4f4e4c5960b01b604482015260640161079f565b606b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517fd91237492a9e30cd2faf361fc103998a382ff0ec2b1b07dc1cbebb76ae2f1ea290600090a250565b6001600160a01b03808316600090815260376020908152604080832093851683529290529081205460ff1680611d4f57506001600160a01b03821660009081526034602052604090205460ff165b90505b92915050565b6001600160a01b038a16611dae5760405162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f2061646472657373000000000000000000000000604482015260640161079f565b6001600160a01b038916611e045760405162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015260640161079f565b868514611e795760405162461bcd60e51b815260206004820152603c60248201527f506f6c79676f6e4c616e6442617365546f6b656e56323a2073697a657327732060448201527f616e6420782773206c656e6774682061726520646966666572656e7400000000606482015260840161079f565b848314611eee5760405162461bcd60e51b815260206004820152603860248201527f506f6c79676f6e4c616e6442617365546f6b656e56323a2078277320616e642060448201527f792773206c656e6774682061726520646966666572656e740000000000000000606482015260840161079f565b896001600160a01b0316611f006126f0565b6001600160a01b031614611fed576001600160a01b038a16600090815260376020526040812090611f2f6126f0565b6001600160a01b0316815260208101919091526040016000205460ff1680611f7c575060346000611f5e6126f0565b6001600160a01b0316815260208101919091526040016000205460ff165b611fed5760405162461bcd60e51b8152602060048201526024808201527f6e6f7420617574686f72697a656420746f207472616e736665724d756c74695160448201527f7561647300000000000000000000000000000000000000000000000000000000606482015260840161079f565b6000805b888110156120a75760008a8a8381811061201b57634e487b7160e01b600052603260045260246000fd5b90506020020135905061207d8d8d838c8c8781811061204a57634e487b7160e01b600052603260045260246000fd5b905060200201358b8b8881811061207157634e487b7160e01b600052603260045260246000fd5b90506020020135612e04565b6120878180615d58565b6120919084615d2c565b925050808061209f90615dd1565b915050611ff1565b506001600160a01b038b16600090815260356020526040812080548392906120d0908490615d77565b90915550506001600160a01b038a16600090815260356020526040812080548392906120fd908490615d2c565b90915550506001600160a01b038a163b1515801561212757506121278a6317a2fd9160e21b613fe8565b1561232a5760008167ffffffffffffffff81111561215557634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561217e578160200160208202803683370190505b5090506000805b8a8110156122845760008c8c838181106121af57634e487b7160e01b600052603260045260246000fd5b90506020020135905060005b6121c58280615d58565b81101561226f5761222481838e8e878181106121f157634e487b7160e01b600052603260045260246000fd5b905060200201358d8d8881811061221857634e487b7160e01b600052603260045260246000fd5b905060200201356140af565b85858151811061224457634e487b7160e01b600052603260045260246000fd5b60209081029190910101528361225981615dd1565b945050808061226790615dd1565b9150506121bb565b5050808061227c90615dd1565b915050612185565b506122cf6122906126f0565b8e8e8589898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061412692505050565b6123275760405162461bcd60e51b8152602060048201526024808201527f657263373231206261746368207472616e736665722072656a656374656420626044820152637920746f60e01b606482015260840161079f565b50505b5050505050505050505050565b606c5482906001600160a01b03163b1561241157606c54604051633185c44d60e21b81523060048201526001600160a01b0383811660248301529091169063c61711349060440160206040518083038186803b15801561239657600080fd5b505afa1580156123aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123ce9190615b43565b6124115760405162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015260640161079f565b610a038484846141e5565b6000807fff0000000000000000000000000000000000000000000000000000000000000083161561248f5760405162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e20696400000000000000000000000000000000604482015260640161079f565b600061249d61019885615dec565b905060006124ad61019886615d44565b600086815260366020526040902054909150600160a01b80821614156124e45760009450600160ff1b80821614935050505061253d565b80156124fd57809450600160ff1b808216149350612539565b61253260038061250d8682615d58565b6125179190615d44565b60036125238682615d58565b61252d9190615d44565b6138b0565b9450600093505b5050505b915091565b6000818152603660205260408120549061255b8361311a565b905060006125676126f0565b90506001600160a01b0382166125bf5760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e000000000000000000000000000000604482015260640161079f565b806001600160a01b0316826001600160a01b0316148061260457506001600160a01b0380831660009081526037602090815260408083209385168352929052205460ff165b8061262757506001600160a01b03811660009081526034602052604090205460ff165b6126735760405162461bcd60e51b815260206004820152601560248201527f554e415554484f52495a45445f415050524f56414c0000000000000000000000604482015260640161079f565b6111c68386866142d6565b6108d0868686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8a018190048102820181019092528881529250889150879081908401838280828437600092018290525092506127ae915050565b60006126fa61438c565b905090565b61270a8383836143d6565b6127158383836145df565b6001600160a01b0382163b1515801561273a575061273a826317a2fd9160e21b613fe8565b156108bd5761276261274a6126f0565b8484846040518060200160405280600081525061469d565b6108bd5760405162461bcd60e51b815260206004820152601860248201527f4552433732315f5452414e534645525f52454a45435445440000000000000000604482015260640161079f565b60006127b86126f0565b90506000866001600160a01b0316826001600160a01b0316148061280157506001600160a01b0380881660009081526037602090815260408083209386168352929052205460ff165b8061282457506001600160a01b03821660009081526034602052604090205460ff165b90506001600160a01b03871661287c5760405162461bcd60e51b815260206004820152601460248201527f4e4f545f46524f4d5f5a45524f41444452455353000000000000000000000000604482015260640161079f565b6001600160a01b0386166128d25760405162461bcd60e51b815260206004820152601260248201527f4e4f545f544f5f5a45524f414444524553530000000000000000000000000000604482015260640161079f565b845160005b81811015612a6957600087828151811061290157634e487b7160e01b600052603260045260246000fd5b602002602001015190506000806129178361241c565b915091508b6001600160a01b0316826001600160a01b03161461297c5760405162461bcd60e51b815260206004820152601b60248201527f42415443485452414e5346455246524f4d5f4e4f545f4f574e45520000000000604482015260640161079f565b85806129a957508080156129a957506000838152603860205260409020546001600160a01b038881169116145b6129f55760405162461bcd60e51b815260206004820152600e60248201527f4e4f545f415554484f52495a4544000000000000000000000000000000000000604482015260640161079f565b600083815260366020526040812054612a12918591908e9061475c565b828b6001600160a01b03168d6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050508080612a6190615dd1565b9150506128d7565b50866001600160a01b0316886001600160a01b031614612ade576001600160a01b03881660009081526035602052604081208054839290612aab908490615d77565b90915550506001600160a01b03871660009081526035602052604081208054839290612ad8908490615d2c565b90915550505b6001600160a01b0387163b15612c0757612aff876317a2fd9160e21b613fe8565b15612b6257612b118389898989614126565b612b5d5760405162461bcd60e51b815260206004820152601e60248201527f4552433732315f42415443485f52454345495645445f52454a45435445440000604482015260640161079f565b612c07565b8315612c075760005b81811015612c0557612ba7848a8a8a8581518110612b9957634e487b7160e01b600052603260045260246000fd5b60200260200101518a61469d565b612bf35760405162461bcd60e51b815260206004820152601860248201527f4552433732315f52454345495645445f52454a45435445440000000000000000604482015260640161079f565b80612bfd81615dd1565b915050612b6b565b505b5050505050505050565b60008181526036602052604081205490612c2a8361311a565b90506000612c366126f0565b90506001600160a01b038616612c8e5760405162461bcd60e51b815260206004820152601360248201527f5a45524f5f414444524553535f53454e44455200000000000000000000000000604482015260640161079f565b6001600160a01b038216612ce45760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e000000000000000000000000000000604482015260640161079f565b856001600160a01b0316816001600160a01b03161480612d2957506001600160a01b0380871660009081526037602090815260408083209385168352929052205460ff165b80612d4c57506001600160a01b03811660009081526034602052604090205460ff165b612d985760405162461bcd60e51b815260206004820152601560248201527f554e415554484f52495a45445f415050524f56414c0000000000000000000000604482015260640161079f565b856001600160a01b0316836001600160a01b031614612df95760405162461bcd60e51b815260206004820152601060248201527f4f574e45525f4e4f545f53454e44455200000000000000000000000000000000604482015260640161079f565b6108d08386866142d6565b612e0f8383836136d0565b8260011415612f0c576000612e26600084846147ef565b90506000612e338261311a565b90506001600160a01b038116612e8b5760405162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f74206578697374000000000000000000000000604482015260640161079f565b866001600160a01b0316816001600160a01b031614612eec5760405162461bcd60e51b815260206004820152601a60248201527f6e6f74206f776e657220696e205f7472616e7366657251756164000000000000604482015260640161079f565b5060009081526036602052604090206001600160a01b0385169055612f42565b612f4085856040518060600160405280868152602001858152602001878152506001600288612f3b9190615d44565b614811565b505b60005b612f4f8480615d58565b8110156108d057612f62818585856140af565b856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a480612fac81615dd1565b915050612f45565b6001600160a01b0385163b15158015612fd95750612fd9856317a2fd9160e21b613fe8565b15610db2576000612fea8580615d58565b67ffffffffffffffff81111561301057634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015613039578160200160208202803683370190505b50905060005b6130498680615d58565b8110156130995761305c818787876140af565b82828151811061307c57634e487b7160e01b600052603260045260246000fd5b60209081029190910101528061309181615dd1565b91505061303f565b506130a78888888486614126565b612c075760405162461bcd60e51b8152602060048201526024808201527f657263373231206261746368207472616e736665722072656a656374656420626044820152637920746f60e01b606482015260840161079f565b6108bd8383836040518060200160405280600081525061183d565b60007fff0000000000000000000000000000000000000000000000000000000000000082161561318c5760405162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e20696400000000000000000000000000000000604482015260640161079f565b600080600061319a85614a90565b919450925090506131ab8383615dec565b156131f85760405162461bcd60e51b815260206004820152601e60248201527f7820636f6f7264696e6174653a20496e76616c696420746f6b656e2069640000604482015260640161079f565b6132028382615dec565b1561324f5760405162461bcd60e51b815260206004820152601e60248201527f7920636f6f7264696e6174653a20496e76616c696420746f6b656e2069640000604482015260640161079f565b826001141561329257600085815260366020526040902054600160a01b808216146132845761327f8484846138b0565b613287565b60005b9450505050506106fd565b61329d8383836138b0565b95945050505050565b816001600160a01b0316836001600160a01b0316146133075760405162461bcd60e51b815260206004820152600960248201527f4e4f545f4f574e45520000000000000000000000000000000000000000000000604482015260640161079f565b80600160a01b61331c6001600160ff1b615d77565b6000838152603660209081526040808320805494909416949094179092556001600160a01b0387168152603590915290812080549161335a83615dba565b909155505060405182906000906001600160a01b038716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a450505050565b60006133a885614b9c565b5050905060006133b98286866147ef565b604080518181526108208101825291925060009190816020015b6133f760405180606001604052806000815260200160008152602001600081525090565b8152602001906001900390816133d357905050905060008060038911156134515761344b60405180606001604052808a81526020018981526020018b81525084838560028e6134469190615d44565b614c94565b90925090505b60005b61345e8a80615d58565b81101561363e576000613473828c8c8c6140af565b905060006134ad86604051806060016040528061348f86613b23565b815260200161349d86613af4565b8152602001600181525087614e74565b905080156134f25760405182906001600160a01b038f169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90600090a4613629565b6000828152603660205260409020546001600160a01b03163314156135a3576000828152603860205260409020546001600160a01b031615613558576000828152603860205260409020805473ffffffffffffffffffffffffffffffffffffffff191690555b613563600185615d2c565b60405190945082906001600160a01b038f169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90600090a4613629565b600082815260366020526040902054156135f05760405162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015260640161079f565b60405182906001600160a01b038f16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45b5050808061363690615dd1565b915050613454565b5061364f8383838d8d8d8d8d614f45565b60008481526036602052604090206001600160a01b038b1690556136738980615d58565b6001600160a01b038b166000908152603560205260408120805490919061369b908490615d2c565b909155505033600090815260356020526040812080548392906136bf908490615d77565b909155505050505050505050505050565b82600114806136df5750826003145b806136ea5750826006145b806136f5575082600c145b806137005750826018145b61374c5760405162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a650000000000000000000000000000000000000000604482015260640161079f565b6137568383615dec565b156137a35760405162461bcd60e51b815260206004820152601460248201527f496e76616c6964207820636f6f7264696e617465000000000000000000000000604482015260640161079f565b6137ad8382615dec565b156137fa5760405162461bcd60e51b815260206004820152601460248201527f496e76616c6964207920636f6f7264696e617465000000000000000000000000604482015260640161079f565b61380683610198615d77565b8211156138555760405162461bcd60e51b815260206004820152600f60248201527f78206f7574206f6620626f756e64730000000000000000000000000000000000604482015260640161079f565b61386183610198615d77565b8111156108bd5760405162461bcd60e51b815260206004820152600f60248201527f79206f7574206f6620626f756e64730000000000000000000000000000000000604482015260640161079f565b60008060006138be86614b9c565b50909250905060006036816138fc858a6138d8818c615d44565b6138e29190615d58565b8b6138ed818c615d44565b6138f79190615d58565b6147ef565b815260208101919091526040016000205490506001600160a01b038116156139285792506110ed915050565b60188710156139465761393c8287876138b0565b93505050506110ed565b5060009695505050505050565b6001600160a01b0385166139a95760405162461bcd60e51b815260206004820152601260248201527f746f206973207a65726f20616464726573730000000000000000000000000000604482015260640161079f565b60006139b485614b9c565b5050905060006139c58286866147ef565b90506139d486868660186152a7565b60005b6139e18780615d58565b811015613a915760006139f6828989896140af565b60008181526036602052604090205490915015613a465760405162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015260640161079f565b60405181906001600160a01b038b16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45080613a8981615dd1565b9150506139d7565b5060008181526036602052604090206001600160a01b0388169055613ab68680615d58565b6001600160a01b03881660009081526035602052604081208054909190613ade908490615d2c565b90915550610db290503360008989898989612fb4565b60006106fa6101987effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8416615d44565b60006106fa6101987effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8416615dec565b6116fe613b5d6126f0565b838361540f565b606c546001600160a01b03163b15613d7157606c546040517fc3c5a5470000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b039091169063c3c5a54790602401602060405180830381600087803b158015613bd457600080fd5b505af1158015613be8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c0c9190615b43565b613d71578015613c9a57606c546040517f7d3e3dbe0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03848116602483015290911690637d3e3dbe906044015b600060405180830381600087803b158015613c7d57600080fd5b505af1158015613c91573d6000803e3d6000fd5b50505050613d71565b6001600160a01b03821615613cfa57606c546040517fa0af29030000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0384811660248301529091169063a0af290390604401613c63565b606c546040517f4420e4860000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0390911690634420e48690602401600060405180830381600087803b158015613d5857600080fd5b505af1158015613d6c573d6000803e3d6000fd5b505050505b816001600160a01b03167f3c7a9c847c035e45b84027e44ad55724873d5921b3a6abb8c0926b415d9241b182604051611c47911515815260200190565b613db98484846143d6565b613dc48484846145df565b6001600160a01b0383163b15610a0357613de8613ddf6126f0565b8585858561469d565b610a035760405162461bcd60e51b815260206004820152601860248201527f4552433732315f5452414e534645525f52454a45435445440000000000000000604482015260640161079f565b606b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383811691909117918290556040519116907fd91237492a9e30cd2faf361fc103998a382ff0ec2b1b07dc1cbebb76ae2f1ea290600090a250565b606081613ed2575060408051808201909152600181527f300000000000000000000000000000000000000000000000000000000000000060208201526106fd565b8160005b8115613efc5780613ee681615dd1565b9150613ef59050600a83615d44565b9150613ed6565b60008167ffffffffffffffff811115613f2557634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613f4f576020820181803683370190505b5090505b8415613fe057613f64600183615d77565b9150613f71600a86615dec565b613f7c906030615d2c565b60f81b818381518110613f9f57634e487b7160e01b600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350613fd9600a86615d44565b9450613f53565b949350505050565b604080516001600160e01b031983166024808301919091528251808303909101815260449091018252602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001781528251935160008082529485948594909392908183858c612710fa955080519450505050609e5a1161409b57634e487b7160e01b600052600160045260246000fd5b8280156140a55750815b9695505050505050565b6000806140bc8587615d44565b90506140c9600282615dec565b6140f8576140f060006140dc8789615dec565b6140e69087615d2c565b6138f78487615d2c565b915050613fe0565b6140f060006141078789615dec565b614112906001615d2c565b61411c8888615d2c565b6140e69190615d77565b600080846001600160a01b0316634b808c46888887876040518563ffffffff1660e01b815260040161415b9493929190615c72565b602060405180830381600087803b15801561417557600080fd5b505af1158015614189573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141ad9190615b7b565b6001600160e01b0319167f4b808c46000000000000000000000000000000000000000000000000000000001491505095945050505050565b6001600160a01b03831661423b5760405162461bcd60e51b815260206004820152601660248201527f496e76616c69642073656e646572206164647265737300000000000000000000604482015260640161079f565b60006142456126f0565b9050836001600160a01b0316816001600160a01b0316148061427f57506001600160a01b03811660009081526034602052604090205460ff165b6142cb5760405162461bcd60e51b815260206004820152601c60248201527f554e415554484f52495a45445f415050524f56455f464f525f414c4c00000000604482015260640161079f565b610a0384848461540f565b60006142e18261311a565b90506001600160a01b038316614303576142fe828583600061475c565b614345565b614310828583600161475c565b6000828152603860205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385161790555b81836001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a450505050565b606b546000906001600160a01b03163314156143cf57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c610737565b5033610737565b6000806143e28361241c565b9150915060006143f06126f0565b90506001600160a01b0383166144485760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e000000000000000000000000000000604482015260640161079f565b856001600160a01b0316836001600160a01b0316146144a95760405162461bcd60e51b815260206004820152601760248201527f434845434b5452414e534645525f4e4f545f4f574e4552000000000000000000604482015260640161079f565b6001600160a01b0385166144ff5760405162461bcd60e51b815260206004820152601260248201527f4e4f545f544f5f5a45524f414444524553530000000000000000000000000000604482015260640161079f565b826001600160a01b0316816001600160a01b0316148061453757506001600160a01b03811660009081526034602052604090205460ff165b8061456757506001600160a01b0380871660009081526037602090815260408083209385168352929052205460ff165b80614593575081801561459357506000848152603860205260409020546001600160a01b038281169116145b6108d05760405162461bcd60e51b815260206004820152601560248201527f554e415554484f52495a45445f5452414e534645520000000000000000000000604482015260640161079f565b6001600160a01b038316600090815260356020526040812080549161460383615dba565b90915550506001600160a01b038216600090815260356020526040812080549161462c83615dd1565b919050555061465781603660006146408590565b81526020019081526020016000205484600061475c565b80826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b600080846001600160a01b031663150b7a02888887876040518563ffffffff1660e01b81526004016146d29493929190615ce7565b602060405180830381600087803b1580156146ec57600080fd5b505af1158015614700573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147249190615b7b565b6001600160e01b0319167f150b7a02000000000000000000000000000000000000000000000000000000001491505095945050505050565b80156147a0576000848152603660205260409020600160ff1b6001600160a01b03841673ffffffffffffffffffffffffffffffffffffffff19861617179055610a03565b6001600160a01b0382166147b96001600160ff1b615d77565b841673ffffffffffffffffffffffffffffffffffffffff1916176036600086815260208101919091526040016000205550505050565b60006147fd61019883615d58565b6148078486615d2c565b613fe09190615d2c565b60008060006148238660400151614b9c565b9250509150600061483d83886000015189602001516147ef565b87519091506001905b604089015189516148579190615d2c565b8110156149b35760208901515b89604001518a602001516148789190615d2c565b8110156149a15760008060038a10156148b0576148a08e61489b600087876147ef565b6154e5565b80156148a95750845b9050614976565b6148df8e8e60405180606001604052808881526020018781526020018e815250600060028f612f3b9190615d44565b905060006148ee8886866147ef565b6000818152603660205260409020549350905082156149745781614964578e6001600160a01b031683146149645760405162461bcd60e51b815260206004820152601760248201527f6e6f74206f776e6572206f66206368696c642051756164000000000000000000604482015260640161079f565b6000818152603660205260408120555b505b808061498157508115155b801561498a5750845b94505050878161499a9190615d2c565b9050614864565b506149ac8782615d2c565b9050614846565b508615614a835780614a5c57896001600160a01b03166149e089604001518a600001518b602001516138b0565b6001600160a01b031614614a5c5760405162461bcd60e51b815260206004820152602b60248201527f6e6f74206f776e6572206f6620616c6c20737562207175616473206e6f72207060448201527f6172656e74207175616473000000000000000000000000000000000000000000606482015260840161079f565b5060009081526036602052604090206001600160a01b0388169055506001915061329d9050565b9998505050505050505050565b6000806000614a9e84613b23565b9150614aa984613af4565b90507fff00000000000000000000000000000000000000000000000000000000000000841680614adc5760019350614b94565b600160f81b811415614af15760039350614b94565b600160f91b811415614b065760069350614b94565b600360f81b811415614b1b57600c9350614b94565b7f0400000000000000000000000000000000000000000000000000000000000000811415614b4c5760189350614b94565b60405162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e20696400000000000000000000000000000000604482015260640161079f565b509193909250565b60008060008360011415614bb7576000925060039150614c8d565b8360031415614bd057600160f81b925060069150614c8d565b8360061415614bef5750600160f91b9150600c9050600160f81b614c8d565b83600c1415614c0e5750600360f81b915060189050600160f91b614c8d565b8360181415614c4557507f04000000000000000000000000000000000000000000000000000000000000009150600360f81b614c8d565b60405162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a650000000000000000000000000000000000000000604482015260640161079f565b9193909250565b6000806000614ca284614b9c565b50509050600088604001518960000151614cbc9190615d2c565b9050600089604001518a60200151614cd49190615d2c565b8a519091505b82811015614e3c5760208b01515b82811015614e2a576000614d178c60405180606001604052808681526020018581526020018c8152508c614e74565b905080614e18576000614d2b8785856147ef565b6000818152603660205260409020549091506001600160a01b038116331415614dcd5760405180606001604052808681526020018581526020018c8152508e8d81518110614d8957634e487b7160e01b600052603260045260246000fd5b60200260200101819052508b80614d9f90615dd1565b9c50614dad90508b80615d58565b614db7908e615d2c565b6000838152603660205260408120559c50614e15565b6001600160a01b03811615614e155760405162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015260640161079f565b50505b50614e238882615d2c565b9050614ce8565b50614e358782615d2c565b9050614cda565b50614e48600287615d44565b955060038610614e6457614e5f8a8a8a8a8a614c94565b985096505b5094989597509495505050505050565b6000805b82811015614f3a576000858281518110614ea257634e487b7160e01b600052603260045260246000fd5b6020026020010151905084604001518160400151118015614ec557508051855110155b8015614ee1575060408101518151614edd9190615d2c565b8551105b8015614ef557508060200151856020015110155b8015614f17575080604001518160200151614f109190615d2c565b8560200151105b15614f27576001925050506110ed565b5080614f3281615dd1565b915050614e78565b506000949350505050565b6001600160a01b0385163b15158015614f6a5750614f6a856317a2fd9160e21b613fe8565b156152405760008667ffffffffffffffff811115614f9857634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015614fc1578160200160208202803683370190505b50905060008088614fd28880615d58565b614fdc9190615d77565b67ffffffffffffffff81111561500257634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561502b578160200160208202803683370190505b5090506000805b61503c8980615d58565b81101561516b576000615051828b8b8b6140af565b90506150898e604051806060016040528061506b85613b23565b815260200161507985613af4565b815260200160018152508f614e74565b156150cc57808686815181106150af57634e487b7160e01b600052603260045260246000fd5b6020908102919091010152846150c481615dd1565b955050615158565b6000818152603660205260409020546001600160a01b031633141561511e57600081815260366020526040812055855181908790879081106150af57634e487b7160e01b600052603260045260246000fd5b8084848151811061513f57634e487b7160e01b600052603260045260246000fd5b60209081029190910101528261515481615dd1565b9350505b508061516381615dd1565b915050615032565b5061517a3360008b8589614126565b6151d25760405162461bcd60e51b8152602060048201526024808201527f657263373231206261746368207472616e736665722072656a656374656420626044820152637920746f60e01b606482015260840161079f565b6151df33338b8789614126565b6152375760405162461bcd60e51b8152602060048201526024808201527f657263373231206261746368207472616e736665722072656a656374656420626044820152637920746f60e01b606482015260840161079f565b50505050612c07565b60005b61524d8580615d58565b811015612c05576000615262828787876140af565b6000818152603660205260409020549091506001600160a01b0316331415615294576000818152603660205260408120555b508061529f81615dd1565b915050615243565b60006152b282614b9c565b5050905081851161533957603660006152e583856152d0818a615d44565b6152da9190615d58565b866138ed818a615d44565b8152602001908152602001600020546000146153345760405162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015260640161079f565b6153ee565b60006153458686615d2c565b905060006153538786615d2c565b9050855b828110156153ea57855b828110156153d857603660006153788785856147ef565b8152602001908152602001600020546000146153c75760405162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015260640161079f565b6153d18682615d2c565b9050615361565b506153e38582615d2c565b9050615357565b5050505b6153f9600283615d44565b9150600382106111c6576111c6858585856152a7565b6001600160a01b03821660009081526034602052604090205460ff16156154785760405162461bcd60e51b815260206004820152601760248201527f494e56414c49445f415050524f56414c5f4348414e4745000000000000000000604482015260640161079f565b6001600160a01b03838116600081815260376020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b60008181526036602052604081205480156155c957600160a01b80821614156155505760405162461bcd60e51b815260206004820152600960248201527f6e6f74206f776e65720000000000000000000000000000000000000000000000604482015260640161079f565b836001600160a01b0316816001600160a01b0316146155b15760405162461bcd60e51b815260206004820152600960248201527f6e6f74206f776e65720000000000000000000000000000000000000000000000604482015260640161079f565b50506000818152603660205260408120556001611d52565b5060009392505050565b80356001600160a01b03811681146106fd57600080fd5b60008083601f8401126155fb578081fd5b50813567ffffffffffffffff811115615612578182fd5b602083019150836020808302850101111561562c57600080fd5b9250929050565b60008083601f840112615644578182fd5b50813567ffffffffffffffff81111561565b578182fd5b60208301915083602082850101111561562c57600080fd5b600082601f830112615683578081fd5b813567ffffffffffffffff8082111561569e5761569e615e2c565b604051601f8301601f19908116603f011681019082821181831017156156c6576156c6615e2c565b816040528381528660208588010111156156de578485fd5b8360208701602083013792830160200193909352509392505050565b60006020828403121561570b578081fd5b611d4f826155d3565b60008060408385031215615726578081fd5b61572f836155d3565b915061573d602084016155d3565b90509250929050565b60008060008060008060008060008060c08b8d031215615764578586fd5b61576d8b6155d3565b995061577b60208c016155d3565b985060408b013567ffffffffffffffff80821115615797578788fd5b6157a38e838f016155ea565b909a50985060608d01359150808211156157bb578788fd5b6157c78e838f016155ea565b909850965060808d01359150808211156157df578586fd5b6157eb8e838f016155ea565b909650945060a08d0135915080821115615803578384fd5b506158108d828e01615633565b915080935050809150509295989b9194979a5092959850565b60008060008060008060808789031215615841578182fd5b61584a876155d3565b9550615858602088016155d3565b9450604087013567ffffffffffffffff80821115615874578384fd5b6158808a838b016155ea565b90965094506060890135915080821115615898578384fd5b506158a589828a01615633565b979a9699509497509295939492505050565b6000806000606084860312156158cb578283fd5b6158d4846155d3565b92506158e2602085016155d3565b915060408401356158f281615e42565b809150509250925092565b600080600060608486031215615911578283fd5b61591a846155d3565b9250615928602085016155d3565b9150604084013590509250925092565b6000806000806080858703121561594d578384fd5b615956856155d3565b9350615964602086016155d3565b925060408501359150606085013567ffffffffffffffff811115615986578182fd5b61599287828801615673565b91505092959194509250565b600080600080600080600060c0888a0312156159b8578283fd5b6159c1886155d3565b96506159cf602089016155d3565b955060408801359450606088013593506080880135925060a088013567ffffffffffffffff8111156159ff578283fd5b615a0b8a828b01615633565b989b979a50959850939692959293505050565b60008060408385031215615a30578081fd5b615a39836155d3565b91506020830135615a4981615e42565b809150509250929050565b60008060408385031215615a66578182fd5b615a6f836155d3565b946020939093013593505050565b60008060008060008060a08789031215615a95578384fd5b615a9e876155d3565b9550602087013594506040870135935060608701359250608087013567ffffffffffffffff811115615ace578283fd5b6158a589828a01615633565b600080600080600060a08688031215615af1578283fd5b615afa866155d3565b9450602086013593506040860135925060608601359150608086013567ffffffffffffffff811115615b2a578182fd5b615b3688828901615673565b9150509295509295909350565b600060208284031215615b54578081fd5b81516110ed81615e42565b600060208284031215615b70578081fd5b81356110ed81615e50565b600060208284031215615b8c578081fd5b81516110ed81615e50565b600060208284031215615ba8578081fd5b5035919050565b600080600060608486031215615bc3578081fd5b505081359360208301359350604090920135919050565b60008151808452615bf2816020860160208601615d8e565b601f01601f19169290920160200192915050565b60007f68747470733a2f2f6170692e73616e64626f782e67616d652f6c616e64732f0082528251615c3e81601f850160208701615d8e565b7f2f6d657461646174612e6a736f6e000000000000000000000000000000000000601f939091019283015250602d01919050565b6000608082016001600160a01b03808816845260208188168186015260806040860152829150865180845260a0860192508188019350845b81811015615cc657845184529382019392820192600101615caa565b5050508381036060850152615cdb8186615bda565b98975050505050505050565b60006001600160a01b038087168352808616602084015250836040830152608060608301526140a56080830184615bda565b600060208252611d4f6020830184615bda565b60008219821115615d3f57615d3f615e00565b500190565b600082615d5357615d53615e16565b500490565b6000816000190483118215151615615d7257615d72615e00565b500290565b600082821015615d8957615d89615e00565b500390565b60005b83811015615da9578181015183820152602001615d91565b83811115610a035750506000910152565b600081615dc957615dc9615e00565b506000190190565b6000600019821415615de557615de5615e00565b5060010190565b600082615dfb57615dfb615e16565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114610efb57600080fd5b6001600160e01b031981168114610efb57600080fdfea26469706673582212202f00bade401d38e048836aa9a97bca4db995f998866ba696bdcfaf359a1a99c164736f6c63430008020033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102d35760003560e01c806379cc679011610186578063ac9fe421116100e3578063ce1b815f11610097578063e985e9c511610071578063e985e9c51461062a578063eaa5e0671461063d578063eeb5a5d114610650576102d3565b8063ce1b815f146105f3578063cf456ae714610604578063da74222814610617576102d3565b8063b88d4fde116100c8578063b88d4fde146105ba578063c4d66de8146105cd578063c87b56dd146105e0576102d3565b8063ac9fe42114610594578063b0ccc31e146105a7576102d3565b80639d28fb861161013a578063a22cb4651161011f578063a22cb46514610542578063aa271e1a14610555578063ab01b46914610581576102d3565b80639d28fb861461052f5780639ededf7714610355576102d3565b80638e5cb5f61161016b5780638e5cb5f6146104d05780638f283970146104e357806395d89b41146104f6576102d3565b806379cc6790146104aa578063845a4697146104bd576102d3565b806342842e0e116102345780636352211e116101e85780636e1e3bbf116101cd5780636e1e3bbf146104735780636e9960c31461048657806370a0823114610497576102d3565b80636352211e14610434578063654b748a14610447576102d3565b80634e6a0f44116102195780634e6a0f44146103ec57806355064d85146103ff578063572b6c0514610412576102d3565b806342842e0e146103c657806342966c68146103d9576102d3565b806315ddc5351161028b57806328cfbd461161027057806328cfbd461461038d5780632b991746146103a057806338bb305a146103b3576102d3565b806315ddc5351461036757806323b872dd1461037a576102d3565b8063081812fc116102bc578063081812fc14610315578063095ea7b3146103405780630ef2674314610355576102d3565b806301ffc9a7146102d857806306fdde0314610300575b600080fd5b6102eb6102e6366004615b5f565b610663565b60405190151581526020015b60405180910390f35b610308610702565b6040516102f79190615d19565b610328610323366004615b97565b61073a565b6040516001600160a01b0390911681526020016102f7565b61035361034e366004615a54565b6107d9565b005b6101985b6040519081526020016102f7565b610353610375366004615829565b6108c2565b6103536103883660046158fd565b6108d8565b61035361039b366004615829565b610a09565b6103536103ae3660046158fd565b610a7e565b6103536103c136600461599e565b610b63565b6103536103d43660046158fd565b610dbb565b6103536103e7366004615b97565b610ee1565b6103536103fa366004615a7d565b610efe565b6102eb61040d366004615baf565b6110c5565b6102eb6104203660046156fa565b606b546001600160a01b0390811691161490565b610328610442366004615b97565b6110f4565b6102eb6104553660046156fa565b6001600160a01b031660009081526034602052604090205460ff1690565b610353610481366004615ada565b611157565b6033546001600160a01b0316610328565b6103596104a53660046156fa565b6111cd565b6103536104b8366004615a54565b611241565b6103596104cb366004615b97565b61139e565b6103596104de366004615b97565b6113a9565b6103536104f13660046156fa565b6113b4565b60408051808201909152600481527f4c414e44000000000000000000000000000000000000000000000000000000006020820152610308565b61035361053d3660046156fa565b61148f565b610353610550366004615a1e565b61153d565b6102eb6105633660046156fa565b6001600160a01b031660009081526039602052604090205460ff1690565b61035361058f366004615a1e565b611621565b6103536105a2366004615a1e565b611702565b606c54610328906001600160a01b031681565b6103536105c8366004615938565b61183d565b6103536105db3660046156fa565b61196a565b6103086105ee366004615b97565b611ab3565b606b546001600160a01b0316610328565b610353610612366004615a1e565b611b46565b6103536106253660046156fa565b611c53565b6102eb610638366004615714565b611d01565b61035361064b366004615746565b611d58565b61035361065e3660046158b7565b612337565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b0319831614806106c657507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b806106fa57507f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b90505b919050565b60408051808201909152600f81527f53616e64626f782773204c414e4473000000000000000000000000000000000060208201525b90565b60008060006107488461241c565b90925090506001600160a01b0382166107a85760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e00000000000000000000000000000060448201526064015b60405180910390fd5b80156107ce575050506000818152603860205260409020546001600160a01b03166106fd565b6000925050506106fd565b606c5482906001600160a01b03163b156108b357606c54604051633185c44d60e21b81523060048201526001600160a01b0383811660248301529091169063c61711349060440160206040518083038186803b15801561083857600080fd5b505afa15801561084c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108709190615b43565b6108b35760405162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015260640161079f565b6108bd8383612542565b505050565b6108d086868686868661267e565b505050505050565b606c5483906001600160a01b03163b156109f8576108f46126f0565b6001600160a01b0316816001600160a01b0316141561091d576109188484846126ff565b610a03565b606c546001600160a01b031663c6171134306109376126f0565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260440160206040518083038186803b15801561097d57600080fd5b505afa158015610991573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b59190615b43565b6109f85760405162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015260640161079f565b610a038484846126ff565b50505050565b6108d0868686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8a018190048102820181019092528881529250889150879081908401838280828437600092019190915250600192506127ae915050565b606c5482906001600160a01b03163b15610b5857606c54604051633185c44d60e21b81523060048201526001600160a01b0383811660248301529091169063c61711349060440160206040518083038186803b158015610add57600080fd5b505afa158015610af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b159190615b43565b610b585760405162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015260640161079f565b610a03848484612c11565b6001600160a01b038716610bb95760405162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f2061646472657373000000000000000000000000604482015260640161079f565b6001600160a01b038616610c0f5760405162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015260640161079f565b866001600160a01b0316610c216126f0565b6001600160a01b031614610ce9576001600160a01b038716600090815260376020526040812090610c506126f0565b6001600160a01b0316815260208101919091526040016000205460ff1680610c9d575060346000610c7f6126f0565b6001600160a01b0316815260208101919091526040016000205460ff165b610ce95760405162461bcd60e51b815260206004820152601e60248201527f6e6f7420617574686f72697a656420746f207472616e73666572517561640000604482015260640161079f565b610cf68787878787612e04565b610d008580615d58565b6001600160a01b03881660009081526035602052604081208054909190610d28908490615d77565b90915550610d3890508580615d58565b6001600160a01b03871660009081526035602052604081208054909190610d60908490615d2c565b90915550610db29050610d716126f0565b888888888888888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612fb492505050565b50505050505050565b606c5483906001600160a01b03163b15610ed657610dd76126f0565b6001600160a01b0316816001600160a01b03161415610dfb576109188484846130ff565b606c546001600160a01b031663c617113430610e156126f0565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260440160206040518083038186803b158015610e5b57600080fd5b505afa158015610e6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e939190615b43565b610ed65760405162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015260640161079f565b610a038484846130ff565b610efb610eec6126f0565b610ef58361311a565b836132a6565b50565b3360009081526039602052604090205460ff16610f5d5760405162461bcd60e51b815260206004820152600b60248201527f21415554484f52495a4544000000000000000000000000000000000000000000604482015260640161079f565b6001600160a01b038616610fb35760405162461bcd60e51b815260206004820152601260248201527f746f206973207a65726f20616464726573730000000000000000000000000000604482015260640161079f565b610fbe8585856110c5565b1561108257610fd03387878787612e04565b610fda8580615d58565b3360009081526035602052604081208054909190610ff9908490615d77565b9091555061100990508580615d58565b6001600160a01b03871660009081526035602052604081208054909190611031908490615d2c565b9250508190555061107d33338888888888888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612fb492505050565b6108d0565b6108d08686868686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061339d92505050565b60006110d28484846136d0565b60006110df8585856138b0565b6001600160a01b0316141590505b9392505050565b60006110ff8261311a565b90506001600160a01b0381166106fd5760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354414e545f544f4b454e000000000000000000000000000000604482015260640161079f565b6111628484846136d0565b61116d6105636126f0565b6111b95760405162461bcd60e51b815260206004820152600b60248201527f21415554484f52495a4544000000000000000000000000000000000000000000604482015260640161079f565b6111c68585858585613953565b5050505050565b60006001600160a01b0382166112255760405162461bcd60e51b815260206004820152601260248201527f5a45524f5f414444524553535f4f574e45520000000000000000000000000000604482015260640161079f565b506001600160a01b031660009081526035602052604090205490565b6001600160a01b0382166112975760405162461bcd60e51b815260206004820152601460248201527f4e4f545f46524f4d5f5a45524f41444452455353000000000000000000000000604482015260640161079f565b6000806112a38361241c565b9150915060006112b16126f0565b9050846001600160a01b0316816001600160a01b031614806112f457508180156112f457506000848152603860205260409020546001600160a01b038281169116145b8061131757506001600160a01b03811660009081526034602052604090205460ff165b8061134757506001600160a01b0380861660009081526037602090815260408083209385168352929052205460ff165b6113935760405162461bcd60e51b815260206004820152601160248201527f554e415554484f52495a45445f4255524e000000000000000000000000000000604482015260640161079f565b6111c68584866132a6565b60006106fa82613af4565b60006106fa82613b23565b6033546001600160a01b0316806113c96126f0565b6001600160a01b03161461141f5760405162461bcd60e51b815260206004820152601360248201527f41444d494e5f4143434553535f44454e49454400000000000000000000000000604482015260640161079f565b816001600160a01b0316816001600160a01b03167f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f60405160405180910390a3506033805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6033546001600160a01b03166114a36126f0565b6001600160a01b0316146114e65760405162461bcd60e51b815260206004820152600a60248201526941444d494e5f4f4e4c5960b01b604482015260640161079f565b606c805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517fc6df119c56c99171b170652a3c4750ba46dcaacbdb3b7ab4847a9fa339659bd490600090a250565b606c5482906001600160a01b03163b1561161757606c54604051633185c44d60e21b81523060048201526001600160a01b0383811660248301529091169063c61711349060440160206040518083038186803b15801561159c57600080fd5b505afa1580156115b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d49190615b43565b6116175760405162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015260640161079f565b6108bd8383613b52565b6033546001600160a01b03166116356126f0565b6001600160a01b0316146116785760405162461bcd60e51b815260206004820152600a60248201526941444d494e5f4f4e4c5960b01b604482015260640161079f565b6001600160a01b0382166116f45760405162461bcd60e51b815260206004820152603160248201527f506f6c79676f6e4c616e6456323a20737562736372697074696f6e2063616e2760448201527f74206265207a65726f2061646472657373000000000000000000000000000000606482015260840161079f565b6116fe8282613b64565b5050565b6033546001600160a01b03166117166126f0565b6001600160a01b0316146117595760405162461bcd60e51b815260206004820152600a60248201526941444d494e5f4f4e4c5960b01b604482015260640161079f565b6033546001600160a01b031661176d6126f0565b6001600160a01b0316146117e95760405162461bcd60e51b815260206004820152602c60248201527f6f6e6c792061646d696e20697320616c6c6f77656420746f206164642073757060448201527f6572206f70657261746f72730000000000000000000000000000000000000000606482015260840161079f565b6001600160a01b038216600081815260346020526040808220805460ff191685151590811790915590519092917f44f92d27abdf4cfb6a7d712c3af68f3be086d4ca747ab802c36f67d6790060d891a35050565b606c5484906001600160a01b03163b1561195e576118596126f0565b6001600160a01b0316816001600160a01b031614156118835761187e85858585613dae565b6111c6565b606c546001600160a01b031663c61711343061189d6126f0565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260440160206040518083038186803b1580156118e357600080fd5b505afa1580156118f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191b9190615b43565b61195e5760405162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015260640161079f565b6111c685858585613dae565b600054610100900460ff166119855760005460ff1615611989565b303b155b6119fb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161079f565b600054610100900460ff16158015611a26576000805460ff1961ff0019909116610100171660011790555b611a2e6126f0565b6033805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055611a6482613e34565b6033546040516001600160a01b03909116906000907f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f908290a380156116fe576000805461ff00191690555050565b60606000611ac08361311a565b6001600160a01b03161415611b175760405162461bcd60e51b815260206004820152601160248201527f496420646f6573206e6f74206578697374000000000000000000000000000000604482015260640161079f565b611b2082613e91565b604051602001611b309190615c06565b6040516020818303038152906040529050919050565b6033546001600160a01b0316611b5a6126f0565b6001600160a01b031614611b9d5760405162461bcd60e51b815260206004820152600a60248201526941444d494e5f4f4e4c5960b01b604482015260640161079f565b6001600160a01b038216611bf35760405162461bcd60e51b815260206004820152601c60248201527f506f6c79676f6e4c616e643a20496e76616c6964206164647265737300000000604482015260640161079f565b6001600160a01b038216600081815260396020908152604091829020805460ff191685151590811790915591519182527fff452b3b9159b024a9098f0058c63eccd90d36b3584608202800d662f962bb6091015b60405180910390a25050565b6033546001600160a01b0316611c676126f0565b6001600160a01b031614611caa5760405162461bcd60e51b815260206004820152600a60248201526941444d494e5f4f4e4c5960b01b604482015260640161079f565b606b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517fd91237492a9e30cd2faf361fc103998a382ff0ec2b1b07dc1cbebb76ae2f1ea290600090a250565b6001600160a01b03808316600090815260376020908152604080832093851683529290529081205460ff1680611d4f57506001600160a01b03821660009081526034602052604090205460ff165b90505b92915050565b6001600160a01b038a16611dae5760405162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f2061646472657373000000000000000000000000604482015260640161079f565b6001600160a01b038916611e045760405162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f2061646472657373000000000000604482015260640161079f565b868514611e795760405162461bcd60e51b815260206004820152603c60248201527f506f6c79676f6e4c616e6442617365546f6b656e56323a2073697a657327732060448201527f616e6420782773206c656e6774682061726520646966666572656e7400000000606482015260840161079f565b848314611eee5760405162461bcd60e51b815260206004820152603860248201527f506f6c79676f6e4c616e6442617365546f6b656e56323a2078277320616e642060448201527f792773206c656e6774682061726520646966666572656e740000000000000000606482015260840161079f565b896001600160a01b0316611f006126f0565b6001600160a01b031614611fed576001600160a01b038a16600090815260376020526040812090611f2f6126f0565b6001600160a01b0316815260208101919091526040016000205460ff1680611f7c575060346000611f5e6126f0565b6001600160a01b0316815260208101919091526040016000205460ff165b611fed5760405162461bcd60e51b8152602060048201526024808201527f6e6f7420617574686f72697a656420746f207472616e736665724d756c74695160448201527f7561647300000000000000000000000000000000000000000000000000000000606482015260840161079f565b6000805b888110156120a75760008a8a8381811061201b57634e487b7160e01b600052603260045260246000fd5b90506020020135905061207d8d8d838c8c8781811061204a57634e487b7160e01b600052603260045260246000fd5b905060200201358b8b8881811061207157634e487b7160e01b600052603260045260246000fd5b90506020020135612e04565b6120878180615d58565b6120919084615d2c565b925050808061209f90615dd1565b915050611ff1565b506001600160a01b038b16600090815260356020526040812080548392906120d0908490615d77565b90915550506001600160a01b038a16600090815260356020526040812080548392906120fd908490615d2c565b90915550506001600160a01b038a163b1515801561212757506121278a6317a2fd9160e21b613fe8565b1561232a5760008167ffffffffffffffff81111561215557634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561217e578160200160208202803683370190505b5090506000805b8a8110156122845760008c8c838181106121af57634e487b7160e01b600052603260045260246000fd5b90506020020135905060005b6121c58280615d58565b81101561226f5761222481838e8e878181106121f157634e487b7160e01b600052603260045260246000fd5b905060200201358d8d8881811061221857634e487b7160e01b600052603260045260246000fd5b905060200201356140af565b85858151811061224457634e487b7160e01b600052603260045260246000fd5b60209081029190910101528361225981615dd1565b945050808061226790615dd1565b9150506121bb565b5050808061227c90615dd1565b915050612185565b506122cf6122906126f0565b8e8e8589898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061412692505050565b6123275760405162461bcd60e51b8152602060048201526024808201527f657263373231206261746368207472616e736665722072656a656374656420626044820152637920746f60e01b606482015260840161079f565b50505b5050505050505050505050565b606c5482906001600160a01b03163b1561241157606c54604051633185c44d60e21b81523060048201526001600160a01b0383811660248301529091169063c61711349060440160206040518083038186803b15801561239657600080fd5b505afa1580156123aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123ce9190615b43565b6124115760405162461bcd60e51b815260206004820152601460248201527313dc195c985d1bdc88139bdd08105b1b1bddd95960621b604482015260640161079f565b610a038484846141e5565b6000807fff0000000000000000000000000000000000000000000000000000000000000083161561248f5760405162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e20696400000000000000000000000000000000604482015260640161079f565b600061249d61019885615dec565b905060006124ad61019886615d44565b600086815260366020526040902054909150600160a01b80821614156124e45760009450600160ff1b80821614935050505061253d565b80156124fd57809450600160ff1b808216149350612539565b61253260038061250d8682615d58565b6125179190615d44565b60036125238682615d58565b61252d9190615d44565b6138b0565b9450600093505b5050505b915091565b6000818152603660205260408120549061255b8361311a565b905060006125676126f0565b90506001600160a01b0382166125bf5760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e000000000000000000000000000000604482015260640161079f565b806001600160a01b0316826001600160a01b0316148061260457506001600160a01b0380831660009081526037602090815260408083209385168352929052205460ff165b8061262757506001600160a01b03811660009081526034602052604090205460ff165b6126735760405162461bcd60e51b815260206004820152601560248201527f554e415554484f52495a45445f415050524f56414c0000000000000000000000604482015260640161079f565b6111c68386866142d6565b6108d0868686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8a018190048102820181019092528881529250889150879081908401838280828437600092018290525092506127ae915050565b60006126fa61438c565b905090565b61270a8383836143d6565b6127158383836145df565b6001600160a01b0382163b1515801561273a575061273a826317a2fd9160e21b613fe8565b156108bd5761276261274a6126f0565b8484846040518060200160405280600081525061469d565b6108bd5760405162461bcd60e51b815260206004820152601860248201527f4552433732315f5452414e534645525f52454a45435445440000000000000000604482015260640161079f565b60006127b86126f0565b90506000866001600160a01b0316826001600160a01b0316148061280157506001600160a01b0380881660009081526037602090815260408083209386168352929052205460ff165b8061282457506001600160a01b03821660009081526034602052604090205460ff165b90506001600160a01b03871661287c5760405162461bcd60e51b815260206004820152601460248201527f4e4f545f46524f4d5f5a45524f41444452455353000000000000000000000000604482015260640161079f565b6001600160a01b0386166128d25760405162461bcd60e51b815260206004820152601260248201527f4e4f545f544f5f5a45524f414444524553530000000000000000000000000000604482015260640161079f565b845160005b81811015612a6957600087828151811061290157634e487b7160e01b600052603260045260246000fd5b602002602001015190506000806129178361241c565b915091508b6001600160a01b0316826001600160a01b03161461297c5760405162461bcd60e51b815260206004820152601b60248201527f42415443485452414e5346455246524f4d5f4e4f545f4f574e45520000000000604482015260640161079f565b85806129a957508080156129a957506000838152603860205260409020546001600160a01b038881169116145b6129f55760405162461bcd60e51b815260206004820152600e60248201527f4e4f545f415554484f52495a4544000000000000000000000000000000000000604482015260640161079f565b600083815260366020526040812054612a12918591908e9061475c565b828b6001600160a01b03168d6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050508080612a6190615dd1565b9150506128d7565b50866001600160a01b0316886001600160a01b031614612ade576001600160a01b03881660009081526035602052604081208054839290612aab908490615d77565b90915550506001600160a01b03871660009081526035602052604081208054839290612ad8908490615d2c565b90915550505b6001600160a01b0387163b15612c0757612aff876317a2fd9160e21b613fe8565b15612b6257612b118389898989614126565b612b5d5760405162461bcd60e51b815260206004820152601e60248201527f4552433732315f42415443485f52454345495645445f52454a45435445440000604482015260640161079f565b612c07565b8315612c075760005b81811015612c0557612ba7848a8a8a8581518110612b9957634e487b7160e01b600052603260045260246000fd5b60200260200101518a61469d565b612bf35760405162461bcd60e51b815260206004820152601860248201527f4552433732315f52454345495645445f52454a45435445440000000000000000604482015260640161079f565b80612bfd81615dd1565b915050612b6b565b505b5050505050505050565b60008181526036602052604081205490612c2a8361311a565b90506000612c366126f0565b90506001600160a01b038616612c8e5760405162461bcd60e51b815260206004820152601360248201527f5a45524f5f414444524553535f53454e44455200000000000000000000000000604482015260640161079f565b6001600160a01b038216612ce45760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e000000000000000000000000000000604482015260640161079f565b856001600160a01b0316816001600160a01b03161480612d2957506001600160a01b0380871660009081526037602090815260408083209385168352929052205460ff165b80612d4c57506001600160a01b03811660009081526034602052604090205460ff165b612d985760405162461bcd60e51b815260206004820152601560248201527f554e415554484f52495a45445f415050524f56414c0000000000000000000000604482015260640161079f565b856001600160a01b0316836001600160a01b031614612df95760405162461bcd60e51b815260206004820152601060248201527f4f574e45525f4e4f545f53454e44455200000000000000000000000000000000604482015260640161079f565b6108d08386866142d6565b612e0f8383836136d0565b8260011415612f0c576000612e26600084846147ef565b90506000612e338261311a565b90506001600160a01b038116612e8b5760405162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f74206578697374000000000000000000000000604482015260640161079f565b866001600160a01b0316816001600160a01b031614612eec5760405162461bcd60e51b815260206004820152601a60248201527f6e6f74206f776e657220696e205f7472616e7366657251756164000000000000604482015260640161079f565b5060009081526036602052604090206001600160a01b0385169055612f42565b612f4085856040518060600160405280868152602001858152602001878152506001600288612f3b9190615d44565b614811565b505b60005b612f4f8480615d58565b8110156108d057612f62818585856140af565b856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a480612fac81615dd1565b915050612f45565b6001600160a01b0385163b15158015612fd95750612fd9856317a2fd9160e21b613fe8565b15610db2576000612fea8580615d58565b67ffffffffffffffff81111561301057634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015613039578160200160208202803683370190505b50905060005b6130498680615d58565b8110156130995761305c818787876140af565b82828151811061307c57634e487b7160e01b600052603260045260246000fd5b60209081029190910101528061309181615dd1565b91505061303f565b506130a78888888486614126565b612c075760405162461bcd60e51b8152602060048201526024808201527f657263373231206261746368207472616e736665722072656a656374656420626044820152637920746f60e01b606482015260840161079f565b6108bd8383836040518060200160405280600081525061183d565b60007fff0000000000000000000000000000000000000000000000000000000000000082161561318c5760405162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e20696400000000000000000000000000000000604482015260640161079f565b600080600061319a85614a90565b919450925090506131ab8383615dec565b156131f85760405162461bcd60e51b815260206004820152601e60248201527f7820636f6f7264696e6174653a20496e76616c696420746f6b656e2069640000604482015260640161079f565b6132028382615dec565b1561324f5760405162461bcd60e51b815260206004820152601e60248201527f7920636f6f7264696e6174653a20496e76616c696420746f6b656e2069640000604482015260640161079f565b826001141561329257600085815260366020526040902054600160a01b808216146132845761327f8484846138b0565b613287565b60005b9450505050506106fd565b61329d8383836138b0565b95945050505050565b816001600160a01b0316836001600160a01b0316146133075760405162461bcd60e51b815260206004820152600960248201527f4e4f545f4f574e45520000000000000000000000000000000000000000000000604482015260640161079f565b80600160a01b61331c6001600160ff1b615d77565b6000838152603660209081526040808320805494909416949094179092556001600160a01b0387168152603590915290812080549161335a83615dba565b909155505060405182906000906001600160a01b038716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a450505050565b60006133a885614b9c565b5050905060006133b98286866147ef565b604080518181526108208101825291925060009190816020015b6133f760405180606001604052806000815260200160008152602001600081525090565b8152602001906001900390816133d357905050905060008060038911156134515761344b60405180606001604052808a81526020018981526020018b81525084838560028e6134469190615d44565b614c94565b90925090505b60005b61345e8a80615d58565b81101561363e576000613473828c8c8c6140af565b905060006134ad86604051806060016040528061348f86613b23565b815260200161349d86613af4565b8152602001600181525087614e74565b905080156134f25760405182906001600160a01b038f169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90600090a4613629565b6000828152603660205260409020546001600160a01b03163314156135a3576000828152603860205260409020546001600160a01b031615613558576000828152603860205260409020805473ffffffffffffffffffffffffffffffffffffffff191690555b613563600185615d2c565b60405190945082906001600160a01b038f169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90600090a4613629565b600082815260366020526040902054156135f05760405162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015260640161079f565b60405182906001600160a01b038f16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45b5050808061363690615dd1565b915050613454565b5061364f8383838d8d8d8d8d614f45565b60008481526036602052604090206001600160a01b038b1690556136738980615d58565b6001600160a01b038b166000908152603560205260408120805490919061369b908490615d2c565b909155505033600090815260356020526040812080548392906136bf908490615d77565b909155505050505050505050505050565b82600114806136df5750826003145b806136ea5750826006145b806136f5575082600c145b806137005750826018145b61374c5760405162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a650000000000000000000000000000000000000000604482015260640161079f565b6137568383615dec565b156137a35760405162461bcd60e51b815260206004820152601460248201527f496e76616c6964207820636f6f7264696e617465000000000000000000000000604482015260640161079f565b6137ad8382615dec565b156137fa5760405162461bcd60e51b815260206004820152601460248201527f496e76616c6964207920636f6f7264696e617465000000000000000000000000604482015260640161079f565b61380683610198615d77565b8211156138555760405162461bcd60e51b815260206004820152600f60248201527f78206f7574206f6620626f756e64730000000000000000000000000000000000604482015260640161079f565b61386183610198615d77565b8111156108bd5760405162461bcd60e51b815260206004820152600f60248201527f79206f7574206f6620626f756e64730000000000000000000000000000000000604482015260640161079f565b60008060006138be86614b9c565b50909250905060006036816138fc858a6138d8818c615d44565b6138e29190615d58565b8b6138ed818c615d44565b6138f79190615d58565b6147ef565b815260208101919091526040016000205490506001600160a01b038116156139285792506110ed915050565b60188710156139465761393c8287876138b0565b93505050506110ed565b5060009695505050505050565b6001600160a01b0385166139a95760405162461bcd60e51b815260206004820152601260248201527f746f206973207a65726f20616464726573730000000000000000000000000000604482015260640161079f565b60006139b485614b9c565b5050905060006139c58286866147ef565b90506139d486868660186152a7565b60005b6139e18780615d58565b811015613a915760006139f6828989896140af565b60008181526036602052604090205490915015613a465760405162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015260640161079f565b60405181906001600160a01b038b16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45080613a8981615dd1565b9150506139d7565b5060008181526036602052604090206001600160a01b0388169055613ab68680615d58565b6001600160a01b03881660009081526035602052604081208054909190613ade908490615d2c565b90915550610db290503360008989898989612fb4565b60006106fa6101987effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8416615d44565b60006106fa6101987effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8416615dec565b6116fe613b5d6126f0565b838361540f565b606c546001600160a01b03163b15613d7157606c546040517fc3c5a5470000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b039091169063c3c5a54790602401602060405180830381600087803b158015613bd457600080fd5b505af1158015613be8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c0c9190615b43565b613d71578015613c9a57606c546040517f7d3e3dbe0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03848116602483015290911690637d3e3dbe906044015b600060405180830381600087803b158015613c7d57600080fd5b505af1158015613c91573d6000803e3d6000fd5b50505050613d71565b6001600160a01b03821615613cfa57606c546040517fa0af29030000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0384811660248301529091169063a0af290390604401613c63565b606c546040517f4420e4860000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0390911690634420e48690602401600060405180830381600087803b158015613d5857600080fd5b505af1158015613d6c573d6000803e3d6000fd5b505050505b816001600160a01b03167f3c7a9c847c035e45b84027e44ad55724873d5921b3a6abb8c0926b415d9241b182604051611c47911515815260200190565b613db98484846143d6565b613dc48484846145df565b6001600160a01b0383163b15610a0357613de8613ddf6126f0565b8585858561469d565b610a035760405162461bcd60e51b815260206004820152601860248201527f4552433732315f5452414e534645525f52454a45435445440000000000000000604482015260640161079f565b606b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383811691909117918290556040519116907fd91237492a9e30cd2faf361fc103998a382ff0ec2b1b07dc1cbebb76ae2f1ea290600090a250565b606081613ed2575060408051808201909152600181527f300000000000000000000000000000000000000000000000000000000000000060208201526106fd565b8160005b8115613efc5780613ee681615dd1565b9150613ef59050600a83615d44565b9150613ed6565b60008167ffffffffffffffff811115613f2557634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613f4f576020820181803683370190505b5090505b8415613fe057613f64600183615d77565b9150613f71600a86615dec565b613f7c906030615d2c565b60f81b818381518110613f9f57634e487b7160e01b600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350613fd9600a86615d44565b9450613f53565b949350505050565b604080516001600160e01b031983166024808301919091528251808303909101815260449091018252602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001781528251935160008082529485948594909392908183858c612710fa955080519450505050609e5a1161409b57634e487b7160e01b600052600160045260246000fd5b8280156140a55750815b9695505050505050565b6000806140bc8587615d44565b90506140c9600282615dec565b6140f8576140f060006140dc8789615dec565b6140e69087615d2c565b6138f78487615d2c565b915050613fe0565b6140f060006141078789615dec565b614112906001615d2c565b61411c8888615d2c565b6140e69190615d77565b600080846001600160a01b0316634b808c46888887876040518563ffffffff1660e01b815260040161415b9493929190615c72565b602060405180830381600087803b15801561417557600080fd5b505af1158015614189573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141ad9190615b7b565b6001600160e01b0319167f4b808c46000000000000000000000000000000000000000000000000000000001491505095945050505050565b6001600160a01b03831661423b5760405162461bcd60e51b815260206004820152601660248201527f496e76616c69642073656e646572206164647265737300000000000000000000604482015260640161079f565b60006142456126f0565b9050836001600160a01b0316816001600160a01b0316148061427f57506001600160a01b03811660009081526034602052604090205460ff165b6142cb5760405162461bcd60e51b815260206004820152601c60248201527f554e415554484f52495a45445f415050524f56455f464f525f414c4c00000000604482015260640161079f565b610a0384848461540f565b60006142e18261311a565b90506001600160a01b038316614303576142fe828583600061475c565b614345565b614310828583600161475c565b6000828152603860205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385161790555b81836001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a450505050565b606b546000906001600160a01b03163314156143cf57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c610737565b5033610737565b6000806143e28361241c565b9150915060006143f06126f0565b90506001600160a01b0383166144485760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e000000000000000000000000000000604482015260640161079f565b856001600160a01b0316836001600160a01b0316146144a95760405162461bcd60e51b815260206004820152601760248201527f434845434b5452414e534645525f4e4f545f4f574e4552000000000000000000604482015260640161079f565b6001600160a01b0385166144ff5760405162461bcd60e51b815260206004820152601260248201527f4e4f545f544f5f5a45524f414444524553530000000000000000000000000000604482015260640161079f565b826001600160a01b0316816001600160a01b0316148061453757506001600160a01b03811660009081526034602052604090205460ff165b8061456757506001600160a01b0380871660009081526037602090815260408083209385168352929052205460ff165b80614593575081801561459357506000848152603860205260409020546001600160a01b038281169116145b6108d05760405162461bcd60e51b815260206004820152601560248201527f554e415554484f52495a45445f5452414e534645520000000000000000000000604482015260640161079f565b6001600160a01b038316600090815260356020526040812080549161460383615dba565b90915550506001600160a01b038216600090815260356020526040812080549161462c83615dd1565b919050555061465781603660006146408590565b81526020019081526020016000205484600061475c565b80826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b600080846001600160a01b031663150b7a02888887876040518563ffffffff1660e01b81526004016146d29493929190615ce7565b602060405180830381600087803b1580156146ec57600080fd5b505af1158015614700573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147249190615b7b565b6001600160e01b0319167f150b7a02000000000000000000000000000000000000000000000000000000001491505095945050505050565b80156147a0576000848152603660205260409020600160ff1b6001600160a01b03841673ffffffffffffffffffffffffffffffffffffffff19861617179055610a03565b6001600160a01b0382166147b96001600160ff1b615d77565b841673ffffffffffffffffffffffffffffffffffffffff1916176036600086815260208101919091526040016000205550505050565b60006147fd61019883615d58565b6148078486615d2c565b613fe09190615d2c565b60008060006148238660400151614b9c565b9250509150600061483d83886000015189602001516147ef565b87519091506001905b604089015189516148579190615d2c565b8110156149b35760208901515b89604001518a602001516148789190615d2c565b8110156149a15760008060038a10156148b0576148a08e61489b600087876147ef565b6154e5565b80156148a95750845b9050614976565b6148df8e8e60405180606001604052808881526020018781526020018e815250600060028f612f3b9190615d44565b905060006148ee8886866147ef565b6000818152603660205260409020549350905082156149745781614964578e6001600160a01b031683146149645760405162461bcd60e51b815260206004820152601760248201527f6e6f74206f776e6572206f66206368696c642051756164000000000000000000604482015260640161079f565b6000818152603660205260408120555b505b808061498157508115155b801561498a5750845b94505050878161499a9190615d2c565b9050614864565b506149ac8782615d2c565b9050614846565b508615614a835780614a5c57896001600160a01b03166149e089604001518a600001518b602001516138b0565b6001600160a01b031614614a5c5760405162461bcd60e51b815260206004820152602b60248201527f6e6f74206f776e6572206f6620616c6c20737562207175616473206e6f72207060448201527f6172656e74207175616473000000000000000000000000000000000000000000606482015260840161079f565b5060009081526036602052604090206001600160a01b0388169055506001915061329d9050565b9998505050505050505050565b6000806000614a9e84613b23565b9150614aa984613af4565b90507fff00000000000000000000000000000000000000000000000000000000000000841680614adc5760019350614b94565b600160f81b811415614af15760039350614b94565b600160f91b811415614b065760069350614b94565b600360f81b811415614b1b57600c9350614b94565b7f0400000000000000000000000000000000000000000000000000000000000000811415614b4c5760189350614b94565b60405162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e20696400000000000000000000000000000000604482015260640161079f565b509193909250565b60008060008360011415614bb7576000925060039150614c8d565b8360031415614bd057600160f81b925060069150614c8d565b8360061415614bef5750600160f91b9150600c9050600160f81b614c8d565b83600c1415614c0e5750600360f81b915060189050600160f91b614c8d565b8360181415614c4557507f04000000000000000000000000000000000000000000000000000000000000009150600360f81b614c8d565b60405162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a650000000000000000000000000000000000000000604482015260640161079f565b9193909250565b6000806000614ca284614b9c565b50509050600088604001518960000151614cbc9190615d2c565b9050600089604001518a60200151614cd49190615d2c565b8a519091505b82811015614e3c5760208b01515b82811015614e2a576000614d178c60405180606001604052808681526020018581526020018c8152508c614e74565b905080614e18576000614d2b8785856147ef565b6000818152603660205260409020549091506001600160a01b038116331415614dcd5760405180606001604052808681526020018581526020018c8152508e8d81518110614d8957634e487b7160e01b600052603260045260246000fd5b60200260200101819052508b80614d9f90615dd1565b9c50614dad90508b80615d58565b614db7908e615d2c565b6000838152603660205260408120559c50614e15565b6001600160a01b03811615614e155760405162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015260640161079f565b50505b50614e238882615d2c565b9050614ce8565b50614e358782615d2c565b9050614cda565b50614e48600287615d44565b955060038610614e6457614e5f8a8a8a8a8a614c94565b985096505b5094989597509495505050505050565b6000805b82811015614f3a576000858281518110614ea257634e487b7160e01b600052603260045260246000fd5b6020026020010151905084604001518160400151118015614ec557508051855110155b8015614ee1575060408101518151614edd9190615d2c565b8551105b8015614ef557508060200151856020015110155b8015614f17575080604001518160200151614f109190615d2c565b8560200151105b15614f27576001925050506110ed565b5080614f3281615dd1565b915050614e78565b506000949350505050565b6001600160a01b0385163b15158015614f6a5750614f6a856317a2fd9160e21b613fe8565b156152405760008667ffffffffffffffff811115614f9857634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015614fc1578160200160208202803683370190505b50905060008088614fd28880615d58565b614fdc9190615d77565b67ffffffffffffffff81111561500257634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561502b578160200160208202803683370190505b5090506000805b61503c8980615d58565b81101561516b576000615051828b8b8b6140af565b90506150898e604051806060016040528061506b85613b23565b815260200161507985613af4565b815260200160018152508f614e74565b156150cc57808686815181106150af57634e487b7160e01b600052603260045260246000fd5b6020908102919091010152846150c481615dd1565b955050615158565b6000818152603660205260409020546001600160a01b031633141561511e57600081815260366020526040812055855181908790879081106150af57634e487b7160e01b600052603260045260246000fd5b8084848151811061513f57634e487b7160e01b600052603260045260246000fd5b60209081029190910101528261515481615dd1565b9350505b508061516381615dd1565b915050615032565b5061517a3360008b8589614126565b6151d25760405162461bcd60e51b8152602060048201526024808201527f657263373231206261746368207472616e736665722072656a656374656420626044820152637920746f60e01b606482015260840161079f565b6151df33338b8789614126565b6152375760405162461bcd60e51b8152602060048201526024808201527f657263373231206261746368207472616e736665722072656a656374656420626044820152637920746f60e01b606482015260840161079f565b50505050612c07565b60005b61524d8580615d58565b811015612c05576000615262828787876140af565b6000818152603660205260409020549091506001600160a01b0316331415615294576000818152603660205260408120555b508061529f81615dd1565b915050615243565b60006152b282614b9c565b5050905081851161533957603660006152e583856152d0818a615d44565b6152da9190615d58565b866138ed818a615d44565b8152602001908152602001600020546000146153345760405162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015260640161079f565b6153ee565b60006153458686615d2c565b905060006153538786615d2c565b9050855b828110156153ea57855b828110156153d857603660006153788785856147ef565b8152602001908152602001600020546000146153c75760405162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b604482015260640161079f565b6153d18682615d2c565b9050615361565b506153e38582615d2c565b9050615357565b5050505b6153f9600283615d44565b9150600382106111c6576111c6858585856152a7565b6001600160a01b03821660009081526034602052604090205460ff16156154785760405162461bcd60e51b815260206004820152601760248201527f494e56414c49445f415050524f56414c5f4348414e4745000000000000000000604482015260640161079f565b6001600160a01b03838116600081815260376020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b60008181526036602052604081205480156155c957600160a01b80821614156155505760405162461bcd60e51b815260206004820152600960248201527f6e6f74206f776e65720000000000000000000000000000000000000000000000604482015260640161079f565b836001600160a01b0316816001600160a01b0316146155b15760405162461bcd60e51b815260206004820152600960248201527f6e6f74206f776e65720000000000000000000000000000000000000000000000604482015260640161079f565b50506000818152603660205260408120556001611d52565b5060009392505050565b80356001600160a01b03811681146106fd57600080fd5b60008083601f8401126155fb578081fd5b50813567ffffffffffffffff811115615612578182fd5b602083019150836020808302850101111561562c57600080fd5b9250929050565b60008083601f840112615644578182fd5b50813567ffffffffffffffff81111561565b578182fd5b60208301915083602082850101111561562c57600080fd5b600082601f830112615683578081fd5b813567ffffffffffffffff8082111561569e5761569e615e2c565b604051601f8301601f19908116603f011681019082821181831017156156c6576156c6615e2c565b816040528381528660208588010111156156de578485fd5b8360208701602083013792830160200193909352509392505050565b60006020828403121561570b578081fd5b611d4f826155d3565b60008060408385031215615726578081fd5b61572f836155d3565b915061573d602084016155d3565b90509250929050565b60008060008060008060008060008060c08b8d031215615764578586fd5b61576d8b6155d3565b995061577b60208c016155d3565b985060408b013567ffffffffffffffff80821115615797578788fd5b6157a38e838f016155ea565b909a50985060608d01359150808211156157bb578788fd5b6157c78e838f016155ea565b909850965060808d01359150808211156157df578586fd5b6157eb8e838f016155ea565b909650945060a08d0135915080821115615803578384fd5b506158108d828e01615633565b915080935050809150509295989b9194979a5092959850565b60008060008060008060808789031215615841578182fd5b61584a876155d3565b9550615858602088016155d3565b9450604087013567ffffffffffffffff80821115615874578384fd5b6158808a838b016155ea565b90965094506060890135915080821115615898578384fd5b506158a589828a01615633565b979a9699509497509295939492505050565b6000806000606084860312156158cb578283fd5b6158d4846155d3565b92506158e2602085016155d3565b915060408401356158f281615e42565b809150509250925092565b600080600060608486031215615911578283fd5b61591a846155d3565b9250615928602085016155d3565b9150604084013590509250925092565b6000806000806080858703121561594d578384fd5b615956856155d3565b9350615964602086016155d3565b925060408501359150606085013567ffffffffffffffff811115615986578182fd5b61599287828801615673565b91505092959194509250565b600080600080600080600060c0888a0312156159b8578283fd5b6159c1886155d3565b96506159cf602089016155d3565b955060408801359450606088013593506080880135925060a088013567ffffffffffffffff8111156159ff578283fd5b615a0b8a828b01615633565b989b979a50959850939692959293505050565b60008060408385031215615a30578081fd5b615a39836155d3565b91506020830135615a4981615e42565b809150509250929050565b60008060408385031215615a66578182fd5b615a6f836155d3565b946020939093013593505050565b60008060008060008060a08789031215615a95578384fd5b615a9e876155d3565b9550602087013594506040870135935060608701359250608087013567ffffffffffffffff811115615ace578283fd5b6158a589828a01615633565b600080600080600060a08688031215615af1578283fd5b615afa866155d3565b9450602086013593506040860135925060608601359150608086013567ffffffffffffffff811115615b2a578182fd5b615b3688828901615673565b9150509295509295909350565b600060208284031215615b54578081fd5b81516110ed81615e42565b600060208284031215615b70578081fd5b81356110ed81615e50565b600060208284031215615b8c578081fd5b81516110ed81615e50565b600060208284031215615ba8578081fd5b5035919050565b600080600060608486031215615bc3578081fd5b505081359360208301359350604090920135919050565b60008151808452615bf2816020860160208601615d8e565b601f01601f19169290920160200192915050565b60007f68747470733a2f2f6170692e73616e64626f782e67616d652f6c616e64732f0082528251615c3e81601f850160208701615d8e565b7f2f6d657461646174612e6a736f6e000000000000000000000000000000000000601f939091019283015250602d01919050565b6000608082016001600160a01b03808816845260208188168186015260806040860152829150865180845260a0860192508188019350845b81811015615cc657845184529382019392820192600101615caa565b5050508381036060850152615cdb8186615bda565b98975050505050505050565b60006001600160a01b038087168352808616602084015250836040830152608060608301526140a56080830184615bda565b600060208252611d4f6020830184615bda565b60008219821115615d3f57615d3f615e00565b500190565b600082615d5357615d53615e16565b500490565b6000816000190483118215151615615d7257615d72615e00565b500290565b600082821015615d8957615d89615e00565b500390565b60005b83811015615da9578181015183820152602001615d91565b83811115610a035750506000910152565b600081615dc957615dc9615e00565b506000190190565b6000600019821415615de557615de5615e00565b5060010190565b600082615dfb57615dfb615e16565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114610efb57600080fd5b6001600160e01b031981168114610efb57600080fdfea26469706673582212202f00bade401d38e048836aa9a97bca4db995f998866ba696bdcfaf359a1a99c164736f6c63430008020033", "devdoc": { "kind": "dev", "methods": { "approve(address,uint256)": { "params": { - "id": "The id of the token.", - "operator": "The address receiving the approval." + "id": "The id of the token", + "operator": "The address receiving the approval" } }, "approveFor(address,address,uint256)": { "params": { - "id": "The id of the token.", - "operator": "The address receiving the approval.", - "sender": "The address giving the approval." + "id": "The id of the token", + "operator": "The address receiving the approval", + "sender": "The address giving the approval" } }, "balanceOf(address)": { @@ -944,6 +1066,24 @@ "_0": "The number of tokens owned by the address." } }, + "batchTransferFrom(address,address,uint256[],bytes)": { + "params": { + "data": "Additional data.", + "from": "The sender of the token.", + "ids": "The ids of the tokens.", + "to": "The recipient of the token." + } + }, + "batchTransferQuad(address,address,uint256[],uint256[],uint256[],bytes)": { + "params": { + "data": "additional data", + "from": "current owner of the quad", + "sizes": "list of sizes for each quad", + "to": "destination", + "xs": "list of bottom left x coordinates for each quad", + "ys": "list of bottom left y coordinates for each quad" + } + }, "burn(uint256)": { "params": { "id": "The token which will be burnt." @@ -961,6 +1101,16 @@ "newAdmin": "The address of the new administrator." } }, + "exists(uint256,uint256,uint256)": { + "params": { + "size": "size of the", + "x": "x coordinate of the quad", + "y": "y coordinate of the quad" + }, + "returns": { + "_0": "bool for if Land has been minted or not" + } + }, "getAdmin()": { "details": "Get the current administrator of this contract.", "returns": { @@ -975,6 +1125,11 @@ "_0": "The address of the operator." } }, + "getTrustedForwarder()": { + "returns": { + "_0": "trustedForwarder address of the trusted forwarder" + } + }, "getX(uint256)": { "params": { "id": "tokenId" @@ -1002,7 +1157,7 @@ "owner": "The address of the owner." }, "returns": { - "isOperator": "The status of the approval." + "_0": "isOperator The status of the approval." } }, "isMinter(address)": { @@ -1021,6 +1176,23 @@ "_0": "whether the address has superOperator rights." } }, + "isTrustedForwarder(address)": { + "params": { + "forwarder": "address to check" + }, + "returns": { + "_0": "is trusted" + } + }, + "mintAndTransferQuad(address,uint256,uint256,uint256,bytes)": { + "params": { + "data": "extra data to pass to the transfer", + "size": "The size of the new quad", + "to": "The recipient of the new quad", + "x": "The top left x coordinate of the new quad", + "y": "The top left y coordinate of the new quad" + } + }, "mintQuad(address,uint256,uint256,uint256,bytes)": { "params": { "data": "extra data to pass to the transfer", @@ -1043,6 +1215,13 @@ "owner": "The address of the token owner." } }, + "register(address,bool)": { + "details": "can only be called by admin.", + "params": { + "subscribe": "bool to signify subscription 'true' or to copy the list 'false'.", + "subscriptionOrRegistrantToCopy": "registration address of the list to subscribe." + } + }, "safeBatchTransferFrom(address,address,uint256[],bytes)": { "params": { "data": "Additional data.", @@ -1053,30 +1232,30 @@ }, "safeTransferFrom(address,address,uint256)": { "params": { - "from": "The send of the token.", - "id": "The id of the token.", - "to": "The recipient of the token." + "from": "The send of the token", + "id": "The id of the token", + "to": "The recipient of the token" } }, "safeTransferFrom(address,address,uint256,bytes)": { "params": { - "data": "Additional data.", - "from": "The sender of the token.", - "id": "The id of the token.", - "to": "The recipient of the token." + "data": "Additional data", + "from": "The sender of the token", + "id": "The id of the token", + "to": "The recipient of the token" } }, "setApprovalForAll(address,bool)": { "params": { - "approved": "The determination of the approval.", - "operator": "The address receiving the approval." + "approved": "The determination of the approval", + "operator": "The address receiving the approval" } }, "setApprovalForAllFor(address,address,bool)": { "params": { - "approved": "The determination of the approval.", - "operator": "The address receiving the approval.", - "sender": "The address giving the approval." + "approved": "The determination of the approval", + "operator": "The address receiving the approval", + "sender": "The address giving the approval" } }, "setMinter(address,bool)": { @@ -1085,6 +1264,11 @@ "minter": "address that will be given/removed minter right." } }, + "setOperatorRegistry(address)": { + "params": { + "registry": "the address of the registry" + } + }, "setSuperOperator(address,bool)": { "params": { "enabled": "set whether the superOperator is enabled or disabled.", @@ -1120,9 +1304,19 @@ }, "transferFrom(address,address,uint256)": { "params": { - "from": "The sender of the token.", - "id": "The id of the token.", - "to": "The recipient of the token." + "from": "The sender of the token", + "id": "The id of the token", + "to": "The recipient of the token" + } + }, + "transferQuad(address,address,uint256,uint256,uint256,bytes)": { + "params": { + "data": "additional data for transfer", + "from": "current owner of the quad", + "size": "size of the quad", + "to": "destination", + "x": "The top left x coordinate of the quad", + "y": "The top left y coordinate of the quad" } }, "width()": { @@ -1138,23 +1332,41 @@ "kind": "user", "methods": { "approve(address,uint256)": { - "notice": "Approve an operator to spend tokens on the senders behalf." + "notice": "Approve an operator to spend tokens on the sender behalf" }, "approveFor(address,address,uint256)": { - "notice": "Approve an operator to spend tokens on the sender behalf." + "notice": "Approve an operator to spend tokens on the sender behalf" }, "balanceOf(address)": { "notice": "Get the number of tokens owned by an address." }, + "batchTransferFrom(address,address,uint256[],bytes)": { + "notice": "Transfer many tokens between 2 addresses." + }, + "batchTransferQuad(address,address,uint256[],uint256[],uint256[],bytes)": { + "notice": "transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)" + }, "burn(uint256)": { "notice": "Burns token `id`." }, "burnFrom(address,uint256)": { - "notice": "Burn token`id` from `from`." + "notice": "Burn token `id` from `from`." + }, + "changeAdmin(address)": { + "notice": "Change the admin of the contract" + }, + "exists(uint256,uint256,uint256)": { + "notice": "checks if Land has been minted or not" + }, + "getAdmin()": { + "notice": "Get the current admin" }, "getApproved(uint256)": { "notice": "Get the approved operator for a specific token." }, + "getTrustedForwarder()": { + "notice": "Get the current trusted forwarder" + }, "getX(uint256)": { "notice": "x coordinate of Land token" }, @@ -1173,6 +1385,12 @@ "isSuperOperator(address)": { "notice": "check whether address `who` is given superOperator rights." }, + "isTrustedForwarder(address)": { + "notice": "Checks if an address is a trusted forwarder" + }, + "mintAndTransferQuad(address,uint256,uint256,uint256,bytes)": { + "notice": "Checks if a parent quad has child quads already minted. Then mints the rest child quads and transfers the parent quad. Should only be called by the tunnel." + }, "mintQuad(address,uint256,uint256,uint256,bytes)": { "notice": "Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)" }, @@ -1182,24 +1400,30 @@ "ownerOf(uint256)": { "notice": "Get the owner of a token." }, + "register(address,bool)": { + "notice": "This function is used to register Land contract on the Operator Filterer Registry of Opensea." + }, "safeBatchTransferFrom(address,address,uint256[],bytes)": { "notice": "Transfer many tokens between 2 addresses, while ensuring the receiving contract has a receiver method." }, "safeTransferFrom(address,address,uint256)": { - "notice": "Transfer a token between 2 addresses letting the receiver know of the transfer." + "notice": "Transfer a token between 2 addresses letting the receiver knows of the transfer" }, "safeTransferFrom(address,address,uint256,bytes)": { - "notice": "Transfer a token between 2 addresses letting the receiver knows of the transfer." + "notice": "Transfer a token between 2 addresses letting the receiver knows of the transfer" }, "setApprovalForAll(address,bool)": { - "notice": "Set the approval for an operator to manage all the tokens of the sender." + "notice": "Set the approval for an operator to manage all the tokens of the sender" }, "setApprovalForAllFor(address,address,bool)": { - "notice": "Set the approval for an operator to manage all the tokens of the sender." + "notice": "Set the approval for an operator to manage all the tokens of the sender" }, "setMinter(address,bool)": { "notice": "Enable or disable the ability of `minter` to transfer tokens of all (minter rights)." }, + "setOperatorRegistry(address)": { + "notice": "sets filter registry address deployed in test" + }, "setSuperOperator(address,bool)": { "notice": "Enable or disable the ability of `superOperator` to transfer tokens of all (superOperator rights)." }, @@ -1213,7 +1437,10 @@ "notice": "Return the URI of a specific token" }, "transferFrom(address,address,uint256)": { - "notice": "Transfer a token between 2 addresses." + "notice": "Transfer a token between 2 addresses" + }, + "transferQuad(address,address,uint256,uint256,uint256,bytes)": { + "notice": "transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)" }, "width()": { "notice": "total width of the map" @@ -1224,100 +1451,108 @@ "storageLayout": { "storage": [ { - "astId": 4850, - "contract": "src/solc_0.8/polygon/child/land/PolygonLandV1.sol:PolygonLandV1", + "astId": 10217, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandV2.sol:PolygonLandV2", "label": "_initialized", "offset": 0, "slot": "0", "type": "t_bool" }, { - "astId": 4853, - "contract": "src/solc_0.8/polygon/child/land/PolygonLandV1.sol:PolygonLandV1", + "astId": 10220, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandV2.sol:PolygonLandV2", "label": "_initializing", "offset": 1, "slot": "0", "type": "t_bool" }, { - "astId": 5530, - "contract": "src/solc_0.8/polygon/child/land/PolygonLandV1.sol:PolygonLandV1", + "astId": 12276, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandV2.sol:PolygonLandV2", "label": "__gap", "offset": 0, "slot": "1", "type": "t_array(t_uint256)50_storage" }, { - "astId": 27367, - "contract": "src/solc_0.8/polygon/child/land/PolygonLandV1.sol:PolygonLandV1", + "astId": 38971, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandV2.sol:PolygonLandV2", "label": "_admin", "offset": 0, "slot": "51", "type": "t_address" }, { - "astId": 27663, - "contract": "src/solc_0.8/polygon/child/land/PolygonLandV1.sol:PolygonLandV1", + "astId": 39430, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandV2.sol:PolygonLandV2", "label": "_superOperators", "offset": 0, "slot": "52", "type": "t_mapping(t_address,t_bool)" }, { - "astId": 25570, - "contract": "src/solc_0.8/polygon/child/land/PolygonLandV1.sol:PolygonLandV1", + "astId": 37175, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandV2.sol:PolygonLandV2", "label": "_numNFTPerAddress", "offset": 0, "slot": "53", "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 25574, - "contract": "src/solc_0.8/polygon/child/land/PolygonLandV1.sol:PolygonLandV1", + "astId": 37180, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandV2.sol:PolygonLandV2", "label": "_owners", "offset": 0, "slot": "54", "type": "t_mapping(t_uint256,t_uint256)" }, { - "astId": 25580, - "contract": "src/solc_0.8/polygon/child/land/PolygonLandV1.sol:PolygonLandV1", + "astId": 37186, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandV2.sol:PolygonLandV2", "label": "_operatorsForAll", "offset": 0, "slot": "55", "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" }, { - "astId": 25584, - "contract": "src/solc_0.8/polygon/child/land/PolygonLandV1.sol:PolygonLandV1", + "astId": 37190, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandV2.sol:PolygonLandV2", "label": "_operators", "offset": 0, "slot": "56", "type": "t_mapping(t_uint256,t_address)" }, { - "astId": 34200, - "contract": "src/solc_0.8/polygon/child/land/PolygonLandV1.sol:PolygonLandV1", + "astId": 60988, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandV2.sol:PolygonLandV2", "label": "_minters", "offset": 0, "slot": "57", "type": "t_mapping(t_address,t_bool)" }, { - "astId": 36912, - "contract": "src/solc_0.8/polygon/child/land/PolygonLandV1.sol:PolygonLandV1", + "astId": 63668, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandV2.sol:PolygonLandV2", "label": "__gap", "offset": 0, "slot": "58", "type": "t_array(t_uint256)49_storage" }, { - "astId": 24032, - "contract": "src/solc_0.8/polygon/child/land/PolygonLandV1.sol:PolygonLandV1", + "astId": 35420, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandV2.sol:PolygonLandV2", "label": "_trustedForwarder", "offset": 0, "slot": "107", "type": "t_address" + }, + { + "astId": 17796, + "contract": "src/solc_0.8/polygon/child/land/PolygonLandV2.sol:PolygonLandV2", + "label": "operatorFilterRegistry", + "offset": 0, + "slot": "108", + "type": "t_contract(IOperatorFilterRegistry)18178" } ], "types": { @@ -1343,6 +1578,11 @@ "label": "bool", "numberOfBytes": "1" }, + "t_contract(IOperatorFilterRegistry)18178": { + "encoding": "inplace", + "label": "contract IOperatorFilterRegistry", + "numberOfBytes": "20" + }, "t_mapping(t_address,t_bool)": { "encoding": "mapping", "key": "t_address", diff --git a/packages/core/deployments/polygon/PolygonLand_V1.json b/packages/core/deployments/polygon/PolygonLand_V1.json new file mode 100644 index 0000000000..b8adb692ea --- /dev/null +++ b/packages/core/deployments/polygon/PolygonLand_V1.json @@ -0,0 +1,1077 @@ +{ + "address": "0x9d305a42A3975Ee4c1C57555BeD5919889DCE63F", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "Minter", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "superOperator", + "type": "address" + }, + { + "indexed": true, + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "SuperOperator", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "approveFor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "batchTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "sizes", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "xs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "ys", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "batchTransferQuad", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "size", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "x", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "y", + "type": "uint256" + } + ], + "name": "exists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAdmin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTrustedForwarder", + "outputs": [ + { + "internalType": "address", + "name": "trustedForwarder", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "getX", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "getY", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "height", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "trustedForwarder", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "isOperator", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "who", + "type": "address" + } + ], + "name": "isMinter", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "who", + "type": "address" + } + ], + "name": "isSuperOperator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "forwarder", + "type": "address" + } + ], + "name": "isTrustedForwarder", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "size", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "x", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "y", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "mintQuad", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeBatchTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAllFor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "setMinter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "superOperator", + "type": "address" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "setSuperOperator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "trustedForwarder", + "type": "address" + } + ], + "name": "setTrustedForwarder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "id", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "size", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "x", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "y", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "transferQuad", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "width", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "initialLogic", + "type": "address" + }, + { + "internalType": "address", + "name": "initialAdmin", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xa8e719474e5236f79176831ba07fa2de4a3397945682c651f369b25ebba5b9ef", + "receipt": { + "to": null, + "from": "0x7074BB056C53ACC0b6091dd3FAe591aa3A4acC88", + "contractAddress": "0x9d305a42A3975Ee4c1C57555BeD5919889DCE63F", + "transactionIndex": 42, + "gasUsed": "613363", + "logsBloom": "0x0000000000000000000000000000000000000000000000000000000040000000000000000000000002000000000000000000a000000000000000000000000000000000000000000000000000000000800000000000000000000100000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000008000000000000000000000000000200000000000000000000000000000000000000000000000000000000000004000000000000000000081000000000000000000000000000000100000000000000000000000000000000000000000000000000800000000000000000000100000", + "blockHash": "0x57fd97e2d454100fdccecc964c73a34e68edae94f1b0d36499355ca82df06ed9", + "transactionHash": "0xa8e719474e5236f79176831ba07fa2de4a3397945682c651f369b25ebba5b9ef", + "logs": [ + { + "transactionIndex": 42, + "blockNumber": 29533337, + "transactionHash": "0xa8e719474e5236f79176831ba07fa2de4a3397945682c651f369b25ebba5b9ef", + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x0000000000000000000000007074bb056c53acc0b6091dd3fae591aa3a4acc88", + "0x000000000000000000000000e7e2cb8c81c10ff191a73fe266788c9ce62ec754" + ], + "data": "0x0000000000000000000000000000000000000000000000000041b33074fc9e220000000000000000000000000000000000000000000000055a53b2341e9212c6000000000000000000000000000000000000000000001f4c6cf96348d00198c30000000000000000000000000000000000000000000000055a11ff03a99574a4000000000000000000000000000000000000000000001f4c6d3b167944fe36e5", + "logIndex": 248, + "blockHash": "0x57fd97e2d454100fdccecc964c73a34e68edae94f1b0d36499355ca82df06ed9" + } + ], + "blockNumber": 29533337, + "cumulativeGasUsed": "14053295", + "status": 1, + "byzantium": true + }, + "args": [ + "0x16f78D75fABB869835236B5Fb59c2b29f6cBbfcf", + "0x29BeE877F756952cC810c0cF93bF0fC2bF036Fdb", + "0xc4d66de8000000000000000000000000f0511f123164602042ab2bcf02111fa5d3fe97cd" + ], + "numDeployments": 1, + "solcInputHash": "1635d55d57a0a2552952c0d22586ed23", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialLogic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAdmin\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\",\"events\":{\"AdminChanged(address,address)\":{\"details\":\"Emitted when the admin account has changed.\"}},\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"stateVariables\":{\"_ADMIN_SLOT\":{\"details\":\"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.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.7/openzeppelin/proxy/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.7/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n * \\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n * \\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal virtual view returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n * \\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {\\n }\\n}\\n\",\"keccak256\":\"0xc33f9858a67e34c77831163d5611d21fc627dfd2c303806a98a6c9db5a01b034\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./UpgradeableProxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n * \\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n * \\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n * \\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n * \\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is UpgradeableProxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\\n */\\n constructor(address initialLogic, address initialAdmin, bytes memory _data) payable UpgradeableProxy(initialLogic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _setAdmin(initialAdmin);\\n }\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _admin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n * \\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address) {\\n return _admin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n * \\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address) {\\n return _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n * \\n * Emits an {AdminChanged} event.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external ifAdmin {\\n require(newAdmin != address(0), \\\"TransparentUpgradeableProxy: new admin is the zero address\\\");\\n emit AdminChanged(_admin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeTo(newImplementation);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeTo(newImplementation);\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = newImplementation.delegatecall(data);\\n require(success);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view returns (address adm) {\\n bytes32 slot = _ADMIN_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n adm := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n bytes32 slot = _ADMIN_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newAdmin)\\n }\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal override virtual {\\n require(msg.sender != _admin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xd6cecbe00dc78355aff1a16d83487bb73c54701004d61a2e48cdb81e2bcacc26\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/UpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Proxy.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n * \\n * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see\\n * {TransparentUpgradeableProxy}.\\n */\\ncontract UpgradeableProxy is Proxy {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n * \\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _setImplementation(_logic);\\n if(_data.length > 0) {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = _logic.delegatecall(_data);\\n require(success);\\n }\\n }\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal override view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Upgrades the proxy to a new implementation.\\n * \\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"UpgradeableProxy: new implementation is not a contract\\\");\\n\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newImplementation)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd68f4c11941712db79a61b9dca81a5db663cfacec3d7bb19f8d2c23bb1ab8afe\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\\n // for accounts without code, i.e. `keccak256('')`\\n bytes32 codehash;\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { codehash := extcodehash(account) }\\n return (codehash != accountHash && codehash != 0x0);\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return _functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n return _functionCallWithValue(target, data, value, errorMessage);\\n }\\n\\n function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x698f929f1097637d051976b322a2d532c27df022b09010e8d091e2888a5ebdf8\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051610aaa380380610aaa8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101bf565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b6101b782610231565b505050610291565b6101d28161025560201b6104bb1760201c565b61020d5760405162461bcd60e51b8152600401808060200182810382526036815260200180610a746036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061028957508115155b949350505050565b6107d4806102a06000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104f7565b6101ed6101e861058b565b6105b0565b565b6101f76105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105f9565b610240565b6102406101d5565b50565b61024b6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105f9565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b60006103216105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61058b565b905061036b565b61036b6101d5565b90565b6103766105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806106ed603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e6105d4565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610646565b60006104806105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c6105d4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104ef57508115155b949350505050565b6104ff6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061075d6042913960600191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105cf573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106028161066a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610673816104bb565b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806107276036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a2646970667358221220b141ef72de179b8b56cef31601d40ff2875391088197e73cac39eba1ddcd0fdd64736f6c634300070600335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104f7565b6101ed6101e861058b565b6105b0565b565b6101f76105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105f9565b610240565b6102406101d5565b50565b61024b6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105f9565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b60006103216105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61058b565b905061036b565b61036b6101d5565b90565b6103766105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806106ed603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e6105d4565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610646565b60006104806105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c6105d4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104ef57508115155b949350505050565b6104ff6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061075d6042913960600191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105cf573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106028161066a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610673816104bb565b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806107276036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a2646970667358221220b141ef72de179b8b56cef31601d40ff2875391088197e73cac39eba1ddcd0fdd64736f6c63430007060033", + "execute": { + "methodName": "initialize", + "args": [ + "0xf0511f123164602042ab2bCF02111fA5D3Fe97CD" + ] + }, + "implementation": "0x16f78D75fABB869835236B5Fb59c2b29f6cBbfcf", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.", + "events": { + "AdminChanged(address,address)": { + "details": "Emitted when the admin account has changed." + } + }, + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "stateVariables": { + "_ADMIN_SLOT": { + "details": "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." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/core/deployments/polygon/PolygonOperatorFilterRegistry.json b/packages/core/deployments/polygon/PolygonOperatorFilterRegistry.json new file mode 100644 index 0000000000..8a54ce6f8a --- /dev/null +++ b/packages/core/deployments/polygon/PolygonOperatorFilterRegistry.json @@ -0,0 +1,668 @@ +{ + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_defaultSubscribtion", + "type": "address" + }, + { + "internalType": "address[]", + "name": "_blacklistedAddresses", + "type": "address[]" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "codeHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bool", + "name": "filtered", + "type": "bool" + } + ], + "name": "CodeHashUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32[]", + "name": "codeHashes", + "type": "bytes32[]" + }, + { + "indexed": true, + "internalType": "bool", + "name": "filtered", + "type": "bool" + } + ], + "name": "CodeHashesUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "bool", + "name": "filtered", + "type": "bool" + } + ], + "name": "OperatorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "operators", + "type": "address[]" + }, + { + "indexed": true, + "internalType": "bool", + "name": "filtered", + "type": "bool" + } + ], + "name": "OperatorsUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "indexed": true, + "internalType": "bool", + "name": "registered", + "type": "bool" + } + ], + "name": "RegistrationUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "subscription", + "type": "address" + }, + { + "indexed": true, + "internalType": "bool", + "name": "subscribed", + "type": "bool" + } + ], + "name": "SubscriptionUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "EOA_CODEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "codeHashOf", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "registrantToCopy", + "type": "address" + } + ], + "name": "copyEntriesOf", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "filteredCodeHashAt", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + } + ], + "name": "filteredCodeHashes", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "", + "type": "bytes32[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "filteredOperatorAt", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + } + ], + "name": "filteredOperators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "codeHash", + "type": "bytes32" + } + ], + "name": "isCodeHashFiltered", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "operatorWithCode", + "type": "address" + } + ], + "name": "isCodeHashOfFiltered", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isOperatorAllowed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isOperatorFiltered", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + } + ], + "name": "isRegistered", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "registrantToCopy", + "type": "address" + } + ], + "name": "registerAndCopyEntries", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "subscription", + "type": "address" + } + ], + "name": "registerAndSubscribe", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "newSubscription", + "type": "address" + } + ], + "name": "subscribe", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "subscriberAt", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + } + ], + "name": "subscribers", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + } + ], + "name": "subscriptionOf", + "outputs": [ + { + "internalType": "address", + "name": "subscription", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + } + ], + "name": "unregister", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "bool", + "name": "copyExistingEntries", + "type": "bool" + } + ], + "name": "unsubscribe", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "codeHash", + "type": "bytes32" + }, + { + "internalType": "bool", + "name": "filtered", + "type": "bool" + } + ], + "name": "updateCodeHash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "bytes32[]", + "name": "codeHashes", + "type": "bytes32[]" + }, + { + "internalType": "bool", + "name": "filtered", + "type": "bool" + } + ], + "name": "updateCodeHashes", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "filtered", + "type": "bool" + } + ], + "name": "updateOperator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address[]", + "name": "operators", + "type": "address[]" + }, + { + "internalType": "bool", + "name": "filtered", + "type": "bool" + } + ], + "name": "updateOperators", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] +} \ No newline at end of file diff --git a/packages/core/deployments/polygon/PolygonOperatorFilterSubscription.json b/packages/core/deployments/polygon/PolygonOperatorFilterSubscription.json new file mode 100644 index 0000000000..972ff99f9b --- /dev/null +++ b/packages/core/deployments/polygon/PolygonOperatorFilterSubscription.json @@ -0,0 +1,340 @@ +{ + "address": "0x31F74dc99528895b56823a00f5c7D71C30416683", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "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": "DEFAULT_SUBSCRIPTION", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "operatorFilterRegistry", + "outputs": [ + { + "internalType": "contract IOperatorFilterRegistry", + "name": "", + "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": "initialLogic", + "type": "address" + }, + { + "internalType": "address", + "name": "initialAdmin", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xf7209261013bbd940ada5d8d4c48164b569e78571b0c6d683087a75e9d08addd", + "receipt": { + "to": null, + "from": "0x7074BB056C53ACC0b6091dd3FAe591aa3A4acC88", + "contractAddress": "0x31F74dc99528895b56823a00f5c7D71C30416683", + "transactionIndex": 57, + "gasUsed": "626517", + "logsBloom": "0x0000000000000000000000000000000000000020080000000080000050000000000000000000000000000000000000000000a000000000000000000000040000000080000000000000000000000000800001000000040000000140000000000000000000020000000000000000000800000000000000000080000000000100400000000001000000000000000000000000000000000000000000000000000000200000000000000100000000000010000000000000000000000000000000004000000000004000000001000000000200000000000000000100100000000060000000080000000000100000000000000000000800000000200000000000100000", + "blockHash": "0x432ff97db8e5c1c8779b48591b16c71d52236e43c4a6a6e4d10842e9a22b600e", + "transactionHash": "0xf7209261013bbd940ada5d8d4c48164b569e78571b0c6d683087a75e9d08addd", + "logs": [ + { + "transactionIndex": 57, + "blockNumber": 45783599, + "transactionHash": "0xf7209261013bbd940ada5d8d4c48164b569e78571b0c6d683087a75e9d08addd", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x86d03f430c7616021073d7a71766f632f1ce19f289aa989534d9f4732253eb59", + "0x00000000000000000000000031f74dc99528895b56823a00f5c7d71c30416683", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 660, + "blockHash": "0x432ff97db8e5c1c8779b48591b16c71d52236e43c4a6a6e4d10842e9a22b600e" + }, + { + "transactionIndex": 57, + "blockNumber": 45783599, + "transactionHash": "0xf7209261013bbd940ada5d8d4c48164b569e78571b0c6d683087a75e9d08addd", + "address": "0x31F74dc99528895b56823a00f5c7D71C30416683", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007074bb056c53acc0b6091dd3fae591aa3a4acc88" + ], + "data": "0x", + "logIndex": 661, + "blockHash": "0x432ff97db8e5c1c8779b48591b16c71d52236e43c4a6a6e4d10842e9a22b600e" + }, + { + "transactionIndex": 57, + "blockNumber": 45783599, + "transactionHash": "0xf7209261013bbd940ada5d8d4c48164b569e78571b0c6d683087a75e9d08addd", + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x0000000000000000000000007074bb056c53acc0b6091dd3fae591aa3a4acc88", + "0x000000000000000000000000b9ede6f94d192073d8eaf85f8db677133d483249" + ], + "data": "0x000000000000000000000000000000000000000000000000000248b80908a13800000000000000000000000000000000000000000000000129b95ea19504021600000000000000000000000000000000000000000000011fbd0f5bc10f871e5400000000000000000000000000000000000000000000000129b715e98bfb60de00000000000000000000000000000000000000000000011fbd11a479188fbf8c", + "logIndex": 662, + "blockHash": "0x432ff97db8e5c1c8779b48591b16c71d52236e43c4a6a6e4d10842e9a22b600e" + } + ], + "blockNumber": 45783599, + "cumulativeGasUsed": "18690298", + "status": 1, + "byzantium": true + }, + "args": [ + "0x6598Ebbd50221fDEF2ACF3a666Bf3EE826156204", + "0x29BeE877F756952cC810c0cF93bF0fC2bF036Fdb", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "1635d55d57a0a2552952c0d22586ed23", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialLogic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAdmin\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\",\"events\":{\"AdminChanged(address,address)\":{\"details\":\"Emitted when the admin account has changed.\"}},\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"stateVariables\":{\"_ADMIN_SLOT\":{\"details\":\"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.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.7/openzeppelin/proxy/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.7/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n * \\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n * \\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal virtual view returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n * \\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {\\n }\\n}\\n\",\"keccak256\":\"0xc33f9858a67e34c77831163d5611d21fc627dfd2c303806a98a6c9db5a01b034\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./UpgradeableProxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n * \\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n * \\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n * \\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n * \\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is UpgradeableProxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\\n */\\n constructor(address initialLogic, address initialAdmin, bytes memory _data) payable UpgradeableProxy(initialLogic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _setAdmin(initialAdmin);\\n }\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _admin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n * \\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address) {\\n return _admin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n * \\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address) {\\n return _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n * \\n * Emits an {AdminChanged} event.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external ifAdmin {\\n require(newAdmin != address(0), \\\"TransparentUpgradeableProxy: new admin is the zero address\\\");\\n emit AdminChanged(_admin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeTo(newImplementation);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeTo(newImplementation);\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = newImplementation.delegatecall(data);\\n require(success);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view returns (address adm) {\\n bytes32 slot = _ADMIN_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n adm := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n bytes32 slot = _ADMIN_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newAdmin)\\n }\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal override virtual {\\n require(msg.sender != _admin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xd6cecbe00dc78355aff1a16d83487bb73c54701004d61a2e48cdb81e2bcacc26\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/UpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Proxy.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n * \\n * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see\\n * {TransparentUpgradeableProxy}.\\n */\\ncontract UpgradeableProxy is Proxy {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n * \\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _setImplementation(_logic);\\n if(_data.length > 0) {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = _logic.delegatecall(_data);\\n require(success);\\n }\\n }\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal override view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Upgrades the proxy to a new implementation.\\n * \\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"UpgradeableProxy: new implementation is not a contract\\\");\\n\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newImplementation)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd68f4c11941712db79a61b9dca81a5db663cfacec3d7bb19f8d2c23bb1ab8afe\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\\n // for accounts without code, i.e. `keccak256('')`\\n bytes32 codehash;\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { codehash := extcodehash(account) }\\n return (codehash != accountHash && codehash != 0x0);\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return _functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n return _functionCallWithValue(target, data, value, errorMessage);\\n }\\n\\n function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x698f929f1097637d051976b322a2d532c27df022b09010e8d091e2888a5ebdf8\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051610aaa380380610aaa8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101bf565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b6101b782610231565b505050610291565b6101d28161025560201b6104bb1760201c565b61020d5760405162461bcd60e51b8152600401808060200182810382526036815260200180610a746036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061028957508115155b949350505050565b6107d4806102a06000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104f7565b6101ed6101e861058b565b6105b0565b565b6101f76105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105f9565b610240565b6102406101d5565b50565b61024b6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105f9565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b60006103216105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61058b565b905061036b565b61036b6101d5565b90565b6103766105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806106ed603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e6105d4565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610646565b60006104806105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c6105d4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104ef57508115155b949350505050565b6104ff6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061075d6042913960600191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105cf573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106028161066a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610673816104bb565b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806107276036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a2646970667358221220b141ef72de179b8b56cef31601d40ff2875391088197e73cac39eba1ddcd0fdd64736f6c634300070600335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104f7565b6101ed6101e861058b565b6105b0565b565b6101f76105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105f9565b610240565b6102406101d5565b50565b61024b6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105f9565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b60006103216105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61058b565b905061036b565b61036b6101d5565b90565b6103766105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806106ed603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e6105d4565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610646565b60006104806105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c6105d4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104ef57508115155b949350505050565b6104ff6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061075d6042913960600191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105cf573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106028161066a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610673816104bb565b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806107276036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a2646970667358221220b141ef72de179b8b56cef31601d40ff2875391088197e73cac39eba1ddcd0fdd64736f6c63430007060033", + "execute": { + "methodName": "initialize", + "args": [] + }, + "implementation": "0x6598Ebbd50221fDEF2ACF3a666Bf3EE826156204", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.", + "events": { + "AdminChanged(address,address)": { + "details": "Emitted when the admin account has changed." + } + }, + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "stateVariables": { + "_ADMIN_SLOT": { + "details": "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." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/core/deployments/polygon/PolygonOperatorFilterSubscription_Implementation.json b/packages/core/deployments/polygon/PolygonOperatorFilterSubscription_Implementation.json new file mode 100644 index 0000000000..248ab27bb7 --- /dev/null +++ b/packages/core/deployments/polygon/PolygonOperatorFilterSubscription_Implementation.json @@ -0,0 +1,224 @@ +{ + "address": "0x6598Ebbd50221fDEF2ACF3a666Bf3EE826156204", + "abi": [ + { + "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": "DEFAULT_SUBSCRIPTION", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "operatorFilterRegistry", + "outputs": [ + { + "internalType": "contract IOperatorFilterRegistry", + "name": "", + "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" + } + ], + "transactionHash": "0x3b536987d0fbdf9506aefb4eb78d33f576872de4feeaa92a5453768cf2423ef5", + "receipt": { + "to": null, + "from": "0x7074BB056C53ACC0b6091dd3FAe591aa3A4acC88", + "contractAddress": "0x6598Ebbd50221fDEF2ACF3a666Bf3EE826156204", + "transactionIndex": 53, + "gasUsed": "414714", + "logsBloom": "0x0000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000a000000000000000004000000000000000000000000000000000000000800000000000000000000100000000000000000000000000000000000000000000000000000000000080000000200000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000004000000000000000000021000000000000000000000000000000100000000000000000000000000000000000000000000000000800000000000000000000100000", + "blockHash": "0x0fab601ad353088e1597df28457106bd904215a0fb28122550a98a25b429448b", + "transactionHash": "0x3b536987d0fbdf9506aefb4eb78d33f576872de4feeaa92a5453768cf2423ef5", + "logs": [ + { + "transactionIndex": 53, + "blockNumber": 45783493, + "transactionHash": "0x3b536987d0fbdf9506aefb4eb78d33f576872de4feeaa92a5453768cf2423ef5", + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x0000000000000000000000007074bb056c53acc0b6091dd3fae591aa3a4acc88", + "0x00000000000000000000000009385a960a2e0b6b4516d341534da92cb2a50085" + ], + "data": "0x000000000000000000000000000000000000000000000000002cb9fcc408c5720000000000000000000000000000000000000000000000012a4e423aaff3f6f8000000000000000000000000000000000000000000000037d99014fe92c30d360000000000000000000000000000000000000000000000012a21883debeb3186000000000000000000000000000000000000000000000037d9bccefb56cbd2a8", + "logIndex": 219, + "blockHash": "0x0fab601ad353088e1597df28457106bd904215a0fb28122550a98a25b429448b" + } + ], + "blockNumber": 45783493, + "cumulativeGasUsed": "7871304", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e1aa5651f7645b1641ef34120369a942", + "metadata": "{\"compiler\":{\"version\":\"0.8.2+commit.661d1103\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"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\":\"DEFAULT_SUBSCRIPTION\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"operatorFilterRegistry\",\"outputs\":[{\"internalType\":\"contract IOperatorFilterRegistry\",\"name\":\"\",\"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\"}],\"devdoc\":{\"custom:experimental\":\"This is an experimental contract. There could be future changes according to the change in the requirements\",\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"OperatorFilterSubription\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"This contract is ment to register and copy the default subscription of the openSea for the operator filter and our Token contract are supposed to subscribe to This contract on openSea operator filter registry\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/solc_0.8/OperatorFilterer/contracts/OperatorFilterRegistrant.sol\":\"OperatorFilterSubscription\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Context_init_unchained();\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x9ffedb33e192f8821cbaead72596c79ea87fb28a73f8d3a9f5004449799f8e1b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the\\n * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() initializer {}\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n bool private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Modifier to protect an initializer function from being invoked twice.\\n */\\n modifier initializer() {\\n // If the contract is initializing we ignore whether _initialized is set in order to support multiple\\n // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the\\n // contract may have been reentered.\\n require(_initializing ? _isConstructor() : !_initialized, \\\"Initializable: contract is already initialized\\\");\\n\\n bool isTopLevelCall = !_initializing;\\n if (isTopLevelCall) {\\n _initializing = true;\\n _initialized = true;\\n }\\n\\n _;\\n\\n if (isTopLevelCall) {\\n _initializing = false;\\n }\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} modifier, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n function _isConstructor() private view returns (bool) {\\n return !AddressUpgradeable.isContract(address(this));\\n }\\n}\\n\",\"keccak256\":\"0x68861bcc80cacbd498efde75aab6c74a486cc48262660d326c8d7530d9752097\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3f0f878c796dfc7feba6d3c4e3e526c14c7deae8b7bfc71088e3f38fab0d77b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n __Context_init_unchained();\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x0b0d548f6381370d394f7a434f994dc678b3ef3e755de106109d61343a685ea7\",\"license\":\"MIT\"},\"src/solc_0.8/OperatorFilterer/contracts/OperatorFilterRegistrant.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// solhint-disable-next-line compiler-version\\npragma solidity 0.8.2;\\n\\nimport {IOperatorFilterRegistry} from \\\"../interfaces/IOperatorFilterRegistry.sol\\\";\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\n\\n/// @title OperatorFilterSubription\\n/// @notice This contract is ment to register and copy the default subscription of the openSea for the operator filter and our Token contract are supposed to subscribe to This contract on openSea operator filter registry\\n/// @custom:experimental This is an experimental contract. There could be future changes according to the change in the requirements\\ncontract OperatorFilterSubscription is OwnableUpgradeable {\\n address public constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);\\n\\n IOperatorFilterRegistry public constant operatorFilterRegistry =\\n IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);\\n\\n function initialize() external initializer {\\n // Subscribe and copy the entries of the Default subscription list of open sea.\\n if (address(operatorFilterRegistry).code.length > 0) {\\n operatorFilterRegistry.registerAndCopyEntries(address(this), DEFAULT_SUBSCRIPTION);\\n }\\n __Ownable_init();\\n }\\n}\\n\",\"keccak256\":\"0x0b41d80857c0190de23ece65a6c2a7affa7c18bd52563cb4cf9841a0457bcb7c\",\"license\":\"MIT\"},\"src/solc_0.8/OperatorFilterer/interfaces/IOperatorFilterRegistry.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.2;\\n\\n/**\\n * @title IOperatorFilterRegistry\\n * @author OpenSea\\n * @notice Interface of the operator filter registry\\n * @dev This interface comes from OpenSea https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/IOperatorFilterRegistry.sol and adapted to the 0.5.9 solidity version\\n */\\ninterface IOperatorFilterRegistry {\\n /**\\n * @notice Check if the operator is allowed for the given registrant\\n * @param registrant address of the registrant\\n * @param operator operator address to check\\n * @return is the operator allowed\\n */\\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\\n\\n /**\\n * @notice Register a new address\\n * @param registrant address to register\\n */\\n function register(address registrant) external;\\n\\n /**\\n * @notice Register a new address & subscribe to an address\\n * @param registrant address of the registrant\\n * @param subscription address where the registrant is subscribed to\\n */\\n function registerAndSubscribe(address registrant, address subscription) external;\\n\\n /**\\n * @notice Register and copy entries of another registrant\\n * @param registrant address of the registrant\\n * @param registrantToCopy address to copy from\\n */\\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\\n\\n /**\\n * @notice update the operator for a registrant\\n * @param registrant address of the registrant\\n * @param operator operator to be updated\\n * @param filtered is it filtered\\n */\\n function updateOperator(\\n address registrant,\\n address operator,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update operators for a registrant\\n * @param registrant address of the registrant\\n * @param operators addresses of the operators\\n * @param filtered is it filtered\\n */\\n function updateOperators(\\n address registrant,\\n address[] calldata operators,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update code hash\\n * @param registrant address of the registrant\\n * @param codehash code hash\\n * @param filtered is it filtered\\n */\\n function updateCodeHash(\\n address registrant,\\n bytes32 codehash,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update code hashes\\n * @param registrant address of the registrant\\n * @param codeHashes code hashes\\n * @param filtered is it filtered\\n */\\n function updateCodeHashes(\\n address registrant,\\n bytes32[] calldata codeHashes,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Subscribe a registrant\\n * @param registrant address of the registrant\\n * @param registrantToSubscribe address to subscribe with\\n */\\n function subscribe(address registrant, address registrantToSubscribe) external;\\n\\n /**\\n * @notice Unsubscribe a registrant\\n * @param registrant address of the registrant\\n * @param copyExistingEntries copy existing entries\\n */\\n function unsubscribe(address registrant, bool copyExistingEntries) external;\\n\\n /**\\n * @notice Get the subscription of an address\\n * @param addr address to check\\n * @return registrant the registrant address\\n */\\n function subscriptionOf(address addr) external returns (address registrant);\\n\\n /**\\n * @notice Get the subscribers of the registrant\\n * @param registrant address of the registrant\\n * @return the subscribers addresses\\n */\\n function subscribers(address registrant) external returns (address[] memory);\\n\\n /**\\n * @notice Get a specific subscriber\\n * @param registrant address of the registrant\\n * @param index index to check\\n * @return the ith subscriber of the registrant\\n */\\n function subscriberAt(address registrant, uint256 index) external returns (address);\\n\\n /**\\n * @notice Copy the entries of a registrant\\n * @param registrant address of the registrant\\n * @param registrantToCopy address to copy\\n */\\n function copyEntriesOf(address registrant, address registrantToCopy) external;\\n\\n /**\\n * @notice Is a registrant filtered\\n * @param registrant address of the registrant\\n * @param operator operator address to check\\n * @return is it filtered\\n */\\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\\n\\n /**\\n * @notice Is the code hash of an operator filtered\\n * @param registrant address of the registrant\\n * @param operatorWithCode operator address to check\\n * @return is it filtered\\n */\\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\\n\\n /**\\n * @notice Is the code hash filtered\\n * @param registrant address of the registrant\\n * @param codeHash code hash\\n * @return is it filtered\\n */\\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\\n\\n /**\\n * @notice Get the filtered operators\\n * @param addr address to check\\n * @return filtered operators\\n */\\n function filteredOperators(address addr) external returns (address[] memory);\\n\\n /**\\n * @notice Get the filtered code hashes\\n * @param addr address to check\\n * @return filtered code hashes\\n */\\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\\n\\n /**\\n * @notice Get a specific operator\\n * @param registrant address of the registrant\\n * @param index index to check\\n * @return address of the operator\\n */\\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\\n\\n /**\\n * @notice Get the ith filtered code hash\\n * @param registrant address of the registrant\\n * @param index index to check\\n * @return the code hash\\n */\\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\\n\\n /**\\n * @notice Is the address registered\\n * @param addr address to check\\n * @return is it registered\\n */\\n function isRegistered(address addr) external returns (bool);\\n\\n /**\\n * @notice Get the code hash for this address\\n * @param addr address to check\\n * @return the code hash\\n */\\n function codeHashOf(address addr) external returns (bytes32);\\n}\\n\",\"keccak256\":\"0xe399bf85460967b797bd4d2250b0b6ccbfd1188d3c843e2f29147f8061fc1c8e\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610692806100206000396000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c8063b0ccc31e11610050578063b0ccc31e146100cc578063f2fde38b146100e1578063f9c0611c146100f457610072565b8063715018a6146100775780638129fc1c146100815780638da5cb5b14610089575b600080fd5b61007f61010f565b005b61007f610187565b60335473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6100a36daaeb6d7670e522a718067333cd4e81565b61007f6100ef366004610621565b610325565b6100a3733cc6cdda760b79bafa08df41ecfa224f810dceb681565b60335473ffffffffffffffffffffffffffffffffffffffff16331461017b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b610185600061041a565b565b600054610100900460ff166101a25760005460ff16156101a6565b303b155b6102185760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610172565b600054610100900460ff1615801561026157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0061ff0019909116610100171660011790555b6daaeb6d7670e522a718067333cd4e3b15610308576040517fa0af2903000000000000000000000000000000000000000000000000000000008152306004820152733cc6cdda760b79bafa08df41ecfa224f810dceb660248201526daaeb6d7670e522a718067333cd4e9063a0af290390604401600060405180830381600087803b1580156102ef57600080fd5b505af1158015610303573d6000803e3d6000fd5b505050505b610310610491565b8015610322576000805461ff00191690555b50565b60335473ffffffffffffffffffffffffffffffffffffffff16331461038c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610172565b73ffffffffffffffffffffffffffffffffffffffff81166104155760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610172565b610322815b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661050e5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610172565b61051661051e565b61018561059b565b600054610100900460ff166101855760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610172565b600054610100900460ff166106185760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610172565b6101853361041a565b600060208284031215610632578081fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610655578182fd5b939250505056fea2646970667358221220935c1184430e8217311d76c7de8dec2610b36997ed0e7acc61e8def1405705da64736f6c63430008020033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100725760003560e01c8063b0ccc31e11610050578063b0ccc31e146100cc578063f2fde38b146100e1578063f9c0611c146100f457610072565b8063715018a6146100775780638129fc1c146100815780638da5cb5b14610089575b600080fd5b61007f61010f565b005b61007f610187565b60335473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6100a36daaeb6d7670e522a718067333cd4e81565b61007f6100ef366004610621565b610325565b6100a3733cc6cdda760b79bafa08df41ecfa224f810dceb681565b60335473ffffffffffffffffffffffffffffffffffffffff16331461017b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b610185600061041a565b565b600054610100900460ff166101a25760005460ff16156101a6565b303b155b6102185760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610172565b600054610100900460ff1615801561026157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0061ff0019909116610100171660011790555b6daaeb6d7670e522a718067333cd4e3b15610308576040517fa0af2903000000000000000000000000000000000000000000000000000000008152306004820152733cc6cdda760b79bafa08df41ecfa224f810dceb660248201526daaeb6d7670e522a718067333cd4e9063a0af290390604401600060405180830381600087803b1580156102ef57600080fd5b505af1158015610303573d6000803e3d6000fd5b505050505b610310610491565b8015610322576000805461ff00191690555b50565b60335473ffffffffffffffffffffffffffffffffffffffff16331461038c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610172565b73ffffffffffffffffffffffffffffffffffffffff81166104155760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610172565b610322815b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661050e5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610172565b61051661051e565b61018561059b565b600054610100900460ff166101855760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610172565b600054610100900460ff166106185760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610172565b6101853361041a565b600060208284031215610632578081fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610655578182fd5b939250505056fea2646970667358221220935c1184430e8217311d76c7de8dec2610b36997ed0e7acc61e8def1405705da64736f6c63430008020033", + "devdoc": { + "custom:experimental": "This is an experimental contract. There could be future changes according to the change in the requirements", + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "title": "OperatorFilterSubription", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "notice": "This contract is ment to register and copy the default subscription of the openSea for the operator filter and our Token contract are supposed to subscribe to This contract on openSea operator filter registry", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 10217, + "contract": "src/solc_0.8/OperatorFilterer/contracts/OperatorFilterRegistrant.sol:OperatorFilterSubscription", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 10220, + "contract": "src/solc_0.8/OperatorFilterer/contracts/OperatorFilterRegistrant.sol:OperatorFilterSubscription", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 12276, + "contract": "src/solc_0.8/OperatorFilterer/contracts/OperatorFilterRegistrant.sol:OperatorFilterSubscription", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 9994, + "contract": "src/solc_0.8/OperatorFilterer/contracts/OperatorFilterRegistrant.sol:OperatorFilterSubscription", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 10108, + "contract": "src/solc_0.8/OperatorFilterer/contracts/OperatorFilterRegistrant.sol:OperatorFilterSubscription", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/packages/core/deployments/polygon/PolygonOperatorFilterSubscription_Proxy.json b/packages/core/deployments/polygon/PolygonOperatorFilterSubscription_Proxy.json new file mode 100644 index 0000000000..e1c231f524 --- /dev/null +++ b/packages/core/deployments/polygon/PolygonOperatorFilterSubscription_Proxy.json @@ -0,0 +1,250 @@ +{ + "address": "0x31F74dc99528895b56823a00f5c7D71C30416683", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "initialLogic", + "type": "address" + }, + { + "internalType": "address", + "name": "initialAdmin", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xf7209261013bbd940ada5d8d4c48164b569e78571b0c6d683087a75e9d08addd", + "receipt": { + "to": null, + "from": "0x7074BB056C53ACC0b6091dd3FAe591aa3A4acC88", + "contractAddress": "0x31F74dc99528895b56823a00f5c7D71C30416683", + "transactionIndex": 57, + "gasUsed": "626517", + "logsBloom": "0x0000000000000000000000000000000000000020080000000080000050000000000000000000000000000000000000000000a000000000000000000000040000000080000000000000000000000000800001000000040000000140000000000000000000020000000000000000000800000000000000000080000000000100400000000001000000000000000000000000000000000000000000000000000000200000000000000100000000000010000000000000000000000000000000004000000000004000000001000000000200000000000000000100100000000060000000080000000000100000000000000000000800000000200000000000100000", + "blockHash": "0x432ff97db8e5c1c8779b48591b16c71d52236e43c4a6a6e4d10842e9a22b600e", + "transactionHash": "0xf7209261013bbd940ada5d8d4c48164b569e78571b0c6d683087a75e9d08addd", + "logs": [ + { + "transactionIndex": 57, + "blockNumber": 45783599, + "transactionHash": "0xf7209261013bbd940ada5d8d4c48164b569e78571b0c6d683087a75e9d08addd", + "address": "0x000000000000AAeB6D7670E522A718067333cd4E", + "topics": [ + "0x86d03f430c7616021073d7a71766f632f1ce19f289aa989534d9f4732253eb59", + "0x00000000000000000000000031f74dc99528895b56823a00f5c7d71c30416683", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 660, + "blockHash": "0x432ff97db8e5c1c8779b48591b16c71d52236e43c4a6a6e4d10842e9a22b600e" + }, + { + "transactionIndex": 57, + "blockNumber": 45783599, + "transactionHash": "0xf7209261013bbd940ada5d8d4c48164b569e78571b0c6d683087a75e9d08addd", + "address": "0x31F74dc99528895b56823a00f5c7D71C30416683", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007074bb056c53acc0b6091dd3fae591aa3a4acc88" + ], + "data": "0x", + "logIndex": 661, + "blockHash": "0x432ff97db8e5c1c8779b48591b16c71d52236e43c4a6a6e4d10842e9a22b600e" + }, + { + "transactionIndex": 57, + "blockNumber": 45783599, + "transactionHash": "0xf7209261013bbd940ada5d8d4c48164b569e78571b0c6d683087a75e9d08addd", + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x0000000000000000000000007074bb056c53acc0b6091dd3fae591aa3a4acc88", + "0x000000000000000000000000b9ede6f94d192073d8eaf85f8db677133d483249" + ], + "data": "0x000000000000000000000000000000000000000000000000000248b80908a13800000000000000000000000000000000000000000000000129b95ea19504021600000000000000000000000000000000000000000000011fbd0f5bc10f871e5400000000000000000000000000000000000000000000000129b715e98bfb60de00000000000000000000000000000000000000000000011fbd11a479188fbf8c", + "logIndex": 662, + "blockHash": "0x432ff97db8e5c1c8779b48591b16c71d52236e43c4a6a6e4d10842e9a22b600e" + } + ], + "blockNumber": 45783599, + "cumulativeGasUsed": "18690298", + "status": 1, + "byzantium": true + }, + "args": [ + "0x6598Ebbd50221fDEF2ACF3a666Bf3EE826156204", + "0x29BeE877F756952cC810c0cF93bF0fC2bF036Fdb", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "1635d55d57a0a2552952c0d22586ed23", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialLogic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAdmin\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\",\"events\":{\"AdminChanged(address,address)\":{\"details\":\"Emitted when the admin account has changed.\"}},\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"stateVariables\":{\"_ADMIN_SLOT\":{\"details\":\"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.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.7/openzeppelin/proxy/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.7/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n * \\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n * \\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal virtual view returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n * \\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {\\n }\\n}\\n\",\"keccak256\":\"0xc33f9858a67e34c77831163d5611d21fc627dfd2c303806a98a6c9db5a01b034\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./UpgradeableProxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n * \\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n * \\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n * \\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n * \\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is UpgradeableProxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\\n */\\n constructor(address initialLogic, address initialAdmin, bytes memory _data) payable UpgradeableProxy(initialLogic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _setAdmin(initialAdmin);\\n }\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _admin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n * \\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address) {\\n return _admin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n * \\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address) {\\n return _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n * \\n * Emits an {AdminChanged} event.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external ifAdmin {\\n require(newAdmin != address(0), \\\"TransparentUpgradeableProxy: new admin is the zero address\\\");\\n emit AdminChanged(_admin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeTo(newImplementation);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n * \\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeTo(newImplementation);\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = newImplementation.delegatecall(data);\\n require(success);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view returns (address adm) {\\n bytes32 slot = _ADMIN_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n adm := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n bytes32 slot = _ADMIN_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newAdmin)\\n }\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal override virtual {\\n require(msg.sender != _admin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xd6cecbe00dc78355aff1a16d83487bb73c54701004d61a2e48cdb81e2bcacc26\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/UpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Proxy.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n * \\n * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see\\n * {TransparentUpgradeableProxy}.\\n */\\ncontract UpgradeableProxy is Proxy {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n * \\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _setImplementation(_logic);\\n if(_data.length > 0) {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = _logic.delegatecall(_data);\\n require(success);\\n }\\n }\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal override view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Upgrades the proxy to a new implementation.\\n * \\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"UpgradeableProxy: new implementation is not a contract\\\");\\n\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newImplementation)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd68f4c11941712db79a61b9dca81a5db663cfacec3d7bb19f8d2c23bb1ab8afe\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\\n // for accounts without code, i.e. `keccak256('')`\\n bytes32 codehash;\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { codehash := extcodehash(account) }\\n return (codehash != accountHash && codehash != 0x0);\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return _functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n return _functionCallWithValue(target, data, value, errorMessage);\\n }\\n\\n function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x698f929f1097637d051976b322a2d532c27df022b09010e8d091e2888a5ebdf8\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051610aaa380380610aaa8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101bf565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b6101b782610231565b505050610291565b6101d28161025560201b6104bb1760201c565b61020d5760405162461bcd60e51b8152600401808060200182810382526036815260200180610a746036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061028957508115155b949350505050565b6107d4806102a06000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104f7565b6101ed6101e861058b565b6105b0565b565b6101f76105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105f9565b610240565b6102406101d5565b50565b61024b6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105f9565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b60006103216105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61058b565b905061036b565b61036b6101d5565b90565b6103766105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806106ed603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e6105d4565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610646565b60006104806105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c6105d4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104ef57508115155b949350505050565b6104ff6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061075d6042913960600191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105cf573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106028161066a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610673816104bb565b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806107276036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a2646970667358221220b141ef72de179b8b56cef31601d40ff2875391088197e73cac39eba1ddcd0fdd64736f6c634300070600335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104f7565b6101ed6101e861058b565b6105b0565b565b6101f76105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105f9565b610240565b6102406101d5565b50565b61024b6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105f9565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b60006103216105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61058b565b905061036b565b61036b6101d5565b90565b6103766105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806106ed603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e6105d4565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610646565b60006104806105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c6105d4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104ef57508115155b949350505050565b6104ff6105d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061075d6042913960600191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105cf573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106028161066a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610673816104bb565b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806107276036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a2646970667358221220b141ef72de179b8b56cef31601d40ff2875391088197e73cac39eba1ddcd0fdd64736f6c63430007060033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.", + "events": { + "AdminChanged(address,address)": { + "details": "Emitted when the admin account has changed." + } + }, + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. 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`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. 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`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "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. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "stateVariables": { + "_ADMIN_SLOT": { + "details": "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." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/core/deployments/polygon/solcInputs/e1aa5651f7645b1641ef34120369a942.json b/packages/core/deployments/polygon/solcInputs/e1aa5651f7645b1641ef34120369a942.json new file mode 100644 index 0000000000..ba21e467b8 --- /dev/null +++ b/packages/core/deployments/polygon/solcInputs/e1aa5651f7645b1641ef34120369a942.json @@ -0,0 +1,905 @@ +{ + "language": "Solidity", + "sources": { + "@maticnetwork/fx-portal/contracts/lib/ExitPayloadReader.sol": { + "content": "pragma solidity ^0.8.0;\n\nimport {RLPReader} from \"./RLPReader.sol\";\n\nlibrary ExitPayloadReader {\n using RLPReader for bytes;\n using RLPReader for RLPReader.RLPItem;\n\n uint8 constant WORD_SIZE = 32;\n\n struct ExitPayload {\n RLPReader.RLPItem[] data;\n }\n\n struct Receipt {\n RLPReader.RLPItem[] data;\n bytes raw;\n uint256 logIndex;\n }\n\n struct Log {\n RLPReader.RLPItem data;\n RLPReader.RLPItem[] list;\n }\n\n struct LogTopics {\n RLPReader.RLPItem[] data;\n }\n\n // copy paste of private copy() from RLPReader to avoid changing of existing contracts\n function copy(\n uint256 src,\n uint256 dest,\n uint256 len\n ) private pure {\n if (len == 0) return;\n\n // copy as many word sizes as possible\n for (; len >= WORD_SIZE; len -= WORD_SIZE) {\n assembly {\n mstore(dest, mload(src))\n }\n\n src += WORD_SIZE;\n dest += WORD_SIZE;\n }\n \n if (len == 0) return;\n\n // left over bytes. Mask is used to remove unwanted bytes from the word\n uint256 mask = 256**(WORD_SIZE - len) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask)) // zero out src\n let destpart := and(mload(dest), mask) // retrieve the bytes\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n function toExitPayload(bytes memory data) internal pure returns (ExitPayload memory) {\n RLPReader.RLPItem[] memory payloadData = data.toRlpItem().toList();\n\n return ExitPayload(payloadData);\n }\n\n function getHeaderNumber(ExitPayload memory payload) internal pure returns (uint256) {\n return payload.data[0].toUint();\n }\n\n function getBlockProof(ExitPayload memory payload) internal pure returns (bytes memory) {\n return payload.data[1].toBytes();\n }\n\n function getBlockNumber(ExitPayload memory payload) internal pure returns (uint256) {\n return payload.data[2].toUint();\n }\n\n function getBlockTime(ExitPayload memory payload) internal pure returns (uint256) {\n return payload.data[3].toUint();\n }\n\n function getTxRoot(ExitPayload memory payload) internal pure returns (bytes32) {\n return bytes32(payload.data[4].toUint());\n }\n\n function getReceiptRoot(ExitPayload memory payload) internal pure returns (bytes32) {\n return bytes32(payload.data[5].toUint());\n }\n\n function getReceipt(ExitPayload memory payload) internal pure returns (Receipt memory receipt) {\n receipt.raw = payload.data[6].toBytes();\n RLPReader.RLPItem memory receiptItem = receipt.raw.toRlpItem();\n\n if (receiptItem.isList()) {\n // legacy tx\n receipt.data = receiptItem.toList();\n } else {\n // pop first byte before parsting receipt\n bytes memory typedBytes = receipt.raw;\n bytes memory result = new bytes(typedBytes.length - 1);\n uint256 srcPtr;\n uint256 destPtr;\n assembly {\n srcPtr := add(33, typedBytes)\n destPtr := add(0x20, result)\n }\n\n copy(srcPtr, destPtr, result.length);\n receipt.data = result.toRlpItem().toList();\n }\n\n receipt.logIndex = getReceiptLogIndex(payload);\n return receipt;\n }\n\n function getReceiptProof(ExitPayload memory payload) internal pure returns (bytes memory) {\n return payload.data[7].toBytes();\n }\n\n function getBranchMaskAsBytes(ExitPayload memory payload) internal pure returns (bytes memory) {\n return payload.data[8].toBytes();\n }\n\n function getBranchMaskAsUint(ExitPayload memory payload) internal pure returns (uint256) {\n return payload.data[8].toUint();\n }\n\n function getReceiptLogIndex(ExitPayload memory payload) internal pure returns (uint256) {\n return payload.data[9].toUint();\n }\n\n // Receipt methods\n function toBytes(Receipt memory receipt) internal pure returns (bytes memory) {\n return receipt.raw;\n }\n\n function getLog(Receipt memory receipt) internal pure returns (Log memory) {\n RLPReader.RLPItem memory logData = receipt.data[3].toList()[receipt.logIndex];\n return Log(logData, logData.toList());\n }\n\n // Log methods\n function getEmitter(Log memory log) internal pure returns (address) {\n return RLPReader.toAddress(log.list[0]);\n }\n\n function getTopics(Log memory log) internal pure returns (LogTopics memory) {\n return LogTopics(log.list[1].toList());\n }\n\n function getData(Log memory log) internal pure returns (bytes memory) {\n return log.list[2].toBytes();\n }\n\n function toRlpBytes(Log memory log) internal pure returns (bytes memory) {\n return log.data.toRlpBytes();\n }\n\n // LogTopics methods\n function getField(LogTopics memory topics, uint256 index) internal pure returns (RLPReader.RLPItem memory) {\n return topics.data[index];\n }\n}\n" + }, + "@maticnetwork/fx-portal/contracts/lib/Merkle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary Merkle {\n function checkMembership(\n bytes32 leaf,\n uint256 index,\n bytes32 rootHash,\n bytes memory proof\n ) internal pure returns (bool) {\n require(proof.length % 32 == 0, \"Invalid proof length\");\n uint256 proofHeight = proof.length / 32;\n // Proof of size n means, height of the tree is n+1.\n // In a tree of height n+1, max #leafs possible is 2 ^ n\n require(index < 2**proofHeight, \"Leaf index is too big\");\n\n bytes32 proofElement;\n bytes32 computedHash = leaf;\n for (uint256 i = 32; i <= proof.length; i += 32) {\n assembly {\n proofElement := mload(add(proof, i))\n }\n\n if (index % 2 == 0) {\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\n } else {\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\n }\n\n index = index / 2;\n }\n return computedHash == rootHash;\n }\n}\n" + }, + "@maticnetwork/fx-portal/contracts/lib/MerklePatriciaProof.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {RLPReader} from \"./RLPReader.sol\";\n\nlibrary MerklePatriciaProof {\n /*\n * @dev Verifies a merkle patricia proof.\n * @param value The terminating value in the trie.\n * @param encodedPath The path in the trie leading to value.\n * @param rlpParentNodes The rlp encoded stack of nodes.\n * @param root The root hash of the trie.\n * @return The boolean validity of the proof.\n */\n function verify(\n bytes memory value,\n bytes memory encodedPath,\n bytes memory rlpParentNodes,\n bytes32 root\n ) internal pure returns (bool) {\n RLPReader.RLPItem memory item = RLPReader.toRlpItem(rlpParentNodes);\n RLPReader.RLPItem[] memory parentNodes = RLPReader.toList(item);\n\n bytes memory currentNode;\n RLPReader.RLPItem[] memory currentNodeList;\n\n bytes32 nodeKey = root;\n uint256 pathPtr = 0;\n\n bytes memory path = _getNibbleArray(encodedPath);\n if (path.length == 0) {\n return false;\n }\n\n for (uint256 i = 0; i < parentNodes.length; i++) {\n if (pathPtr > path.length) {\n return false;\n }\n\n currentNode = RLPReader.toRlpBytes(parentNodes[i]);\n if (nodeKey != keccak256(currentNode)) {\n return false;\n }\n currentNodeList = RLPReader.toList(parentNodes[i]);\n\n if (currentNodeList.length == 17) {\n if (pathPtr == path.length) {\n if (keccak256(RLPReader.toBytes(currentNodeList[16])) == keccak256(value)) {\n return true;\n } else {\n return false;\n }\n }\n\n uint8 nextPathNibble = uint8(path[pathPtr]);\n if (nextPathNibble > 16) {\n return false;\n }\n nodeKey = bytes32(RLPReader.toUintStrict(currentNodeList[nextPathNibble]));\n pathPtr += 1;\n } else if (currentNodeList.length == 2) {\n uint256 traversed = _nibblesToTraverse(RLPReader.toBytes(currentNodeList[0]), path, pathPtr);\n if (pathPtr + traversed == path.length) {\n //leaf node\n if (keccak256(RLPReader.toBytes(currentNodeList[1])) == keccak256(value)) {\n return true;\n } else {\n return false;\n }\n }\n\n //extension node\n if (traversed == 0) {\n return false;\n }\n\n pathPtr += traversed;\n nodeKey = bytes32(RLPReader.toUintStrict(currentNodeList[1]));\n } else {\n return false;\n }\n }\n }\n\n function _nibblesToTraverse(\n bytes memory encodedPartialPath,\n bytes memory path,\n uint256 pathPtr\n ) private pure returns (uint256) {\n uint256 len = 0;\n // encodedPartialPath has elements that are each two hex characters (1 byte), but partialPath\n // and slicedPath have elements that are each one hex character (1 nibble)\n bytes memory partialPath = _getNibbleArray(encodedPartialPath);\n bytes memory slicedPath = new bytes(partialPath.length);\n\n // pathPtr counts nibbles in path\n // partialPath.length is a number of nibbles\n for (uint256 i = pathPtr; i < pathPtr + partialPath.length; i++) {\n bytes1 pathNibble = path[i];\n slicedPath[i - pathPtr] = pathNibble;\n }\n\n if (keccak256(partialPath) == keccak256(slicedPath)) {\n len = partialPath.length;\n } else {\n len = 0;\n }\n return len;\n }\n\n // bytes b must be hp encoded\n function _getNibbleArray(bytes memory b) internal pure returns (bytes memory) {\n bytes memory nibbles = \"\";\n if (b.length > 0) {\n uint8 offset;\n uint8 hpNibble = uint8(_getNthNibbleOfBytes(0, b));\n if (hpNibble == 1 || hpNibble == 3) {\n nibbles = new bytes(b.length * 2 - 1);\n bytes1 oddNibble = _getNthNibbleOfBytes(1, b);\n nibbles[0] = oddNibble;\n offset = 1;\n } else {\n nibbles = new bytes(b.length * 2 - 2);\n offset = 0;\n }\n\n for (uint256 i = offset; i < nibbles.length; i++) {\n nibbles[i] = _getNthNibbleOfBytes(i - offset + 2, b);\n }\n }\n return nibbles;\n }\n\n function _getNthNibbleOfBytes(uint256 n, bytes memory str) private pure returns (bytes1) {\n return bytes1(n % 2 == 0 ? uint8(str[n / 2]) / 0x10 : uint8(str[n / 2]) % 0x10);\n }\n}\n" + }, + "@maticnetwork/fx-portal/contracts/lib/RLPReader.sol": { + "content": "/*\n * @author Hamdi Allam hamdi.allam97@gmail.com\n * Please reach out with any questions or concerns\n */\npragma solidity ^0.8.0;\n\nlibrary RLPReader {\n uint8 constant STRING_SHORT_START = 0x80;\n uint8 constant STRING_LONG_START = 0xb8;\n uint8 constant LIST_SHORT_START = 0xc0;\n uint8 constant LIST_LONG_START = 0xf8;\n uint8 constant WORD_SIZE = 32;\n\n struct RLPItem {\n uint256 len;\n uint256 memPtr;\n }\n\n struct Iterator {\n RLPItem item; // Item that's being iterated over.\n uint256 nextPtr; // Position of the next item in the list.\n }\n\n /*\n * @dev Returns the next element in the iteration. Reverts if it has not next element.\n * @param self The iterator.\n * @return The next element in the iteration.\n */\n function next(Iterator memory self) internal pure returns (RLPItem memory) {\n require(hasNext(self));\n\n uint256 ptr = self.nextPtr;\n uint256 itemLength = _itemLength(ptr);\n self.nextPtr = ptr + itemLength;\n\n return RLPItem(itemLength, ptr);\n }\n\n /*\n * @dev Returns true if the iteration has more elements.\n * @param self The iterator.\n * @return true if the iteration has more elements.\n */\n function hasNext(Iterator memory self) internal pure returns (bool) {\n RLPItem memory item = self.item;\n return self.nextPtr < item.memPtr + item.len;\n }\n\n /*\n * @param item RLP encoded bytes\n */\n function toRlpItem(bytes memory item) internal pure returns (RLPItem memory) {\n uint256 memPtr;\n assembly {\n memPtr := add(item, 0x20)\n }\n\n return RLPItem(item.length, memPtr);\n }\n\n /*\n * @dev Create an iterator. Reverts if item is not a list.\n * @param self The RLP item.\n * @return An 'Iterator' over the item.\n */\n function iterator(RLPItem memory self) internal pure returns (Iterator memory) {\n require(isList(self));\n\n uint256 ptr = self.memPtr + _payloadOffset(self.memPtr);\n return Iterator(self, ptr);\n }\n\n /*\n * @param item RLP encoded bytes\n */\n function rlpLen(RLPItem memory item) internal pure returns (uint256) {\n return item.len;\n }\n\n /*\n * @param item RLP encoded bytes\n */\n function payloadLen(RLPItem memory item) internal pure returns (uint256) {\n return item.len - _payloadOffset(item.memPtr);\n }\n\n /*\n * @param item RLP encoded list in bytes\n */\n function toList(RLPItem memory item) internal pure returns (RLPItem[] memory) {\n require(isList(item));\n\n uint256 items = numItems(item);\n RLPItem[] memory result = new RLPItem[](items);\n\n uint256 memPtr = item.memPtr + _payloadOffset(item.memPtr);\n uint256 dataLen;\n for (uint256 i = 0; i < items; i++) {\n dataLen = _itemLength(memPtr);\n result[i] = RLPItem(dataLen, memPtr);\n memPtr = memPtr + dataLen;\n }\n\n return result;\n }\n\n // @return indicator whether encoded payload is a list. negate this function call for isData.\n function isList(RLPItem memory item) internal pure returns (bool) {\n if (item.len == 0) return false;\n\n uint8 byte0;\n uint256 memPtr = item.memPtr;\n assembly {\n byte0 := byte(0, mload(memPtr))\n }\n\n if (byte0 < LIST_SHORT_START) return false;\n return true;\n }\n\n /*\n * @dev A cheaper version of keccak256(toRlpBytes(item)) that avoids copying memory.\n * @return keccak256 hash of RLP encoded bytes.\n */\n function rlpBytesKeccak256(RLPItem memory item) internal pure returns (bytes32) {\n uint256 ptr = item.memPtr;\n uint256 len = item.len;\n bytes32 result;\n assembly {\n result := keccak256(ptr, len)\n }\n return result;\n }\n\n function payloadLocation(RLPItem memory item) internal pure returns (uint256, uint256) {\n uint256 offset = _payloadOffset(item.memPtr);\n uint256 memPtr = item.memPtr + offset;\n uint256 len = item.len - offset; // data length\n return (memPtr, len);\n }\n\n /*\n * @dev A cheaper version of keccak256(toBytes(item)) that avoids copying memory.\n * @return keccak256 hash of the item payload.\n */\n function payloadKeccak256(RLPItem memory item) internal pure returns (bytes32) {\n (uint256 memPtr, uint256 len) = payloadLocation(item);\n bytes32 result;\n assembly {\n result := keccak256(memPtr, len)\n }\n return result;\n }\n\n /** RLPItem conversions into data types **/\n\n // @returns raw rlp encoding in bytes\n function toRlpBytes(RLPItem memory item) internal pure returns (bytes memory) {\n bytes memory result = new bytes(item.len);\n if (result.length == 0) return result;\n\n uint256 ptr;\n assembly {\n ptr := add(0x20, result)\n }\n\n copy(item.memPtr, ptr, item.len);\n return result;\n }\n\n // any non-zero byte is considered true\n function toBoolean(RLPItem memory item) internal pure returns (bool) {\n require(item.len == 1);\n uint256 result;\n uint256 memPtr = item.memPtr;\n assembly {\n result := byte(0, mload(memPtr))\n }\n\n return result == 0 ? false : true;\n }\n\n function toAddress(RLPItem memory item) internal pure returns (address) {\n // 1 byte for the length prefix\n require(item.len == 21);\n\n return address(uint160(toUint(item)));\n }\n\n function toUint(RLPItem memory item) internal pure returns (uint256) {\n require(item.len > 0 && item.len <= 33);\n\n uint256 offset = _payloadOffset(item.memPtr);\n uint256 len = item.len - offset;\n\n uint256 result;\n uint256 memPtr = item.memPtr + offset;\n assembly {\n result := mload(memPtr)\n\n // shfit to the correct location if neccesary\n if lt(len, 32) {\n result := div(result, exp(256, sub(32, len)))\n }\n }\n\n return result;\n }\n\n // enforces 32 byte length\n function toUintStrict(RLPItem memory item) internal pure returns (uint256) {\n // one byte prefix\n require(item.len == 33);\n\n uint256 result;\n uint256 memPtr = item.memPtr + 1;\n assembly {\n result := mload(memPtr)\n }\n\n return result;\n }\n\n function toBytes(RLPItem memory item) internal pure returns (bytes memory) {\n require(item.len > 0);\n\n uint256 offset = _payloadOffset(item.memPtr);\n uint256 len = item.len - offset; // data length\n bytes memory result = new bytes(len);\n\n uint256 destPtr;\n assembly {\n destPtr := add(0x20, result)\n }\n\n copy(item.memPtr + offset, destPtr, len);\n return result;\n }\n\n /*\n * Private Helpers\n */\n\n // @return number of payload items inside an encoded list.\n function numItems(RLPItem memory item) private pure returns (uint256) {\n if (item.len == 0) return 0;\n\n uint256 count = 0;\n uint256 currPtr = item.memPtr + _payloadOffset(item.memPtr);\n uint256 endPtr = item.memPtr + item.len;\n while (currPtr < endPtr) {\n currPtr = currPtr + _itemLength(currPtr); // skip over an item\n count++;\n }\n\n return count;\n }\n\n // @return entire rlp item byte length\n function _itemLength(uint256 memPtr) private pure returns (uint256) {\n uint256 itemLen;\n uint256 byte0;\n assembly {\n byte0 := byte(0, mload(memPtr))\n }\n\n if (byte0 < STRING_SHORT_START) itemLen = 1;\n else if (byte0 < STRING_LONG_START) itemLen = byte0 - STRING_SHORT_START + 1;\n else if (byte0 < LIST_SHORT_START) {\n assembly {\n let byteLen := sub(byte0, 0xb7) // # of bytes the actual length is\n memPtr := add(memPtr, 1) // skip over the first byte\n /* 32 byte word size */\n let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to get the len\n itemLen := add(dataLen, add(byteLen, 1))\n }\n } else if (byte0 < LIST_LONG_START) {\n itemLen = byte0 - LIST_SHORT_START + 1;\n } else {\n assembly {\n let byteLen := sub(byte0, 0xf7)\n memPtr := add(memPtr, 1)\n\n let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to the correct length\n itemLen := add(dataLen, add(byteLen, 1))\n }\n }\n\n return itemLen;\n }\n\n // @return number of bytes until the data\n function _payloadOffset(uint256 memPtr) private pure returns (uint256) {\n uint256 byte0;\n assembly {\n byte0 := byte(0, mload(memPtr))\n }\n\n if (byte0 < STRING_SHORT_START) return 0;\n else if (byte0 < STRING_LONG_START || (byte0 >= LIST_SHORT_START && byte0 < LIST_LONG_START)) return 1;\n else if (byte0 < LIST_SHORT_START)\n // being explicit\n return byte0 - (STRING_LONG_START - 1) + 1;\n else return byte0 - (LIST_LONG_START - 1) + 1;\n }\n\n /*\n * @param src Pointer to source\n * @param dest Pointer to destination\n * @param len Amount of memory to copy from the source\n */\n function copy(\n uint256 src,\n uint256 dest,\n uint256 len\n ) private pure {\n if (len == 0) return;\n\n // copy as many word sizes as possible\n for (; len >= WORD_SIZE; len -= WORD_SIZE) {\n assembly {\n mstore(dest, mload(src))\n }\n\n src += WORD_SIZE;\n dest += WORD_SIZE;\n }\n\n if (len == 0) return;\n\n // left over bytes. Mask is used to remove unwanted bytes from the word\n uint256 mask = 256**(WORD_SIZE - len) - 1;\n\n assembly {\n let srcpart := and(mload(src), not(mask)) // zero out src\n let destpart := and(mload(dest), mask) // retrieve the bytes\n mstore(dest, or(destpart, srcpart))\n }\n }\n}\n" + }, + "@maticnetwork/fx-portal/contracts/tunnel/FxBaseChildTunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n// IFxMessageProcessor represents interface to process message\ninterface IFxMessageProcessor {\n function processMessageFromRoot(\n uint256 stateId,\n address rootMessageSender,\n bytes calldata data\n ) external;\n}\n\n/**\n * @notice Mock child tunnel contract to receive and send message from L2\n */\nabstract contract FxBaseChildTunnel is IFxMessageProcessor {\n // MessageTunnel on L1 will get data from this event\n event MessageSent(bytes message);\n\n // fx child\n address public fxChild;\n\n // fx root tunnel\n address public fxRootTunnel;\n\n constructor(address _fxChild) {\n fxChild = _fxChild;\n }\n\n // Sender must be fxRootTunnel in case of ERC20 tunnel\n modifier validateSender(address sender) {\n require(sender == fxRootTunnel, \"FxBaseChildTunnel: INVALID_SENDER_FROM_ROOT\");\n _;\n }\n\n // set fxRootTunnel if not set already\n function setFxRootTunnel(address _fxRootTunnel) external virtual {\n require(fxRootTunnel == address(0x0), \"FxBaseChildTunnel: ROOT_TUNNEL_ALREADY_SET\");\n fxRootTunnel = _fxRootTunnel;\n }\n\n function processMessageFromRoot(\n uint256 stateId,\n address rootMessageSender,\n bytes calldata data\n ) external override {\n require(msg.sender == fxChild, \"FxBaseChildTunnel: INVALID_SENDER\");\n _processMessageFromRoot(stateId, rootMessageSender, data);\n }\n\n /**\n * @notice Emit message that can be received on Root Tunnel\n * @dev Call the internal function when need to emit message\n * @param message bytes message that will be sent to Root Tunnel\n * some message examples -\n * abi.encode(tokenId);\n * abi.encode(tokenId, tokenMetadata);\n * abi.encode(messageType, messageData);\n */\n function _sendMessageToRoot(bytes memory message) internal {\n emit MessageSent(message);\n }\n\n /**\n * @notice Process message received from Root Tunnel\n * @dev function needs to be implemented to handle message as per requirement\n * This is called by onStateReceive function.\n * Since it is called via a system call, any event will not be emitted during its execution.\n * @param stateId unique state id\n * @param sender root message sender\n * @param message bytes message that was sent from Root Tunnel\n */\n function _processMessageFromRoot(\n uint256 stateId,\n address sender,\n bytes memory message\n ) internal virtual;\n}\n" + }, + "@maticnetwork/fx-portal/contracts/tunnel/FxBaseRootTunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {RLPReader} from \"../lib/RLPReader.sol\";\nimport {MerklePatriciaProof} from \"../lib/MerklePatriciaProof.sol\";\nimport {Merkle} from \"../lib/Merkle.sol\";\nimport \"../lib/ExitPayloadReader.sol\";\n\ninterface IFxStateSender {\n function sendMessageToChild(address _receiver, bytes calldata _data) external;\n}\n\ncontract ICheckpointManager {\n struct HeaderBlock {\n bytes32 root;\n uint256 start;\n uint256 end;\n uint256 createdAt;\n address proposer;\n }\n\n /**\n * @notice mapping of checkpoint header numbers to block details\n * @dev These checkpoints are submited by plasma contracts\n */\n mapping(uint256 => HeaderBlock) public headerBlocks;\n}\n\nabstract contract FxBaseRootTunnel {\n using RLPReader for RLPReader.RLPItem;\n using Merkle for bytes32;\n using ExitPayloadReader for bytes;\n using ExitPayloadReader for ExitPayloadReader.ExitPayload;\n using ExitPayloadReader for ExitPayloadReader.Log;\n using ExitPayloadReader for ExitPayloadReader.LogTopics;\n using ExitPayloadReader for ExitPayloadReader.Receipt;\n\n // keccak256(MessageSent(bytes))\n bytes32 public constant SEND_MESSAGE_EVENT_SIG = 0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036;\n\n // state sender contract\n IFxStateSender public fxRoot;\n // root chain manager\n ICheckpointManager public checkpointManager;\n // child tunnel contract which receives and sends messages\n address public fxChildTunnel;\n\n // storage to avoid duplicate exits\n mapping(bytes32 => bool) public processedExits;\n\n constructor(address _checkpointManager, address _fxRoot) {\n checkpointManager = ICheckpointManager(_checkpointManager);\n fxRoot = IFxStateSender(_fxRoot);\n }\n\n // set fxChildTunnel if not set already\n function setFxChildTunnel(address _fxChildTunnel) public virtual {\n require(fxChildTunnel == address(0x0), \"FxBaseRootTunnel: CHILD_TUNNEL_ALREADY_SET\");\n fxChildTunnel = _fxChildTunnel;\n }\n\n /**\n * @notice Send bytes message to Child Tunnel\n * @param message bytes message that will be sent to Child Tunnel\n * some message examples -\n * abi.encode(tokenId);\n * abi.encode(tokenId, tokenMetadata);\n * abi.encode(messageType, messageData);\n */\n function _sendMessageToChild(bytes memory message) internal {\n fxRoot.sendMessageToChild(fxChildTunnel, message);\n }\n\n function _validateAndExtractMessage(bytes memory inputData) internal returns (bytes memory) {\n ExitPayloadReader.ExitPayload memory payload = inputData.toExitPayload();\n\n bytes memory branchMaskBytes = payload.getBranchMaskAsBytes();\n uint256 blockNumber = payload.getBlockNumber();\n // checking if exit has already been processed\n // unique exit is identified using hash of (blockNumber, branchMask, receiptLogIndex)\n bytes32 exitHash = keccak256(\n abi.encodePacked(\n blockNumber,\n // first 2 nibbles are dropped while generating nibble array\n // this allows branch masks that are valid but bypass exitHash check (changing first 2 nibbles only)\n // so converting to nibble array and then hashing it\n MerklePatriciaProof._getNibbleArray(branchMaskBytes),\n payload.getReceiptLogIndex()\n )\n );\n require(processedExits[exitHash] == false, \"FxRootTunnel: EXIT_ALREADY_PROCESSED\");\n processedExits[exitHash] = true;\n\n ExitPayloadReader.Receipt memory receipt = payload.getReceipt();\n ExitPayloadReader.Log memory log = receipt.getLog();\n\n // check child tunnel\n require(fxChildTunnel == log.getEmitter(), \"FxRootTunnel: INVALID_FX_CHILD_TUNNEL\");\n\n bytes32 receiptRoot = payload.getReceiptRoot();\n // verify receipt inclusion\n require(\n MerklePatriciaProof.verify(receipt.toBytes(), branchMaskBytes, payload.getReceiptProof(), receiptRoot),\n \"FxRootTunnel: INVALID_RECEIPT_PROOF\"\n );\n\n // verify checkpoint inclusion\n _checkBlockMembershipInCheckpoint(\n blockNumber,\n payload.getBlockTime(),\n payload.getTxRoot(),\n receiptRoot,\n payload.getHeaderNumber(),\n payload.getBlockProof()\n );\n\n ExitPayloadReader.LogTopics memory topics = log.getTopics();\n\n require(\n bytes32(topics.getField(0).toUint()) == SEND_MESSAGE_EVENT_SIG, // topic0 is event sig\n \"FxRootTunnel: INVALID_SIGNATURE\"\n );\n\n // received message data\n bytes memory message = abi.decode(log.getData(), (bytes)); // event decodes params again, so decoding bytes to get message\n return message;\n }\n\n function _checkBlockMembershipInCheckpoint(\n uint256 blockNumber,\n uint256 blockTime,\n bytes32 txRoot,\n bytes32 receiptRoot,\n uint256 headerNumber,\n bytes memory blockProof\n ) private view returns (uint256) {\n (bytes32 headerRoot, uint256 startBlock, , uint256 createdAt, ) = checkpointManager.headerBlocks(headerNumber);\n\n require(\n keccak256(abi.encodePacked(blockNumber, blockTime, txRoot, receiptRoot)).checkMembership(\n blockNumber - startBlock,\n headerRoot,\n blockProof\n ),\n \"FxRootTunnel: INVALID_HEADER\"\n );\n return createdAt;\n }\n\n /**\n * @notice receive message from L2 to L1, validated by proof\n * @dev This function verifies if the transaction actually happened on child chain\n *\n * @param inputData RLP encoded data of the reference tx containing following list of fields\n * 0 - headerNumber - Checkpoint header block number containing the reference tx\n * 1 - blockProof - Proof that the block header (in the child chain) is a leaf in the submitted merkle root\n * 2 - blockNumber - Block number containing the reference tx on child chain\n * 3 - blockTime - Reference tx block time\n * 4 - txRoot - Transactions root of block\n * 5 - receiptRoot - Receipts root of block\n * 6 - receipt - Receipt of the reference transaction\n * 7 - receiptProof - Merkle proof of the reference receipt\n * 8 - branchMask - 32 bits denoting the path of receipt in merkle tree\n * 9 - receiptLogIndex - Log Index to read from the receipt\n */\n function receiveMessage(bytes memory inputData) public virtual {\n bytes memory message = _validateAndExtractMessage(inputData);\n _processMessageFromChild(message);\n }\n\n /**\n * @notice Process message received from Child Tunnel\n * @dev function needs to be implemented to handle message as per requirement\n * This is called by onStateReceive function.\n * Since it is called via a system call, any event will not be emitted during its execution.\n * @param message bytes message that was sent from Child Tunnel\n */\n function _processMessageFromChild(bytes memory message) internal virtual;\n}\n" + }, + "@openzeppelin/contracts-0.8/access/AccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role, _msgSender());\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(uint160(account), 20),\n \" is missing role \",\n Strings.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/access/AccessControlEnumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/AccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlEnumerable.sol\";\nimport \"./AccessControl.sol\";\nimport \"../utils/structs/EnumerableSet.sol\";\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view override returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view override returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override {\n super._grantRole(role, account);\n _roleMembers[role].add(account);\n }\n\n /**\n * @dev Overload {_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override {\n super._revokeRole(role, account);\n _roleMembers[role].remove(account);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/access/IAccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts-0.8/access/IAccessControlEnumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-0.8/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/security/Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n constructor() {\n _paused = false;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n require(!paused(), \"Pausable: paused\");\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n require(paused(), \"Pausable: not paused\");\n _;\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC1155/ERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC1155.sol\";\nimport \"./IERC1155Receiver.sol\";\nimport \"./extensions/IERC1155MetadataURI.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of the basic standard multi-token.\n * See https://eips.ethereum.org/EIPS/eip-1155\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\n *\n * _Available since v3.1._\n */\ncontract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n\n // Mapping from token ID to account balances\n mapping(uint256 => mapping(address => uint256)) private _balances;\n\n // Mapping from account to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json\n string private _uri;\n\n /**\n * @dev See {_setURI}.\n */\n constructor(string memory uri_) {\n _setURI(uri_);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155MetadataURI-uri}.\n *\n * This implementation returns the same URI for *all* token types. It relies\n * on the token type ID substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * Clients calling this function must replace the `\\{id\\}` substring with the\n * actual token type ID.\n */\n function uri(uint256) public view virtual override returns (string memory) {\n return _uri;\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {\n require(account != address(0), \"ERC1155: balance query for the zero address\");\n return _balances[id][account];\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] memory accounts, uint256[] memory ids)\n public\n view\n virtual\n override\n returns (uint256[] memory)\n {\n require(accounts.length == ids.length, \"ERC1155: accounts and ids length mismatch\");\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not owner nor approved\"\n );\n _safeTransferFrom(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n _safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n\n emit TransferSingle(operator, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n }\n\n emit TransferBatch(operator, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);\n }\n\n /**\n * @dev Sets a new URI for all token types, by relying on the token type ID\n * substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * By this mechanism, any occurrence of the `\\{id\\}` substring in either the\n * URI or any of the amounts in the JSON file at said URI will be replaced by\n * clients with the token type ID.\n *\n * For example, the `https://token-cdn-domain/\\{id\\}.json` URI would be\n * interpreted by clients as\n * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\n * for token type ID 0x4cce0.\n *\n * See {uri}.\n *\n * Because these URIs cannot be meaningfully represented by the {URI} event,\n * this function emits no events.\n */\n function _setURI(string memory newuri) internal virtual {\n _uri = newuri;\n }\n\n /**\n * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _mint(\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data);\n\n _balances[id][to] += amount;\n emit TransferSingle(operator, address(0), to, id, amount);\n\n _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; i++) {\n _balances[ids[i]][to] += amounts[i];\n }\n\n emit TransferBatch(operator, address(0), to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);\n }\n\n /**\n * @dev Destroys `amount` tokens of token type `id` from `from`\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `from` must have at least `amount` tokens of token type `id`.\n */\n function _burn(\n address from,\n uint256 id,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, address(0), _asSingletonArray(id), _asSingletonArray(amount), \"\");\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n\n emit TransferSingle(operator, from, address(0), id, amount);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n */\n function _burnBatch(\n address from,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n for (uint256 i = 0; i < ids.length; i++) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n }\n\n emit TransferBatch(operator, from, address(0), ids, amounts);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits a {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC1155: setting approval status for self\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `id` and `amount` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {\n if (response != IERC1155Receiver.onERC1155Received.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (\n bytes4 response\n ) {\n if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {\n uint256[] memory array = new uint256[](1);\n array[0] = element;\n\n return array;\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC1155/extensions/ERC1155Burnable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155.sol\";\n\n/**\n * @dev Extension of {ERC1155} that allows token holders to destroy both their\n * own tokens and those that they have been approved to use.\n *\n * _Available since v3.1._\n */\nabstract contract ERC1155Burnable is ERC1155 {\n function burn(\n address account,\n uint256 id,\n uint256 value\n ) public virtual {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _burn(account, id, value);\n }\n\n function burnBatch(\n address account,\n uint256[] memory ids,\n uint256[] memory values\n ) public virtual {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _burnBatch(account, ids, values);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC1155/extensions/ERC1155Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155.sol\";\nimport \"../../../security/Pausable.sol\";\n\n/**\n * @dev ERC1155 token with pausable token transfers, minting and burning.\n *\n * Useful for scenarios such as preventing trades until the end of an evaluation\n * period, or having an emergency switch for freezing all token transfers in the\n * event of a large bug.\n *\n * _Available since v3.1._\n */\nabstract contract ERC1155Pausable is ERC1155, Pausable {\n /**\n * @dev See {ERC1155-_beforeTokenTransfer}.\n *\n * Requirements:\n *\n * - the contract must not be paused.\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n require(!paused(), \"ERC1155Pausable: token transfer while paused\");\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n @dev Handles the receipt of a single ERC1155 token type. This function is\n called at the end of a `safeTransferFrom` after the balance has been updated.\n To accept the transfer, this must return\n `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n (i.e. 0xf23a6e61, or its own function selector).\n @param operator The address which initiated the transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param id The ID of the token being transferred\n @param value The amount of tokens being transferred\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n @dev Handles the receipt of a multiple ERC1155 token types. This function\n is called at the end of a `safeBatchTransferFrom` after the balances have\n been updated. To accept the transfer(s), this must return\n `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n (i.e. 0xbc197c81, or its own function selector).\n @param operator The address which initiated the batch transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param ids An array containing ids of each token being transferred (order and length must match values array)\n @param values An array containing amounts of each token being transferred (order and length must match ids array)\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC1155/presets/ERC1155PresetMinterPauser.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/presets/ERC1155PresetMinterPauser.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155.sol\";\nimport \"../extensions/ERC1155Burnable.sol\";\nimport \"../extensions/ERC1155Pausable.sol\";\nimport \"../../../access/AccessControlEnumerable.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @dev {ERC1155} token, including:\n *\n * - ability for holders to burn (destroy) their tokens\n * - a minter role that allows for token minting (creation)\n * - a pauser role that allows to stop all token transfers\n *\n * This contract uses {AccessControl} to lock permissioned functions using the\n * different roles - head to its documentation for details.\n *\n * The account that deploys the contract will be granted the minter and pauser\n * roles, as well as the default admin role, which will let it grant both minter\n * and pauser roles to other accounts.\n */\ncontract ERC1155PresetMinterPauser is Context, AccessControlEnumerable, ERC1155Burnable, ERC1155Pausable {\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant PAUSER_ROLE = keccak256(\"PAUSER_ROLE\");\n\n /**\n * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE`, and `PAUSER_ROLE` to the account that\n * deploys the contract.\n */\n constructor(string memory uri) ERC1155(uri) {\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n\n _setupRole(MINTER_ROLE, _msgSender());\n _setupRole(PAUSER_ROLE, _msgSender());\n }\n\n /**\n * @dev Creates `amount` new tokens for `to`, of token type `id`.\n *\n * See {ERC1155-_mint}.\n *\n * Requirements:\n *\n * - the caller must have the `MINTER_ROLE`.\n */\n function mint(\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual {\n require(hasRole(MINTER_ROLE, _msgSender()), \"ERC1155PresetMinterPauser: must have minter role to mint\");\n\n _mint(to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] variant of {mint}.\n */\n function mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual {\n require(hasRole(MINTER_ROLE, _msgSender()), \"ERC1155PresetMinterPauser: must have minter role to mint\");\n\n _mintBatch(to, ids, amounts, data);\n }\n\n /**\n * @dev Pauses all token transfers.\n *\n * See {ERC1155Pausable} and {Pausable-_pause}.\n *\n * Requirements:\n *\n * - the caller must have the `PAUSER_ROLE`.\n */\n function pause() public virtual {\n require(hasRole(PAUSER_ROLE, _msgSender()), \"ERC1155PresetMinterPauser: must have pauser role to pause\");\n _pause();\n }\n\n /**\n * @dev Unpauses all token transfers.\n *\n * See {ERC1155Pausable} and {Pausable-_unpause}.\n *\n * Requirements:\n *\n * - the caller must have the `PAUSER_ROLE`.\n */\n function unpause() public virtual {\n require(hasRole(PAUSER_ROLE, _msgSender()), \"ERC1155PresetMinterPauser: must have pauser role to unpause\");\n _unpause();\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(AccessControlEnumerable, ERC1155)\n returns (bool)\n {\n return super.supportsInterface(interfaceId);\n }\n\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override(ERC1155, ERC1155Pausable) {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC1155/utils/ERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Receiver.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: balance query for the zero address\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"ERC721: owner query for nonexistent token\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n require(_exists(tokenId), \"ERC721Metadata: URI query for nonexistent token\");\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overriden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n require(_exists(tokenId), \"ERC721: approved query for nonexistent token\");\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n _safeTransfer(from, to, tokenId, _data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `_data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, _data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n require(_exists(tokenId), \"ERC721: operator query for nonexistent token\");\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, _data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Clear approvals\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer of token that is not own\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits a {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits a {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param _data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC721/extensions/ERC721Burnable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @title ERC721 Burnable Token\n * @dev ERC721 Token that can be irreversibly burned (destroyed).\n */\nabstract contract ERC721Burnable is Context, ERC721 {\n /**\n * @dev Burns `tokenId`. See {ERC721-_burn}.\n *\n * Requirements:\n *\n * - The caller must own `tokenId` or be an approved operator.\n */\n function burn(uint256 tokenId) public virtual {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721Burnable: caller is not owner nor approved\");\n _burn(tokenId);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC721/extensions/ERC721Enumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721.sol\";\nimport \"./IERC721Enumerable.sol\";\n\n/**\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\n * enumerability of all the token ids in the contract as well as all token ids owned by each\n * account.\n */\nabstract contract ERC721Enumerable is ERC721, IERC721Enumerable {\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {\n return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721.balanceOf(owner), \"ERC721Enumerable: owner index out of bounds\");\n return _ownedTokens[owner][index];\n }\n\n /**\n * @dev See {IERC721Enumerable-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721Enumerable.totalSupply(), \"ERC721Enumerable: global index out of bounds\");\n return _allTokens[index];\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, tokenId);\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = ERC721.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n }\n\n // This also deletes the contents at the last position of the array\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\n */\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = _allTokens.length - 1;\n uint256 tokenIndex = _allTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\n uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n\n // This also deletes the contents at the last position of the array\n delete _allTokensIndex[tokenId];\n _allTokens.pop();\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC721/extensions/ERC721Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721.sol\";\nimport \"../../../security/Pausable.sol\";\n\n/**\n * @dev ERC721 token with pausable token transfers, minting and burning.\n *\n * Useful for scenarios such as preventing trades until the end of an evaluation\n * period, or having an emergency switch for freezing all token transfers in the\n * event of a large bug.\n */\nabstract contract ERC721Pausable is ERC721, Pausable {\n /**\n * @dev See {ERC721-_beforeTokenTransfer}.\n *\n * Requirements:\n *\n * - the contract must not be paused.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, tokenId);\n\n require(!paused(), \"ERC721Pausable: token transfer while paused\");\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC721/extensions/IERC721Enumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Enumerable is IERC721 {\n /**\n * @dev Returns the total amount of tokens stored by the contract.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);\n\n /**\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n * Use along with {totalSupply} to enumerate all tokens.\n */\n function tokenByIndex(uint256 index) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-0.8/token/ERC721/presets/ERC721PresetMinterPauserAutoId.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/presets/ERC721PresetMinterPauserAutoId.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721.sol\";\nimport \"../extensions/ERC721Enumerable.sol\";\nimport \"../extensions/ERC721Burnable.sol\";\nimport \"../extensions/ERC721Pausable.sol\";\nimport \"../../../access/AccessControlEnumerable.sol\";\nimport \"../../../utils/Context.sol\";\nimport \"../../../utils/Counters.sol\";\n\n/**\n * @dev {ERC721} token, including:\n *\n * - ability for holders to burn (destroy) their tokens\n * - a minter role that allows for token minting (creation)\n * - a pauser role that allows to stop all token transfers\n * - token ID and URI autogeneration\n *\n * This contract uses {AccessControl} to lock permissioned functions using the\n * different roles - head to its documentation for details.\n *\n * The account that deploys the contract will be granted the minter and pauser\n * roles, as well as the default admin role, which will let it grant both minter\n * and pauser roles to other accounts.\n */\ncontract ERC721PresetMinterPauserAutoId is\n Context,\n AccessControlEnumerable,\n ERC721Enumerable,\n ERC721Burnable,\n ERC721Pausable\n{\n using Counters for Counters.Counter;\n\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant PAUSER_ROLE = keccak256(\"PAUSER_ROLE\");\n\n Counters.Counter private _tokenIdTracker;\n\n string private _baseTokenURI;\n\n /**\n * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the\n * account that deploys the contract.\n *\n * Token URIs will be autogenerated based on `baseURI` and their token IDs.\n * See {ERC721-tokenURI}.\n */\n constructor(\n string memory name,\n string memory symbol,\n string memory baseTokenURI\n ) ERC721(name, symbol) {\n _baseTokenURI = baseTokenURI;\n\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n\n _setupRole(MINTER_ROLE, _msgSender());\n _setupRole(PAUSER_ROLE, _msgSender());\n }\n\n function _baseURI() internal view virtual override returns (string memory) {\n return _baseTokenURI;\n }\n\n /**\n * @dev Creates a new token for `to`. Its token ID will be automatically\n * assigned (and available on the emitted {IERC721-Transfer} event), and the token\n * URI autogenerated based on the base URI passed at construction.\n *\n * See {ERC721-_mint}.\n *\n * Requirements:\n *\n * - the caller must have the `MINTER_ROLE`.\n */\n function mint(address to) public virtual {\n require(hasRole(MINTER_ROLE, _msgSender()), \"ERC721PresetMinterPauserAutoId: must have minter role to mint\");\n\n // We cannot just use balanceOf to create the new tokenId because tokens\n // can be burned (destroyed), so we need a separate counter.\n _mint(to, _tokenIdTracker.current());\n _tokenIdTracker.increment();\n }\n\n /**\n * @dev Pauses all token transfers.\n *\n * See {ERC721Pausable} and {Pausable-_pause}.\n *\n * Requirements:\n *\n * - the caller must have the `PAUSER_ROLE`.\n */\n function pause() public virtual {\n require(hasRole(PAUSER_ROLE, _msgSender()), \"ERC721PresetMinterPauserAutoId: must have pauser role to pause\");\n _pause();\n }\n\n /**\n * @dev Unpauses all token transfers.\n *\n * See {ERC721Pausable} and {Pausable-_unpause}.\n *\n * Requirements:\n *\n * - the caller must have the `PAUSER_ROLE`.\n */\n function unpause() public virtual {\n require(hasRole(PAUSER_ROLE, _msgSender()), \"ERC721PresetMinterPauserAutoId: must have pauser role to unpause\");\n _unpause();\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual override(ERC721, ERC721Enumerable, ERC721Pausable) {\n super._beforeTokenTransfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(AccessControlEnumerable, ERC721, ERC721Enumerable)\n returns (bool)\n {\n return super.supportsInterface(interfaceId);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/Counters.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary Counters {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/cryptography/draft-EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712 {\n /* solhint-disable var-name-mixedcase */\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n // invalidate the cached domain separator if the chain id changes.\n bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;\n uint256 private immutable _CACHED_CHAIN_ID;\n address private immutable _CACHED_THIS;\n\n bytes32 private immutable _HASHED_NAME;\n bytes32 private immutable _HASHED_VERSION;\n bytes32 private immutable _TYPE_HASH;\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n constructor(string memory name, string memory version) {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n bytes32 typeHash = keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n );\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n _CACHED_CHAIN_ID = block.chainid;\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n _CACHED_THIS = address(this);\n _TYPE_HASH = typeHash;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\n return _CACHED_DOMAIN_SEPARATOR;\n } else {\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n }\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s;\n uint8 v;\n assembly {\n s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\n v := add(shr(255, vs), 27)\n }\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/cryptography/MerkleProof.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Trees proofs.\n *\n * The proofs can be generated using the JavaScript library\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\n *\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n if (computedHash <= proofElement) {\n // Hash(current computed hash + current element of the proof)\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\n } else {\n // Hash(current element of the proof + current computed hash)\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\n }\n }\n return computedHash;\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" + }, + "@openzeppelin/contracts-0.8/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n function __AccessControl_init() internal onlyInitializing {\n __Context_init_unchained();\n __ERC165_init_unchained();\n __AccessControl_init_unchained();\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\n }\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role, _msgSender());\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(uint160(account), 20),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Context_init_unchained();\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/metatx/ERC2771ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (metatx/ERC2771Context.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Context variant with ERC2771 support.\n */\nabstract contract ERC2771ContextUpgradeable is Initializable, ContextUpgradeable {\n address private _trustedForwarder;\n\n function __ERC2771Context_init(address trustedForwarder) internal onlyInitializing {\n __Context_init_unchained();\n __ERC2771Context_init_unchained(trustedForwarder);\n }\n\n function __ERC2771Context_init_unchained(address trustedForwarder) internal onlyInitializing {\n _trustedForwarder = trustedForwarder;\n }\n\n function isTrustedForwarder(address forwarder) public view virtual returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n function _msgSender() internal view virtual override returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return super._msgSender();\n }\n }\n\n function _msgData() internal view virtual override returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender)) {\n return msg.data[:msg.data.length - 20];\n } else {\n return super._msgData();\n }\n }\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the\n * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() initializer {}\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n */\n bool private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Modifier to protect an initializer function from being invoked twice.\n */\n modifier initializer() {\n // If the contract is initializing we ignore whether _initialized is set in order to support multiple\n // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the\n // contract may have been reentered.\n require(_initializing ? _isConstructor() : !_initialized, \"Initializable: contract is already initialized\");\n\n bool isTopLevelCall = !_initializing;\n if (isTopLevelCall) {\n _initializing = true;\n _initialized = true;\n }\n\n _;\n\n if (isTopLevelCall) {\n _initializing = false;\n }\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} modifier, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n function _isConstructor() private view returns (bool) {\n return !AddressUpgradeable.isContract(address(this));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal onlyInitializing {\n __Context_init_unchained();\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal onlyInitializing {\n _paused = false;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n require(!paused(), \"Pausable: paused\");\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n require(paused(), \"Pausable: not paused\");\n _;\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __Context_init_unchained();\n __ERC165_init_unchained();\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: balance query for the zero address\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"ERC721: owner query for nonexistent token\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n require(_exists(tokenId), \"ERC721Metadata: URI query for nonexistent token\");\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overriden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n require(_exists(tokenId), \"ERC721: approved query for nonexistent token\");\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n _safeTransfer(from, to, tokenId, _data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `_data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, _data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n require(_exists(tokenId), \"ERC721: operator query for nonexistent token\");\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, _data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Clear approvals\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer of token that is not own\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits a {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits a {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param _data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n uint256[44] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"./IERC721EnumerableUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\n * enumerability of all the token ids in the contract as well as all token ids owned by each\n * account.\n */\nabstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {\n function __ERC721Enumerable_init() internal onlyInitializing {\n __Context_init_unchained();\n __ERC165_init_unchained();\n __ERC721Enumerable_init_unchained();\n }\n\n function __ERC721Enumerable_init_unchained() internal onlyInitializing {\n }\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) {\n return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721Upgradeable.balanceOf(owner), \"ERC721Enumerable: owner index out of bounds\");\n return _ownedTokens[owner][index];\n }\n\n /**\n * @dev See {IERC721Enumerable-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721EnumerableUpgradeable.totalSupply(), \"ERC721Enumerable: global index out of bounds\");\n return _allTokens[index];\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, tokenId);\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = ERC721Upgradeable.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n }\n\n // This also deletes the contents at the last position of the array\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\n */\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = _allTokens.length - 1;\n uint256 tokenIndex = _allTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\n uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n\n // This also deletes the contents at the last position of the array\n delete _allTokensIndex[tokenId];\n _allTokens.pop();\n }\n uint256[46] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721EnumerableUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the total amount of tokens stored by the contract.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);\n\n /**\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n * Use along with {totalSupply} to enumerate all tokens.\n */\n function tokenByIndex(uint256 index) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n __Context_init_unchained();\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712Upgradeable is Initializable {\n /* solhint-disable var-name-mixedcase */\n bytes32 private _HASHED_NAME;\n bytes32 private _HASHED_VERSION;\n bytes32 private constant _TYPE_HASH = keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash());\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712NameHash() internal virtual view returns (bytes32) {\n return _HASHED_NAME;\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712VersionHash() internal virtual view returns (bytes32) {\n return _HASHED_VERSION;\n }\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s;\n uint8 v;\n assembly {\n s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\n v := add(shr(255, vs), 27)\n }\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n __ERC165_init_unchained();\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" + }, + "fx-portal/contracts/lib/ExitPayloadReader.sol": { + "content": "pragma solidity ^0.8.0;\n\nimport { RLPReader } from \"./RLPReader.sol\";\n\nlibrary ExitPayloadReader {\n using RLPReader for bytes;\n using RLPReader for RLPReader.RLPItem;\n\n uint8 constant WORD_SIZE = 32;\n\n struct ExitPayload {\n RLPReader.RLPItem[] data;\n }\n\n struct Receipt {\n RLPReader.RLPItem[] data;\n bytes raw;\n uint256 logIndex;\n }\n\n struct Log {\n RLPReader.RLPItem data;\n RLPReader.RLPItem[] list;\n }\n\n struct LogTopics {\n RLPReader.RLPItem[] data;\n }\n\n // copy paste of private copy() from RLPReader to avoid changing of existing contracts\n function copy(uint src, uint dest, uint len) private pure {\n if (len == 0) return;\n\n // copy as many word sizes as possible\n for (; len >= WORD_SIZE; len -= WORD_SIZE) {\n assembly {\n mstore(dest, mload(src))\n }\n\n src += WORD_SIZE;\n dest += WORD_SIZE;\n }\n\n // left over bytes. Mask is used to remove unwanted bytes from the word\n uint mask = 256 ** (WORD_SIZE - len) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask)) // zero out src\n let destpart := and(mload(dest), mask) // retrieve the bytes\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n function toExitPayload(bytes memory data)\n internal\n pure\n returns (ExitPayload memory)\n {\n RLPReader.RLPItem[] memory payloadData = data\n .toRlpItem()\n .toList();\n\n return ExitPayload(payloadData);\n }\n\n function getHeaderNumber(ExitPayload memory payload) internal pure returns(uint256) {\n return payload.data[0].toUint();\n }\n\n function getBlockProof(ExitPayload memory payload) internal pure returns(bytes memory) {\n return payload.data[1].toBytes();\n }\n\n function getBlockNumber(ExitPayload memory payload) internal pure returns(uint256) {\n return payload.data[2].toUint();\n }\n\n function getBlockTime(ExitPayload memory payload) internal pure returns(uint256) {\n return payload.data[3].toUint();\n }\n\n function getTxRoot(ExitPayload memory payload) internal pure returns(bytes32) {\n return bytes32(payload.data[4].toUint());\n }\n\n function getReceiptRoot(ExitPayload memory payload) internal pure returns(bytes32) {\n return bytes32(payload.data[5].toUint());\n }\n\n function getReceipt(ExitPayload memory payload) internal pure returns(Receipt memory receipt) {\n receipt.raw = payload.data[6].toBytes();\n RLPReader.RLPItem memory receiptItem = receipt.raw.toRlpItem();\n\n if (receiptItem.isList()) {\n // legacy tx\n receipt.data = receiptItem.toList();\n } else {\n // pop first byte before parsting receipt\n bytes memory typedBytes = receipt.raw;\n bytes memory result = new bytes(typedBytes.length - 1);\n uint256 srcPtr;\n uint256 destPtr;\n assembly {\n srcPtr := add(33, typedBytes)\n destPtr := add(0x20, result)\n }\n\n copy(srcPtr, destPtr, result.length);\n receipt.data = result.toRlpItem().toList();\n }\n\n receipt.logIndex = getReceiptLogIndex(payload);\n return receipt;\n }\n\n function getReceiptProof(ExitPayload memory payload) internal pure returns(bytes memory) {\n return payload.data[7].toBytes();\n }\n\n function getBranchMaskAsBytes(ExitPayload memory payload) internal pure returns(bytes memory) {\n return payload.data[8].toBytes();\n }\n\n function getBranchMaskAsUint(ExitPayload memory payload) internal pure returns(uint256) {\n return payload.data[8].toUint();\n }\n\n function getReceiptLogIndex(ExitPayload memory payload) internal pure returns(uint256) {\n return payload.data[9].toUint();\n }\n \n // Receipt methods\n function toBytes(Receipt memory receipt) internal pure returns(bytes memory) {\n return receipt.raw;\n }\n\n function getLog(Receipt memory receipt) internal pure returns(Log memory) {\n RLPReader.RLPItem memory logData = receipt.data[3].toList()[receipt.logIndex];\n return Log(logData, logData.toList());\n }\n\n // Log methods\n function getEmitter(Log memory log) internal pure returns(address) {\n return RLPReader.toAddress(log.list[0]);\n }\n\n function getTopics(Log memory log) internal pure returns(LogTopics memory) {\n return LogTopics(log.list[1].toList());\n }\n\n function getData(Log memory log) internal pure returns(bytes memory) {\n return log.list[2].toBytes();\n }\n\n function toRlpBytes(Log memory log) internal pure returns(bytes memory) {\n return log.data.toRlpBytes();\n }\n\n // LogTopics methods\n function getField(LogTopics memory topics, uint256 index) internal pure returns(RLPReader.RLPItem memory) {\n return topics.data[index];\n }\n}\n" + }, + "fx-portal/contracts/lib/Merkle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary Merkle {\n function checkMembership(\n bytes32 leaf,\n uint256 index,\n bytes32 rootHash,\n bytes memory proof\n ) internal pure returns (bool) {\n require(proof.length % 32 == 0, \"Invalid proof length\");\n uint256 proofHeight = proof.length / 32;\n // Proof of size n means, height of the tree is n+1.\n // In a tree of height n+1, max #leafs possible is 2 ^ n\n require(index < 2 ** proofHeight, \"Leaf index is too big\");\n\n bytes32 proofElement;\n bytes32 computedHash = leaf;\n for (uint256 i = 32; i <= proof.length; i += 32) {\n assembly {\n proofElement := mload(add(proof, i))\n }\n\n if (index % 2 == 0) {\n computedHash = keccak256(\n abi.encodePacked(computedHash, proofElement)\n );\n } else {\n computedHash = keccak256(\n abi.encodePacked(proofElement, computedHash)\n );\n }\n\n index = index / 2;\n }\n return computedHash == rootHash;\n }\n}\n" + }, + "fx-portal/contracts/lib/MerklePatriciaProof.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {RLPReader} from \"./RLPReader.sol\";\n\nlibrary MerklePatriciaProof {\n /*\n * @dev Verifies a merkle patricia proof.\n * @param value The terminating value in the trie.\n * @param encodedPath The path in the trie leading to value.\n * @param rlpParentNodes The rlp encoded stack of nodes.\n * @param root The root hash of the trie.\n * @return The boolean validity of the proof.\n */\n function verify(\n bytes memory value,\n bytes memory encodedPath,\n bytes memory rlpParentNodes,\n bytes32 root\n ) internal pure returns (bool) {\n RLPReader.RLPItem memory item = RLPReader.toRlpItem(rlpParentNodes);\n RLPReader.RLPItem[] memory parentNodes = RLPReader.toList(item);\n\n bytes memory currentNode;\n RLPReader.RLPItem[] memory currentNodeList;\n\n bytes32 nodeKey = root;\n uint256 pathPtr = 0;\n\n bytes memory path = _getNibbleArray(encodedPath);\n if (path.length == 0) {\n return false;\n }\n\n for (uint256 i = 0; i < parentNodes.length; i++) {\n if (pathPtr > path.length) {\n return false;\n }\n\n currentNode = RLPReader.toRlpBytes(parentNodes[i]);\n if (nodeKey != keccak256(currentNode)) {\n return false;\n }\n currentNodeList = RLPReader.toList(parentNodes[i]);\n\n if (currentNodeList.length == 17) {\n if (pathPtr == path.length) {\n if (\n keccak256(RLPReader.toBytes(currentNodeList[16])) ==\n keccak256(value)\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n uint8 nextPathNibble = uint8(path[pathPtr]);\n if (nextPathNibble > 16) {\n return false;\n }\n nodeKey = bytes32(\n RLPReader.toUintStrict(currentNodeList[nextPathNibble])\n );\n pathPtr += 1;\n } else if (currentNodeList.length == 2) {\n uint256 traversed = _nibblesToTraverse(\n RLPReader.toBytes(currentNodeList[0]),\n path,\n pathPtr\n );\n if (pathPtr + traversed == path.length) {\n //leaf node\n if (\n keccak256(RLPReader.toBytes(currentNodeList[1])) ==\n keccak256(value)\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n //extension node\n if (traversed == 0) {\n return false;\n }\n\n pathPtr += traversed;\n nodeKey = bytes32(RLPReader.toUintStrict(currentNodeList[1]));\n } else {\n return false;\n }\n }\n }\n\n function _nibblesToTraverse(\n bytes memory encodedPartialPath,\n bytes memory path,\n uint256 pathPtr\n ) private pure returns (uint256) {\n uint256 len = 0;\n // encodedPartialPath has elements that are each two hex characters (1 byte), but partialPath\n // and slicedPath have elements that are each one hex character (1 nibble)\n bytes memory partialPath = _getNibbleArray(encodedPartialPath);\n bytes memory slicedPath = new bytes(partialPath.length);\n\n // pathPtr counts nibbles in path\n // partialPath.length is a number of nibbles\n for (uint256 i = pathPtr; i < pathPtr + partialPath.length; i++) {\n bytes1 pathNibble = path[i];\n slicedPath[i - pathPtr] = pathNibble;\n }\n\n if (keccak256(partialPath) == keccak256(slicedPath)) {\n len = partialPath.length;\n } else {\n len = 0;\n }\n return len;\n }\n\n // bytes b must be hp encoded\n function _getNibbleArray(bytes memory b)\n internal\n pure\n returns (bytes memory)\n {\n bytes memory nibbles = \"\";\n if (b.length > 0) {\n uint8 offset;\n uint8 hpNibble = uint8(_getNthNibbleOfBytes(0, b));\n if (hpNibble == 1 || hpNibble == 3) {\n nibbles = new bytes(b.length * 2 - 1);\n bytes1 oddNibble = _getNthNibbleOfBytes(1, b);\n nibbles[0] = oddNibble;\n offset = 1;\n } else {\n nibbles = new bytes(b.length * 2 - 2);\n offset = 0;\n }\n\n for (uint256 i = offset; i < nibbles.length; i++) {\n nibbles[i] = _getNthNibbleOfBytes(i - offset + 2, b);\n }\n }\n return nibbles;\n }\n\n function _getNthNibbleOfBytes(uint256 n, bytes memory str)\n private\n pure\n returns (bytes1)\n {\n return\n bytes1(\n n % 2 == 0 ? uint8(str[n / 2]) / 0x10 : uint8(str[n / 2]) % 0x10\n );\n }\n}" + }, + "fx-portal/contracts/lib/RLPReader.sol": { + "content": "/*\n* @author Hamdi Allam hamdi.allam97@gmail.com\n* Please reach out with any questions or concerns\n*/\npragma solidity ^0.8.0;\n\nlibrary RLPReader {\n uint8 constant STRING_SHORT_START = 0x80;\n uint8 constant STRING_LONG_START = 0xb8;\n uint8 constant LIST_SHORT_START = 0xc0;\n uint8 constant LIST_LONG_START = 0xf8;\n uint8 constant WORD_SIZE = 32;\n\n struct RLPItem {\n uint len;\n uint memPtr;\n }\n\n struct Iterator {\n RLPItem item; // Item that's being iterated over.\n uint nextPtr; // Position of the next item in the list.\n }\n\n /*\n * @dev Returns the next element in the iteration. Reverts if it has not next element.\n * @param self The iterator.\n * @return The next element in the iteration.\n */\n function next(Iterator memory self) internal pure returns (RLPItem memory) {\n require(hasNext(self));\n\n uint ptr = self.nextPtr;\n uint itemLength = _itemLength(ptr);\n self.nextPtr = ptr + itemLength;\n\n return RLPItem(itemLength, ptr);\n }\n\n /*\n * @dev Returns true if the iteration has more elements.\n * @param self The iterator.\n * @return true if the iteration has more elements.\n */\n function hasNext(Iterator memory self) internal pure returns (bool) {\n RLPItem memory item = self.item;\n return self.nextPtr < item.memPtr + item.len;\n }\n\n /*\n * @param item RLP encoded bytes\n */\n function toRlpItem(bytes memory item) internal pure returns (RLPItem memory) {\n uint memPtr;\n assembly {\n memPtr := add(item, 0x20)\n }\n\n return RLPItem(item.length, memPtr);\n }\n\n /*\n * @dev Create an iterator. Reverts if item is not a list.\n * @param self The RLP item.\n * @return An 'Iterator' over the item.\n */\n function iterator(RLPItem memory self) internal pure returns (Iterator memory) {\n require(isList(self));\n\n uint ptr = self.memPtr + _payloadOffset(self.memPtr);\n return Iterator(self, ptr);\n }\n\n /*\n * @param item RLP encoded bytes\n */\n function rlpLen(RLPItem memory item) internal pure returns (uint) {\n return item.len;\n }\n\n /*\n * @param item RLP encoded bytes\n */\n function payloadLen(RLPItem memory item) internal pure returns (uint) {\n return item.len - _payloadOffset(item.memPtr);\n }\n\n /*\n * @param item RLP encoded list in bytes\n */\n function toList(RLPItem memory item) internal pure returns (RLPItem[] memory) {\n require(isList(item));\n\n uint items = numItems(item);\n RLPItem[] memory result = new RLPItem[](items);\n\n uint memPtr = item.memPtr + _payloadOffset(item.memPtr);\n uint dataLen;\n for (uint i = 0; i < items; i++) {\n dataLen = _itemLength(memPtr);\n result[i] = RLPItem(dataLen, memPtr); \n memPtr = memPtr + dataLen;\n }\n\n return result;\n }\n\n // @return indicator whether encoded payload is a list. negate this function call for isData.\n function isList(RLPItem memory item) internal pure returns (bool) {\n if (item.len == 0) return false;\n\n uint8 byte0;\n uint memPtr = item.memPtr;\n assembly {\n byte0 := byte(0, mload(memPtr))\n }\n\n if (byte0 < LIST_SHORT_START)\n return false;\n return true;\n }\n\n /*\n * @dev A cheaper version of keccak256(toRlpBytes(item)) that avoids copying memory.\n * @return keccak256 hash of RLP encoded bytes.\n */\n function rlpBytesKeccak256(RLPItem memory item) internal pure returns (bytes32) {\n uint256 ptr = item.memPtr;\n uint256 len = item.len;\n bytes32 result;\n assembly {\n result := keccak256(ptr, len)\n }\n return result;\n }\n\n function payloadLocation(RLPItem memory item) internal pure returns (uint, uint) {\n uint offset = _payloadOffset(item.memPtr);\n uint memPtr = item.memPtr + offset;\n uint len = item.len - offset; // data length\n return (memPtr, len);\n }\n\n /*\n * @dev A cheaper version of keccak256(toBytes(item)) that avoids copying memory.\n * @return keccak256 hash of the item payload.\n */\n function payloadKeccak256(RLPItem memory item) internal pure returns (bytes32) {\n (uint memPtr, uint len) = payloadLocation(item);\n bytes32 result;\n assembly {\n result := keccak256(memPtr, len)\n }\n return result;\n }\n\n /** RLPItem conversions into data types **/\n\n // @returns raw rlp encoding in bytes\n function toRlpBytes(RLPItem memory item) internal pure returns (bytes memory) {\n bytes memory result = new bytes(item.len);\n if (result.length == 0) return result;\n \n uint ptr;\n assembly {\n ptr := add(0x20, result)\n }\n\n copy(item.memPtr, ptr, item.len);\n return result;\n }\n\n // any non-zero byte is considered true\n function toBoolean(RLPItem memory item) internal pure returns (bool) {\n require(item.len == 1);\n uint result;\n uint memPtr = item.memPtr;\n assembly {\n result := byte(0, mload(memPtr))\n }\n\n return result == 0 ? false : true;\n }\n\n function toAddress(RLPItem memory item) internal pure returns (address) {\n // 1 byte for the length prefix\n require(item.len == 21);\n\n return address(uint160(toUint(item)));\n }\n\n function toUint(RLPItem memory item) internal pure returns (uint) {\n require(item.len > 0 && item.len <= 33);\n\n uint offset = _payloadOffset(item.memPtr);\n uint len = item.len - offset;\n\n uint result;\n uint memPtr = item.memPtr + offset;\n assembly {\n result := mload(memPtr)\n\n // shfit to the correct location if neccesary\n if lt(len, 32) {\n result := div(result, exp(256, sub(32, len)))\n }\n }\n\n return result;\n }\n\n // enforces 32 byte length\n function toUintStrict(RLPItem memory item) internal pure returns (uint) {\n // one byte prefix\n require(item.len == 33);\n\n uint result;\n uint memPtr = item.memPtr + 1;\n assembly {\n result := mload(memPtr)\n }\n\n return result;\n }\n\n function toBytes(RLPItem memory item) internal pure returns (bytes memory) {\n require(item.len > 0);\n\n uint offset = _payloadOffset(item.memPtr);\n uint len = item.len - offset; // data length\n bytes memory result = new bytes(len);\n\n uint destPtr;\n assembly {\n destPtr := add(0x20, result)\n }\n\n copy(item.memPtr + offset, destPtr, len);\n return result;\n }\n\n /*\n * Private Helpers\n */\n\n // @return number of payload items inside an encoded list.\n function numItems(RLPItem memory item) private pure returns (uint) {\n if (item.len == 0) return 0;\n\n uint count = 0;\n uint currPtr = item.memPtr + _payloadOffset(item.memPtr);\n uint endPtr = item.memPtr + item.len;\n while (currPtr < endPtr) {\n currPtr = currPtr + _itemLength(currPtr); // skip over an item\n count++;\n }\n\n return count;\n }\n\n // @return entire rlp item byte length\n function _itemLength(uint memPtr) private pure returns (uint) {\n uint itemLen;\n uint byte0;\n assembly {\n byte0 := byte(0, mload(memPtr))\n }\n\n if (byte0 < STRING_SHORT_START)\n itemLen = 1;\n \n else if (byte0 < STRING_LONG_START)\n itemLen = byte0 - STRING_SHORT_START + 1;\n\n else if (byte0 < LIST_SHORT_START) {\n assembly {\n let byteLen := sub(byte0, 0xb7) // # of bytes the actual length is\n memPtr := add(memPtr, 1) // skip over the first byte\n /* 32 byte word size */\n let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to get the len\n itemLen := add(dataLen, add(byteLen, 1))\n }\n }\n\n else if (byte0 < LIST_LONG_START) {\n itemLen = byte0 - LIST_SHORT_START + 1;\n } \n\n else {\n assembly {\n let byteLen := sub(byte0, 0xf7)\n memPtr := add(memPtr, 1)\n\n let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to the correct length\n itemLen := add(dataLen, add(byteLen, 1))\n }\n }\n\n return itemLen;\n }\n\n // @return number of bytes until the data\n function _payloadOffset(uint memPtr) private pure returns (uint) {\n uint byte0;\n assembly {\n byte0 := byte(0, mload(memPtr))\n }\n\n if (byte0 < STRING_SHORT_START) \n return 0;\n else if (byte0 < STRING_LONG_START || (byte0 >= LIST_SHORT_START && byte0 < LIST_LONG_START))\n return 1;\n else if (byte0 < LIST_SHORT_START) // being explicit\n return byte0 - (STRING_LONG_START - 1) + 1;\n else\n return byte0 - (LIST_LONG_START - 1) + 1;\n }\n\n /*\n * @param src Pointer to source\n * @param dest Pointer to destination\n * @param len Amount of memory to copy from the source\n */\n function copy(uint src, uint dest, uint len) private pure {\n if (len == 0) return;\n\n // copy as many word sizes as possible\n for (; len >= WORD_SIZE; len -= WORD_SIZE) {\n assembly {\n mstore(dest, mload(src))\n }\n\n src += WORD_SIZE;\n dest += WORD_SIZE;\n }\n\n if (len == 0) return;\n\n // left over bytes. Mask is used to remove unwanted bytes from the word\n uint mask = 256 ** (WORD_SIZE - len) - 1;\n\n assembly {\n let srcpart := and(mload(src), not(mask)) // zero out src\n let destpart := and(mload(dest), mask) // retrieve the bytes\n mstore(dest, or(destpart, srcpart))\n }\n }\n}\n" + }, + "fx-portal/contracts/tunnel/FxBaseChildTunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n// IFxMessageProcessor represents interface to process message\ninterface IFxMessageProcessor {\n function processMessageFromRoot(uint256 stateId, address rootMessageSender, bytes calldata data) external;\n}\n\n/**\n* @notice Mock child tunnel contract to receive and send message from L2\n*/\nabstract contract FxBaseChildTunnel is IFxMessageProcessor{\n // MessageTunnel on L1 will get data from this event\n event MessageSent(bytes message);\n\n // fx child\n address public fxChild;\n\n // fx root tunnel\n address public fxRootTunnel;\n\n constructor(address _fxChild) {\n fxChild = _fxChild;\n }\n\n // Sender must be fxRootTunnel in case of ERC20 tunnel\n modifier validateSender(address sender) {\n require(sender == fxRootTunnel, \"FxBaseChildTunnel: INVALID_SENDER_FROM_ROOT\");\n _;\n }\n\n // set fxRootTunnel if not set already\n function setFxRootTunnel(address _fxRootTunnel) external {\n require(fxRootTunnel == address(0x0), \"FxBaseChildTunnel: ROOT_TUNNEL_ALREADY_SET\");\n fxRootTunnel = _fxRootTunnel;\n }\n\n function processMessageFromRoot(uint256 stateId, address rootMessageSender, bytes calldata data) external override {\n require(msg.sender == fxChild, \"FxBaseChildTunnel: INVALID_SENDER\");\n _processMessageFromRoot(stateId, rootMessageSender, data);\n }\n\n /**\n * @notice Emit message that can be received on Root Tunnel\n * @dev Call the internal function when need to emit message\n * @param message bytes message that will be sent to Root Tunnel\n * some message examples -\n * abi.encode(tokenId);\n * abi.encode(tokenId, tokenMetadata);\n * abi.encode(messageType, messageData);\n */\n function _sendMessageToRoot(bytes memory message) internal {\n emit MessageSent(message);\n }\n\n /**\n * @notice Process message received from Root Tunnel\n * @dev function needs to be implemented to handle message as per requirement\n * This is called by onStateReceive function.\n * Since it is called via a system call, any event will not be emitted during its execution.\n * @param stateId unique state id\n * @param sender root message sender\n * @param message bytes message that was sent from Root Tunnel\n */\n function _processMessageFromRoot(uint256 stateId, address sender, bytes memory message) virtual internal;\n}\n" + }, + "fx-portal/contracts/tunnel/FxBaseRootTunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n\nimport {RLPReader} from \"../lib/RLPReader.sol\";\nimport {MerklePatriciaProof} from \"../lib/MerklePatriciaProof.sol\";\nimport {Merkle} from \"../lib/Merkle.sol\";\nimport \"../lib/ExitPayloadReader.sol\";\n\n\ninterface IFxStateSender {\n function sendMessageToChild(address _receiver, bytes calldata _data) external;\n}\n\ncontract ICheckpointManager {\n struct HeaderBlock {\n bytes32 root;\n uint256 start;\n uint256 end;\n uint256 createdAt;\n address proposer;\n }\n\n /**\n * @notice mapping of checkpoint header numbers to block details\n * @dev These checkpoints are submited by plasma contracts\n */\n mapping(uint256 => HeaderBlock) public headerBlocks;\n}\n\nabstract contract FxBaseRootTunnel {\n using RLPReader for RLPReader.RLPItem;\n using Merkle for bytes32;\n using ExitPayloadReader for bytes;\n using ExitPayloadReader for ExitPayloadReader.ExitPayload;\n using ExitPayloadReader for ExitPayloadReader.Log;\n using ExitPayloadReader for ExitPayloadReader.LogTopics;\n using ExitPayloadReader for ExitPayloadReader.Receipt;\n\n // keccak256(MessageSent(bytes))\n bytes32 public constant SEND_MESSAGE_EVENT_SIG = 0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036;\n\n // state sender contract\n IFxStateSender public fxRoot;\n // root chain manager\n ICheckpointManager public checkpointManager;\n // child tunnel contract which receives and sends messages \n address public fxChildTunnel;\n\n // storage to avoid duplicate exits\n mapping(bytes32 => bool) public processedExits;\n\n constructor(address _checkpointManager, address _fxRoot) {\n checkpointManager = ICheckpointManager(_checkpointManager);\n fxRoot = IFxStateSender(_fxRoot);\n }\n\n // set fxChildTunnel if not set already\n function setFxChildTunnel(address _fxChildTunnel) public {\n require(fxChildTunnel == address(0x0), \"FxBaseRootTunnel: CHILD_TUNNEL_ALREADY_SET\");\n fxChildTunnel = _fxChildTunnel;\n }\n\n /**\n * @notice Send bytes message to Child Tunnel\n * @param message bytes message that will be sent to Child Tunnel\n * some message examples -\n * abi.encode(tokenId);\n * abi.encode(tokenId, tokenMetadata);\n * abi.encode(messageType, messageData);\n */\n function _sendMessageToChild(bytes memory message) internal {\n fxRoot.sendMessageToChild(fxChildTunnel, message);\n }\n\n function _validateAndExtractMessage(bytes memory inputData) internal returns (bytes memory) {\n ExitPayloadReader.ExitPayload memory payload = inputData.toExitPayload();\n\n bytes memory branchMaskBytes = payload.getBranchMaskAsBytes();\n uint256 blockNumber = payload.getBlockNumber();\n // checking if exit has already been processed\n // unique exit is identified using hash of (blockNumber, branchMask, receiptLogIndex)\n bytes32 exitHash = keccak256(\n abi.encodePacked(\n blockNumber,\n // first 2 nibbles are dropped while generating nibble array\n // this allows branch masks that are valid but bypass exitHash check (changing first 2 nibbles only)\n // so converting to nibble array and then hashing it\n MerklePatriciaProof._getNibbleArray(branchMaskBytes),\n payload.getReceiptLogIndex()\n )\n );\n require(\n processedExits[exitHash] == false,\n \"FxRootTunnel: EXIT_ALREADY_PROCESSED\"\n );\n processedExits[exitHash] = true;\n\n ExitPayloadReader.Receipt memory receipt = payload.getReceipt();\n ExitPayloadReader.Log memory log = receipt.getLog();\n\n // check child tunnel\n require(fxChildTunnel == log.getEmitter(), \"FxRootTunnel: INVALID_FX_CHILD_TUNNEL\");\n\n bytes32 receiptRoot = payload.getReceiptRoot();\n // verify receipt inclusion\n require(\n MerklePatriciaProof.verify(\n receipt.toBytes(), \n branchMaskBytes, \n payload.getReceiptProof(), \n receiptRoot\n ),\n \"FxRootTunnel: INVALID_RECEIPT_PROOF\"\n );\n\n // verify checkpoint inclusion\n _checkBlockMembershipInCheckpoint(\n blockNumber,\n payload.getBlockTime(),\n payload.getTxRoot(),\n receiptRoot,\n payload.getHeaderNumber(),\n payload.getBlockProof()\n );\n\n ExitPayloadReader.LogTopics memory topics = log.getTopics();\n\n require(\n bytes32(topics.getField(0).toUint()) == SEND_MESSAGE_EVENT_SIG, // topic0 is event sig\n \"FxRootTunnel: INVALID_SIGNATURE\"\n );\n\n // received message data\n (bytes memory message) = abi.decode(log.getData(), (bytes)); // event decodes params again, so decoding bytes to get message\n return message;\n }\n\n function _checkBlockMembershipInCheckpoint(\n uint256 blockNumber,\n uint256 blockTime,\n bytes32 txRoot,\n bytes32 receiptRoot,\n uint256 headerNumber,\n bytes memory blockProof\n ) private view returns (uint256) {\n (\n bytes32 headerRoot,\n uint256 startBlock,\n ,\n uint256 createdAt,\n\n ) = checkpointManager.headerBlocks(headerNumber);\n\n require(\n keccak256(\n abi.encodePacked(blockNumber, blockTime, txRoot, receiptRoot)\n )\n .checkMembership(\n blockNumber-startBlock,\n headerRoot,\n blockProof\n ),\n \"FxRootTunnel: INVALID_HEADER\"\n );\n return createdAt;\n }\n\n /**\n * @notice receive message from L2 to L1, validated by proof\n * @dev This function verifies if the transaction actually happened on child chain\n *\n * @param inputData RLP encoded data of the reference tx containing following list of fields\n * 0 - headerNumber - Checkpoint header block number containing the reference tx\n * 1 - blockProof - Proof that the block header (in the child chain) is a leaf in the submitted merkle root\n * 2 - blockNumber - Block number containing the reference tx on child chain\n * 3 - blockTime - Reference tx block time\n * 4 - txRoot - Transactions root of block\n * 5 - receiptRoot - Receipts root of block\n * 6 - receipt - Receipt of the reference transaction\n * 7 - receiptProof - Merkle proof of the reference receipt\n * 8 - branchMask - 32 bits denoting the path of receipt in merkle tree\n * 9 - receiptLogIndex - Log Index to read from the receipt\n */\n function receiveMessage(bytes memory inputData) public virtual {\n bytes memory message = _validateAndExtractMessage(inputData);\n _processMessageFromChild(message);\n }\n\n /**\n * @notice Process message received from Child Tunnel\n * @dev function needs to be implemented to handle message as per requirement\n * This is called by onStateReceive function.\n * Since it is called via a system call, any event will not be emitted during its execution.\n * @param message bytes message that was sent from Child Tunnel\n */\n function _processMessageFromChild(bytes memory message) virtual internal;\n}\n" + }, + "src/solc_0.8/asset/AssetAttributesRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\npragma experimental ABIEncoderV2;\n\nimport \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport \"../catalyst/GemsCatalystsRegistry.sol\";\nimport \"../common/BaseWithStorage/WithAdmin.sol\";\nimport \"../common/BaseWithStorage/WithMinter.sol\";\nimport \"../common/BaseWithStorage/WithUpgrader.sol\";\n\n/// @notice Allows setting the gems and catalysts of an asset\ncontract AssetAttributesRegistry is WithMinter, WithUpgrader, IAssetAttributesRegistry, Context {\n uint256 internal constant MAX_NUM_GEMS = 15;\n uint256 private constant IS_NFT = 0x0000000000000000000000000000000000000000800000000000000000000000;\n uint256 private constant NOT_IS_NFT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFFFFFFFFFFF;\n uint256 private constant NOT_NFT_INDEX = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000007FFFFFFFFFFFFFFF;\n\n GemsCatalystsRegistry internal immutable _gemsCatalystsRegistry;\n mapping(uint256 => Record) internal _records;\n\n // used to allow migration to specify blockNumber when setting catalyst/gems\n address public migrationContract;\n // used to to set catalyst without burning actual ERC20 (cross layer deposit)\n address public overLayerDepositor;\n\n struct Record {\n uint16 catalystId; // start at 1\n uint16[MAX_NUM_GEMS] gemIds;\n }\n\n event CatalystApplied(uint256 indexed assetId, uint16 indexed catalystId, uint16[] gemIds, uint64 blockNumber);\n event GemsAdded(uint256 indexed assetId, uint16[] gemIds, uint64 blockNumber);\n\n /// @notice AssetAttributesRegistry depends on\n /// @param gemsCatalystsRegistry: GemsCatalystsRegistry for fetching attributes\n /// @param admin: for setting the migration contract address\n /// @param minter: allowed to set gems and catalysts for a given asset\n constructor(\n GemsCatalystsRegistry gemsCatalystsRegistry,\n address admin,\n address minter,\n address upgrader\n ) {\n _gemsCatalystsRegistry = gemsCatalystsRegistry;\n _admin = admin;\n _minter = minter;\n _upgrader = upgrader;\n }\n\n function getCatalystRegistry() external view override returns (address) {\n return address(_gemsCatalystsRegistry);\n }\n\n /// @notice get the record data (catalyst id, gems ids list) for an asset id\n /// @param assetId id of the asset\n function getRecord(uint256 assetId)\n external\n view\n override\n returns (\n bool exists,\n uint16 catalystId,\n uint16[] memory gemIds\n )\n {\n catalystId = _records[assetId].catalystId;\n if (catalystId == 0 && assetId & IS_NFT != 0) {\n // fallback on collection catalyst\n assetId = _getCollectionId(assetId);\n catalystId = _records[assetId].catalystId;\n }\n uint16[MAX_NUM_GEMS] memory fixedGemIds = _records[assetId].gemIds;\n exists = catalystId != 0;\n gemIds = new uint16[](MAX_NUM_GEMS);\n uint8 i = 0;\n while (fixedGemIds[i] != 0) {\n gemIds[i] = (fixedGemIds[i]);\n i++;\n }\n }\n\n /// @notice getAttributes\n /// @param assetId id of the asset\n /// @return values The array of values(256) requested.\n function getAttributes(uint256 assetId, GemEvent[] calldata events)\n external\n view\n override\n returns (uint32[] memory values)\n {\n return _gemsCatalystsRegistry.getAttributes(_records[assetId].catalystId, assetId, events);\n }\n\n /// @notice sets the catalyst and gems when an asset goes over layers\n /// @param assetId id of the asset\n /// @param catalystId id of the catalyst to set\n /// @param gemIds list of gems ids to set\n function setCatalystWhenDepositOnOtherLayer(\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds\n ) external override {\n require(\n _msgSender() == overLayerDepositor || _msgSender() == _admin,\n \"AssetAttributesRegistry: not overLayerDepositor\"\n );\n // We have to ignore all 0 gemid in case of L2 to L1 deposit\n // In this case we get gems data in a form of an array of MAX_NUM_GEMS padded with 0\n if (gemIds.length == MAX_NUM_GEMS) {\n uint256 firstZeroIndex;\n for (firstZeroIndex = 0; firstZeroIndex < gemIds.length; firstZeroIndex++) {\n if (gemIds[firstZeroIndex] == 0) {\n break;\n }\n }\n uint16[] memory gemIdsWithoutZero = new uint16[](firstZeroIndex);\n // find first 0\n for (uint256 i = 0; i < firstZeroIndex; i++) {\n gemIdsWithoutZero[i] = gemIds[i];\n }\n _setCatalyst(assetId, catalystId, gemIdsWithoutZero, _getBlockNumber(), false);\n } else {\n _setCatalyst(assetId, catalystId, gemIds, _getBlockNumber(), false);\n }\n }\n\n /// @notice sets the catalyst and gems for an asset, minter only\n /// @param assetId id of the asset\n /// @param catalystId id of the catalyst to set\n /// @param gemIds list of gems ids to set\n function setCatalyst(\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds\n ) external virtual override {\n require(_msgSender() == _minter || _msgSender() == _upgrader, \"NOT_AUTHORIZED_MINTER\");\n _setCatalyst(assetId, catalystId, gemIds, _getBlockNumber(), true);\n }\n\n /// @notice sets the catalyst and gems for an asset for a given block number, migration contract only\n /// @param assetId id of the asset\n /// @param catalystId id of the catalyst to set\n /// @param gemIds list of gems ids to set\n /// @param blockNumber block number\n function setCatalystWithBlockNumber(\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds,\n uint64 blockNumber\n ) external override {\n require(_msgSender() == migrationContract, \"NOT_AUTHORIZED_MIGRATION\");\n _setCatalyst(assetId, catalystId, gemIds, blockNumber, true);\n }\n\n /// @notice adds gems to an existing list of gems of an asset, upgrader only\n /// @param assetId id of the asset\n /// @param gemIds list of gems ids to set\n function addGems(uint256 assetId, uint16[] calldata gemIds) external virtual override {\n require(_msgSender() == _upgrader, \"NOT_AUTHORIZED_UPGRADER\");\n require(assetId & IS_NFT != 0, \"INVALID_NOT_NFT\");\n require(gemIds.length != 0, \"INVALID_GEMS_0\");\n\n uint16 catalystId = _records[assetId].catalystId;\n uint16[MAX_NUM_GEMS] memory gemIdsToStore;\n if (catalystId == 0) {\n // fallback on collection catalyst\n uint256 collectionId = _getCollectionId(assetId);\n catalystId = _records[collectionId].catalystId;\n if (catalystId != 0) {\n _records[assetId].catalystId = catalystId;\n gemIdsToStore = _records[collectionId].gemIds;\n }\n } else {\n gemIdsToStore = _records[assetId].gemIds;\n }\n\n require(catalystId != 0, \"NO_CATALYST_SET\");\n uint8 j = 0;\n uint8 i = 0;\n for (i = 0; i < MAX_NUM_GEMS; i++) {\n if (j == gemIds.length) {\n break;\n }\n if (gemIdsToStore[i] == 0) {\n require(gemIds[j] != 0, \"INVALID_GEM_ID\");\n gemIdsToStore[i] = gemIds[j];\n j++;\n }\n }\n uint8 maxGems = _gemsCatalystsRegistry.getMaxGems(catalystId);\n require(i <= maxGems, \"GEMS_TOO_MANY\");\n _records[assetId].gemIds = gemIdsToStore;\n uint64 blockNumber = _getBlockNumber();\n emit GemsAdded(assetId, gemIds, blockNumber);\n }\n\n /// @notice set the migration contract address, admin or migration contract only\n /// @param _migrationContract address of the migration contract\n function setMigrationContract(address _migrationContract) external override {\n address currentMigrationContract = migrationContract;\n if (currentMigrationContract == address(0)) {\n require(_msgSender() == _admin, \"NOT_AUTHORIZED\");\n migrationContract = _migrationContract;\n } else {\n require(_msgSender() == currentMigrationContract, \"NOT_AUTHORIZED_MIGRATION\");\n migrationContract = _migrationContract;\n }\n }\n\n /// @dev Set a catalyst for the given asset.\n /// @param assetId The asset to set a catalyst on.\n /// @param catalystId The catalyst to set.\n /// @param gemIds The gems to embed in the catalyst.\n /// @param blockNumber The blocknumber to emit in the event.\n /// @param hasToEmitEvent boolean to indicate if we want to emit an event\n function _setCatalyst(\n uint256 assetId,\n uint16 catalystId,\n uint16[] memory gemIds,\n uint64 blockNumber,\n bool hasToEmitEvent\n ) internal virtual {\n require(gemIds.length <= MAX_NUM_GEMS, \"GEMS_MAX_REACHED\");\n uint8 maxGems = _gemsCatalystsRegistry.getMaxGems(catalystId);\n require(gemIds.length <= maxGems, \"GEMS_TOO_MANY\");\n uint16[MAX_NUM_GEMS] memory gemIdsToStore;\n for (uint8 i = 0; i < gemIds.length; i++) {\n require(gemIds[i] != 0, \"INVALID_GEM_ID\");\n gemIdsToStore[i] = gemIds[i];\n }\n _records[assetId] = Record(catalystId, gemIdsToStore);\n if (hasToEmitEvent) {\n emit CatalystApplied(assetId, catalystId, gemIds, blockNumber);\n }\n }\n\n /// @dev Get the collection Id for an asset.\n /// @param assetId The asset to get the collection id for.\n /// @return The id of the collection the asset belongs to.\n function _getCollectionId(uint256 assetId) internal pure returns (uint256) {\n return assetId & NOT_NFT_INDEX & NOT_IS_NFT; // compute the same as Asset to get collectionId\n }\n\n /// @dev Get a blocknumber for use when querying attributes.\n /// @return blockNumber The current blocknumber + 1.\n function _getBlockNumber() internal view returns (uint64 blockNumber) {\n blockNumber = uint64(block.number + 1);\n }\n}\n" + }, + "src/solc_0.8/asset/AssetMinter.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport \"../common/BaseWithStorage/ERC2771Handler.sol\";\nimport \"../common/interfaces/IAssetMinter.sol\";\nimport \"../catalyst/GemsCatalystsRegistry.sol\";\nimport \"../common/interfaces/IPolygonAssetERC1155.sol\";\n\n/// @notice Allow to mint Asset with Catalyst, Gems and Sand, giving the assets attributes through AssetAttributeRegistry\ncontract AssetMinter is ERC2771Handler, IAssetMinter, Ownable {\n uint32 public numberOfGemsBurnPerAsset = 1;\n uint32 public numberOfCatalystBurnPerAsset = 1;\n\n IAssetAttributesRegistry internal immutable _registry;\n IPolygonAssetERC1155 internal immutable _assetERC1155;\n GemsCatalystsRegistry internal immutable _gemsCatalystsRegistry;\n\n mapping(uint16 => uint256) public quantitiesByCatalystId;\n mapping(uint16 => uint256) public quantitiesByAssetTypeId; // quantities for asset that don't use catalyst to burn (art, prop...)\n mapping(address => bool) public customMinterAllowance;\n\n event CustomMintingAllowanceChanged(address indexed addressModified, bool indexed isAddressCustomMintingAllowed);\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\n event QuantitiesByCatalystIdChanged(uint256 indexed id, uint256 indexed newValue);\n event QuantitiesByAssetTypeIdChanged(uint256 indexed index, uint256 indexed newValue);\n event NumberOfGemsBurnPerAssetChanged(uint256 indexed newValue);\n event NumberOfCatalystBurnPerAssetChanged(uint256 indexed newValue);\n\n /// @notice AssetMinter depends on\n /// @param registry: AssetAttributesRegistry for recording catalyst and gems used\n /// @param assetERC1155: Asset ERC1155 Token Contract\n /// @param gemsCatalystsRegistry: that track the canonical catalyst and gems and provide batch burning facility\n /// @param trustedForwarder: address of the trusted forwarder (used for metaTX)\n constructor(\n IAssetAttributesRegistry registry,\n IPolygonAssetERC1155 assetERC1155,\n GemsCatalystsRegistry gemsCatalystsRegistry,\n address admin,\n address trustedForwarder,\n uint256[] memory quantitiesByCatalystId_,\n uint256[] memory quantitiesByAssetTypeId_\n ) {\n require(address(registry) != address(0), \"AssetMinter: registry can't be zero\");\n require(address(assetERC1155) != address(0), \"AssetMinter: assetERC1155 can't be zero\");\n require(address(gemsCatalystsRegistry) != address(0), \"AssetMinter: gemsCatalystsRegistry can't be zero\");\n _registry = registry;\n _assetERC1155 = assetERC1155;\n _gemsCatalystsRegistry = gemsCatalystsRegistry;\n transferOwnership(admin);\n __ERC2771Handler_initialize(trustedForwarder);\n\n require(quantitiesByCatalystId_.length > 0, \"AssetMinter: quantitiesByCatalystID length cannot be 0\");\n require(quantitiesByAssetTypeId_.length > 0, \"AssetMinter: quantitiesByAssetTypeId length cannot be 0\");\n\n for (uint16 i = 0; i < quantitiesByCatalystId_.length; i++) {\n quantitiesByCatalystId[i + 1] = quantitiesByCatalystId_[i];\n }\n\n for (uint16 i = 0; i < quantitiesByAssetTypeId_.length; i++) {\n quantitiesByAssetTypeId[i + 1] = quantitiesByAssetTypeId_[i];\n }\n }\n\n function addOrReplaceQuantityByCatalystId(uint16 catalystId, uint256 newQuantity) external override onlyOwner {\n quantitiesByCatalystId[catalystId] = newQuantity;\n emit QuantitiesByCatalystIdChanged(catalystId, newQuantity);\n }\n\n function addOrReplaceAssetTypeQuantity(uint16 index1Based, uint256 newQuantity) external override onlyOwner {\n quantitiesByAssetTypeId[index1Based] = newQuantity;\n emit QuantitiesByAssetTypeIdChanged(index1Based, newQuantity);\n }\n\n function setNumberOfGemsBurnPerAsset(uint32 newQuantity) external override onlyOwner {\n numberOfGemsBurnPerAsset = newQuantity;\n emit NumberOfGemsBurnPerAssetChanged(newQuantity);\n }\n\n function setNumberOfCatalystsBurnPerAsset(uint32 newQuantity) external override onlyOwner {\n numberOfCatalystBurnPerAsset = newQuantity;\n emit NumberOfCatalystBurnPerAssetChanged(newQuantity);\n }\n\n function setCustomMintingAllowance(address addressToModify, bool isAddressAllowed) external override onlyOwner {\n customMinterAllowance[addressToModify] = isAddressAllowed;\n\n emit CustomMintingAllowanceChanged(addressToModify, isAddressAllowed);\n }\n\n /// @notice mint \"quantity\" number of Asset token using one catalyst.\n /// @param mintData (-from address creating the Asset, need to be the tx sender or meta tx signer.\n /// -packId unused packId that will let you predict the resulting tokenId.\n /// - metadataHash cidv1 ipfs hash of the folder where 0.json file contains the metadata.\n /// - to destination address receiving the minted tokens.\n /// - data extra data)\n /// @param catalystId Id of the Catalyst ERC20 token to burn (1, 2, 3 or 4).\n /// @param gemIds list of gem ids to burn in the catalyst.\n /// @param quantity number of token to mint\n /// @return assetId The new token Id.\n function mintCustomNumberWithCatalyst(\n MintData calldata mintData,\n uint16 catalystId,\n uint16[] calldata gemIds,\n uint256 quantity,\n uint256 _numberOfCatalystBurnPerAsset,\n uint256 _numberOfGemsBurnPerAsset\n ) external override returns (uint256 assetId) {\n require(\n customMinterAllowance[_msgSender()] == true || _msgSender() == owner(),\n \"AssetMinter: custom minting unauthorized\"\n );\n require(\n _numberOfCatalystBurnPerAsset == numberOfCatalystBurnPerAsset,\n \"AssetMinter: invalid numberOfCatalystBurnPerAsset value \"\n );\n require(\n _numberOfGemsBurnPerAsset == numberOfGemsBurnPerAsset,\n \"AssetMinter: invalid numberOfGemsBurnPerAsset value\"\n );\n assetId = _burnAndMint(mintData, catalystId, gemIds, quantity);\n }\n\n /// @notice mint \"quantity\" number of Asset token without using a catalyst.\n /// @param mintData (-from address creating the Asset, need to be the tx sender or meta tx signer.\n /// -packId unused packId that will let you predict the resulting tokenId.\n /// - metadataHash cidv1 ipfs hash of the folder where 0.json file contains the metadata.\n /// - to destination address receiving the minted tokens.\n /// - data extra data)\n /// @param quantity number of token to mint\n /// @return assetId The new token Id.\n function mintCustomNumberWithoutCatalyst(MintData calldata mintData, uint256 quantity)\n external\n override\n returns (uint256 assetId)\n {\n require(\n customMinterAllowance[_msgSender()] == true || _msgSender() == owner(),\n \"AssetMinter: custom minting unauthorized\"\n );\n _mintRequirements(mintData.from, quantity, mintData.to);\n assetId = _assetERC1155.mint(\n mintData.from,\n mintData.packId,\n mintData.metadataHash,\n quantity,\n mintData.to,\n mintData.data\n );\n }\n\n /// @notice mint one Asset token with no catalyst.\n /// @param mintData : (-from address creating the Asset, need to be the tx sender or meta tx signer.\n /// -packId unused packId that will let you predict the resulting tokenId.\n /// - metadataHash cidv1 ipfs hash of the folder where 0.json file contains the metadata.\n /// - to destination address receiving the minted tokens.\n /// - data extra data)\n /// @param typeAsset1Based (art, prop...) decide how many asset will be minted (start at 1)\n /// @return assetId The new token Id.\n function mintWithoutCatalyst(\n MintData calldata mintData,\n uint16 typeAsset1Based,\n uint256 quantity\n ) external override returns (uint256 assetId) {\n require(\n quantity == quantitiesByAssetTypeId[typeAsset1Based],\n \"AssetMinter: Invalid quantitiesByAssetType value\"\n );\n\n _mintRequirements(mintData.from, quantity, mintData.to);\n assetId = _assetERC1155.mint(\n mintData.from,\n mintData.packId,\n mintData.metadataHash,\n quantity,\n mintData.to,\n mintData.data\n );\n }\n\n /// @notice mint multiple Asset tokens using one catalyst.\n /// @param mintData : (-from address creating the Asset, need to be the tx sender or meta tx signer.\n /// -packId unused packId that will let you predict the resulting tokenId.\n /// - metadataHash cidv1 ipfs hash of the folder where 0.json file contains the metadata.\n /// - to destination address receiving the minted tokens.\n /// - data extra data)\n /// @param catalystId Id of the Catalyst ERC20 token to burn (1, 2, 3 or 4).\n /// @param gemIds list of gem ids to burn in the catalyst.\n /// @return assetId The new token Id.\n function mintWithCatalyst(\n MintData calldata mintData,\n uint16 catalystId,\n uint16[] calldata gemIds,\n uint256 quantity,\n uint256 _numberOfCatalystBurnPerAsset,\n uint256 _numberOfGemsBurnPerAsset\n ) external override returns (uint256 assetId) {\n require(quantity == quantitiesByCatalystId[catalystId], \"AssetMinter : Invalid quantitiesByCatalyst value\");\n require(\n _numberOfCatalystBurnPerAsset == numberOfCatalystBurnPerAsset,\n \"AssetMinter: invalid numberOfCatalystBurnPerAsset value\"\n );\n require(\n _numberOfGemsBurnPerAsset == numberOfGemsBurnPerAsset,\n \"AssetMinter: invalid numberOfGemsBurnPerAsset value \"\n );\n\n assetId = _burnAndMint(mintData, catalystId, gemIds, quantity);\n }\n\n /// @notice mint multiple Asset tokens.\n /// @param mintData contains (-from address creating the Asset, need to be the tx sender or meta tx signer\n /// -packId unused packId that will let you predict the resulting tokenId\n /// -metadataHash cidv1 ipfs hash of the folder where 0.json file contains the metadata)\n /// @param assets data (gems and catalyst data)\n function mintMultipleWithCatalyst(\n MintData calldata mintData,\n AssetData[] memory assets,\n uint256[] memory supplies,\n uint256 _numberOfCatalystBurnPerAsset,\n uint256 _numberOfGemsBurnPerAsset\n ) external override returns (uint256[] memory assetIds) {\n uint256 assetsLength = assets.length;\n require(assetsLength != 0, \"INVALID_0_ASSETS\");\n require(assetsLength == supplies.length, \"AssetMinter: supplies and assets length mismatch\");\n require(mintData.to != address(0), \"INVALID_TO_ZERO_ADDRESS\");\n require(\n _numberOfCatalystBurnPerAsset == numberOfCatalystBurnPerAsset,\n \"AssetMinter: invalid numberOfCatalystBurnPerAsset value\"\n );\n require(\n _numberOfGemsBurnPerAsset == numberOfGemsBurnPerAsset,\n \"AssetMinter: invalid numberOfGemsBurnPerAsset value\"\n );\n require(_msgSender() == mintData.from, \"AUTH_ACCESS_DENIED\");\n\n _handleMultipleAssetRequirements(mintData.from, assets, supplies);\n assetIds = _assetERC1155.mintMultiple(\n mintData.from,\n mintData.packId,\n mintData.metadataHash,\n supplies,\n \"\",\n mintData.to,\n mintData.data\n );\n for (uint256 i = 0; i < assetIds.length; i++) {\n require(assets[i].catalystId != 0, \"AssetMinter: catalystID can't be 0\");\n _registry.setCatalyst(assetIds[i], assets[i].catalystId, assets[i].gemIds);\n }\n return assetIds;\n }\n\n function mintMultipleWithoutCatalyst(\n MintData calldata mintData,\n uint256[] calldata supplies,\n uint16[] calldata assetTypesIds\n ) external override returns (uint256[] memory assetIds) {\n uint256 suppliesLength = supplies.length;\n require(suppliesLength != 0, \"INVALID_0_ASSETS\");\n require(suppliesLength == assetTypesIds.length, \"AssetMinter: supplies and assets length mismatch\");\n require(mintData.to != address(0), \"INVALID_TO_ZERO_ADDRESS\");\n require(_msgSender() == mintData.from, \"AUTH_ACCESS_DENIED\");\n for (uint256 i = 0; i < suppliesLength; i++) {\n require(\n supplies[i] == quantitiesByAssetTypeId[assetTypesIds[i]],\n \"AssetMinter: Invalid quantitiesByAssetType value\"\n );\n }\n assetIds = _assetERC1155.mintMultiple(\n mintData.from,\n mintData.packId,\n mintData.metadataHash,\n supplies,\n \"\",\n mintData.to,\n mintData.data\n );\n return assetIds;\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n\n emit TrustedForwarderChanged(trustedForwarder);\n }\n\n /// @dev Handler for dealing with assets when minting multiple at once.\n /// @param from The original address that signed the transaction.\n /// @param assets An array of AssetData structs to define how the total gems and catalysts are to be allocated.\n function _handleMultipleAssetRequirements(\n address from,\n AssetData[] memory assets,\n uint256[] memory supplies\n ) internal {\n uint256[] memory catalystsToBurn = new uint256[](_gemsCatalystsRegistry.getNumberOfCatalystContracts());\n uint256[] memory gemsToBurn = new uint256[](_gemsCatalystsRegistry.getNumberOfGemContracts());\n\n for (uint256 i = 0; i < assets.length; i++) {\n require(\n assets[i].catalystId > 0 && assets[i].catalystId <= catalystsToBurn.length,\n \"AssetMinter: catalystID out of bound\"\n );\n catalystsToBurn[assets[i].catalystId - 1]++;\n for (uint256 j = 0; j < assets[i].gemIds.length; j++) {\n require(\n assets[i].gemIds[j] > 0 && assets[i].gemIds[j] <= gemsToBurn.length,\n \"AssetMinter: gemId out of bound\"\n );\n gemsToBurn[assets[i].gemIds[j] - 1]++;\n }\n\n uint16 maxGems = _gemsCatalystsRegistry.getMaxGems(assets[i].catalystId);\n require(assets[i].gemIds.length <= maxGems, \"AssetMinter: too many gems\");\n require(\n supplies[i] == quantitiesByCatalystId[assets[i].catalystId],\n \"AssetMinter: Invalid quantitiesByAssetType value\"\n );\n }\n _batchBurnCatalysts(from, catalystsToBurn);\n _batchBurnGems(from, gemsToBurn);\n }\n\n /// @dev Burn a batch of catalysts in one tx.\n /// @param from The original address that signed the tx.\n /// @param catalystsQuantities An array of quantities for each type of catalyst to burn.\n function _batchBurnCatalysts(address from, uint256[] memory catalystsQuantities) internal {\n uint16[] memory ids = new uint16[](catalystsQuantities.length);\n for (uint16 i = 0; i < ids.length; i++) {\n ids[i] = i + 1;\n }\n _gemsCatalystsRegistry.batchBurnCatalysts(from, ids, _scaleCatalystQuantities(catalystsQuantities));\n }\n\n /// @dev Burn a batch of gems in one tx.\n /// @param from The original address that signed the tx.\n /// @param gemsQuantities An array of quantities for each type of gems to burn.\n function _batchBurnGems(address from, uint256[] memory gemsQuantities) internal {\n uint16[] memory ids = new uint16[](gemsQuantities.length);\n for (uint16 i = 0; i < ids.length; i++) {\n ids[i] = i + 1;\n }\n _gemsCatalystsRegistry.batchBurnGems(from, ids, _scaleGemQuantities(gemsQuantities));\n }\n\n /// @dev Burn an array of gems.\n /// @param from The original signer of the tx.\n /// @param gemIds The array of gems to burn.\n /// @param numTimes Amount of gems to burn.\n function _burnGems(\n address from,\n uint16[] memory gemIds,\n uint32 numTimes\n ) internal {\n uint256[] memory gemFactors = new uint256[](gemIds.length);\n for (uint256 i = 0; i < gemIds.length; i++) {\n gemFactors[i] = 10**(_gemsCatalystsRegistry.getGemDecimals(gemIds[i])) * numTimes;\n }\n _gemsCatalystsRegistry.batchBurnGems(from, gemIds, gemFactors);\n }\n\n /// @dev Burn a single type of catalyst.\n /// @param from The original signer of the tx.\n /// @param catalystId The type of catalyst to burn.\n /// @param numTimes Amount of catalysts of this type to burn.\n function _burnCatalyst(\n address from,\n uint16 catalystId,\n uint32 numTimes\n ) internal {\n _gemsCatalystsRegistry.burnCatalyst(\n from,\n catalystId,\n numTimes * 10**(_gemsCatalystsRegistry.getCatalystDecimals(catalystId))\n );\n }\n\n /// @dev Scale up each number in an array of quantities by a factor of gemsUnits.\n /// @param quantities The array of numbers to scale.\n /// @return scaledQuantities The scaled-up values.\n function _scaleGemQuantities(uint256[] memory quantities)\n internal\n view\n returns (uint256[] memory scaledQuantities)\n {\n scaledQuantities = new uint256[](quantities.length);\n for (uint256 i = 0; i < quantities.length; i++) {\n uint256 gemFactor = 10**_gemsCatalystsRegistry.getGemDecimals(uint16(i + 1));\n scaledQuantities[i] = quantities[i] * gemFactor * numberOfGemsBurnPerAsset;\n }\n }\n\n /// @dev Scale up each number in an array of quantities by a factor of gemsUnits.\n /// @param quantities The array of numbers to scale.\n /// @return scaledQuantities The scaled-up values.\n function _scaleCatalystQuantities(uint256[] memory quantities)\n internal\n view\n returns (uint256[] memory scaledQuantities)\n {\n scaledQuantities = new uint256[](quantities.length);\n for (uint256 i = 0; i < quantities.length; i++) {\n uint256 catalystFactor = 10**_gemsCatalystsRegistry.getCatalystDecimals(uint16(i + 1));\n scaledQuantities[i] = quantities[i] * catalystFactor * numberOfCatalystBurnPerAsset;\n }\n }\n\n function _msgSender() internal view override(Context, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n\n function _mintRequirements(\n address from,\n uint256 quantity,\n address to\n ) internal view {\n require(to != address(0), \"INVALID_TO_ZERO_ADDRESS\");\n require(_msgSender() == from, \"AUTH_ACCESS_DENIED\");\n require(quantity != 0, \"AssetMinter: quantity cannot be 0\");\n }\n\n function _burnAndMint(\n MintData calldata mintData,\n uint16 catalystId,\n uint16[] calldata gemIds,\n uint256 quantity\n ) internal returns (uint256 assetId) {\n _mintRequirements(mintData.from, quantity, mintData.to);\n\n _burnCatalyst(mintData.from, catalystId, numberOfCatalystBurnPerAsset);\n _burnGems(mintData.from, gemIds, numberOfGemsBurnPerAsset);\n\n assetId = _assetERC1155.mint(\n mintData.from,\n mintData.packId,\n mintData.metadataHash,\n quantity,\n mintData.to,\n mintData.data\n );\n _registry.setCatalyst(assetId, catalystId, gemIds);\n }\n}\n" + }, + "src/solc_0.8/asset/AssetSignedAuctionWithAuth.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {IERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts-0.8/security/ReentrancyGuard.sol\";\nimport {SigUtil} from \"../common/Libraries/SigUtil.sol\";\nimport {PriceUtil} from \"../common/Libraries/PriceUtil.sol\";\nimport {TheSandbox712} from \"../common/Base/TheSandbox712.sol\";\nimport {MetaTransactionReceiver} from \"../common/BaseWithStorage/MetaTransactionReceiver.sol\";\nimport {ERC1271} from \"../common/interfaces/ERC1271.sol\";\nimport {ERC1271Constants} from \"../common/interfaces/ERC1271Constants.sol\";\nimport {ERC1654} from \"../common/interfaces/ERC1654.sol\";\nimport {ERC1654Constants} from \"../common/interfaces/ERC1654Constants.sol\";\nimport {IAuthValidator} from \"../common/interfaces/IAuthValidator.sol\";\nimport {IERC1155} from \"../common/interfaces/IERC1155.sol\";\n\ncontract AssetSignedAuctionWithAuth is\n ReentrancyGuard,\n ERC1654Constants,\n ERC1271Constants,\n TheSandbox712,\n MetaTransactionReceiver\n{\n struct ClaimSellerOfferRequest {\n address buyer;\n address payable seller;\n address token;\n uint256[] purchase;\n uint256[] auctionData;\n uint256[] ids;\n uint256[] amounts;\n bytes signature;\n bytes backendSignature;\n }\n\n enum SignatureType {DIRECT, EIP1654, EIP1271}\n\n bytes32 public constant BACKEND_TYPEHASH =\n keccak256(\n \"Auction(address to,address from,address token,bytes auctionData,bytes ids,bytes amounts,bytes purchase)\"\n );\n\n bytes32 public constant AUCTION_TYPEHASH =\n keccak256(\"Auction(address from,address token,bytes auctionData,bytes ids,bytes amounts)\");\n\n event OfferClaimed(\n address indexed seller,\n address indexed buyer,\n uint256 indexed offerId,\n uint256 amount,\n uint256 pricePaid,\n uint256 feePaid\n );\n event OfferCancelled(address indexed seller, uint256 indexed offerId);\n event NewFeeLimit(uint256 feeLimit);\n\n uint256 public constant MAX_UINT256 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;\n\n // Stack too deep, grouping parameters\n // AuctionData:\n uint256 public constant AuctionData_OfferId = 0;\n uint256 public constant AuctionData_StartingPrice = 1;\n uint256 public constant AuctionData_EndingPrice = 2;\n uint256 public constant AuctionData_StartedAt = 3;\n uint256 public constant AuctionData_Duration = 4;\n uint256 public constant AuctionData_Packs = 5;\n\n mapping(address => mapping(uint256 => uint256)) public claimed;\n\n IAuthValidator public _authValidator;\n IERC1155 public _asset;\n uint256 public _fee10000th = 0;\n uint256 public _feeLimit = 500;\n uint256 public _maxfeeLimit = 500; // 5%\n address payable public _feeCollector;\n\n event FeeSetup(address feeCollector, uint256 fee10000th);\n\n constructor(\n IERC1155 asset,\n address admin,\n address initialMetaTx,\n address payable feeCollector,\n uint256 fee10000th,\n address authValidator\n ) TheSandbox712() {\n require(fee10000th <= _feeLimit, \"Fee above the limit\");\n _asset = asset;\n _feeCollector = feeCollector;\n _fee10000th = fee10000th;\n emit FeeSetup(feeCollector, fee10000th);\n _admin = admin;\n _setMetaTransactionProcessor(initialMetaTx, true);\n _authValidator = IAuthValidator(authValidator);\n }\n\n // check backend signature to avoid front-running\n modifier isAuthValid(bytes memory signature, bytes32 hashedData) {\n require(_authValidator.isAuthValid(signature, hashedData), \"INVALID_AUTH\");\n _;\n }\n\n /// @notice set fee parameters\n /// @param feeCollector address receiving the fee\n /// @param fee10000th fee in 10,000th\n function setFee(address payable feeCollector, uint256 fee10000th) external {\n require(feeCollector != address(0), \"feeCollector cannot be Zero address\");\n require(msg.sender == _admin, \"only admin can change fee\");\n require(fee10000th <= _feeLimit, \"Fee above the limit\");\n _feeCollector = feeCollector;\n _fee10000th = fee10000th;\n emit FeeSetup(feeCollector, fee10000th);\n }\n\n /// @notice setFeeLimit parameters\n /// @param newFeeLimit new fee limit\n function setFeeLimit(uint256 newFeeLimit) external {\n require(msg.sender == _admin, \"only admin can change fee limit\");\n require(newFeeLimit <= _maxfeeLimit, \"new limit above max limit\");\n\n _feeLimit = newFeeLimit;\n\n emit NewFeeLimit(newFeeLimit);\n }\n\n /// @notice claim offer using EIP712\n /// @param input Claim Seller Offer Request\n function claimSellerOffer(ClaimSellerOfferRequest memory input)\n external\n payable\n isAuthValid(\n input.backendSignature,\n _hashBackendSig(\n input.buyer,\n input.seller,\n input.token,\n input.auctionData,\n input.ids,\n input.amounts,\n input.purchase\n )\n )\n {\n _verifyParameters(\n input.buyer,\n input.seller,\n input.token,\n input.purchase[0],\n input.auctionData,\n input.ids,\n input.amounts\n );\n _ensureCorrectSigner(\n input.seller,\n input.token,\n input.auctionData,\n input.ids,\n input.amounts,\n input.signature,\n SignatureType.DIRECT\n );\n _executeDeal(\n input.token,\n input.purchase,\n input.buyer,\n input.seller,\n input.auctionData,\n input.ids,\n input.amounts\n );\n }\n\n /// @notice claim offer using EIP712 and EIP1271 signature verification scheme\n /// @param input Claim Seller Offer Request\n function claimSellerOfferViaEIP1271(ClaimSellerOfferRequest memory input)\n external\n payable\n isAuthValid(\n input.backendSignature,\n _hashBackendSig(\n input.buyer,\n input.seller,\n input.token,\n input.auctionData,\n input.ids,\n input.amounts,\n input.purchase\n )\n )\n {\n _verifyParameters(\n input.buyer,\n input.seller,\n input.token,\n input.purchase[0],\n input.auctionData,\n input.ids,\n input.amounts\n );\n _ensureCorrectSigner(\n input.seller,\n input.token,\n input.auctionData,\n input.ids,\n input.amounts,\n input.signature,\n SignatureType.EIP1271\n );\n _executeDeal(\n input.token,\n input.purchase,\n input.buyer,\n input.seller,\n input.auctionData,\n input.ids,\n input.amounts\n );\n }\n\n /// @notice claim offer using EIP712 and EIP1654 signature verification scheme\n /// @param input Claim Seller Offer Request\n function claimSellerOfferViaEIP1654(ClaimSellerOfferRequest memory input)\n external\n payable\n isAuthValid(\n input.backendSignature,\n _hashBackendSig(\n input.buyer,\n input.seller,\n input.token,\n input.auctionData,\n input.ids,\n input.amounts,\n input.purchase\n )\n )\n {\n _verifyParameters(\n input.buyer,\n input.seller,\n input.token,\n input.purchase[0],\n input.auctionData,\n input.ids,\n input.amounts\n );\n _ensureCorrectSigner(\n input.seller,\n input.token,\n input.auctionData,\n input.ids,\n input.amounts,\n input.signature,\n SignatureType.EIP1654\n );\n _executeDeal(\n input.token,\n input.purchase,\n input.buyer,\n input.seller,\n input.auctionData,\n input.ids,\n input.amounts\n );\n }\n\n /// @notice cancel a offer previously signed, new offer need to use a id not used yet\n /// @param offerId offer to cancel\n function cancelSellerOffer(uint256 offerId) external {\n require(claimed[msg.sender][offerId] != MAX_UINT256, \"Sell offer was already cancelled\");\n claimed[msg.sender][offerId] = MAX_UINT256;\n emit OfferCancelled(msg.sender, offerId);\n }\n\n function _executeDeal(\n address token,\n uint256[] memory purchase,\n address buyer,\n address payable seller,\n uint256[] memory auctionData,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal nonReentrant {\n uint256 offer =\n PriceUtil.calculateCurrentPrice(\n auctionData[AuctionData_StartingPrice],\n auctionData[AuctionData_EndingPrice],\n auctionData[AuctionData_Duration],\n block.timestamp - auctionData[AuctionData_StartedAt]\n ) * purchase[0];\n claimed[seller][auctionData[AuctionData_OfferId]] =\n claimed[seller][auctionData[AuctionData_OfferId]] +\n purchase[0];\n\n uint256 fee = 0;\n if (_fee10000th > 0) {\n fee = PriceUtil.calculateFee(offer, _fee10000th);\n }\n\n uint256 total = offer + fee;\n require(total <= purchase[1], \"offer exceeds max amount to spend\");\n\n if (token != address(0)) {\n require(IERC20(token).transferFrom(buyer, seller, offer), \"failed to transfer token price\");\n if (fee > 0) {\n require(IERC20(token).transferFrom(buyer, _feeCollector, fee), \"failed to collect fee\");\n }\n } else {\n require(msg.value >= total, \"ETH < total\");\n if (msg.value > total) {\n Address.sendValue(payable(msg.sender), msg.value - total);\n }\n Address.sendValue(seller, offer);\n if (fee > 0) {\n Address.sendValue(_feeCollector, fee);\n }\n }\n\n uint256[] memory packAmounts = new uint256[](amounts.length);\n for (uint256 i = 0; i < packAmounts.length; i++) {\n packAmounts[i] = amounts[i] * purchase[0];\n }\n _asset.safeBatchTransferFrom(seller, buyer, ids, packAmounts, \"\");\n emit OfferClaimed(seller, buyer, auctionData[AuctionData_OfferId], purchase[0], offer, fee);\n }\n\n function _ensureCorrectSigner(\n address from,\n address token,\n uint256[] memory auctionData,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory signature,\n SignatureType signatureType\n ) internal view {\n bytes memory dataToHash;\n\n dataToHash = abi.encodePacked(\n \"\\x19\\x01\",\n _DOMAIN_SEPARATOR,\n _hashAuction(from, token, auctionData, ids, amounts)\n );\n\n if (signatureType == SignatureType.EIP1271) {\n require(\n ERC1271(from).isValidSignature(dataToHash, signature) == ERC1271_MAGICVALUE,\n \"invalid 1271 signature\"\n );\n } else if (signatureType == SignatureType.EIP1654) {\n require(\n ERC1654(from).isValidSignature(keccak256(dataToHash), signature) == ERC1654_MAGICVALUE,\n \"invalid 1654 signature\"\n );\n } else {\n address signer = SigUtil.recover(keccak256(dataToHash), signature);\n require(signer == from, \"signer != from\");\n }\n }\n\n function _verifyParameters(\n address buyer,\n address payable seller,\n address token,\n uint256 buyAmount,\n uint256[] memory auctionData,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal view {\n require(ids.length == amounts.length, \"ids and amounts length not matching\");\n require(\n buyer == msg.sender || (token != address(0) && _metaTransactionContracts[msg.sender]),\n \"not authorized\"\n );\n uint256 amountAlreadyClaimed = claimed[seller][auctionData[AuctionData_OfferId]];\n require(amountAlreadyClaimed != MAX_UINT256, \"Auction cancelled\");\n\n uint256 total = amountAlreadyClaimed + buyAmount;\n require(total <= auctionData[AuctionData_Packs], \"Buy amount exceeds sell amount\");\n\n require(auctionData[AuctionData_StartedAt] <= block.timestamp, \"Auction didn't start yet\");\n require(\n auctionData[AuctionData_StartedAt] + auctionData[AuctionData_Duration] > block.timestamp,\n \"Auction finished\"\n );\n }\n\n function _hashAuction(\n address from,\n address token,\n uint256[] memory auctionData,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encode(\n AUCTION_TYPEHASH,\n from,\n token,\n keccak256(abi.encodePacked(auctionData)),\n keccak256(abi.encodePacked(ids)),\n keccak256(abi.encodePacked(amounts))\n )\n );\n }\n\n function _hashBackendSig(\n address to,\n address from,\n address token,\n uint256[] memory auctionData,\n uint256[] memory ids,\n uint256[] memory amounts,\n uint256[] memory purchase\n ) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encode(\n BACKEND_TYPEHASH,\n to,\n from,\n token,\n keccak256(abi.encodePacked(auctionData)),\n keccak256(abi.encodePacked(ids)),\n keccak256(abi.encodePacked(amounts)),\n keccak256(abi.encodePacked(purchase))\n )\n );\n }\n}\n" + }, + "src/solc_0.8/asset/AssetUpgrader.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\nimport \"@openzeppelin/contracts-0.8/utils/math/SafeMath.sol\";\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport \"../common/BaseWithStorage/ERC2771Handler.sol\";\nimport \"../common/interfaces/IAssetAttributesRegistry.sol\";\nimport \"../common/interfaces/IAssetUpgrader.sol\";\nimport \"../catalyst/GemsCatalystsRegistry.sol\";\nimport \"../common/interfaces/IERC20Extended.sol\";\nimport \"../common/interfaces/IPolygonAssetERC721.sol\";\nimport \"../common/interfaces/IPolygonAssetERC1155.sol\";\n\n/// @notice Allow to upgrade Asset with Catalyst, Gems and Sand, giving the assets attributes through AssetAttributeRegistry\ncontract AssetUpgrader is Ownable, ERC2771Handler, IAssetUpgrader {\n using SafeMath for uint256;\n\n address public immutable feeRecipient;\n uint256 public immutable upgradeFee;\n uint256 public immutable gemAdditionFee;\n uint256 private constant IS_NFT = 0x0000000000000000000000000000000000000000800000000000000000000000;\n address private constant BURN_ADDRESS = 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF;\n\n IERC20Extended internal immutable _sand;\n IAssetAttributesRegistry internal immutable _registry;\n IPolygonAssetERC721 internal immutable _assetERC721;\n IPolygonAssetERC1155 internal immutable _assetERC1155;\n GemsCatalystsRegistry internal immutable _gemsCatalystsRegistry;\n\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\n\n /// @notice AssetUpgrader depends on\n /// @param registry: AssetAttributesRegistry for recording catalyst and gems used\n /// @param sand: ERC20 for fee payment\n /// @param assetERC1155: ERC1155 Asset Token Contract\n /// @param gemsCatalystsRegistry: that track the canonical catalyst and gems and provide batch burning facility\n /// @param _upgradeFee: the fee in Sand paid for an upgrade (setting or replacing a catalyst)\n /// @param _gemAdditionFee: the fee in Sand paid for adding gems\n /// @param _feeRecipient: address receiving the Sand fee\n /// @param trustedForwarder: address of the trusted forwarder (used for metaTX)\n constructor(\n IAssetAttributesRegistry registry,\n IERC20Extended sand,\n IPolygonAssetERC721 assetERC721,\n IPolygonAssetERC1155 assetERC1155,\n GemsCatalystsRegistry gemsCatalystsRegistry,\n uint256 _upgradeFee,\n uint256 _gemAdditionFee,\n address _feeRecipient,\n address trustedForwarder\n ) {\n _registry = registry;\n _sand = sand;\n _assetERC721 = assetERC721;\n _assetERC1155 = assetERC1155;\n _gemsCatalystsRegistry = gemsCatalystsRegistry;\n upgradeFee = _upgradeFee;\n gemAdditionFee = _gemAdditionFee;\n feeRecipient = _feeRecipient;\n __ERC2771Handler_initialize(trustedForwarder);\n }\n\n /// @notice associate a catalyst to a fungible Asset token by extracting it as ERC721 first.\n /// @param from address from which the Asset token belongs to.\n /// @param assetId tokenId of the Asset being extracted.\n /// @param catalystId address of the catalyst token to use and burn.\n /// @param gemIds list of gems to socket into the catalyst (burned).\n /// @param to destination address receiving the extracted and upgraded ERC721 Asset token.\n /// @return tokenId The Id of the extracted token.\n function extractAndSetCatalyst(\n address from,\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds,\n address to\n ) external override returns (uint256 tokenId) {\n require(to != address(0), \"INVALID_TO_ZERO_ADDRESS\");\n require(_msgSender() == from, \"AUTH_ACCESS_DENIED\");\n tokenId = _assetERC1155.extractERC721From(from, assetId, from);\n _changeCatalyst(from, tokenId, catalystId, gemIds, to, false);\n }\n\n /// @notice associate a new catalyst to a non-fungible Asset token.\n /// @param from address from which the Asset token belongs to.\n /// @param assetId tokenId of the Asset being updated.\n /// @param catalystId address of the catalyst token to use and burn.\n /// @param gemIds list of gems to socket into the catalyst (burned).\n /// @param to destination address receiving the Asset token.\n /// @return tokenId The id of the asset.\n function changeCatalyst(\n address from,\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds,\n address to\n ) external override returns (uint256 tokenId) {\n require(to != address(0), \"INVALID_TO_ZERO_ADDRESS\");\n require(_msgSender() == from, \"AUTH_ACCESS_DENIED\");\n _changeCatalyst(from, assetId, catalystId, gemIds, to, true);\n return assetId;\n }\n\n /// @notice add gems to a non-fungible Asset token.\n /// @param from address from which the Asset token belongs to.\n /// @param assetId tokenId of the Asset to which the gems will be added to.\n /// @param gemIds list of gems to socket into the existing catalyst (burned).\n /// @param to destination address receiving the extracted and upgraded ERC721 Asset token.\n function addGems(\n address from,\n uint256 assetId,\n uint16[] calldata gemIds,\n address to\n ) external override {\n require(to != address(0), \"INVALID_TO_ZERO_ADDRESS\");\n require(_msgSender() == from, \"AUTH_ACCESS_DENIED\");\n _addGems(from, assetId, gemIds, to);\n }\n\n /// @dev Collect a fee in SAND tokens\n /// @param from The address paying the fee.\n /// @param sandFee The fee amount.\n function _chargeSand(address from, uint256 sandFee) internal {\n if (feeRecipient != address(0) && sandFee != 0) {\n if (feeRecipient == address(BURN_ADDRESS)) {\n // special address for burn\n _sand.burnFor(from, sandFee);\n } else {\n require(\n _sand.transferFrom(from, feeRecipient, sandFee),\n \"AssetUpgrader: ERC20 operation did not succeed\"\n );\n }\n }\n }\n\n /// @dev Change the catalyst for an asset.\n /// @param from The current owner of the asset.\n /// @param assetId The id of the asset to change.\n /// @param catalystId The id of the new catalyst to set.\n /// @param gemIds An array of gemIds to embed.\n /// @param to The address to transfer the asset to after the catalyst is changed.\n function _changeCatalyst(\n address from,\n uint256 assetId,\n uint16 catalystId,\n uint16[] memory gemIds,\n address to,\n bool isERC1155\n ) internal {\n require(assetId & IS_NFT != 0, \"INVALID_NOT_NFT\"); // Asset (ERC1155ERC721.sol) ensure NFT will return true here and non-NFT will return false\n _burnCatalyst(from, catalystId);\n _burnGems(from, gemIds);\n _chargeSand(from, upgradeFee);\n _registry.setCatalyst(assetId, catalystId, gemIds);\n _transfer(from, to, assetId, isERC1155);\n }\n\n /// @dev Add gems to an existing asset.\n /// @param from The current owner of the asset.\n /// @param assetId The asset to add gems to.\n /// @param gemIds An array of gemIds to add to the asset.\n /// @param to The address to transfer the asset to after adding gems.\n function _addGems(\n address from,\n uint256 assetId,\n uint16[] memory gemIds,\n address to\n ) internal {\n require(assetId & IS_NFT != 0, \"INVALID_NOT_NFT\"); // Asset (ERC1155ERC721.sol) ensure NFT will return true here and non-NFT will return false\n _burnGems(from, gemIds);\n _chargeSand(from, gemAdditionFee);\n _registry.addGems(assetId, gemIds);\n _transfer(from, to, assetId, true);\n }\n\n /// @dev transfer an asset if from != to.\n /// @param from The address to transfer the asset from.\n /// @param to The address to transfer the asset to.\n /// @param assetId The asset to transfer.\n function _transfer(\n address from,\n address to,\n uint256 assetId,\n bool isERC1155\n ) internal {\n if (isERC1155) {\n if (from != to) {\n _assetERC1155.safeTransferFrom(from, to, assetId, 1, \"\");\n } else {\n require(_assetERC1155.balanceOf(from, assetId) > 0, \"NOT_AUTHORIZED_ASSET_OWNER\");\n }\n } else {\n if (from != to) {\n _assetERC721.safeTransferFrom(from, to, assetId);\n } else {\n require(_assetERC721.ownerOf(assetId) == from, \"NOT_AUTHORIZED_ASSET_OWNER\");\n }\n }\n }\n\n /// @dev Burn gems.\n /// @param from The owner of the gems.\n /// @param gemIds The gem types to burn.\n function _burnGems(address from, uint16[] memory gemIds) internal {\n uint256[] memory gemFactors = new uint256[](gemIds.length);\n for (uint256 i = 0; i < gemIds.length; i++) {\n gemFactors[i] = 10**_gemsCatalystsRegistry.getGemDecimals(gemIds[i]);\n }\n _gemsCatalystsRegistry.batchBurnGems(from, gemIds, gemFactors);\n }\n\n /// @dev Burn a catalyst.\n /// @param from The owner of the catalyst.\n /// @param catalystId The catalyst type to burn.\n function _burnCatalyst(address from, uint16 catalystId) internal {\n uint256 catalystFactor = 10**_gemsCatalystsRegistry.getCatalystDecimals(catalystId);\n _gemsCatalystsRegistry.burnCatalyst(from, catalystId, catalystFactor);\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n\n emit TrustedForwarderChanged(trustedForwarder);\n }\n\n function _msgSender() internal view override(Context, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n}\n" + }, + "src/solc_0.8/asset/libraries/AssetHelper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../common/interfaces/IAssetAttributesRegistry.sol\";\n\n// used to reduce PolygonAssetV2 contract code size\nlibrary AssetHelper {\n struct AssetRegistryData {\n IAssetAttributesRegistry assetRegistry;\n }\n\n function setCatalystDatas(\n AssetRegistryData storage self,\n IAssetAttributesRegistry.AssetGemsCatalystData[] memory assetGemsCatalystData\n ) public {\n for (uint256 i = 0; i < assetGemsCatalystData.length; i++) {\n require(assetGemsCatalystData[i].catalystContractId > 0, \"WRONG_catalystContractId\");\n require(assetGemsCatalystData[i].assetId != 0, \"WRONG_assetId\");\n self.assetRegistry.setCatalystWhenDepositOnOtherLayer(\n assetGemsCatalystData[i].assetId,\n assetGemsCatalystData[i].catalystContractId,\n assetGemsCatalystData[i].gemContractIds\n );\n }\n }\n\n function decodeAndSetCatalystDataL1toL2(AssetRegistryData storage self, bytes calldata depositData)\n public\n returns (\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes32[] memory hashes\n )\n {\n bytes memory data;\n IAssetAttributesRegistry.AssetGemsCatalystData[] memory catalystDatas;\n (ids, amounts, data) = abi.decode(depositData, (uint256[], uint256[], bytes));\n (hashes, catalystDatas) = abi.decode(data, (bytes32[], IAssetAttributesRegistry.AssetGemsCatalystData[]));\n\n setCatalystDatas(self, catalystDatas);\n }\n\n function decodeAndSetCatalystDataL2toL1(AssetRegistryData storage self, bytes calldata data)\n public\n returns (bytes32[] memory hashes)\n {\n IAssetAttributesRegistry.AssetGemsCatalystData[] memory catalystDatas;\n\n (hashes, catalystDatas) = abi.decode(data, (bytes32[], IAssetAttributesRegistry.AssetGemsCatalystData[]));\n\n setCatalystDatas(self, catalystDatas);\n }\n\n function getGemsAndCatalystData(AssetRegistryData storage self, uint256[] calldata assetIds)\n public\n view\n returns (IAssetAttributesRegistry.AssetGemsCatalystData[] memory)\n {\n uint256 count = getGemsCatalystDataCount(self, assetIds);\n uint256 indexInCatalystArray;\n\n IAssetAttributesRegistry.AssetGemsCatalystData[] memory gemsCatalystDatas =\n new IAssetAttributesRegistry.AssetGemsCatalystData[](count);\n\n for (uint256 i = 0; i < assetIds.length; i++) {\n (bool isDataFound, uint16 catalystId, uint16[] memory gemIds) = self.assetRegistry.getRecord(assetIds[i]);\n if (isDataFound) {\n IAssetAttributesRegistry.AssetGemsCatalystData memory data;\n data.assetId = assetIds[i];\n data.catalystContractId = catalystId;\n data.gemContractIds = gemIds;\n require(indexInCatalystArray < count, \"indexInCatalystArray out of bound\");\n gemsCatalystDatas[indexInCatalystArray] = data;\n indexInCatalystArray++;\n }\n }\n\n return gemsCatalystDatas;\n }\n\n function getGemsCatalystDataCount(AssetRegistryData storage self, uint256[] calldata assetIds)\n internal\n view\n returns (uint256)\n {\n uint256 count;\n\n for (uint256 i = 0; i < assetIds.length; i++) {\n (bool isDataFound, , ) = self.assetRegistry.getRecord(assetIds[i]);\n if (isDataFound) {\n count++;\n }\n }\n return count;\n }\n}\n" + }, + "src/solc_0.8/asset/libraries/ERC1155ERC721Helper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nlibrary ERC1155ERC721Helper {\n bytes32 private constant base32Alphabet = 0x6162636465666768696A6B6C6D6E6F707172737475767778797A323334353637;\n\n uint256 public constant CREATOR_OFFSET_MULTIPLIER = uint256(2)**(256 - 160);\n uint256 public constant IS_NFT_OFFSET_MULTIPLIER = uint256(2)**(256 - 160 - 1);\n uint256 public constant CHAIN_INDEX_OFFSET_MULTIPLIER = uint256(2)**(256 - 160 - 1 - 8);\n uint256 public constant PACK_ID_OFFSET_MULTIPLIER = uint256(2)**(256 - 160 - 1 - 32 - 40);\n uint256 public constant PACK_NUM_FT_TYPES_OFFSET_MULTIPLIER = uint256(2)**(256 - 160 - 1 - 32 - 40 - 12);\n uint256 public constant NFT_INDEX_OFFSET = 63;\n\n uint256 public constant IS_NFT = 0x0000000000000000000000000000000000000000800000000000000000000000;\n uint256 public constant NOT_IS_NFT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFFFFFFFFFFF;\n uint256 public constant NFT_INDEX = 0x0000000000000000000000000000000000000000007FFFFF8000000000000000;\n uint256 public constant NOT_NFT_INDEX = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000007FFFFFFFFFFFFFFF;\n uint256 public constant URI_ID = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000007FFFFFFFFFFFF800;\n uint256 public constant PACK_ID = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000007FFFFFFFFF800000;\n uint256 public constant PACK_INDEX = 0x00000000000000000000000000000000000000000000000000000000000007FF;\n uint256 public constant PACK_NUM_FT_TYPES = 0x00000000000000000000000000000000000000000000000000000000007FF800;\n uint256 public constant CHAIN_INDEX = 0x00000000000000000000000000000000000000007F8000000000000000000000;\n uint256 public constant NOT_CHAIN_INDEX = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF807FFFFFFFFFFFFFFFFFFFFF;\n\n uint256 public constant MAX_SUPPLY = uint256(2)**32 - 1;\n uint256 public constant MAX_PACK_SIZE = uint256(2)**11;\n uint256 public constant MAX_NUM_FT = uint256(2)**12;\n\n function toFullURI(bytes32 hash, uint256 id) external pure returns (string memory) {\n return string(abi.encodePacked(\"ipfs://bafybei\", hash2base32(hash), \"/\", uint2str(id & PACK_INDEX), \".json\"));\n }\n\n // solium-disable-next-line security/no-assign-params\n function hash2base32(bytes32 hash) public pure returns (string memory _uintAsString) {\n uint256 _i = uint256(hash);\n uint256 k = 52;\n bytes memory bstr = new bytes(k);\n bstr[--k] = base32Alphabet[uint8((_i % 8) << 2)]; // uint8 s = uint8((256 - skip) % 5); // (_i % (2**s)) << (5-s)\n _i /= 8;\n while (k > 0) {\n bstr[--k] = base32Alphabet[_i % 32];\n _i /= 32;\n }\n return string(bstr);\n }\n\n // solium-disable-next-line security/no-assign-params\n function uint2str(uint256 _i) public pure returns (string memory _uintAsString) {\n if (_i == 0) {\n return \"0\";\n }\n\n uint256 j = _i;\n uint256 len;\n while (j != 0) {\n len++;\n j /= 10;\n }\n\n bytes memory bstr = new bytes(len);\n uint256 k = len;\n while (_i != 0) {\n bstr[--k] = bytes1(uint8(48 + uint8(_i % 10)));\n _i /= 10;\n }\n\n return string(bstr);\n }\n}\n" + }, + "src/solc_0.8/assetERC1155/AssetBaseERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155Receiver.sol\";\nimport \"../common/interfaces/IAssetERC721.sol\";\nimport \"../common/Libraries/ObjectLib32.sol\";\nimport \"../common/BaseWithStorage/WithSuperOperators.sol\";\nimport \"../asset/libraries/ERC1155ERC721Helper.sol\";\n\n// solhint-disable max-states-count\nabstract contract AssetBaseERC1155 is WithSuperOperators, IERC1155 {\n using Address for address;\n using ObjectLib32 for ObjectLib32.Operations;\n using ObjectLib32 for uint256;\n\n bytes4 private constant ERC1155_IS_RECEIVER = 0x4e2312e0;\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n mapping(address => uint256) private _numNFTPerAddress; // erc721\n mapping(uint256 => uint256) private _owners; // erc721\n mapping(address => mapping(uint256 => uint256)) private _packedTokenBalance; // erc1155\n mapping(address => mapping(address => bool)) private _operatorsForAll; // erc721 and erc1155\n mapping(uint256 => address) private _erc721operators; // erc721\n mapping(uint256 => bytes32) internal _metadataHash; // erc721 and erc1155\n mapping(uint256 => bytes) internal _rarityPacks; // rarity configuration per packs (2 bits per Asset) *DEPRECATED*\n mapping(uint256 => uint32) private _nextCollectionIndex; // extraction\n\n // @note : Deprecated.\n mapping(address => address) private _creatorship; // creatorship transfer // deprecated\n\n mapping(address => bool) private _bouncers; // the contracts allowed to mint\n\n // @note : Deprecated.\n mapping(address => bool) private _metaTransactionContracts;\n\n address private _bouncerAdmin;\n\n bool internal _init;\n\n bytes4 internal constant ERC165ID = 0x01ffc9a7;\n\n uint256 internal _initBits;\n address internal _predicate; // used in place of polygon's `PREDICATE_ROLE`\n\n uint8 internal _chainIndex; // modify this for l2\n\n address internal _trustedForwarder;\n\n IAssetERC721 public _assetERC721;\n\n uint256[20] private __gap;\n // solhint-enable max-states-count\n\n event BouncerAdminChanged(address indexed oldBouncerAdmin, address indexed newBouncerAdmin);\n event Bouncer(address indexed bouncer, bool indexed enabled);\n event Extraction(uint256 indexed id, uint256 indexed newId);\n event AssetERC721Set(IAssetERC721 indexed assetERC721);\n\n function init(\n address trustedForwarder,\n address admin,\n address bouncerAdmin,\n IAssetERC721 assetERC721,\n uint8 chainIndex\n ) public {\n // one-time init of bitfield's previous versions\n _checkInit(1);\n _admin = admin;\n _bouncerAdmin = bouncerAdmin;\n _assetERC721 = assetERC721;\n __ERC2771Handler_initialize(trustedForwarder);\n _chainIndex = chainIndex;\n }\n\n /// @notice Change the minting administrator to be `newBouncerAdmin`.\n /// @param newBouncerAdmin address of the new minting administrator.\n function changeBouncerAdmin(address newBouncerAdmin) external {\n require(_msgSender() == _bouncerAdmin, \"!BOUNCER_ADMIN\");\n require(newBouncerAdmin != address(0), \"AssetBaseERC1155: new bouncer admin can't be zero address\");\n emit BouncerAdminChanged(_bouncerAdmin, newBouncerAdmin);\n _bouncerAdmin = newBouncerAdmin;\n }\n\n /// @notice Enable or disable the ability of `bouncer` to mint tokens (minting bouncer rights).\n /// @param bouncer address that will be given/removed minting bouncer rights.\n /// @param enabled set whether the address is enabled or disabled as a minting bouncer.\n function setBouncer(address bouncer, bool enabled) external {\n require(_msgSender() == _bouncerAdmin, \"!BOUNCER_ADMIN\");\n _bouncers[bouncer] = enabled;\n emit Bouncer(bouncer, enabled);\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param value amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function _safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) internal {\n require(to != address(0), \"TO==0\");\n require(from != address(0), \"FROM==0\");\n bool success = _transferFrom(from, to, id, value);\n if (success) {\n require(_checkOnERC1155Received(_msgSender(), from, to, id, value, data), \"1155_TRANSFER_REJECTED\");\n }\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @dev call data should be optimized to order ids so packedBalance can be used efficiently.\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param values amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function _safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) internal {\n require(ids.length == values.length, \"MISMATCHED_ARR_LEN\");\n require(to != address(0), \"TO==0\");\n require(from != address(0), \"FROM==0\");\n address msgSender = _msgSender();\n bool authorized = from == msgSender || isApprovedForAll(from, msgSender);\n\n _batchTransferFrom(from, to, ids, values, authorized);\n emit TransferBatch(msgSender, from, to, ids, values);\n require(_checkOnERC1155BatchReceived(msgSender, from, to, ids, values, data), \"1155_TRANSFER_REJECTED\");\n }\n\n /// @notice Enable or disable approval for `operator` to manage all `sender`'s tokens.\n /// @dev used for Meta Transaction (from metaTransactionContract).\n /// @param sender address which grant approval.\n /// @param operator address which will be granted rights to transfer all token owned by `sender`.\n /// @param approved whether to approve or revoke.\n function _setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) internal {\n require(sender == _msgSender() || _superOperators[_msgSender()], \"!AUTHORIZED\");\n _setApprovalForAll(sender, operator, approved);\n }\n\n /// @notice Returns the current administrator in charge of minting rights.\n /// @return the current minting administrator in charge of minting rights.\n function getBouncerAdmin() external view returns (address) {\n return _bouncerAdmin;\n }\n\n /// @notice check whether address `who` is given minting bouncer rights.\n /// @param who The address to query.\n /// @return whether the address has minting rights.\n function isBouncer(address who) public view returns (bool) {\n return _bouncers[who];\n }\n\n /// @notice Get the balance of `owners` for each token type `ids`.\n /// @param owners the addresses of the token holders queried.\n /// @param ids ids of each token type to query.\n /// @return the balance of each `owners` for each token type `ids`.\n function balanceOfBatch(address[] calldata owners, uint256[] calldata ids)\n external\n view\n override\n returns (uint256[] memory)\n {\n require(owners.length == ids.length, \"ARG_LENGTH_MISMATCH\");\n uint256[] memory balances = new uint256[](ids.length);\n for (uint256 i = 0; i < ids.length; i++) {\n balances[i] = balanceOf(owners[i], ids[i]);\n }\n return balances;\n }\n\n /// @notice A descriptive name for the collection of tokens in this contract.\n /// @return _name the name of the tokens.\n function name() external pure returns (string memory _name) {\n return \"Sandbox's ASSETs\";\n }\n\n /// @notice An abbreviated name for the collection of tokens in this contract.\n /// @return _symbol the symbol of the tokens.\n function symbol() external pure returns (string memory _symbol) {\n return \"ASSET\";\n }\n\n /// @notice Query if a contract implements interface `id`.\n /// @param id the interface identifier, as specified in ERC-165.\n /// @return `true` if the contract implements `id`.\n function supportsInterface(bytes4 id) external pure override returns (bool) {\n return\n id == 0x01ffc9a7 || //ERC165\n id == 0xd9b67a26 || // ERC1155\n id == 0x0e89341c || // ERC1155 metadata\n id == 0x572b6c05; // ERC2771\n }\n\n /// Collection methods for ERC721s extracted from an ERC1155 -----------------------------------------------------\n\n /// @notice Gives the collection a specific token belongs to.\n /// @param id the token to get the collection of.\n /// @return the collection the NFT is part of.\n function collectionOf(uint256 id) public view returns (uint256) {\n require(doesHashExist(id), \"INVALID_ID\"); // Note: doesHashExist must track ERC721s\n uint256 collectionId = id & ERC1155ERC721Helper.NOT_NFT_INDEX & ERC1155ERC721Helper.NOT_IS_NFT;\n require(doesHashExist(collectionId), \"UNMINTED_COLLECTION\");\n return collectionId;\n }\n\n /// @notice Return wether the id is a collection\n /// @param id collectionId to check.\n /// @return whether the id is a collection.\n function isCollection(uint256 id) external view returns (bool) {\n uint256 collectionId = id & ERC1155ERC721Helper.NOT_NFT_INDEX & ERC1155ERC721Helper.NOT_IS_NFT;\n return doesHashExist(collectionId);\n }\n\n /// @notice Gives the index at which an NFT was minted in a collection : first of a collection get the zero index.\n /// @param id the token to get the index of.\n /// @return the index/order at which the token `id` was minted in a collection.\n function collectionIndexOf(uint256 id) external view returns (uint256) {\n collectionOf(id); // this check if id and collection indeed was ever minted\n return uint24((id & ERC1155ERC721Helper.NFT_INDEX) >> ERC1155ERC721Helper.NFT_INDEX_OFFSET);\n }\n\n /// end collection methods ---------------------------------------------------------------------------------------\n\n /// @notice Whether or not an ERC1155 or ERC721 tokenId has a valid structure and the metadata hash exists.\n /// @param id the token to check.\n /// @return bool whether a given id has a valid structure.\n /// @dev if IS_NFT > 0 then PACK_NUM_FT_TYPES may be 0\n function doesHashExist(uint256 id) public view returns (bool) {\n return (((id & ERC1155ERC721Helper.PACK_INDEX) <=\n ((id & ERC1155ERC721Helper.PACK_NUM_FT_TYPES) / ERC1155ERC721Helper.PACK_NUM_FT_TYPES_OFFSET_MULTIPLIER)) &&\n _metadataHash[id & ERC1155ERC721Helper.URI_ID] != 0);\n }\n\n /// @notice A distinct Uniform Resource Identifier (URI) for a given ERC1155 asset.\n /// @param id ERC1155 token to get the uri of.\n /// @return URI string\n function uri(uint256 id) public view returns (string memory) {\n require(doesHashExist(id), \"INVALID_ID\"); // prevent returning invalid uri\n return ERC1155ERC721Helper.toFullURI(_metadataHash[id & ERC1155ERC721Helper.URI_ID], id);\n }\n\n /// @notice Get the balance of `owner` for the token type `id`.\n /// @param owner The address of the token holder.\n /// @param id the token type of which to get the balance of.\n /// @return the balance of `owner` for the token type `id`.\n function balanceOf(address owner, uint256 id) public view override returns (uint256) {\n require(doesHashExist(id), \"INVALID_ID\");\n (uint256 bin, uint256 index) = id.getTokenBinIndex();\n return _packedTokenBalance[owner][bin].getValueInBin(index);\n }\n\n /// @notice Extracts an EIP-721 Asset from an EIP-1155 Asset.\n /// @dev Extraction is limited to bouncers.\n /// @param sender address which own the token to be extracted.\n /// @param id the token type to extract from.\n /// @param to address which will receive the token.\n /// @return newId the id of the newly minted NFT.\n function extractERC721From(\n address sender,\n uint256 id,\n address to\n ) external returns (uint256) {\n require(sender == _msgSender() || isApprovedForAll(sender, _msgSender()), \"!AUTHORIZED\");\n require(isBouncer(_msgSender()), \"!BOUNCER\");\n require(to != address(0), \"TO==0\");\n require(id & ERC1155ERC721Helper.IS_NFT == 0, \"UNIQUE_ERC1155\");\n uint24 tokenCollectionIndex = uint24(_nextCollectionIndex[id]) + 1;\n _nextCollectionIndex[id] = tokenCollectionIndex;\n string memory metaData = uri(id);\n uint256 newId =\n id +\n ERC1155ERC721Helper.IS_NFT_OFFSET_MULTIPLIER + // newId is always an NFT; IS_NFT is 1\n (tokenCollectionIndex) *\n 2**ERC1155ERC721Helper.NFT_INDEX_OFFSET; // uint24 nft index\n _burnFT(sender, id, 1);\n _assetERC721.mint(to, newId, bytes(abi.encode(metaData)));\n emit Extraction(id, newId);\n return newId;\n }\n\n /// @notice Set the ERC721 contract.\n /// @param assetERC721 the contract address to set the ERC721 contract to.\n /// @return true if the operation completes successfully.\n function setAssetERC721(IAssetERC721 assetERC721) external returns (bool) {\n require(_admin == _msgSender(), \"!AUTHORIZED\");\n _assetERC721 = assetERC721;\n emit AssetERC721Set(assetERC721);\n return true;\n }\n\n /// @notice Queries the approval status of `operator` for owner `owner`.\n /// @param owner the owner of the tokens.\n /// @param operator address of authorized operator.\n /// @return isOperator true if the operator is approved, false if not.\n function isApprovedForAll(address owner, address operator)\n public\n view\n override(IERC1155)\n returns (bool isOperator)\n {\n require(owner != address(0), \"OWNER==0\");\n require(operator != address(0), \"OPERATOR==0\");\n return _operatorsForAll[owner][operator] || _superOperators[operator];\n }\n\n /// @notice Queries the chainIndex that a token was minted on originally.\n /// @param id the token id to query.\n /// @return chainIndex the chainIndex that the token was minted on originally.\n /// @dev take care not to confuse chainIndex with chain ID.\n function getChainIndex(uint256 id) external pure returns (uint256) {\n return uint8((id & ERC1155ERC721Helper.CHAIN_INDEX) / ERC1155ERC721Helper.CHAIN_INDEX_OFFSET_MULTIPLIER);\n }\n\n function __ERC2771Handler_initialize(address forwarder) internal {\n _trustedForwarder = forwarder;\n }\n\n function isTrustedForwarder(address forwarder) public view returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n function getTrustedForwarder() external view returns (address) {\n return _trustedForwarder;\n }\n\n function _msgSender() internal view virtual returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return msg.sender;\n }\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender)) {\n return msg.data[:msg.data.length - 20];\n } else {\n return msg.data;\n }\n }\n\n function _setApprovalForAll(\n address sender,\n address operator,\n bool approved\n ) internal {\n require(sender != address(0), \"SENDER==0\");\n require(sender != operator, \"SENDER==OPERATOR\");\n require(operator != address(0), \"OPERATOR==0\");\n require(!_superOperators[operator], \"APPR_EXISTING_SUPEROPERATOR\");\n _operatorsForAll[sender][operator] = approved;\n emit ApprovalForAll(sender, operator, approved);\n }\n\n /* solhint-disable code-complexity */\n function _batchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory values,\n bool authorized\n ) internal {\n uint256 numItems = ids.length;\n uint256 bin;\n uint256 index;\n uint256 balFrom;\n uint256 balTo;\n\n uint256 lastBin;\n require(authorized, \"OPERATOR_!AUTH\");\n\n for (uint256 i = 0; i < numItems; i++) {\n if (from == to) {\n _checkEnoughBalance(from, ids[i], values[i]);\n } else if (values[i] > 0) {\n (bin, index) = ids[i].getTokenBinIndex();\n if (lastBin == 0) {\n lastBin = bin;\n balFrom = ObjectLib32.updateTokenBalance(\n _packedTokenBalance[from][bin],\n index,\n values[i],\n ObjectLib32.Operations.SUB\n );\n balTo = ObjectLib32.updateTokenBalance(\n _packedTokenBalance[to][bin],\n index,\n values[i],\n ObjectLib32.Operations.ADD\n );\n } else {\n if (bin != lastBin) {\n _packedTokenBalance[from][lastBin] = balFrom;\n _packedTokenBalance[to][lastBin] = balTo;\n balFrom = _packedTokenBalance[from][bin];\n balTo = _packedTokenBalance[to][bin];\n lastBin = bin;\n }\n\n balFrom = balFrom.updateTokenBalance(index, values[i], ObjectLib32.Operations.SUB);\n balTo = balTo.updateTokenBalance(index, values[i], ObjectLib32.Operations.ADD);\n }\n }\n }\n\n if (bin != 0 && from != to) {\n _packedTokenBalance[from][bin] = balFrom;\n _packedTokenBalance[to][bin] = balTo;\n }\n }\n\n function _burn(\n address from,\n uint256 id,\n uint256 amount\n ) internal {\n require(amount > 0 && amount <= ERC1155ERC721Helper.MAX_SUPPLY, \"INVALID_AMOUNT\");\n _burnFT(from, id, uint32(amount));\n emit TransferSingle(_msgSender(), from, address(0), id, amount);\n }\n\n function _burnBatch(\n address from,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal {\n address operator = _msgSender();\n for (uint256 i = 0; i < ids.length; i++) {\n require(amounts[i] > 0 && amounts[i] <= ERC1155ERC721Helper.MAX_SUPPLY, \"INVALID_AMOUNT\");\n _burnFT(from, ids[i], uint32(amounts[i]));\n }\n emit TransferBatch(operator, from, address(0), ids, amounts);\n }\n\n function _burnFT(\n address from,\n uint256 id,\n uint32 amount\n ) internal {\n (uint256 bin, uint256 index) = (id).getTokenBinIndex();\n _packedTokenBalance[from][bin] = _packedTokenBalance[from][bin].updateTokenBalance(\n index,\n amount,\n ObjectLib32.Operations.SUB\n );\n }\n\n function _mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal {\n uint16 offset = 0;\n while (offset < amounts.length) {\n _mintPack(offset, amounts, to, ids);\n offset += 8;\n }\n _completeBatchMint(_msgSender(), to, ids, amounts, data);\n }\n\n function _mintPack(\n uint16 offset,\n uint256[] memory supplies,\n address owner,\n uint256[] memory ids\n ) internal {\n (uint256 bin, uint256 index) = ids[offset].getTokenBinIndex();\n for (uint256 i = 0; i < 8 && offset + i < supplies.length; i++) {\n uint256 j = offset + i;\n if (supplies[j] > 0) {\n _packedTokenBalance[owner][bin] = _packedTokenBalance[owner][bin].updateTokenBalance(\n index + i,\n supplies[j],\n ObjectLib32.Operations.ADD\n );\n }\n }\n }\n\n function _transferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value\n ) internal returns (bool) {\n address sender = _msgSender();\n bool authorized = from == sender || isApprovedForAll(from, sender);\n\n require(authorized, \"OPERATOR_!AUTH\");\n if (value > 0) {\n (uint256 bin, uint256 index) = id.getTokenBinIndex();\n _packedTokenBalance[from][bin] = _packedTokenBalance[from][bin].updateTokenBalance(\n index,\n value,\n ObjectLib32.Operations.SUB\n );\n _packedTokenBalance[to][bin] = _packedTokenBalance[to][bin].updateTokenBalance(\n index,\n value,\n ObjectLib32.Operations.ADD\n );\n }\n\n emit TransferSingle(sender, from, to, id, value);\n return true;\n }\n\n function _mint(\n address operator,\n address account,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (uint256 bin, uint256 index) = id.getTokenBinIndex();\n _packedTokenBalance[account][bin] = _packedTokenBalance[account][bin].updateTokenBalance(\n index,\n amount,\n ObjectLib32.Operations.REPLACE\n );\n\n emit TransferSingle(operator, address(0), account, id, amount);\n require(_checkOnERC1155Received(operator, address(0), account, id, amount, data), \"TRANSFER_REJECTED\");\n }\n\n function _mintBatches(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal {\n for (uint256 i = 0; i < amounts.length; i++) {\n if (amounts[i] > 0) {\n (uint256 bin, uint256 index) = ids[i].getTokenBinIndex();\n _packedTokenBalance[to][bin] = _packedTokenBalance[to][bin].updateTokenBalance(\n index,\n amounts[i],\n ObjectLib32.Operations.REPLACE\n );\n }\n }\n _completeBatchMint(_msgSender(), to, ids, amounts, data);\n }\n\n function _mintDeficit(\n address account,\n uint256 id,\n uint256 amount\n ) internal {\n address sender = _msgSender();\n (uint256 bin, uint256 index) = id.getTokenBinIndex();\n _packedTokenBalance[account][bin] = _packedTokenBalance[account][bin].updateTokenBalance(\n index,\n amount,\n ObjectLib32.Operations.ADD\n );\n\n emit TransferSingle(sender, address(0), account, id, amount);\n require(_checkOnERC1155Received(sender, address(0), account, id, amount, \"\"), \"TRANSFER_REJECTED\");\n }\n\n /// @dev Allows the use of a bitfield to track the initialized status of the version `v` passed in as an arg.\n /// If the bit at the index corresponding to the given version is already set, revert.\n /// Otherwise, set the bit and return.\n /// @param v The version of this contract.\n function _checkInit(uint256 v) internal {\n require((_initBits >> v) & uint256(1) != 1, \"ALREADY_INITIALISED\");\n _initBits = _initBits | (uint256(1) << v);\n }\n\n function _completeBatchMint(\n address operator,\n address owner,\n uint256[] memory ids,\n uint256[] memory supplies,\n bytes memory data\n ) internal {\n emit TransferBatch(operator, address(0), owner, ids, supplies);\n require(_checkOnERC1155BatchReceived(operator, address(0), owner, ids, supplies, data), \"TRANSFER_REJECTED\");\n }\n\n function _checkEnoughBalance(\n address from,\n uint256 id,\n uint256 value\n ) internal view {\n (uint256 bin, uint256 index) = id.getTokenBinIndex();\n require(_packedTokenBalance[from][bin].getValueInBin(index) >= value, \"BALANCE_TOO_LOW\");\n }\n\n function _checkOnERC1155Received(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes memory data\n ) internal returns (bool) {\n if (!to.isContract()) {\n return true;\n }\n\n return IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data) == ERC1155_RECEIVED;\n }\n\n function _checkOnERC1155BatchReceived(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory values,\n bytes memory data\n ) internal returns (bool) {\n if (!to.isContract()) {\n return true;\n }\n bytes4 retval = IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, values, data);\n return (retval == ERC1155_BATCH_RECEIVED);\n }\n}\n" + }, + "src/solc_0.8/assetERC1155/AssetERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./AssetBaseERC1155.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {\n DefaultOperatorFiltererUpgradeable\n} from \"../OperatorFilterer/contracts/upgradeable/DefaultOperatorFiltererUpgradeable.sol\";\nimport {OperatorFiltererUpgradeable} from \"../OperatorFilterer/contracts/upgradeable/OperatorFiltererUpgradeable.sol\";\n\n// solhint-disable-next-line no-empty-blocks\ncontract AssetERC1155 is AssetBaseERC1155, OperatorFiltererUpgradeable {\n event PredicateSet(address predicate);\n\n function initialize(\n address trustedForwarder,\n address admin,\n address bouncerAdmin,\n IAssetERC721 assetERC721,\n uint8 chainIndex,\n address subscription\n ) external initializer {\n init(trustedForwarder, admin, bouncerAdmin, assetERC721, chainIndex);\n __OperatorFilterer_init(subscription, true);\n }\n\n /// @notice Mint a token type for `creator` on slot `packId`.\n /// @dev Function implementation reserved for future use cases on L1.\n /// @dev For this function it is not required to provide data.\n /// @param creator address of the creator of the token.\n /// @param packId unique packId for that token.\n /// @param hash hash of an IPFS cidv1 folder that contains the metadata of the token type in the file 0.json.\n /// @param supply number of tokens minted for that token type.\n /// @param owner address that will receive the tokens.\n /// @param data extra data to accompany the minting call.\n /// @return id the id of the newly minted token type.\n function mint(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256 supply,\n address owner,\n bytes calldata data\n ) external returns (uint256 id) {\n require(hash != 0, \"HASH==0\");\n require(isBouncer(_msgSender()), \"!BOUNCER\");\n require(owner != address(0), \"TO==0\");\n id = _generateTokenId(creator, supply, packId, supply == 1 ? 0 : 1, 0);\n uint256 uriId = id & ERC1155ERC721Helper.URI_ID;\n require(uint256(_metadataHash[uriId]) == 0, \"ID_TAKEN\");\n _metadataHash[uriId] = hash;\n _mint(_msgSender(), owner, id, supply, data);\n }\n\n /// @notice Creates `amount` tokens of token type `id`, and assigns them to `account`.\n /// @dev Should be callable only by AssetERC1155Tunnel.\n /// @dev Encoded bytes32 metadata hash must be provided as data.\n /// Make sure minting is done only by this function.\n /// @param account user address for whom token is being minted.\n /// @param id token which is being minted.\n /// @param amount amount of token being minted.\n /// @param data token metadata.\n function mint(\n address account,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external {\n require(_msgSender() == _predicate, \"!PREDICATE\");\n require(data.length > 0, \"METADATA_MISSING\");\n require(account != address(0), \"TO==0\");\n uint256 uriId = id & ERC1155ERC721Helper.URI_ID;\n require(uint256(_metadataHash[uriId]) == 0, \"ID_TAKEN\");\n _metadataHash[uriId] = abi.decode(data, (bytes32));\n _mint(_msgSender(), account, id, amount, data);\n }\n\n /// @notice Creates `amounts` tokens of token types `ids`, and assigns them to `account`.\n /// @dev Should be callable only by AssetERC1155Tunnel.\n /// @dev Encoded bytes32[] metadata hashes must be provided as data.\n /// @param to address to mint to.\n /// @param ids ids to mint.\n /// @param amounts supply for each token type.\n /// @param data token metadata.\n function mintMultiple(\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external {\n require(ids.length == amounts.length, \"AssetERC1155: ids and amounts length mismatch\");\n require(_msgSender() == _predicate, \"!PREDICATE\");\n require(data.length > 0, \"METADATA_MISSING\");\n require(to != address(0), \"TO==0\");\n bytes32[] memory hashes = abi.decode(data, (bytes32[]));\n for (uint256 i = 0; i < ids.length; i++) {\n uint256 uriId = ids[i] & ERC1155ERC721Helper.URI_ID;\n require(uint256(_metadataHash[uriId]) == 0, \"ID_TAKEN\");\n _metadataHash[uriId] = hashes[i];\n }\n _mintBatches(to, ids, amounts, data);\n }\n\n /// @notice function to be called by tunnel to mint deficit of minted tokens\n /// @dev This mint calls for add instead of replace in packedTokenBalance\n /// @param account address of the ownerof tokens.\n /// @param id id of the token to be minted.\n /// @param amount quantity of the token to be minted.\n function mintDeficit(\n address account,\n uint256 id,\n uint256 amount\n ) external {\n require(_msgSender() == _predicate, \"!PREDICATE\");\n _mintDeficit(account, id, amount);\n }\n\n /// @notice Set the address that will be able to mint on L1 (limited to custom predicate).\n /// @param predicate address that will be given minting rights for L1.\n function setPredicate(address predicate) external {\n require(_msgSender() == _admin, \"!ADMIN\");\n _predicate = predicate;\n emit PredicateSet(predicate);\n }\n\n /// @notice Burns `amount` tokens of type `id`.\n /// @param id token type which will be burnt.\n /// @param amount amount of token to burn.\n function burn(uint256 id, uint256 amount) external {\n _burn(_msgSender(), id, amount);\n }\n\n /// @notice Burns `amount` tokens of type `id` from `from`.\n /// @param from address whose token is to be burnt.\n /// @param id token type which will be burnt.\n /// @param amount amount of token to burn.\n function burnFrom(\n address from,\n uint256 id,\n uint256 amount\n ) external {\n require(from == _msgSender() || isApprovedForAll(from, _msgSender()), \"!AUTHORIZED\");\n _burn(from, id, amount);\n }\n\n /// @notice gets the metadata hash set for the and asset with id \"id\"\n /// @param id the id of the asset whose metadata hash has to be returned\n function metadataHash(uint256 id) external view returns (bytes32) {\n return _metadataHash[id & ERC1155ERC721Helper.URI_ID];\n }\n\n function _generateTokenId(\n address creator,\n uint256 supply,\n uint40 packId,\n uint16 numFTs,\n uint16 packIndex\n ) internal view returns (uint256) {\n require(supply > 0 && supply <= ERC1155ERC721Helper.MAX_SUPPLY, \"SUPPLY_OUT_OF_BOUNDS\");\n require(numFTs >= 0 && numFTs <= ERC1155ERC721Helper.MAX_NUM_FT, \"NUM_FT_OUT_OF_BOUNDS\");\n return\n uint256(uint160(creator)) *\n ERC1155ERC721Helper.CREATOR_OFFSET_MULTIPLIER + // CREATOR uint160\n (supply == 1 ? uint256(1) * ERC1155ERC721Helper.IS_NFT_OFFSET_MULTIPLIER : 0) + // minted as NFT(1)|FT(0), 1 bit\n uint256(_chainIndex) *\n ERC1155ERC721Helper.CHAIN_INDEX_OFFSET_MULTIPLIER + // mainnet = 0, polygon = 1, uint8\n uint256(packId) *\n ERC1155ERC721Helper.PACK_ID_OFFSET_MULTIPLIER + // packId (unique pack), uint40\n numFTs *\n ERC1155ERC721Helper.PACK_NUM_FT_TYPES_OFFSET_MULTIPLIER + // number of fungible token in the pack, 12 bits\n packIndex; // packIndex (position in the pack), 11 bits\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param value amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override onlyAllowedOperator(from) {\n super._safeTransferFrom(from, to, id, value, data);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @dev call data should be optimized to order ids so packedBalance can be used efficiently.\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param values amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override onlyAllowedOperator(from) {\n super._safeBatchTransferFrom(from, to, ids, values, data);\n }\n\n /// @notice Enable or disable approval for `operator` to manage all `sender`'s tokens.\n /// @dev used for Meta Transaction (from metaTransactionContract).\n /// @param sender address which grant approval.\n /// @param operator address which will be granted rights to transfer all token owned by `sender`.\n /// @param approved whether to approve or revoke.\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) external onlyAllowedOperatorApproval(operator) {\n super._setApprovalForAll(sender, operator, approved);\n }\n\n /// @notice Enable or disable approval for `operator` to manage all of the caller's tokens.\n /// @param operator address which will be granted rights to transfer all tokens of the caller.\n /// @param approved whether to approve or revoke\n function setApprovalForAll(address operator, bool approved)\n external\n override(IERC1155)\n onlyAllowedOperatorApproval(operator)\n {\n super._setApprovalForAll(_msgSender(), operator, approved);\n }\n\n function _msgSender()\n internal\n view\n virtual\n override(ContextUpgradeable, AssetBaseERC1155)\n returns (address sender)\n {\n return AssetBaseERC1155._msgSender();\n }\n\n function _msgData() internal view virtual override(ContextUpgradeable, AssetBaseERC1155) returns (bytes calldata) {\n return AssetBaseERC1155._msgData();\n }\n}\n" + }, + "src/solc_0.8/assetERC721/BaseERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport {ERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport {AccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {IMintableERC721} from \"../common/interfaces/IMintableERC721.sol\";\nimport {IERC721Token} from \"../common/interfaces/IERC721Token.sol\";\nimport {IERC721ExtendedToken} from \"../common/interfaces/IERC721ExtendedToken.sol\";\nimport {IERC721Minter} from \"../common/interfaces/IERC721Minter.sol\";\n\nabstract contract BaseERC721 is\n AccessControlUpgradeable,\n ERC721Upgradeable,\n IMintableERC721,\n IERC721Token,\n IERC721ExtendedToken,\n IERC721Minter\n{\n uint256[50] private __gap1; // In case\n\n address internal _trustedForwarder;\n\n string public baseTokenURI;\n\n mapping(uint256 => string) public tokenUris;\n\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant BURNER_ROLE = keccak256(\"BURNER_ROLE\");\n\n /// @notice Mint an ERC721 Asset with the provided id.\n /// @dev Should be callable only by the designated predicate on L1.\n /// @dev Do not use this mint method if you want to retain metadata.\n /// @param to Address that will receive the token.\n /// @param id ERC721 id to be used.\n function mint(address to, uint256 id) public virtual override(IMintableERC721, IERC721Token, IERC721Minter) {\n _safeMint(to, id);\n }\n\n /// @notice Mint an ERC721 Asset with the provided id.\n /// @dev Should be callable only by the designated predicate on L1.\n /// @dev If you want to retain token metadata from L2 to L1 during exit, you must implement this method.\n /// @param to Address that will receive the token.\n /// @param id ERC721 id to be used.\n /// @param data Associated token metadata, which is decoded & used to set the full tokenUri.\n function mint(\n address to,\n uint256 id,\n bytes calldata data\n ) public virtual override(IMintableERC721, IERC721Token, IERC721Minter) {\n require(data.length > 0, \"DATA_MUST_CONTAIN_TOKENURI\");\n _setTokenURI(id, data);\n _safeMint(to, id, data);\n }\n\n /// @notice Approve an operator to operate tokens on the sender's behalf.\n /// @param from The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param id The id of the token.\n function approveFor(\n address from,\n address operator,\n uint256 id\n ) public virtual override(IERC721ExtendedToken) {\n require(from != address(0), \"ZERO_ADDRESS\");\n require(from == _msgSender() || isApprovedForAll(from, _msgSender()), \"!AUTHORIZED\");\n approve(operator, id);\n }\n\n /// @notice Set the approval for an operator to manage all the tokens of the sender.\n /// @param from The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param approved The determination of the approval.\n function setApprovalForAllFor(\n address from,\n address operator,\n bool approved\n ) public virtual override(IERC721ExtendedToken) {\n require(from != address(0), \"ZERO_ADDRESS\");\n require(from == _msgSender() || isApprovedForAll(from, _msgSender()), \"!AUTHORIZED\");\n _setApprovalForAll(from, operator, approved);\n }\n\n /// @notice Burns token with given `id`.\n /// @param from Address whose token is to be burned.\n /// @param id Token id which will be burned.\n function burnFrom(address from, uint256 id) public virtual override(IERC721ExtendedToken, IERC721Token) {\n require(from == _msgSender() || isApprovedForAll(from, _msgSender()), \"!AUTHORIZED\");\n require(from == ERC721Upgradeable.ownerOf(id), \"NOT_OWNER\");\n _burn(id);\n }\n\n /// @notice Burns token with given `id`.\n /// @dev Used by default fx-portal tunnel which burns rather than locks.\n /// @param id The id of the token to be burned.\n function burn(uint256 id) public virtual override(IERC721ExtendedToken) onlyRole(BURNER_ROLE) {\n _burn(id);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param from Address whose token is to be transferred.\n /// @param to Recipient.\n /// @param tokenId The token id to be transferred.\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override(ERC721Upgradeable, IMintableERC721, IERC721Token) {\n ERC721Upgradeable.safeTransferFrom(from, to, tokenId);\n }\n\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids\n ) public virtual override(IERC721ExtendedToken) {\n uint256 numTokens = ids.length;\n for (uint256 i = 0; i < numTokens; i++) {\n uint256 id = ids[i];\n ERC721Upgradeable.transferFrom(from, to, id);\n }\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n /// @param data Additional data.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) public virtual override(IERC721ExtendedToken) {\n uint256 numTokens = ids.length;\n for (uint256 i = 0; i < numTokens; i++) {\n uint256 id = ids[i];\n ERC721Upgradeable.safeTransferFrom(from, to, id, data);\n }\n }\n\n /// @notice Query if a token id exists.\n /// @param tokenId Token id to be queried.\n function exists(uint256 tokenId) public view virtual override(IMintableERC721, IERC721Token) returns (bool) {\n return _exists(tokenId);\n }\n\n /// @notice Query if a contract implements interface `id`.\n /// @param id the interface identifier, as specified in ERC-165.\n /// @return `true` if the contract implements `id`.\n function supportsInterface(bytes4 id)\n public\n view\n virtual\n override(AccessControlUpgradeable, ERC721Upgradeable)\n returns (bool)\n {\n return super.supportsInterface(id);\n }\n\n /// @notice Change the address of the trusted forwarder for meta-transactions\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) public virtual onlyRole(DEFAULT_ADMIN_ROLE) {\n _trustedForwarder = trustedForwarder;\n }\n\n function isTrustedForwarder(address forwarder) public view virtual returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n function getTrustedForwarder() public view virtual returns (address trustedForwarder) {\n return _trustedForwarder;\n }\n\n function _setTokenURI(uint256 id, bytes memory data) internal {\n tokenUris[id] = abi.decode(data, (string));\n }\n\n function _msgSender() internal view virtual override returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return msg.sender;\n }\n }\n\n function _msgData() internal view virtual override returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender)) {\n return msg.data[:msg.data.length - 20];\n } else {\n return msg.data;\n }\n }\n\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n super.tokenURI(tokenId);\n }\n\n function _baseURI() internal view override(ERC721Upgradeable) returns (string memory) {\n return baseTokenURI;\n }\n\n uint256[50] private __gap2; // In case\n}\n" + }, + "src/solc_0.8/bundleSandSale/PolygonBundleSandSale.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../common/interfaces/IERC20.sol\";\nimport \"../common/interfaces/Medianizer.sol\";\nimport \"../common/interfaces/IERC1155TokenReceiver.sol\";\nimport \"../common/BaseWithStorage/WithAdmin.sol\";\nimport \"../common/interfaces/IPolygonAssetERC1155.sol\";\n\n/// @title PolygonBundleSandSale contract.\n/// @notice This contract receives bundles of: Assets (ERC1155) + Sand.\n/// @notice Then those bundles are sold to users. Users can pay BaseCoin (Ethers) or Dais for the bundles.\ncontract PolygonBundleSandSale is WithAdmin, IERC1155TokenReceiver {\n bytes4 public constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 public constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n event BundleSale(\n uint256 indexed saleId,\n uint256[] ids,\n uint256[] amounts,\n uint256 sandAmount,\n uint256 priceUSD,\n uint256 numPacks\n );\n\n event BundleSold(\n uint256 indexed saleId,\n address indexed buyer,\n uint256 numPacks,\n address token,\n uint256 tokenAmount\n );\n\n Medianizer public medianizer;\n IERC20 public dai;\n IERC20 public sand;\n IPolygonAssetERC1155 public asset;\n address payable public receivingWallet;\n\n /*\n This is the main structure representing a pack to be sold.\n Each pack includes some Assets (NFTs or small collection of fungible tokens) plus Sand\n */\n struct Sale {\n uint256[] ids; // ids of the Assets in each pack\n uint256[] amounts; // Amount of each Asset in each pack\n uint256 sandAmount; // Sands sold with each pack\n uint256 priceUSD; // Price in USD for each Pack u$s * 1e18 (aka: 1u$s == 1e18 wei)\n uint256 numPacksLeft; // Number of packs left, used for accounting\n }\n\n Sale[] private sales;\n\n constructor(\n IERC20 sandTokenContractAddress,\n IPolygonAssetERC1155 assetTokenContractAddress,\n Medianizer medianizerContractAddress,\n IERC20 daiTokenContractAddress,\n address admin,\n address payable receivingWallet_\n ) {\n require(receivingWallet_ != address(0), \"need a wallet to receive funds\");\n medianizer = medianizerContractAddress;\n sand = sandTokenContractAddress;\n asset = assetTokenContractAddress;\n dai = daiTokenContractAddress;\n _admin = admin;\n receivingWallet = receivingWallet_;\n }\n\n /// @notice set the wallet receiving the proceeds\n /// @param newWallet address of the new receiving wallet\n function setReceivingWallet(address payable newWallet) external onlyAdmin {\n require(newWallet != address(0), \"receiving wallet cannot be zero address\");\n receivingWallet = newWallet;\n }\n\n /**\n * @notice Buys Sand Bundle with Ether\n * @param saleId id of the bundle\n * @param numPacks the amount of packs to buy\n * @param to The address that will receive the SAND\n */\n function buyBundleWithEther(\n uint256 saleId,\n uint256 numPacks,\n address to\n ) external payable {\n (uint256 saleIndex, uint256 usdRequired) = _getSaleAmount(saleId, numPacks);\n uint256 ethRequired = getEtherAmountWithUSD(usdRequired);\n require(msg.value >= ethRequired, \"not enough ether sent\");\n uint256 leftOver = msg.value - ethRequired;\n if (leftOver > 0) {\n payable(msg.sender).transfer(leftOver);\n // refund extra\n }\n payable(receivingWallet).transfer(ethRequired);\n _transferPack(saleIndex, numPacks, to);\n\n emit BundleSold(saleId, msg.sender, numPacks, address(0), ethRequired);\n }\n\n /**\n * @notice Buys Sand Bundle with DAI\n * @param saleId id of the bundle\n * @param numPacks the amount of packs to buy\n * @param to The address that will receive the SAND\n */\n function buyBundleWithDai(\n uint256 saleId,\n uint256 numPacks,\n address to\n ) external {\n (uint256 saleIndex, uint256 usdRequired) = _getSaleAmount(saleId, numPacks);\n require(dai.transferFrom(msg.sender, receivingWallet, usdRequired), \"failed to transfer dai\");\n _transferPack(saleIndex, numPacks, to);\n\n emit BundleSold(saleId, msg.sender, numPacks, address(dai), usdRequired);\n }\n\n /**\n * @notice get a specific sale information\n * @param saleId id of the bundle\n * @return priceUSD price in USD\n * @return numPacksLeft number of packs left\n */\n function getSaleInfo(uint256 saleId) external view returns (uint256 priceUSD, uint256 numPacksLeft) {\n require(saleId > 0, \"invalid saleId\");\n uint256 saleIndex = saleId - 1;\n priceUSD = sales[saleIndex].priceUSD;\n numPacksLeft = sales[saleIndex].numPacksLeft;\n }\n\n /**\n * @notice Remove a sale returning everything to some address\n * @param saleId id of the bundle\n * @param to The address that will receive the SAND\n */\n function withdrawSale(uint256 saleId, address to) external onlyAdmin {\n require(saleId > 0, \"invalid saleId\");\n uint256 saleIndex = saleId - 1;\n uint256 numPacksLeft = sales[saleIndex].numPacksLeft;\n sales[saleIndex].numPacksLeft = 0;\n\n uint256[] memory ids = sales[saleIndex].ids;\n uint256[] memory amounts = sales[saleIndex].amounts;\n uint256 numIds = ids.length;\n for (uint256 i = 0; i < numIds; i++) {\n amounts[i] = amounts[i] * numPacksLeft;\n }\n require(\n sand.transferFrom(address(this), to, numPacksLeft * sales[saleIndex].sandAmount),\n \"transfer fo Sand failed\"\n );\n asset.safeBatchTransferFrom(address(this), to, ids, amounts, \"\");\n }\n\n /**\n * @notice IERC1155TokenReceiver callback, creates a new Sale\n * @notice OBS: in the case of NFTs (one of a kind) value is one so numPacks must be 1 too to be divisible.\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(address(asset) == msg.sender, \"only accept asset as sender\");\n require(from == operator, \"only self executed transfer allowed\");\n require(value > 0, \"no Asset transfered\");\n require(data.length > 0, \"data need to contains the sale data\");\n\n (uint256 numPacks, uint256 sandAmountPerPack, uint256 priceUSDPerPack) =\n abi.decode(data, (uint256, uint256, uint256));\n\n uint256 amount = value / numPacks;\n require(amount * numPacks == value, \"invalid amounts, not divisible by numPacks\");\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = amount;\n uint256[] memory ids = new uint256[](1);\n ids[0] = id;\n _setupBundle(from, sandAmountPerPack, numPacks, ids, amounts, priceUSDPerPack);\n return ERC1155_RECEIVED;\n }\n\n /**\n * @notice IERC1155TokenReceiver callback, creates a new Sale\n * @notice OBS: in the case of NFTs (one of a kind) value is one so numPacks must be 1 too to be divisible.\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(address(asset) == msg.sender, \"only accept asset as sender\");\n require(from == operator, \"only self executed transfer allowed\");\n require(ids.length > 0, \"need to contains Asset\");\n require(data.length > 0, \"data need to contains the sale data\");\n\n (uint256 numPacks, uint256 sandAmountPerPack, uint256 priceUSDPerPack) =\n abi.decode(data, (uint256, uint256, uint256));\n\n uint256[] memory amounts = new uint256[](ids.length);\n for (uint256 i = 0; i < amounts.length; i++) {\n require(values[i] > 0, \"asset transfer with zero values\");\n uint256 amount = values[i] / numPacks;\n require(amount * numPacks == values[i], \"invalid amounts, not divisible by numPacks\");\n amounts[i] = amount;\n }\n\n _setupBundle(from, sandAmountPerPack, numPacks, ids, amounts, priceUSDPerPack);\n return ERC1155_BATCH_RECEIVED;\n }\n\n /**\n * @notice Returns the amount of ETH for a specific amount\n * @notice This rounds down with a precision of 1wei if usdAmount price is expressed in u$s * 10e18\n * @param usdAmount An amount of USD\n * @return The amount of ETH\n */\n function getEtherAmountWithUSD(uint256 usdAmount) public view returns (uint256) {\n uint256 ethUsdPair = getEthUsdPair();\n return (usdAmount * 1 ether) / ethUsdPair;\n }\n\n /**\n * @notice Gets the ETHUSD pair from the Medianizer contract\n * @return The pair as an uint256\n */\n function getEthUsdPair() internal view returns (uint256) {\n bytes32 pair = medianizer.read();\n return uint256(pair);\n }\n\n function _transferPack(\n uint256 saleIndex,\n uint256 numPacks,\n address to\n ) internal {\n uint256 sandAmountPerPack = sales[saleIndex].sandAmount;\n require(sand.transferFrom(address(this), to, sandAmountPerPack * numPacks), \"Sand Transfer failed\");\n uint256[] memory ids = sales[saleIndex].ids;\n uint256[] memory amounts = sales[saleIndex].amounts;\n uint256 numIds = ids.length;\n for (uint256 i = 0; i < numIds; i++) {\n amounts[i] = amounts[i] * numPacks;\n }\n asset.safeBatchTransferFrom(address(this), to, ids, amounts, \"\");\n }\n\n /**\n * @notice Create a Sale to be sold.\n * @param from seller address\n * @param sandAmountPerPack the sands that will be sell with the Sale\n * @param numPacks number of packs that this sale contains\n * @param ids list of ids to create bundle from\n * @param amounts the corresponding amounts of assets to be bundled for sale\n * @param priceUSDPerPack price in USD per pack\n */\n function _setupBundle(\n address from,\n uint256 sandAmountPerPack,\n uint256 numPacks,\n uint256[] memory ids,\n uint256[] memory amounts,\n uint256 priceUSDPerPack\n ) internal {\n require(sand.transferFrom(from, address(this), sandAmountPerPack * numPacks), \"failed to transfer Sand\");\n sales.push(\n Sale({\n ids: ids,\n amounts: amounts,\n sandAmount: sandAmountPerPack,\n priceUSD: priceUSDPerPack,\n numPacksLeft: numPacks\n })\n );\n uint256 saleId = sales.length;\n emit BundleSale(saleId, ids, amounts, sandAmountPerPack, priceUSDPerPack, numPacks);\n }\n\n function _getSaleAmount(uint256 saleId, uint256 numPacks)\n internal\n returns (uint256 saleIndex, uint256 usdRequired)\n {\n require(saleId > 0, \"PolygonBundleSandSale: invalid saleId\");\n saleIndex = saleId - 1;\n uint256 numPacksLeft = sales[saleIndex].numPacksLeft;\n require(numPacksLeft >= numPacks, \"PolygonBundleSandSale: not enough packs on sale\");\n sales[saleIndex].numPacksLeft = numPacksLeft - numPacks;\n\n usdRequired = numPacks * sales[saleIndex].priceUSD;\n }\n}\n" + }, + "src/solc_0.8/catalyst/CatalystV1.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../common/interfaces/IAssetAttributesRegistry.sol\";\nimport \"../common/BaseWithStorage/ERC20/ERC20TokenUpgradeable.sol\";\nimport \"./interfaces/ICatalyst.sol\";\n\ncontract CatalystV1 is ICatalyst, ERC20TokenUpgradeable {\n uint16 public override catalystId;\n uint8 internal _maxGems;\n bytes32 public constant APPROVER_ROLE = keccak256(\"APPROVER_ROLE\");\n\n IAttributes internal _attributes;\n\n function __CatalystV1_init(\n string memory name,\n string memory symbol,\n address trustedForwarder,\n address admin,\n uint8 maxGems,\n uint16 _catalystId,\n IAttributes attributes,\n address approver\n ) public initializer {\n __ERC20TokenUpgradeable_init(name, symbol, trustedForwarder, admin);\n _maxGems = maxGems;\n catalystId = _catalystId;\n _attributes = attributes;\n _grantRole(APPROVER_ROLE, approver);\n }\n\n /// @notice Used by Admin to update the attributes contract.\n /// @param attributes The new attributes contract.\n function changeAttributes(IAttributes attributes) external override onlyRole(DEFAULT_ADMIN_ROLE) {\n _attributes = attributes;\n }\n\n /// @notice Get the value of _maxGems(the max number of gems that can be embeded in this type of catalyst).\n /// @return The value of _maxGems.\n function getMaxGems() external view override returns (uint8) {\n return _maxGems;\n }\n\n /// @notice Get the attributes for each gem in an asset.\n /// See DefaultAttributes.getAttributes for more.\n /// @return values An array of values representing the \"level\" of each gem. ie: Power=14, speed=45, etc...\n function getAttributes(uint256 assetId, IAssetAttributesRegistry.GemEvent[] calldata events)\n external\n view\n override\n returns (uint32[] memory values)\n {\n return _attributes.getAttributes(assetId, events);\n }\n\n /// @notice Approve `spender` to transfer `amount` tokens from `owner`.\n /// @param owner The address whose token is allowed.\n /// @param spender The address to be given rights to transfer.\n /// @param amount The number of tokens allowed.\n /// @return success Whether or not the call succeeded.\n function approveFor(\n address owner,\n address spender,\n uint256 amount\n ) external override(ERC20BaseTokenUpgradeable, ICatalyst) returns (bool success) {\n require(\n _msgSender() == owner || hasRole(SUPER_OPERATOR_ROLE, _msgSender()) || hasRole(APPROVER_ROLE, _msgSender()),\n \"NOT_AUTHORIZED\"\n );\n _approveFor(owner, spender, amount);\n return true;\n }\n\n function getDecimals() external pure override returns (uint8) {\n return ERC20BaseTokenUpgradeable.decimals();\n }\n}\n" + }, + "src/solc_0.8/catalyst/CollectionCatalystMigrations.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\npragma experimental ABIEncoderV2;\n\nimport \"./interfaces/IOldCatalystRegistry.sol\";\nimport \"../common/interfaces/IAssetAttributesRegistry.sol\";\nimport \"./interfaces/ICollectionCatalystMigrations.sol\";\nimport \"../common/interfaces/IAssetToken.sol\";\nimport \"../common/BaseWithStorage/WithAdmin.sol\";\n\n/// @notice Contract performing migrations for collections, do not require owner approval\ncontract CollectionCatalystMigrations is WithAdmin, ICollectionCatalystMigrations {\n uint256 private constant IS_NFT = 0x0000000000000000000000000000000000000000800000000000000000000000;\n\n IOldCatalystRegistry internal immutable _oldRegistry;\n IAssetAttributesRegistry internal immutable _registry;\n IAssetToken internal immutable _asset;\n\n event BatchCatalystMigrationDone();\n\n /// @notice CollectionCatalystMigrations depends on:\n /// @param asset: Asset Token Contract\n /// @param registry: New AssetAttributesRegistry\n /// @param oldRegistry: Old CatalystRegistry\n /// @param admin: Contract admin\n constructor(\n IAssetToken asset,\n IAssetAttributesRegistry registry,\n IOldCatalystRegistry oldRegistry,\n address admin\n ) {\n _oldRegistry = oldRegistry;\n _asset = asset;\n _registry = registry;\n _admin = admin;\n }\n\n /// @notice Migrate the catalysts for a batch of assets.\n /// @param migrations The data to use for each migration in the batch.\n function batchMigrate(Migration[] calldata migrations) external override {\n require(msg.sender == _admin, \"NOT_AUTHORIZED\");\n for (uint256 i = 0; i < migrations.length; i++) {\n _migrate(migrations[i].assetId, migrations[i].gemIds, migrations[i].blockNumber);\n }\n emit BatchCatalystMigrationDone();\n }\n\n /// @notice Set the registry migration contract\n /// @param migrationContract The migration contract for AssetAttributesRegistry\n function setAssetAttributesRegistryMigrationContract(address migrationContract) external {\n require(msg.sender == _admin, \"NOT_AUTHORIZED\");\n _registry.setMigrationContract(migrationContract);\n }\n\n /// @dev Perform the migration of the catalyst. See `migrate(...)`\n function _migrate(\n uint256 assetId,\n uint16[] memory oldGemIds,\n uint64 blockNumber\n ) internal {\n (bool oldExists, uint256 oldCatalystId) = _oldRegistry.getCatalyst(assetId);\n require(oldExists, \"OLD_CATALYST_NOT_EXIST\");\n (bool exists, , ) = _registry.getRecord(assetId);\n require(!exists, \"ALREADY_MIGRATED\");\n oldCatalystId += 1; // old catalyst start from 0 , new one start with common = 1\n if (assetId & IS_NFT != 0) {\n // ensure this NFT has no collection: original NFT\n // If it has, the collection itself need to be migrated\n try _asset.collectionOf(assetId) returns (uint256 collId) {\n require(collId == 0, \"NOT_ORIGINAL_NFT\");\n // solhint-disable-next-line no-empty-blocks\n } catch {}\n }\n // old gems started from 0, new gems starts with power = 1\n for (uint256 i = 0; i < oldGemIds.length; i++) {\n oldGemIds[i] += 1;\n }\n _registry.setCatalystWithBlockNumber(assetId, uint16(oldCatalystId), oldGemIds, blockNumber);\n }\n}\n" + }, + "src/solc_0.8/catalyst/DefaultAttributes.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../common/interfaces/IAttributes.sol\";\n\ncontract DefaultAttributes is IAttributes {\n uint256 internal constant MAX_NUM_GEMS = 15;\n uint256 internal constant MAX_NUM_GEM_TYPES = 256;\n\n /// @notice Returns the values for each gem included in a given asset.\n /// @param assetId The asset tokenId.\n /// @param events An array of GemEvents. Be aware that only gemEvents from the last CatalystApplied event onwards should be used to populate a query. If gemEvents from multiple CatalystApplied events are included the output values will be incorrect.\n /// @return values An array of values for each gem present in the asset.\n function getAttributes(uint256 assetId, IAssetAttributesRegistry.GemEvent[] calldata events)\n external\n pure\n override\n returns (uint32[] memory values)\n {\n values = new uint32[](MAX_NUM_GEM_TYPES);\n\n uint256 numGems;\n for (uint256 i = 0; i < events.length; i++) {\n numGems += events[i].gemIds.length;\n }\n require(numGems <= MAX_NUM_GEMS, \"TOO_MANY_GEMS\");\n\n uint32 minValue = (uint32(numGems) - 1) * 5 + 1;\n\n uint256 numGemsSoFar = 0;\n for (uint256 i = 0; i < events.length; i++) {\n numGemsSoFar += events[i].gemIds.length;\n for (uint256 j = 0; j < events[i].gemIds.length; j++) {\n uint256 gemId = events[i].gemIds[j];\n uint256 slotIndex = numGemsSoFar - events[i].gemIds.length + j;\n if (values[gemId] == 0) {\n // first gem : value = roll between ((numGemsSoFar-1)*5+1) and 25\n values[gemId] = _computeValue(\n assetId,\n gemId,\n events[i].blockHash,\n slotIndex,\n (uint32(numGemsSoFar) - 1) * 5 + 1\n );\n // bump previous values:\n if (values[gemId] < minValue) {\n values[gemId] = minValue;\n }\n } else {\n // further gem, previous roll are overriden with 25 and new roll between 1 and 25\n uint32 newRoll = _computeValue(assetId, gemId, events[i].blockHash, slotIndex, 1);\n values[gemId] = (((values[gemId] - 1) / 25) + 1) * 25 + newRoll;\n }\n }\n }\n }\n\n /// @dev compute a random value between min to 25.\n /// example: 1-25, 6-25, 11-25, 16-25\n /// @param assetId The id of the asset.\n /// @param gemId The id of the gem.\n /// @param blockHash The blockHash from the gemEvent.\n /// @param slotIndex Index of the current gem.\n /// @param min The minumum value this gem can have.\n /// @return The computed value for the given gem.\n function _computeValue(\n uint256 assetId,\n uint256 gemId,\n bytes32 blockHash,\n uint256 slotIndex,\n uint32 min\n ) internal pure returns (uint32) {\n return min + uint16(uint256(keccak256(abi.encodePacked(gemId, assetId, blockHash, slotIndex))) % (26 - min));\n }\n}\n" + }, + "src/solc_0.8/catalyst/GemsCatalystsRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IGem} from \"./interfaces/IGem.sol\";\nimport {ICatalyst, IAssetAttributesRegistry} from \"./interfaces/ICatalyst.sol\";\nimport {IERC20Extended, IERC20} from \"../common/interfaces/IERC20Extended.sol\";\nimport {IGemsCatalystsRegistry} from \"./interfaces/IGemsCatalystsRegistry.sol\";\nimport {ERC2771HandlerUpgradeable} from \"../common/BaseWithStorage/ERC2771/ERC2771HandlerUpgradeable.sol\";\nimport {\n AccessControlUpgradeable,\n ContextUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\n\n/// @notice Contract managing the Gems and Catalysts\n/// @notice The following privileged roles are used in this contract: DEFAULT_ADMIN_ROLE, SUPER_OPERATOR_ROLE\n/// @dev Each Gems and Catalyst must be registered here.\n/// @dev Each new Gem get assigned a new id (starting at 1)\n/// @dev Each new Catalyst get assigned a new id (starting at 1)\n/// @dev DEFAULT_ADMIN_ROLE is intended for contract setup / emergency, SUPER_OPERATOR_ROLE is provided for business purposes\ncontract GemsCatalystsRegistry is ERC2771HandlerUpgradeable, IGemsCatalystsRegistry, AccessControlUpgradeable {\n uint256 private constant MAX_GEMS_AND_CATALYSTS = 256;\n uint256 internal constant MAX_UINT256 = type(uint256).max;\n bytes32 public constant SUPER_OPERATOR_ROLE = keccak256(\"SUPER_OPERATOR_ROLE\");\n\n IGem[] internal _gems;\n ICatalyst[] internal _catalysts;\n\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\n event AddGemsAndCatalysts(IGem[] gems, ICatalyst[] catalysts);\n event SetGemsAndCatalystsAllowance(address owner, uint256 allowanceValue);\n\n // solhint-disable-next-line no-empty-blocks\n constructor() initializer {}\n\n function initV1(address trustedForwarder, address admin) external initializer {\n require(trustedForwarder != address(0), \"TRUSTED_FORWARDER_ZERO_ADDRESS\");\n require(admin != address(0), \"ADMIN_ZERO_ADDRESS\");\n _grantRole(DEFAULT_ADMIN_ROLE, admin);\n __ERC2771Handler_initialize(trustedForwarder);\n __AccessControl_init();\n }\n\n /// @notice Returns the values for each gem included in a given asset.\n /// @param catalystId The catalyst identifier.\n /// @param assetId The asset tokenId.\n /// @param events An array of GemEvents. Be aware that only gemEvents from the last CatalystApplied event onwards should be used to populate a query. If gemEvents from multiple CatalystApplied events are included the output values will be incorrect.\n /// @return values An array of values for each gem present in the asset.\n function getAttributes(\n uint16 catalystId,\n uint256 assetId,\n IAssetAttributesRegistry.GemEvent[] calldata events\n ) external view override returns (uint32[] memory values) {\n ICatalyst catalyst = getCatalyst(catalystId);\n require(catalyst != ICatalyst(address(0)), \"CATALYST_DOES_NOT_EXIST\");\n return catalyst.getAttributes(assetId, events);\n }\n\n /// @notice Returns the maximum number of gems for a given catalyst\n /// @param catalystId catalyst identifier\n function getMaxGems(uint16 catalystId) external view override returns (uint8) {\n ICatalyst catalyst = getCatalyst(catalystId);\n require(catalyst != ICatalyst(address(0)), \"CATALYST_DOES_NOT_EXIST\");\n return catalyst.getMaxGems();\n }\n\n /// @notice Returns the decimals for a given catalyst\n /// @param catalystId catalyst identifier\n function getCatalystDecimals(uint16 catalystId) external view override returns (uint8) {\n ICatalyst catalyst = getCatalyst(catalystId);\n require(catalyst != ICatalyst(address(0)), \"CATALYST_DOES_NOT_EXIST\");\n return catalyst.getDecimals();\n }\n\n /// @notice Returns the decimals for a given gem\n /// @param gemId gem identifier\n function getGemDecimals(uint16 gemId) external view override returns (uint8) {\n IGem gem = getGem(gemId);\n require(gem != IGem(address(0)), \"GEM_DOES_NOT_EXIST\");\n return gem.getDecimals();\n }\n\n /// @notice Burns few gem units from each gem id on behalf of a beneficiary\n /// @param from address of the beneficiary to burn on behalf of\n /// @param gemIds list of gems to burn gem units from each\n /// @param amounts list of amounts of units to burn\n function batchBurnGems(\n address from,\n uint16[] calldata gemIds,\n uint256[] calldata amounts\n ) external override {\n uint256 gemIdsLength = gemIds.length;\n require(gemIdsLength == amounts.length, \"GemsCatalystsRegistry: gemsIds and amounts length mismatch\");\n for (uint256 i = 0; i < gemIdsLength; i++) {\n if (gemIds[i] != 0 && amounts[i] != 0) {\n burnGem(from, gemIds[i], amounts[i]);\n }\n }\n }\n\n /// @notice Burns few catalyst units from each catalyst id on behalf of a beneficiary\n /// @param from address of the beneficiary to burn on behalf of\n /// @param catalystIds list of catalysts to burn catalyst units from each\n /// @param amounts list of amounts of units to burn\n function batchBurnCatalysts(\n address from,\n uint16[] calldata catalystIds,\n uint256[] calldata amounts\n ) external override {\n uint256 catalystIdsLength = catalystIds.length;\n require(catalystIdsLength == amounts.length, \"GemsCatalystsRegistry: catalystIds and amounts length mismatch\");\n for (uint256 i = 0; i < catalystIdsLength; i++) {\n if (catalystIds[i] != 0 && amounts[i] != 0) {\n burnCatalyst(from, catalystIds[i], amounts[i]);\n }\n }\n }\n\n /// @notice Adds both arrays of gems and catalysts to registry\n /// @param gems array of gems to be added\n /// @param catalysts array of catalysts to be added\n function addGemsAndCatalysts(IGem[] calldata gems, ICatalyst[] calldata catalysts)\n external\n override\n onlyRole(DEFAULT_ADMIN_ROLE)\n {\n require(\n uint256(_gems.length + _catalysts.length + gems.length + catalysts.length) < MAX_GEMS_AND_CATALYSTS,\n \"GemsCatalystsRegistry: Too many gem and catalyst contracts\"\n );\n\n for (uint256 i = 0; i < gems.length; i++) {\n IGem gem = gems[i];\n require(address(gem) != address(0), \"GEM_ZERO_ADDRESS\");\n uint16 gemId = gem.gemId();\n require(gemId == _gems.length + 1, \"GEM_ID_NOT_IN_ORDER\");\n _gems.push(gem);\n }\n\n for (uint256 i = 0; i < catalysts.length; i++) {\n ICatalyst catalyst = catalysts[i];\n require(address(catalyst) != address(0), \"CATALYST_ZERO_ADDRESS\");\n uint16 catalystId = catalyst.catalystId();\n require(catalystId == _catalysts.length + 1, \"CATALYST_ID_NOT_IN_ORDER\");\n _catalysts.push(catalyst);\n }\n emit AddGemsAndCatalysts(gems, catalysts);\n }\n\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(trustedForwarder != address(0), \"ZERO_ADDRESS\");\n _trustedForwarder = trustedForwarder;\n emit TrustedForwarderChanged(trustedForwarder);\n }\n\n /// @notice Query whether a given gem exists.\n /// @param gemId The gem being queried.\n /// @return Whether the gem exists.\n function doesGemExist(uint16 gemId) external view override returns (bool) {\n return getGem(gemId) != IGem(address(0));\n }\n\n /// @notice Query whether a giving catalyst exists.\n /// @param catalystId The catalyst being queried.\n /// @return Whether the catalyst exists.\n function doesCatalystExist(uint16 catalystId) external view returns (bool) {\n return getCatalyst(catalystId) != ICatalyst(address(0));\n }\n\n /// @notice Burn a catalyst.\n /// @param from The signing address for the tx.\n /// @param catalystId The id of the catalyst to burn.\n /// @param amount The number of catalyst tokens to burn.\n function burnCatalyst(\n address from,\n uint16 catalystId,\n uint256 amount\n ) public override checkAuthorization(from) {\n ICatalyst catalyst = getCatalyst(catalystId);\n require(catalyst != ICatalyst(address(0)), \"CATALYST_DOES_NOT_EXIST\");\n catalyst.burnFor(from, amount);\n }\n\n /// @notice Burn a gem.\n /// @param from The signing address for the tx.\n /// @param gemId The id of the gem to burn.\n /// @param amount The number of gem tokens to burn.\n function burnGem(\n address from,\n uint16 gemId,\n uint256 amount\n ) public override checkAuthorization(from) {\n IGem gem = getGem(gemId);\n require(gem != IGem(address(0)), \"GEM_DOES_NOT_EXIST\");\n gem.burnFor(from, amount);\n }\n\n function getNumberOfCatalystContracts() external view returns (uint256 number) {\n number = _catalysts.length;\n }\n\n function getNumberOfGemContracts() external view returns (uint256 number) {\n number = _gems.length;\n }\n\n /// @dev Only the owner, SUPER_OPERATOR_ROLE or APPROVER_ROLE may set the allowance\n function revokeGemsandCatalystsMaxAllowance() external {\n _setGemsAndCatalystsAllowance(0);\n }\n\n /// @dev Only the owner, SUPER_OPERATOR_ROLE or APPROVER_ROLE may set the allowance\n function setGemsAndCatalystsMaxAllowance() external {\n _setGemsAndCatalystsAllowance(MAX_UINT256);\n }\n\n /// @dev Get the catalyst contract corresponding to the id.\n /// @param catalystId The catalyst id to use to retrieve the contract.\n /// @return The requested Catalyst contract.\n function getCatalyst(uint16 catalystId) public view returns (ICatalyst) {\n if (catalystId > 0 && catalystId <= _catalysts.length) {\n return _catalysts[catalystId - 1];\n } else {\n return ICatalyst(address(0));\n }\n }\n\n /// @dev Get the gem contract corresponding to the id.\n /// @param gemId The gem id to use to retrieve the contract.\n /// @return The requested Gem contract.\n function getGem(uint16 gemId) public view returns (IGem) {\n if (gemId > 0 && gemId <= _gems.length) {\n return _gems[gemId - 1];\n } else {\n return IGem(address(0));\n }\n }\n\n /// @dev verify that the caller is authorized for this function call.\n /// @param from The original signer of the transaction.\n modifier checkAuthorization(address from) {\n require(_msgSender() == from || hasRole(SUPER_OPERATOR_ROLE, _msgSender()), \"AUTH_ACCESS_DENIED\");\n _;\n }\n\n function _setGemsAndCatalystsAllowance(uint256 allowanceValue) internal {\n for (uint256 i = 0; i < _gems.length; i++) {\n require(_gems[i].approveFor(_msgSender(), address(this), allowanceValue), \"GEM_ALLOWANCE_NOT_APPROVED\");\n }\n\n for (uint256 i = 0; i < _catalysts.length; i++) {\n require(\n _catalysts[i].approveFor(_msgSender(), address(this), allowanceValue),\n \"CATALYST_ALLOWANCE_NOT_APPROVED\"\n );\n }\n emit SetGemsAndCatalystsAllowance(_msgSender(), allowanceValue);\n }\n\n function _msgSender()\n internal\n view\n override(ContextUpgradeable, ERC2771HandlerUpgradeable)\n returns (address sender)\n {\n return ERC2771HandlerUpgradeable._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771HandlerUpgradeable) returns (bytes calldata) {\n return ERC2771HandlerUpgradeable._msgData();\n }\n}\n" + }, + "src/solc_0.8/catalyst/GemV1.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./interfaces/IGem.sol\";\nimport \"../common/BaseWithStorage/ERC20/ERC20TokenUpgradeable.sol\";\n\ncontract GemV1 is IGem, ERC20TokenUpgradeable {\n uint16 public override gemId;\n bytes32 public constant APPROVER_ROLE = keccak256(\"APPROVER_ROLE\");\n\n function __GemV1_init(\n string memory name,\n string memory symbol,\n address trustedForwarder,\n address admin,\n uint16 _gemId,\n address approver\n ) public initializer {\n __ERC20TokenUpgradeable_init(name, symbol, trustedForwarder, admin);\n gemId = _gemId;\n _grantRole(APPROVER_ROLE, approver);\n }\n\n /// @notice Approve `spender` to transfer `amount` tokens from `owner`.\n /// @param owner The address whose token is allowed.\n /// @param spender The address to be given rights to transfer.\n /// @param amount The number of tokens allowed.\n /// @return success Whether or not the call succeeded.\n function approveFor(\n address owner,\n address spender,\n uint256 amount\n ) external override(ERC20BaseTokenUpgradeable, IGem) returns (bool success) {\n require(\n _msgSender() == owner || hasRole(SUPER_OPERATOR_ROLE, _msgSender()) || hasRole(APPROVER_ROLE, _msgSender()),\n \"NOT_AUTHORIZED\"\n );\n _approveFor(owner, spender, amount);\n return true;\n }\n\n function getDecimals() external pure override returns (uint8) {\n return ERC20BaseTokenUpgradeable.decimals();\n }\n}\n" + }, + "src/solc_0.8/catalyst/interfaces/ICatalyst.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../common/interfaces/IAssetAttributesRegistry.sol\";\nimport \"../../common/interfaces/IAttributes.sol\";\nimport \"../../common/interfaces/IERC20Extended.sol\";\n\ninterface ICatalyst is IERC20Extended, IAttributes {\n function catalystId() external returns (uint16);\n\n function changeAttributes(IAttributes attributes) external;\n\n function getMaxGems() external view returns (uint8);\n\n function approveFor(\n address owner,\n address spender,\n uint256 amount\n ) external override returns (bool success);\n\n function getAttributes(uint256 assetId, IAssetAttributesRegistry.GemEvent[] calldata events)\n external\n view\n override\n returns (uint32[] memory values);\n\n function getDecimals() external pure returns (uint8);\n}\n" + }, + "src/solc_0.8/catalyst/interfaces/ICollectionCatalystMigrations.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\npragma experimental ABIEncoderV2;\n\ninterface ICollectionCatalystMigrations {\n struct Migration {\n uint256 assetId;\n uint16[] gemIds;\n uint64 blockNumber;\n }\n\n function batchMigrate(Migration[] calldata migrations) external;\n}\n" + }, + "src/solc_0.8/catalyst/interfaces/IGem.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../common/interfaces/IERC20Extended.sol\";\n\ninterface IGem is IERC20Extended {\n function gemId() external returns (uint16);\n\n function approveFor(\n address owner,\n address spender,\n uint256 amount\n ) external override returns (bool success);\n\n function getDecimals() external pure returns (uint8);\n}\n" + }, + "src/solc_0.8/catalyst/interfaces/IGemsCatalystsRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../common/interfaces/IAssetAttributesRegistry.sol\";\nimport \"./IGem.sol\";\nimport \"./ICatalyst.sol\";\n\ninterface IGemsCatalystsRegistry {\n function getAttributes(\n uint16 catalystId,\n uint256 assetId,\n IAssetAttributesRegistry.GemEvent[] calldata events\n ) external view returns (uint32[] memory values);\n\n function getMaxGems(uint16 catalystId) external view returns (uint8);\n\n function batchBurnGems(\n address from,\n uint16[] calldata gemIds,\n uint256[] calldata amounts\n ) external;\n\n function batchBurnCatalysts(\n address from,\n uint16[] calldata catalystIds,\n uint256[] calldata amounts\n ) external;\n\n function addGemsAndCatalysts(IGem[] calldata gems, ICatalyst[] calldata catalysts) external;\n\n function doesGemExist(uint16 gemId) external view returns (bool);\n\n function burnCatalyst(\n address from,\n uint16 catalystId,\n uint256 amount\n ) external;\n\n function burnGem(\n address from,\n uint16 gemId,\n uint256 amount\n ) external;\n\n function getCatalystDecimals(uint16 catalystId) external view returns (uint8);\n\n function getGemDecimals(uint16 gemId) external view returns (uint8);\n}\n" + }, + "src/solc_0.8/catalyst/interfaces/IOldCatalystRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface IOldCatalystRegistry {\n function getCatalyst(uint256 assetId) external view returns (bool exists, uint256 catalystId);\n}\n" + }, + "src/solc_0.8/claims/AssetGiveaway/AssetGiveaway.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\nimport \"./ClaimERC1155.sol\";\nimport \"../../common/BaseWithStorage/WithAdmin.sol\";\n\n/// @title AssetGiveaway contract.\n/// @notice This contract manages ERC1155 claims.\ncontract AssetGiveaway is WithAdmin, ClaimERC1155 {\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n uint256 internal immutable _expiryTime;\n mapping(address => bool) public claimed;\n\n constructor(\n address asset,\n address admin,\n bytes32 merkleRoot,\n address assetsHolder,\n uint256 expiryTime\n ) ClaimERC1155(IERC1155(asset), assetsHolder) {\n _admin = admin;\n _merkleRoot = merkleRoot;\n _expiryTime = expiryTime;\n }\n\n /// @notice Function to set the merkle root hash for the asset data, if it is 0.\n /// @param merkleRoot The merkle root hash of the asset data.\n function setMerkleRoot(bytes32 merkleRoot) external onlyAdmin {\n require(_merkleRoot == 0, \"MERKLE_ROOT_ALREADY_SET\");\n _merkleRoot = merkleRoot;\n }\n\n /// @notice Function to permit the claiming of an asset to a reserved address.\n /// @param to The intended recipient (reserved address) of the ERC1155 tokens.\n /// @param assetIds The array of IDs of the asset tokens.\n /// @param assetValues The amounts of each token ID to transfer.\n /// @param proof The proof submitted for verification.\n /// @param salt The salt submitted for verification.\n function claimAssets(\n address to,\n uint256[] calldata assetIds,\n uint256[] calldata assetValues,\n bytes32[] calldata proof,\n bytes32 salt\n ) external {\n require(block.timestamp < _expiryTime, \"CLAIM_PERIOD_IS_OVER\");\n require(to != address(0), \"INVALID_TO_ZERO_ADDRESS\");\n require(claimed[to] == false, \"DESTINATION_ALREADY_CLAIMED\");\n claimed[to] = true;\n _claimERC1155(to, assetIds, assetValues, proof, salt);\n }\n\n function onERC1155Received(\n address, /*operator*/\n address, /*from*/\n uint256, /*id*/\n uint256, /*value*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address, /*operator*/\n address, /*from*/\n uint256[] calldata, /*ids*/\n uint256[] calldata, /*values*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n}\n" + }, + "src/solc_0.8/claims/AssetGiveaway/ClaimERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\n\ncontract ClaimERC1155 {\n bytes32 internal _merkleRoot;\n IERC1155 internal immutable _asset;\n address internal immutable _assetsHolder;\n event ClaimedAssets(address to, uint256[] assetIds, uint256[] assetValues);\n\n constructor(IERC1155 asset, address assetsHolder) {\n _asset = asset;\n if (assetsHolder == address(0)) {\n assetsHolder = address(this);\n }\n _assetsHolder = assetsHolder;\n }\n\n /// @dev See for example AssetGiveaway.sol claimAssets.\n function _claimERC1155(\n address to,\n uint256[] calldata assetIds,\n uint256[] calldata assetValues,\n bytes32[] calldata proof,\n bytes32 salt\n ) internal {\n _checkValidity(to, assetIds, assetValues, proof, salt);\n _sendAssets(to, assetIds, assetValues);\n emit ClaimedAssets(to, assetIds, assetValues);\n }\n\n function _checkValidity(\n address to,\n uint256[] memory assetIds,\n uint256[] memory assetValues,\n bytes32[] memory proof,\n bytes32 salt\n ) internal view {\n require(assetIds.length == assetValues.length, \"INVALID_INPUT\");\n bytes32 leaf = _generateClaimHash(to, assetIds, assetValues, salt);\n require(_verify(proof, leaf), \"INVALID_CLAIM\");\n }\n\n function _generateClaimHash(\n address to,\n uint256[] memory assetIds,\n uint256[] memory assetValues,\n bytes32 salt\n ) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(to, assetIds, assetValues, salt));\n }\n\n function _verify(bytes32[] memory proof, bytes32 computedHash) internal view returns (bool) {\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n\n if (computedHash < proofElement) {\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\n } else {\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\n }\n }\n\n return computedHash == _merkleRoot;\n }\n\n function _sendAssets(\n address to,\n uint256[] memory assetIds,\n uint256[] memory assetValues\n ) internal {\n _asset.safeBatchTransferFrom(_assetsHolder, to, assetIds, assetValues, \"\");\n }\n}\n" + }, + "src/solc_0.8/claims/MultiGiveaway/ClaimERC1155ERC721ERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IERC1155} from \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\nimport {IERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport {MerkleProof} from \"@openzeppelin/contracts-0.8/utils/cryptography/MerkleProof.sol\";\nimport {IERC721Extended} from \"../../common/interfaces/IERC721Extended.sol\";\n\ncontract ClaimERC1155ERC721ERC20 {\n using SafeERC20 for IERC20;\n\n struct Claim {\n address to;\n ERC1155Claim[] erc1155;\n ERC721Claim[] erc721;\n ERC20Claim erc20;\n bytes32 salt;\n }\n\n struct ERC1155Claim {\n uint256[] ids;\n uint256[] values;\n address contractAddress;\n }\n\n struct ERC721Claim {\n uint256[] ids;\n address contractAddress;\n }\n\n struct ERC20Claim {\n uint256[] amounts;\n address[] contractAddresses;\n }\n\n /// @dev Emits when a successful claim occurs.\n /// @param to The destination address for the claimed ERC1155, ERC721 and ERC20 tokens.\n /// @param erc1155 The array of ERC1155Claim structs containing the ids, values and ERC1155 contract address.\n /// @param erc721 The array of ERC721Claim structs containing the ids and ERC721 contract address.\n /// @param erc20 The ERC20Claim struct containing the amounts and ERC20 contract addresses.\n /// @param merkleRoot The merkle root hash for the specific set of items being claimed.\n event ClaimedMultipleTokens(\n address to,\n ERC1155Claim[] erc1155,\n ERC721Claim[] erc721,\n ERC20Claim erc20,\n bytes32 merkleRoot\n );\n\n /// @dev Internal function used to claim multiple token types in one claim.\n /// @param merkleRoot The merkle root hash for the specific set of items being claimed.\n /// @param claim The claim struct containing the destination address, all items to be claimed and optional salt param.\n /// @param proof The proof provided by the user performing the claim function.\n function _claimERC1155ERC721ERC20(\n bytes32 merkleRoot,\n Claim memory claim,\n bytes32[] calldata proof\n ) internal {\n _checkValidity(merkleRoot, claim, proof);\n for (uint256 i = 0; i < claim.erc1155.length; i++) {\n require(claim.erc1155[i].ids.length == claim.erc1155[i].values.length, \"CLAIM_INVALID_INPUT\");\n _transferERC1155(claim.to, claim.erc1155[i].ids, claim.erc1155[i].values, claim.erc1155[i].contractAddress);\n }\n for (uint256 i = 0; i < claim.erc721.length; i++) {\n _transferERC721(claim.to, claim.erc721[i].ids, claim.erc721[i].contractAddress);\n }\n if (claim.erc20.amounts.length != 0) {\n require(claim.erc20.amounts.length == claim.erc20.contractAddresses.length, \"CLAIM_INVALID_INPUT\");\n _transferERC20(claim.to, claim.erc20.amounts, claim.erc20.contractAddresses);\n }\n emit ClaimedMultipleTokens(claim.to, claim.erc1155, claim.erc721, claim.erc20, merkleRoot);\n }\n\n /// @dev Private function used to check the validity of a specific claim.\n /// @param merkleRoot The merkle root hash for the specific set of items being claimed.\n /// @param claim The claim struct containing the destination address, all items to be claimed and optional salt param.\n /// @param proof The proof provided by the user performing the claim function.\n function _checkValidity(\n bytes32 merkleRoot,\n Claim memory claim,\n bytes32[] memory proof\n ) private pure {\n bytes32 leaf = _generateClaimHash(claim);\n require(MerkleProof.verify(proof, merkleRoot, leaf), \"CLAIM_INVALID\");\n }\n\n /// @dev Internal function used to generate a hash from an encoded claim.\n /// @param claim The claim struct.\n function _generateClaimHash(Claim memory claim) internal pure returns (bytes32) {\n return keccak256(abi.encode(claim));\n }\n\n /// @dev Private function used to transfer the ERC1155 tokens specified in a specific claim.\n /// @param to The destination address for the claimed tokens.\n /// @param ids The array of ERC1155 ids.\n /// @param values The amount of ERC1155 tokens of each id to be transferred.\n /// @param contractAddress The ERC1155 token contract address.\n function _transferERC1155(\n address to,\n uint256[] memory ids,\n uint256[] memory values,\n address contractAddress\n ) private {\n require(contractAddress != address(0), \"CLAIM_INVALID_CONTRACT_ZERO_ADDRESS\");\n IERC1155(contractAddress).safeBatchTransferFrom(address(this), to, ids, values, \"\");\n }\n\n /// @dev Private function used to transfer the ERC721tokens specified in a specific claim.\n /// @param to The destination address for the claimed tokens.\n /// @param ids The array of ERC721 ids.\n /// @param contractAddress The ERC721 token contract address.\n function _transferERC721(\n address to,\n uint256[] memory ids,\n address contractAddress\n ) private {\n require(contractAddress != address(0), \"CLAIM_INVALID_CONTRACT_ZERO_ADDRESS\");\n IERC721Extended(contractAddress).safeBatchTransferFrom(address(this), to, ids, \"\");\n }\n\n /// @dev Private function used to transfer the ERC20 tokens specified in a specific claim.\n /// @param to The destination address for the claimed tokens.\n /// @param amounts The array of amounts of ERC20 tokens to be transferred.\n /// @param contractAddresses The array of ERC20 token contract addresses.\n function _transferERC20(\n address to,\n uint256[] memory amounts,\n address[] memory contractAddresses\n ) private {\n for (uint256 i = 0; i < amounts.length; i++) {\n address erc20ContractAddress = contractAddresses[i];\n uint256 erc20Amount = amounts[i];\n require(erc20ContractAddress != address(0), \"CLAIM_INVALID_CONTRACT_ZERO_ADDRESS\");\n IERC20(erc20ContractAddress).safeTransferFrom(address(this), to, erc20Amount);\n }\n }\n}\n" + }, + "src/solc_0.8/claims/MultiGiveaway/MultiGiveaway.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {Context} from \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport {ClaimERC1155ERC721ERC20} from \"./ClaimERC1155ERC721ERC20.sol\";\nimport {AccessControl} from \"@openzeppelin/contracts-0.8/access/AccessControl.sol\";\nimport {Pausable} from \"@openzeppelin/contracts-0.8/security/Pausable.sol\";\nimport {ERC2771Handler} from \"../../common/BaseWithStorage/ERC2771Handler.sol\";\n\n/// @title A Multi Claim contract that enables claims of user rewards in the form of ERC1155, ERC721 and / or ERC20 tokens\n/// @notice This contract manages claims for multiple token types\n/// @dev The contract implements ERC2771 to ensure that users do not pay gas\ncontract MultiGiveaway is AccessControl, ClaimERC1155ERC721ERC20, ERC2771Handler, Pausable {\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n bytes4 internal constant ERC721_RECEIVED = 0x150b7a02;\n bytes4 internal constant ERC721_BATCH_RECEIVED = 0x4b808c46;\n\n mapping(address => mapping(bytes32 => bool)) public claimed;\n mapping(bytes32 => uint256) internal _expiryTime;\n\n event NewGiveaway(bytes32 merkleRoot, uint256 expiryTime);\n event NewTrustedForwarder(address trustedForwarder);\n\n constructor(address admin, address trustedForwarder) {\n _setupRole(DEFAULT_ADMIN_ROLE, admin);\n __ERC2771Handler_initialize(trustedForwarder);\n }\n\n /// @notice Function to add a new giveaway.\n /// @param merkleRoot The merkle root hash of the claim data.\n /// @param expiryTime The expiry time for the giveaway.\n function addNewGiveaway(bytes32 merkleRoot, uint256 expiryTime)\n external\n onlyRole(DEFAULT_ADMIN_ROLE)\n whenNotPaused()\n {\n _expiryTime[merkleRoot] = expiryTime;\n emit NewGiveaway(merkleRoot, expiryTime);\n }\n\n /// @notice set the trusted forwarder\n /// @param trustedForwarder address of the contract that is enabled to send meta-tx on behalf of the user\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _trustedForwarder = trustedForwarder;\n\n emit NewTrustedForwarder(trustedForwarder);\n }\n\n /// @notice Function to permit the claiming of multiple tokens from multiple giveaways to a reserved address.\n /// @param claims The array of claim structs, each containing a destination address, the giveaway items to be claimed and an optional salt param.\n /// @param proofs The proofs submitted for verification.\n function claimMultipleTokensFromMultipleMerkleTree(\n bytes32[] calldata rootHashes,\n Claim[] memory claims,\n bytes32[][] calldata proofs\n ) external {\n require(claims.length == rootHashes.length, \"MULTIGIVEAWAY_INVALID_INPUT\");\n require(claims.length == proofs.length, \"MULTIGIVEAWAY_INVALID_INPUT\");\n for (uint256 i = 0; i < rootHashes.length; i++) {\n claimMultipleTokens(rootHashes[i], claims[i], proofs[i]);\n }\n }\n\n /// @notice Function to check which giveaways have been claimed by a particular user.\n /// @param user The user (intended token destination) address.\n /// @param claims The claim struct containing the destination address, all items to be claimed and optional salt param.\n /// @return claimedGiveaways The array of bools confirming whether or not the giveaways relating to the root hashes provided have been claimed.\n function getClaimedStatus(address user, Claim[] memory claims) external view returns (bool[] memory) {\n bool[] memory claimedGiveaways = new bool[](claims.length);\n for (uint256 i = 0; i < claims.length; i++) {\n bytes32 merkleLeaf = _generateClaimHash(claims[i]);\n claimedGiveaways[i] = claimed[user][merkleLeaf];\n }\n return claimedGiveaways;\n }\n\n /// @dev Public function used to perform validity checks and progress to claim multiple token types in one claim.\n /// @param merkleRoot The merkle root hash for the specific set of items being claimed.\n /// @param claim The claim struct containing the destination address, all items to be claimed and optional salt param.\n /// @param proof The proof provided by the user performing the claim function.\n function claimMultipleTokens(\n bytes32 merkleRoot,\n Claim memory claim,\n bytes32[] calldata proof\n ) public whenNotPaused() {\n uint256 giveawayExpiryTime = _expiryTime[merkleRoot];\n require(claim.to != address(0), \"MULTIGIVEAWAY_INVALID_TO_ZERO_ADDRESS\");\n require(claim.to != address(this), \"MULTIGIVEAWAY_DESTINATION_MULTIGIVEAWAY_CONTRACT\");\n require(giveawayExpiryTime != 0, \"MULTIGIVEAWAY_DOES_NOT_EXIST\");\n require(block.timestamp < giveawayExpiryTime, \"MULTIGIVEAWAY_CLAIM_PERIOD_IS_OVER\");\n bytes32 merkleLeaf = _generateClaimHash(claim);\n require(claimed[claim.to][merkleLeaf] == false, \"MULTIGIVEAWAY_DESTINATION_ALREADY_CLAIMED\");\n claimed[claim.to][merkleLeaf] = true;\n\n _claimERC1155ERC721ERC20(merkleRoot, claim, proof);\n }\n\n function onERC721Received(\n address, /*operator*/\n address, /*from*/\n uint256, /*id*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC721_RECEIVED;\n }\n\n function onERC721BatchReceived(\n address, /*operator*/\n address, /*from*/\n uint256[] calldata, /*ids*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC721_BATCH_RECEIVED;\n }\n\n function onERC1155Received(\n address, /*operator*/\n address, /*from*/\n uint256, /*id*/\n uint256, /*value*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address, /*operator*/\n address, /*from*/\n uint256[] calldata, /*ids*/\n uint256[] calldata, /*values*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n\n function _msgSender() internal view override(Context, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n}\n" + }, + "src/solc_0.8/claims/MultiGiveawayV2/ClaimERC1155ERC721ERC20V2.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IERC1155} from \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\nimport {IERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport {MerkleProof} from \"@openzeppelin/contracts-0.8/utils/cryptography/MerkleProof.sol\";\nimport {IERC721Extended} from \"../../common/interfaces/IERC721Extended.sol\";\n\ncontract ClaimERC1155ERC721ERC20V2 {\n using SafeERC20 for IERC20;\n\n struct Claim {\n address to;\n ERC1155Claim[] erc1155;\n ERC721Claim[] erc721;\n ERC20Claim erc20;\n bytes32 salt;\n }\n\n struct ERC1155Claim {\n uint256[] ids;\n uint256[] values;\n address contractAddress;\n }\n\n struct ERC721Claim {\n uint256[] ids;\n address contractAddress;\n }\n\n struct ERC20Claim {\n uint256[] amounts;\n address[] contractAddresses;\n }\n\n /// @dev Emits when a successful claim occurs.\n /// @param to The destination address for the claimed ERC1155, ERC721 and ERC20 tokens.\n /// @param erc1155 The array of ERC1155Claim structs containing the ids, values and ERC1155 contract address.\n /// @param erc721 The array of ERC721Claim structs containing the ids and ERC721 contract address.\n /// @param erc20 The ERC20Claim struct containing the amounts and ERC20 contract addresses.\n /// @param merkleRoot The merkle root hash for the specific set of items being claimed.\n event ClaimedMultipleTokens(\n address indexed to,\n ERC1155Claim[] erc1155,\n ERC721Claim[] erc721,\n ERC20Claim erc20,\n bytes32 merkleRoot\n );\n\n /// @dev Internal function used to claim multiple token types in one claim.\n /// @param merkleRoot The merkle root hash for the specific set of items being claimed.\n /// @param claim The claim struct containing the destination address, all items to be claimed and optional salt param.\n /// @param proof The proof provided by the user performing the claim function.\n function _claimERC1155ERC721ERC20(\n bytes32 merkleRoot,\n Claim memory claim,\n bytes32[] calldata proof\n ) internal {\n _checkValidity(merkleRoot, claim, proof);\n for (uint256 i = 0; i < claim.erc1155.length; i++) {\n require(claim.erc1155[i].ids.length == claim.erc1155[i].values.length, \"CLAIM_INVALID_INPUT\");\n _transferERC1155(claim.to, claim.erc1155[i].ids, claim.erc1155[i].values, claim.erc1155[i].contractAddress);\n }\n for (uint256 i = 0; i < claim.erc721.length; i++) {\n _transferERC721(claim.to, claim.erc721[i].ids, claim.erc721[i].contractAddress);\n }\n if (claim.erc20.amounts.length != 0) {\n require(claim.erc20.amounts.length == claim.erc20.contractAddresses.length, \"CLAIM_INVALID_INPUT\");\n _transferERC20(claim.to, claim.erc20.amounts, claim.erc20.contractAddresses);\n }\n emit ClaimedMultipleTokens(claim.to, claim.erc1155, claim.erc721, claim.erc20, merkleRoot);\n }\n\n /// @dev Private function used to check the validity of a specific claim.\n /// @param merkleRoot The merkle root hash for the specific set of items being claimed.\n /// @param claim The claim struct containing the destination address, all items to be claimed and optional salt param.\n /// @param proof The proof provided by the user performing the claim function.\n function _checkValidity(\n bytes32 merkleRoot,\n Claim memory claim,\n bytes32[] memory proof\n ) private pure {\n bytes32 leaf = _generateClaimHash(claim);\n require(MerkleProof.verify(proof, merkleRoot, leaf), \"CLAIM_INVALID\");\n }\n\n /// @dev Internal function used to generate a hash from an encoded claim.\n /// @param claim The claim struct.\n function _generateClaimHash(Claim memory claim) internal pure returns (bytes32) {\n return keccak256(abi.encode(claim));\n }\n\n /// @dev Private function used to transfer the ERC1155 tokens specified in a specific claim.\n /// @param to The destination address for the claimed tokens.\n /// @param ids The array of ERC1155 ids.\n /// @param values The amount of ERC1155 tokens of each id to be transferred.\n /// @param contractAddress The ERC1155 token contract address.\n function _transferERC1155(\n address to,\n uint256[] memory ids,\n uint256[] memory values,\n address contractAddress\n ) private {\n require(contractAddress != address(0), \"CLAIM_INVALID_CONTRACT_ZERO_ADDRESS\");\n IERC1155(contractAddress).safeBatchTransferFrom(address(this), to, ids, values, \"\");\n }\n\n /// @dev Private function used to transfer the ERC721tokens specified in a specific claim.\n /// @param to The destination address for the claimed tokens.\n /// @param ids The array of ERC721 ids.\n /// @param contractAddress The ERC721 token contract address.\n function _transferERC721(\n address to,\n uint256[] memory ids,\n address contractAddress\n ) private {\n require(contractAddress != address(0), \"CLAIM_INVALID_CONTRACT_ZERO_ADDRESS\");\n IERC721Extended(contractAddress).safeBatchTransferFrom(address(this), to, ids, \"\");\n }\n\n /// @dev Private function used to transfer the ERC20 tokens specified in a specific claim.\n /// @param to The destination address for the claimed tokens.\n /// @param amounts The array of amounts of ERC20 tokens to be transferred.\n /// @param contractAddresses The array of ERC20 token contract addresses.\n function _transferERC20(\n address to,\n uint256[] memory amounts,\n address[] memory contractAddresses\n ) private {\n for (uint256 i = 0; i < amounts.length; i++) {\n address erc20ContractAddress = contractAddresses[i];\n uint256 erc20Amount = amounts[i];\n require(erc20ContractAddress != address(0), \"CLAIM_INVALID_CONTRACT_ZERO_ADDRESS\");\n IERC20(erc20ContractAddress).safeTransferFrom(address(this), to, erc20Amount);\n }\n }\n}\n" + }, + "src/solc_0.8/claims/MultiGiveawayV2/MultiGiveawayV2.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {Context} from \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport {ClaimERC1155ERC721ERC20V2} from \"./ClaimERC1155ERC721ERC20V2.sol\";\nimport {AccessControl} from \"@openzeppelin/contracts-0.8/access/AccessControl.sol\";\nimport {Pausable} from \"@openzeppelin/contracts-0.8/security/Pausable.sol\";\nimport {ERC2771Handler} from \"../../common/BaseWithStorage/ERC2771Handler.sol\";\n\n/// @title A Multi Claim contract that enables claims of user rewards in the form of ERC1155, ERC721 and / or ERC20 tokens\n/// @notice This contract manages claims for multiple token types\n/// @notice The following privileged roles are used in this contract: DEFAULT_ADMIN_ROLE, MULTIGIVEAWAY_ROLE\n/// @notice DEFAULT_ADMIN_ROLE is intended for setup / emergency, MULTIGIVEAWAY_ROLE is provided for business purposes\n/// @dev The contract implements ERC2771 to ensure that users do not pay gas\ncontract MultiGiveawayV2 is AccessControl, ClaimERC1155ERC721ERC20V2, ERC2771Handler, Pausable {\n /// @dev `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n\n /// @dev `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n /// @dev `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`\n bytes4 internal constant ERC721_RECEIVED = 0x150b7a02;\n\n /// @dev `bytes4(keccak256(\"onERC721BatchReceived(address,address,uint256[],bytes)\"))`\n bytes4 internal constant ERC721_BATCH_RECEIVED = 0x4b808c46;\n\n mapping(address => mapping(bytes32 => bool)) public claimed;\n mapping(bytes32 => uint256) private _expiryTime;\n\n /// @dev MULTIGIVEAWAY_ROLE is provided for business-related admin functions\n bytes32 public constant MULTIGIVEAWAY_ROLE = keccak256(\"MULTIGIVEAWAY_ROLE\");\n\n event NewGiveaway(bytes32 merkleRoot, uint256 expiryTime);\n event NewTrustedForwarder(address indexed trustedForwarder);\n\n /// @notice Constructor with the admin & trusted forwarder\n /// @param admin Admin of the contract\n /// @param trustedForwarder Trusted forwarder for ERC2771\n constructor(\n address admin,\n address multigiveawayAdmin,\n address trustedForwarder\n ) {\n require(admin != address(0), \"MULTIGIVEAWAY_INVALID_TO_ZERO_ADDRESS\");\n _grantRole(DEFAULT_ADMIN_ROLE, admin);\n _grantRole(MULTIGIVEAWAY_ROLE, multigiveawayAdmin);\n __ERC2771Handler_initialize(trustedForwarder);\n }\n\n /// @notice Function to add a new giveaway.\n /// @param merkleRoot The merkle root hash of the claim data.\n /// @param expiryTime The expiry time for the giveaway.\n function addNewGiveaway(bytes32 merkleRoot, uint256 expiryTime)\n external\n onlyRole(MULTIGIVEAWAY_ROLE)\n whenNotPaused()\n {\n require(expiryTime > block.timestamp, \"MULTIGIVEAWAY_INVALID_INPUT\");\n require(merkleRoot != 0, \"MULTIGIVEAWAY_INVALID_INPUT\");\n require(_expiryTime[merkleRoot] == 0, \"MULTIGIVEAWAY_ALREADY_EXISTS\");\n _expiryTime[merkleRoot] = expiryTime;\n emit NewGiveaway(merkleRoot, expiryTime);\n }\n\n /// @notice set the trusted forwarder\n /// @param trustedForwarder address of the contract that is enabled to send meta-tx on behalf of the user\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(trustedForwarder != address(0), \"MULTIGIVEAWAY_INVALID_ZERO_ADDRESS\");\n _trustedForwarder = trustedForwarder;\n\n emit NewTrustedForwarder(trustedForwarder);\n }\n\n /// @notice Function to permit the claiming of multiple tokens from multiple giveaways to a reserved address.\n /// @param claims The array of claim structs, each containing a destination address, the giveaway items to be claimed and an optional salt param.\n /// @param proofs The proofs submitted for verification.\n function claimMultipleTokensFromMultipleMerkleTree(\n bytes32[] calldata rootHashes,\n Claim[] memory claims,\n bytes32[][] calldata proofs\n ) external {\n require(claims.length == rootHashes.length, \"MULTIGIVEAWAY_INVALID_INPUT\");\n require(claims.length == proofs.length, \"MULTIGIVEAWAY_INVALID_INPUT\");\n for (uint256 i = 0; i < rootHashes.length; i++) {\n claimMultipleTokens(rootHashes[i], claims[i], proofs[i]);\n }\n }\n\n /// @notice Function to check which giveaways have been claimed by a particular user.\n /// @param user The user (intended token destination) address.\n /// @param claims The claim struct containing the destination address, all items to be claimed and optional salt param.\n /// @return claimedGiveaways The array of bools confirming whether or not the giveaways relating to the root hashes provided have been claimed.\n function getClaimedStatus(address user, Claim[] memory claims) external view returns (bool[] memory) {\n bool[] memory claimedGiveaways = new bool[](claims.length);\n for (uint256 i = 0; i < claims.length; i++) {\n bytes32 merkleLeaf = _generateClaimHash(claims[i]);\n claimedGiveaways[i] = claimed[user][merkleLeaf];\n }\n return claimedGiveaways;\n }\n\n /// @dev Public function used to perform validity checks and progress to claim multiple token types in one claim.\n /// @param merkleRoot The merkle root hash for the specific set of items being claimed.\n /// @param claim The claim struct containing the destination address, all items to be claimed and optional salt param.\n /// @param proof The proof provided by the user performing the claim function.\n function claimMultipleTokens(\n bytes32 merkleRoot,\n Claim memory claim,\n bytes32[] calldata proof\n ) public whenNotPaused() {\n uint256 giveawayExpiryTime = _expiryTime[merkleRoot];\n require(claim.to != address(0), \"MULTIGIVEAWAY_INVALID_TO_ZERO_ADDRESS\");\n require(claim.to != address(this), \"MULTIGIVEAWAY_DESTINATION_MULTIGIVEAWAY_CONTRACT\");\n require(giveawayExpiryTime != 0, \"MULTIGIVEAWAY_DOES_NOT_EXIST\");\n require(block.timestamp < giveawayExpiryTime, \"MULTIGIVEAWAY_CLAIM_PERIOD_IS_OVER\");\n bytes32 merkleLeaf = _generateClaimHash(claim);\n require(claimed[claim.to][merkleLeaf] == false, \"MULTIGIVEAWAY_DESTINATION_ALREADY_CLAIMED\");\n claimed[claim.to][merkleLeaf] = true;\n\n _claimERC1155ERC721ERC20(merkleRoot, claim, proof);\n }\n\n /// @notice Get the expiry time for a merkle root\n /// @param merkleRoot merkle root\n function getExpiryTime(bytes32 merkleRoot) external view returns (uint256) {\n return _expiryTime[merkleRoot];\n }\n\n /// @notice Pause the contract\n /// @dev Only the role DEFAULT_ADMIN_ROLE can pause\n function pause() external onlyRole(DEFAULT_ADMIN_ROLE) {\n _pause();\n }\n\n /// @notice Unpause the contract\n /// @dev Only the role DEFAULT_ADMIN_ROLE can unpause\n function unpause() external onlyRole(DEFAULT_ADMIN_ROLE) {\n _unpause();\n }\n\n /// @notice Handle the receipt of an NFT\n /// @return `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`\n function onERC721Received(\n address, /*operator*/\n address, /*from*/\n uint256, /*id*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC721_RECEIVED;\n }\n\n /// @notice Handle the receipt of a batch of NFTs\n /// @return `bytes4(keccak256(\"onERC721BatchReceived(address,address,uint256[],bytes)\"))`\n function onERC721BatchReceived(\n address, /*operator*/\n address, /*from*/\n uint256[] calldata, /*ids*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC721_BATCH_RECEIVED;\n }\n\n /// @notice Handle the receipt of a single ERC1155 token type.\n /// @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n function onERC1155Received(\n address, /*operator*/\n address, /*from*/\n uint256, /*id*/\n uint256, /*value*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n /// @notice Handle the receipt of a batch of ERC1155 tokens type.\n /// @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n function onERC1155BatchReceived(\n address, /*operator*/\n address, /*from*/\n uint256[] calldata, /*ids*/\n uint256[] calldata, /*values*/\n bytes calldata /*data*/\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n\n /// @dev Returns the real sender of meta-transactions\n /// @return sender sender of the meta-tx\n function _msgSender() internal view override(Context, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n /// @dev Returns the real data of meta-transactions\n /// @return calldata data of the meta-tx\n function _msgData() internal view override(Context, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n}\n" + }, + "src/solc_0.8/claims/signedGiveaway/SignedERC20Giveaway.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {EIP712Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol\";\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {ERC2771Handler} from \"../../common/BaseWithStorage/ERC2771Handler.sol\";\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\nimport {ECDSAUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol\";\nimport {AccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\n\n/// @title This contract pays Sand claims when the backend authorize it via message signing.\n/// @dev can be extended to support NFTs, etc.\n/// @dev This contract support meta transactions.\n/// @dev This contract is final, don't inherit form it.\ncontract SignedERC20Giveaway is\n Initializable,\n ContextUpgradeable,\n AccessControlUpgradeable,\n EIP712Upgradeable,\n ERC2771Handler,\n PausableUpgradeable\n{\n event Claimed(address indexed signer, uint256 claimId, address indexed token, address indexed to, uint256 amount);\n event RevokedClaims(uint256[] claimIds);\n\n bytes32 public constant SIGNER_ROLE = keccak256(\"SIGNER_ROLE\");\n bytes32 public constant CLAIM_TYPEHASH =\n keccak256(\"Claim(address signer,uint256 claimId,address token,address to,uint256 amount)\");\n string public constant name = \"Sandbox SignedERC20Giveaway\";\n string public constant version = \"1.0\";\n mapping(uint256 => bool) public claimed;\n\n function initialize(address trustedForwarder_, address defaultAdmin_) external initializer {\n __Context_init_unchained();\n __ERC165_init_unchained();\n __AccessControl_init_unchained();\n __EIP712_init_unchained(name, version);\n __ERC2771Handler_initialize(trustedForwarder_);\n __Pausable_init_unchained();\n _setupRole(DEFAULT_ADMIN_ROLE, defaultAdmin_);\n }\n\n /// @notice verifies a ERC712 signature for the Mint data type.\n /// @param v signature part\n /// @param r signature part\n /// @param s signature part\n /// @param signer the address of the signer, must be part of the signer role\n /// @param claimId unique claim id\n /// @param token token contract address\n /// @param to destination user\n /// @param amount of ERC20 to transfer\n /// @return true if the signature is valid\n function verify(\n uint8 v,\n bytes32 r,\n bytes32 s,\n address signer,\n uint256 claimId,\n address token,\n address to,\n uint256 amount\n ) external view returns (bool) {\n return _verify(v, r, s, signer, claimId, token, to, amount);\n }\n\n /// @notice verifies a ERC712 signature and mint a new NFT for the buyer.\n /// @param v signature part\n /// @param r signature part\n /// @param s signature part\n /// @param signer the address of the signer, must be part of the signer role\n /// @param claimId unique claim id\n /// @param token token contract address\n /// @param to destination user\n /// @param amount of ERC20 to transfer\n function claim(\n uint8 v,\n bytes32 r,\n bytes32 s,\n address signer,\n uint256 claimId,\n address token,\n address to,\n uint256 amount\n ) external whenNotPaused {\n require(_verify(v, r, s, signer, claimId, token, to, amount), \"Invalid signature\");\n require(hasRole(SIGNER_ROLE, signer), \"Invalid signer\");\n require(!claimed[claimId], \"Already claimed\");\n claimed[claimId] = true;\n require(IERC20Upgradeable(token).transfer(to, amount), \"Transfer failed\");\n emit Claimed(signer, claimId, token, to, amount);\n }\n\n /// @notice let the admin revoke some claims so they cannot be used\n /// @param claimIds and array of claim Ids to revoke\n function revokeClaims(uint256[] calldata claimIds) external {\n require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), \"Only admin\");\n for (uint256 i = 0; i < claimIds.length; i++) {\n claimed[claimIds[i]] = true;\n }\n emit RevokedClaims(claimIds);\n }\n\n // @dev Triggers stopped state.\n // The contract must not be paused.\n function pause() external {\n require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), \"Only admin\");\n _pause();\n }\n\n // @dev Returns to normal state.\n // The contract must be paused.\n function unpause() external {\n require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), \"Only admin\");\n _unpause();\n }\n\n function domainSeparator() external view returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n function getChainId() external view returns (uint256) {\n return block.chainid;\n }\n\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n\n function _verify(\n uint8 v,\n bytes32 r,\n bytes32 s,\n address signer,\n uint256 claimId,\n address token,\n address to,\n uint256 amount\n ) internal view returns (bool) {\n bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(CLAIM_TYPEHASH, signer, claimId, token, to, amount)));\n address recoveredSigner = ECDSAUpgradeable.recover(digest, v, r, s);\n return recoveredSigner == signer;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view override(AccessControlUpgradeable) returns (bool) {\n return super.supportsInterface(interfaceId);\n }\n}\n" + }, + "src/solc_0.8/common/Base/TheSandbox712.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ncontract TheSandbox712 {\n bytes32 internal constant EIP712DOMAIN_TYPEHASH =\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n // solhint-disable-next-line var-name-mixedcase\n bytes32 public immutable _DOMAIN_SEPARATOR;\n\n constructor() {\n _DOMAIN_SEPARATOR = keccak256(\n // chainId 137 = Polygon\n abi.encode(EIP712DOMAIN_TYPEHASH, keccak256(\"The Sandbox\"), keccak256(\"1\"), block.chainid, address(this))\n );\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC20/ERC20BaseToken.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport \"./extensions/ERC20Internal.sol\";\nimport \"../../interfaces/IERC20Extended.sol\";\nimport \"../WithSuperOperators.sol\";\n\nabstract contract ERC20BaseToken is WithSuperOperators, IERC20, IERC20Extended, ERC20Internal, Context {\n string internal _name;\n string internal _symbol;\n address internal immutable _operator;\n uint256 internal _totalSupply;\n mapping(address => uint256) internal _balances;\n mapping(address => mapping(address => uint256)) internal _allowances;\n\n constructor(\n string memory tokenName,\n string memory tokenSymbol,\n address admin,\n address operator\n ) {\n _name = tokenName;\n _symbol = tokenSymbol;\n _admin = admin;\n _operator = operator;\n }\n\n /// @notice Transfer `amount` tokens to `to`.\n /// @param to The recipient address of the tokens being transfered.\n /// @param amount The number of tokens being transfered.\n /// @return success Whether or not the transfer succeeded.\n function transfer(address to, uint256 amount) external override returns (bool success) {\n _transfer(_msgSender(), to, amount);\n return true;\n }\n\n /// @notice Transfer `amount` tokens from `from` to `to`.\n /// @param from The origin address of the tokens being transferred.\n /// @param to The recipient address of the tokensbeing transfered.\n /// @param amount The number of tokens transfered.\n /// @return success Whether or not the transfer succeeded.\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool success) {\n if (_msgSender() != from && !_superOperators[_msgSender()] && _msgSender() != _operator) {\n uint256 currentAllowance = _allowances[from][_msgSender()];\n if (currentAllowance != ~uint256(0)) {\n // save gas when allowance is maximal by not reducing it (see https://github.com/ethereum/EIPs/issues/717)\n require(currentAllowance >= amount, \"NOT_AUTHORIZED_ALLOWANCE\");\n _allowances[from][_msgSender()] = currentAllowance - amount;\n }\n }\n _transfer(from, to, amount);\n return true;\n }\n\n /// @notice Burn `amount` tokens.\n /// @param amount The number of tokens to burn.\n function burn(uint256 amount) external override {\n _burn(_msgSender(), amount);\n }\n\n /// @notice Burn `amount` tokens from `owner`.\n /// @param from The address whose token to burn.\n /// @param amount The number of tokens to burn.\n function burnFor(address from, uint256 amount) external override {\n _burn(from, amount);\n }\n\n /// @notice Approve `spender` to transfer `amount` tokens.\n /// @param spender The address to be given rights to transfer.\n /// @param amount The number of tokens allowed.\n /// @return success Whether or not the call succeeded.\n function approve(address spender, uint256 amount) external override returns (bool success) {\n _approveFor(_msgSender(), spender, amount);\n return true;\n }\n\n /// @notice Get the name of the token collection.\n /// @return The name of the token collection.\n function name() external view virtual returns (string memory) {\n //added virtual\n return _name;\n }\n\n /// @notice Get the symbol for the token collection.\n /// @return The symbol of the token collection.\n function symbol() external view virtual returns (string memory) {\n //added virtual\n return _symbol;\n }\n\n /// @notice Get the total number of tokens in existence.\n /// @return The total number of tokens in existence.\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n\n /// @notice Get the balance of `owner`.\n /// @param owner The address to query the balance of.\n /// @return The amount owned by `owner`.\n function balanceOf(address owner) external view override returns (uint256) {\n return _balances[owner];\n }\n\n /// @notice Get the allowance of `spender` for `owner`'s tokens.\n /// @param owner The address whose token is allowed.\n /// @param spender The address allowed to transfer.\n /// @return remaining The amount of token `spender` is allowed to transfer on behalf of `owner`.\n function allowance(address owner, address spender) external view override returns (uint256 remaining) {\n return _allowances[owner][spender];\n }\n\n /// @notice Get the number of decimals for the token collection.\n /// @return The number of decimals.\n function decimals() external pure virtual returns (uint8) {\n return uint8(18);\n }\n\n /// @notice Approve `spender` to transfer `amount` tokens from `owner`.\n /// @param owner The address whose token is allowed.\n /// @param spender The address to be given rights to transfer.\n /// @param amount The number of tokens allowed.\n /// @return success Whether or not the call succeeded.\n function approveFor(\n address owner,\n address spender,\n uint256 amount\n ) public override returns (bool success) {\n require(_msgSender() == owner || _superOperators[_msgSender()] || _msgSender() == _operator, \"NOT_AUTHORIZED\");\n _approveFor(owner, spender, amount);\n return true;\n }\n\n /// @notice Increase the allowance for the spender if needed\n /// @param owner The address of the owner of the tokens\n /// @param spender The address wanting to spend tokens\n /// @param amountNeeded The amount requested to spend\n /// @return success Whether or not the call succeeded.\n function addAllowanceIfNeeded(\n address owner,\n address spender,\n uint256 amountNeeded\n ) public returns (bool success) {\n require(_msgSender() == owner || _superOperators[_msgSender()] || _msgSender() == _operator, \"INVALID_SENDER\");\n _addAllowanceIfNeeded(owner, spender, amountNeeded);\n return true;\n }\n\n /// @dev See addAllowanceIfNeeded.\n function _addAllowanceIfNeeded(\n address owner,\n address spender,\n uint256 amountNeeded /*(ERC20Internal, ERC20ExecuteExtension, ERC20BasicApproveExtension)*/\n ) internal virtual override {\n if (amountNeeded > 0 && !isSuperOperator(spender) && spender != _operator) {\n uint256 currentAllowance = _allowances[owner][spender];\n if (currentAllowance < amountNeeded) {\n _approveFor(owner, spender, amountNeeded);\n }\n }\n }\n\n /// @dev See approveFor.\n function _approveFor(\n address owner,\n address spender,\n uint256 amount /*(ERC20BasicApproveExtension, ERC20Internal)*/\n ) internal virtual override {\n require(owner != address(0) && spender != address(0), \"INVALID_OWNER_||_SPENDER\");\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /// @dev See transfer.\n function _transfer(\n address from,\n address to,\n uint256 amount /*(ERC20Internal, ERC20ExecuteExtension)*/\n ) internal virtual override {\n require(to != address(0), \"NOT_TO_ZEROADDRESS\");\n require(to != address(this), \"NOT_TO_THIS\");\n uint256 currentBalance = _balances[from];\n require(currentBalance >= amount, \"INSUFFICIENT_FUNDS\");\n _balances[from] = currentBalance - amount;\n _balances[to] += amount;\n emit Transfer(from, to, amount);\n }\n\n /// @dev Mint tokens for a recipient.\n /// @param to The recipient address.\n /// @param amount The number of token to mint.\n function _mint(address to, uint256 amount) internal {\n require(to != address(0), \"NOT_TO_ZEROADDRESS\");\n require(amount > 0, \"MINT_O_TOKENS\");\n uint256 currentTotalSupply = _totalSupply;\n uint256 newTotalSupply = currentTotalSupply + amount;\n require(newTotalSupply > currentTotalSupply, \"OVERFLOW\");\n _totalSupply = newTotalSupply;\n _balances[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @dev Burn tokens from an address.\n /// @param from The address whose tokens to burn.\n /// @param amount The number of token to burn.\n function _burn(address from, uint256 amount) internal {\n require(amount > 0, \"BURN_O_TOKENS\");\n if (_msgSender() != from && !_superOperators[_msgSender()] && _msgSender() != _operator) {\n uint256 currentAllowance = _allowances[from][_msgSender()];\n if (currentAllowance != ~uint256(0)) {\n // save gas when allowance is maximal by not reducing it (see https://github.com/ethereum/EIPs/issues/717)\n require(currentAllowance >= amount, \"INSUFFICIENT_ALLOWANCE\");\n _allowances[from][_msgSender()] = currentAllowance - amount;\n }\n }\n\n uint256 currentBalance = _balances[from];\n require(currentBalance >= amount, \"INSUFFICIENT_FUNDS\");\n _balances[from] = currentBalance - amount;\n _totalSupply -= amount;\n emit Transfer(from, address(0), amount);\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC20/ERC20BaseTokenUpgradeable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-upgradeable/metatx/ERC2771ContextUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport \"./extensions/ERC20Internal.sol\";\nimport \"../../interfaces/IERC20Extended.sol\";\n\nabstract contract ERC20BaseTokenUpgradeable is\n IERC20,\n IERC20Extended,\n ERC20Internal,\n ERC2771ContextUpgradeable,\n AccessControlUpgradeable\n{\n bytes32 public constant SUPER_OPERATOR_ROLE = keccak256(\"SUPER_OPERATOR_ROLE\");\n\n string internal _name;\n string internal _symbol;\n uint256 internal _totalSupply;\n mapping(address => uint256) internal _balances;\n mapping(address => mapping(address => uint256)) internal _allowances;\n\n uint256[50] private __gap;\n\n function __ERC20BaseTokenUpgradeable_init(\n string memory tokenName,\n string memory tokenSymbol,\n address trustedForwarder,\n address admin\n ) internal initializer {\n _name = tokenName;\n _symbol = tokenSymbol;\n __AccessControl_init();\n _setupRole(DEFAULT_ADMIN_ROLE, admin);\n __ERC2771Context_init(trustedForwarder);\n }\n\n /// @notice Transfer `amount` tokens to `to`.\n /// @param to The recipient address of the tokens being transfered.\n /// @param amount The number of tokens being transfered.\n /// @return success Whether or not the transfer succeeded.\n function transfer(address to, uint256 amount) external override returns (bool success) {\n _transfer(_msgSender(), to, amount);\n return true;\n }\n\n /// @notice Transfer `amount` tokens from `from` to `to`.\n /// @param from The origin address of the tokens being transferred.\n /// @param to The recipient address of the tokensbeing transfered.\n /// @param amount The number of tokens transfered.\n /// @return success Whether or not the transfer succeeded.\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool success) {\n if (_msgSender() != from && !hasRole(SUPER_OPERATOR_ROLE, _msgSender())) {\n uint256 currentAllowance = _allowances[from][_msgSender()];\n if (currentAllowance != ~uint256(0)) {\n // save gas when allowance is maximal by not reducing it (see https://github.com/ethereum/EIPs/issues/717)\n require(currentAllowance >= amount, \"NOT_AUTHORIZED_ALLOWANCE\");\n _allowances[from][_msgSender()] = currentAllowance - amount;\n }\n }\n _transfer(from, to, amount);\n return true;\n }\n\n /// @notice Burn `amount` tokens.\n /// @param amount The number of tokens to burn.\n function burn(uint256 amount) external override {\n _burn(_msgSender(), amount);\n }\n\n /// @notice Burn `amount` tokens from `owner`.\n /// @param from The address whose token to burn.\n /// @param amount The number of tokens to burn.\n function burnFor(address from, uint256 amount) external override {\n _burn(from, amount);\n }\n\n /// @notice Approve `spender` to transfer `amount` tokens.\n /// @param spender The address to be given rights to transfer.\n /// @param amount The number of tokens allowed.\n /// @return success Whether or not the call succeeded.\n function approve(address spender, uint256 amount) external override returns (bool success) {\n _approveFor(_msgSender(), spender, amount);\n return true;\n }\n\n /// @notice Get the name of the token collection.\n /// @return The name of the token collection.\n function name() external view virtual returns (string memory) {\n //added virtual\n return _name;\n }\n\n /// @notice Get the symbol for the token collection.\n /// @return The symbol of the token collection.\n function symbol() external view virtual returns (string memory) {\n //added virtual\n return _symbol;\n }\n\n /// @notice Get the total number of tokens in existence.\n /// @return The total number of tokens in existence.\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n\n /// @notice Get the balance of `owner`.\n /// @param owner The address to query the balance of.\n /// @return The amount owned by `owner`.\n function balanceOf(address owner) external view override returns (uint256) {\n return _balances[owner];\n }\n\n /// @notice Get the allowance of `spender` for `owner`'s tokens.\n /// @param owner The address whose token is allowed.\n /// @param spender The address allowed to transfer.\n /// @return remaining The amount of token `spender` is allowed to transfer on behalf of `owner`.\n function allowance(address owner, address spender) external view override returns (uint256 remaining) {\n return _allowances[owner][spender];\n }\n\n /// @notice Get the number of decimals for the token collection.\n /// @return The number of decimals.\n function decimals() public pure virtual returns (uint8) {\n return uint8(18);\n }\n\n /// @notice Approve `spender` to transfer `amount` tokens from `owner`.\n /// @param owner The address whose token is allowed.\n /// @param spender The address to be given rights to transfer.\n /// @param amount The number of tokens allowed.\n /// @return success Whether or not the call succeeded.\n function approveFor(\n address owner,\n address spender,\n uint256 amount\n ) external virtual override returns (bool success) {\n require(_msgSender() == owner || hasRole(SUPER_OPERATOR_ROLE, _msgSender()), \"NOT_AUTHORIZED\");\n _approveFor(owner, spender, amount);\n return true;\n }\n\n /// @notice Increase the allowance for the spender if needed\n /// @param owner The address of the owner of the tokens\n /// @param spender The address wanting to spend tokens\n /// @param amountNeeded The amount requested to spend\n /// @return success Whether or not the call succeeded.\n function addAllowanceIfNeeded(\n address owner,\n address spender,\n uint256 amountNeeded\n ) external returns (bool success) {\n require(_msgSender() == owner || hasRole(SUPER_OPERATOR_ROLE, _msgSender()), \"INVALID_SENDER\");\n _addAllowanceIfNeeded(owner, spender, amountNeeded);\n return true;\n }\n\n /// @dev See addAllowanceIfNeeded.\n function _addAllowanceIfNeeded(\n address owner,\n address spender,\n uint256 amountNeeded\n ) internal virtual override {\n if (amountNeeded > 0 && !hasRole(SUPER_OPERATOR_ROLE, _msgSender())) {\n uint256 currentAllowance = _allowances[owner][spender];\n if (currentAllowance < amountNeeded) {\n _approveFor(owner, spender, amountNeeded);\n }\n }\n }\n\n /// @dev See approveFor.\n function _approveFor(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual override {\n require(owner != address(0) && spender != address(0), \"INVALID_OWNER_||_SPENDER\");\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /// @dev See transfer.\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n require(to != address(0), \"NOT_TO_ZEROADDRESS\");\n require(to != address(this), \"NOT_TO_THIS\");\n uint256 currentBalance = _balances[from];\n require(currentBalance >= amount, \"INSUFFICIENT_FUNDS\");\n _balances[from] = currentBalance - amount;\n _balances[to] += amount;\n emit Transfer(from, to, amount);\n }\n\n /// @dev Mint tokens for a recipient.\n /// @param to The recipient address.\n /// @param amount The number of token to mint.\n function _mint(address to, uint256 amount) internal {\n require(to != address(0), \"NOT_TO_ZEROADDRESS\");\n require(amount > 0, \"MINT_O_TOKENS\");\n uint256 currentTotalSupply = _totalSupply;\n uint256 newTotalSupply = currentTotalSupply + amount;\n require(newTotalSupply > currentTotalSupply, \"OVERFLOW\");\n _totalSupply = newTotalSupply;\n _balances[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @dev Burn tokens from an address.\n /// @param from The address whose tokens to burn.\n /// @param amount The number of token to burn.\n function _burn(address from, uint256 amount) internal {\n require(amount > 0, \"BURN_O_TOKENS\");\n if (_msgSender() != from && !hasRole(SUPER_OPERATOR_ROLE, _msgSender())) {\n uint256 currentAllowance = _allowances[from][_msgSender()];\n if (currentAllowance != ~uint256(0)) {\n // save gas when allowance is maximal by not reducing it (see https://github.com/ethereum/EIPs/issues/717)\n require(currentAllowance >= amount, \"INSUFFICIENT_ALLOWANCE\");\n _allowances[from][_msgSender()] = currentAllowance - amount;\n }\n }\n uint256 currentBalance = _balances[from];\n require(currentBalance >= amount, \"INSUFFICIENT_FUNDS\");\n _balances[from] = currentBalance - amount;\n _totalSupply -= amount;\n emit Transfer(from, address(0), amount);\n }\n\n function _msgSender()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771ContextUpgradeable)\n returns (address sender)\n {\n return ERC2771ContextUpgradeable._msgSender();\n }\n\n function _msgData()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771ContextUpgradeable)\n returns (bytes calldata)\n {\n return ERC2771ContextUpgradeable._msgData();\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC20/ERC20Token.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./ERC20BaseToken.sol\";\nimport \"./extensions/ERC20BasicApproveExtension.sol\";\nimport \"../WithPermit.sol\";\nimport \"../ERC677/extensions/ERC677Extension.sol\";\nimport \"../../interfaces/IERC677Receiver.sol\";\n\ncontract ERC20Token is ERC20BasicApproveExtension, ERC677Extension, WithPermit, ERC20BaseToken {\n // /////////////////// CONSTRUCTOR ////////////////////\n constructor(\n string memory name,\n string memory symbol,\n address admin,\n address operator\n )\n ERC20BaseToken(name, symbol, admin, operator) // solhint-disable-next-line no-empty-blocks\n {}\n\n function mint(address to, uint256 amount) external onlyAdmin {\n _mint(to, amount);\n }\n\n /// @notice Function to permit the expenditure of ERC20 token by a nominated spender\n /// @param owner The owner of the ERC20 tokens\n /// @param spender The nominated spender of the ERC20 tokens\n /// @param value The value (allowance) of the ERC20 tokens that the nominated spender will be allowed to spend\n /// @param deadline The deadline for granting permission to the spender\n /// @param v The final 1 byte of signature\n /// @param r The first 32 bytes of signature\n /// @param s The second 32 bytes of signature\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public override {\n checkApproveFor(owner, spender, value, deadline, v, r, s);\n _approveFor(owner, spender, value);\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC20/ERC20TokenUpgradeable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./ERC20BaseTokenUpgradeable.sol\";\nimport \"../WithPermitUpgradeable.sol\";\nimport \"../ERC677/extensions/ERC677Extension.sol\";\nimport \"../../interfaces/IERC677Receiver.sol\";\n\ncontract ERC20TokenUpgradeable is ERC677Extension, WithPermitUpgradeable, ERC20BaseTokenUpgradeable {\n function __ERC20TokenUpgradeable_init(\n string memory name,\n string memory symbol,\n address trustedForwarder,\n address admin\n ) public initializer {\n __ERC20BaseTokenUpgradeable_init(name, symbol, trustedForwarder, admin);\n __WithPermitUpgradeable_init(\"The Sandbox\");\n }\n\n function mint(address to, uint256 amount) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _mint(to, amount);\n }\n\n /// @notice Function to permit the expenditure of ERC20 token by a nominated spender\n /// @param owner The owner of the ERC20 tokens\n /// @param spender The nominated spender of the ERC20 tokens\n /// @param value The value (allowance) of the ERC20 tokens that the nominated spender will be allowed to spend\n /// @param deadline The deadline for granting permission to the spender\n /// @param v The final 1 byte of signature\n /// @param r The first 32 bytes of signature\n /// @param s The second 32 bytes of signature\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public override {\n checkApproveFor(owner, spender, value, deadline, v, r, s);\n _approveFor(owner, spender, value);\n }\n\n function _msgSender() internal view override(Context, ERC20BaseTokenUpgradeable) returns (address sender) {\n return ERC2771ContextUpgradeable._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC20BaseTokenUpgradeable) returns (bytes calldata) {\n return ERC2771ContextUpgradeable._msgData();\n }\n\n uint256[50] private __gap;\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC20/extensions/ERC20BasicApproveExtension.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport \"./ERC20Internal.sol\";\nimport \"../../../Libraries/BytesUtil.sol\";\n\nabstract contract ERC20BasicApproveExtension is ERC20Internal, Context {\n /// @notice Approve `target` to spend `amount` and call it with data.\n /// @param target The address to be given rights to transfer and destination of the call.\n /// @param amount The number of tokens allowed.\n /// @param data The bytes for the call.\n /// @return The data of the call.\n function approveAndCall(\n address target,\n uint256 amount,\n bytes calldata data\n ) external payable returns (bytes memory) {\n require(BytesUtil.doFirstParamEqualsAddress(data, _msgSender()), \"FIRST_PARAM_NOT_SENDER\");\n\n _approveFor(_msgSender(), target, amount);\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returnData) = target.call{value: msg.value}(data);\n require(success, string(returnData));\n return returnData;\n }\n\n /// @notice Temporarily approve `target` to spend `amount` and call it with data.\n /// Previous approvals remains unchanged.\n /// @param target The destination of the call, allowed to spend the amount specified\n /// @param amount The number of tokens allowed to spend.\n /// @param data The bytes for the call.\n /// @return The data of the call.\n function paidCall(\n address target,\n uint256 amount,\n bytes calldata data\n ) external payable returns (bytes memory) {\n require(BytesUtil.doFirstParamEqualsAddress(data, _msgSender()), \"FIRST_PARAM_NOT_SENDER\");\n\n if (amount > 0) {\n _addAllowanceIfNeeded(_msgSender(), target, amount);\n }\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returnData) = target.call{value: msg.value}(data);\n require(success, string(returnData));\n\n return returnData;\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC20/extensions/ERC20Internal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nabstract contract ERC20Internal {\n function _approveFor(\n address owner,\n address target,\n uint256 amount\n ) internal virtual;\n\n function _addAllowanceIfNeeded(\n address owner,\n address spender,\n uint256 amountNeeded\n ) internal virtual;\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual;\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC2771/ERC2771HandlerUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/// @dev minimal ERC2771 handler to keep bytecode-size down\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.6.0/contracts/metatx/ERC2771Context.sol\n/// with an initializer for proxies and a mutable forwarder\n/// @dev same as ERC2771Handler.sol but with gap\n\ncontract ERC2771HandlerUpgradeable {\n address internal _trustedForwarder;\n uint256[49] private __gap;\n\n function __ERC2771Handler_initialize(address forwarder) internal {\n _trustedForwarder = forwarder;\n }\n\n function isTrustedForwarder(address forwarder) public view returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n function getTrustedForwarder() external view returns (address trustedForwarder) {\n return _trustedForwarder;\n }\n\n function _msgSender() internal view virtual returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return msg.sender;\n }\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender)) {\n return msg.data[:msg.data.length - 20];\n } else {\n return msg.data;\n }\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC2771/ERC2771HandlerV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/// @dev minimal ERC2771 handler to keep bytecode-size down\n/// @dev no initializer version\n\ncontract ERC2771HandlerV2 {\n address internal _trustedForwarder;\n\n constructor(address forwarder) {\n _trustedForwarder = forwarder;\n }\n\n function isTrustedForwarder(address forwarder) public view returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n function getTrustedForwarder() external view returns (address trustedForwarder) {\n return _trustedForwarder;\n }\n\n function _msgSender() internal view virtual returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return msg.sender;\n }\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender)) {\n return msg.data[:msg.data.length - 20];\n } else {\n return msg.data;\n }\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC2771Handler.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/**\n * @title ERC2771Handler\n * @author The Sandbox\n * @notice Handle meta-transactions\n * @dev minimal ERC2771 handler to keep bytecode-size down\n * based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.6.0/contracts/metatx/ERC2771Context.sol\n * with an initializer for proxies and a mutable forwarder\n */\nabstract contract ERC2771Handler {\n address internal _trustedForwarder;\n\n event TrustedForwarderSet(address indexed newForwarder);\n\n /**\n * @dev Initializes the contract\n * @param forwarder trusted forwarder address\n */\n function __ERC2771Handler_initialize(address forwarder) internal {\n _trustedForwarder = forwarder;\n emit TrustedForwarderSet(_trustedForwarder);\n }\n\n /**\n * @notice Checks if an address is a trusted forwarder\n * @param forwarder address to check\n * @return is trusted\n */\n function isTrustedForwarder(address forwarder) public view returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n /**\n * @notice Get the current trusted forwarder\n * @return trustedForwarder address of the trusted forwarder\n */\n function getTrustedForwarder() external view returns (address) {\n return _trustedForwarder;\n }\n\n /**\n * @dev if the call comes from the trusted forwarder, it gets the real sender by checking the encoded address in the data\n * @return sender address of the real sender\n */\n function _msgSender() internal view virtual returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return msg.sender;\n }\n }\n\n /**\n * @dev if the call comes from the trusted forwarder, it substracts the sender address from `msg.data` to get the real `msg.data`\n * @return the real `msg.data`\n */\n function _msgData() internal view virtual returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender)) {\n return msg.data[:msg.data.length - 20];\n } else {\n return msg.data;\n }\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC2771HandlerV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/// @dev minimal ERC2771 handler to keep bytecode-size down.\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\n\nabstract contract ERC2771HandlerV2 {\n address internal _trustedForwarder;\n\n function __ERC2771HandlerV2_initialize(address forwarder) internal {\n _trustedForwarder = forwarder;\n }\n\n function isTrustedForwarder(address forwarder) public view returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n function getTrustedForwarder() external view returns (address trustedForwarder) {\n return _trustedForwarder;\n }\n\n function _msgSender() internal view virtual returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n require(msg.data.length >= 24, \"ERC2771HandlerV2: Invalid msg.data\");\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return msg.sender;\n }\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender)) {\n require(msg.data.length >= 24, \"ERC2771HandlerV2: Invalid msg.data\");\n return msg.data[:msg.data.length - 20];\n } else {\n return msg.data;\n }\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC2771HandlerV3.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/// @dev minimal ERC2771 handler to keep bytecode-size down.\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\n\nabstract contract ERC2771HandlerV3 {\n address internal _trustedForwarder;\n\n function __ERC2771HandlerV3_initialize(address forwarder) internal {\n _trustedForwarder = forwarder;\n }\n\n /// @notice check if an given address is a trusted forwarder\n /// @param forwarder address to check\n function isTrustedForwarder(address forwarder) public view returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n /// @notice return trusted forwarder address\n function getTrustedForwarder() external view returns (address) {\n return _trustedForwarder;\n }\n\n function _msgSender() internal view virtual returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n require(msg.data.length >= 24, \"ERC2771HandlerV2: Invalid msg.data\");\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return msg.sender;\n }\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender)) {\n require(msg.data.length >= 24, \"ERC2771HandlerV2: Invalid msg.data\");\n return msg.data[:msg.data.length - 20];\n } else {\n return msg.data;\n }\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC677/extensions/ERC677Extension.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../../interfaces/IERC677.sol\";\nimport \"../../../interfaces/IERC677Receiver.sol\";\nimport \"../../ERC20/extensions/ERC20Internal.sol\";\nimport \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport \"@openzeppelin/contracts-0.8/utils/Context.sol\";\n\nabstract contract ERC677Extension is ERC20Internal, IERC677, Context {\n using Address for address;\n\n /// @notice Transfers tokens to an address with _data if the recipient is a contact.\n /// @param _to The address to transfer to.\n /// @param _value The amount to be transferred.\n /// @param _data The extra data to be passed to the receiving contract.\n function transferAndCall(\n address _to,\n uint256 _value,\n bytes calldata _data\n ) external override returns (bool success) {\n _transfer(_msgSender(), _to, _value);\n if (_to.isContract()) {\n IERC677Receiver receiver = IERC677Receiver(_to);\n receiver.onTokenTransfer(_msgSender(), _value, _data);\n }\n return true;\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC721BaseToken.sol": { + "content": "//SPDX-License-Identifier: MIT\n/* solhint-disable func-order, code-complexity */\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\nimport \"./WithSuperOperators.sol\";\nimport \"../interfaces/IERC721MandatoryTokenReceiver.sol\";\nimport \"./ERC2771Handler.sol\";\n\ncontract ERC721BaseToken is IERC721Upgradeable, WithSuperOperators, ERC2771Handler {\n using AddressUpgradeable for address;\n\n bytes4 internal constant _ERC721_RECEIVED = 0x150b7a02;\n bytes4 internal constant _ERC721_BATCH_RECEIVED = 0x4b808c46;\n\n bytes4 internal constant ERC165ID = 0x01ffc9a7;\n bytes4 internal constant ERC721_MANDATORY_RECEIVER = 0x5e8bf644;\n\n uint256 internal constant NOT_ADDRESS = 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000;\n uint256 internal constant OPERATOR_FLAG = (2**255);\n uint256 internal constant NOT_OPERATOR_FLAG = OPERATOR_FLAG - 1;\n uint256 internal constant BURNED_FLAG = (2**160);\n\n mapping(address => uint256) internal _numNFTPerAddress;\n mapping(uint256 => uint256) internal _owners;\n mapping(address => mapping(address => bool)) internal _operatorsForAll;\n mapping(uint256 => address) internal _operators;\n\n /// @notice Approve an operator to spend tokens on the senders behalf.\n /// @param operator The address receiving the approval.\n /// @param id The id of the token.\n function approve(address operator, uint256 id) external override {\n uint256 ownerData = _owners[_storageId(id)];\n address owner = _ownerOf(id);\n address msgSender = _msgSender();\n require(owner != address(0), \"NONEXISTENT_TOKEN\");\n require(\n owner == msgSender || _superOperators[msgSender] || _operatorsForAll[owner][msgSender],\n \"UNAUTHORIZED_APPROVAL\"\n );\n _approveFor(ownerData, operator, id);\n }\n\n /// @notice Approve an operator to spend tokens on the sender behalf.\n /// @param sender The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param id The id of the token.\n function approveFor(\n address sender,\n address operator,\n uint256 id\n ) external {\n uint256 ownerData = _owners[_storageId(id)];\n address owner = _ownerOf(id);\n address msgSender = _msgSender();\n require(sender != address(0), \"ZERO_ADDRESS_SENDER\");\n require(owner != address(0), \"NONEXISTENT_TOKEN\");\n require(\n msgSender == sender || _superOperators[msgSender] || _operatorsForAll[sender][msgSender],\n \"UNAUTHORIZED_APPROVAL\"\n );\n require(address(uint160(ownerData)) == sender, \"OWNER_NOT_SENDER\");\n _approveFor(ownerData, operator, id);\n }\n\n /// @notice Transfer a token between 2 addresses.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param id The id of the token.\n function transferFrom(\n address from,\n address to,\n uint256 id\n ) external override {\n _checkTransfer(from, to, id);\n _transferFrom(from, to, id);\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n require(_checkOnERC721Received(_msgSender(), from, to, id, \"\"), \"ERC721_TRANSFER_REJECTED\");\n }\n }\n\n /// @notice Transfer a token between 2 addresses letting the receiver know of the transfer.\n /// @param from The send of the token.\n /// @param to The recipient of the token.\n /// @param id The id of the token.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id\n ) external override {\n safeTransferFrom(from, to, id, \"\");\n }\n\n /// @notice Transfer many tokens between 2 addresses.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param ids The ids of the tokens.\n /// @param data Additional data.\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) public virtual {\n _batchTransferFrom(from, to, ids, data, false);\n }\n\n /// @notice Transfer many tokens between 2 addresses, while\n /// ensuring the receiving contract has a receiver method.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param ids The ids of the tokens.\n /// @param data Additional data.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external {\n _batchTransferFrom(from, to, ids, data, true);\n }\n\n /// @notice Set the approval for an operator to manage all the tokens of the sender.\n /// @param sender The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param approved The determination of the approval.\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) external {\n require(sender != address(0), \"Invalid sender address\");\n address msgSender = _msgSender();\n require(msgSender == sender || _superOperators[msgSender], \"UNAUTHORIZED_APPROVE_FOR_ALL\");\n\n _setApprovalForAll(sender, operator, approved);\n }\n\n /// @notice Set the approval for an operator to manage all the tokens of the sender.\n /// @param operator The address receiving the approval.\n /// @param approved The determination of the approval.\n function setApprovalForAll(address operator, bool approved) external override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /// @notice Burns token `id`.\n /// @param id The token which will be burnt.\n function burn(uint256 id) external virtual {\n _burn(_msgSender(), _ownerOf(id), id);\n }\n\n /// @notice Burn token`id` from `from`.\n /// @param from address whose token is to be burnt.\n /// @param id The token which will be burnt.\n function burnFrom(address from, uint256 id) external virtual {\n require(from != address(0), \"NOT_FROM_ZEROADDRESS\");\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n address msgSender = _msgSender();\n require(\n msgSender == from ||\n (operatorEnabled && _operators[id] == msgSender) ||\n _superOperators[msgSender] ||\n _operatorsForAll[from][msgSender],\n \"UNAUTHORIZED_BURN\"\n );\n _burn(from, owner, id);\n }\n\n /// @notice Get the number of tokens owned by an address.\n /// @param owner The address to look for.\n /// @return The number of tokens owned by the address.\n function balanceOf(address owner) external view override returns (uint256) {\n require(owner != address(0), \"ZERO_ADDRESS_OWNER\");\n return _numNFTPerAddress[owner];\n }\n\n /// @notice Get the owner of a token.\n /// @param id The id of the token.\n /// @return owner The address of the token owner.\n function ownerOf(uint256 id) external view override returns (address owner) {\n owner = _ownerOf(id);\n require(owner != address(0), \"NONEXISTANT_TOKEN\");\n }\n\n /// @notice Get the approved operator for a specific token.\n /// @param id The id of the token.\n /// @return The address of the operator.\n function getApproved(uint256 id) external view override returns (address) {\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(owner != address(0), \"NONEXISTENT_TOKEN\");\n if (operatorEnabled) {\n return _operators[id];\n } else {\n return address(0);\n }\n }\n\n /// @notice Check if the sender approved the operator.\n /// @param owner The address of the owner.\n /// @param operator The address of the operator.\n /// @return isOperator The status of the approval.\n function isApprovedForAll(address owner, address operator) external view override returns (bool isOperator) {\n return _operatorsForAll[owner][operator] || _superOperators[operator];\n }\n\n /// @notice Transfer a token between 2 addresses letting the receiver knows of the transfer.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param id The id of the token.\n /// @param data Additional data.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) public override {\n _checkTransfer(from, to, id);\n _transferFrom(from, to, id);\n if (to.isContract()) {\n require(_checkOnERC721Received(_msgSender(), from, to, id, data), \"ERC721_TRANSFER_REJECTED\");\n }\n }\n\n /// @notice Check if the contract supports an interface.\n /// 0x01ffc9a7 is ERC-165.\n /// 0x80ac58cd is ERC-721\n /// @param id The id of the interface.\n /// @return Whether the interface is supported.\n function supportsInterface(bytes4 id) public pure virtual override returns (bool) {\n return id == 0x01ffc9a7 || id == 0x80ac58cd;\n }\n\n /// @dev By overriding this function in an implementation which inherits this contract, you can enable versioned tokenIds without the extra overhead of writing to a new storage slot in _owners each time a version is incremented. See GameToken._storageId() for an example, where the storageId is the tokenId minus the version number.\n /// !!! Caution !!! Overriding this function without taking appropriate care could lead to\n /// ownerOf() returning an owner for non-existent tokens. Tests should be written to\n /// guard against introducing this bug.\n /// @param id The id of a token.\n /// @return The id used for storage mappings.\n function _storageId(uint256 id) internal view virtual returns (uint256) {\n return id;\n }\n\n function _updateOwnerData(\n uint256 id,\n uint256 oldData,\n address newOwner,\n bool hasOperator\n ) internal virtual {\n if (hasOperator) {\n _owners[_storageId(id)] = (oldData & NOT_ADDRESS) | OPERATOR_FLAG | uint256(uint160(newOwner));\n } else {\n _owners[_storageId(id)] = ((oldData & NOT_ADDRESS) & NOT_OPERATOR_FLAG) | uint256(uint160(newOwner));\n }\n }\n\n function _transferFrom(\n address from,\n address to,\n uint256 id\n ) internal {\n _numNFTPerAddress[from]--;\n _numNFTPerAddress[to]++;\n _updateOwnerData(id, _owners[_storageId(id)], to, false);\n emit Transfer(from, to, id);\n }\n\n /// @dev See approveFor.\n function _approveFor(\n uint256 ownerData,\n address operator,\n uint256 id\n ) internal {\n address owner = _ownerOf(id);\n if (operator == address(0)) {\n _updateOwnerData(id, ownerData, owner, false);\n } else {\n _updateOwnerData(id, ownerData, owner, true);\n _operators[id] = operator;\n }\n emit Approval(owner, operator, id);\n }\n\n /// @dev See batchTransferFrom.\n function _batchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n bytes memory data,\n bool safe\n ) internal {\n address msgSender = _msgSender();\n bool authorized = msgSender == from || _superOperators[msgSender] || _operatorsForAll[from][msgSender];\n\n require(from != address(0), \"NOT_FROM_ZEROADDRESS\");\n require(to != address(0), \"NOT_TO_ZEROADDRESS\");\n\n uint256 numTokens = ids.length;\n for (uint256 i = 0; i < numTokens; i++) {\n uint256 id = ids[i];\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(owner == from, \"BATCHTRANSFERFROM_NOT_OWNER\");\n require(authorized || (operatorEnabled && _operators[id] == msgSender), \"NOT_AUTHORIZED\");\n _updateOwnerData(id, _owners[_storageId(id)], to, false);\n emit Transfer(from, to, id);\n }\n if (from != to) {\n _numNFTPerAddress[from] -= numTokens;\n _numNFTPerAddress[to] += numTokens;\n }\n\n if (to.isContract()) {\n if (_checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n require(_checkOnERC721BatchReceived(msgSender, from, to, ids, data), \"ERC721_BATCH_RECEIVED_REJECTED\");\n } else if (safe) {\n for (uint256 i = 0; i < numTokens; i++) {\n require(_checkOnERC721Received(msgSender, from, to, ids[i], data), \"ERC721_RECEIVED_REJECTED\");\n }\n }\n }\n }\n\n /// @dev See setApprovalForAll.\n function _setApprovalForAll(\n address sender,\n address operator,\n bool approved\n ) internal {\n require(!_superOperators[operator], \"INVALID_APPROVAL_CHANGE\");\n _operatorsForAll[sender][operator] = approved;\n\n emit ApprovalForAll(sender, operator, approved);\n }\n\n /// @dev See burn.\n function _burn(\n address from,\n address owner,\n uint256 id\n ) internal {\n require(from == owner, \"NOT_OWNER\");\n uint256 storageId = _storageId(id);\n _owners[storageId] = (_owners[storageId] & NOT_OPERATOR_FLAG) | BURNED_FLAG; // record as non owner but keep track of last owner\n _numNFTPerAddress[from]--;\n emit Transfer(from, address(0), id);\n }\n\n /// @dev Check if receiving contract accepts erc721 transfers.\n /// @param operator The address of the operator.\n /// @param from The from address, may be different from msg.sender.\n /// @param to The adddress we want to transfer to.\n /// @param tokenId The id of the token we would like to transfer.\n /// @param _data Any additional data to send with the transfer.\n /// @return Whether the expected value of 0x150b7a02 is returned.\n function _checkOnERC721Received(\n address operator,\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal returns (bool) {\n bytes4 retval = IERC721ReceiverUpgradeable(to).onERC721Received(operator, from, tokenId, _data);\n return (retval == _ERC721_RECEIVED);\n }\n\n /// @dev Check if receiving contract accepts erc721 batch transfers.\n /// @param operator The address of the operator.\n /// @param from The from address, may be different from msg.sender.\n /// @param to The adddress we want to transfer to.\n /// @param ids The ids of the tokens we would like to transfer.\n /// @param _data Any additional data to send with the transfer.\n /// @return Whether the expected value of 0x4b808c46 is returned.\n function _checkOnERC721BatchReceived(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n bytes memory _data\n ) internal returns (bool) {\n bytes4 retval = IERC721MandatoryTokenReceiver(to).onERC721BatchReceived(operator, from, ids, _data);\n return (retval == _ERC721_BATCH_RECEIVED);\n }\n\n /// @dev See ownerOf\n function _ownerOf(uint256 id) internal view virtual returns (address) {\n uint256 data = _owners[_storageId(id)];\n if ((data & BURNED_FLAG) == BURNED_FLAG) {\n return address(0);\n }\n return address(uint160(data));\n }\n\n /// @dev Get the owner and operatorEnabled status of a token.\n /// @param id The token to query.\n /// @return owner The owner of the token.\n /// @return operatorEnabled Whether or not operators are enabled for this token.\n function _ownerAndOperatorEnabledOf(uint256 id)\n internal\n view\n virtual\n returns (address owner, bool operatorEnabled)\n {\n uint256 data = _owners[_storageId(id)];\n if ((data & BURNED_FLAG) == BURNED_FLAG) {\n owner = address(0);\n } else {\n owner = address(uint160(data));\n }\n operatorEnabled = (data & OPERATOR_FLAG) == OPERATOR_FLAG;\n }\n\n /// @dev Check whether a transfer is a meta Transaction or not.\n /// @param from The address who initiated the transfer (may differ from msg.sender).\n /// @param to The address recieving the token.\n /// @param id The token being transferred.\n /// @return isMetaTx Whether or not the transaction is a MetaTx.\n function _checkTransfer(\n address from,\n address to,\n uint256 id\n ) internal view returns (bool isMetaTx) {\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n address msgSender = _msgSender();\n require(owner != address(0), \"NONEXISTENT_TOKEN\");\n require(owner == from, \"CHECKTRANSFER_NOT_OWNER\");\n require(to != address(0), \"NOT_TO_ZEROADDRESS\");\n require(\n msgSender == owner ||\n _superOperators[msgSender] ||\n _operatorsForAll[from][msgSender] ||\n (operatorEnabled && _operators[id] == msgSender),\n \"UNAUTHORIZED_TRANSFER\"\n );\n return true;\n }\n\n /// @dev Check if there was enough gas.\n /// @param _contract The address of the contract to check.\n /// @param interfaceId The id of the interface we want to test.\n /// @return Whether or not this check succeeded.\n function _checkInterfaceWith10000Gas(address _contract, bytes4 interfaceId) internal view returns (bool) {\n bool success;\n bool result;\n bytes memory callData = abi.encodeWithSelector(ERC165ID, interfaceId);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let call_ptr := add(0x20, callData)\n let call_size := mload(callData)\n let output := mload(0x40) // Find empty storage location using \"free memory pointer\"\n mstore(output, 0x0)\n success := staticcall(10000, _contract, call_ptr, call_size, output, 0x20) // 32 bytes\n result := mload(output)\n }\n // (10000 / 63) \"not enough for supportsInterface(...)\" // consume all gas, so caller can potentially know that there was not enough gas\n assert(gasleft() > 158);\n return success && result;\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ERC721BaseTokenV2.sol": { + "content": "//SPDX-License-Identifier: MIT\n/* solhint-disable func-order, code-complexity */\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport {AddressUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport {\n IERC721ReceiverUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\";\nimport {IERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\nimport {WithSuperOperatorsV2} from \"./WithSuperOperatorsV2.sol\";\nimport {IERC721MandatoryTokenReceiver} from \"../interfaces/IERC721MandatoryTokenReceiver.sol\";\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\n/// @title ERC721BaseTokenV2\n/// @author The Sandbox\n/// @notice Basic functionalities of a NFT\n/// @dev ERC721 implementation that supports meta-transactions and super operators\ncontract ERC721BaseTokenV2 is ContextUpgradeable, IERC721Upgradeable, WithSuperOperatorsV2 {\n using AddressUpgradeable for address;\n\n bytes4 internal constant _ERC721_RECEIVED = 0x150b7a02;\n bytes4 internal constant _ERC721_BATCH_RECEIVED = 0x4b808c46;\n\n bytes4 internal constant ERC165ID = 0x01ffc9a7;\n bytes4 internal constant ERC721_MANDATORY_RECEIVER = 0x5e8bf644;\n\n uint256 internal constant NOT_ADDRESS = 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000;\n uint256 internal constant OPERATOR_FLAG = (2**255);\n uint256 internal constant NOT_OPERATOR_FLAG = OPERATOR_FLAG - 1;\n uint256 internal constant BURNED_FLAG = (2**160);\n\n mapping(address => uint256) internal _numNFTPerAddress;\n /**\n * @dev mapping to store owner of lands and quads.\n * For 1x1 lands it also the 255 bit is 1 if that land has operator approved and is 0 if no operator is approved.\n * For burned 1x1 Land 160 bit is set to 1.\n */\n mapping(uint256 => uint256) internal _owners;\n mapping(address => mapping(address => bool)) internal _operatorsForAll;\n mapping(uint256 => address) internal _operators;\n\n /// @notice Approve an operator to spend tokens on the senders behalf.\n /// @param operator The address receiving the approval.\n /// @param id The id of the token.\n function approve(address operator, uint256 id) public virtual override {\n uint256 ownerData = _owners[_storageId(id)];\n address owner = _ownerOf(id);\n address msgSender = _msgSender();\n require(owner != address(0), \"NONEXISTENT_TOKEN\");\n require(\n owner == msgSender || _operatorsForAll[owner][msgSender] || _superOperators[msgSender],\n \"UNAUTHORIZED_APPROVAL\"\n );\n _approveFor(ownerData, operator, id);\n }\n\n /// @notice Approve an operator to spend tokens on the sender behalf.\n /// @param sender The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param id The id of the token.\n function approveFor(\n address sender,\n address operator,\n uint256 id\n ) public virtual {\n uint256 ownerData = _owners[_storageId(id)];\n address owner = _ownerOf(id);\n address msgSender = _msgSender();\n require(sender != address(0), \"ZERO_ADDRESS_SENDER\");\n require(owner != address(0), \"NONEXISTENT_TOKEN\");\n require(\n msgSender == sender || _operatorsForAll[sender][msgSender] || _superOperators[msgSender],\n \"UNAUTHORIZED_APPROVAL\"\n );\n require(address(uint160(ownerData)) == sender, \"OWNER_NOT_SENDER\");\n _approveFor(ownerData, operator, id);\n }\n\n /// @notice Transfer a token between 2 addresses.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param id The id of the token.\n function transferFrom(\n address from,\n address to,\n uint256 id\n ) public virtual override {\n _checkTransfer(from, to, id);\n _transferFrom(from, to, id);\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n require(_checkOnERC721Received(_msgSender(), from, to, id, \"\"), \"ERC721_TRANSFER_REJECTED\");\n }\n }\n\n /// @notice Transfer a token between 2 addresses letting the receiver know of the transfer.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param id The id of the token.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id\n ) public virtual override {\n safeTransferFrom(from, to, id, \"\");\n }\n\n /// @notice Transfer many tokens between 2 addresses.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param ids The ids of the tokens.\n /// @param data Additional data.\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) public virtual {\n _batchTransferFrom(from, to, ids, data, false);\n }\n\n /// @notice Transfer many tokens between 2 addresses, while\n /// ensuring the receiving contract has a receiver method.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param ids The ids of the tokens.\n /// @param data Additional data.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external virtual {\n _batchTransferFrom(from, to, ids, data, true);\n }\n\n /// @notice Set the approval for an operator to manage all the tokens of the sender.\n /// @param sender The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param approved The determination of the approval.\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) public virtual {\n require(sender != address(0), \"Invalid sender address\");\n address msgSender = _msgSender();\n require(msgSender == sender || _superOperators[msgSender], \"UNAUTHORIZED_APPROVE_FOR_ALL\");\n\n _setApprovalForAll(sender, operator, approved);\n }\n\n /// @notice Set the approval for an operator to manage all the tokens of the sender.\n /// @param operator The address receiving the approval.\n /// @param approved The determination of the approval.\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /// @notice Burns token `id`.\n /// @param id The token which will be burnt.\n function burn(uint256 id) external virtual {\n _burn(_msgSender(), _ownerOf(id), id);\n }\n\n /// @notice Burn token `id` from `from`.\n /// @param from address whose token is to be burnt.\n /// @param id The token which will be burnt.\n function burnFrom(address from, uint256 id) external virtual {\n require(from != address(0), \"NOT_FROM_ZEROADDRESS\");\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n address msgSender = _msgSender();\n require(\n msgSender == from ||\n (operatorEnabled && _operators[id] == msgSender) ||\n _superOperators[msgSender] ||\n _operatorsForAll[from][msgSender],\n \"UNAUTHORIZED_BURN\"\n );\n _burn(from, owner, id);\n }\n\n /// @notice Get the number of tokens owned by an address.\n /// @param owner The address to look for.\n /// @return The number of tokens owned by the address.\n function balanceOf(address owner) external view override returns (uint256) {\n require(owner != address(0), \"ZERO_ADDRESS_OWNER\");\n return _numNFTPerAddress[owner];\n }\n\n /// @notice Get the owner of a token.\n /// @param id The id of the token.\n /// @return owner The address of the token owner.\n function ownerOf(uint256 id) external view override returns (address owner) {\n owner = _ownerOf(id);\n require(owner != address(0), \"NONEXISTANT_TOKEN\");\n }\n\n /// @notice Get the approved operator for a specific token.\n /// @param id The id of the token.\n /// @return The address of the operator.\n function getApproved(uint256 id) external view override returns (address) {\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(owner != address(0), \"NONEXISTENT_TOKEN\");\n if (operatorEnabled) {\n return _operators[id];\n } else {\n return address(0);\n }\n }\n\n /// @notice Check if the sender approved the operator.\n /// @param owner The address of the owner.\n /// @param operator The address of the operator.\n /// @return isOperator The status of the approval.\n function isApprovedForAll(address owner, address operator) external view override returns (bool) {\n return _operatorsForAll[owner][operator] || _superOperators[operator];\n }\n\n /// @notice Transfer a token between 2 addresses letting the receiver knows of the transfer.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param id The id of the token.\n /// @param data Additional data.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) public virtual override {\n _checkTransfer(from, to, id);\n _transferFrom(from, to, id);\n if (to.isContract()) {\n require(_checkOnERC721Received(_msgSender(), from, to, id, data), \"ERC721_TRANSFER_REJECTED\");\n }\n }\n\n /// @notice Check if the contract supports an interface.\n /// 0x01ffc9a7 is ERC-165.\n /// 0x80ac58cd is ERC-721\n /// @param id The id of the interface.\n /// @return Whether the interface is supported.\n function supportsInterface(bytes4 id) public pure virtual override returns (bool) {\n return id == 0x01ffc9a7 || id == 0x80ac58cd;\n }\n\n /// @dev By overriding this function in an implementation which inherits this contract,\n /// you can enable versioned tokenIds without the extra overhead of writing to a new storage slot in _owners each time a version is incremented.\n /// See GameToken._storageId() for an example, where the storageId is the tokenId minus the version number.\n /// !!! Caution !!! Overriding this function without taking appropriate care could lead to\n /// ownerOf() returning an owner for non-existent tokens. Tests should be written to\n /// guard against introducing this bug.\n /// @param id The id of a token.\n /// @return The id used for storage mappings.\n function _storageId(uint256 id) internal view virtual returns (uint256) {\n return id;\n }\n\n function _updateOwnerData(\n uint256 id,\n uint256 oldData,\n address newOwner,\n bool hasOperator\n ) internal virtual {\n if (hasOperator) {\n _owners[_storageId(id)] = (oldData & NOT_ADDRESS) | OPERATOR_FLAG | uint256(uint160(newOwner));\n } else {\n _owners[_storageId(id)] = ((oldData & NOT_ADDRESS) & NOT_OPERATOR_FLAG) | uint256(uint160(newOwner));\n }\n }\n\n function _transferFrom(\n address from,\n address to,\n uint256 id\n ) internal {\n _numNFTPerAddress[from]--;\n _numNFTPerAddress[to]++;\n _updateOwnerData(id, _owners[_storageId(id)], to, false);\n emit Transfer(from, to, id);\n }\n\n /// @dev See approveFor.\n function _approveFor(\n uint256 ownerData,\n address operator,\n uint256 id\n ) internal {\n address owner = _ownerOf(id);\n if (operator == address(0)) {\n _updateOwnerData(id, ownerData, owner, false);\n } else {\n _updateOwnerData(id, ownerData, owner, true);\n _operators[id] = operator;\n }\n emit Approval(owner, operator, id);\n }\n\n /// @dev See batchTransferFrom.\n function _batchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n bytes memory data,\n bool safe\n ) internal {\n address msgSender = _msgSender();\n bool authorized = msgSender == from || _operatorsForAll[from][msgSender] || _superOperators[msgSender];\n\n require(from != address(0), \"NOT_FROM_ZEROADDRESS\");\n require(to != address(0), \"NOT_TO_ZEROADDRESS\");\n\n uint256 numTokens = ids.length;\n for (uint256 i = 0; i < numTokens; i++) {\n uint256 id = ids[i];\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n require(owner == from, \"BATCHTRANSFERFROM_NOT_OWNER\");\n require(authorized || (operatorEnabled && _operators[id] == msgSender), \"NOT_AUTHORIZED\");\n _updateOwnerData(id, _owners[_storageId(id)], to, false);\n emit Transfer(from, to, id);\n }\n if (from != to) {\n _numNFTPerAddress[from] -= numTokens;\n _numNFTPerAddress[to] += numTokens;\n }\n\n if (to.isContract()) {\n if (_checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n require(_checkOnERC721BatchReceived(msgSender, from, to, ids, data), \"ERC721_BATCH_RECEIVED_REJECTED\");\n } else if (safe) {\n for (uint256 i = 0; i < numTokens; i++) {\n require(_checkOnERC721Received(msgSender, from, to, ids[i], data), \"ERC721_RECEIVED_REJECTED\");\n }\n }\n }\n }\n\n /// @dev See setApprovalForAll.\n function _setApprovalForAll(\n address sender,\n address operator,\n bool approved\n ) internal {\n require(!_superOperators[operator], \"INVALID_APPROVAL_CHANGE\");\n _operatorsForAll[sender][operator] = approved;\n\n emit ApprovalForAll(sender, operator, approved);\n }\n\n /// @dev See burn.\n function _burn(\n address from,\n address owner,\n uint256 id\n ) internal {\n require(from == owner, \"NOT_OWNER\");\n uint256 storageId = _storageId(id);\n _owners[storageId] = (_owners[storageId] & NOT_OPERATOR_FLAG) | BURNED_FLAG; // record as non owner but keep track of last owner\n _numNFTPerAddress[from]--;\n emit Transfer(from, address(0), id);\n }\n\n /// @dev Check if receiving contract accepts erc721 transfers.\n /// @param operator The address of the operator.\n /// @param from The from address, may be different from msg.sender.\n /// @param to The address we want to transfer to.\n /// @param tokenId The id of the token we would like to transfer.\n /// @param _data Any additional data to send with the transfer.\n /// @return Whether the expected value of 0x150b7a02 is returned.\n function _checkOnERC721Received(\n address operator,\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal returns (bool) {\n bytes4 retval = IERC721ReceiverUpgradeable(to).onERC721Received(operator, from, tokenId, _data);\n return (retval == _ERC721_RECEIVED);\n }\n\n /// @dev Check if receiving contract accepts erc721 batch transfers.\n /// @param operator The address of the operator.\n /// @param from The from address, may be different from msg.sender.\n /// @param to The address we want to transfer to.\n /// @param ids The ids of the tokens we would like to transfer.\n /// @param _data Any additional data to send with the transfer.\n /// @return Whether the expected value of 0x4b808c46 is returned.\n function _checkOnERC721BatchReceived(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n bytes memory _data\n ) internal returns (bool) {\n bytes4 retval = IERC721MandatoryTokenReceiver(to).onERC721BatchReceived(operator, from, ids, _data);\n return (retval == _ERC721_BATCH_RECEIVED);\n }\n\n /// @dev See ownerOf\n function _ownerOf(uint256 id) internal view virtual returns (address) {\n uint256 data = _owners[_storageId(id)];\n if ((data & BURNED_FLAG) == BURNED_FLAG) {\n return address(0);\n }\n return address(uint160(data));\n }\n\n /// @dev Get the owner and operatorEnabled status of a token.\n /// @param id The token to query.\n /// @return owner The owner of the token.\n /// @return operatorEnabled Whether or not operators are enabled for this token.\n function _ownerAndOperatorEnabledOf(uint256 id)\n internal\n view\n virtual\n returns (address owner, bool operatorEnabled)\n {\n uint256 data = _owners[_storageId(id)];\n if ((data & BURNED_FLAG) == BURNED_FLAG) {\n owner = address(0);\n } else {\n owner = address(uint160(data));\n }\n operatorEnabled = (data & OPERATOR_FLAG) == OPERATOR_FLAG;\n }\n\n /// @dev Check whether a transfer is a meta Transaction or not.\n /// @param from The address who initiated the transfer (may differ from msg.sender).\n /// @param to The address receiving the token.\n /// @param id The token being transferred.\n function _checkTransfer(\n address from,\n address to,\n uint256 id\n ) internal view {\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);\n address msgSender = _msgSender();\n require(owner != address(0), \"NONEXISTENT_TOKEN\");\n require(owner == from, \"CHECKTRANSFER_NOT_OWNER\");\n require(to != address(0), \"NOT_TO_ZEROADDRESS\");\n require(\n msgSender == owner ||\n _superOperators[msgSender] ||\n _operatorsForAll[from][msgSender] ||\n (operatorEnabled && _operators[id] == msgSender),\n \"UNAUTHORIZED_TRANSFER\"\n );\n }\n\n /// @dev Check if there was enough gas.\n /// @param _contract The address of the contract to check.\n /// @param interfaceId The id of the interface we want to test.\n /// @return Whether or not this check succeeded.\n function _checkInterfaceWith10000Gas(address _contract, bytes4 interfaceId) internal view returns (bool) {\n bool success;\n bool result;\n bytes memory callData = abi.encodeWithSelector(ERC165ID, interfaceId);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let call_ptr := add(0x20, callData)\n let call_size := mload(callData)\n let output := mload(0x40) // Find empty storage location using \"free memory pointer\"\n mstore(output, 0x0)\n success := staticcall(10000, _contract, call_ptr, call_size, output, 0x20) // 32 bytes\n result := mload(output)\n }\n // (10000 / 63) \"not enough for supportsInterface(...)\" // consume all gas, so caller can potentially know that there was not enough gas\n assert(gasleft() > 158);\n return success && result;\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/ImmutableERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../BaseWithStorage/ERC721BaseToken.sol\";\n\ncontract ImmutableERC721 is ERC721BaseToken {\n uint256 internal constant CREATOR_OFFSET_MULTIPLIER = uint256(2)**(256 - 160);\n uint256 internal constant SUBID_MULTIPLIER = uint256(2)**(256 - 224);\n uint256 internal constant CHAIN_INDEX_OFFSET_MULTIPLIER = uint256(2)**(256 - 160 - 64 - 16);\n uint256 internal constant STORAGE_ID_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000;\n uint256 internal constant VERSION_MASK = 0x000000FFFFFFFF00000000000000000000000000000000000000000000000000;\n uint256 internal constant CHAIN_INDEX_MASK = 0x0000000000000000000000000000000000000000000000000000000000FF0000;\n bytes32 internal constant base32Alphabet = 0x6162636465666768696A6B6C6D6E6F707172737475767778797A323334353637;\n\n uint8 internal _chainIndex;\n\n function __ImmutableERC721_initialize(uint8 index) internal {\n _chainIndex = index;\n }\n\n /// @dev get the layer a token was minted on from its id.\n /// @param id The id of the token to query.\n /// @return The index of the original layer of minting.\n /// 0 = eth mainnet, 1 == Polygon, etc...\n function getChainIndex(uint256 id) public pure virtual returns (uint256) {\n return uint256((id & CHAIN_INDEX_MASK) >> 16);\n }\n\n /// @dev An implementation which handles versioned tokenIds.\n /// @param id The tokenId to get the owner of.\n /// @return The address of the owner.\n function _ownerOf(uint256 id) internal view virtual override returns (address) {\n uint256 packedData = _owners[_storageId(id)];\n uint16 idVersion = uint16(id);\n uint16 storageVersion = uint16((packedData & VERSION_MASK) >> 200);\n if (((packedData & BURNED_FLAG) == BURNED_FLAG) || idVersion != storageVersion) {\n return address(0);\n }\n return address(uint160(packedData));\n }\n\n /// @dev Check if a withdrawal is allowed.\n /// @param from The address requesting the withdrawal.\n /// @param gameId The id of the GAME token to withdraw assets from.\n function _check_withdrawal_authorized(address from, uint256 gameId) internal view virtual {\n require(from != address(0), \"SENDER_ZERO_ADDRESS\");\n require(from == _withdrawalOwnerOf(gameId), \"LAST_OWNER_NOT_EQUAL_SENDER\");\n }\n\n /// @dev Get the address allowed to withdraw associated tokens from the parent token.\n /// If too many associated tokens in TOKEN, block.gaslimit won't allow detroy and withdraw in 1 tx.\n /// An owner may destroy their token, then withdraw associated tokens in a later tx (even\n /// though ownerOf(id) would be address(0) after burning.)\n /// @param id The id of the token to query.\n /// @return the address of the owner before burning.\n function _withdrawalOwnerOf(uint256 id) internal view virtual returns (address) {\n uint256 packedData = _owners[_storageId(id)];\n return address(uint160(packedData));\n }\n\n /// @notice Get the storageID (no chainIndex or version data), which is constant for a given token.\n /// @param tokenId The tokenId for which to find the first token Id.\n /// @return The storage id for this token.\n function getStorageId(uint256 tokenId) external pure virtual returns (uint256) {\n return _storageId(tokenId);\n }\n\n /// @dev Get the storageId (full id without the version number) from the full tokenId.\n /// @param id The full tokenId for the GAME token.\n /// @return The storageId.\n function _storageId(uint256 id) internal pure virtual override returns (uint256) {\n return uint256(id & STORAGE_ID_MASK);\n }\n\n /// @dev Get the a full URI string for a given hash + gameId.\n /// @param hash The 32 byte IPFS hash.\n /// @return The URI string.\n function _toFullURI(bytes32 hash) internal pure virtual returns (string memory) {\n return string(abi.encodePacked(\"ipfs://bafybei\", hash2base32(hash), \"/\", \"token.json\"));\n }\n\n /// @dev Create a new tokenId and associate it with an owner.\n /// This is a packed id, consisting of 4 parts:\n /// the creator's address, a uint64 subId, a uint18 chainIndex and a uint16 version.\n /// @param creator The address of the Token creator.\n /// @param subId The id used to generate the id.\n /// @param version The publicversion used to generate the id.\n function _generateTokenId(\n address creator,\n uint64 subId,\n uint8 chainIndex,\n uint16 version\n ) internal pure returns (uint256) {\n return\n uint256(uint160(creator)) *\n CREATOR_OFFSET_MULTIPLIER +\n subId *\n SUBID_MULTIPLIER +\n chainIndex *\n CHAIN_INDEX_OFFSET_MULTIPLIER +\n version;\n }\n\n /// @dev Convert a 32 byte hash to a base 32 string.\n /// @param hash A 32 byte (IPFS) hash.\n /// @return _uintAsString The hash as a base 32 string.\n // solhint-disable-next-line security/no-assign-params\n function hash2base32(bytes32 hash) internal pure returns (string memory _uintAsString) {\n uint256 _i = uint256(hash);\n uint256 k = 52;\n bytes memory bstr = new bytes(k);\n bstr[--k] = base32Alphabet[uint8((_i % 8) << 2)]; // uint8 s = uint8((256 - skip) % 5); // (_i % (2**s)) << (5-s)\n _i /= 8;\n while (k > 0) {\n bstr[--k] = base32Alphabet[_i % 32];\n _i /= 32;\n }\n return string(bstr);\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/MetaTransactionReceiver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./WithAdmin.sol\";\n\ncontract MetaTransactionReceiver is WithAdmin {\n mapping(address => bool) internal _metaTransactionContracts;\n event MetaTransactionProcessor(address metaTransactionProcessor, bool enabled);\n\n /// @notice Enable or disable the ability of `metaTransactionProcessor` to perform meta-tx (metaTransactionProcessor rights).\n /// @param metaTransactionProcessor address that will be given/removed metaTransactionProcessor rights.\n /// @param enabled set whether the metaTransactionProcessor is enabled or disabled.\n function setMetaTransactionProcessor(address metaTransactionProcessor, bool enabled) external {\n require(msg.sender == _admin, \"only admin can setup metaTransactionProcessors\");\n _setMetaTransactionProcessor(metaTransactionProcessor, enabled);\n }\n\n function _setMetaTransactionProcessor(address metaTransactionProcessor, bool enabled) internal {\n _metaTransactionContracts[metaTransactionProcessor] = enabled;\n emit MetaTransactionProcessor(metaTransactionProcessor, enabled);\n }\n\n /// @notice check whether address `who` is given meta-transaction execution rights.\n /// @param who The address to query.\n /// @return whether the address has meta-transaction execution rights.\n function isMetaTransactionProcessor(address who) external view returns (bool) {\n return _metaTransactionContracts[who];\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/WithAdmin.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\ncontract WithAdmin {\n address internal _admin;\n\n /// @dev Emits when the contract administrator is changed.\n /// @param oldAdmin The address of the previous administrator.\n /// @param newAdmin The address of the new administrator.\n event AdminChanged(address indexed oldAdmin, address indexed newAdmin);\n\n modifier onlyAdmin() {\n require(msg.sender == _admin, \"ADMIN_ONLY\");\n _;\n }\n\n /// @dev Get the current administrator of this contract.\n /// @return The current administrator of this contract.\n function getAdmin() external view returns (address) {\n return _admin;\n }\n\n /// @dev Change the administrator to be `newAdmin`.\n /// @param newAdmin The address of the new administrator.\n function changeAdmin(address newAdmin) external {\n require(msg.sender == _admin, \"ADMIN_ACCESS_DENIED\");\n emit AdminChanged(_admin, newAdmin);\n _admin = newAdmin;\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/WithAdminV2.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\n/// @title WithAdminV2\n/// @author The Sandbox\n/// @notice Add an admin to the contract\ncontract WithAdminV2 is ContextUpgradeable {\n address internal _admin;\n\n /// @dev Emits when the contract administrator is changed.\n /// @param oldAdmin The address of the previous administrator.\n /// @param newAdmin The address of the new administrator.\n event AdminChanged(address indexed oldAdmin, address indexed newAdmin);\n\n modifier onlyAdmin() {\n require(_msgSender() == _admin, \"ADMIN_ONLY\");\n _;\n }\n\n /// @notice Get the current admin\n /// @dev Get the current administrator of this contract.\n /// @return The current administrator of this contract.\n function getAdmin() external view returns (address) {\n return _admin;\n }\n\n /// @notice Change the admin of the contract\n /// @dev Change the administrator to be `newAdmin`.\n /// @param newAdmin The address of the new administrator.\n function changeAdmin(address newAdmin) external {\n address admin = _admin;\n require(_msgSender() == admin, \"ADMIN_ACCESS_DENIED\");\n emit AdminChanged(admin, newAdmin);\n _admin = newAdmin;\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/WithMinter.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"./WithAdmin.sol\";\n\ncontract WithMinter is WithAdmin {\n address internal _minter;\n\n /// @dev Emits when the Minter address is changed\n /// @param oldMinter The previous Minter address\n /// @param newMinter The new Minter address\n event MinterChanged(address oldMinter, address newMinter);\n\n modifier onlyMinter() {\n require(msg.sender == _minter, \"MINTER_ACCESS_DENIED\");\n _;\n }\n\n /// @dev Get the current minter of this contract.\n /// @return The current minter of this contract.\n function getMinter() external view returns (address) {\n return _minter;\n }\n\n /// @dev Change the minter to be `newMinter`.\n /// @param newMinter The address of the new minter.\n function changeMinter(address newMinter) external onlyAdmin() {\n emit MinterChanged(_minter, newMinter);\n _minter = newMinter;\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/WithPermit.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC20/extensions/draft-IERC20Permit.sol\";\nimport \"../../common/interfaces/IERC20Extended.sol\";\nimport \"../../common/Base/TheSandbox712.sol\";\n\n/// @title Permit contract\n/// @notice This contract manages approvals of SAND via signature\nabstract contract WithPermit is TheSandbox712, IERC20Permit {\n mapping(address => uint256) public _nonces;\n\n bytes32 public constant PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n\n /// @notice Function to permit the expenditure of ERC20 token by a nominated spender\n /// @param owner The owner of the ERC20 tokens\n /// @param spender The nominated spender of the ERC20 tokens\n /// @param value The value (allowance) of the ERC20 tokens that the nominated spender will be allowed to spend\n /// @param deadline The deadline for granting permission to the spender\n /// @param v The final 1 byte of signature\n /// @param r The first 32 bytes of signature\n /// @param s The second 32 bytes of signature\n function checkApproveFor(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public {\n require(deadline >= block.timestamp, \"PAST_DEADLINE\");\n bytes32 digest =\n keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n _DOMAIN_SEPARATOR,\n keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, _nonces[owner]++, deadline))\n )\n );\n address recoveredAddress = ecrecover(digest, v, r, s);\n require(recoveredAddress != address(0) && recoveredAddress == owner, \"INVALID_SIGNATURE\");\n }\n\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _DOMAIN_SEPARATOR;\n }\n\n function nonces(address owner) external view override returns (uint256) {\n return _nonces[owner];\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/WithPermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\";\n\nabstract contract WithPermitUpgradeable is EIP712Upgradeable, IERC20PermitUpgradeable {\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n mapping(address => CountersUpgradeable.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 public constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n\n function __WithPermitUpgradeable_init(string memory name) internal onlyInitializing {\n __EIP712_init_unchained(name, \"1\");\n }\n\n /// @notice Function to permit the expenditure of ERC20 token by a nominated spender\n /// @param owner The owner of the ERC20 tokens\n /// @param spender The nominated spender of the ERC20 tokens\n /// @param value The value (allowance) of the ERC20 tokens that the nominated spender will be allowed to spend\n /// @param deadline The deadline for granting permission to the spender\n /// @param v The final 1 byte of signature\n /// @param r The first 32 bytes of signature\n /// @param s The second 32 bytes of signature\n function checkApproveFor(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public {\n require(block.timestamp <= deadline, \"PAST_DEADLINE\");\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n bytes32 hash = _hashTypedDataV4(structHash);\n address signer = ECDSAUpgradeable.recover(hash, v, r, s);\n require(signer == owner, \"INVALID_SIGNATURE\");\n }\n\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n function nonces(address owner) external view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n CountersUpgradeable.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n\n uint256[49] private __gap;\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/WithSuperOperators.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"./WithAdmin.sol\";\n\ncontract WithSuperOperators is WithAdmin {\n mapping(address => bool) internal _superOperators;\n\n event SuperOperator(address indexed superOperator, bool indexed enabled);\n\n /// @notice Enable or disable the ability of `superOperator` to transfer tokens of all (superOperator rights).\n /// @param superOperator address that will be given/removed superOperator right.\n /// @param enabled set whether the superOperator is enabled or disabled.\n function setSuperOperator(address superOperator, bool enabled) external {\n require(msg.sender == _admin, \"only admin is allowed to add super operators\");\n _superOperators[superOperator] = enabled;\n emit SuperOperator(superOperator, enabled);\n }\n\n /// @notice check whether address `who` is given superOperator rights.\n /// @param who The address to query.\n /// @return whether the address has superOperator rights.\n function isSuperOperator(address who) public view returns (bool) {\n return _superOperators[who];\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/WithSuperOperatorsV2.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport {WithAdminV2} from \"./WithAdminV2.sol\";\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\n/// @title WithSuperOperatorsV2\n/// @author The Sandbox\n/// @notice Add super operators handled by an admin\ncontract WithSuperOperatorsV2 is ContextUpgradeable, WithAdminV2 {\n mapping(address => bool) internal _superOperators;\n\n event SuperOperator(address indexed superOperator, bool indexed enabled);\n\n /// @notice Enable or disable the ability of `superOperator` to transfer tokens of all (superOperator rights).\n /// @param superOperator address that will be given/removed superOperator right.\n /// @param enabled set whether the superOperator is enabled or disabled.\n function setSuperOperator(address superOperator, bool enabled) external onlyAdmin {\n require(_msgSender() == _admin, \"only admin is allowed to add super operators\");\n _superOperators[superOperator] = enabled;\n emit SuperOperator(superOperator, enabled);\n }\n\n /// @notice check whether address `who` is given superOperator rights.\n /// @param who The address to query.\n /// @return whether the address has superOperator rights.\n function isSuperOperator(address who) public view returns (bool) {\n return _superOperators[who];\n }\n}\n" + }, + "src/solc_0.8/common/BaseWithStorage/WithUpgrader.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./WithAdmin.sol\";\n\ncontract WithUpgrader is WithAdmin {\n address internal _upgrader;\n\n /// @dev Emits when the Upgrader address is changed\n /// @param oldUpgrader The previous Upgrader address\n /// @param newUpgrader The new Upgrader address\n event UpgraderChanged(address oldUpgrader, address newUpgrader);\n\n modifier onlyUpgrader() {\n require(msg.sender == _upgrader, \"UPGRADER_ACCESS_DENIED\");\n _;\n }\n\n /// @dev Get the current upgrader of this contract.\n /// @return The current upgrader of this contract.\n function getUpgrader() external view returns (address) {\n return _upgrader;\n }\n\n /// @dev Change the upgrader to be `newUpgrader`.\n /// @param newUpgrader The address of the new upgrader.\n function changeUpgrader(address newUpgrader) external onlyAdmin() {\n emit UpgraderChanged(_upgrader, newUpgrader);\n _upgrader = newUpgrader;\n }\n}\n" + }, + "src/solc_0.8/common/fx-portal/FxBaseChildTunnelUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {FxBaseChildTunnel} from \"@maticnetwork/fx-portal/contracts/tunnel/FxBaseChildTunnel.sol\";\n\n/**\n * @title FxBaseChildTunnelUpgradeable\n * @author The Sandbox\n * @dev Upgradeable version of the fx-portal tunnel for the child chain\n */\nabstract contract FxBaseChildTunnelUpgradeable is FxBaseChildTunnel {\n // solhint-disable-next-line no-empty-blocks\n constructor() FxBaseChildTunnel(address(0)) {}\n\n /**\n * @dev Initializes the contract\n * @param _fxChild fx child\n */\n function __FxBaseChildTunnelUpgradeable_initialize(address _fxChild) internal {\n fxChild = _fxChild;\n }\n\n uint256[50] private __gap;\n}\n" + }, + "src/solc_0.8/common/fx-portal/FxBaseRootTunnelUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {\n FxBaseRootTunnel,\n ICheckpointManager,\n IFxStateSender\n} from \"@maticnetwork/fx-portal/contracts/tunnel/FxBaseRootTunnel.sol\";\n\n/**\n * @title FxBaseRootTunnelUpgradeable\n * @author The Sandbox\n * @dev Upgradeable version of the fx-portal tunnel for the root chain\n */\nabstract contract FxBaseRootTunnelUpgradeable is FxBaseRootTunnel {\n // solhint-disable-next-line no-empty-blocks\n constructor() FxBaseRootTunnel(address(0), address(0)) {}\n\n /**\n * @dev Initializes the contract\n * @param _checkpointManager checkpoint manager address\n * @param _fxRoot state sender contract\n */\n function __FxBaseRootTunnelUpgradeable_initialize(address _checkpointManager, address _fxRoot) internal {\n checkpointManager = ICheckpointManager(_checkpointManager);\n fxRoot = IFxStateSender(_fxRoot);\n }\n\n uint256[50] private __gap;\n}\n" + }, + "src/solc_0.8/common/interfaces/ERC1271.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface ERC1271 {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param data Arbitrary length data signed on the behalf of address(this)\n * @param signature Signature byte array associated with _data\n *\n * MUST return the bytes4 magic value 0x20c13b0b when function passes.\n * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5)\n * MUST allow external calls\n */\n function isValidSignature(bytes memory data, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" + }, + "src/solc_0.8/common/interfaces/ERC1271Constants.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ncontract ERC1271Constants {\n bytes4 internal constant ERC1271_MAGICVALUE = 0x20c13b0b;\n}\n" + }, + "src/solc_0.8/common/interfaces/ERC1654.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface ERC1654 {\n /**\n * @dev Should return whether the signature provided is valid for the provided hash\n * @param hash 32 bytes hash to be signed\n * @param signature Signature byte array associated with hash\n * @return magicValue - 0x1626ba7e if valid else 0x00000000\n */\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" + }, + "src/solc_0.8/common/interfaces/ERC1654Constants.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ncontract ERC1654Constants {\n bytes4 internal constant ERC1654_MAGICVALUE = 0x1626ba7e;\n}\n" + }, + "src/solc_0.8/common/interfaces/IAssetAttributesRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\npragma experimental ABIEncoderV2;\n\ninterface IAssetAttributesRegistry {\n struct GemEvent {\n uint16[] gemIds;\n bytes32 blockHash;\n }\n\n struct AssetGemsCatalystData {\n uint256 assetId;\n uint16 catalystContractId;\n uint16[] gemContractIds;\n }\n\n function getRecord(uint256 assetId)\n external\n view\n returns (\n bool exists,\n uint16 catalystId,\n uint16[] memory gemIds\n );\n\n function getAttributes(uint256 assetId, GemEvent[] calldata events) external view returns (uint32[] memory values);\n\n function setCatalyst(\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds\n ) external;\n\n function setCatalystWhenDepositOnOtherLayer(\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds\n ) external;\n\n function setCatalystWithBlockNumber(\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds,\n uint64 blockNumber\n ) external;\n\n function addGems(uint256 assetId, uint16[] calldata gemIds) external;\n\n function setMigrationContract(address _migrationContract) external;\n\n function getCatalystRegistry() external view returns (address);\n}\n" + }, + "src/solc_0.8/common/interfaces/IAssetERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IAssetERC721} from \"./IAssetERC721.sol\";\n\ninterface IAssetERC1155 {\n function changeBouncerAdmin(address newBouncerAdmin) external;\n\n function setBouncer(address bouncer, bool enabled) external;\n\n function setPredicate(address predicate) external;\n\n function mint(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256 supply,\n uint8 rarity,\n address owner,\n bytes calldata data\n ) external returns (uint256 id);\n\n function mint(\n address account,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n function mintMultiple(\n address account,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n\n // for bridging, where the ID has already been minted on that layer\n function mintDeficit(\n address account,\n uint256 id,\n uint256 amount\n ) external;\n\n // fails on non-NFT or nft who do not have collection (was a mistake)\n function collectionOf(uint256 id) external view returns (uint256);\n\n function balanceOf(address owner, uint256 id) external view returns (uint256);\n\n // return true for Non-NFT ERC1155 tokens which exists\n function isCollection(uint256 id) external view returns (bool);\n\n function collectionIndexOf(uint256 id) external view returns (uint256);\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external;\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external;\n\n function burnFrom(\n address from,\n uint256 id,\n uint256 amount\n ) external;\n\n function getBouncerAdmin() external view returns (address);\n\n function extractERC721From(\n address sender,\n uint256 id,\n address to\n ) external returns (uint256 newId);\n\n function isBouncer(address who) external view returns (bool);\n\n function creatorOf(uint256 id) external view returns (address);\n\n function doesHashExist(uint256 id) external view returns (bool);\n\n function isSuperOperator(address who) external view returns (bool);\n\n function isApprovedForAll(address owner, address operator) external view returns (bool isOperator);\n\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) external returns (uint256[] memory);\n\n function name() external returns (string memory _name);\n\n function symbol() external returns (string memory _symbol);\n\n function supportsInterface(bytes4 id) external returns (bool);\n\n function uri(uint256 id) external returns (string memory);\n\n function setAssetERC721(IAssetERC721 assetERC721) external;\n\n function exists(uint256 tokenId) external view returns (bool);\n\n function setTrustedForwarder(address trustedForwarder) external;\n\n function isTrustedForwarder(address forwarder) external returns (bool);\n\n function getTrustedForwarder() external view returns (address);\n\n function metadataHash(uint256 id) external view returns (bytes32);\n}\n" + }, + "src/solc_0.8/common/interfaces/IAssetERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IERC721Base} from \"./IERC721Base.sol\";\n\ninterface IAssetERC721 is IERC721Base {\n function setTokenURI(uint256 id, string memory uri) external;\n\n function tokenURI(uint256 id) external view returns (string memory);\n}\n" + }, + "src/solc_0.8/common/interfaces/IAssetMinter.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\npragma experimental ABIEncoderV2;\n\ninterface IAssetMinter {\n struct AssetData {\n uint16[] gemIds;\n uint16 catalystId;\n }\n\n // use only to fix stack too deep\n struct MintData {\n address from;\n address to;\n uint40 packId;\n bytes32 metadataHash;\n bytes data;\n }\n\n function mintWithoutCatalyst(\n MintData calldata mintData,\n uint16 typeAsset1Based,\n uint256 quantity\n ) external returns (uint256 assetId);\n\n function mintWithCatalyst(\n MintData calldata mintData,\n uint16 catalystId,\n uint16[] calldata gemIds,\n uint256 quantity,\n uint256 _numberOfCatalystBurnPerAsset,\n uint256 _numberOfGemsBurnPerAsset\n ) external returns (uint256 assetId);\n\n function mintMultipleWithCatalyst(\n MintData calldata mintData,\n AssetData[] memory assets,\n uint256[] memory supplies,\n uint256 _numberOfCatalystBurnPerAsset,\n uint256 _numberOfGemsBurnPerAsset\n ) external returns (uint256[] memory assetIds);\n\n function mintMultipleWithoutCatalyst(\n MintData calldata mintData,\n uint256[] calldata supplies,\n uint16[] calldata assetTypesIds\n ) external returns (uint256[] memory assetIds);\n\n function mintCustomNumberWithCatalyst(\n MintData calldata mintData,\n uint16 catalystId,\n uint16[] calldata gemIds,\n uint256 quantity,\n uint256 _numberOfCatalystBurnPerAsset,\n uint256 _numberOfGemsBurnPerAsset\n ) external returns (uint256 assetId);\n\n function mintCustomNumberWithoutCatalyst(MintData calldata mintData, uint256 quantity)\n external\n returns (uint256 assetId);\n\n function addOrReplaceQuantityByCatalystId(uint16 catalystId, uint256 newQuantity) external;\n\n function addOrReplaceAssetTypeQuantity(uint16 index1Based, uint256 newQuantity) external;\n\n function setNumberOfGemsBurnPerAsset(uint32 newQuantity) external;\n\n function setNumberOfCatalystsBurnPerAsset(uint32 newQuantity) external;\n\n function setCustomMintingAllowance(address addressToModify, bool isAddressAllowed) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IAssetToken.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\ninterface IAssetToken {\n function mint(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256 supply,\n uint8 rarity,\n address owner,\n bytes calldata data\n ) external returns (uint256 id);\n\n function mintMultiple(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256[] calldata supplies,\n bytes calldata rarityPack,\n address owner,\n bytes calldata data\n ) external returns (uint256[] memory ids);\n\n // fails on non-NFT or nft who do not have collection (was a mistake)\n function collectionOf(uint256 id) external view returns (uint256);\n\n function balanceOf(address owner, uint256 id) external view returns (uint256);\n\n // return true for Non-NFT ERC1155 tokens which exists\n function isCollection(uint256 id) external view returns (bool);\n\n function collectionIndexOf(uint256 id) external view returns (uint256);\n\n function extractERC721From(\n address sender,\n uint256 id,\n address to\n ) external returns (uint256 newId);\n\n function transferFrom(\n address from,\n address to,\n uint256 id\n ) external;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id\n ) external;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external;\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external;\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external;\n\n function isSuperOperator(address who) external view returns (bool);\n}\n" + }, + "src/solc_0.8/common/interfaces/IAssetUpgrader.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\npragma experimental ABIEncoderV2;\n\ninterface IAssetUpgrader {\n function extractAndSetCatalyst(\n address from,\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds,\n address to\n ) external returns (uint256 tokenId);\n\n function changeCatalyst(\n address from,\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds,\n address to\n ) external returns (uint256 tokenId);\n\n function addGems(\n address from,\n uint256 assetId,\n uint16[] calldata gemIds,\n address to\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IAttributes.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\npragma experimental ABIEncoderV2;\n\nimport \"../interfaces/IAssetAttributesRegistry.sol\";\n\ninterface IAttributes {\n function getAttributes(uint256 assetId, IAssetAttributesRegistry.GemEvent[] calldata events)\n external\n view\n returns (uint32[] memory values);\n}\n" + }, + "src/solc_0.8/common/interfaces/IAuthValidator.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface IAuthValidator {\n function isAuthValid(bytes calldata signature, bytes32 hashedData) external view returns (bool);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/**\n @title ERC-1155 Multi Token Standard\n @dev See https://eips.ethereum.org/EIPS/eip-1155\n Note: The ERC-165 identifier for this interface is 0xd9b67a26.\n */\ninterface IERC1155 {\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n event URI(string value, uint256 indexed id);\n\n /**\n @notice Transfers `value` amount of an `id` from `from` to `to` (with safety call).\n @dev Caller must be approved to manage the tokens being transferred out of the `from` account (see \"Approval\" section of the standard).\n MUST revert if `to` is the zero address.\n MUST revert if balance of holder for token `id` is lower than the `value` sent.\n MUST revert on any other error.\n MUST emit the `TransferSingle` event to reflect the balance change (see \"Safe Transfer Rules\" section of the standard).\n After the above conditions are met, this function MUST check if `to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `to` and act appropriately (see \"Safe Transfer Rules\" section of the standard).\n @param from Source address\n @param to Target address\n @param id ID of the token type\n @param value Transfer amount\n @param data Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `to`\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external;\n\n /**\n @notice Transfers `values` amount(s) of `ids` from the `from` address to the `to` address specified (with safety call).\n @dev Caller must be approved to manage the tokens being transferred out of the `from` account (see \"Approval\" section of the standard).\n MUST revert if `to` is the zero address.\n MUST revert if length of `ids` is not the same as length of `values`.\n MUST revert if any of the balance(s) of the holder(s) for token(s) in `ids` is lower than the respective amount(s) in `values` sent to the recipient.\n MUST revert on any other error.\n MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see \"Safe Transfer Rules\" section of the standard).\n Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).\n After the above conditions for the transfer(s) in the batch are met, this function MUST check if `to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `to` and act appropriately (see \"Safe Transfer Rules\" section of the standard).\n @param from Source address\n @param to Target address\n @param ids IDs of each token type (order and length must match _values array)\n @param values Transfer amounts per token type (order and length must match _ids array)\n @param data Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `to`\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external;\n\n /**\n @notice Get the balance of an account's tokens.\n @param owner The address of the token holder\n @param id ID of the token\n @return The _owner's balance of the token type requested\n */\n function balanceOf(address owner, uint256 id) external view returns (uint256);\n\n /**\n @notice Get the balance of multiple account/token pairs\n @param owners The addresses of the token holders\n @param ids ID of the tokens\n @return The _owner's balance of the token types requested (i.e. balance for each (owner, id) pair)\n */\n function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) external view returns (uint256[] memory);\n\n /**\n @notice Enable or disable approval for a third party (\"operator\") to manage all of the caller's tokens.\n @dev MUST emit the ApprovalForAll event on success.\n @param operator Address to add to the set of authorized operators\n @param approved True if the operator is approved, false to revoke approval\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n @notice Queries the approval status of an operator for a given owner.\n @param owner The owner of the tokens\n @param operator Address of authorized operator\n @return True if the operator is approved, false if not\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC1155TokenReceiver.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/**\n Note: The ERC-165 identifier for this interface is 0x4e2312e0.\n*/\ninterface IERC1155TokenReceiver {\n /**\n @notice Handle the receipt of a single ERC1155 token type.\n @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.\n This function MUST return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` (i.e. 0xf23a6e61) if it accepts the transfer.\n This function MUST revert if it rejects the transfer.\n Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller.\n @param operator The address which initiated the transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param id The ID of the token being transferred\n @param value The amount of tokens being transferred\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n @notice Handle the receipt of multiple ERC1155 token types.\n @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.\n This function MUST return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` (i.e. 0xbc197c81) if it accepts the transfer(s).\n This function MUST revert if it rejects the transfer(s).\n Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller.\n @param operator The address which initiated the batch transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param ids An array containing ids of each token being transferred (order and length must match _values array)\n @param values An array containing amounts of each token being transferred (order and length must match _ids array)\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC165.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/**\n * @title ERC165\n * @dev https://eips.ethereum.org/EIPS/eip-165\n */\ninterface IERC165 {\n /**\n * @notice Query if a contract implements interface `interfaceId`\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @dev Interface identification is specified in ERC-165. This function\n * uses less than 30,000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\n/// @dev see https://eips.ethereum.org/EIPS/eip-20\ninterface IERC20 {\n /// @notice emitted when tokens are transfered from one address to another.\n /// @param from address from which the token are transfered from (zero means tokens are minted).\n /// @param to destination address which the token are transfered to (zero means tokens are burnt).\n /// @param value amount of tokens transferred.\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice emitted when owner grant transfer rights to another address\n /// @param owner address allowing its token to be transferred.\n /// @param spender address allowed to spend on behalf of `owner`\n /// @param value amount of tokens allowed.\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /// @notice return the current total amount of tokens owned by all holders.\n /// @return supply total number of tokens held.\n function totalSupply() external view returns (uint256 supply);\n\n /// @notice return the number of tokens held by a particular address.\n /// @param who address being queried.\n /// @return balance number of token held by that address.\n function balanceOf(address who) external view returns (uint256 balance);\n\n /// @notice transfer tokens to a specific address.\n /// @param to destination address receiving the tokens.\n /// @param value number of tokens to transfer.\n /// @return success whether the transfer succeeded.\n function transfer(address to, uint256 value) external returns (bool success);\n\n /// @notice transfer tokens from one address to another.\n /// @param from address tokens will be sent from.\n /// @param to destination address receiving the tokens.\n /// @param value number of tokens to transfer.\n /// @return success whether the transfer succeeded.\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool success);\n\n /// @notice approve an address to spend on your behalf.\n /// @param spender address entitled to transfer on your behalf.\n /// @param value amount allowed to be transfered.\n /// @param success whether the approval succeeded.\n function approve(address spender, uint256 value) external returns (bool success);\n\n /// @notice return the current allowance for a particular owner/spender pair.\n /// @param owner address allowing spender.\n /// @param spender address allowed to spend.\n /// @return amount number of tokens `spender` can spend on behalf of `owner`.\n function allowance(address owner, address spender) external view returns (uint256 amount);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC20Extended.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"./IERC20.sol\";\n\ninterface IERC20Extended is IERC20 {\n function burnFor(address from, uint256 amount) external;\n\n function burn(uint256 amount) external;\n\n function approveFor(\n address owner,\n address spender,\n uint256 amount\n ) external returns (bool success);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC677.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface IERC677 {\n function transferAndCall(\n address to,\n uint256 value,\n bytes calldata data\n ) external returns (bool success);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC677Receiver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface IERC677Receiver {\n function onTokenTransfer(\n address _sender,\n uint256 _value,\n bytes calldata _data\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"./IERC165.sol\";\nimport \"./IERC721Events.sol\";\n\n/**\n * @title ERC721 Non-Fungible Token Standard basic interface\n * @dev see https://eips.ethereum.org/EIPS/eip-721\n */\n/*interface*/\ninterface IERC721 is IERC165, IERC721Events {\n function balanceOf(address owner) external view returns (uint256 balance);\n\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n // function exists(uint256 tokenId) external view returns (bool exists);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC721Base.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\nimport {IERC721ExtendedToken} from \"./IERC721ExtendedToken.sol\";\n\ninterface IERC721Base is IERC721Upgradeable {\n function mint(address to, uint256 id) external;\n\n function mint(\n address to,\n uint256 id,\n bytes calldata metaData\n ) external;\n\n function approveFor(\n address from,\n address operator,\n uint256 id\n ) external;\n\n function setApprovalForAllFor(\n address from,\n address operator,\n bool approved\n ) external;\n\n function burnFrom(address from, uint256 id) external;\n\n function burn(uint256 id) external;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external override;\n\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids\n ) external;\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external;\n\n function exists(uint256 tokenId) external view returns (bool);\n\n function supportsInterface(bytes4 id) external view override returns (bool);\n\n function setTrustedForwarder(address trustedForwarder) external;\n\n function isTrustedForwarder(address forwarder) external returns (bool);\n\n function getTrustedForwarder() external returns (address trustedForwarder);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC721Events.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/**\n * @title ERC721 Non-Fungible Token Standard basic interface\n * @dev see https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Events {\n event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);\n event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);\n // Duplicate event, ERC1155 ApprovalForAll\n // event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC721Extended.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\n\ninterface IERC721Extended is IERC721 {\n function approveFor(\n address sender,\n address operator,\n uint256 id\n ) external;\n\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external;\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external;\n\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) external;\n\n function burn(uint256 id) external;\n\n function burnFrom(address from, uint256 id) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC721ExtendedToken.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface IERC721ExtendedToken {\n function approveFor(\n address sender,\n address operator,\n uint256 id\n ) external;\n\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids\n ) external;\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external;\n\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) external;\n\n function burn(uint256 id) external;\n\n function burnFrom(address from, uint256 id) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC721MandatoryTokenReceiver.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/**\n * @title IERC721MandatoryTokenReceiver\n * @author The Sandbox\n * @notice Interface for any contract that wants to support safeBatchTransfers\n * from ERC721 asset contracts.\n * @dev The ERC-165 identifier for this interface is 0x5e8bf644.\n */\ninterface IERC721MandatoryTokenReceiver {\n /**\n * @notice Whenever tokens are transferred to this contract via {IERC721-safeBatchTransferFrom}\n * by `operator` from `from`, this function is called.\n * @param operator sender\n * @param from owner of the tokens\n * @param ids token ids\n * @param data extra data\n * @return 0x4b808c46 if the transfer is a success\n */\n function onERC721BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n bytes calldata data\n ) external returns (bytes4); // needs to return 0x4b808c46\n\n /**\n * @notice Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n * @param operator sender\n * @param from owner of the token\n * @param tokenId token id\n * @param data extra data\n * @return 0x4b808c46 if the transfer is a success\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4); // needs to return 0x150b7a02\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC721Minter.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface IERC721Minter {\n function mint(address to, uint256 id) external;\n\n function mint(\n address to,\n uint256 id,\n bytes calldata data\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC721Token.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\ninterface IERC721Token {\n function mint(address to, uint256 id) external;\n\n function mint(\n address to,\n uint256 id,\n bytes calldata metaData\n ) external;\n\n function burnFrom(address from, uint256 id) external;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n function exists(uint256 tokenId) external view returns (bool);\n}\n" + }, + "src/solc_0.8/common/interfaces/IERC721TokenReceiver.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n *\n * This code has not been reviewed.\n * Do not use or deploy this code before reviewing it personally first.\n */\n\ninterface IERC721TokenReceiver {\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "src/solc_0.8/common/interfaces/IGameMinter.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"./IGameToken.sol\";\n\ninterface IGameMinter {\n function createGame(\n address to,\n IGameToken.GameData calldata creation,\n address editor,\n uint64 subId\n ) external returns (uint256 gameId);\n\n function updateGame(uint256 gameId, IGameToken.GameData memory update) external returns (uint256 newId);\n}\n" + }, + "src/solc_0.8/common/interfaces/IGameToken.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\n/// @title Interface for the Game token\n\ninterface IGameToken {\n struct GameData1155 {\n uint256[] assetIdsToRemove;\n uint256[] assetAmountsToRemove;\n uint256[] assetIdsToAdd;\n uint256[] assetAmountsToAdd;\n }\n\n struct GameData721 {\n uint256[] assetIdsToRemove;\n uint256[] assetIdsToAdd;\n }\n\n struct GameData {\n GameData1155 gameData1155;\n GameData721 gameData721;\n bytes32 uri; // ipfs hash (without the prefix, assume cidv1 folder)\n }\n\n function createGame(\n address from,\n address to,\n GameData calldata creation,\n address editor,\n uint64 subId\n ) external returns (uint256 id);\n\n function burn(uint256 gameId) external;\n\n function burnFrom(address from, uint256 gameId) external;\n\n function recoverAssets(\n address from,\n address to,\n uint256 gameId,\n uint256[] calldata assetERC1155Ids,\n uint256[] calldata assetERC721Ids\n ) external;\n\n function burnAndRecover(\n address from,\n address to,\n uint256 gameId,\n uint256[] calldata assetERC1155Ids,\n uint256[] calldata assetERC721Ids\n ) external;\n\n function updateGame(\n address from,\n uint256 gameId,\n GameData calldata update\n ) external returns (uint256);\n\n function getERC1155AssetBalances(uint256 gameId, uint256[] calldata assetIds)\n external\n view\n returns (uint256[] calldata);\n\n function getERC721AssetBalances(uint256 gameId, uint256[] calldata assetIds)\n external\n view\n returns (uint256[] calldata);\n\n function setGameEditor(\n address gameCreator,\n address editor,\n bool isEditor\n ) external;\n\n function isGameEditor(address gameOwner, address editor) external view returns (bool isEditor);\n\n function creatorOf(uint256 id) external view returns (address);\n\n function transferCreatorship(\n uint256 gameId,\n address sender,\n address to\n ) external;\n\n function name() external pure returns (string memory);\n\n function symbol() external pure returns (string memory);\n\n function tokenURI(uint256 gameId) external returns (string memory uri);\n\n function onERC1155Received(\n address operator,\n address, /*from*/\n uint256, /*id*/\n uint256, /*value*/\n bytes calldata /*data*/\n ) external view returns (bytes4);\n\n function onERC1155BatchReceived(\n address operator,\n address, /*from*/\n uint256[] calldata, /*ids*/\n uint256[] calldata, /*values*/\n bytes calldata /*data*/\n ) external view returns (bytes4);\n}\n" + }, + "src/solc_0.8/common/interfaces/ILandToken.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\n/// @title ILandToken\n/// @author The Sandbox\n/// @notice Interface of the LAND token including quad methods\ninterface ILandToken {\n /// @notice transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\n /// @param from current owner of the quad\n /// @param to destination\n /// @param sizes list of sizes for each quad\n /// @param xs list of bottom left x coordinates for each quad\n /// @param ys list of bottom left y coordinates for each quad\n /// @param data additional data\n function batchTransferQuad(\n address from,\n address to,\n uint256[] calldata sizes,\n uint256[] calldata xs,\n uint256[] calldata ys,\n bytes calldata data\n ) external;\n\n /// @notice transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\n /// @param from current owner of the quad\n /// @param to destination\n /// @param size size of the quad\n /// @param x The top left x coordinate of the quad\n /// @param y The top left y coordinate of the quad\n /// @param data additional data\n function transferQuad(\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external;\n\n /// @notice Transfer many tokens between 2 addresses.\n /// @param from The sender of the token.\n /// @param to The recipient of the token.\n /// @param ids The ids of the tokens.\n /// @param data Additional data.\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/ILandTokenV2.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./ILandToken.sol\";\n\n/**\n * @title ILandTokenV2\n * @author The Sandbox\n * @notice Interface of the LAND token including quad methods\n */\ninterface ILandTokenV2 is ILandToken {\n /**\n * @notice Checks if an address if an operator\n * @param who address checked\n * @return is it super operator\n */\n function isSuperOperator(address who) external view returns (bool);\n\n /**\n * @notice Checks if a LAND exists by its coordinates\n * @param size size of the quad\n * @param x x coordinate\n * @param y y coordinate\n * @return does the LAND exist\n */\n function exists(\n uint256 size,\n uint256 x,\n uint256 y\n ) external view returns (bool);\n\n /**\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\n * @param to The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external;\n\n /**\n * @notice Checks if a parent quad has child quads already minted.\n * Then mints the rest child quads and transfers the parent quad.\n * Should only be called by the tunnel.\n * @param to The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintAndTransferQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/ILandTokenV3.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./ILandTokenV2.sol\";\n\ninterface ILandTokenV3 is ILandTokenV2 {\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) external;\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) external;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IMintableERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface IMintableERC1155 {\n /**\n * @notice Creates `amount` tokens of token type `id`, and assigns them to `account`.\n * @dev Should be callable only by MintableERC1155Predicate\n * Make sure minting is done only by this function\n * @param account user address for whom token is being minted\n * @param id token which is being minted\n * @param amount amount of token being minted\n * @param data extra byte data to be accompanied with minted tokens\n */\n function mint(\n address account,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @notice Batched version of singular token minting, where\n * for each token in `ids` respective amount to be minted from `amounts`\n * array, for address `to`.\n * @dev Should be callable only by MintableERC1155Predicate\n * Make sure minting is done only by this function\n * @param to user address for whom token is being minted\n * @param ids tokens which are being minted\n * @param amounts amount of each token being minted\n * @param data extra byte data to be accompanied with minted tokens\n */\n function mintBatch(\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IMintableERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\n// import {IERC721} from \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\n\npragma solidity 0.8.2;\n\ninterface IMintableERC721 {\n // is IERC721 {\n\n /**\n * @notice called by predicate contract to mint tokens while withdrawing\n * @dev Should be callable only by MintableERC721Predicate\n * Make sure minting is done only by this function\n * @param user user address for whom token is being minted\n * @param tokenId tokenId being minted\n */\n function mint(address user, uint256 tokenId) external;\n\n /**\n * @notice called by predicate contract to mint tokens while withdrawing with metadata from L2\n * @dev Should be callable only by MintableERC721Predicate\n * Make sure minting is only done either by this function/ 👆\n * @param user user address for whom token is being minted\n * @param tokenId tokenId being minted\n * @param metaData Associated token metadata, to be decoded & set using `setTokenMetadata`\n *\n * Note : If you're interested in taking token metadata from L2 to L1 during exit, you must\n * implement this method\n */\n function mint(\n address user,\n uint256 tokenId,\n bytes calldata metaData\n ) external;\n\n /**\n * @notice check if token already exists, return true if it does exist\n * @dev this check will be used by the predicate to determine if the token needs to be minted or transfered\n * @param tokenId tokenId being checked\n */\n function exists(uint256 tokenId) external view returns (bool);\n\n // This one came form ERC721 and is used by the predicate!!!\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IPolygonAssetERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IAssetERC721} from \"./IAssetERC721.sol\";\n\ninterface IPolygonAssetERC1155 {\n function changeBouncerAdmin(address newBouncerAdmin) external;\n\n function setBouncer(address bouncer, bool enabled) external;\n\n function setPredicate(address predicate) external;\n\n function mint(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256 supply,\n address owner,\n bytes calldata data\n ) external returns (uint256 id);\n\n function mint(\n address account,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n function mintDeficit(\n address account,\n uint256 id,\n uint256 amount\n ) external;\n\n function mintMultiple(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256[] calldata supplies,\n bytes calldata rarityPack,\n address owner,\n bytes calldata data\n ) external returns (uint256[] memory ids);\n\n // fails on non-NFT or nft who do not have collection (was a mistake)\n function collectionOf(uint256 id) external view returns (uint256);\n\n function balanceOf(address owner, uint256 id) external view returns (uint256);\n\n // return true for Non-NFT ERC1155 tokens which exists\n function isCollection(uint256 id) external view returns (bool);\n\n function collectionIndexOf(uint256 id) external view returns (uint256);\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external;\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external;\n\n function burnFrom(\n address from,\n uint256 id,\n uint256 amount\n ) external;\n\n function getBouncerAdmin() external view returns (address);\n\n function extractERC721From(\n address sender,\n uint256 id,\n address to\n ) external returns (uint256 newId);\n\n function isBouncer(address who) external view returns (bool);\n\n function creatorOf(uint256 id) external view returns (address);\n\n function doesHashExist(uint256 id) external view returns (bool);\n\n function isSuperOperator(address who) external view returns (bool);\n\n function isApprovedForAll(address owner, address operator) external view returns (bool isOperator);\n\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) external returns (uint256[] memory);\n\n function name() external returns (string memory _name);\n\n function symbol() external returns (string memory _symbol);\n\n function supportsInterface(bytes4 id) external returns (bool);\n\n function uri(uint256 id) external returns (string memory);\n\n function setAssetERC721(IAssetERC721 assetERC721) external;\n\n function exists(uint256 tokenId) external view returns (bool);\n\n function setTrustedForwarder(address trustedForwarder) external;\n\n function isTrustedForwarder(address forwarder) external returns (bool);\n\n function getTrustedForwarder() external returns (address);\n\n function metadataHash(uint256 id) external returns (bytes32);\n}\n" + }, + "src/solc_0.8/common/interfaces/IPolygonAssetERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IERC721Base} from \"./IERC721Base.sol\";\n\ninterface IPolygonAssetERC721 is IERC721Base {\n function setTokenURI(uint256 id, string memory uri) external;\n\n function tokenURI(uint256 id) external view returns (string memory);\n}\n" + }, + "src/solc_0.8/common/interfaces/IPolygonLand.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {ILandToken} from \"./ILandToken.sol\";\n\n/**\n * @title IPolygonLand\n * @author The Sandbox\n * @notice Interface of the LAND token on the child chain\n */\ninterface IPolygonLand is ILandToken {\n /**\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\n * @param to The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) external;\n\n /**\n * @notice Checks if a LAND exists by its coordinates\n * @param size size of the quad\n * @param x x coordinate\n * @param y y coordinate\n * @return does the LAND exist\n */\n function exists(\n uint256 size,\n uint256 x,\n uint256 y\n ) external view returns (bool);\n}\n" + }, + "src/solc_0.8/common/interfaces/IPolygonLandTunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\n/**\n * @title IPolygonLandTunnel\n * @author The Sandbox\n * @notice Interface of the LAND tunnel on the child chain\n */\ninterface IPolygonLandTunnel {\n /**\n * @notice Withdraw multiple quads to the root chain\n * @param to the recipient\n * @param sizes size of the quads\n * @param xs x of the quads\n * @param ys y of the quads\n * @param data extra data\n */\n function batchTransferQuadToL1(\n address to,\n uint256[] calldata sizes,\n uint256[] calldata xs,\n uint256[] calldata ys,\n bytes memory data\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IPolygonLandV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./IPolygonLand.sol\";\n\n/**\n * @title IPolygonLandV2\n * @author The Sandbox\n * @notice interface of the LAND v2 based on IPolygonLand\n */\ninterface IPolygonLandV2 is IPolygonLand {\n /**\n * @notice checks if an address if an operator\n * @param who address checked\n * @return is it super operator\n */\n function isSuperOperator(address who) external view returns (bool);\n\n /**\n * @notice checks if a parent quad has child quads already minted.\n * Then mints the rest child quads and transfers the parent quad.\n * Should only be called by the tunnel.\n * @param to The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintAndTransferQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/IPolygonLandWithSetApproval.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IPolygonLand} from \"./IPolygonLand.sol\";\n\n/**\n * @title IPolygonLandWithSetApproval\n * @author The Sandbox\n * @notice Approve for all interface for the LAND on the chain root\n */\ninterface IPolygonLandWithSetApproval is IPolygonLand {\n /**\n * @notice Approve or disapprove the operator for all the tokens\n * @param operator address to approve\n * @param approved should it be approved or not\n */\n function setApprovalForAll(address operator, bool approved) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/Medianizer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\n/**\n * @title Medianizer contract\n * @dev From MakerDAO (https://etherscan.io/address/0x729D19f657BD0614b4985Cf1D82531c67569197B#code)\n */\ninterface Medianizer {\n function read() external view returns (bytes32);\n}\n" + }, + "src/solc_0.8/common/interfaces/pos-portal/child/IChildToken.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface IChildToken {\n function deposit(address user, bytes calldata depositData) external;\n}\n" + }, + "src/solc_0.8/common/interfaces/pos-portal/root/IRootERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\n// import {IERC721} from \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\n\npragma solidity 0.8.2;\n\ninterface IRootERC721 {\n // is IERC721 {\n // Make sure you implement this method in root ERC721\n // contract when you're interested in transferring\n // metadata from L2 to L1\n function setTokenMetadata(uint256 tokenId, bytes calldata data) external;\n}\n" + }, + "src/solc_0.8/common/Libraries/BytesUtil.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nlibrary BytesUtil {\n uint256 private constant DATA_MIN_LENGTH = 68;\n\n /// @dev Check if the data == _address.\n /// @param data The bytes passed to the function.\n /// @param _address The address to compare to.\n /// @return Whether the first param == _address.\n function doFirstParamEqualsAddress(bytes memory data, address _address) internal pure returns (bool) {\n if (data.length < DATA_MIN_LENGTH) {\n return false;\n }\n uint256 value;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n value := mload(add(data, 36))\n }\n return value == uint256(uint160(_address));\n }\n}\n" + }, + "src/solc_0.8/common/Libraries/ObjectLib32.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nlibrary ObjectLib32 {\n enum Operations {ADD, SUB, REPLACE}\n // Constants regarding bin or chunk sizes for balance packing\n uint256 internal constant TYPES_BITS_SIZE = 32; // Max size of each object\n uint256 internal constant TYPES_PER_UINT256 = 256 / TYPES_BITS_SIZE; // Number of types per uint256\n uint256 internal constant TYPE_ELIMINATOR = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFFFFFFFFFFF;\n\n //\n // Objects and Tokens Functions\n //\n\n /// @dev Return the bin number and index within that bin where ID is\n /// @param tokenId Object type\n /// @return bin Bin number.\n /// @return index ID's index within that bin.\n function getTokenBinIndex(uint256 tokenId) internal pure returns (uint256 bin, uint256 index) {\n uint256 id = tokenId & TYPE_ELIMINATOR;\n unchecked {bin = (id * TYPES_BITS_SIZE) / 256;}\n index = tokenId % TYPES_PER_UINT256;\n return (bin, index);\n }\n\n /**\n * @dev update the balance of a type provided in binBalances\n * @param binBalances Uint256 containing the balances of objects\n * @param index Index of the object in the provided bin\n * @param amount Value to update the type balance\n * @param operation Which operation to conduct :\n * Operations.REPLACE : Replace type balance with amount\n * Operations.ADD : ADD amount to type balance\n * Operations.SUB : Substract amount from type balance\n */\n function updateTokenBalance(\n uint256 binBalances,\n uint256 index,\n uint256 amount,\n Operations operation\n ) internal pure returns (uint256 newBinBalance) {\n uint256 objectBalance = 0;\n if (operation == Operations.ADD) {\n objectBalance = getValueInBin(binBalances, index);\n newBinBalance = writeValueInBin(binBalances, index, objectBalance + amount);\n } else if (operation == Operations.SUB) {\n objectBalance = getValueInBin(binBalances, index);\n require(objectBalance >= amount, \"can't substract more than there is\");\n newBinBalance = writeValueInBin(binBalances, index, objectBalance - amount);\n } else if (operation == Operations.REPLACE) {\n newBinBalance = writeValueInBin(binBalances, index, amount);\n } else {\n revert(\"Invalid operation\"); // Bad operation\n }\n\n return newBinBalance;\n }\n\n /*\n * @dev return value in binValue at position index\n * @param binValue uint256 containing the balances of TYPES_PER_UINT256 types\n * @param index index at which to retrieve value\n * @return Value at given index in bin\n */\n function getValueInBin(uint256 binValue, uint256 index) internal pure returns (uint256) {\n // Mask to retrieve data for a given binData\n uint256 mask = (uint256(1) << TYPES_BITS_SIZE) - 1;\n\n // Shift amount\n uint256 rightShift = 256 - TYPES_BITS_SIZE * (index + 1);\n return (binValue >> rightShift) & mask;\n }\n\n /**\n * @dev return the updated binValue after writing amount at index\n * @param binValue uint256 containing the balances of TYPES_PER_UINT256 types\n * @param index Index at which to retrieve value\n * @param amount Value to store at index in bin\n * @return Value at given index in bin\n */\n function writeValueInBin(\n uint256 binValue,\n uint256 index,\n uint256 amount\n ) internal pure returns (uint256) {\n require(amount < 2**TYPES_BITS_SIZE, \"Amount to write in bin is too large\");\n\n // Mask to retrieve data for a given binData\n uint256 mask = (uint256(1) << TYPES_BITS_SIZE) - 1;\n\n // Shift amount\n uint256 leftShift = 256 - TYPES_BITS_SIZE * (index + 1);\n return (binValue & ~(mask << leftShift)) | (amount << leftShift);\n }\n}\n" + }, + "src/solc_0.8/common/Libraries/PriceUtil.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nlibrary PriceUtil {\n function calculateCurrentPrice(\n uint256 startingPrice,\n uint256 endingPrice,\n uint256 duration,\n uint256 secondsPassed\n ) internal pure returns (uint256) {\n if (secondsPassed > duration) {\n return endingPrice;\n }\n if (endingPrice == startingPrice) {\n return endingPrice;\n } else if (endingPrice > startingPrice) {\n return startingPrice + ((endingPrice - startingPrice) * secondsPassed) / duration;\n } else {\n return startingPrice - ((startingPrice - endingPrice) * secondsPassed) / duration;\n }\n }\n\n function calculateFee(uint256 price, uint256 fee10000th) internal pure returns (uint256) {\n // _fee < 10000, so the result will be <= price\n return (price * fee10000th) / 10000;\n }\n}\n" + }, + "src/solc_0.8/common/Libraries/SafeMathWithRequire.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that revert\n */\nlibrary SafeMathWithRequire {\n uint256 private constant DECIMALS_18 = 1000000000000000000;\n uint256 private constant DECIMALS_12 = 1000000000000;\n uint256 private constant DECIMALS_9 = 1000000000;\n uint256 private constant DECIMALS_6 = 1000000;\n\n function sqrt6(uint256 a) internal pure returns (uint256 c) {\n a = a * DECIMALS_12;\n uint256 tmp = (a + 1) / 2;\n c = a;\n // tmp cannot be zero unless a = 0 which skip the loop\n while (tmp < c) {\n c = tmp;\n tmp = ((a / tmp) + tmp) / 2;\n }\n }\n\n function sqrt3(uint256 a) internal pure returns (uint256 c) {\n a = a * DECIMALS_6;\n uint256 tmp = (a + 1) / 2;\n c = a;\n // tmp cannot be zero unless a = 0 which skip the loop\n while (tmp < c) {\n c = tmp;\n tmp = ((a / tmp) + tmp) / 2;\n }\n }\n\n function cbrt6(uint256 a) internal pure returns (uint256 c) {\n a = a * DECIMALS_18;\n uint256 tmp = (a + 2) / 3;\n c = a;\n // tmp cannot be zero unless a = 0 which skip the loop\n while (tmp < c) {\n c = tmp;\n uint256 tmpSquare = tmp**2;\n require(tmpSquare > tmp, \"overflow\");\n tmp = ((a / tmpSquare) + (tmp * 2)) / 3;\n }\n return c;\n }\n\n function cbrt3(uint256 a) internal pure returns (uint256 c) {\n a = a * DECIMALS_9;\n uint256 tmp = (a + 2) / 3;\n c = a;\n // tmp cannot be zero unless a = 0 which skip the loop\n while (tmp < c) {\n c = tmp;\n uint256 tmpSquare = tmp**2;\n require(tmpSquare > tmp, \"overflow\");\n tmp = ((a / tmpSquare) + (tmp * 2)) / 3;\n }\n return c;\n }\n}\n" + }, + "src/solc_0.8/common/Libraries/SigUtil.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nlibrary SigUtil {\n function recover(bytes32 hash, bytes memory sig) internal pure returns (address recovered) {\n require(sig.length == 65, \"incorrect signature length\");\n\n bytes32 r;\n bytes32 s;\n uint8 v;\n assembly {\n r := mload(add(sig, 32))\n s := mload(add(sig, 64))\n v := byte(0, mload(add(sig, 96)))\n }\n\n // Version of signature should be 27 or 28, but 0 and 1 are also possible versions\n if (v < 27) {\n v += 27;\n }\n require(v == 27 || v == 28, \"version of signature should be 27 or 28\");\n\n recovered = ecrecover(hash, v, r, s);\n require(recovered != address(0), \"incorrect address\");\n }\n\n function recoverWithZeroOnFailure(bytes32 hash, bytes memory sig) internal pure returns (address) {\n if (sig.length != 65) {\n return (address(0));\n }\n\n bytes32 r;\n bytes32 s;\n uint8 v;\n assembly {\n r := mload(add(sig, 32))\n s := mload(add(sig, 64))\n v := byte(0, mload(add(sig, 96)))\n }\n\n // Version of signature should be 27 or 28, but 0 and 1 are also possible versions\n if (v < 27) {\n v += 27;\n }\n\n if (v != 27 && v != 28) {\n return (address(0));\n } else {\n return ecrecover(hash, v, r, s);\n }\n }\n\n // Builds a prefixed hash to mimic the behavior of eth_sign.\n function prefixed(bytes32 hash) internal pure returns (bytes memory) {\n return abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash);\n }\n}\n" + }, + "src/solc_0.8/defi/contributionCalculation/LandContributionCalculator.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {IERC721} from \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\nimport {SafeMathWithRequire} from \"../../common/Libraries/SafeMathWithRequire.sol\";\nimport {IContributionCalculator} from \"../interfaces/IContributionCalculator.sol\";\n\ncontract LandContributionCalculator is IContributionCalculator, Ownable {\n using Address for address;\n\n uint256 internal constant DECIMALS_9 = 1000000000;\n uint256 internal constant MIDPOINT_9 = 500000000;\n uint256 internal constant NFT_FACTOR_6 = 10000;\n uint256 internal constant NFT_CONSTANT_3 = 9000;\n uint256 internal constant ROOT3_FACTOR = 697;\n\n IERC721 public multiplierNFToken;\n\n constructor(IERC721 multiplierNFToken_) {\n multiplierNFToken = multiplierNFToken_;\n }\n\n function multiplierOf(address account) external view virtual returns (uint256) {\n return multiplierNFToken.balanceOf(account);\n }\n\n function computeContribution(address account, uint256 amountStaked) external view override returns (uint256) {\n uint256 numLands = multiplierNFToken.balanceOf(account);\n return _contribution(amountStaked, numLands);\n }\n\n function contribution(uint256 amountStaked, uint256 numLands) external pure returns (uint256) {\n return _contribution(amountStaked, numLands);\n }\n\n function setNFTMultiplierToken(address newNFTMultiplierToken) external onlyOwner {\n require(newNFTMultiplierToken.isContract(), \"LandContributionCalc: Bad NFTMultiplierToken address\");\n multiplierNFToken = IERC721(newNFTMultiplierToken);\n }\n\n function _contribution(uint256 amountStaked, uint256 numLands) internal pure returns (uint256) {\n if (numLands == 0) {\n return amountStaked;\n }\n uint256 nftContrib =\n NFT_FACTOR_6 * (NFT_CONSTANT_3 + SafeMathWithRequire.cbrt3((((numLands - 1) * ROOT3_FACTOR) + 1)));\n if (nftContrib > MIDPOINT_9) {\n nftContrib = MIDPOINT_9 + (nftContrib - MIDPOINT_9) / 10;\n }\n return amountStaked + ((amountStaked * nftContrib) / DECIMALS_9);\n }\n}\n" + }, + "src/solc_0.8/defi/contributionCalculation/LandOwnerContributionCalculator.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {IERC721} from \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\nimport {SafeMathWithRequire} from \"../../common/Libraries/SafeMathWithRequire.sol\";\nimport {IContributionCalculator} from \"../interfaces/IContributionCalculator.sol\";\n\ncontract LandOwnersAloneContributionCalculator is IContributionCalculator, Ownable {\n using Address for address;\n\n IERC721 public multiplierNFToken;\n\n constructor(IERC721 multiplierNFToken_) {\n multiplierNFToken = multiplierNFToken_;\n }\n\n function multiplierOf(address account) external view virtual returns (uint256) {\n return multiplierNFToken.balanceOf(account);\n }\n\n function computeContribution(address account, uint256 amountStaked) external view override returns (uint256) {\n uint256 numLands = multiplierNFToken.balanceOf(account);\n if (numLands > 0) {\n return amountStaked;\n }\n return 0;\n }\n\n function setNFTMultiplierToken(address newNFTMultiplierToken) external onlyOwner {\n require(newNFTMultiplierToken.isContract(), \"LandOwnersAloneContributionCalc: Bad NFTMultiplierToken address\");\n multiplierNFToken = IERC721(newNFTMultiplierToken);\n }\n}\n" + }, + "src/solc_0.8/defi/ERC20RewardPool.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Context} from \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport {IERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts-0.8/security/ReentrancyGuard.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {Pausable} from \"@openzeppelin/contracts-0.8/security/Pausable.sol\";\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport {Math} from \"@openzeppelin/contracts-0.8/utils/math/Math.sol\";\nimport {ERC2771HandlerV2} from \"../common/BaseWithStorage/ERC2771HandlerV2.sol\";\nimport {StakeTokenWrapper} from \"./StakeTokenWrapper.sol\";\nimport {IContributionRules} from \"./interfaces/IContributionRules.sol\";\nimport {IRewardCalculator} from \"./interfaces/IRewardCalculator.sol\";\nimport {LockRules} from \"./rules/LockRules.sol\";\nimport {RequirementsRules} from \"./rules/RequirementsRules.sol\";\n\n/// @title A pool that distributes rewards between users that stake any erc20 token\n/// @notice The contributions are updated passively, an external call to computeContribution from a backend is needed.\n/// @notice After initialization the reward calculator must be set by the admin.\n/// @dev The contract has two plugins that affect the behaviour: contributionCalculator and rewardCalculator\n/// @dev contributionCalculator instead of using the stake directly the result of computeContribution is used\n/// @dev this way some users can get an extra share of the rewards\n/// @dev rewardCalculator is used to manage the rate at which the rewards are distributed.\n/// @dev This way we can build different types of pools by mixing in the plugins we want with this contract.\n/// @dev default behaviour (address(0)) for contributionCalculator is to use the stacked amount as contribution.\n/// @dev default behaviour (address(0)) for rewardCalculator is that no rewards are given\ncontract ERC20RewardPool is\n Ownable,\n StakeTokenWrapper,\n LockRules,\n RequirementsRules,\n ReentrancyGuard,\n ERC2771HandlerV2,\n Pausable\n{\n using SafeERC20 for IERC20;\n using Address for address;\n\n event Staked(address indexed account, uint256 stakeAmount);\n event Withdrawn(address indexed account, uint256 stakeAmount);\n event Exit(address indexed account);\n event RewardPaid(address indexed account, uint256 rewardAmount);\n event ContributionUpdated(address indexed account, uint256 newContribution, uint256 oldContribution);\n\n uint256 internal constant DECIMALS_18 = 1 ether;\n\n // This value multiplied by the user contribution is the share of accumulated rewards (from the start of time\n // until the last call to restartRewards) for the user taking into account the value of totalContributions.\n uint256 public rewardPerTokenStored;\n\n IERC20 public rewardToken;\n IContributionRules public contributionRules;\n IRewardCalculator public rewardCalculator;\n\n // This value multiplied by the user contribution is the share of reward from the the last time\n // the user changed his contribution and called restartRewards\n mapping(address => uint256) public userRewardPerTokenPaid;\n\n // This value is the accumulated rewards won by the user when he called the contract.\n mapping(address => uint256) public rewards;\n\n uint256 internal _totalContributions;\n mapping(address => uint256) internal _contributions;\n\n constructor(\n IERC20 stakeToken_,\n IERC20 rewardToken_,\n address trustedForwarder\n ) StakeTokenWrapper(stakeToken_) {\n require(address(rewardToken_).isContract(), \"ERC20RewardPool: is not a contract\");\n rewardToken = rewardToken_;\n __ERC2771HandlerV2_initialize(trustedForwarder);\n }\n\n // Checks that the given address is a contract and\n // that the caller of the method is the owner of this contract - ERC20RewardPool.\n modifier isContractAndAdmin(address contractAddress) {\n require(contractAddress.isContract(), \"ERC20RewardPool: is not a contract\");\n require(owner() == _msgSender(), \"ERC20RewardPool: not admin\");\n _;\n }\n\n modifier isValidAddress(address account) {\n require(account != address(0), \"ERC20RewardPool: zero address\");\n\n _;\n }\n\n /// @notice set the reward token\n /// @param contractAddress address token used to pay rewards\n function setRewardToken(address contractAddress)\n external\n isContractAndAdmin(contractAddress)\n isValidAddress(contractAddress)\n {\n IERC20 _newRewardToken = IERC20(contractAddress);\n require(\n rewardToken.balanceOf(address(this)) <= _newRewardToken.balanceOf(address(this)),\n \"ERC20RewardPool: insufficient balance\"\n );\n rewardToken = _newRewardToken;\n }\n\n /// @notice set the stake token\n /// @param contractAddress address token used to stake funds\n function setStakeToken(address contractAddress)\n external\n isContractAndAdmin(contractAddress)\n isValidAddress(contractAddress)\n {\n IERC20 _newStakeToken = IERC20(contractAddress);\n require(\n _stakeToken.balanceOf(address(this)) <= _newStakeToken.balanceOf(address(this)),\n \"ERC20RewardPool: insufficient balance\"\n );\n _stakeToken = _newStakeToken;\n }\n\n /// @notice set the trusted forwarder\n /// @param trustedForwarder address of the contract that is enabled to send meta-tx on behalf of the user\n function setTrustedForwarder(address trustedForwarder) external isContractAndAdmin(trustedForwarder) {\n _trustedForwarder = trustedForwarder;\n }\n\n /// @notice set contract that contains all the contribution rules\n function setContributionRules(address contractAddress)\n external\n isContractAndAdmin(contractAddress)\n isValidAddress(contractAddress)\n {\n contributionRules = IContributionRules(contractAddress);\n }\n\n /// @notice set the reward calculator\n /// @param contractAddress address of a plugin that calculates absolute rewards at any point in time\n /// @param restartRewards_ if true the rewards from the previous calculator are accumulated before changing it\n function setRewardCalculator(address contractAddress, bool restartRewards_)\n external\n isContractAndAdmin(contractAddress)\n isValidAddress(contractAddress)\n {\n // We process the rewards of the current reward calculator before the switch.\n if (restartRewards_) {\n _restartRewards();\n }\n rewardCalculator = IRewardCalculator(contractAddress);\n }\n\n /// @notice the admin recover is able to recover reward funds\n /// @param receiver address of the beneficiary of the recovered funds\n /// @dev this function must be called in an emergency situation only.\n /// @dev Calling it is risky specially when rewardToken == stakeToken\n function recoverFunds(address receiver) external onlyOwner whenPaused() isValidAddress(receiver) {\n uint256 recoverAmount;\n\n if (rewardToken == _stakeToken) {\n recoverAmount = rewardToken.balanceOf(address(this)) - _totalSupply;\n } else {\n recoverAmount = rewardToken.balanceOf(address(this));\n }\n\n rewardToken.safeTransfer(receiver, recoverAmount);\n }\n\n /// @notice return the total supply of staked tokens\n /// @return the total supply of staked tokens\n function totalSupply() external view returns (uint256) {\n return _totalSupply;\n }\n\n /// @notice return the balance of staked tokens for a user\n /// @param account the address of the account\n /// @return balance of staked tokens\n function balanceOf(address account) external view returns (uint256) {\n return _balances[account];\n }\n\n /// @notice return the address of the stake token contract\n /// @return address of the stake token contract\n function stakeToken() external view returns (IERC20) {\n return _stakeToken;\n }\n\n /// @notice return the amount of rewards deposited in the contract that can be distributed by different campaigns\n /// @return the total amount of deposited rewards\n /// @dev this function can be called by a reward calculator to throw if a campaign doesn't have\n /// @dev enough rewards to start\n function getRewardsAvailable() external view returns (uint256) {\n if (address(rewardToken) != address(_stakeToken)) {\n return rewardToken.balanceOf(address(this));\n }\n return _stakeToken.balanceOf(address(this)) - _totalSupply;\n }\n\n /// @notice return the sum of the values returned by the contribution calculator\n /// @return total contributions of the users\n /// @dev this is the same than the totalSupply only if the contribution calculator\n /// @dev uses the staked amount as the contribution of the user which is the default behaviour\n function totalContributions() external view returns (uint256) {\n return _totalContributions;\n }\n\n /// @notice return the contribution of some user\n /// @param account the address of the account\n /// @return contribution of the users\n /// @dev this is the same than the balanceOf only if the contribution calculator\n /// @dev uses the staked amount as the contribution of the user which is the default behaviour\n function contributionOf(address account) external view returns (uint256) {\n return _contributions[account];\n }\n\n /// @notice accumulated rewards taking into account the totalContribution (see: rewardPerTokenStored)\n /// @return the accumulated total rewards\n /// @dev This value multiplied by the user contribution is the share of accumulated rewards for the user. Taking\n /// @dev into account the value of totalContributions.\n function rewardPerToken() external view returns (uint256) {\n return rewardPerTokenStored + _rewardPerToken();\n }\n\n /// @notice available earnings for some user\n /// @param account the address of the account\n /// @return the available earnings for the user\n function earned(address account) external view returns (uint256) {\n return rewards[account] + _earned(account, _rewardPerToken());\n }\n\n /// @notice accumulates the current rewards into rewardPerTokenStored and restart the reward calculator\n /// @dev calling this function makes no difference. It is useful for testing and when the reward calculator\n /// @dev is changed.\n function restartRewards() external {\n _restartRewards();\n }\n\n /// @notice update the contribution for a user\n /// @param account the address of the account\n /// @dev if the user change his holdings (or any other parameter that affect the contribution calculation),\n /// @dev he can the reward distribution to his favor. This function must be called by an external agent ASAP to\n /// @dev update the contribution for the user. We understand the risk but the rewards are distributed slowly so\n /// @dev the user cannot affect the reward distribution heavily.\n function computeContribution(address account) external isValidAddress(account) {\n // We decide to give the user the accumulated rewards even if he cheated a little bit.\n _processRewards(account);\n _updateContribution(account);\n }\n\n /// @notice update the contribution for a sef of users\n /// @param accounts the addresses of the accounts to update\n /// @dev see: computeContribution\n function computeContributionInBatch(address[] calldata accounts) external {\n _restartRewards();\n for (uint256 i = 0; i < accounts.length; i++) {\n address account = accounts[i];\n if (account == address(0)) {\n continue;\n }\n _processAccountRewards(account);\n _updateContribution(account);\n }\n }\n\n /// @notice stake some amount into the contract\n /// @param amount the amount of tokens to stake\n /// @dev the user must approve in the stake token before calling this function\n function stake(uint256 amount)\n external\n nonReentrant\n whenNotPaused()\n antiDepositCheck(_msgSender())\n checkRequirements(_msgSender(), amount, _balances[_msgSender()])\n {\n require(amount > 0, \"ERC20RewardPool: Cannot stake 0\");\n\n // The first time a user stakes he cannot remove his rewards immediately.\n if (timeLockClaim.lastClaim[_msgSender()] == 0) {\n timeLockClaim.lastClaim[_msgSender()] = block.timestamp;\n }\n\n lockDeposit.lastDeposit[_msgSender()] = block.timestamp;\n\n uint256 earlierRewards = 0;\n\n if (_totalContributions == 0 && rewardCalculator != IRewardCalculator(address(0))) {\n earlierRewards = rewardCalculator.getRewards();\n }\n\n _processRewards(_msgSender());\n super._stake(amount);\n _updateContribution(_msgSender());\n require(_contributions[_msgSender()] > 0, \"ERC20RewardPool: not enough contributions\");\n\n if (earlierRewards != 0) {\n rewards[_msgSender()] = rewards[_msgSender()] + earlierRewards;\n }\n emit Staked(_msgSender(), amount);\n }\n\n /// @notice withdraw the stake from the contract\n /// @param amount the amount of tokens to withdraw\n /// @dev the user can withdraw his stake independently from the rewards\n function withdraw(uint256 amount) external nonReentrant whenNotPaused() {\n _processRewards(_msgSender());\n _withdrawStake(_msgSender(), amount);\n _updateContribution(_msgSender());\n }\n\n /// @notice withdraw the stake and the rewards from the contract\n function exit() external nonReentrant whenNotPaused() {\n _processRewards(_msgSender());\n _withdrawStake(_msgSender(), _balances[_msgSender()]);\n _withdrawRewards(_msgSender());\n _updateContribution(_msgSender());\n emit Exit(_msgSender());\n }\n\n /// @notice withdraw the rewards from the contract\n /// @dev the user can withdraw his stake independently from the rewards\n function getReward() external nonReentrant whenNotPaused() {\n _processRewards(_msgSender());\n _withdrawRewards(_msgSender());\n _updateContribution(_msgSender());\n }\n\n function renounceOwnership() public view override onlyOwner {\n revert(\"ERC20RewardPool: can't renounceOwnership\");\n }\n\n function _withdrawStake(address account, uint256 amount) internal antiWithdrawCheck(_msgSender()) {\n require(amount > 0, \"ERC20RewardPool: Cannot withdraw 0\");\n lockWithdraw.lastWithdraw[_msgSender()] = block.timestamp;\n super._withdraw(amount);\n emit Withdrawn(account, amount);\n }\n\n function _withdrawRewards(address account) internal timeLockClaimCheck(account) {\n uint256 reward = rewards[account];\n uint256 mod = 0;\n if (reward > 0) {\n if (amountLockClaim.claimLockEnabled == true) {\n // constrain the reward amount to the integer allowed\n mod = reward % DECIMALS_18;\n reward = reward - mod;\n require(\n amountLockClaim.amount <= reward,\n \"ERC20RewardPool: Cannot withdraw - lockClaim.amount < reward\"\n );\n }\n rewards[account] = mod;\n rewardToken.safeTransfer(account, reward);\n emit RewardPaid(account, reward);\n }\n }\n\n function _updateContribution(address account) internal {\n uint256 oldContribution = _contributions[account];\n _totalContributions = _totalContributions - oldContribution;\n uint256 contribution = _computeContribution(account);\n _totalContributions = _totalContributions + contribution;\n _contributions[account] = contribution;\n emit ContributionUpdated(account, contribution, oldContribution);\n }\n\n function _computeContribution(address account) internal returns (uint256) {\n if (contributionRules == IContributionRules(address(0))) {\n return Math.min(_balances[account], maxStakeAllowedCalculator(account));\n } else {\n return\n contributionRules.computeMultiplier(\n account,\n Math.min(_balances[account], maxStakeAllowedCalculator(account))\n );\n }\n }\n\n // Something changed (stake, withdraw, etc), we distribute current accumulated rewards and start from zero.\n // Called each time there is a change in contract state (stake, withdraw, etc).\n function _processRewards(address account) internal {\n _restartRewards();\n _processAccountRewards(account);\n }\n\n // Update the earnings for this specific user with what he earned until now\n function _processAccountRewards(address account) internal {\n // usually _earned takes _rewardPerToken() but in this method is zero because _restartRewards must be\n // called before _processAccountRewards\n rewards[account] = rewards[account] + _earned(account, 0);\n // restart rewards for this specific user, now earned(account) = 0\n userRewardPerTokenPaid[account] = rewardPerTokenStored;\n }\n\n function _restartRewards() internal {\n if (rewardCalculator != IRewardCalculator(address(0))) {\n // Distribute the accumulated rewards\n rewardPerTokenStored = rewardPerTokenStored + _rewardPerToken();\n // restart rewards so now the rewardCalculator return zero rewards\n rewardCalculator.restartRewards();\n }\n }\n\n function _earned(address account, uint256 rewardPerToken_) internal view returns (uint256) {\n // - userRewardPerTokenPaid[account] * _contributions[account] / _totalContributions is the portion of\n // rewards the last time the user changed his contribution and called _restartRewards\n // (_totalContributions corresponds to previous value of that moment).\n // - rewardPerTokenStored * _contributions[account] is the share of the user from the\n // accumulated rewards (from the start of time until the last call to _restartRewards) with the\n // current value of _totalContributions\n // - _rewardPerToken() * _contributions[account] / _totalContributions is the share of the user of the\n // rewards from the last time anybody called _restartRewards until this moment\n //\n // The important thing to note is that at any moment in time _contributions[account] / _totalContributions is\n // the share of the user even if _totalContributions changes because of other users activity.\n return\n ((rewardPerToken_ + rewardPerTokenStored - userRewardPerTokenPaid[account]) * _contributions[account]) /\n 1e24;\n }\n\n // This function gives the proportion of the total contribution that corresponds to each user from\n // last restartRewards call.\n // _rewardsPerToken() * _contributions[account] is the amount of extra rewards gained from last restartRewards.\n function _rewardPerToken() internal view returns (uint256) {\n if (rewardCalculator == IRewardCalculator(address(0)) || _totalContributions == 0) {\n return 0;\n }\n return (rewardCalculator.getRewards() * 1e24) / _totalContributions;\n }\n\n // @dev Triggers stopped state.\n // The contract must not be paused.\n function pause() external onlyOwner {\n _pause();\n }\n\n // @dev Returns to normal state.\n // The contract must be paused.\n function unpause() external onlyOwner {\n _unpause();\n }\n\n function _msgSender() internal view override(Context, ERC2771HandlerV2) returns (address sender) {\n return ERC2771HandlerV2._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC2771HandlerV2) returns (bytes calldata) {\n return ERC2771HandlerV2._msgData();\n }\n}\n" + }, + "src/solc_0.8/defi/ERC20RewardPoolV2.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Context} from \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport {IERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts-0.8/security/ReentrancyGuard.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {Pausable} from \"@openzeppelin/contracts-0.8/security/Pausable.sol\";\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport {Math} from \"@openzeppelin/contracts-0.8/utils/math/Math.sol\";\nimport {ERC2771HandlerV3} from \"../common/BaseWithStorage/ERC2771HandlerV3.sol\";\nimport {StakeTokenWrapperV2} from \"./StakeTokenWrapperV2.sol\";\nimport {IContributionRules} from \"./interfaces/IContributionRules.sol\";\nimport {IRewardCalculator} from \"./interfaces/IRewardCalculator.sol\";\nimport {LockRulesV2} from \"./rules-v2/LockRulesV2.sol\";\nimport {RequirementsRulesV2} from \"./rules-v2/RequirementsRulesV2.sol\";\n\n/// @title A pool that distributes rewards between users that stake any erc20 token\n/// @notice The contributions are updated passively, an external call to computeContribution from a backend is needed.\n/// @notice After initialization the reward calculator must be set by the admin.\n/// @dev The contract has two plugins that affect the behaviour: contributionCalculator and rewardCalculator\n/// @dev contributionCalculator instead of using the stake directly the result of computeContribution is used\n/// @dev this way some users can get an extra share of the rewards\n/// @dev rewardCalculator is used to manage the rate at which the rewards are distributed.\n/// @dev This way we can build different types of pools by mixing in the plugins we want with this contract.\n/// @dev default behaviour (address(0)) for contributionCalculator is to use the stacked amount as contribution.\n/// @dev default behaviour (address(0)) for rewardCalculator is that no rewards are given\ncontract ERC20RewardPoolV2 is\n Ownable,\n StakeTokenWrapperV2,\n LockRulesV2,\n RequirementsRulesV2,\n ReentrancyGuard,\n ERC2771HandlerV3,\n Pausable\n{\n using SafeERC20 for IERC20;\n using Address for address;\n\n event RewardTokenSet(address indexed contractAddress);\n event StakeTokenSet(address indexed contractAddress);\n event TrustedForwarderSet(address indexed trustedForwarder);\n event ContributionRulesSet(address indexed contractAddress);\n event RewardCalculatorSet(address indexed contractAddress, bool restartRewards_);\n event FundsRecovered(address indexed receiver, uint256 recoverAmount);\n event Staked(address indexed account, uint256 stakeAmount);\n event Withdrawn(address indexed account, uint256 stakeAmount);\n event Exit(address indexed account);\n event RewardPaid(address indexed account, uint256 rewardAmount);\n event ContributionUpdated(address indexed account, uint256 newContribution, uint256 oldContribution);\n\n uint256 private constant DECIMALS_18 = 1 ether;\n\n // This value multiplied by the user contribution is the share of accumulated rewards (from the start of time\n // until the last call to restartRewards) for the user taking into account the value of totalContributions.\n uint256 public rewardPerTokenStored;\n\n IERC20 public rewardToken;\n IContributionRules public contributionRules;\n IRewardCalculator public rewardCalculator;\n\n // This value multiplied by the user contribution is the share of reward from the the last time\n // the user changed his contribution and called restartRewards\n mapping(address => uint256) public userRewardPerTokenPaid;\n\n // This value is the accumulated rewards won by the user when he called the contract.\n mapping(address => uint256) public rewards;\n\n uint256 internal _totalContributions;\n mapping(address => uint256) internal _contributions;\n\n constructor(\n IERC20 stakeToken_,\n IERC20 rewardToken_,\n address trustedForwarder\n ) StakeTokenWrapperV2(stakeToken_) {\n require(address(rewardToken_).isContract(), \"ERC20RewardPool: is not a contract\");\n rewardToken = rewardToken_;\n __ERC2771HandlerV3_initialize(trustedForwarder);\n }\n\n modifier isValidAddress(address account) {\n require(account != address(0), \"ERC20RewardPool: zero address\");\n\n _;\n }\n\n /// @notice set the reward token\n /// @param contractAddress address token used to pay rewards\n function setRewardToken(address contractAddress)\n external\n isContract(contractAddress)\n isValidAddress(contractAddress)\n onlyOwner\n {\n IERC20 _newRewardToken = IERC20(contractAddress);\n require(\n rewardToken.balanceOf(address(this)) <= _newRewardToken.balanceOf(address(this)),\n \"ERC20RewardPool: insufficient balance\"\n );\n rewardToken = _newRewardToken;\n\n emit RewardTokenSet(contractAddress);\n }\n\n /// @notice set the stake token\n /// @param contractAddress address token used to stake funds\n function setStakeToken(address contractAddress)\n external\n isContract(contractAddress)\n isValidAddress(contractAddress)\n onlyOwner\n {\n IERC20 _newStakeToken = IERC20(contractAddress);\n require(\n _stakeToken.balanceOf(address(this)) <= _newStakeToken.balanceOf(address(this)),\n \"ERC20RewardPool: insufficient balance\"\n );\n _stakeToken = _newStakeToken;\n\n emit StakeTokenSet(contractAddress);\n }\n\n /// @notice set the trusted forwarder\n /// @param trustedForwarder address of the contract that is enabled to send meta-tx on behalf of the user\n function setTrustedForwarder(address trustedForwarder) external isContract(trustedForwarder) onlyOwner {\n _trustedForwarder = trustedForwarder;\n\n emit TrustedForwarderSet(trustedForwarder);\n }\n\n /// @notice set contract that contains all the contribution rules\n function setContributionRules(address contractAddress)\n external\n isContract(contractAddress)\n isValidAddress(contractAddress)\n onlyOwner\n {\n contributionRules = IContributionRules(contractAddress);\n\n emit ContributionRulesSet(contractAddress);\n }\n\n /// @notice set the reward calculator\n /// @param contractAddress address of a plugin that calculates absolute rewards at any point in time\n /// @param restartRewards_ if true the rewards from the previous calculator are accumulated before changing it\n function setRewardCalculator(address contractAddress, bool restartRewards_)\n external\n isContract(contractAddress)\n isValidAddress(contractAddress)\n onlyOwner\n {\n // We process the rewards of the current reward calculator before the switch.\n if (restartRewards_) {\n _restartRewards();\n }\n rewardCalculator = IRewardCalculator(contractAddress);\n\n emit RewardCalculatorSet(contractAddress, restartRewards_);\n }\n\n /// @notice the admin recover is able to recover reward funds\n /// @param receiver address of the beneficiary of the recovered funds\n /// @dev this function must be called in an emergency situation only.\n /// @dev Calling it is risky specially when rewardToken == stakeToken\n function recoverFunds(address receiver) external onlyOwner whenPaused() isValidAddress(receiver) {\n uint256 recoverAmount;\n\n if (rewardToken == _stakeToken) {\n recoverAmount = rewardToken.balanceOf(address(this)) - _totalSupply;\n } else {\n recoverAmount = rewardToken.balanceOf(address(this));\n }\n\n rewardToken.safeTransfer(receiver, recoverAmount);\n\n emit FundsRecovered(receiver, recoverAmount);\n }\n\n /// @notice return the total supply of staked tokens\n /// @return the total supply of staked tokens\n function totalSupply() external view returns (uint256) {\n return _totalSupply;\n }\n\n /// @notice return the balance of staked tokens for a user\n /// @param account the address of the account\n /// @return balance of staked tokens\n function balanceOf(address account) external view returns (uint256) {\n return _balances[account];\n }\n\n /// @notice return the address of the stake token contract\n /// @return address of the stake token contract\n function stakeToken() external view returns (IERC20) {\n return _stakeToken;\n }\n\n /// @notice return the amount of rewards deposited in the contract that can be distributed by different campaigns\n /// @return the total amount of deposited rewards\n /// @dev this function can be called by a reward calculator to throw if a campaign doesn't have\n /// @dev enough rewards to start\n function getRewardsAvailable() public view returns (uint256) {\n if (address(rewardToken) != address(_stakeToken)) {\n return rewardToken.balanceOf(address(this));\n }\n return rewardToken.balanceOf(address(this)) - _totalSupply;\n }\n\n /// @notice return the sum of the values returned by the contribution calculator\n /// @return total contributions of the users\n /// @dev this is the same than the totalSupply only if the contribution calculator\n /// @dev uses the staked amount as the contribution of the user which is the default behaviour\n function totalContributions() external view returns (uint256) {\n return _totalContributions;\n }\n\n /// @notice return the contribution of some user\n /// @param account the address of the account\n /// @return contribution of the users\n /// @dev this is the same than the balanceOf only if the contribution calculator\n /// @dev uses the staked amount as the contribution of the user which is the default behaviour\n function contributionOf(address account) external view returns (uint256) {\n return _contributions[account];\n }\n\n /// @notice accumulated rewards taking into account the totalContribution (see: rewardPerTokenStored)\n /// @return the accumulated total rewards\n /// @dev This value multiplied by the user contribution is the share of accumulated rewards for the user. Taking\n /// @dev into account the value of totalContributions.\n function rewardPerToken() external view returns (uint256) {\n return rewardPerTokenStored + _rewardPerToken();\n }\n\n /// @notice available earnings for some user\n /// @param account the address of the account\n /// @return the available earnings for the user\n function earned(address account) external view returns (uint256) {\n return rewards[account] + _earned(account, _rewardPerToken());\n }\n\n /// @notice accumulates the current rewards into rewardPerTokenStored and restart the reward calculator\n /// @dev calling this function makes no difference. It is useful for testing and when the reward calculator\n /// @dev is changed.\n function restartRewards() external {\n _restartRewards();\n }\n\n /// @notice update the contribution for a user\n /// @param account the address of the account\n /// @dev if the user change his holdings (or any other parameter that affect the contribution calculation),\n /// @dev he can the reward distribution to his favor. This function must be called by an external agent ASAP to\n /// @dev update the contribution for the user. We understand the risk but the rewards are distributed slowly so\n /// @dev the user cannot affect the reward distribution heavily.\n function computeContribution(address account) external isValidAddress(account) {\n // We decide to give the user the accumulated rewards even if he cheated a little bit.\n _processRewards(account);\n _updateContribution(account);\n }\n\n /// @notice update the contribution for a sef of users\n /// @param accounts the addresses of the accounts to update\n /// @dev see: computeContribution\n function computeContributionInBatch(address[] calldata accounts) external {\n _restartRewards();\n for (uint256 i; i < accounts.length; ) {\n address account = accounts[i];\n if (account == address(0)) {\n continue;\n }\n _processAccountRewards(account);\n _updateContribution(account);\n\n unchecked {i++;}\n }\n }\n\n /// @notice stake some amount into the contract\n /// @param amount the amount of tokens to stake\n /// @dev the user must approve in the stake token before calling this function\n function stake(uint256 amount)\n external\n nonReentrant\n whenNotPaused()\n antiDepositCheck(_msgSender())\n checkRequirements(_msgSender(), amount, _balances[_msgSender()])\n {\n require(amount > 0, \"ERC20RewardPool: Cannot stake 0\");\n\n address _sender = _msgSender();\n\n // The first time a user stakes he cannot remove his rewards immediately.\n if (timeLockClaim.lastClaim[_sender] == 0) {\n timeLockClaim.lastClaim[_sender] = block.timestamp;\n }\n\n uint256 earlierRewards;\n\n if (_totalContributions == 0 && rewardCalculator != IRewardCalculator(address(0))) {\n earlierRewards = rewardCalculator.getRewards();\n }\n\n _processRewards(_sender);\n super._stake(amount);\n _updateContribution(_sender);\n require(_contributions[_sender] > 0, \"ERC20RewardPool: not enough contributions\");\n\n if (earlierRewards != 0) {\n rewards[_sender] = rewards[_sender] + earlierRewards;\n }\n emit Staked(_sender, amount);\n }\n\n /// @notice withdraw the stake from the contract\n /// @param amount the amount of tokens to withdraw\n /// @dev the user can withdraw his stake independently from the rewards\n function withdraw(uint256 amount) external nonReentrant whenNotPaused() {\n address _sender = _msgSender();\n\n _processRewards(_sender);\n _withdrawStake(_sender, amount);\n _updateContribution(_sender);\n }\n\n /// @notice withdraw the stake and the rewards from the contract\n function exit() external nonReentrant whenNotPaused() {\n address _sender = _msgSender();\n\n _processRewards(_sender);\n _withdrawStake(_sender, _balances[_sender]);\n _withdrawRewards(_sender);\n _updateContribution(_sender);\n emit Exit(_sender);\n }\n\n /// @notice withdraw the rewards from the contract\n /// @dev the user can withdraw his stake independently from the rewards\n function getReward() external nonReentrant whenNotPaused() {\n address _sender = _msgSender();\n\n _processRewards(_sender);\n _withdrawRewards(_sender);\n _updateContribution(_sender);\n }\n\n /// @notice as admin powers are really important in this contract\n /// we're overriding the renounceOwnership method to avoid losing rights\n function renounceOwnership() public view override onlyOwner {\n revert(\"ERC20RewardPool: can't renounceOwnership\");\n }\n\n function _withdrawStake(address account, uint256 amount) internal antiWithdrawCheck(_msgSender()) {\n require(amount > 0, \"ERC20RewardPool: Cannot withdraw 0\");\n super._withdraw(amount);\n emit Withdrawn(account, amount);\n }\n\n function _withdrawRewards(address account) internal timeLockClaimCheck(account) {\n uint256 reward = rewards[account];\n uint256 mod;\n if (reward > 0) {\n if (amountLockClaim.claimLockEnabled == true) {\n // constrain the reward amount to the integer allowed\n mod = reward % DECIMALS_18;\n reward -= mod;\n require(\n amountLockClaim.amount <= reward,\n \"ERC20RewardPool: Cannot withdraw - lockClaim.amount < reward\"\n );\n }\n require(reward <= getRewardsAvailable(), \"ERC20RewardPool: not enough rewards\");\n rewards[account] = mod;\n rewardToken.safeTransfer(account, reward);\n emit RewardPaid(account, reward);\n }\n }\n\n function _updateContribution(address account) internal {\n uint256 oldContribution = _contributions[account];\n _totalContributions -= oldContribution;\n uint256 contribution = _computeContribution(account);\n _totalContributions += contribution;\n _contributions[account] = contribution;\n emit ContributionUpdated(account, contribution, oldContribution);\n }\n\n function _computeContribution(address account) internal returns (uint256) {\n if (contributionRules == IContributionRules(address(0))) {\n return Math.min(_balances[account], maxStakeAllowedCalculator(account));\n } else {\n return\n contributionRules.computeMultiplier(\n account,\n Math.min(_balances[account], maxStakeAllowedCalculator(account))\n );\n }\n }\n\n // Something changed (stake, withdraw, etc), we distribute current accumulated rewards and start from zero.\n // Called each time there is a change in contract state (stake, withdraw, etc).\n function _processRewards(address account) internal {\n _restartRewards();\n _processAccountRewards(account);\n }\n\n // Update the earnings for this specific user with what he earned until now\n function _processAccountRewards(address account) internal {\n // usually _earned takes _rewardPerToken() but in this method is zero because _restartRewards must be\n // called before _processAccountRewards\n rewards[account] = rewards[account] + _earned(account, 0);\n // restart rewards for this specific user, now earned(account) = 0\n userRewardPerTokenPaid[account] = rewardPerTokenStored;\n }\n\n function _restartRewards() internal {\n if (rewardCalculator != IRewardCalculator(address(0))) {\n // Distribute the accumulated rewards\n rewardPerTokenStored = rewardPerTokenStored + _rewardPerToken();\n // restart rewards so now the rewardCalculator return zero rewards\n rewardCalculator.restartRewards();\n }\n }\n\n function _earned(address account, uint256 rewardPerToken_) internal view returns (uint256) {\n // - userRewardPerTokenPaid[account] * _contributions[account] / _totalContributions is the portion of\n // rewards the last time the user changed his contribution and called _restartRewards\n // (_totalContributions corresponds to previous value of that moment).\n // - rewardPerTokenStored * _contributions[account] is the share of the user from the\n // accumulated rewards (from the start of time until the last call to _restartRewards) with the\n // current value of _totalContributions\n // - _rewardPerToken() * _contributions[account] / _totalContributions is the share of the user of the\n // rewards from the last time anybody called _restartRewards until this moment\n //\n // The important thing to note is that at any moment in time _contributions[account] / _totalContributions is\n // the share of the user even if _totalContributions changes because of other users activity.\n return\n ((rewardPerToken_ + rewardPerTokenStored - userRewardPerTokenPaid[account]) * _contributions[account]) /\n 1e24;\n }\n\n // This function gives the proportion of the total contribution that corresponds to each user from\n // last restartRewards call.\n // _rewardsPerToken() * _contributions[account] is the amount of extra rewards gained from last restartRewards.\n function _rewardPerToken() internal view returns (uint256) {\n if (rewardCalculator == IRewardCalculator(address(0)) || _totalContributions == 0) {\n return 0;\n }\n return (rewardCalculator.getRewards() * 1e24) / _totalContributions;\n }\n\n /// @dev Triggers stopped state.\n /// The contract must not be paused.\n function pause() external onlyOwner {\n _pause();\n }\n\n /// @dev Returns to normal state.\n /// The contract must be paused.\n function unpause() external onlyOwner {\n _unpause();\n }\n\n function _msgSender() internal view override(Context, ERC2771HandlerV3) returns (address) {\n return ERC2771HandlerV3._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC2771HandlerV3) returns (bytes calldata) {\n return ERC2771HandlerV3._msgData();\n }\n}\n" + }, + "src/solc_0.8/defi/interfaces/IContributionCalculator.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\n/// @title Plugins for the SandRewardPool that calculate the contributions must implement this interface\ninterface IContributionCalculator {\n /// @notice based on the user stake and address calculate the contribution\n /// @param account address of the user that is staking tokens\n /// @param amountStaked the amount of tokens stacked\n function computeContribution(address account, uint256 amountStaked) external returns (uint256);\n}\n" + }, + "src/solc_0.8/defi/interfaces/IContributionRules.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\n/// @title Plugins for the ERC20RewardPool that calculates the contributions (multipliers) must implement this interface\ninterface IContributionRules {\n /// @notice based on the user stake and address apply the contribution rules\n /// @param account address of the user that is staking tokens\n /// @param amountStaked the amount of tokens stacked\n function computeMultiplier(address account, uint256 amountStaked) external returns (uint256);\n}\n" + }, + "src/solc_0.8/defi/interfaces/IRewardCalculator.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\n/// @title Plugins for Reward Pools that calculate the rewards must implement this interface\ninterface IRewardCalculator {\n /// @dev At any point in time this function must return the accumulated rewards from the last call to restartRewards\n function getRewards() external view returns (uint256);\n\n /// @dev The main contract has distributed the rewards (getRewards()) until this point, this must start\n /// @dev from scratch => getRewards() == 0\n function restartRewards() external;\n}\n" + }, + "src/solc_0.8/defi/rewardCalculation/PeriodicRewardCalculator.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Math} from \"@openzeppelin/contracts-0.8/utils/math/Math.sol\";\nimport {AccessControl} from \"@openzeppelin/contracts-0.8/access/AccessControl.sol\";\nimport {IRewardCalculator} from \"../interfaces/IRewardCalculator.sol\";\n\n/*\n This contract calculate rewards linearly from the call to notifyRewardAmount until periodFinish\n if restartRewards is called in the middle with a nonzero contribution rewards are\n restarted (the main contract distribute the rewards at that point in time before calling)\n at the end of the period all the accumulated rewards (including those when restartRewards was called) are given.\n*/\ncontract PeriodicRewardCalculator is IRewardCalculator, AccessControl {\n event RewardAdded(uint256 reward);\n\n // This role is in charge of configuring reward distribution\n bytes32 public constant REWARD_DISTRIBUTION = keccak256(\"REWARD_DISTRIBUTION\");\n // Each time a parameter that affects the reward distribution is changed the rewards are distributed by the reward\n // pool contract this is the restart time.\n uint256 public lastUpdateTime;\n // This is the end of the period in which rewards are distributed\n uint256 public periodFinish;\n // Rewards are distributed at a fixed rate => reward = rewardRate * time\n uint256 public rewardRate;\n // The duration of the distribution period\n uint256 public duration;\n // This variable is only used when a new campaign starts (notifyRewardAmount is called)\n // We need to save the rewards accumulated between the last call to restartRewards and the call to notifyRewardAmount\n uint256 public savedRewards;\n // The address of the reward pool, the only one authorized to restart rewards\n address public immutable rewardPool;\n\n constructor(address rewardPool_, uint256 duration_) {\n rewardPool = rewardPool_;\n duration = duration_;\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n }\n\n function setDuration(uint256 newDuration) external {\n require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), \"PeriodicRewardCalculator: not admin\");\n require(block.timestamp >= periodFinish, \"PeriodicRewardCalculator: campaign already started\");\n\n duration = newDuration;\n }\n\n // At any point in time this function must return the accumulated rewards from last call to restartRewards\n function getRewards() external view override returns (uint256) {\n return savedRewards + _getRewards();\n }\n\n // The main contract has distributed the rewards until this point, this must start from scratch => getRewards() == 0\n function restartRewards() external override {\n require(msg.sender == rewardPool, \"PeriodicRewardCalculator: not reward pool\");\n // ensure reward past the first stacker do not get lost\n lastUpdateTime = _lastTimeRewardApplicable();\n savedRewards = 0;\n }\n\n // Useful when switching reward calculators to set an initial reward.\n function setSavedRewards(uint256 reward) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"PeriodicRewardCalculator: not reward distribution\");\n savedRewards = reward;\n lastUpdateTime = block.timestamp;\n }\n\n function lastTimeRewardApplicable() external view returns (uint256) {\n return _lastTimeRewardApplicable();\n }\n\n ///@notice to be called after the amount of reward tokens (specified by the reward parameter) has been sent to the contract\n // Note that the reward should be divisible by the duration to avoid reward token lost\n // When calling this function with remaining>0 then reward + leftover must be divisible by duration (which can be problematic)\n ///@param reward number of token to be distributed over the duration\n function notifyRewardAmount(uint256 reward) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"PeriodicRewardCalculator: not reward distribution\");\n savedRewards = _getRewards();\n lastUpdateTime = block.timestamp;\n if (block.timestamp >= periodFinish) {\n rewardRate = reward / duration;\n } else {\n uint256 remaining = periodFinish - block.timestamp;\n uint256 leftover = remaining * rewardRate;\n rewardRate = (reward + leftover) / duration;\n }\n periodFinish = block.timestamp + duration;\n emit RewardAdded(reward);\n }\n\n function _getRewards() internal view returns (uint256) {\n return (_lastTimeRewardApplicable() - lastUpdateTime) * rewardRate;\n }\n\n function _lastTimeRewardApplicable() internal view returns (uint256) {\n return Math.min(block.timestamp, periodFinish);\n }\n}\n" + }, + "src/solc_0.8/defi/rewardCalculation/TwoPeriodsRewardCalculator.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Math} from \"@openzeppelin/contracts-0.8/utils/math/Math.sol\";\nimport {AccessControl} from \"@openzeppelin/contracts-0.8/access/AccessControl.sol\";\nimport {IRewardCalculator} from \"../interfaces/IRewardCalculator.sol\";\n\ncontract TwoPeriodsRewardCalculator is IRewardCalculator, AccessControl {\n event InitialCampaign(\n uint256 reward,\n uint256 duration,\n uint256 finish1,\n uint256 rate1,\n uint256 finish2,\n uint256 rate2\n );\n event NextCampaign(\n uint256 reward,\n uint256 duration,\n uint256 finish1,\n uint256 rate1,\n uint256 finish2,\n uint256 rate2\n );\n event UpdateCampaign(\n uint256 reward,\n uint256 duration,\n uint256 finish1,\n uint256 rate1,\n uint256 finish2,\n uint256 rate2\n );\n\n // This role is in charge of configuring reward distribution\n bytes32 public constant REWARD_DISTRIBUTION = keccak256(\"REWARD_DISTRIBUTION\");\n // Each time a parameter that affects the reward distribution is changed the rewards are distributed by the reward\n // pool contract this is the restart time.\n uint256 public lastUpdateTime;\n // This variable is only used when a new campaign starts (notifyRewardAmount is called)\n // We need to save the rewards accumulated between the last call to restartRewards and the call to notifyRewardAmount\n uint256 public savedRewards;\n // The reward distribution is divided in two periods with two different rated\n // | | |************|*\n // | | **| |*\n // | | ** | |*\n // | | ** | |*\n // | | ** | |*\n // | | ** | |*\n // | |** | |*\n // | ****| | |*\n // | **** | | |*\n // |**** | | |*\n // zero -> **********| | | |********************\n // |<-perido1-> |<-period2-> |<-restart-> |\n uint256 public finish1;\n uint256 public rate1;\n uint256 public finish2;\n uint256 public rate2;\n\n // The address of the reward pool, the only one authorized to restart rewards\n address public immutable rewardPool;\n\n constructor(address rewardPool_) {\n rewardPool = rewardPool_;\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n }\n\n // For the UI\n function getRate() external view returns (uint256) {\n return rate1;\n }\n\n // For the UI\n function getFinish() external view returns (uint256) {\n return finish1;\n }\n\n // At any point in time this function must return the accumulated rewards from last call to restartRewards\n function getRewards() external view override returns (uint256) {\n return savedRewards + _getRewards();\n }\n\n // The main contract has distributed the rewards until this point, this must start from scratch => getRewards() == 0\n function restartRewards() external override {\n require(msg.sender == rewardPool, \"not reward pool\");\n lastUpdateTime = block.timestamp;\n savedRewards = 0;\n }\n\n // Useful when switching reward calculators to set an initial reward.\n function setSavedRewards(uint256 reward) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n savedRewards = reward;\n lastUpdateTime = block.timestamp;\n }\n\n // This is a helper function, it is better to call setInitialCampaign or updateNextCampaign directly\n function runCampaign(uint256 reward, uint256 duration) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n if (block.timestamp >= finish2) {\n _initialCampaign(reward, duration);\n } else {\n _updateNextCampaign(reward, duration);\n }\n }\n\n // Start an initial campaign, set the period1 of reward distribution, period2 rate is zero\n function setInitialCampaign(uint256 reward, uint256 duration) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n require(block.timestamp >= finish2, \"initial campaign running\");\n _initialCampaign(reward, duration);\n }\n\n // Update the period2 of rate distribution, must be called after an initial campaign is set\n // If period1 is running, period2 is set with the rate reward/duration.\n // If period1 is finished it is updated with the values of period2 and period2 is set with the rate reward/duration.\n function updateNextCampaign(uint256 reward, uint256 duration) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n require(block.timestamp < finish2, \"initial campaign not running\");\n _updateNextCampaign(reward, duration);\n }\n\n function updateCurrentCampaign(uint256 reward, uint256 duration) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n require(block.timestamp < finish2, \"initial campaign not running\");\n _updateCurrentCampaign(reward, duration);\n }\n\n // Check if both periods already ended => campaign is finished\n function isCampaignFinished() external view returns (bool) {\n return (block.timestamp >= finish2);\n }\n\n // Check if some of the periods are still running\n function isCampaignRunning() external view returns (bool) {\n return (block.timestamp < finish2);\n }\n\n function _initialCampaign(uint256 reward, uint256 duration) internal {\n // block.timestamp >= finish2\n _saveRewards();\n finish1 = block.timestamp + duration;\n rate1 = reward / duration;\n finish2 = block.timestamp + duration;\n rate2 = 0;\n emit InitialCampaign(reward, duration, finish1, rate1, finish2, rate2);\n }\n\n function _updateNextCampaign(uint256 reward, uint256 duration) internal {\n // block.timestamp < finish2\n _saveRewards();\n if (block.timestamp >= finish1) {\n // The next campaign is new.\n finish1 = finish2;\n rate1 = rate2;\n }\n finish2 = finish1 + duration;\n rate2 = reward / duration;\n emit NextCampaign(reward, duration, finish1, rate1, finish2, rate2);\n }\n\n // TODO: we need to check the logic for this one, what to do with the remainder rewards and the next campaign duration ?\n // TODO: Right now we restart the current campaign forgetting the old values and leaving next one untouched.\n function _updateCurrentCampaign(uint256 reward, uint256 duration) internal {\n _saveRewards();\n if (block.timestamp >= finish1) {\n // The next campaign is new.\n finish1 = finish2;\n rate1 = rate2;\n rate2 = 0;\n }\n assert(finish1 <= finish2);\n uint256 duration2 = finish2 - finish1;\n finish1 = block.timestamp + duration;\n finish2 = finish1 + duration2;\n rate1 = reward / duration;\n emit UpdateCampaign(reward, duration, finish1, rate1, finish2, rate2);\n }\n\n function _saveRewards() internal {\n savedRewards = savedRewards + _getRewards();\n lastUpdateTime = block.timestamp;\n }\n\n function _getRewards() internal view returns (uint256) {\n assert(lastUpdateTime <= block.timestamp);\n assert(finish1 <= finish2);\n if (lastUpdateTime >= finish2) {\n return 0;\n }\n if (block.timestamp <= finish1) {\n return (block.timestamp - lastUpdateTime) * rate1;\n }\n // block.timestamp > finish1\n uint256 rewards2 = (Math.min(block.timestamp, finish2) - Math.max(lastUpdateTime, finish1)) * rate2;\n if (lastUpdateTime < finish1) {\n // add reward1 + reward2\n return (finish1 - lastUpdateTime) * rate1 + rewards2;\n }\n return rewards2;\n }\n}\n" + }, + "src/solc_0.8/defi/rewardCalculation/TwoPeriodsRewardCalculatorV2.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Math} from \"@openzeppelin/contracts-0.8/utils/math/Math.sol\";\nimport {AccessControl} from \"@openzeppelin/contracts-0.8/access/AccessControl.sol\";\nimport {IRewardCalculator} from \"../interfaces/IRewardCalculator.sol\";\n\n/// @notice This contract has two periods and two corresponding rates and durations. After an initial call\n/// that sets the first period duration and rate another call can be done to set the duration and rate\n/// for the next period. When the first period finishes, the next period becomes the current one, and\n/// then the parameters for the future next period can be set again. This way the rate for the next\n/// period can be set at any moment.\ncontract TwoPeriodsRewardCalculatorV2 is IRewardCalculator, AccessControl {\n event InitialCampaign(\n uint256 reward,\n uint256 duration,\n uint256 finish1,\n uint256 rate1,\n uint256 finish2,\n uint256 rate2\n );\n event NextCampaign(\n uint256 reward,\n uint256 duration,\n uint256 finish1,\n uint256 rate1,\n uint256 finish2,\n uint256 rate2\n );\n event UpdateCampaign(\n uint256 reward,\n uint256 duration,\n uint256 finish1,\n uint256 rate1,\n uint256 finish2,\n uint256 rate2\n );\n\n event SavedRewardsSet(uint256 indexed reward);\n\n // This role is in charge of configuring reward distribution\n bytes32 public constant REWARD_DISTRIBUTION = keccak256(\"REWARD_DISTRIBUTION\");\n // Each time a parameter that affects the reward distribution is changed the rewards are distributed by the reward\n // pool contract this is the restart time.\n uint256 public lastUpdateTime;\n // This variable is only used when a new campaign starts (notifyRewardAmount is called)\n // We need to save the rewards accumulated between the last call to restartRewards and the call to notifyRewardAmount\n uint256 public savedRewards;\n // The reward distribution is divided in two periods with two different rated\n // | | |************|*\n // | | **| |*\n // | | ** | |*\n // | | ** | |*\n // | | ** | |*\n // | | ** | |*\n // | |** | |*\n // | ****| | |*\n // | **** | | |*\n // |**** | | |*\n // zero -> **********| | | |********************\n // |<-period1-> |<-period2-> |<-restart-> |\n uint256 public finish1;\n uint256 public rate1;\n uint256 public finish2;\n uint256 public rate2;\n\n // The address of the reward pool, the only one authorized to restart rewards\n address public immutable rewardPool;\n\n constructor(address rewardPool_) {\n rewardPool = rewardPool_;\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n }\n\n /// @notice For the UI\n function getRate() external view returns (uint256) {\n if (isCampaignFinished()) {\n return 0;\n } else if (block.timestamp >= finish1) {\n return rate2;\n } else {\n return rate1;\n }\n }\n\n /// @notice For the UI\n function getFinish() external view returns (uint256) {\n if (isCampaignFinished()) {\n return 0;\n } else if (block.timestamp >= finish1) {\n return finish2;\n } else {\n return finish1;\n }\n }\n\n /// @notice At any point in time this function must return the accumulated rewards from last call to restartRewards\n function getRewards() external view override returns (uint256) {\n return savedRewards + _getRewards();\n }\n\n /// @notice The main contract has distributed the rewards until this point, this must start from scratch => getRewards() == 0\n function restartRewards() external override {\n require(msg.sender == rewardPool, \"not reward pool\");\n lastUpdateTime = block.timestamp;\n savedRewards = 0;\n }\n\n /// @notice Useful when switching reward calculators to set an initial reward.\n function setSavedRewards(uint256 reward) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n savedRewards = reward;\n lastUpdateTime = block.timestamp;\n\n emit SavedRewardsSet(reward);\n }\n\n /// @notice This is a helper function, it is better to call setInitialCampaign or updateNextCampaign directly\n function runCampaign(uint256 reward, uint256 duration) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n if (block.timestamp >= finish2) {\n _initialCampaign(reward, duration);\n } else {\n _updateNextCampaign(reward, duration);\n }\n }\n\n /// @notice Start an initial campaign, set the period1 of reward distribution, period2 rate is zero\n function setInitialCampaign(uint256 reward, uint256 duration) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n require(block.timestamp >= finish2, \"initial campaign running\");\n _initialCampaign(reward, duration);\n }\n\n /// @notice Update the period2 of rate distribution, must be called after an initial campaign is set\n /// If period1 is running, period2 is set with the rate reward/duration.\n /// If period1 is finished it is updated with the values of period2 and period2 is set with the rate reward/duration.\n function updateNextCampaign(uint256 reward, uint256 duration) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n require(block.timestamp < finish2, \"initial campaign not running\");\n _updateNextCampaign(reward, duration);\n }\n\n /// @notice Update the period1 (current campaign) of rate distribution, must be called after an initial campaign is set\n function updateCurrentCampaign(uint256 reward, uint256 duration) external {\n require(hasRole(REWARD_DISTRIBUTION, _msgSender()), \"not reward distribution\");\n require(block.timestamp < finish2, \"initial campaign not running\");\n _updateCurrentCampaign(reward, duration);\n }\n\n // Check if both periods already ended => campaign is finished\n function isCampaignFinished() public view returns (bool) {\n return (block.timestamp >= finish2);\n }\n\n /// @notice Check if some of the periods are still running\n function isCampaignRunning() external view returns (bool) {\n return (block.timestamp < finish2);\n }\n\n function _initialCampaign(uint256 reward, uint256 duration) internal {\n // block.timestamp >= finish2\n _saveRewards();\n finish1 = block.timestamp + duration;\n rate1 = reward / duration;\n finish2 = block.timestamp + duration;\n rate2 = 0;\n emit InitialCampaign(reward, duration, finish1, rate1, finish2, rate2);\n }\n\n function _updateNextCampaign(uint256 reward, uint256 duration) internal {\n // block.timestamp < finish2\n _saveRewards();\n if (block.timestamp >= finish1) {\n // The next campaign is new.\n finish1 = finish2;\n rate1 = rate2;\n }\n finish2 = finish1 + duration;\n rate2 = reward / duration;\n emit NextCampaign(reward, duration, finish1, rate1, finish2, rate2);\n }\n\n // TODO: we need to check the logic for this one, what to do with the remainder rewards and the next campaign duration ?\n // TODO: Right now we restart the current campaign forgetting the old values and leaving next one untouched.\n function _updateCurrentCampaign(uint256 reward, uint256 duration) internal {\n _saveRewards();\n if (block.timestamp >= finish1) {\n // The next campaign is new.\n finish1 = finish2;\n rate1 = rate2;\n rate2 = 0;\n }\n assert(finish1 <= finish2);\n uint256 duration2 = finish2 - finish1;\n finish1 = block.timestamp + duration;\n finish2 = finish1 + duration2;\n rate1 = reward / duration;\n emit UpdateCampaign(reward, duration, finish1, rate1, finish2, rate2);\n }\n\n function _saveRewards() internal {\n savedRewards = savedRewards + _getRewards();\n lastUpdateTime = block.timestamp;\n }\n\n function _getRewards() internal view returns (uint256) {\n assert(lastUpdateTime <= block.timestamp);\n assert(finish1 <= finish2);\n if (lastUpdateTime >= finish2) {\n return 0;\n }\n if (block.timestamp <= finish1) {\n return (block.timestamp - lastUpdateTime) * rate1;\n }\n // block.timestamp > finish1\n uint256 rewards2 = (Math.min(block.timestamp, finish2) - Math.max(lastUpdateTime, finish1)) * rate2;\n if (lastUpdateTime < finish1) {\n // add reward1 + reward2\n return (finish1 - lastUpdateTime) * rate1 + rewards2;\n }\n return rewards2;\n }\n}\n" + }, + "src/solc_0.8/defi/rules-v2/ContributionRulesV2.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {SafeMathWithRequire} from \"../../common/Libraries/SafeMathWithRequire.sol\";\nimport {IERC721} from \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\nimport {IERC1155} from \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\nimport {IContributionRules} from \"../interfaces/IContributionRules.sol\";\n\n/// @notice The contribution rules is a plugin contract that takes the amount staked and the address of\n/// the user and returns the absolute share (contribution) that the user will get from the total rewards.\n/// The contribution rules must implement the IContributionRules interface. This interface has only one method:\n/// computeMultiplier which takes the account and amountStaked parameters and returns the contribution for this user.\ncontract ContributionRulesV2 is Ownable, IContributionRules {\n using Address for address;\n\n // LIMITS\n // we limited the number of Ids and contracts that we can have in the lists\n // to avoid the risk of DoS caused by gas limits being exceeded during the iterations\n uint256 public constant IDS_LIMIT = 64;\n uint256 public constant CONTRACTS_LIMIT = 4;\n uint256 public constant MAX_MULTIPLIER = 1000;\n uint256 public multiplierLimitERC721 = 1000;\n uint256 public multiplierLimitERC1155 = 1000;\n\n uint256 internal constant DECIMALS_7 = 10_000_000;\n uint256 internal constant MIDPOINT_9 = 500_000_000;\n uint256 internal constant NFT_FACTOR_6 = 10000;\n uint256 internal constant NFT_CONSTANT_3 = 9000;\n uint256 internal constant ROOT3_FACTOR = 697;\n\n struct MultiplierRule {\n uint256[] ids;\n uint256[] multipliers;\n bool balanceOf;\n uint256 index;\n }\n\n mapping(IERC721 => MultiplierRule) internal _listERC721;\n mapping(IERC1155 => MultiplierRule) internal _listERC1155;\n IERC721[] internal _listERC721Index;\n IERC1155[] internal _listERC1155Index;\n\n event ERC1155MultiplierListSet(address indexed contractERC1155, uint256[] multipliers, uint256[] ids);\n event ERC721MultiplierListSet(address indexed contractERC721, uint256[] multipliers, uint256[] ids, bool balanceOf);\n event ERC1155MultiplierListDeleted(address indexed contractERC1155);\n event ERC721MultiplierListDeleted(address indexed contractERC721);\n event ERC721MultiplierLimitSet(uint256 newERC721MultiplierLimit);\n event ERC1155MultiplierLimitSet(uint256 newERC1155MultiplierLimit);\n\n modifier isContract(address account) {\n require(account.isContract(), \"ContributionRules: is not contract\");\n\n _;\n }\n\n modifier isERC721MemberList(address contractERC721) {\n require(\n isERC721MemberMultiplierList(IERC721(contractERC721)),\n \"ContributionRules: contract is not in the list\"\n );\n _;\n }\n\n modifier isERC1155MemberList(address contractERC1155) {\n require(\n isERC1155MemberMultiplierList(IERC1155(contractERC1155)),\n \"ContributionRules: contract is not in the list\"\n );\n _;\n }\n\n /// @notice compute user multiplier based on the amount staked\n /// @param account account to compute the multiplier\n /// @param amountStaked amount stake for the given account\n /// @return amountStaked\n function computeMultiplier(address account, uint256 amountStaked) external view override returns (uint256) {\n uint256 multiplierERC721 = multiplierBalanceOfERC721(account);\n uint256 multiplierERC1155 = multiplierBalanceOfERC1155(account);\n\n // check if the calculated multipliers exceed the limit\n if (multiplierLimitERC721 < multiplierERC721) {\n multiplierERC721 = multiplierLimitERC721;\n }\n\n if (multiplierLimitERC1155 < multiplierERC1155) {\n multiplierERC1155 = multiplierLimitERC1155;\n }\n\n return amountStaked + ((amountStaked * (multiplierERC721 + multiplierERC1155)) / 100);\n }\n\n /// @notice set a Multiplier limit a user can reach by having ERC721 tokens\n /// @param _newLimit new limit value - should be less then the max limit allowed by the system.\n function setERC721MultiplierLimit(uint256 _newLimit) external onlyOwner {\n require(_newLimit <= MAX_MULTIPLIER, \"ContributionRules: invalid newLimit\");\n\n multiplierLimitERC721 = _newLimit;\n\n emit ERC721MultiplierLimitSet(_newLimit);\n }\n\n /// @notice set a Multiplier limit a user can reach by having ERC1155 tokens\n /// @param _newLimit new limit value - should be less then the max limit allowed by the system.\n function setERC1155MultiplierLimit(uint256 _newLimit) external onlyOwner {\n require(_newLimit <= MAX_MULTIPLIER, \"ContributionRules: invalid newLimit\");\n\n multiplierLimitERC1155 = _newLimit;\n\n emit ERC1155MultiplierLimitSet(_newLimit);\n }\n\n /// @notice set the ERC1155 Multiplier list\n /// @param contractERC1155 ERC1155 contract address to add to the list\n /// @param ids ID user should hold to earn the multiplier\n /// @param multipliers multiplier applied if the user has the respective id\n function setERC1155MultiplierList(\n address contractERC1155,\n uint256[] memory ids,\n uint256[] memory multipliers\n ) external onlyOwner isContract(contractERC1155) {\n require(ids.length > 0, \"ContributionRules: ids <= 0\");\n require(ids.length <= IDS_LIMIT, \"ContributionRules: invalid array of ids\");\n require(multipliers.length > 0, \"ContributionRules: invalid array of multipliers\");\n require(multipliers.length == ids.length, \"ContributionRules: multipliers array != ids array\");\n\n IERC1155 multContract = IERC1155(contractERC1155);\n\n // if it's a new member create a new registry, instead, only update\n if (isERC1155MemberMultiplierList(multContract) == false) {\n // Limiting the size of the array (iterations) to avoid the risk of DoS.\n require(CONTRACTS_LIMIT > _listERC1155Index.length, \"ContributionRules: CONTRACTS_LIMIT exceeded\");\n _listERC1155Index.push(multContract);\n _listERC1155[multContract].index = _listERC1155Index.length - 1;\n }\n\n _listERC1155[multContract].ids = ids;\n _listERC1155[multContract].multipliers = multipliers;\n _listERC1155[multContract].balanceOf = false;\n\n emit ERC1155MultiplierListSet(contractERC1155, multipliers, ids);\n }\n\n /// @notice set the ERC721 Multiplier list\n /// @param contractERC721 ERC721 contract address to add to the list\n /// @param ids ID user should hold to earn the multiplier\n /// @param multipliers multiplier applied if the user has the respective id\n /// @param balanceOf if true, will use balanceOf instead of ID - id.length should be = 0\n function setERC721MultiplierList(\n address contractERC721,\n uint256[] memory ids,\n uint256[] memory multipliers,\n bool balanceOf\n ) external onlyOwner isContract(contractERC721) {\n if (balanceOf == false) {\n require(ids.length > 0, \"ContributionRules: invalid ids array\");\n require(multipliers.length == ids.length, \"ContributionRules: ids array != multipliers array\");\n }\n require(ids.length <= IDS_LIMIT, \"ContributionRules: invalid array of ids\");\n\n IERC721 multContract = IERC721(contractERC721);\n\n // if it's a new member create a new registry, instead, only update\n if (isERC721MemberMultiplierList(multContract) == false) {\n // Limiting the size of the array (iterations) to avoid the risk of DoS.\n require(CONTRACTS_LIMIT > _listERC721Index.length, \"ContributionRules: CONTRACTS_LIMIT exceeded\");\n _listERC721Index.push(multContract);\n _listERC721[multContract].index = _listERC721Index.length - 1;\n }\n\n _listERC721[multContract].multipliers = multipliers;\n _listERC721[multContract].balanceOf = balanceOf;\n _listERC721[multContract].ids = ids;\n\n emit ERC721MultiplierListSet(contractERC721, multipliers, ids, balanceOf);\n }\n\n /// @notice Return the max multiplier for the given account\n /// @param account account address to retrieve the max multiplier\n function getMaxGlobalMultiplier(address account) external view returns (uint256) {\n return multiplierBalanceOfERC721(account) + multiplierBalanceOfERC1155(account);\n }\n\n /// @notice return the ERC721 multiplier list for the given contract\n /// @param reqContract ERC721 contract address to retrieve\n function getERC721MultiplierList(address reqContract)\n external\n view\n isContract(reqContract)\n isERC721MemberList(reqContract)\n returns (MultiplierRule memory)\n {\n return _listERC721[IERC721(reqContract)];\n }\n\n /// @notice return the ERC1155 multiplier list for the given contract\n /// @param reqContract ERC1155 contract address to retrieve\n function getERC1155MultiplierList(address reqContract)\n external\n view\n isContract(reqContract)\n isERC1155MemberList(reqContract)\n returns (MultiplierRule memory)\n {\n return _listERC1155[IERC1155(reqContract)];\n }\n\n /// @notice remove the given contract from the list\n /// @param contractERC721 contract address to be removed from the list\n function deleteERC721MultiplierList(address contractERC721)\n external\n isContract(contractERC721)\n isERC721MemberList(contractERC721)\n onlyOwner\n {\n IERC721 reqContract = IERC721(contractERC721);\n uint256 indexToDelete = _listERC721[reqContract].index;\n IERC721 addrToMove = _listERC721Index[_listERC721Index.length - 1];\n _listERC721Index[indexToDelete] = addrToMove;\n _listERC721[addrToMove].index = indexToDelete;\n _listERC721Index.pop();\n\n emit ERC721MultiplierListDeleted(address(reqContract));\n }\n\n /// @notice remove the given contract from the list\n /// @param contractERC1155 contract address to be removed from the list\n function deleteERC1155MultiplierList(address contractERC1155)\n external\n isContract(contractERC1155)\n isERC1155MemberList(contractERC1155)\n onlyOwner\n {\n IERC1155 reqContract = IERC1155(contractERC1155);\n uint256 indexToDelete = _listERC1155[reqContract].index;\n IERC1155 addrToMove = _listERC1155Index[_listERC1155Index.length - 1];\n _listERC1155Index[indexToDelete] = addrToMove;\n _listERC1155[addrToMove].index = indexToDelete;\n _listERC1155Index.pop();\n\n emit ERC1155MultiplierListDeleted(address(reqContract));\n }\n\n /// @notice check if the given contract is in the list\n /// @param reqContract contract address to check\n /// @return true if the contract is in the list\n function isERC721MemberMultiplierList(IERC721 reqContract) public view returns (bool) {\n return !(_listERC721Index.length == 0) && (_listERC721Index[_listERC721[reqContract].index] == reqContract);\n }\n\n /// @notice check if the given contract is in the list\n /// @param reqContract contract address to check\n /// @return true if the contract is in the list\n function isERC1155MemberMultiplierList(IERC1155 reqContract) public view returns (bool) {\n return !(_listERC1155Index.length == 0) && (_listERC1155Index[_listERC1155[reqContract].index] == reqContract);\n }\n\n /// @notice calculate and return the ERC721 multiplier for a given user\n /// @param account user address to calculate the multiplier\n function multiplierBalanceOfERC721(address account) public view returns (uint256) {\n uint256 _multiplier;\n uint256 _indexLength = _listERC721Index.length;\n\n for (uint256 i; i < _indexLength; ) {\n IERC721 reqContract = _listERC721Index[i];\n\n if (_listERC721[reqContract].balanceOf == true) {\n _multiplier = _multiplier + multiplierLogarithm(account, reqContract);\n } else {\n uint256 _listIdsLength = _listERC721[reqContract].ids.length;\n for (uint256 j; j < _listIdsLength; ) {\n address owner = reqContract.ownerOf(_listERC721[reqContract].ids[j]);\n if (owner == account) {\n _multiplier = _multiplier + _listERC721[reqContract].multipliers[j];\n }\n\n unchecked {j++;}\n }\n }\n\n unchecked {i++;}\n }\n\n return _multiplier;\n }\n\n /// @notice calculate and return the ERC1155 multiplier for a given user\n /// @param account user address to calculate the multiplier\n function multiplierBalanceOfERC1155(address account) public view returns (uint256) {\n uint256 _multiplier;\n uint256 _indexLength = _listERC1155Index.length;\n\n for (uint256 i; i < _indexLength; ) {\n IERC1155 reqContract = _listERC1155Index[i];\n uint256 _listIdsLength = _listERC1155[reqContract].ids.length;\n\n for (uint256 j; j < _listIdsLength; ) {\n uint256 _bal = reqContract.balanceOf(account, _listERC1155[reqContract].ids[j]);\n\n if (_bal > 0) {\n _multiplier = _multiplier + _listERC1155[reqContract].multipliers[j];\n }\n\n unchecked {j++;}\n }\n\n unchecked {i++;}\n }\n\n return _multiplier;\n }\n\n /// @notice calculate and return the multiplier for a given user,\n /// based on the amount of the specific ERC721 he owns\n /// @param account user address to calculate the multiplier\n /// @param contractERC721 contract address to check\n /// @return ERC721 _multiplier based on the balance\n function multiplierLogarithm(address account, IERC721 contractERC721) public view returns (uint256) {\n uint256 balERC721 = contractERC721.balanceOf(account);\n\n if (balERC721 == 0) {\n return 0;\n }\n\n uint256 _multiplierERC721 =\n NFT_FACTOR_6 * (NFT_CONSTANT_3 + SafeMathWithRequire.cbrt3((((balERC721 - 1) * ROOT3_FACTOR) + 1)));\n if (_multiplierERC721 > MIDPOINT_9) {\n _multiplierERC721 = MIDPOINT_9 + (_multiplierERC721 - MIDPOINT_9) / 10;\n }\n\n return _multiplierERC721 / DECIMALS_7;\n }\n\n /// @notice as admin powers are really important in this contract\n /// we're overriding the renounceOwnership method to avoid losing rights\n function renounceOwnership() public view override onlyOwner {\n revert(\"ContributionRules: can't renounceOwnership\");\n }\n}\n" + }, + "src/solc_0.8/defi/rules-v2/LockRulesV2.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Context} from \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\n\n// Note: this contract is meant to be inherited by ERC20RewardPool.\n// we should override the renounceOwnership() method otherwise.\n\n/// @notice The base contract (ERC20RewardPool) also inherits from this one. In this contract,\n/// we handle all the rules related to: Deposit, withdrawal, and claim. Basically, we have time locks for each action,\n/// where we can force the user to wait for a specific amount of time (lockPeriodInSecs) to re-do any of these actions.\n/// For the claim action, we also have the amountLockClaim(amount, bool). With this requirement,\n/// we can set a minimum amount to claim and also constrain the claim to an integer.\ncontract LockRulesV2 is Context, Ownable {\n // limits\n uint256 public constant TIME_LOCK_LIMIT = 180 days;\n uint256 public constant AMOUNT_LOCK_LIMIT = 1000 ether;\n\n struct TimeLockClaim {\n uint256 lockPeriodInSecs;\n mapping(address => uint256) lastClaim;\n }\n\n struct AmountLockClaim {\n uint256 amount;\n bool claimLockEnabled;\n }\n\n struct TimeLockWithdraw {\n uint256 lockPeriodInSecs;\n mapping(address => uint256) lastWithdraw;\n }\n\n struct TimeLockDeposit {\n uint256 lockPeriodInSecs;\n mapping(address => uint256) lastDeposit;\n }\n\n event TimelockClaimSet(uint256 lockPeriodInSecs);\n event TimelockDepositSet(uint256 newTimeDeposit);\n event TimeLockWithdrawSet(uint256 newTimeWithdraw);\n event AmountLockClaimSet(uint256 newAmountLockClaim, bool isEnabled);\n\n // This is used to implement a time buffer for reward retrieval, so the user cannot re-stake the rewards too fast.\n TimeLockClaim public timeLockClaim;\n AmountLockClaim public amountLockClaim;\n TimeLockWithdraw public lockWithdraw;\n TimeLockDeposit public lockDeposit;\n\n modifier timeLockClaimCheck(address account) {\n // We use lockPeriodInSecs == 0 to disable this check\n if (timeLockClaim.lockPeriodInSecs != 0) {\n require(\n block.timestamp > timeLockClaim.lastClaim[account] + timeLockClaim.lockPeriodInSecs,\n \"LockRules: Claim must wait\"\n );\n }\n timeLockClaim.lastClaim[account] = block.timestamp;\n _;\n }\n\n modifier antiWithdrawCheck(address account) {\n // We use lockPeriodInSecs == 0 to disable this check\n if (lockWithdraw.lockPeriodInSecs != 0) {\n require(\n block.timestamp > lockWithdraw.lastWithdraw[account] + lockWithdraw.lockPeriodInSecs,\n \"LockRules: Withdraw must wait\"\n );\n }\n lockWithdraw.lastWithdraw[account] = block.timestamp;\n _;\n }\n\n modifier antiDepositCheck(address account) {\n // We use lockPeriodInSecs == 0 to disable this check\n if (lockDeposit.lockPeriodInSecs != 0) {\n require(\n block.timestamp > lockDeposit.lastDeposit[account] + lockDeposit.lockPeriodInSecs,\n \"LockRules: Deposit must wait\"\n );\n }\n lockDeposit.lastDeposit[account] = block.timestamp;\n _;\n }\n\n /// @notice set the _lockPeriodInSecs for the anti-compound buffer\n /// @param _lockPeriodInSecs amount of time the user must wait between reward withdrawal\n function setTimelockClaim(uint256 _lockPeriodInSecs) external onlyOwner {\n require(_lockPeriodInSecs <= TIME_LOCK_LIMIT, \"LockRules: invalid lockPeriodInSecs\");\n timeLockClaim.lockPeriodInSecs = _lockPeriodInSecs;\n\n emit TimelockClaimSet(_lockPeriodInSecs);\n }\n\n /// @notice set a new time lock for the deposit\n /// user will only be able to stake again, after that time.\n /// @param _newTimeDeposit amount of time the user must wait between deposits/stake\n function setTimelockDeposit(uint256 _newTimeDeposit) external onlyOwner {\n require(_newTimeDeposit <= TIME_LOCK_LIMIT, \"LockRules: invalid lockPeriodInSecs\");\n lockDeposit.lockPeriodInSecs = _newTimeDeposit;\n\n emit TimelockDepositSet(_newTimeDeposit);\n }\n\n /// @notice set a new time lock for the withdrawn/unstake\n /// user will only be able to withdrawn/unstake again, after that time.\n /// @param _newTimeWithdraw amount of time the user must wait between withdrawn/unstake\n function setTimeLockWithdraw(uint256 _newTimeWithdraw) external onlyOwner {\n require(_newTimeWithdraw <= TIME_LOCK_LIMIT, \"LockRules: invalid lockPeriodInSecs\");\n lockWithdraw.lockPeriodInSecs = _newTimeWithdraw;\n\n emit TimeLockWithdrawSet(_newTimeWithdraw);\n }\n\n /// @notice set a new oamount lock for the claim\n /// user will only be able to claim rewards if the value is higher then the lock.\n /// @param _newAmountLockClaim min amount user should have to claim the rewards\n /// @param _isEnabled if true, the lock is enabled\n function setAmountLockClaim(uint256 _newAmountLockClaim, bool _isEnabled) external onlyOwner {\n require(_newAmountLockClaim <= AMOUNT_LOCK_LIMIT, \"LockRules: invalid newAmountLockClaim\");\n amountLockClaim.amount = _newAmountLockClaim;\n amountLockClaim.claimLockEnabled = _isEnabled;\n\n emit AmountLockClaimSet(_newAmountLockClaim, _isEnabled);\n }\n\n /// @notice return the remaining time for the user to be able to claim again\n function getRemainingTimelockClaim() external view returns (uint256) {\n uint256 timeLock = (timeLockClaim.lastClaim[_msgSender()] + timeLockClaim.lockPeriodInSecs);\n\n if (timeLock > block.timestamp) {\n return timeLock - block.timestamp;\n } else {\n return 0;\n }\n }\n\n /// @notice return the remaining time for the user to be able to withdrawn/unstake again\n function getRemainingTimelockWithdraw() external view returns (uint256) {\n uint256 timeLock = (lockWithdraw.lastWithdraw[_msgSender()] + lockWithdraw.lockPeriodInSecs);\n\n if (timeLock > block.timestamp) {\n return timeLock - block.timestamp;\n } else {\n return 0;\n }\n }\n\n /// @notice return the remaining time for the user to be able to deposit/stake again\n function getRemainingTimelockDeposit() external view returns (uint256) {\n uint256 timeLock = (lockDeposit.lastDeposit[_msgSender()] + lockDeposit.lockPeriodInSecs);\n\n if (timeLock > block.timestamp) {\n return timeLock - block.timestamp;\n } else {\n return 0;\n }\n }\n}\n" + }, + "src/solc_0.8/defi/rules-v2/RequirementsRulesV2.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {Math} from \"@openzeppelin/contracts-0.8/utils/math/Math.sol\";\nimport {IERC721} from \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\nimport {IERC1155} from \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\n\n/// @notice The base contract (ERC20RewardPool) inherits from this one. This contract contains\n/// and checks all the requirements that a user needs to meet in order to stake.\n/// These requirements are checked through the modifier checkRequirements at the moment of the stake\ncontract RequirementsRulesV2 is Ownable {\n using Address for address;\n\n // we limited the number of Ids and contracts that we can have in the lists\n // to avoid the risk of DoS caused by gas limits being exceeded during the iterations\n uint256 public constant IDS_LIMIT = 64;\n uint256 public constant CONTRACTS_LIMIT = 4;\n\n // maxStake amount allowed if user has no ERC721 or ERC1155\n uint256 public maxStakeOverall;\n\n struct ERC721RequirementRule {\n uint256[] ids;\n bool balanceOf;\n uint256 minAmountBalanceOf;\n uint256 maxAmountBalanceOf;\n uint256 minAmountId;\n uint256 maxAmountId;\n uint256 index;\n }\n\n struct ERC1155RequirementRule {\n uint256[] ids;\n uint256 minAmountId;\n uint256 maxAmountId;\n uint256 index;\n }\n\n mapping(IERC721 => ERC721RequirementRule) internal _listERC721;\n mapping(IERC1155 => ERC1155RequirementRule) internal _listERC1155;\n IERC721[] internal _listERC721Index;\n IERC1155[] internal _listERC1155Index;\n\n event ERC1155RequirementListSet(\n address indexed contractERC1155,\n uint256[] ids,\n uint256 minAmountId,\n uint256 maxAmountId\n );\n event ERC721RequirementListSet(\n address indexed contractERC721,\n uint256[] ids,\n bool balanceOf,\n uint256 minAmountBalanceOf,\n uint256 maxAmountBalanceOf,\n uint256 minAmountId,\n uint256 maxAmountId\n );\n event MaxStakeOverallSet(uint256 newMaxStake, uint256 oldMaxStake);\n event ERC11551RequirementListDeleted(address indexed contractERC1155);\n event ERC721RequirementListDeleted(address indexed contractERC721);\n\n modifier isContract(address account) {\n require(account.isContract(), \"RequirementsRules: is not a contract\");\n\n _;\n }\n\n modifier checkRequirements(\n address account,\n uint256 amount,\n uint256 balanceOf\n ) {\n uint256 maxStakeERC721 = checkAndGetERC721Stake(account);\n uint256 maxStakeERC1155 = checkAndGetERC1155Stake(account);\n uint256 maxAllowed = _maxStakeAllowedCalculator(maxStakeERC721, maxStakeERC1155);\n\n if ((maxAllowed > 0) || _listERC721Index.length > 0 || _listERC1155Index.length > 0) {\n require(amount + balanceOf <= maxAllowed, \"RequirementsRules: maxAllowed\");\n }\n\n _;\n }\n\n modifier isERC721MemberList(address contractERC721) {\n require(\n isERC721MemberRequirementList(IERC721(contractERC721)),\n \"RequirementsRules: contract is not in the list\"\n );\n _;\n }\n\n modifier isERC1155MemberList(address contractERC1155) {\n require(\n isERC1155MemberRequirementList(IERC1155(contractERC1155)),\n \"RequirementsRules: contract is not in the list\"\n );\n _;\n }\n\n /// @notice set a Max stake in case user has not ERC721 or ERC1155\n /// @param newMaxStake new max stake value\n /// @dev we should always try setting this value to less than the lowest amount\n /// @dev possible from meeting a requirement rule.\n /// @dev That way we don't benefit those who do not have assets\n function setMaxStakeOverall(uint256 newMaxStake) external onlyOwner {\n uint256 oldMaxStake = maxStakeOverall;\n maxStakeOverall = newMaxStake;\n\n emit MaxStakeOverallSet(newMaxStake, oldMaxStake);\n }\n\n /// @notice set the ERC71 requirements for the user to stake\n /// @param contractERC721 ERC721 contract address to add to the list\n /// @param ids ID user should hold\n /// @param balanceOf if true, use the balanceOf values instead of Ids\n /// @param minAmountBalanceOf min amount user should hold to be able to stake\n /// @param maxAmountBalanceOf max value user can stake for each ERC721 he owns.\n /// @param minAmountId min amount user needs to own of a specific ID to be able to stake\n /// @param maxAmountId max value user can stake for each asset(ID) he owns\n function setERC721RequirementList(\n address contractERC721,\n uint256[] memory ids,\n bool balanceOf,\n uint256 minAmountBalanceOf,\n uint256 maxAmountBalanceOf,\n uint256 minAmountId,\n uint256 maxAmountId\n ) external onlyOwner isContract(contractERC721) {\n if (balanceOf == true) {\n require(ids.length == 0, \"RequirementRules: invalid ids array\");\n require(minAmountBalanceOf > 0, \"RequirementRules: invalid minAmountBalanceOf\");\n require(maxAmountBalanceOf > 0, \"RequirementRules: invalid maxAmountBalanceOf\");\n } else {\n require(ids.length > 0, \"RequirementRules: invalid ids array\");\n require(minAmountId > 0, \"RequirementRules: invalid minAmountId\");\n require(maxAmountId > 0, \"RequirementRules: invalid maxAmountId\");\n require(ids.length <= IDS_LIMIT, \"RequirementRules: ids array > limit\");\n }\n\n IERC721 newContract = IERC721(contractERC721);\n\n if (ids.length != 0) {\n _listERC721[newContract].ids = ids;\n }\n _listERC721[newContract].minAmountBalanceOf = minAmountBalanceOf;\n _listERC721[newContract].maxAmountBalanceOf = maxAmountBalanceOf;\n _listERC721[newContract].minAmountId = minAmountId;\n _listERC721[newContract].maxAmountId = maxAmountId;\n _listERC721[newContract].balanceOf = balanceOf;\n\n // if it's a new member create a new registry, instead, only update\n if (isERC721MemberRequirementList(newContract) == false) {\n // Limiting the size of the array (interations) to avoid the risk of DoS.\n require(CONTRACTS_LIMIT > _listERC721Index.length, \"RequirementsRules: CONTRACTS_LIMIT exceeded\");\n _listERC721Index.push(newContract);\n _listERC721[newContract].index = _listERC721Index.length - 1;\n }\n\n emit ERC721RequirementListSet(\n contractERC721,\n ids,\n balanceOf,\n minAmountBalanceOf,\n maxAmountBalanceOf,\n minAmountId,\n maxAmountId\n );\n }\n\n /// @notice set the ERC1155 requirements for the user to stake\n /// @param contractERC1155 ERC1155 contract address to add to the list\n /// @param ids ID user should hold\n /// @param minAmountId min amount user needs to own of a specific ID to be able to stake\n /// @param maxAmountId max value user can stake for each asset(ID) he owns\n function setERC1155RequirementList(\n address contractERC1155,\n uint256[] memory ids,\n uint256 minAmountId,\n uint256 maxAmountId\n ) external onlyOwner isContract(contractERC1155) {\n require(ids.length > 0, \"RequirementRules: invalid ids\");\n require(minAmountId > 0, \"RequirementRules: invalid minAmountId\");\n require(maxAmountId > 0, \"RequirementRules: invalid\");\n require(ids.length <= IDS_LIMIT, \"RequirementRules: IDS_LIMIT\");\n IERC1155 newContract = IERC1155(contractERC1155);\n _listERC1155[newContract].ids = ids;\n _listERC1155[newContract].minAmountId = minAmountId;\n _listERC1155[newContract].maxAmountId = maxAmountId;\n\n // if it's a new member create a new registry, instead, only update\n if (isERC1155MemberRequirementList(newContract) == false) {\n // Limiting the size of the array (interations) to avoid the risk of DoS.\n require(CONTRACTS_LIMIT > _listERC1155Index.length, \"RequirementsRules: CONTRACTS_LIMIT exceeded\");\n _listERC1155Index.push(newContract);\n _listERC1155[newContract].index = _listERC1155Index.length - 1;\n }\n\n emit ERC1155RequirementListSet(contractERC1155, ids, minAmountId, maxAmountId);\n }\n\n /// @notice return the ERC721 list of the given contract\n /// @param contractERC721 contract address to retrieve the list\n function getERC721RequirementList(address contractERC721)\n external\n view\n isContract(contractERC721)\n isERC721MemberList(contractERC721)\n returns (ERC721RequirementRule memory)\n {\n return _listERC721[IERC721(contractERC721)];\n }\n\n /// @notice return the ERC1155 list of the given contract\n /// @param contractERC1155 contract address to retrieve the list\n function getERC1155RequirementList(address contractERC1155)\n external\n view\n isContract(contractERC1155)\n isERC1155MemberList(contractERC1155)\n returns (ERC1155RequirementRule memory)\n {\n return _listERC1155[IERC1155(contractERC1155)];\n }\n\n /// @notice remove the given contract from the list\n /// @param contractERC721 contract address to be removed from the list\n function deleteERC721RequirementList(address contractERC721)\n external\n onlyOwner\n isContract(contractERC721)\n isERC721MemberList(contractERC721)\n {\n IERC721 reqContract = IERC721(contractERC721);\n uint256 indexToDelete = _listERC721[reqContract].index;\n IERC721 addrToMove = _listERC721Index[_listERC721Index.length - 1];\n _listERC721Index[indexToDelete] = addrToMove;\n _listERC721[addrToMove].index = indexToDelete;\n _listERC721Index.pop();\n\n emit ERC721RequirementListDeleted(contractERC721);\n }\n\n /// @notice remove the given contract from the list\n /// @param contractERC1155 contract address to be removed from the list\n function deleteERC1155RequirementList(address contractERC1155)\n external\n onlyOwner\n isContract(contractERC1155)\n isERC1155MemberList(contractERC1155)\n {\n IERC1155 reqContract = IERC1155(contractERC1155);\n uint256 indexToDelete = _listERC1155[reqContract].index;\n IERC1155 addrToMove = _listERC1155Index[_listERC1155Index.length - 1];\n _listERC1155Index[indexToDelete] = addrToMove;\n _listERC1155[addrToMove].index = indexToDelete;\n _listERC1155Index.pop();\n\n emit ERC11551RequirementListDeleted(contractERC1155);\n }\n\n /// @notice check if the given contract is in the list\n /// @param reqContract contract address to check\n /// @return true if the contract is in the list\n function isERC721MemberRequirementList(IERC721 reqContract) public view returns (bool) {\n return (_listERC721Index.length != 0) && (_listERC721Index[_listERC721[reqContract].index] == reqContract);\n }\n\n /// @notice check if the given contract is in the list\n /// @param reqContract contract address to check\n /// @return true if the contract is in the list\n function isERC1155MemberRequirementList(IERC1155 reqContract) public view returns (bool) {\n return (_listERC1155Index.length != 0) && (_listERC1155Index[_listERC1155[reqContract].index] == reqContract);\n }\n\n /// @notice return the max amount the user can stake for holding ERC721 assets\n /// @param account user address to calculate the max stake amount\n function getERC721MaxStake(address account) public view returns (uint256) {\n uint256 _maxStake;\n uint256 _indexLength = _listERC721Index.length;\n\n for (uint256 i; i < _indexLength; ) {\n uint256 balanceOf;\n uint256 balanceOfId;\n IERC721 reqContract = _listERC721Index[i];\n\n if (_listERC721[reqContract].balanceOf == true) {\n balanceOf = reqContract.balanceOf(account);\n } else {\n balanceOfId = getERC721BalanceId(reqContract, account);\n }\n\n _maxStake =\n _maxStake +\n (balanceOf *\n _listERC721[reqContract].maxAmountBalanceOf +\n balanceOfId *\n _listERC721[reqContract].maxAmountId);\n\n unchecked {i++;}\n }\n\n return _maxStake;\n }\n\n /// @notice return the max amount the user can stake for holding ERC1155 assets\n /// @param account user address to calculate the max stake amount\n function getERC1155MaxStake(address account) public view returns (uint256) {\n uint256 _maxStake;\n uint256 _indexLength = _listERC1155Index.length;\n\n for (uint256 i; i < _indexLength; ) {\n uint256 _totalBal;\n IERC1155 reqContract = _listERC1155Index[i];\n\n uint256 bal = getERC1155BalanceId(reqContract, account);\n\n _totalBal = _totalBal + bal;\n\n _maxStake = _maxStake + (_totalBal * _listERC1155[reqContract].maxAmountId);\n\n unchecked {i++;}\n }\n\n return _maxStake;\n }\n\n /// @notice return the max amount the user can stake\n /// @param account user address to calculate the max stake amount\n function maxStakeAllowedCalculator(address account) public view returns (uint256) {\n uint256 maxStakeERC721 = getERC721MaxStake(account);\n uint256 maxStakeERC1155 = getERC1155MaxStake(account);\n return _maxStakeAllowedCalculator(maxStakeERC721, maxStakeERC1155);\n }\n\n /// @notice return the balance of a specific ID the given user owns\n /// @param account user address to check the balance\n function getERC721BalanceId(IERC721 reqContract, address account) public view returns (uint256) {\n uint256 balanceOfId;\n uint256 _listIdsLength = _listERC721[reqContract].ids.length;\n\n for (uint256 j; j < _listIdsLength; ) {\n address owner = reqContract.ownerOf(_listERC721[reqContract].ids[j]);\n if (owner == account) {\n ++balanceOfId;\n }\n\n unchecked {j++;}\n }\n\n return balanceOfId;\n }\n\n /// @notice return the balance of a specific ID the given user owns\n /// @param account user address to check the balance\n function getERC1155BalanceId(IERC1155 reqContract, address account) public view returns (uint256) {\n uint256 balanceOfId;\n uint256 _listIdsLength = _listERC1155[reqContract].ids.length;\n\n for (uint256 j; j < _listIdsLength; ) {\n uint256 bal = reqContract.balanceOf(account, _listERC1155[reqContract].ids[j]);\n\n balanceOfId = balanceOfId + bal;\n\n unchecked {j++;}\n }\n\n return balanceOfId;\n }\n\n /// @notice check and calculates the ERC1155 max stake for the given user\n /// @param account user address to check\n function checkAndGetERC1155Stake(address account) public view returns (uint256) {\n uint256 _maxStake;\n uint256 _indexLength = _listERC1155Index.length;\n\n for (uint256 i; i < _indexLength; ) {\n IERC1155 reqContract = _listERC1155Index[i];\n\n uint256 balanceId = getERC1155BalanceId(reqContract, account);\n if (_listERC1155[reqContract].ids.length > 0) {\n require(balanceId >= _listERC1155[reqContract].minAmountId, \"RequirementsRules: balanceId\");\n }\n _maxStake = _maxStake + (balanceId * _listERC1155[reqContract].maxAmountId);\n\n unchecked {i++;}\n }\n return _maxStake;\n }\n\n /// @notice check and calculates the ERC721 max stake for the given user\n /// @param account user address to check\n function checkAndGetERC721Stake(address account) public view returns (uint256) {\n uint256 _maxStake;\n uint256 _indexLength = _listERC721Index.length;\n\n for (uint256 i; i < _indexLength; ) {\n uint256 balanceOf;\n uint256 balanceOfId;\n IERC721 reqContract = _listERC721Index[i];\n\n if (_listERC721[reqContract].balanceOf == true) {\n require(\n (reqContract.balanceOf(account) >= _listERC721[reqContract].minAmountBalanceOf) ||\n (maxStakeOverall > 0),\n \"RequirementsRules: balanceOf\"\n );\n balanceOf = reqContract.balanceOf(account);\n } else {\n balanceOfId = getERC721BalanceId(reqContract, account);\n if (_listERC721[reqContract].ids.length > 0) {\n require(\n (balanceOfId >= _listERC721[reqContract].minAmountId) || (maxStakeOverall > 0),\n \"RequirementsRules: balanceId\"\n );\n }\n }\n\n _maxStake =\n _maxStake +\n (balanceOf *\n _listERC721[reqContract].maxAmountBalanceOf +\n balanceOfId *\n _listERC721[reqContract].maxAmountId);\n\n unchecked {i++;}\n }\n return _maxStake;\n }\n\n /// @notice calculates the maxStake allowed\n /// @param maxStakeERC721 max stake ERC721 previously calculated for the user\n /// @param maxStakeERC1155 max stake ERC1155 previously calculated for the user\n /// @return max amount allowed for the user to stake\n function _maxStakeAllowedCalculator(uint256 maxStakeERC721, uint256 maxStakeERC1155)\n internal\n view\n returns (uint256)\n {\n uint256 maxAllowed = maxStakeOverall;\n\n uint256 totalMaxStake = maxStakeERC721 + maxStakeERC1155;\n\n if (totalMaxStake > 0) {\n if (maxAllowed > 0) {\n maxAllowed = Math.min(maxAllowed, totalMaxStake);\n } else {\n maxAllowed = totalMaxStake;\n }\n }\n\n return maxAllowed;\n }\n}\n" + }, + "src/solc_0.8/defi/rules/ContributionRules.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {SafeMathWithRequire} from \"../../common/Libraries/SafeMathWithRequire.sol\";\nimport {IERC721} from \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\nimport {IERC1155} from \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\nimport {IContributionRules} from \"../interfaces/IContributionRules.sol\";\n\ncontract ContributionRules is Ownable, IContributionRules {\n using Address for address;\n\n // LIMITS\n // we limited the number of Ids and contracts that we can have in the lists\n // to avoid the risk of DoS caused by gas limits being exceeded during the iterations\n uint256 public constant idsLimit = 64;\n uint256 public constant contractsLimit = 4;\n uint256 public constant maxMultiplier = 1000;\n uint256 public multiplierLimitERC721 = 1000;\n uint256 public multiplierLimitERC1155 = 1000;\n\n uint256 internal constant DECIMALS_7 = 10_000_000;\n uint256 internal constant MIDPOINT_9 = 500_000_000;\n uint256 internal constant NFT_FACTOR_6 = 10000;\n uint256 internal constant NFT_CONSTANT_3 = 9000;\n uint256 internal constant ROOT3_FACTOR = 697;\n\n struct MultiplierRule {\n uint256[] ids;\n uint256[] multipliers;\n bool balanceOf;\n uint256 index;\n }\n\n mapping(IERC721 => MultiplierRule) internal _listERC721;\n mapping(IERC1155 => MultiplierRule) internal _listERC1155;\n IERC721[] internal _listERC721Index;\n IERC1155[] internal _listERC1155Index;\n\n event ERC1155MultiplierListSet(address indexed contractERC1155, uint256[] multipliers, uint256[] ids);\n event ERC721MultiplierListSet(address indexed contractERC721, uint256[] multipliers, uint256[] ids, bool balanceOf);\n event ERC1155MultiplierListDeleted(address indexed contractERC1155);\n event ERC721MultiplierListDeleted(address indexed contractERC721);\n event ERC721MultiplierLimitSet(uint256 newERC721MultiplierLimit);\n event ERC1155MultiplierLimitSet(uint256 newERC1155MultiplierLimit);\n\n modifier isContract(address account) {\n require(account.isContract(), \"ContributionRules: is not contract\");\n\n _;\n }\n\n modifier isERC721MemberList(address contractERC721) {\n require(\n isERC721MemberMultiplierList(IERC721(contractERC721)),\n \"ContributionRules: contract is not in the list\"\n );\n _;\n }\n\n modifier isERC1155MemberList(address contractERC1155) {\n require(\n isERC1155MemberMultiplierList(IERC1155(contractERC1155)),\n \"ContributionRules: contract is not in the list\"\n );\n _;\n }\n\n function computeMultiplier(address account, uint256 amountStaked) external view override returns (uint256) {\n uint256 multiplierERC721 = multiplierBalanceOfERC721(account);\n uint256 multiplierERC1155 = multiplierBalanceOfERC1155(account);\n\n // check if the calculated multipliers exceeds the limit\n if (multiplierLimitERC721 < multiplierERC721) {\n multiplierERC721 = multiplierLimitERC721;\n }\n\n if (multiplierLimitERC1155 < multiplierERC1155) {\n multiplierERC1155 = multiplierLimitERC1155;\n }\n\n return amountStaked + ((amountStaked * (multiplierERC721 + multiplierERC1155)) / 100);\n }\n\n function setERC721MultiplierLimit(uint256 _newLimit) external onlyOwner {\n require(_newLimit <= maxMultiplier, \"ContributionRules: invalid newLimit\");\n\n multiplierLimitERC721 = _newLimit;\n\n emit ERC721MultiplierLimitSet(_newLimit);\n }\n\n function setERC1155MultiplierLimit(uint256 _newLimit) external onlyOwner {\n require(_newLimit <= maxMultiplier, \"ContributionRules: invalid newLimit\");\n\n multiplierLimitERC1155 = _newLimit;\n\n emit ERC1155MultiplierLimitSet(_newLimit);\n }\n\n function setERC1155MultiplierList(\n address contractERC1155,\n uint256[] memory ids,\n uint256[] memory multipliers\n ) external onlyOwner isContract(contractERC1155) {\n require(ids.length > 0 && ids.length <= idsLimit, \"ContributionRules: invalid array of ids\");\n require(multipliers.length > 0, \"ContributionRules: invalid array of multipliers\");\n\n IERC1155 multContract = IERC1155(contractERC1155);\n\n // if it's a new member create a new registry, instead, only update\n if (isERC1155MemberMultiplierList(multContract) == false) {\n // Limiting the size of the array (interations) to avoid the risk of DoS.\n require(contractsLimit > _listERC1155Index.length, \"ContributionRules: contractsLimit exceeded\");\n _listERC1155Index.push(multContract);\n _listERC1155[multContract].index = _listERC1155Index.length - 1;\n }\n\n _listERC1155[multContract].ids = ids;\n _listERC1155[multContract].multipliers = multipliers;\n _listERC1155[multContract].balanceOf = false;\n\n emit ERC1155MultiplierListSet(contractERC1155, multipliers, ids);\n }\n\n function setERC721MultiplierList(\n address contractERC721,\n uint256[] memory ids,\n uint256[] memory multipliers,\n bool balanceOf\n ) external onlyOwner isContract(contractERC721) {\n require(\n balanceOf == true || (ids.length > 0 && multipliers.length == ids.length),\n \"ContributionRules: invalid list\"\n );\n require(ids.length <= idsLimit, \"ContributionRules: invalid array of ids\");\n\n IERC721 multContract = IERC721(contractERC721);\n\n // if it's a new member create a new registry, instead, only update\n if (isERC721MemberMultiplierList(multContract) == false) {\n // Limiting the size of the array (interations) to avoid the risk of DoS.\n require(contractsLimit > _listERC721Index.length, \"ContributionRules: contractsLimit exceeded\");\n _listERC721Index.push(multContract);\n _listERC721[multContract].index = _listERC721Index.length - 1;\n }\n\n _listERC721[multContract].multipliers = multipliers;\n _listERC721[multContract].balanceOf = balanceOf;\n _listERC721[multContract].ids = ids;\n\n emit ERC721MultiplierListSet(contractERC721, multipliers, ids, balanceOf);\n }\n\n function getMaxGlobalMultiplier(address account) external view returns (uint256) {\n return multiplierBalanceOfERC721(account) + multiplierBalanceOfERC1155(account);\n }\n\n function getERC721MultiplierList(address reqContract)\n external\n view\n isContract(reqContract)\n isERC721MemberList(reqContract)\n returns (MultiplierRule memory)\n {\n return _listERC721[IERC721(reqContract)];\n }\n\n function getERC1155MultiplierList(address reqContract)\n external\n view\n isContract(reqContract)\n isERC1155MemberList(reqContract)\n returns (MultiplierRule memory)\n {\n return _listERC1155[IERC1155(reqContract)];\n }\n\n function deleteERC721MultiplierList(address contractERC721)\n external\n isContract(contractERC721)\n isERC721MemberList(contractERC721)\n onlyOwner\n {\n IERC721 reqContract = IERC721(contractERC721);\n uint256 indexToDelete = _listERC721[reqContract].index;\n IERC721 addrToMove = _listERC721Index[_listERC721Index.length - 1];\n _listERC721Index[indexToDelete] = addrToMove;\n _listERC721[addrToMove].index = indexToDelete;\n _listERC721Index.pop();\n\n emit ERC721MultiplierListDeleted(address(reqContract));\n }\n\n function deleteERC1155MultiplierList(address contractERC1155)\n external\n isContract(contractERC1155)\n isERC1155MemberList(contractERC1155)\n onlyOwner\n {\n IERC1155 reqContract = IERC1155(contractERC1155);\n uint256 indexToDelete = _listERC1155[reqContract].index;\n IERC1155 addrToMove = _listERC1155Index[_listERC1155Index.length - 1];\n _listERC1155Index[indexToDelete] = addrToMove;\n _listERC1155[addrToMove].index = indexToDelete;\n _listERC1155Index.pop();\n\n emit ERC1155MultiplierListDeleted(address(reqContract));\n }\n\n function isERC721MemberMultiplierList(IERC721 reqContract) public view returns (bool) {\n return !(_listERC721Index.length == 0) && (_listERC721Index[_listERC721[reqContract].index] == reqContract);\n }\n\n function isERC1155MemberMultiplierList(IERC1155 reqContract) public view returns (bool) {\n return !(_listERC1155Index.length == 0) && (_listERC1155Index[_listERC1155[reqContract].index] == reqContract);\n }\n\n function multiplierBalanceOfERC721(address account) public view returns (uint256) {\n uint256 _multiplier = 0;\n\n for (uint256 i = 0; i < _listERC721Index.length; i++) {\n IERC721 reqContract = _listERC721Index[i];\n\n if (_listERC721[reqContract].balanceOf == true) {\n _multiplier = _multiplier + multiplierLogarithm(account, reqContract);\n } else {\n for (uint256 j = 0; j < _listERC721[reqContract].ids.length; j++) {\n address owner = reqContract.ownerOf(_listERC721[reqContract].ids[j]);\n if (owner == account) {\n _multiplier = _multiplier + _listERC721[reqContract].multipliers[j];\n }\n }\n }\n }\n\n return _multiplier;\n }\n\n function multiplierBalanceOfERC1155(address account) public view returns (uint256) {\n uint256 _multiplier = 0;\n for (uint256 i = 0; i < _listERC1155Index.length; i++) {\n IERC1155 reqContract = _listERC1155Index[i];\n\n for (uint256 j = 0; j < _listERC1155[reqContract].ids.length; j++) {\n uint256 _bal = reqContract.balanceOf(account, _listERC1155[reqContract].ids[j]);\n\n if (_bal > 0) {\n _multiplier = _multiplier + _listERC1155[reqContract].multipliers[j];\n }\n }\n }\n\n return _multiplier;\n }\n\n function multiplierLogarithm(address account, IERC721 contractERC721) public view returns (uint256) {\n uint256 balERC721 = contractERC721.balanceOf(account);\n\n if (balERC721 == 0) {\n return 0;\n }\n\n uint256 _multiplierERC721 =\n NFT_FACTOR_6 * (NFT_CONSTANT_3 + SafeMathWithRequire.cbrt3((((balERC721 - 1) * ROOT3_FACTOR) + 1)));\n if (_multiplierERC721 > MIDPOINT_9) {\n _multiplierERC721 = MIDPOINT_9 + (_multiplierERC721 - MIDPOINT_9) / 10;\n }\n\n return _multiplierERC721 / DECIMALS_7;\n }\n\n function renounceOwnership() public view override onlyOwner {\n revert(\"ContributionRules: can't renounceOwnership\");\n }\n}\n" + }, + "src/solc_0.8/defi/rules/LockRules.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Context} from \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\n\n// Note: this contract is meant to be inherited by ERC20RewardPool.\n// we should override the renounceOwnership() method otherwise.\ncontract LockRules is Context, Ownable {\n // limits\n uint256 public constant timeLockLimit = 180 days;\n uint256 public constant amountLockLimit = 1000 ether;\n\n struct TimeLockClaim {\n uint256 lockPeriodInSecs;\n mapping(address => uint256) lastClaim;\n }\n\n struct AmountLockClaim {\n uint256 amount;\n bool claimLockEnabled;\n }\n\n struct TimeLockWithdraw {\n uint256 lockPeriodInSecs;\n mapping(address => uint256) lastWithdraw;\n }\n\n struct TimeLockDeposit {\n uint256 lockPeriodInSecs;\n mapping(address => uint256) lastDeposit;\n }\n\n event TimelockClaimSet(uint256 lockPeriodInSecs);\n event TimelockDepositSet(uint256 newTimeDeposit);\n event TimeLockWithdrawSet(uint256 newTimeWithdraw);\n event AmountLockClaimSet(uint256 newAmountLockClaim, bool isEnabled);\n\n // This is used to implement a time buffer for reward retrieval, so the user cannot re-stake the rewards too fast.\n TimeLockClaim public timeLockClaim;\n AmountLockClaim public amountLockClaim;\n TimeLockWithdraw public lockWithdraw;\n TimeLockDeposit public lockDeposit;\n\n modifier timeLockClaimCheck(address account) {\n // We use lockPeriodInSecs == 0 to disable this check\n if (timeLockClaim.lockPeriodInSecs != 0) {\n require(\n block.timestamp > timeLockClaim.lastClaim[account] + timeLockClaim.lockPeriodInSecs,\n \"LockRules: Claim must wait\"\n );\n }\n timeLockClaim.lastClaim[account] = block.timestamp;\n _;\n }\n\n modifier antiWithdrawCheck(address account) {\n // We use lockPeriodInSecs == 0 to disable this check\n if (lockWithdraw.lockPeriodInSecs != 0) {\n require(\n block.timestamp > lockWithdraw.lastWithdraw[account] + lockWithdraw.lockPeriodInSecs,\n \"LockRules: Withdraw must wait\"\n );\n }\n lockWithdraw.lastWithdraw[account] = block.timestamp;\n _;\n }\n\n modifier antiDepositCheck(address account) {\n // We use lockPeriodInSecs == 0 to disable this check\n if (lockDeposit.lockPeriodInSecs != 0) {\n require(\n block.timestamp > lockDeposit.lastDeposit[account] + lockDeposit.lockPeriodInSecs,\n \"LockRules: Deposit must wait\"\n );\n }\n lockDeposit.lastDeposit[account] = block.timestamp;\n _;\n }\n\n /// @notice set the _lockPeriodInSecs for the anti-compound buffer\n /// @param _lockPeriodInSecs amount of time the user must wait between reward withdrawal\n function setTimelockClaim(uint256 _lockPeriodInSecs) external onlyOwner {\n require(_lockPeriodInSecs <= timeLockLimit, \"LockRules: invalid lockPeriodInSecs\");\n timeLockClaim.lockPeriodInSecs = _lockPeriodInSecs;\n\n emit TimelockClaimSet(_lockPeriodInSecs);\n }\n\n function setTimelockDeposit(uint256 _newTimeDeposit) external onlyOwner {\n require(_newTimeDeposit <= timeLockLimit, \"LockRules: invalid lockPeriodInSecs\");\n lockDeposit.lockPeriodInSecs = _newTimeDeposit;\n\n emit TimelockDepositSet(_newTimeDeposit);\n }\n\n function setTimeLockWithdraw(uint256 _newTimeWithdraw) external onlyOwner {\n require(_newTimeWithdraw <= timeLockLimit, \"LockRules: invalid lockPeriodInSecs\");\n lockWithdraw.lockPeriodInSecs = _newTimeWithdraw;\n\n emit TimeLockWithdrawSet(_newTimeWithdraw);\n }\n\n function setAmountLockClaim(uint256 _newAmountLockClaim, bool _isEnabled) external onlyOwner {\n require(_newAmountLockClaim <= amountLockLimit, \"LockRules: invalid newAmountLockClaim\");\n amountLockClaim.amount = _newAmountLockClaim;\n amountLockClaim.claimLockEnabled = _isEnabled;\n\n emit AmountLockClaimSet(_newAmountLockClaim, _isEnabled);\n }\n\n function getRemainingTimelockClaim() external view returns (uint256) {\n uint256 timeLock = (timeLockClaim.lastClaim[_msgSender()] + timeLockClaim.lockPeriodInSecs);\n\n if (timeLock > block.timestamp) {\n return timeLock - block.timestamp;\n } else {\n return 0;\n }\n }\n\n function getRemainingTimelockWithdraw() external view returns (uint256) {\n uint256 timeLock = (lockWithdraw.lastWithdraw[_msgSender()] + lockWithdraw.lockPeriodInSecs);\n\n if (timeLock > block.timestamp) {\n return timeLock - block.timestamp;\n } else {\n return 0;\n }\n }\n\n function getRemainingTimelockDeposit() external view returns (uint256) {\n uint256 timeLock = (lockDeposit.lastDeposit[_msgSender()] + lockDeposit.lockPeriodInSecs);\n\n if (timeLock > block.timestamp) {\n return timeLock - block.timestamp;\n } else {\n return 0;\n }\n }\n}\n" + }, + "src/solc_0.8/defi/rules/RequirementsRules.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {Math} from \"@openzeppelin/contracts-0.8/utils/math/Math.sol\";\nimport {IERC721} from \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\nimport {IERC1155} from \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\n\ncontract RequirementsRules is Ownable {\n using Address for address;\n\n // we limited the number of Ids and contracts that we can have in the lists\n // to avoid the risk of DoS caused by gas limits being exceeded during the iterations\n uint256 public idsLimit = 64;\n uint256 public contractsLimit = 4;\n\n // maxStake amount allowed if user has no ERC721 or ERC1155\n uint256 public maxStakeOverall;\n\n struct ERC721RequirementRule {\n uint256[] ids;\n bool balanceOf;\n uint256 minAmountBalanceOf;\n uint256 maxAmountBalanceOf;\n uint256 minAmountId;\n uint256 maxAmountId;\n uint256 index;\n }\n\n struct ERC1155RequirementRule {\n uint256[] ids;\n uint256 minAmountId;\n uint256 maxAmountId;\n uint256 index;\n }\n\n mapping(IERC721 => ERC721RequirementRule) internal _listERC721;\n mapping(IERC1155 => ERC1155RequirementRule) internal _listERC1155;\n IERC721[] internal _listERC721Index;\n IERC1155[] internal _listERC1155Index;\n\n event ERC1155RequirementListSet(\n address indexed contractERC1155,\n uint256[] ids,\n uint256 minAmountId,\n uint256 maxAmountId\n );\n event ERC721RequirementListSet(\n address indexed contractERC721,\n uint256[] ids,\n bool balanceOf,\n uint256 minAmountBalanceOf,\n uint256 maxAmountBalanceOf,\n uint256 minAmountId,\n uint256 maxAmountId\n );\n event MaxStakeOverallSet(uint256 newMaxStake, uint256 oldMaxStake);\n event ERC11551RequirementListDeleted(address indexed contractERC1155);\n event ERC721RequirementListDeleted(address indexed contractERC721);\n\n modifier isContract(address account) {\n require(account.isContract(), \"RequirementsRules: is not contract\");\n\n _;\n }\n\n modifier checkRequirements(\n address account,\n uint256 amount,\n uint256 balanceOf\n ) {\n uint256 maxStakeERC721 = checkAndGetERC721Stake(account);\n uint256 maxStakeERC1155 = checkAndGetERC1155Stake(account);\n uint256 maxAllowed = _maxStakeAllowedCalculator(maxStakeERC721, maxStakeERC1155);\n\n if ((maxAllowed > 0) || _listERC721Index.length > 0 || _listERC1155Index.length > 0) {\n require(amount + balanceOf <= maxAllowed, \"RequirementsRules: maxAllowed\");\n }\n\n _;\n }\n\n modifier isERC721MemberList(address contractERC721) {\n require(\n isERC721MemberRequirementList(IERC721(contractERC721)),\n \"RequirementsRules: contract is not in the list\"\n );\n _;\n }\n\n modifier isERC1155MemberList(address contractERC1155) {\n require(\n isERC1155MemberRequirementList(IERC1155(contractERC1155)),\n \"RequirementsRules: contract is not in the list\"\n );\n _;\n }\n\n // if user has not erc721 or erc1155\n function setMaxStakeOverall(uint256 newMaxStake) external onlyOwner {\n uint256 oldMaxStake = maxStakeOverall;\n maxStakeOverall = newMaxStake;\n\n emit MaxStakeOverallSet(newMaxStake, oldMaxStake);\n }\n\n function setERC721RequirementList(\n address contractERC721,\n uint256[] memory ids,\n bool balanceOf,\n uint256 minAmountBalanceOf,\n uint256 maxAmountBalanceOf,\n uint256 minAmountId,\n uint256 maxAmountId\n ) external onlyOwner isContract(contractERC721) {\n require(\n (balanceOf == true && ids.length == 0 && minAmountBalanceOf > 0 && maxAmountBalanceOf > 0) ||\n (balanceOf == false && ids.length > 0 && minAmountId > 0 && maxAmountId > 0 && ids.length <= idsLimit),\n \"RequirementRules: invalid list\"\n );\n IERC721 newContract = IERC721(contractERC721);\n\n if (ids.length != 0) {\n _listERC721[newContract].ids = ids;\n }\n _listERC721[newContract].minAmountBalanceOf = minAmountBalanceOf;\n _listERC721[newContract].maxAmountBalanceOf = maxAmountBalanceOf;\n _listERC721[newContract].minAmountId = minAmountId;\n _listERC721[newContract].maxAmountId = maxAmountId;\n _listERC721[newContract].balanceOf = balanceOf;\n\n // if it's a new member create a new registry, instead, only update\n if (isERC721MemberRequirementList(newContract) == false) {\n // Limiting the size of the array (interations) to avoid the risk of DoS.\n require(contractsLimit > _listERC721Index.length, \"RequirementsRules: contractsLimit exceeded\");\n _listERC721Index.push(newContract);\n _listERC721[newContract].index = _listERC721Index.length - 1;\n }\n\n emit ERC721RequirementListSet(\n contractERC721,\n ids,\n balanceOf,\n minAmountBalanceOf,\n maxAmountBalanceOf,\n minAmountId,\n maxAmountId\n );\n }\n\n function setERC1155RequirementList(\n address contractERC1155,\n uint256[] memory ids,\n uint256 minAmountId,\n uint256 maxAmountId\n ) external onlyOwner isContract(contractERC1155) {\n require(\n ids.length > 0 && minAmountId > 0 && maxAmountId > 0 && ids.length <= idsLimit,\n \"RequirementRules: invalid list\"\n );\n IERC1155 newContract = IERC1155(contractERC1155);\n _listERC1155[newContract].ids = ids;\n _listERC1155[newContract].minAmountId = minAmountId;\n _listERC1155[newContract].maxAmountId = maxAmountId;\n\n // if it's a new member create a new registry, instead, only update\n if (isERC1155MemberRequirementList(newContract) == false) {\n // Limiting the size of the array (interations) to avoid the risk of DoS.\n require(contractsLimit > _listERC1155Index.length, \"RequirementsRules: contractsLimit exceeded\");\n _listERC1155Index.push(newContract);\n _listERC1155[newContract].index = _listERC1155Index.length - 1;\n }\n\n emit ERC1155RequirementListSet(contractERC1155, ids, minAmountId, maxAmountId);\n }\n\n function getERC721RequirementList(address contractERC721)\n external\n view\n isContract(contractERC721)\n isERC721MemberList(contractERC721)\n returns (ERC721RequirementRule memory)\n {\n return _listERC721[IERC721(contractERC721)];\n }\n\n function getERC1155RequirementList(address contractERC1155)\n external\n view\n isContract(contractERC1155)\n isERC1155MemberList(contractERC1155)\n returns (ERC1155RequirementRule memory)\n {\n return _listERC1155[IERC1155(contractERC1155)];\n }\n\n function deleteERC721RequirementList(address contractERC721)\n external\n onlyOwner\n isContract(contractERC721)\n isERC721MemberList(contractERC721)\n {\n IERC721 reqContract = IERC721(contractERC721);\n uint256 indexToDelete = _listERC721[reqContract].index;\n IERC721 addrToMove = _listERC721Index[_listERC721Index.length - 1];\n _listERC721Index[indexToDelete] = addrToMove;\n _listERC721[addrToMove].index = indexToDelete;\n _listERC721Index.pop();\n\n emit ERC721RequirementListDeleted(contractERC721);\n }\n\n function deleteERC1155RequirementList(address contractERC1155)\n external\n onlyOwner\n isContract(contractERC1155)\n isERC1155MemberList(contractERC1155)\n {\n IERC1155 reqContract = IERC1155(contractERC1155);\n uint256 indexToDelete = _listERC1155[reqContract].index;\n IERC1155 addrToMove = _listERC1155Index[_listERC1155Index.length - 1];\n _listERC1155Index[indexToDelete] = addrToMove;\n _listERC1155[addrToMove].index = indexToDelete;\n _listERC1155Index.pop();\n\n emit ERC11551RequirementListDeleted(contractERC1155);\n }\n\n function isERC721MemberRequirementList(IERC721 reqContract) public view returns (bool) {\n return (_listERC721Index.length != 0) && (_listERC721Index[_listERC721[reqContract].index] == reqContract);\n }\n\n function isERC1155MemberRequirementList(IERC1155 reqContract) public view returns (bool) {\n return (_listERC1155Index.length != 0) && (_listERC1155Index[_listERC1155[reqContract].index] == reqContract);\n }\n\n function getERC721MaxStake(address account) public view returns (uint256) {\n uint256 _maxStake = 0;\n for (uint256 i = 0; i < _listERC721Index.length; i++) {\n uint256 balanceOf = 0;\n uint256 balanceOfId = 0;\n IERC721 reqContract = _listERC721Index[i];\n\n if (_listERC721[reqContract].balanceOf == true) {\n balanceOf = reqContract.balanceOf(account);\n } else {\n balanceOfId = getERC721BalanceId(reqContract, account);\n }\n\n _maxStake =\n _maxStake +\n (balanceOf *\n _listERC721[reqContract].maxAmountBalanceOf +\n balanceOfId *\n _listERC721[reqContract].maxAmountId);\n }\n\n return _maxStake;\n }\n\n function getERC1155MaxStake(address account) public view returns (uint256) {\n uint256 _maxStake = 0;\n\n for (uint256 i = 0; i < _listERC1155Index.length; i++) {\n uint256 _totalBal = 0;\n IERC1155 reqContract = _listERC1155Index[i];\n\n uint256 bal = getERC1155BalanceId(reqContract, account);\n\n _totalBal = _totalBal + bal;\n\n _maxStake = _maxStake + (_totalBal * _listERC1155[reqContract].maxAmountId);\n }\n\n return _maxStake;\n }\n\n function maxStakeAllowedCalculator(address account) public view returns (uint256) {\n uint256 maxStakeERC721 = getERC721MaxStake(account);\n uint256 maxStakeERC1155 = getERC1155MaxStake(account);\n return _maxStakeAllowedCalculator(maxStakeERC721, maxStakeERC1155);\n }\n\n function getERC721BalanceId(IERC721 reqContract, address account) public view returns (uint256) {\n uint256 balanceOfId = 0;\n\n for (uint256 j = 0; j < _listERC721[reqContract].ids.length; j++) {\n address owner = reqContract.ownerOf(_listERC721[reqContract].ids[j]);\n if (owner == account) {\n ++balanceOfId;\n }\n }\n\n return balanceOfId;\n }\n\n function getERC1155BalanceId(IERC1155 reqContract, address account) public view returns (uint256) {\n uint256 balanceOfId = 0;\n\n for (uint256 j = 0; j < _listERC1155[reqContract].ids.length; j++) {\n uint256 bal = reqContract.balanceOf(account, _listERC1155[reqContract].ids[j]);\n\n balanceOfId = balanceOfId + bal;\n }\n\n return balanceOfId;\n }\n\n function checkAndGetERC1155Stake(address account) public view returns (uint256) {\n uint256 _maxStake = 0;\n for (uint256 i = 0; i < _listERC1155Index.length; i++) {\n uint256 _totalBal = 0;\n IERC1155 reqContract = _listERC1155Index[i];\n\n uint256 balanceId = getERC1155BalanceId(reqContract, account);\n if (_listERC1155[reqContract].ids.length > 0) {\n require(balanceId >= _listERC1155[reqContract].minAmountId, \"RequirementsRules: balanceId\");\n }\n\n _totalBal = _totalBal + balanceId;\n _maxStake = _maxStake + (_totalBal * _listERC1155[reqContract].maxAmountId);\n }\n return _maxStake;\n }\n\n function checkAndGetERC721Stake(address account) public view returns (uint256) {\n uint256 _maxStake = 0;\n for (uint256 i = 0; i < _listERC721Index.length; i++) {\n uint256 balanceOf = 0;\n uint256 balanceOfId = 0;\n IERC721 reqContract = _listERC721Index[i];\n\n if (_listERC721[reqContract].balanceOf == true) {\n require(\n (reqContract.balanceOf(account) >= _listERC721[reqContract].minAmountBalanceOf) ||\n (maxStakeOverall > 0),\n \"RequirementsRules: balanceOf\"\n );\n balanceOf = reqContract.balanceOf(account);\n } else {\n balanceOfId = getERC721BalanceId(reqContract, account);\n if (_listERC721[reqContract].ids.length > 0) {\n require(\n (balanceOfId >= _listERC721[reqContract].minAmountId) || (maxStakeOverall > 0),\n \"RequirementsRules: balanceId\"\n );\n }\n }\n\n _maxStake =\n _maxStake +\n (balanceOf *\n _listERC721[reqContract].maxAmountBalanceOf +\n balanceOfId *\n _listERC721[reqContract].maxAmountId);\n }\n return _maxStake;\n }\n\n function _maxStakeAllowedCalculator(uint256 maxStakeERC721, uint256 maxStakeERC1155)\n internal\n view\n returns (uint256)\n {\n uint256 maxAllowed = maxStakeOverall;\n\n if (maxStakeERC721 + maxStakeERC1155 > 0) {\n if (maxStakeOverall > 0) {\n maxAllowed = Math.min(maxAllowed, maxStakeERC721 + maxStakeERC1155);\n } else {\n maxAllowed = maxStakeERC721 + maxStakeERC1155;\n }\n } else {\n maxAllowed = maxStakeOverall;\n }\n\n return maxAllowed;\n }\n}\n" + }, + "src/solc_0.8/defi/SandRewardPool.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Context} from \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport {IERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts-0.8/security/ReentrancyGuard.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport {AccessControl} from \"@openzeppelin/contracts-0.8/access/AccessControl.sol\";\nimport {ERC2771Handler} from \"../common/BaseWithStorage/ERC2771Handler.sol\";\nimport {StakeTokenWrapper} from \"./StakeTokenWrapper.sol\";\nimport {IContributionCalculator} from \"./interfaces/IContributionCalculator.sol\";\nimport {IRewardCalculator} from \"./interfaces/IRewardCalculator.sol\";\n\n/// @title A pool that distributes rewards between users that stake sand (or any erc20 token)\n/// @notice The contributions are updated passively, an external call to computeContribution from a backend is needed.\n/// @notice After initialization the reward calculator must be set by the admin.\n/// @dev The contract has two plugins that affect the behaviour: contributionCalculator and rewardCalculator\n/// @dev contributionCalculator instead of using the stake directly the result of computeContribution is used\n/// @dev this way some users can get an extra share of the rewards\n/// @dev rewardCalculator is used to manage the rate at which the rewards are distributed.\n/// @dev This way we can build different types of pools by mixing in the plugins we want with this contract.\n/// @dev default behaviour (address(0)) for contributionCalculator is to use the stacked amount as contribution.\n/// @dev default behaviour (address(0)) for rewardCalculator is that no rewards are giving\ncontract SandRewardPool is StakeTokenWrapper, AccessControl, ReentrancyGuard, ERC2771Handler {\n using SafeERC20 for IERC20;\n using Address for address;\n\n event Staked(address indexed account, uint256 stakeAmount);\n event Withdrawn(address indexed account, uint256 stakeAmount);\n event Exit(address indexed account);\n event RewardPaid(address indexed account, uint256 rewardAmount);\n event ContributionUpdated(address indexed account, uint256 newContribution, uint256 oldContribution);\n\n // This value multiplied by the user contribution is the share of accumulated rewards (from the start of time\n // until the last call to restartRewards) for the user taking into account the value of totalContributions.\n uint256 public rewardPerTokenStored;\n\n // This value multiplied by the user contribution is the share of reward from the the last time\n // the user changed his contribution and called restartRewards\n mapping(address => uint256) public userRewardPerTokenPaid;\n\n // This value is the accumulated rewards won by the user when he called the contract.\n mapping(address => uint256) public rewards;\n\n IERC20 public rewardToken;\n IContributionCalculator public contributionCalculator;\n IRewardCalculator public rewardCalculator;\n\n uint256 internal _totalContributions;\n mapping(address => uint256) internal _contributions;\n\n struct AntiCompound {\n uint256 lockPeriodInSecs;\n mapping(address => uint256) lastClaim;\n }\n // This is used to implement a time buffer for reward retrieval, so the used cannot re-stake the rewards too fast.\n AntiCompound public antiCompound;\n\n constructor(\n IERC20 stakeToken_,\n IERC20 rewardToken_,\n address trustedForwarder\n ) StakeTokenWrapper(stakeToken_) {\n rewardToken = rewardToken_;\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n __ERC2771Handler_initialize(trustedForwarder);\n }\n\n modifier antiCompoundCheck(address account) {\n // We use lockPeriodInSecs == 0 to disable this check\n if (antiCompound.lockPeriodInSecs != 0) {\n require(\n block.timestamp > antiCompound.lastClaim[account] + antiCompound.lockPeriodInSecs,\n \"SandRewardPool: must wait\"\n );\n }\n antiCompound.lastClaim[account] = block.timestamp;\n _;\n }\n\n modifier isContractAndAdmin(address contractAddress) {\n require(contractAddress.isContract(), \"SandRewardPool: not a contract\");\n require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), \"SandRewardPool: not admin\");\n _;\n }\n\n /// @notice set the lockPeriodInSecs for the anti-compound buffer\n /// @param lockPeriodInSecs amount of time the user must wait between reward withdrawal\n function setAntiCompoundLockPeriod(uint256 lockPeriodInSecs) external {\n require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), \"SandRewardPool: not admin\");\n antiCompound.lockPeriodInSecs = lockPeriodInSecs;\n }\n\n /// @notice set the contribution calculator\n /// @param contractAddress address of a plugin that calculates the contribution of the user based on his stake\n function setContributionCalculator(address contractAddress) external isContractAndAdmin(contractAddress) {\n contributionCalculator = IContributionCalculator(contractAddress);\n }\n\n /// @notice set the reward token\n /// @param contractAddress address token used to pay rewards\n function setRewardToken(address contractAddress) external isContractAndAdmin(contractAddress) {\n rewardToken = IERC20(contractAddress);\n }\n\n /// @notice set the stake token\n /// @param contractAddress address token used to stake funds\n function setStakeToken(address contractAddress) external isContractAndAdmin(contractAddress) {\n _stakeToken = IERC20(contractAddress);\n }\n\n /// @notice set the trusted forwarder\n /// @param trustedForwarder address of the contract that is enabled to send meta-tx on behalf of the user\n function setTrustedForwarder(address trustedForwarder) external {\n require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), \"SandRewardPool: not admin\");\n _trustedForwarder = trustedForwarder;\n }\n\n /// @notice set the reward calculator\n /// @param contractAddress address of a plugin that calculates absolute rewards at any point in time\n /// @param restartRewards if true the rewards from the previous calculator are accumulated before changing it\n function setRewardCalculator(address contractAddress, bool restartRewards)\n external\n isContractAndAdmin(contractAddress)\n {\n // We process the rewards of the current reward calculator before the switch.\n if (restartRewards) {\n _restartRewards();\n }\n rewardCalculator = IRewardCalculator(contractAddress);\n }\n\n /// @notice the admin recover is able to recover reward funds\n /// @param receiver address of the beneficiary of the recovered funds\n /// @dev this function must be called in an emergency situation only.\n /// @dev Calling it is risky specially when rewardToken == stakeToken\n function recoverFunds(address receiver) external {\n require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), \"SandRewardPool: not admin\");\n require(receiver != address(0), \"SandRewardPool: invalid receiver\");\n rewardToken.safeTransfer(receiver, rewardToken.balanceOf(address(this)));\n }\n\n /// @notice return the total supply of staked tokens\n /// @return the total supply of staked tokens\n function totalSupply() external view returns (uint256) {\n return _totalSupply;\n }\n\n /// @notice return the balance of staked tokens for a user\n /// @param account the address of the account\n /// @return balance of staked tokens\n function balanceOf(address account) external view returns (uint256) {\n return _balances[account];\n }\n\n /// @notice return the address of the stake token contract\n /// @return address of the stake token contract\n function stakeToken() external view returns (IERC20) {\n return _stakeToken;\n }\n\n /// @notice return the amount of rewards deposited in the contract that can be distributed by different campaigns\n /// @return the total amount of deposited rewards\n /// @dev this function can be called by a reward calculator to throw if a campaign doesn't have\n /// @dev enough rewards to start\n function getRewardsAvailable() external view returns (uint256) {\n if (address(rewardToken) != address(_stakeToken)) {\n return rewardToken.balanceOf(address(this));\n }\n return _stakeToken.balanceOf(address(this)) - _totalSupply;\n }\n\n /// @notice return the sum of the values returned by the contribution calculator\n /// @return total contributions of the users\n /// @dev this is the same than the totalSupply only if the contribution calculator\n /// @dev uses the staked amount as the contribution of the user which is the default behaviour\n function totalContributions() external view returns (uint256) {\n return _totalContributions;\n }\n\n /// @notice return the contribution of some user\n /// @param account the address of the account\n /// @return contribution of the users\n /// @dev this is the same than the balanceOf only if the contribution calculator\n /// @dev uses the staked amount as the contribution of the user which is the default behaviour\n function contributionOf(address account) external view returns (uint256) {\n return _contributions[account];\n }\n\n /// @notice accumulated rewards taking into account the totalContribution (see: rewardPerTokenStored)\n /// @return the accumulated total rewards\n /// @dev This value multiplied by the user contribution is the share of accumulated rewards for the user. Taking\n /// @dev into account the value of totalContributions.\n function rewardPerToken() external view returns (uint256) {\n return rewardPerTokenStored + _rewardPerToken();\n }\n\n /// @notice available earnings for some user\n /// @param account the address of the account\n /// @return the available earnings for the user\n function earned(address account) external view returns (uint256) {\n return rewards[account] + _earned(account, _rewardPerToken());\n }\n\n /// @notice accumulates the current rewards into rewardPerTokenStored and restart the reward calculator\n /// @dev calling this function make no difference. It is useful for testing and when the reward calculator\n /// @dev is changed.\n function restartRewards() external {\n _restartRewards();\n }\n\n /// @notice update the contribution for a user\n /// @param account the address of the account\n /// @dev if the user change his holdings (or any other parameter that affect the contribution calculation),\n /// @dev he can the reward distribution to his favor. This function must be called by an external agent ASAP to\n /// @dev update the contribution for the user. We understand the risk but the rewards are distributes slowly so\n /// @dev the user cannot affect the reward distribution heavily.\n function computeContribution(address account) external {\n require(account != address(0), \"SandRewardPool: invalid address\");\n // We decide to give the user the accumulated rewards even if he cheated a little bit.\n _processRewards(account);\n _updateContribution(account);\n }\n\n /// @notice update the contribution for a sef of users\n /// @param accounts the addresses of the accounts to update\n /// @dev see: computeContribution\n function computeContributionInBatch(address[] calldata accounts) external {\n _restartRewards();\n for (uint256 i = 0; i < accounts.length; i++) {\n address account = accounts[i];\n if (account == address(0)) {\n continue;\n }\n _processAccountRewards(account);\n _updateContribution(account);\n }\n }\n\n /// @notice stake some amount into the contract\n /// @param amount the amount of tokens to stake\n /// @dev the user must approve in the stack token before calling this function\n function stake(uint256 amount) external nonReentrant {\n require(amount > 0, \"SandRewardPool: Cannot stake 0\");\n\n // The first time a user stakes he cannot remove his rewards immediately.\n if (antiCompound.lastClaim[_msgSender()] == 0) {\n antiCompound.lastClaim[_msgSender()] = block.timestamp;\n }\n\n uint256 earlierRewards = 0;\n\n if (_totalContributions == 0 && rewardCalculator != IRewardCalculator(address(0))) {\n earlierRewards = rewardCalculator.getRewards();\n }\n\n _processRewards(_msgSender());\n super._stake(amount);\n _updateContribution(_msgSender());\n require(_contributions[_msgSender()] > 0, \"SandRewardPool: not enough contributions\");\n\n if (earlierRewards != 0) {\n rewards[_msgSender()] = rewards[_msgSender()] + earlierRewards;\n }\n emit Staked(_msgSender(), amount);\n }\n\n /// @notice withdraw the stake from the contract\n /// @param amount the amount of tokens to withdraw\n /// @dev the user can withdraw his stake independently from the rewards\n function withdraw(uint256 amount) external nonReentrant {\n _processRewards(_msgSender());\n _withdrawStake(_msgSender(), amount);\n _updateContribution(_msgSender());\n }\n\n /// @notice withdraw the stake and the rewards from the contract\n function exit() external nonReentrant {\n _processRewards(_msgSender());\n _withdrawStake(_msgSender(), _balances[_msgSender()]);\n _withdrawRewards(_msgSender());\n _updateContribution(_msgSender());\n emit Exit(_msgSender());\n }\n\n /// @notice withdraw the rewards from the contract\n /// @dev the user can withdraw his stake independently from the rewards\n function getReward() external nonReentrant {\n _processRewards(_msgSender());\n _withdrawRewards(_msgSender());\n _updateContribution(_msgSender());\n }\n\n function _withdrawStake(address account, uint256 amount) internal {\n require(amount > 0, \"SandRewardPool: Cannot withdraw 0\");\n super._withdraw(amount);\n emit Withdrawn(account, amount);\n }\n\n function _withdrawRewards(address account) internal antiCompoundCheck(account) {\n uint256 reward = rewards[account];\n if (reward > 0) {\n rewards[account] = 0;\n rewardToken.safeTransfer(account, reward);\n emit RewardPaid(account, reward);\n }\n }\n\n function _updateContribution(address account) internal {\n uint256 oldContribution = _contributions[account];\n _totalContributions = _totalContributions - oldContribution;\n uint256 contribution = _computeContribution(account);\n _totalContributions = _totalContributions + contribution;\n _contributions[account] = contribution;\n emit ContributionUpdated(account, contribution, oldContribution);\n }\n\n function _computeContribution(address account) internal returns (uint256) {\n if (contributionCalculator == IContributionCalculator(address(0))) {\n return _balances[account];\n } else {\n return contributionCalculator.computeContribution(account, _balances[account]);\n }\n }\n\n // Something changed (stake, withdraw, etc), we distribute current accumulated rewards and start from zero.\n // Called each time there is a change in contract state (stake, withdraw, etc).\n function _processRewards(address account) internal {\n _restartRewards();\n _processAccountRewards(account);\n }\n\n // Update the earnings for this specific user with what he earned until now\n function _processAccountRewards(address account) internal {\n // usually _earned takes _rewardPerToken() but in this method is zero because _restartRewards must be\n // called before _processAccountRewards\n rewards[account] = rewards[account] + _earned(account, 0);\n // restart rewards for this specific user, now earned(account) = 0\n userRewardPerTokenPaid[account] = rewardPerTokenStored;\n }\n\n function _restartRewards() internal {\n if (rewardCalculator != IRewardCalculator(address(0))) {\n // Distribute the accumulated rewards\n rewardPerTokenStored = rewardPerTokenStored + _rewardPerToken();\n // restart rewards so now the rewardCalculator return zero rewards\n rewardCalculator.restartRewards();\n }\n }\n\n function _earned(address account, uint256 rewardPerToken) internal view returns (uint256) {\n // - userRewardPerTokenPaid[account] * _contributions[account] / _totalContributions is the portion of\n // rewards the last time the user changed his contribution and called _restartRewards\n // (_totalContributions corresponds to previous value of that moment).\n // - rewardPerTokenStored * _contributions[account] is the share of the user from the\n // accumulated rewards (from the start of time until the last call to _restartRewards) with the\n // current value of _totalContributions\n // - _rewardPerToken() * _contributions[account] / _totalContributions is the share of the user of the\n // rewards from the last time anybody called _restartRewards until this moment\n //\n // The important thing to note is that at any moment in time _contributions[account] / _totalContributions is\n // the share of the user even if _totalContributions changes because of other users activity.\n return\n ((rewardPerToken + rewardPerTokenStored - userRewardPerTokenPaid[account]) * _contributions[account]) /\n 1e24;\n }\n\n // This function gives the proportion of the total contribution that corresponds to each user from\n // last restartRewards call.\n // _rewardsPerToken() * _contributions[account] is the amount of extra rewards gained from last restartRewards.\n function _rewardPerToken() internal view returns (uint256) {\n if (rewardCalculator == IRewardCalculator(address(0)) || _totalContributions == 0) {\n return 0;\n }\n return (rewardCalculator.getRewards() * 1e24) / _totalContributions;\n }\n\n function _msgSender() internal view override(Context, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n}\n" + }, + "src/solc_0.8/defi/StakeTokenWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\n\nabstract contract StakeTokenWrapper is Context {\n using Address for address;\n using SafeERC20 for IERC20;\n IERC20 internal _stakeToken;\n\n uint256 internal _totalSupply;\n mapping(address => uint256) internal _balances;\n\n constructor(IERC20 stakeToken) {\n require(address(stakeToken).isContract(), \"StakeTokenWrapper: is not a contract\");\n _stakeToken = stakeToken;\n }\n\n function _stake(uint256 amount) internal virtual {\n require(amount > 0, \"StakeTokenWrapper: amount > 0\");\n _totalSupply = _totalSupply + amount;\n _balances[_msgSender()] = _balances[_msgSender()] + amount;\n _stakeToken.safeTransferFrom(_msgSender(), address(this), amount);\n }\n\n function _withdraw(uint256 amount) internal virtual {\n require(amount > 0, \"StakeTokenWrapper: amount > 0\");\n _totalSupply = _totalSupply - amount;\n _balances[_msgSender()] = _balances[_msgSender()] - amount;\n _stakeToken.safeTransfer(_msgSender(), amount);\n }\n\n uint256[50] private __gap;\n}\n" + }, + "src/solc_0.8/defi/StakeTokenWrapperV2.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport {Context} from \"@openzeppelin/contracts-0.8/utils/Context.sol\";\nimport {SafeERC20, IERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\n\n/// @title Token wrapper contract to be used by the staking pools\nabstract contract StakeTokenWrapperV2 is Context {\n using Address for address;\n using SafeERC20 for IERC20;\n IERC20 internal _stakeToken;\n\n uint256 internal _totalSupply;\n mapping(address => uint256) internal _balances;\n\n constructor(IERC20 stakeToken) {\n require(address(stakeToken).isContract(), \"StakeTokenWrapper: is not a contract\");\n _stakeToken = stakeToken;\n }\n\n function _stake(uint256 amount) internal virtual {\n require(amount > 0, \"StakeTokenWrapper: amount > 0\");\n\n address _sender = _msgSender();\n\n _totalSupply += amount;\n _balances[_sender] += amount;\n _stakeToken.safeTransferFrom(_sender, address(this), amount);\n }\n\n function _withdraw(uint256 amount) internal virtual {\n require(amount > 0, \"StakeTokenWrapper: amount > 0\");\n\n address _sender = _msgSender();\n\n _totalSupply -= amount;\n _balances[_sender] -= amount;\n _stakeToken.safeTransfer(_sender, amount);\n }\n}\n" + }, + "src/solc_0.8/faucet/Faucet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport \"@openzeppelin/contracts-0.8/utils/Strings.sol\";\n\ncontract Faucet is Ownable {\n IERC20 internal immutable _ierc20;\n uint256 internal _period;\n uint256 internal _amountLimit;\n\n mapping(address => uint256) public _lastTimestamps;\n\n constructor(\n IERC20 ierc20,\n uint256 period,\n uint256 amountLimit\n ) {\n _ierc20 = ierc20;\n _period = period;\n _amountLimit = amountLimit;\n }\n\n event FaucetPeriod(uint256 period);\n event FaucetLimit(uint256 amountLimit);\n event FaucetSent(address _receiver, uint256 _amountSent);\n event FaucetRetrieved(address receiver, uint256 _amountSent);\n\n /// @notice set the minimum time delta between 2 calls to send() for an address.\n /// @param period time delta between 2 calls to send() for an address.\n function setPeriod(uint256 period) public onlyOwner {\n _period = period;\n emit FaucetPeriod(period);\n }\n\n /// @notice returns the minimum time delta between 2 calls to Send for an address.\n function getPeriod() public view returns (uint256) {\n return _period;\n }\n\n /// @notice return the maximum IERC20 token amount for an address.\n function setLimit(uint256 amountLimit) public onlyOwner {\n _amountLimit = amountLimit;\n emit FaucetLimit(amountLimit);\n }\n\n /// @notice return the maximum IERC20 token amount for an address.\n function getLimit() public view returns (uint256) {\n return _amountLimit;\n }\n\n /// @notice return the current IERC20 token balance for the contract.\n function balance() public view returns (uint256) {\n return _ierc20.balanceOf(address(this));\n }\n\n /// @notice retrieve all IERC20 token from contract to an address.\n /// @param receiver The address that will receive all IERC20 tokens.\n function retrieve(address receiver) public onlyOwner {\n uint256 accountBalance = balance();\n _ierc20.transferFrom(address(this), receiver, accountBalance);\n\n emit FaucetRetrieved(receiver, accountBalance);\n }\n\n /// @notice send amount of IERC20 to a receiver.\n /// @param amount The value of the IERC20 token that the receiver will received.\n function send(uint256 amount) public {\n require(\n amount <= _amountLimit,\n string(abi.encodePacked(\"Demand must not exceed \", Strings.toString(_amountLimit)))\n );\n\n uint256 accountBalance = balance();\n\n require(\n accountBalance > 0,\n string(abi.encodePacked(\"Insufficient balance on Faucet account: \", Strings.toString(accountBalance)))\n );\n require(\n _lastTimestamps[msg.sender] + _period < block.timestamp,\n string(abi.encodePacked(\"After each call you must wait \", Strings.toString(_period), \" seconds.\"))\n );\n _lastTimestamps[msg.sender] = block.timestamp;\n\n if (accountBalance < amount) {\n amount = accountBalance;\n }\n _ierc20.transferFrom(address(this), msg.sender, amount);\n\n emit FaucetSent(msg.sender, amount);\n }\n}\n" + }, + "src/solc_0.8/faucet/Faucets.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\n\ncontract Faucets is Ownable {\n event Faucet(address faucet, bool enabled);\n event Period(address faucet, uint256 period);\n event Limit(address faucet, uint256 limit);\n event Claimed(address faucet, address receiver, uint256 amount);\n event Withdrawn(address faucet, address receiver, uint256 amount);\n\n mapping(address => bool) private _faucets;\n mapping(address => uint256) private _periods;\n mapping(address => uint256) private _limits;\n mapping(address => mapping(address => uint256)) private _lastTimestamps;\n\n modifier exists(address faucet) {\n require(_faucets[faucet], \"Faucets: FAUCET_DOES_NOT_EXIST\");\n _;\n }\n\n function addFaucet(\n address faucet,\n uint256 period,\n uint256 limit\n ) public onlyOwner {\n require(!_faucets[faucet], \"Faucets: FAUCET_ALREADY_EXISTS\");\n _setFaucet(faucet);\n _setPeriod(faucet, period);\n _setLimit(faucet, limit);\n }\n\n function _setFaucet(address faucet) internal {\n _faucets[faucet] = true;\n emit Faucet(faucet, true);\n }\n\n function removeFaucet(address faucet) external onlyOwner exists(faucet) {\n _withdraw(faucet, _msgSender());\n delete _faucets[faucet];\n delete _periods[faucet];\n delete _limits[faucet];\n emit Faucet(faucet, false);\n }\n\n function getFaucet(address faucet) public view returns (bool) {\n return _faucets[faucet];\n }\n\n function setPeriod(address faucet, uint256 period) public onlyOwner exists(faucet) {\n _setPeriod(faucet, period);\n }\n\n function _setPeriod(address faucet, uint256 period) internal {\n _periods[faucet] = period;\n emit Period(faucet, period);\n }\n\n function getPeriod(address faucet) public view exists(faucet) returns (uint256) {\n return _periods[faucet];\n }\n\n function setLimit(address faucet, uint256 limit) public onlyOwner exists(faucet) {\n _setLimit(faucet, limit);\n }\n\n function _setLimit(address faucet, uint256 limit) internal {\n _limits[faucet] = limit;\n emit Limit(faucet, limit);\n }\n\n function getLimit(address faucet) public view exists(faucet) returns (uint256) {\n return _limits[faucet];\n }\n\n function getBalance(address faucet) public view exists(faucet) returns (uint256) {\n return IERC20(faucet).balanceOf(address(this));\n }\n\n function _getBalance(address faucet) internal view exists(faucet) returns (uint256) {\n return IERC20(faucet).balanceOf(address(this));\n }\n\n function canClaim(address faucet, address walletAddress) external view exists(faucet) returns (bool) {\n return _canClaim(faucet, walletAddress);\n }\n\n function _canClaim(address faucet, address walletAddress) internal view returns (bool) {\n return _lastTimestamps[faucet][walletAddress] + _periods[faucet] < block.timestamp;\n }\n\n function withdraw(address faucet, address receiver) external onlyOwner exists(faucet) {\n _withdraw(faucet, receiver);\n }\n\n function _withdraw(address faucet, address receiver) internal onlyOwner {\n uint256 accountBalance = _getBalance(faucet);\n IERC20(faucet).transfer(receiver, accountBalance);\n emit Withdrawn(faucet, receiver, accountBalance);\n }\n\n function claimBatch(address[] calldata faucets, uint256[] calldata amounts) public {\n require(faucets.length == amounts.length, \"Faucets: ARRAY_LENGTH_MISMATCH\");\n for (uint256 i = 0; i < faucets.length; i++) {\n claim(faucets[i], amounts[i]);\n }\n }\n\n function claim(address faucet, uint256 amount) public exists(faucet) {\n require(amount <= _limits[faucet], \"Faucets: AMOUNT_EXCEEDED_LIMIT\");\n uint256 accountBalance = _getBalance(faucet);\n require(accountBalance >= amount, \"Faucets: FAUCET_INSUFFICIENT_BALANCE\");\n require(_canClaim(faucet, msg.sender), \"Faucets: FAUCET_PERIOD_COOLDOWN\");\n _lastTimestamps[faucet][msg.sender] = block.timestamp;\n IERC20(faucet).transfer(msg.sender, amount);\n emit Claimed(faucet, msg.sender, amount);\n }\n}\n" + }, + "src/solc_0.8/Game/GameBaseToken.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC721/IERC721Receiver.sol\";\n\nimport \"../common/BaseWithStorage/ImmutableERC721.sol\";\nimport \"../common/BaseWithStorage/WithMinter.sol\";\nimport \"../common/interfaces/IGameToken.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\ncontract GameBaseToken is IERC721Receiver, ImmutableERC721, WithMinter, Initializable, IGameToken {\n /////////////////////////////// Data //////////////////////////////\n\n IERC1155 internal _assetERC1155;\n IERC721 internal _assetERC721;\n\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n mapping(uint256 => mapping(uint256 => uint256)) private _gameERC1155Assets;\n mapping(uint256 => mapping(uint256 => uint256)) private _gameERC721Assets;\n mapping(uint256 => address) private _creatorship; // creatorship transfer\n\n mapping(uint256 => bytes32) private _metaData;\n mapping(address => mapping(address => bool)) private _gameEditors;\n /////////////////////////////// Events //////////////////////////////\n\n /// @dev Emits when a game is updated.\n /// @param oldId The id of the previous ERC721 GAME token.\n /// @param newId The id of the newly minted token.\n /// @param update The changes made to the Game: new assets, removed assets, uri\n\n event GameTokenUpdated(uint256 indexed oldId, uint256 indexed newId, IGameToken.GameData update);\n\n /// @dev Emits when creatorship of a GAME token is transferred.\n /// @param original The original creator of the GAME token.\n /// @param from The current 'creator' of the token.\n /// @param to The new 'creator' of the token.\n event CreatorshipTransfer(address indexed original, address indexed from, address indexed to);\n\n /// @dev Emits when an address has its gameEditor status changed.\n /// @param gameOwner The owner of the GAME token.\n /// @param gameEditor The address whose editor rights to update.\n /// @param isEditor WHether the address 'gameEditor' should be an editor.\n event GameEditorSet(address indexed gameOwner, address gameEditor, bool isEditor);\n\n function initV1(\n address trustedForwarder,\n address admin,\n IERC1155 asset1155,\n IERC721 asset721,\n uint8 chainIndex\n ) public initializer {\n _admin = admin;\n _assetERC1155 = asset1155;\n _assetERC721 = asset721;\n ImmutableERC721.__ImmutableERC721_initialize(chainIndex);\n ERC2771Handler.__ERC2771Handler_initialize(trustedForwarder);\n }\n\n /////////////////////////////// Modifiers //////////////////////////////\n\n modifier notToZero(address to) {\n require(to != address(0), \"DESTINATION_ZERO_ADDRESS\");\n _;\n }\n\n modifier notToThis(address to) {\n require(to != address(this), \"DESTINATION_GAME_CONTRACT\");\n _;\n }\n\n function onERC721Received(\n address, /*operator*/\n address, /*from*/\n uint256, /*id*/\n bytes calldata /*data*/\n ) external view override returns (bytes4) {\n require(_msgSender() == address(_assetERC721), \"WRONG_SENDER\");\n return IERC721Receiver.onERC721Received.selector;\n }\n\n /////////////////////////////// Functions //////////////////////////////\n\n /// @notice Create a new GAME token.\n /// @param from The address of the one creating the game (may be different from msg.sender if metaTx).\n /// @param to The address who will be assigned ownership of this game.\n /// @param creation The struct containing ids & ammounts of assets to add to this game,\n /// along with the uri to set.\n /// @param editor The address to allow to edit (can also be set later).\n /// @param subId A random id created on the backend.\n /// @return id The id of the new GAME token (ERC721).\n function createGame(\n address from,\n address to,\n IGameToken.GameData memory creation,\n address editor,\n uint64 subId\n ) external override onlyMinter notToZero(to) notToThis(to) returns (uint256 id) {\n (uint256 gameId, uint256 strgId) = _mintGame(from, to, subId, 0, true);\n\n if (editor != address(0)) {\n _setGameEditor(to, editor, true);\n }\n\n if (creation.gameData721.assetIdsToAdd.length != 0) {\n _addAssets(from, strgId, creation.gameData721.assetIdsToAdd, new uint256[](0), false);\n }\n\n if (creation.gameData1155.assetIdsToAdd.length != 0) {\n _addAssets(\n from,\n strgId,\n creation.gameData1155.assetIdsToAdd,\n creation.gameData1155.assetAmountsToAdd,\n true\n );\n }\n\n _metaData[strgId] = creation.uri;\n emit GameTokenUpdated(0, gameId, creation);\n return gameId;\n }\n\n /// @notice Update an existing GAME token.This actually burns old token\n /// and mints new token with same basId & incremented version.\n /// @param from The one updating the GAME token.\n /// @param gameId The current id of the GAME token.\n /// @param update The values to use for the update.\n /// @return The new gameId.\n function updateGame(\n address from,\n uint256 gameId,\n IGameToken.GameData memory update\n ) external override onlyMinter returns (uint256) {\n uint256 id = _storageId(gameId);\n if (update.gameData721.assetIdsToAdd.length != 0) {\n _addAssets(from, id, update.gameData721.assetIdsToAdd, new uint256[](0), false);\n }\n if (update.gameData721.assetIdsToRemove.length != 0) {\n _removeAssets(id, update.gameData721.assetIdsToRemove, new uint256[](0), _ownerOf(gameId), false);\n }\n\n if (update.gameData1155.assetIdsToAdd.length != 0) {\n _addAssets(from, id, update.gameData1155.assetIdsToAdd, update.gameData1155.assetAmountsToAdd, true);\n }\n if (update.gameData1155.assetIdsToRemove.length != 0) {\n _removeAssets(\n id,\n update.gameData1155.assetIdsToRemove,\n update.gameData1155.assetAmountsToRemove,\n _ownerOf(gameId),\n true\n );\n }\n _metaData[id] = update.uri;\n uint256 newId = _bumpGameVersion(from, gameId);\n emit GameTokenUpdated(gameId, newId, update);\n return newId;\n }\n\n /// @notice Allow token owner to set game editors.\n /// @param gameOwner The address of a GAME token creator.\n /// @param editor The address of the editor to set.\n /// @param isEditor Add or remove the ability to edit.\n function setGameEditor(\n address gameOwner,\n address editor,\n bool isEditor\n ) external override {\n require(_msgSender() == gameOwner, \"EDITOR_ACCESS_DENIED\");\n _setGameEditor(gameOwner, editor, isEditor);\n }\n\n /// @notice Transfers creatorship of `original` from `sender` to `to`.\n /// @param gameId The current id of the GAME token.\n /// @param sender The address of current registered creator.\n /// @param to The address to transfer the creatorship to\n function transferCreatorship(\n uint256 gameId,\n address sender,\n address to\n ) external override notToZero(to) {\n require(_ownerOf(gameId) != address(0), \"NONEXISTENT_TOKEN\");\n uint256 id = _storageId(gameId);\n address msgSender = _msgSender();\n require(msgSender == sender || _superOperators[msgSender], \"TRANSFER_ACCESS_DENIED\");\n require(sender != address(0), \"NOT_FROM_ZEROADDRESS\");\n address originalCreator = address(uint160(id / CREATOR_OFFSET_MULTIPLIER));\n address current = creatorOf(gameId);\n require(current != to, \"CURRENT_=_TO\");\n require(current == sender, \"CURRENT_!=_SENDER\");\n _creatorship[id] = to;\n emit CreatorshipTransfer(originalCreator, current, to);\n }\n\n /// @notice Burn a GAME token and recover assets.\n /// @param from The address of the one destroying the game.\n /// @param to The address to send all GAME assets to.\n /// @param gameId The id of the GAME to destroy.\n /// @param assetERC1155Ids The ERC1155 assets to recover from the burnt GAME.\n /// @param assetERC721Ids The ERC721 assets to recover from the burnt GAME.\n function burnAndRecover(\n address from,\n address to,\n uint256 gameId,\n uint256[] calldata assetERC1155Ids,\n uint256[] calldata assetERC721Ids\n ) external override notToZero(to) notToThis(to) {\n _burnGame(from, gameId);\n if (assetERC1155Ids.length != 0) {\n _recoverAssets(from, to, gameId, assetERC1155Ids, true);\n }\n if (assetERC721Ids.length != 0) {\n _recoverAssets(from, to, gameId, assetERC721Ids, false);\n }\n }\n\n /// @notice Burn a GAME token.\n /// @param gameId The id of the GAME to destroy.\n function burn(uint256 gameId) external override(ERC721BaseToken, IGameToken) {\n _burnGame(_msgSender(), gameId);\n }\n\n /// @notice Burn a GAME token on behalf of owner.\n /// @param from The address whose GAME is being burnt.\n /// @param gameId The id of the GAME to burn.\n function burnFrom(address from, uint256 gameId) external override(ERC721BaseToken, IGameToken) {\n require(from != address(0), \"NOT_FROM_ZEROADDRESS\");\n _burnGame(from, gameId);\n }\n\n /// @notice Transfer assets from a burnt GAME.\n /// @param from Previous owner of the burnt game.\n /// @param to Address that will receive the assets.\n /// @param gameId Id of the burnt GAME token.\n /// @param assetERC1155Ids The ERC1155 assets to recover from the burnt GAME.\n /// @param assetERC721Ids The ERC1155 assets to recover from the burnt GAME.\n function recoverAssets(\n address from,\n address to,\n uint256 gameId,\n uint256[] calldata assetERC1155Ids,\n uint256[] calldata assetERC721Ids\n ) public override {\n if (assetERC1155Ids.length != 0) {\n _recoverAssets(from, to, gameId, assetERC1155Ids, true);\n }\n if (assetERC721Ids.length != 0) {\n _recoverAssets(from, to, gameId, assetERC721Ids, false);\n }\n }\n\n /// @notice Get the amount of each assetId in a GAME.\n /// @param gameId The game to query.\n /// @param assetIds The assets to get balances for.\n function getERC1155AssetBalances(uint256 gameId, uint256[] calldata assetIds)\n external\n view\n override\n returns (uint256[] memory)\n {\n uint256 storageId = _storageId(gameId);\n require(_ownerOf(gameId) != address(0), \"NONEXISTENT_TOKEN\");\n uint256 length = assetIds.length;\n uint256[] memory assets;\n assets = new uint256[](length);\n for (uint256 i = 0; i < length; i++) {\n assets[i] = _gameERC1155Assets[storageId][assetIds[i]];\n }\n return assets;\n }\n\n /// @notice Get the amount of each assetId in a GAME.\n /// @param gameId The game to query.\n /// @param assetIds The assets to get balances for.\n function getERC721AssetBalances(uint256 gameId, uint256[] calldata assetIds)\n external\n view\n override\n returns (uint256[] memory)\n {\n uint256 storageId = _storageId(gameId);\n require(_ownerOf(gameId) != address(0), \"NONEXISTENT_TOKEN\");\n uint256 length = assetIds.length;\n uint256[] memory assets;\n assets = new uint256[](length);\n for (uint256 i = 0; i < length; i++) {\n assets[i] = _gameERC721Assets[storageId][assetIds[i]];\n }\n return assets;\n }\n\n /// @notice Get game editor status.\n /// @param gameOwner The address of the owner of the GAME.\n /// @param editor The address of the editor to set.\n /// @return isEditor Editor status of editor for given tokenId.\n function isGameEditor(address gameOwner, address editor) external view override returns (bool isEditor) {\n return _gameEditors[gameOwner][editor];\n }\n\n /// @notice Called by other contracts to check if this can receive ERC1155 batch.\n /// @param operator The address of the operator in the current tx.\n /// @return the bytes4 value 0xbc197c81.\n function onERC1155BatchReceived(\n address operator,\n address, /*from*/\n uint256[] calldata, /*ids*/\n uint256[] calldata, /*values*/\n bytes calldata /*data*/\n ) external view override returns (bytes4) {\n if (operator == address(this)) {\n return ERC1155_BATCH_RECEIVED;\n }\n revert(\"ERC1155_BATCH_REJECTED\");\n }\n\n /// @notice Called by other contracts to check if this can receive ERC1155 tokens.\n /// @param operator The address of the operator in the current tx.\n /// @return the bytes4 value 0xf23a6e61.\n function onERC1155Received(\n address operator,\n address, /*from*/\n uint256, /*id*/\n uint256, /*value*/\n bytes calldata /*data*/\n ) external view override returns (bytes4) {\n if (operator == address(this)) {\n return ERC1155_RECEIVED;\n }\n revert(\"ERC1155_REJECTED\");\n }\n\n /// @notice Return the name of the token contract.\n /// @return The name of the token contract.\n function name() external pure override returns (string memory) {\n return \"The Sandbox: GAME token\";\n }\n\n /// @notice Get the symbol of the token contract.\n /// @return the symbol of the token contract.\n function symbol() external pure override returns (string memory) {\n return \"GAME\";\n }\n\n /// @notice Get the creator of the token type `id`.\n /// @param gameId The id of the token to get the creator of.\n /// @return the creator of the token type `id`.\n function creatorOf(uint256 gameId) public view override returns (address) {\n require(gameId != uint256(0), \"GAME_NEVER_MINTED\");\n uint256 id = _storageId(gameId);\n address originalCreator = address(uint160(id / CREATOR_OFFSET_MULTIPLIER));\n address newCreator = _creatorship[id];\n if (newCreator != address(0)) {\n return newCreator;\n }\n return originalCreator;\n }\n\n /// @notice Return the URI of a specific token.\n /// @param gameId The id of the token.\n /// @return uri The URI of the token metadata.\n function tokenURI(uint256 gameId) public view override returns (string memory uri) {\n require(_ownerOf(gameId) != address(0), \"BURNED_OR_NEVER_MINTED\");\n uint256 id = _storageId(gameId);\n return _toFullURI(_metaData[id]);\n }\n\n /// @notice Check if the contract supports an interface.\n /// 0x01ffc9a7 is ERC-165.\n /// 0x80ac58cd is ERC-721.\n /// @param id The id of the interface.\n /// @return if the interface is supported.\n function supportsInterface(bytes4 id) public pure override returns (bool) {\n return id == 0x01ffc9a7 || id == 0x80ac58cd || id == 0x5b5e139f;\n }\n\n /// @notice Return the amount of token for a storage id\n /// @param strgId The storageId of the GAME to add assets to.\n /// @param assetIds The id of the asset to add to GAME.\n /// @param isERC1155 If the asset is an ERC1155\n /// @return amounts The amounts of token for asset ids.\n function getAndClearAmounts(\n uint256 strgId,\n uint256[] memory assetIds,\n bool isERC1155\n ) internal returns (uint256[] memory amounts) {\n uint256[] memory values;\n values = isERC1155 ? new uint256[](assetIds.length) : new uint256[](0);\n for (uint256 i = 0; i < assetIds.length; i++) {\n if (isERC1155) {\n values[i] = _gameERC1155Assets[strgId][assetIds[i]];\n delete _gameERC1155Assets[strgId][assetIds[i]];\n } else {\n delete _gameERC721Assets[strgId][assetIds[i]];\n }\n }\n return values;\n }\n\n /// @notice Return the amount of token for a storage id\n /// @param strgId The storageId of the GAME to add assets to.\n /// @param assetId The id of the asset to add to GAME.\n /// @param amount The amount to increase.\n /// @param isERC1155 If the asset is an ERC1155\n function _increaseAmount(\n uint256 strgId,\n uint256 assetId,\n uint256 amount,\n bool isERC1155\n ) internal {\n if (isERC1155) {\n require(amount != 0, \"INVALID_ASSET_ADDITION\");\n uint256 currentValue = _gameERC1155Assets[strgId][assetId];\n _gameERC1155Assets[strgId][assetId] = currentValue + amount;\n } else {\n uint256 currentValue = _gameERC721Assets[strgId][assetId];\n require(amount == 1 && currentValue == 0, \"INVALID_ASSET_ADDITION\");\n _gameERC721Assets[strgId][assetId] = 1;\n }\n }\n\n /// @notice Return the amount of token for a storage id\n /// @param strgId The storageId of the GAME to add assets to.\n /// @param assetId The id of the asset to add to GAME.\n /// @param amount The amount to decrease.\n /// @param isERC1155 If the asset is an ERC1155\n function _decreaseAmount(\n uint256 strgId,\n uint256 assetId,\n uint256 amount,\n bool isERC1155\n ) internal {\n if (isERC1155) {\n uint256 currentValue = _gameERC1155Assets[strgId][assetId];\n require(amount != 0 && currentValue >= amount, \"INVALID_ASSET_REMOVAL\");\n _gameERC1155Assets[strgId][assetId] = currentValue - amount;\n } else {\n uint256 currentValue = _gameERC721Assets[strgId][assetId];\n require(amount == 1 && currentValue == 1, \"INVALID_ASSET_REMOVAL\");\n _gameERC721Assets[strgId][assetId] = 0;\n }\n }\n\n /// @notice Return the amount of token for a storage id\n /// @param from The address of the current owner of assets.\n /// @param to The address of the receiver owner of assets.\n /// @param assetIds The id of the asset to add to GAME.\n /// @param amounts The amount of each asset to add to GAME.\n /// @param isERC1155 If the asset is an ERC1155\n function _safeTransferFrom(\n address from,\n address to,\n uint256[] memory assetIds,\n uint256[] memory amounts,\n bool isERC1155\n ) internal {\n if (isERC1155) {\n if (assetIds.length == 1) {\n _assetERC1155.safeTransferFrom(from, to, assetIds[0], amounts[0], \"\");\n } else {\n _assetERC1155.safeBatchTransferFrom(from, to, assetIds, amounts, \"\");\n }\n } else {\n for (uint256 i = 0; i < assetIds.length; i++) {\n _assetERC721.safeTransferFrom(from, to, assetIds[i], \"\");\n }\n }\n }\n\n /// @notice Add assets to an existing GAME.\n /// @param from The address of the current owner of assets.\n /// @param strgId The storageId of the GAME to add assets to.\n /// @param assetIds The id of the asset to add to GAME.\n /// @param amounts The amount of each asset to add to GAME.\n function _addAssets(\n address from,\n uint256 strgId,\n uint256[] memory assetIds,\n uint256[] memory amounts,\n bool isERC1155\n ) internal {\n if (assetIds.length == 0) {\n return;\n }\n require(!isERC1155 || assetIds.length == amounts.length, \"INVALID_INPUT_LENGTHS\");\n for (uint256 i = 0; i < assetIds.length; i++) {\n _increaseAmount(strgId, assetIds[i], isERC1155 ? amounts[i] : 1, isERC1155);\n }\n _safeTransferFrom(from, address(this), assetIds, amounts, isERC1155);\n }\n\n /// @notice Remove assets from a GAME.\n /// @param strgId The storageId of the GAME to remove assets from.\n /// @param assetIds An array of asset Ids to remove.\n /// @param values An array of the number of each asset id to remove.\n /// @param to The address to send removed assets to.\n function _removeAssets(\n uint256 strgId,\n uint256[] memory assetIds,\n uint256[] memory values,\n address to,\n bool isERC1155\n ) internal {\n if (assetIds.length == 0) {\n return;\n }\n require(assetIds.length == values.length && assetIds.length != 0, \"INVALID_INPUT_LENGTHS\");\n for (uint256 i = 0; i < assetIds.length; i++) {\n _decreaseAmount(strgId, assetIds[i], isERC1155 ? values[i] : 1, isERC1155);\n }\n _safeTransferFrom(address(this), to, assetIds, values, isERC1155);\n }\n\n /// @dev See burn / burnFrom.\n function _burnGame(address from, uint256 gameId) internal {\n uint256 storageId = _storageId(gameId);\n (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(storageId);\n address msgSender = _msgSender();\n require(\n msgSender == owner ||\n (operatorEnabled && _operators[storageId] == msgSender) ||\n _superOperators[msgSender] ||\n _operatorsForAll[from][msgSender],\n \"UNAUTHORIZED_BURN\"\n );\n\n delete _metaData[storageId];\n _creatorship[gameId] = address(0);\n _burn(from, owner, gameId);\n }\n\n /// @dev See recoverAssets.\n function _recoverAssets(\n address from,\n address to,\n uint256 gameId,\n uint256[] memory assetIds,\n bool isERC1155\n ) internal notToZero(to) notToThis(to) {\n require(_ownerOf(gameId) == address(0), \"ONLY_FROM_BURNED_TOKEN\");\n uint256 storageId = _storageId(gameId);\n require(from == _msgSender(), \"INVALID_RECOVERY\");\n _check_withdrawal_authorized(from, gameId);\n require(assetIds.length > 0, \"WITHDRAWAL_COMPLETE\");\n uint256[] memory values = getAndClearAmounts(storageId, assetIds, isERC1155);\n _safeTransferFrom(address(this), to, assetIds, values, isERC1155);\n GameData memory recovery;\n if (isERC1155) {\n recovery.gameData1155.assetIdsToRemove = assetIds;\n recovery.gameData1155.assetAmountsToRemove = values;\n } else {\n recovery.gameData721.assetIdsToRemove = assetIds;\n }\n emit GameTokenUpdated(gameId, 0, recovery);\n }\n\n /// @dev Create a new gameId and associate it with an owner.\n /// @param from The address of one creating the game.\n /// @param to The address of the Game owner.\n /// @param subId The id to use when generating the new GameId.\n /// @param version The version number part of the gameId.\n /// @param isCreation Whether this is a brand new GAME (as opposed to an update).\n /// @return gameId The newly created gameId.\n function _mintGame(\n address from,\n address to,\n uint64 subId,\n uint16 version,\n bool isCreation\n ) internal returns (uint256 gameId, uint256 strgId) {\n uint16 idVersion;\n if (isCreation) {\n idVersion = 1;\n gameId = _generateTokenId(from, subId, _chainIndex, idVersion);\n strgId = _storageId(gameId);\n require(_owners[strgId] == 0, \"STORAGE_ID_REUSE_FORBIDDEN\");\n } else {\n idVersion = version;\n gameId = _generateTokenId(from, subId, _chainIndex, idVersion);\n strgId = _storageId(gameId);\n }\n\n _owners[strgId] = (uint256(idVersion) << 200) + uint256(uint160(to));\n _numNFTPerAddress[to]++;\n emit Transfer(address(0), to, gameId);\n }\n\n /// @dev Allow token owner to set game editors.\n /// @param gameCreator The address of a GAME creator,\n /// @param editor The address of the editor to set.\n /// @param isEditor Add or remove the ability to edit.\n function _setGameEditor(\n address gameCreator,\n address editor,\n bool isEditor\n ) internal {\n emit GameEditorSet(gameCreator, editor, isEditor);\n _gameEditors[gameCreator][editor] = isEditor;\n }\n\n /// @dev Bumps the version number of a game token, buring the previous\n /// version and minting a new one.\n /// @param from The address of the GAME token owner.\n /// @param gameId The Game token to bump the version of.\n /// @return The new gameId.\n function _bumpGameVersion(address from, uint256 gameId) internal returns (uint256) {\n address originalCreator = address(uint160(gameId / CREATOR_OFFSET_MULTIPLIER));\n uint64 subId = uint64(gameId / SUBID_MULTIPLIER);\n uint16 version = uint16(gameId);\n version++;\n address owner = _ownerOf(gameId);\n if (from == owner) {\n // caller is owner or metaTx on owner's behalf\n _burn(from, owner, gameId);\n } else if (_gameEditors[owner][from]) {\n // caller is editor or metaTx on editor's behalf, so we need to pass owner\n // instead of from or _burn will fail\n _burn(owner, owner, gameId);\n }\n (uint256 newId, ) = _mintGame(originalCreator, owner, subId, version, false);\n address newOwner = _ownerOf(newId);\n assert(owner == newOwner);\n return newId;\n }\n\n /// @dev Get the a full URI string for a given hash + gameId.\n /// @param hash The 32 byte IPFS hash.\n /// @return The URI string.\n function _toFullURI(bytes32 hash) internal pure override returns (string memory) {\n return string(abi.encodePacked(\"ipfs://bafybei\", hash2base32(hash), \"/\", \"game.json\"));\n }\n}\n" + }, + "src/solc_0.8/Game/GameMinter.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"./GameBaseToken.sol\";\nimport \"../common/interfaces/IGameMinter.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport \"../common/BaseWithStorage/ERC2771Handler.sol\";\n\ncontract GameMinter is ERC2771Handler, IGameMinter {\n /////////////////////////////// Data //////////////////////////////\n\n GameBaseToken internal immutable _gameToken;\n // @todo confirm actual fees\n uint256 internal immutable _gameMintingFee;\n uint256 internal immutable _gameUpdateFee;\n address internal immutable _feeBeneficiary;\n IERC20 internal immutable _sand;\n\n /////////////////////////////// Functions /////////////////////////\n\n constructor(\n GameBaseToken gameTokenContract,\n address trustedForwarder,\n uint256 gameMintingFee,\n uint256 gameUpdateFee,\n address feeBeneficiary,\n IERC20 sand\n ) {\n _gameToken = gameTokenContract;\n _gameMintingFee = gameMintingFee;\n _gameUpdateFee = gameUpdateFee;\n _feeBeneficiary = feeBeneficiary;\n _sand = sand;\n ERC2771Handler.__ERC2771Handler_initialize(trustedForwarder);\n }\n\n /// @notice Function to create a new GAME token\n /// @param to The address who will be assigned ownership of this game.\n /// @param creation The struct containing ids & ammounts of assets to add to this game,\n /// along with the uri to set.\n /// @param editor The address to allow to edit (can also be set later).\n /// @param subId A random id created on the backend.\n /// @return gameId The id of the new GAME token (erc721)\n function createGame(\n address to,\n GameBaseToken.GameData calldata creation,\n address editor,\n uint64 subId\n ) external override returns (uint256 gameId) {\n address msgSender = _msgSender();\n _chargeSand(msgSender, _gameMintingFee);\n return _gameToken.createGame(msgSender, to, creation, editor, subId);\n }\n\n /// @notice Update an existing GAME token.This actually burns old token\n /// and mints new token with same basId & incremented version.\n /// @param gameId The current id of the GAME token.\n /// @param update The values to use for the update.\n /// @return newId The new gameId.\n function updateGame(uint256 gameId, GameBaseToken.GameData memory update)\n external\n override\n returns (uint256 newId)\n {\n address gameOwner = _gameToken.ownerOf(gameId);\n address msgSender = _msgSender();\n require(msgSender == gameOwner || _gameToken.isGameEditor(gameOwner, msgSender), \"AUTH_ACCESS_DENIED\");\n _chargeSand(msgSender, _gameUpdateFee);\n return _gameToken.updateGame(msgSender, gameId, update);\n }\n\n /// @dev Charge a fee in Sand if conditions are met.\n /// @param from The address responsible for paying the fee.\n /// @param sandFee The fee that applies to the current operation (create || update).\n function _chargeSand(address from, uint256 sandFee) internal {\n if (_feeBeneficiary != address(0) && sandFee != 0) {\n _sand.transferFrom(from, _feeBeneficiary, sandFee);\n }\n }\n}\n" + }, + "src/solc_0.8/Game/GameV1.sol": { + "content": "//SPDX-License-Identifier: MIT\n\n/* solhint-disable no-empty-blocks */\n\npragma solidity 0.8.2;\nimport \"./GameBaseToken.sol\";\n\ncontract GameV1 is GameBaseToken {}\n" + }, + "src/solc_0.8/OperatorFilterer/contracts/OperatorFilterRegistrant.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport {IOperatorFilterRegistry} from \"../interfaces/IOperatorFilterRegistry.sol\";\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\n/// @title OperatorFilterSubription\n/// @notice This contract is ment to register and copy the default subscription of the openSea for the operator filter and our Token contract are supposed to subscribe to This contract on openSea operator filter registry\n/// @custom:experimental This is an experimental contract. There could be future changes according to the change in the requirements\ncontract OperatorFilterSubscription is OwnableUpgradeable {\n address public constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);\n\n IOperatorFilterRegistry public constant operatorFilterRegistry =\n IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);\n\n function initialize() external initializer {\n // Subscribe and copy the entries of the Default subscription list of open sea.\n if (address(operatorFilterRegistry).code.length > 0) {\n operatorFilterRegistry.registerAndCopyEntries(address(this), DEFAULT_SUBSCRIPTION);\n }\n __Ownable_init();\n }\n}\n" + }, + "src/solc_0.8/OperatorFilterer/contracts/upgradeable/DefaultOperatorFiltererUpgradeable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {OperatorFiltererUpgradeable} from \"./OperatorFiltererUpgradeable.sol\";\n\n/// @title DefaultOperatorFiltererUpgradeable\n/// @notice This contract is ment to be imported in Token contracts to subscribe to the default Black list of Opensea.\nabstract contract DefaultOperatorFiltererUpgradeable is OperatorFiltererUpgradeable {\n // Registration address of the default subscription list.\n address public constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);\n\n function __DefaultOperatorFilterer_init(bool subscribe) internal onlyInitializing {\n __OperatorFilterer_init(DEFAULT_SUBSCRIPTION, subscribe);\n }\n}\n" + }, + "src/solc_0.8/OperatorFilterer/contracts/upgradeable/OperatorFiltererUpgradeable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IOperatorFilterRegistry} from \"../../interfaces/IOperatorFilterRegistry.sol\";\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\n///@title OperatorFiltererUpgradeable\n///@author The Sandbox\n///@notice This contract would subscibe or copy or just to the subscription provided or just register to default subscription list\n///@dev This contract is the upgradeable version of the OpenSea implementation https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/OperatorFilterer.sol and adapted to the 0.5.9 solidity version\nabstract contract OperatorFiltererUpgradeable is ContextUpgradeable {\n IOperatorFilterRegistry public operatorFilterRegistry;\n\n event ContractRegistered(address indexed subscriptionOrRegistrant, bool subscribe);\n\n function __OperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe) internal onlyInitializing {\n _register(subscriptionOrRegistrantToCopy, subscribe);\n }\n\n /**\n * @notice Register this contract into the registry\n * @param subscriptionOrRegistrantToCopy address to subscribe or copy entries from\n * @param subscribe should it subscribe\n */\n function _register(address subscriptionOrRegistrantToCopy, bool subscribe) internal {\n if (address(operatorFilterRegistry).code.length > 0) {\n if (!operatorFilterRegistry.isRegistered(address(this))) {\n if (subscribe) {\n operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);\n } else {\n if (subscriptionOrRegistrantToCopy != address(0)) {\n operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);\n } else {\n operatorFilterRegistry.register(address(this));\n }\n }\n }\n }\n emit ContractRegistered(subscriptionOrRegistrantToCopy, subscribe);\n }\n\n modifier onlyAllowedOperator(address from) virtual {\n // Check registry code length to facilitate testing in environments without a deployed registry.\n if (address(operatorFilterRegistry).code.length > 0) {\n // Allow spending tokens from addresses with balance\n // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred\n // from an EOA.\n if (from == _msgSender()) {\n _;\n return;\n }\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), _msgSender())) {\n revert(\"Operator Not Allowed\");\n }\n }\n _;\n }\n\n modifier onlyAllowedOperatorApproval(address operator) virtual {\n // Check registry code length to facilitate testing in environments without a deployed registry.\n if (address(operatorFilterRegistry).code.length > 0) {\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), operator)) {\n revert(\"Operator Not Allowed\");\n }\n }\n _;\n }\n}\n" + }, + "src/solc_0.8/OperatorFilterer/interfaces/IOperatorFilterRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\n/**\n * @title IOperatorFilterRegistry\n * @author OpenSea\n * @notice Interface of the operator filter registry\n * @dev This interface comes from OpenSea https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/IOperatorFilterRegistry.sol and adapted to the 0.5.9 solidity version\n */\ninterface IOperatorFilterRegistry {\n /**\n * @notice Check if the operator is allowed for the given registrant\n * @param registrant address of the registrant\n * @param operator operator address to check\n * @return is the operator allowed\n */\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\n\n /**\n * @notice Register a new address\n * @param registrant address to register\n */\n function register(address registrant) external;\n\n /**\n * @notice Register a new address & subscribe to an address\n * @param registrant address of the registrant\n * @param subscription address where the registrant is subscribed to\n */\n function registerAndSubscribe(address registrant, address subscription) external;\n\n /**\n * @notice Register and copy entries of another registrant\n * @param registrant address of the registrant\n * @param registrantToCopy address to copy from\n */\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\n\n /**\n * @notice update the operator for a registrant\n * @param registrant address of the registrant\n * @param operator operator to be updated\n * @param filtered is it filtered\n */\n function updateOperator(\n address registrant,\n address operator,\n bool filtered\n ) external;\n\n /**\n * @notice Update operators for a registrant\n * @param registrant address of the registrant\n * @param operators addresses of the operators\n * @param filtered is it filtered\n */\n function updateOperators(\n address registrant,\n address[] calldata operators,\n bool filtered\n ) external;\n\n /**\n * @notice Update code hash\n * @param registrant address of the registrant\n * @param codehash code hash\n * @param filtered is it filtered\n */\n function updateCodeHash(\n address registrant,\n bytes32 codehash,\n bool filtered\n ) external;\n\n /**\n * @notice Update code hashes\n * @param registrant address of the registrant\n * @param codeHashes code hashes\n * @param filtered is it filtered\n */\n function updateCodeHashes(\n address registrant,\n bytes32[] calldata codeHashes,\n bool filtered\n ) external;\n\n /**\n * @notice Subscribe a registrant\n * @param registrant address of the registrant\n * @param registrantToSubscribe address to subscribe with\n */\n function subscribe(address registrant, address registrantToSubscribe) external;\n\n /**\n * @notice Unsubscribe a registrant\n * @param registrant address of the registrant\n * @param copyExistingEntries copy existing entries\n */\n function unsubscribe(address registrant, bool copyExistingEntries) external;\n\n /**\n * @notice Get the subscription of an address\n * @param addr address to check\n * @return registrant the registrant address\n */\n function subscriptionOf(address addr) external returns (address registrant);\n\n /**\n * @notice Get the subscribers of the registrant\n * @param registrant address of the registrant\n * @return the subscribers addresses\n */\n function subscribers(address registrant) external returns (address[] memory);\n\n /**\n * @notice Get a specific subscriber\n * @param registrant address of the registrant\n * @param index index to check\n * @return the ith subscriber of the registrant\n */\n function subscriberAt(address registrant, uint256 index) external returns (address);\n\n /**\n * @notice Copy the entries of a registrant\n * @param registrant address of the registrant\n * @param registrantToCopy address to copy\n */\n function copyEntriesOf(address registrant, address registrantToCopy) external;\n\n /**\n * @notice Is a registrant filtered\n * @param registrant address of the registrant\n * @param operator operator address to check\n * @return is it filtered\n */\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\n\n /**\n * @notice Is the code hash of an operator filtered\n * @param registrant address of the registrant\n * @param operatorWithCode operator address to check\n * @return is it filtered\n */\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\n\n /**\n * @notice Is the code hash filtered\n * @param registrant address of the registrant\n * @param codeHash code hash\n * @return is it filtered\n */\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\n\n /**\n * @notice Get the filtered operators\n * @param addr address to check\n * @return filtered operators\n */\n function filteredOperators(address addr) external returns (address[] memory);\n\n /**\n * @notice Get the filtered code hashes\n * @param addr address to check\n * @return filtered code hashes\n */\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\n\n /**\n * @notice Get a specific operator\n * @param registrant address of the registrant\n * @param index index to check\n * @return address of the operator\n */\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\n\n /**\n * @notice Get the ith filtered code hash\n * @param registrant address of the registrant\n * @param index index to check\n * @return the code hash\n */\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\n\n /**\n * @notice Is the address registered\n * @param addr address to check\n * @return is it registered\n */\n function isRegistered(address addr) external returns (bool);\n\n /**\n * @notice Get the code hash for this address\n * @param addr address to check\n * @return the code hash\n */\n function codeHashOf(address addr) external returns (bytes32);\n}\n" + }, + "src/solc_0.8/permit/Permit.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../common/interfaces/IERC20Extended.sol\";\nimport \"../common/BaseWithStorage/WithPermit.sol\";\n\n/// @title Permit contract\n/// @notice This contract manages approvals of SAND via signature\ncontract Permit is WithPermit {\n IERC20Extended internal immutable _sand;\n\n constructor(IERC20Extended sandContractAddress) {\n _sand = sandContractAddress;\n }\n\n /// @notice Permit the expenditure of SAND by a nominated spender.\n /// @param owner The owner of the ERC20 tokens.\n /// @param spender The nominated spender of the ERC20 tokens.\n /// @param value The value (allowance) of the ERC20 tokens that the nominated.\n /// spender will be allowed to spend.\n /// @param deadline The deadline for granting permission to the spender.\n /// @param v The final 1 byte of signature.\n /// @param r The first 32 bytes of signature.\n /// @param s The second 32 bytes of signature.\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public override {\n checkApproveFor(owner, spender, value, deadline, v, r, s);\n _sand.approveFor(owner, spender, value);\n }\n}\n" + }, + "src/solc_0.8/polygon/child/asset/MockPolygonAssetERC1155Tunnel.sol": { + "content": "/* solhint-disable no-empty-blocks */\n// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./PolygonAssetERC1155Tunnel.sol\";\n\ncontract MockPolygonAssetERC1155Tunnel is PolygonAssetERC1155Tunnel {\n function init(\n address _fxChild,\n IPolygonAssetERC1155 _childToken,\n address trustedForwarder,\n uint256 _maxTransferLimit\n ) external {\n PolygonAssetERC1155Tunnel.initialize(_fxChild, _childToken, trustedForwarder, _maxTransferLimit);\n }\n}\n" + }, + "src/solc_0.8/polygon/child/asset/PolygonAssetERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\nimport {AssetBaseERC1155, ERC1155ERC721Helper, IAssetERC721} from \"../../../assetERC1155/AssetBaseERC1155.sol\";\nimport {\n OperatorFiltererUpgradeable\n} from \"../../../OperatorFilterer/contracts/upgradeable/OperatorFiltererUpgradeable.sol\";\nimport {IChildToken} from \"../../../common/interfaces/pos-portal/child/IChildToken.sol\";\n\n/// @title This contract is for AssetERC1155 which can be minted by a minter role.\n/// @dev AssetERC1155 will be minted only on L2 and can be transferred to L1 and not minted on L1.\n/// @dev This contract supports meta transactions.\n/// @dev This contract is final, don't inherit from it.\ncontract PolygonAssetERC1155 is AssetBaseERC1155, ContextUpgradeable, OperatorFiltererUpgradeable, IChildToken {\n address public _childChainManager;\n\n function initialize(\n address trustedForwarder,\n address admin,\n address bouncerAdmin,\n address childChainManager,\n IAssetERC721 polygonAssetERC721,\n uint8 chainIndex,\n address subscription\n ) external initializer {\n require(address(childChainManager) != address(0), \"PolygonAssetERC1155Tunnel: childChainManager can't be zero\");\n init(trustedForwarder, admin, bouncerAdmin, polygonAssetERC721, chainIndex);\n _childChainManager = childChainManager;\n __OperatorFilterer_init(subscription, true);\n }\n\n /// @notice Mint a token type for `creator` on slot `packId`.\n /// @dev For this function it is not required to provide data.\n /// @param creator address of the creator of the token.\n /// @param packId unique packId for that token.\n /// @param hash hash of an IPFS cidv1 folder that contains the metadata of the token type in the file 0.json.\n /// @param supply number of tokens minted for that token type.\n /// @param owner address that will receive the tokens.\n /// @param data extra data to accompany the minting call.\n /// @return id the id of the newly minted token type.\n function mint(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256 supply,\n address owner,\n bytes calldata data\n ) external returns (uint256 id) {\n require(hash != 0, \"HASH==0\");\n require(isBouncer(_msgSender()), \"!BOUNCER\");\n require(owner != address(0), \"TO==0\");\n id = _generateTokenId(creator, supply, packId, supply == 1 ? 0 : 1, 0);\n uint256 uriId = id & ERC1155ERC721Helper.URI_ID;\n require(uint256(_metadataHash[uriId]) == 0, \"ID_TAKEN\");\n _metadataHash[uriId] = hash;\n _mint(_msgSender(), owner, id, supply, data);\n }\n\n /// @notice Creates `amount` tokens of token type `id`, and assigns them to `account`.\n /// @dev Should be used only by PolygonAssetERC1155Tunnel.\n /// @dev This function can be called when the token ID exists on another layer.\n /// @dev Encoded bytes32 metadata hash must be provided as data.\n /// @param owner address that will receive the tokens.\n /// @param id the id of the newly minted token.\n /// @param supply number of tokens minted for that token type.\n /// @param data token metadata.\n function mint(\n address owner,\n uint256 id,\n uint256 supply,\n bytes calldata data\n ) external {\n require(isBouncer(_msgSender()), \"!BOUNCER\");\n require(data.length > 0, \"METADATA_MISSING\");\n require(owner != address(0), \"TO==0\");\n uint256 uriId = id & ERC1155ERC721Helper.URI_ID;\n require(uint256(_metadataHash[uriId]) == 0, \"ID_TAKEN\");\n _metadataHash[uriId] = abi.decode(data, (bytes32));\n _mint(_msgSender(), owner, id, supply, data);\n }\n\n /// @notice Mint multiple token types for `creator` on slot `packId`.\n /// @dev For this function it is not required to provide data.\n /// @param creator address of the creator of the tokens.\n /// @param packId unique packId for the tokens.\n /// @param hash hash of an IPFS cidv1 folder that contains the metadata of each token type in the files: 0.json, 1.json, 2.json, etc...\n /// @param supplies number of tokens minted for each token type.\n /// @param rarityPack rarity power of each token types packed into 2 bits each.\n /// @param owner address that will receive the tokens.\n /// @param data extra data to accompany the minting call.\n /// @return ids the ids of each newly minted token types.\n function mintMultiple(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256[] calldata supplies,\n bytes calldata rarityPack,\n address owner,\n bytes calldata data\n ) external returns (uint256[] memory ids) {\n require(hash != 0, \"HASH==0\");\n require(isBouncer(_msgSender()), \"!BOUNCER\");\n require(owner != address(0), \"TO==0\");\n ids = _allocateIds(creator, supplies, rarityPack, packId, hash);\n _mintBatch(owner, ids, supplies, data);\n }\n\n /// @notice function to be called by tunnel to mint deficit of minted tokens\n /// @dev This mint calls for add instead of replace in packedTokenBalance\n /// @param account address of the ownerof tokens.\n /// @param id id of the token to be minted.\n /// @param amount quantity of the token to be minted.\n function mintDeficit(\n address account,\n uint256 id,\n uint256 amount\n ) external {\n require(isBouncer(_msgSender()), \"!BOUNCER\");\n _mintDeficit(account, id, amount);\n }\n\n /// @notice Burns `amount` tokens of type `id`.\n /// @param id token type which will be burnt.\n /// @param amount amount of token to burn.\n function burn(uint256 id, uint256 amount) external {\n _burn(_msgSender(), id, amount);\n }\n\n /// @notice Burns `amount` tokens of type `id` from `from`.\n /// @param from address whose token is to be burnt.\n /// @param id token type which will be burnt.\n /// @param amount amount of token to burn.\n function burnFrom(\n address from,\n uint256 id,\n uint256 amount\n ) external {\n require(from == _msgSender() || isApprovedForAll(from, _msgSender()), \"!AUTHORIZED\");\n _burn(from, id, amount);\n }\n\n /// @notice This function is called when a token is deposited to the root chain.\n /// @dev Should be callable only by ChildChainManager.\n /// @dev Should handle deposit by minting the required tokenId(s) for user.\n /// @dev Minting can also be done by other functions.\n /// @param user user address for whom deposit is being done.\n /// @param depositData abi encoded tokenIds. Batch deposit also supported.\n function deposit(address user, bytes calldata depositData) external override {\n require(_msgSender() == _childChainManager, \"!DEPOSITOR\");\n require(user != address(0), \"INVALID_DEPOSIT_USER\");\n (uint256[] memory ids, uint256[] memory amounts, bytes memory data) =\n abi.decode(depositData, (uint256[], uint256[], bytes));\n\n _mintBatches(user, ids, amounts, data);\n }\n\n /// @notice called when user wants to withdraw single token back to root chain.\n /// @dev Should burn user's tokens. This transaction will be verified when exiting on root chain.\n /// @param id id to withdraw.\n /// @param amount amount to withdraw.\n function withdrawSingle(uint256 id, uint256 amount) external {\n _burn(_msgSender(), id, amount);\n }\n\n /// @notice called when user wants to batch withdraw tokens back to root chain.\n /// @dev Should burn user's tokens. This transaction will be verified when exiting on root chain.\n /// @param ids ids to withdraw.\n /// @param amounts amounts to withdraw.\n function withdrawBatch(uint256[] calldata ids, uint256[] calldata amounts) external {\n _burnBatch(_msgSender(), ids, amounts);\n }\n\n /// @notice gets the metadata hash set for the and asset with id \"id\"\n /// @param id the id of the asset whose metadata hash has to be returned\n function metadataHash(uint256 id) external view returns (bytes32) {\n return _metadataHash[id & ERC1155ERC721Helper.URI_ID];\n }\n\n function _allocateIds(\n address creator,\n uint256[] memory supplies,\n bytes memory rarityPack,\n uint40 packId,\n bytes32 hash\n ) internal returns (uint256[] memory ids) {\n require(supplies.length > 0, \"SUPPLIES<=0\");\n require(supplies.length <= ERC1155ERC721Helper.MAX_PACK_SIZE, \"BATCH_TOO_BIG\");\n ids = _generateTokenIds(creator, supplies, packId);\n\n require(uint256(_metadataHash[ids[0] & ERC1155ERC721Helper.URI_ID]) == 0, \"ID_TAKEN\");\n _metadataHash[ids[0] & ERC1155ERC721Helper.URI_ID] = hash;\n _rarityPacks[ids[0] & ERC1155ERC721Helper.URI_ID] = rarityPack;\n }\n\n function _generateTokenIds(\n address creator,\n uint256[] memory supplies,\n uint40 packId\n ) internal view returns (uint256[] memory) {\n uint16 numTokenTypes = uint16(supplies.length);\n uint256[] memory ids = new uint256[](numTokenTypes);\n uint16 numNFTs = 0;\n for (uint16 i = 0; i < numTokenTypes; i++) {\n if (numNFTs == 0) {\n if (supplies[i] == 1) {\n numNFTs = uint16(numTokenTypes - i);\n }\n } else {\n require(supplies[i] == 1, \"NFTS_MUST_BE_LAST\");\n }\n }\n uint16 numFTs = numTokenTypes - numNFTs;\n for (uint16 i = 0; i < numTokenTypes; i++) {\n ids[i] = _generateTokenId(creator, supplies[i], packId, numFTs, i);\n }\n return ids;\n }\n\n function _generateTokenId(\n address creator,\n uint256 supply,\n uint40 packId,\n uint16 numFTs,\n uint16 packIndex\n ) internal view returns (uint256) {\n require(supply > 0 && supply <= ERC1155ERC721Helper.MAX_SUPPLY, \"SUPPLY_OUT_OF_BOUNDS\");\n require(numFTs >= 0 && numFTs <= ERC1155ERC721Helper.MAX_NUM_FT, \"NUM_FT_OUT_OF_BOUNDS\");\n return\n uint256(uint160(creator)) *\n ERC1155ERC721Helper.CREATOR_OFFSET_MULTIPLIER + // CREATOR uint160\n (supply == 1 ? uint256(1) * ERC1155ERC721Helper.IS_NFT_OFFSET_MULTIPLIER : 0) + // minted as NFT(1)|FT(0), 1 bit\n uint256(_chainIndex) *\n ERC1155ERC721Helper.CHAIN_INDEX_OFFSET_MULTIPLIER + // mainnet = 0, polygon = 1, uint8\n uint256(packId) *\n ERC1155ERC721Helper.PACK_ID_OFFSET_MULTIPLIER + // packId (unique pack), uint40\n numFTs *\n ERC1155ERC721Helper.PACK_NUM_FT_TYPES_OFFSET_MULTIPLIER + // number of fungible token in the pack, 12 bits\n packIndex; // packIndex (position in the pack), 11 bits\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param value amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override onlyAllowedOperator(from) {\n super._safeTransferFrom(from, to, id, value, data);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @dev call data should be optimized to order ids so packedBalance can be used efficiently.\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param values amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override onlyAllowedOperator(from) {\n super._safeBatchTransferFrom(from, to, ids, values, data);\n }\n\n /// @notice Enable or disable approval for `operator` to manage all `sender`'s tokens.\n /// @dev used for Meta Transaction (from metaTransactionContract).\n /// @param sender address which grant approval.\n /// @param operator address which will be granted rights to transfer all token owned by `sender`.\n /// @param approved whether to approve or revoke.\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) external onlyAllowedOperatorApproval(operator) {\n super._setApprovalForAll(sender, operator, approved);\n }\n\n /// @notice Enable or disable approval for `operator` to manage all of the caller's tokens.\n /// @param operator address which will be granted rights to transfer all tokens of the caller.\n /// @param approved whether to approve or revoke\n function setApprovalForAll(address operator, bool approved)\n external\n override\n onlyAllowedOperatorApproval(operator)\n {\n super._setApprovalForAll(_msgSender(), operator, approved);\n }\n\n function _msgSender()\n internal\n view\n virtual\n override(ContextUpgradeable, AssetBaseERC1155)\n returns (address sender)\n {\n return AssetBaseERC1155._msgSender();\n }\n\n function _msgData() internal view virtual override(ContextUpgradeable, AssetBaseERC1155) returns (bytes calldata) {\n return AssetBaseERC1155._msgData();\n }\n}\n" + }, + "src/solc_0.8/polygon/child/asset/PolygonAssetERC1155Tunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../../common/fx-portal/FxBaseChildTunnelUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\n\nimport \"../../../common/interfaces/IPolygonAssetERC1155.sol\";\nimport \"../../common/ERC1155Receiver.sol\";\nimport \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\n\nimport \"./PolygonAssetERC1155.sol\";\n\n/// @title ASSETERC1155 bridge on L2\ncontract PolygonAssetERC1155Tunnel is\n Initializable,\n FxBaseChildTunnelUpgradeable,\n ERC1155Receiver,\n ERC2771Handler,\n OwnableUpgradeable,\n PausableUpgradeable\n{\n IPolygonAssetERC1155 public childToken;\n uint256 public maxTransferLimit;\n bool private fetchingAssets = false;\n\n event SetTransferLimit(uint256 limit);\n event Deposit(address user, uint256 id, uint256 value, bytes data);\n event Withdraw(address user, uint256 id, uint256 value, bytes data);\n\n // solhint-disable-next-line no-empty-blocks\n constructor() initializer {}\n\n function initialize(\n address _fxChild,\n IPolygonAssetERC1155 _childToken,\n address trustedForwarder,\n uint256 _maxTransferLimit\n ) public initializer {\n require(address(_childToken) != address(0), \"PolygonAssetERC1155Tunnel: _childToken can't be zero\");\n childToken = _childToken;\n maxTransferLimit = _maxTransferLimit;\n __Ownable_init();\n __Pausable_init();\n __ERC2771Handler_initialize(trustedForwarder);\n __FxBaseChildTunnelUpgradeable_initialize(_fxChild);\n }\n\n function setTransferLimit(uint256 _maxTransferLimit) external onlyOwner {\n maxTransferLimit = _maxTransferLimit;\n emit SetTransferLimit(_maxTransferLimit);\n }\n\n function batchWithdrawToRoot(\n address to,\n uint256[] calldata ids,\n uint256[] calldata values\n ) external whenNotPaused {\n require(to != address(0), \"PolygonAssetERC1155Tunnel: to can't be zero\");\n require(ids.length > 0, \"MISSING_TOKEN_IDS\");\n require(ids.length < maxTransferLimit, \"EXCEEDS_TRANSFER_LIMIT\");\n bytes32[] memory metadataHashes = new bytes32[](ids.length);\n fetchingAssets = true;\n for (uint256 i = 0; i < ids.length; i++) {\n bytes32 metadataHash = childToken.metadataHash(ids[i]);\n metadataHashes[i] = metadataHash;\n bytes memory metadata = abi.encode(metadataHash);\n childToken.safeTransferFrom(_msgSender(), address(this), ids[i], values[i], abi.encode(metadataHash));\n emit Withdraw(to, ids[i], values[i], metadata);\n }\n fetchingAssets = false;\n _sendMessageToRoot(abi.encode(to, ids, values, abi.encode(metadataHashes)));\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n }\n\n /// @dev Pauses all token transfers across bridge\n function pause() external onlyOwner {\n _pause();\n }\n\n /// @dev Unpauses all token transfers across bridge\n function unpause() external onlyOwner {\n _unpause();\n }\n\n function _processMessageFromRoot(\n uint256, /* stateId */\n address sender,\n bytes memory data\n ) internal override validateSender(sender) {\n _syncDeposit(data);\n }\n\n function _syncDeposit(bytes memory syncData) internal {\n (address to, uint256[] memory ids, uint256[] memory values, bytes memory data) =\n abi.decode(syncData, (address, uint256[], uint256[], bytes));\n bytes32[] memory metadataHashes = abi.decode(data, (bytes32[]));\n for (uint256 i = 0; i < ids.length; i++) {\n bytes memory metadata = abi.encode(metadataHashes[i]);\n if (childToken.doesHashExist(ids[i])) {\n _depositMinted(to, ids[i], values[i], metadata);\n } else {\n childToken.mint(to, ids[i], values[i], metadata);\n }\n emit Deposit(to, ids[i], values[i], metadata);\n }\n }\n\n function _depositMinted(\n address to,\n uint256 id,\n uint256 value,\n bytes memory data\n ) internal {\n uint256 balance = childToken.balanceOf(address(this), id);\n if (balance >= value) {\n childToken.safeTransferFrom(address(this), to, id, value, data);\n } else {\n if (balance > 0) childToken.safeTransferFrom(address(this), to, id, balance, data);\n childToken.mintDeficit(to, id, (value - balance));\n }\n }\n\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n\n function onERC1155Received(\n address, /*_operator*/\n address, /*_from*/\n uint256, /*_id*/\n uint256, /*_value*/\n bytes calldata /*_data*/\n ) external view override returns (bytes4) {\n require(fetchingAssets == true, \"PolygonAssetERC1155Tunnel: can't directly send Assets\");\n return 0xf23a6e61; //bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))\n }\n\n function onERC1155BatchReceived(\n address, /*_operator*/\n address, /*_from*/\n uint256[] calldata, /*_ids*/\n uint256[] calldata, /*_values*/\n bytes calldata /*_data*/\n ) external view override returns (bytes4) {\n require(fetchingAssets == true, \"PolygonAssetERC1155Tunnel: can't directly send Assets\");\n return 0xbc197c81; //bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))\n }\n\n function supportsInterface(bytes4 interfaceId) external pure override returns (bool) {\n return\n interfaceId == 0x4e2312e0 || // ERC1155Receiver\n interfaceId == 0x01ffc9a7; // ERC165\n }\n}\n" + }, + "src/solc_0.8/polygon/child/asset/PolygonAssetERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\nimport {BaseERC721} from \"../../../assetERC721/BaseERC721.sol\";\nimport {IPolygonAssetERC721} from \"../../../common/interfaces/IPolygonAssetERC721.sol\";\nimport {IERC721Base} from \"../../../common/interfaces/IERC721Base.sol\";\nimport {\n OperatorFiltererUpgradeable\n} from \"../../../OperatorFilterer/contracts/upgradeable/OperatorFiltererUpgradeable.sol\";\n\n/// @title This contract is for AssetERC721 which can be minted by a minter role.\n/// @dev AssetERC721 will be minted only on L2 and can be transferred to L1 but not minted on L1.\n/// @dev This contract supports meta transactions.\n/// @dev This contract is final, don't inherit from it.\ncontract PolygonAssetERC721 is BaseERC721, IPolygonAssetERC721, OperatorFiltererUpgradeable {\n bytes32 public constant METADATA_ROLE = keccak256(\"METADATA_ROLE\");\n\n /// @notice fulfills the purpose of a constructor in upgradeable contracts\n function initialize(\n address trustedForwarder,\n address admin,\n address subscription\n ) public initializer {\n _setupRole(DEFAULT_ADMIN_ROLE, admin);\n _trustedForwarder = trustedForwarder;\n __ERC721_init(\"Sandbox's ASSETs ERC721\", \"ASSETERC721\");\n __OperatorFilterer_init(subscription, true);\n }\n\n /// @notice Creates a new token for `to`\n /// @dev Minting is only permitted to MINTER_ROLE\n /// @param to The address that will receive a new token\n /// @param id The id of the new token\n function mint(address to, uint256 id) public override(BaseERC721, IERC721Base) onlyRole(MINTER_ROLE) {\n BaseERC721.mint(to, id);\n }\n\n /// @notice Creates a new token for `to`\n /// @dev Minting is only permitted to MINTER_ROLE\n /// @dev Use this function to retain metadata\n /// @param to The address that will receive a new token\n /// @param id The id of the new token\n /// @param data Associated token metadata, which is decoded & used to set the token's metadata hash.\n function mint(\n address to,\n uint256 id,\n bytes calldata data\n ) public override(BaseERC721, IERC721Base) onlyRole(MINTER_ROLE) {\n BaseERC721.mint(to, id, data);\n }\n\n /// @notice Set the metadatahash for a given token id.\n /// @dev The metadata hash for the ERC721 may need to be manually set or overridden.\n /// @param id The token id.\n /// @param uri The full token URI to be used for the token id.\n function setTokenURI(uint256 id, string memory uri) external override onlyRole(METADATA_ROLE) {\n tokenUris[id] = uri;\n }\n\n /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.\n /// @param id The token to get the uri of.\n /// @return URI The token's URI string.\n function tokenURI(uint256 id) public view override(BaseERC721, IPolygonAssetERC721) returns (string memory) {\n require(ownerOf(id) != address(0), \"ZERO_ADDRESS\");\n return tokenUris[id];\n }\n\n /// @notice Query if a contract implements interface `id`.\n /// @param id the interface identifier, as specified in ERC-165.\n /// @return `true` if the contract implements `id`.\n function supportsInterface(bytes4 id) public view override(BaseERC721, IERC721Base) returns (bool) {\n return BaseERC721.supportsInterface(id);\n }\n\n /// @notice Change the address of the trusted forwarder for meta-transactions\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder)\n public\n override(BaseERC721, IERC721Base)\n onlyRole(DEFAULT_ADMIN_ROLE)\n {\n BaseERC721.setTrustedForwarder(trustedForwarder);\n }\n\n /// @notice Set the approval for an operator to manage all the tokens of the sender.\n /// @param from The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param approved The determination of the approval.\n function setApprovalForAllFor(\n address from,\n address operator,\n bool approved\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperatorApproval(operator) {\n BaseERC721.setApprovalForAllFor(from, operator, approved);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param from Address whose token is to be transferred.\n /// @param to Recipient.\n /// @param tokenId The token id to be transferred.\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperator(from) {\n BaseERC721.safeTransferFrom(from, to, tokenId);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n /// @param data Additional data.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperator(from) {\n BaseERC721.safeBatchTransferFrom(from, to, ids, data);\n }\n\n /// @notice Checks if address supplierd is that of an forwarder\n /// @param forwarder the address to be checked\n function isTrustedForwarder(address forwarder) public view override(BaseERC721, IERC721Base) returns (bool) {\n BaseERC721.isTrustedForwarder(forwarder);\n }\n\n /// @notice returns the address of the trusted forwarder\n function getTrustedForwarder() public view override(BaseERC721, IERC721Base) returns (address trustedForwarder) {\n BaseERC721.getTrustedForwarder();\n }\n\n /// @notice checks if the token id has been minted or not\n /// @param tokenId the id to be checked\n function exists(uint256 tokenId) public view override(BaseERC721, IERC721Base) returns (bool) {\n BaseERC721.exists(tokenId);\n }\n\n /// @notice Burns token with given `id`.\n /// @param from Address whose token is to be burned.\n /// @param id Token id which will be burned.\n function burnFrom(address from, uint256 id) public override(BaseERC721, IERC721Base) {\n BaseERC721.burnFrom(from, id);\n }\n\n /// @notice Burns token with given `id`.\n /// @dev Used by default fx-portal tunnel which burns rather than locks.\n /// @param id The id of the token to be burned.\n function burn(uint256 id) public override(BaseERC721, IERC721Base) {\n BaseERC721.burn(id);\n }\n\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperator(from) {\n BaseERC721.batchTransferFrom(from, to, ids);\n }\n\n /// @notice Approve an operator to operate tokens on the sender's behalf.\n /// @param from The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param id The id of the token.\n function approveFor(\n address from,\n address operator,\n uint256 id\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperatorApproval(operator) {\n BaseERC721.approveFor(from, operator, id);\n }\n\n function _msgSender() internal view virtual override(BaseERC721, ContextUpgradeable) returns (address sender) {\n return BaseERC721._msgSender();\n }\n\n function _msgData() internal view virtual override(BaseERC721, ContextUpgradeable) returns (bytes calldata) {\n return BaseERC721._msgData();\n }\n}\n" + }, + "src/solc_0.8/polygon/child/asset/PolygonAssetERC721Tunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../../common/fx-portal/FxBaseChildTunnelUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\n\nimport \"../../../common/interfaces/IPolygonAssetERC721.sol\";\nimport \"../../../common/interfaces/IERC721MandatoryTokenReceiver.sol\";\nimport \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\n\nimport \"./PolygonAssetERC721.sol\";\n\n/// @title ASSETERC721 bridge on L2\ncontract PolygonAssetERC721Tunnel is\n FxBaseChildTunnelUpgradeable,\n IERC165Upgradeable,\n IERC721MandatoryTokenReceiver,\n ERC2771Handler,\n OwnableUpgradeable,\n PausableUpgradeable\n{\n IPolygonAssetERC721 public childToken;\n uint256 public maxTransferLimit;\n bool private fetchingAssets = false;\n\n event SetTransferLimit(uint256 limit);\n event Deposit(address user, uint256 id, bytes data);\n event Withdraw(address user, uint256 id, bytes data);\n\n // solhint-disable-next-line no-empty-blocks\n constructor() initializer {}\n\n function initialize(\n address _fxChild,\n IPolygonAssetERC721 _childToken,\n address _trustedForwarder,\n uint256 _maxTransferLimit\n ) public initializer {\n require(address(_childToken) != address(0), \"PolygonAssetERC721Tunnel: _childToken can't be zero\");\n childToken = _childToken;\n maxTransferLimit = _maxTransferLimit;\n __Ownable_init();\n __Pausable_init();\n __ERC2771Handler_initialize(_trustedForwarder);\n __FxBaseChildTunnelUpgradeable_initialize(_fxChild);\n }\n\n function setTransferLimit(uint256 _maxTransferLimit) external onlyOwner {\n require(_maxTransferLimit > 0, \"PolygonAssetERC721Tunnel: _maxTransferLimit invalid\");\n maxTransferLimit = _maxTransferLimit;\n emit SetTransferLimit(_maxTransferLimit);\n }\n\n function batchWithdrawToRoot(address to, uint256[] calldata ids) external whenNotPaused {\n require(ids.length < maxTransferLimit, \"EXCEEDS_TRANSFER_LIMIT\");\n string[] memory uris = new string[](ids.length);\n fetchingAssets = true;\n for (uint256 i = 0; i < ids.length; i++) {\n // lock the child tokens in this contract\n uint256 id = ids[i];\n string memory uniqueUri = childToken.tokenURI(id);\n uris[i] = uniqueUri;\n bytes memory uniqueUriData = abi.encode(uniqueUri);\n childToken.safeTransferFrom(_msgSender(), address(this), ids[i], uniqueUriData);\n emit Withdraw(to, ids[i], uniqueUriData);\n }\n fetchingAssets = false;\n _sendMessageToRoot(abi.encode(to, ids, uris));\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n }\n\n /// @dev Pauses all token transfers across bridge\n function pause() external onlyOwner {\n _pause();\n }\n\n /// @dev Unpauses all token transfers across bridge\n function unpause() external onlyOwner {\n _unpause();\n }\n\n function _processMessageFromRoot(\n uint256, /* stateId */\n address sender,\n bytes memory data /* encoded message from root tunnel */\n ) internal override validateSender(sender) {\n _syncDeposit(data);\n }\n\n function _syncDeposit(bytes memory syncData) internal {\n (address to, uint256[] memory ids, string[] memory uris) = abi.decode(syncData, (address, uint256[], string[]));\n for (uint256 i = 0; i < ids.length; i++) {\n bytes memory uniqueUriData = abi.encode(uris[i]);\n if (!childToken.exists(ids[i])) childToken.mint(to, ids[i], uniqueUriData);\n else childToken.safeTransferFrom(address(this), to, ids[i], uniqueUriData);\n emit Deposit(to, ids[i], uniqueUriData);\n }\n }\n\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n\n function onERC721Received(\n address, /* operator */\n address, /* from */\n uint256, /* tokenId */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(fetchingAssets == true, \"PolygonAssetERC721Tunnel: can't directly send Assets\");\n return this.onERC721Received.selector;\n }\n\n function onERC721BatchReceived(\n address, /* operator */\n address, /* from */\n uint256[] calldata, /* ids */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(fetchingAssets == true, \"PolygonAssetERC721Tunnel: can't directly send Assets\");\n return this.onERC721BatchReceived.selector;\n }\n\n function supportsInterface(bytes4 interfaceId) external pure override returns (bool) {\n return interfaceId == 0x5e8bf644 || interfaceId == 0x01ffc9a7;\n }\n}\n" + }, + "src/solc_0.8/polygon/child/ChildGameTokenV1.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../Game/GameBaseToken.sol\";\n\n// solhint-disable-next-line no-empty-blocks\ncontract ChildGameTokenV1 is GameBaseToken {\n\n}\n" + }, + "src/solc_0.8/polygon/child/land/PolygonLandBaseToken.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable code-complexity\n\npragma solidity 0.8.2;\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\";\nimport \"../../../common/BaseWithStorage/ERC721BaseTokenV2.sol\";\nimport \"../../../common/interfaces/IPolygonLand.sol\";\n\nabstract contract PolygonLandBaseToken is IPolygonLand, Initializable, ERC721BaseTokenV2 {\n using AddressUpgradeable for address;\n\n uint256 internal constant GRID_SIZE = 408;\n\n uint256 internal constant LAYER = 0xFF00000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_1x1 = 0x0000000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_3x3 = 0x0100000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_6x6 = 0x0200000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_12x12 = 0x0300000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_24x24 = 0x0400000000000000000000000000000000000000000000000000000000000000;\n\n mapping(address => bool) internal _minters;\n\n event Minter(address minter, bool enabled);\n\n modifier validQuad(\n uint256 size,\n uint256 x,\n uint256 y\n ) {\n require(size == 1 || size == 3 || size == 6 || size == 12 || size == 24, \"Invalid size\");\n require(x % size == 0 && y % size == 0, \"Invalid coordinates\");\n require(x <= GRID_SIZE - size && y <= GRID_SIZE - size, \"Out of bounds\");\n\n _;\n }\n\n /**\n * @notice Return the name of the token contract\n * @return The name of the token contract\n */\n function name() public pure returns (string memory) {\n return \"Sandbox's LANDs\";\n }\n\n /**\n * @notice Return the symbol of the token contract\n * @return The symbol of the token contract\n */\n function symbol() public pure returns (string memory) {\n return \"LAND\";\n }\n\n /// @notice total width of the map\n /// @return width\n function width() public pure returns (uint256) {\n return GRID_SIZE;\n }\n\n /// @notice total height of the map\n /// @return height\n function height() public pure returns (uint256) {\n return GRID_SIZE;\n }\n\n /// @notice x coordinate of Land token\n /// @param id tokenId\n /// @return the x coordinates\n function getX(uint256 id) external view returns (uint256) {\n require(_ownerOf(id) != address(0), \"token does not exist\");\n return id % GRID_SIZE;\n }\n\n /// @notice y coordinate of Land token\n /// @param id tokenId\n /// @return the y coordinates\n function getY(uint256 id) external view returns (uint256) {\n require(_ownerOf(id) != address(0), \"token does not exist\");\n return id / GRID_SIZE;\n }\n\n /**\n * @notice Return the URI of a specific token\n * @param id The id of the token\n * @return The URI of the token\n */\n function tokenURI(uint256 id) public view returns (string memory) {\n require(_ownerOf(id) != address(0), \"Id does not exist\");\n return\n string(\n abi.encodePacked(\"https://api.sandbox.game/lands/\", StringsUpgradeable.toString(id), \"/metadata.json\")\n );\n }\n\n /**\n * @notice Check if the contract supports an interface\n * 0x01ffc9a7 is ERC-165\n * 0x80ac58cd is ERC-721\n * 0x5b5e139f is ERC-721 metadata\n * @param id The id of the interface\n * @return True if the interface is supported\n */\n function supportsInterface(bytes4 id) public pure override returns (bool) {\n return id == 0x01ffc9a7 || id == 0x80ac58cd || id == 0x5b5e139f;\n }\n\n /**\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\n * @param user The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintQuad(\n address user,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) external virtual override {\n require(isMinter(_msgSender()), \"!AUTHORIZED\");\n _mintQuad(user, size, x, y, data);\n }\n\n function _mintQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) internal {\n require(to != address(0), \"to is zero address\");\n require(!exists(size, x, y), \"Already minted\");\n\n uint256 quadId;\n uint256 id = x + y * GRID_SIZE;\n\n if (size == 1) {\n quadId = id;\n } else if (size == 3) {\n quadId = LAYER_3x3 + id;\n } else if (size == 6) {\n quadId = LAYER_6x6 + id;\n } else if (size == 12) {\n quadId = LAYER_12x12 + id;\n } else if (size == 24) {\n quadId = LAYER_24x24 + id;\n }\n\n for (uint256 i = 0; i < size * size; i++) {\n emit Transfer(address(0), to, _idInPath(i, size, x, y));\n }\n\n _owners[quadId] = uint256(uint160(address(to)));\n _numNFTPerAddress[to] += size * size;\n\n _checkBatchReceiverAcceptQuad(_msgSender(), address(0), to, size, x, y, data);\n }\n\n function batchTransferQuad(\n address from,\n address to,\n uint256[] calldata sizes,\n uint256[] calldata xs,\n uint256[] calldata ys,\n bytes calldata data\n ) external override {\n require(from != address(0), \"from is zero address\");\n require(to != address(0), \"can't send to zero address\");\n require(sizes.length == xs.length && xs.length == ys.length, \"invalid data\");\n if (_msgSender() != from) {\n require(\n _operatorsForAll[from][_msgSender()] || _superOperators[_msgSender()],\n \"not authorized to transferMultiQuads\"\n );\n }\n uint256 numTokensTransfered = 0;\n for (uint256 i = 0; i < sizes.length; i++) {\n uint256 size = sizes[i];\n _transferQuad(from, to, size, xs[i], ys[i]);\n numTokensTransfered += size * size;\n }\n _numNFTPerAddress[from] -= numTokensTransfered;\n _numNFTPerAddress[to] += numTokensTransfered;\n\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n uint256[] memory ids = new uint256[](numTokensTransfered);\n uint256 counter = 0;\n for (uint256 j = 0; j < sizes.length; j++) {\n uint256 size = sizes[j];\n for (uint256 i = 0; i < size * size; i++) {\n ids[counter] = _idInPath(i, size, xs[j], ys[j]);\n counter++;\n }\n }\n require(\n _checkOnERC721BatchReceived(_msgSender(), from, to, ids, data),\n \"erc721 batch transfer rejected by to\"\n );\n }\n }\n\n function transferQuad(\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external override {\n require(from != address(0), \"from is zero address\");\n require(to != address(0), \"can't send to zero address\");\n if (_msgSender() != from) {\n require(\n _operatorsForAll[from][_msgSender()] || _superOperators[_msgSender()],\n \"not authorized to transferQuad\"\n );\n }\n _transferQuad(from, to, size, x, y);\n _numNFTPerAddress[from] -= size * size;\n _numNFTPerAddress[to] += size * size;\n\n _checkBatchReceiverAcceptQuad(_msgSender(), from, to, size, x, y, data);\n }\n\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) public override(ILandToken, ERC721BaseTokenV2) {\n super.batchTransferFrom(from, to, ids, data);\n }\n\n function exists(\n uint256 size,\n uint256 x,\n uint256 y\n ) public view override validQuad(size, x, y) returns (bool) {\n if (_owners[LAYER_24x24 + (x / 24) * 24 + ((y / 24) * 24) * GRID_SIZE] != 0) return true;\n uint256 toX = x + size;\n uint256 toY = y + size;\n if (size <= 12) {\n if (_owners[LAYER_12x12 + (x / 12) * 12 + ((y / 12) * 12) * GRID_SIZE] != 0) return true;\n } else {\n for (uint256 x12i = x; x12i < toX; x12i += 12) {\n for (uint256 y12i = y; y12i < toY; y12i += 12) {\n uint256 id12x12 = LAYER_12x12 + x12i + y12i * GRID_SIZE;\n if (_owners[id12x12] != 0) return true;\n }\n }\n }\n\n if (size <= 6) {\n if (_owners[LAYER_6x6 + (x / 6) * 6 + ((y / 6) * 6) * GRID_SIZE] != 0) return true;\n } else {\n for (uint256 x6i = x; x6i < toX; x6i += 6) {\n for (uint256 y6i = y; y6i < toY; y6i += 6) {\n uint256 id6x6 = LAYER_6x6 + x6i + y6i * GRID_SIZE;\n if (_owners[id6x6] != 0) return true;\n }\n }\n }\n\n if (size <= 3) {\n if (_owners[LAYER_3x3 + (x / 3) * 3 + ((y / 3) * 3) * GRID_SIZE] != 0) return true;\n } else {\n for (uint256 x3i = x; x3i < toX; x3i += 3) {\n for (uint256 y3i = y; y3i < toY; y3i += 3) {\n uint256 id3x3 = LAYER_3x3 + x3i + y3i * GRID_SIZE;\n if (_owners[id3x3] != 0) return true;\n }\n }\n }\n\n for (uint256 i = 0; i < size * size; i++) {\n if (_owners[_idInPath(i, size, x, y)] != 0) return true;\n }\n\n return false;\n }\n\n /// @notice Enable or disable the ability of `minter` to transfer tokens of all (minter rights).\n /// @param minter address that will be given/removed minter right.\n /// @param enabled set whether the minter is enabled or disabled.\n function setMinter(address minter, bool enabled) external {\n require(_msgSender() == _admin, \"only admin is allowed to add minters\");\n require(minter != address(0), \"PolygonLand: Invalid address\");\n _minters[minter] = enabled;\n emit Minter(minter, enabled);\n }\n\n /// @notice check whether address `who` is given minter rights.\n /// @param who The address to query.\n /// @return whether the address has minter rights.\n function isMinter(address who) public view returns (bool) {\n return _minters[who];\n }\n\n function _transferQuad(\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y\n ) internal validQuad(size, x, y) {\n if (size == 1) {\n uint256 id1x1 = x + y * GRID_SIZE;\n address owner = _ownerOf(id1x1);\n require(owner != address(0), \"token does not exist\");\n require(owner == from, \"not owner in _transferQuad\");\n _owners[id1x1] = uint256(uint160(address(to)));\n } else {\n _regroup(from, to, size, x, y);\n }\n for (uint256 i = 0; i < size * size; i++) {\n emit Transfer(from, to, _idInPath(i, size, x, y));\n }\n }\n\n function _idInPath(\n uint256 i,\n uint256 size,\n uint256 x,\n uint256 y\n ) internal pure returns (uint256) {\n uint256 row = i / size;\n if (row % 2 == 0) {\n // allow ids to follow a path in a quad\n return (x + (i % size)) + ((y + row) * GRID_SIZE);\n } else {\n return ((x + size) - (1 + (i % size))) + ((y + row) * GRID_SIZE);\n }\n }\n\n function _regroup(\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y\n ) internal {\n if (size == 3) {\n _regroup3x3(from, to, x, y, true);\n } else if (size == 6) {\n _regroup6x6(from, to, x, y, true);\n } else if (size == 12) {\n _regroup12x12(from, to, x, y, true);\n } else if (size == 24) {\n _regroup24x24(from, to, x, y, true);\n }\n }\n\n function _regroup3x3(\n address from,\n address to,\n uint256 x,\n uint256 y,\n bool set\n ) internal returns (bool) {\n uint256 id = x + y * GRID_SIZE;\n uint256 quadId = LAYER_3x3 + id;\n bool ownerOfAll = true;\n for (uint256 xi = x; xi < x + 3; xi++) {\n for (uint256 yi = y; yi < y + 3; yi++) {\n ownerOfAll = _checkAndClear(from, xi + yi * GRID_SIZE) && ownerOfAll;\n }\n }\n if (set) {\n if (!ownerOfAll) {\n require(_ownerOfQuad(3, x, y) == from, \"not owner of all sub quads nor parent quads\");\n }\n _owners[quadId] = uint256(uint160(address(to)));\n return true;\n }\n return ownerOfAll;\n }\n\n function _regroup6x6(\n address from,\n address to,\n uint256 x,\n uint256 y,\n bool set\n ) internal returns (bool) {\n uint256 id = x + y * GRID_SIZE;\n uint256 quadId = LAYER_6x6 + id;\n bool ownerOfAll = true;\n for (uint256 xi = x; xi < x + 6; xi += 3) {\n for (uint256 yi = y; yi < y + 6; yi += 3) {\n bool ownAllIndividual = _regroup3x3(from, to, xi, yi, false);\n uint256 id3x3 = LAYER_3x3 + xi + yi * GRID_SIZE;\n uint256 owner3x3 = _owners[id3x3];\n if (owner3x3 != 0) {\n if (!ownAllIndividual) {\n require(owner3x3 == uint256(uint160(address(from))), \"not owner of 3x3 quad\");\n }\n _owners[id3x3] = 0;\n }\n ownerOfAll = (ownAllIndividual || owner3x3 != 0) && ownerOfAll;\n }\n }\n if (set) {\n if (!ownerOfAll) {\n require(_ownerOfQuad(6, x, y) == from, \"not owner of all sub quads nor parent quads\");\n }\n _owners[quadId] = uint256(uint160(address(to)));\n return true;\n }\n return ownerOfAll;\n }\n\n function _regroup12x12(\n address from,\n address to,\n uint256 x,\n uint256 y,\n bool set\n ) internal returns (bool) {\n uint256 id = x + y * GRID_SIZE;\n uint256 quadId = LAYER_12x12 + id;\n bool ownerOfAll = true;\n for (uint256 xi = x; xi < x + 12; xi += 6) {\n for (uint256 yi = y; yi < y + 12; yi += 6) {\n bool ownAllIndividual = _regroup6x6(from, to, xi, yi, false);\n uint256 id6x6 = LAYER_6x6 + xi + yi * GRID_SIZE;\n uint256 owner6x6 = _owners[id6x6];\n if (owner6x6 != 0) {\n if (!ownAllIndividual) {\n require(owner6x6 == uint256(uint160(address(from))), \"not owner of 6x6 quad\");\n }\n _owners[id6x6] = 0;\n }\n ownerOfAll = (ownAllIndividual || owner6x6 != 0) && ownerOfAll;\n }\n }\n if (set) {\n if (!ownerOfAll) {\n require(_ownerOfQuad(12, x, y) == from, \"not owner of all sub quads nor parent quads\");\n }\n _owners[quadId] = uint256(uint160(address(to)));\n return true;\n }\n return ownerOfAll;\n }\n\n function _regroup24x24(\n address from,\n address to,\n uint256 x,\n uint256 y,\n bool set\n ) internal returns (bool) {\n uint256 id = x + y * GRID_SIZE;\n uint256 quadId = LAYER_24x24 + id;\n bool ownerOfAll = true;\n for (uint256 xi = x; xi < x + 24; xi += 12) {\n for (uint256 yi = y; yi < y + 24; yi += 12) {\n bool ownAllIndividual = _regroup12x12(from, to, xi, yi, false);\n uint256 id12x12 = LAYER_12x12 + xi + yi * GRID_SIZE;\n uint256 owner12x12 = _owners[id12x12];\n if (owner12x12 != 0) {\n if (!ownAllIndividual) {\n require(owner12x12 == uint256(uint160(address(from))), \"not owner of 12x12 quad\");\n }\n _owners[id12x12] = 0;\n }\n ownerOfAll = (ownAllIndividual || owner12x12 != 0) && ownerOfAll;\n }\n }\n if (set) {\n if (!ownerOfAll) {\n require(\n _owners[quadId] == uint256(uint160(address(from))),\n \"not owner of all sub quads not parent quad\"\n );\n }\n _owners[quadId] = uint256(uint160(address(to)));\n return true;\n }\n return ownerOfAll || _owners[quadId] == uint256(uint160(address(from)));\n }\n\n function _ownerOfQuad(\n uint256 size,\n uint256 x,\n uint256 y\n ) internal returns (address) {\n uint256 layer;\n uint256 parentSize = size * 2;\n if (size == 3) {\n layer = LAYER_3x3;\n } else if (size == 6) {\n layer = LAYER_6x6;\n } else if (size == 12) {\n layer = LAYER_12x12;\n } else if (size == 24) {\n layer = LAYER_24x24;\n } else {\n require(false, \"Invalid size\");\n }\n\n address owner = address(uint160(_owners[layer + (x / size) * size + ((y / size) * size) * GRID_SIZE]));\n if (owner != address(0)) {\n return owner;\n } else if (size < 24) {\n return _ownerOfQuad(parentSize, x, y);\n }\n return address(0);\n }\n\n function _ownerOf(uint256 id) internal view override returns (address) {\n require(id & LAYER == 0, \"Invalid token id\");\n uint256 x = id % GRID_SIZE;\n uint256 y = id / GRID_SIZE;\n uint256 owner1x1 = _owners[id];\n\n if ((owner1x1 & BURNED_FLAG) == BURNED_FLAG) {\n return address(0);\n }\n\n if (owner1x1 != 0) {\n return address(uint160(owner1x1)); //we check if the quad exists as an 1x1 quad, then 3x3, and so on..\n } else {\n address owner3x3 = address(uint160(_owners[LAYER_3x3 + (x / 3) * 3 + ((y / 3) * 3) * GRID_SIZE]));\n if (owner3x3 != address(0)) {\n return owner3x3;\n } else {\n address owner6x6 = address(uint160(_owners[LAYER_6x6 + (x / 6) * 6 + ((y / 6) * 6) * GRID_SIZE]));\n if (owner6x6 != address(0)) {\n return owner6x6;\n } else {\n address owner12x12 =\n address(uint160(_owners[LAYER_12x12 + (x / 12) * 12 + ((y / 12) * 12) * GRID_SIZE]));\n if (owner12x12 != address(0)) {\n return owner12x12;\n } else {\n return address(uint160(_owners[LAYER_24x24 + (x / 24) * 24 + ((y / 24) * 24) * GRID_SIZE]));\n }\n }\n }\n }\n }\n\n function _checkAndClear(address from, uint256 id) internal returns (bool) {\n uint256 owner = _owners[id];\n if (owner != 0) {\n require((owner & BURNED_FLAG) != BURNED_FLAG, \"not owner\");\n require(address(uint160(owner)) == from, \"not owner\");\n _owners[id] = 0;\n return true;\n }\n return false;\n }\n\n function _checkBatchReceiverAcceptQuad(\n address operator,\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) internal {\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n uint256[] memory ids = new uint256[](size * size);\n for (uint256 i = 0; i < size * size; i++) {\n ids[i] = _idInPath(i, size, x, y);\n }\n require(_checkOnERC721BatchReceived(operator, from, to, ids, data), \"erc721 batch transfer rejected by to\");\n }\n }\n\n function _ownerAndOperatorEnabledOf(uint256 id)\n internal\n view\n override\n returns (address owner, bool operatorEnabled)\n {\n require(id & LAYER == 0, \"Invalid token id\");\n uint256 x = id % GRID_SIZE;\n uint256 y = id / GRID_SIZE;\n uint256 owner1x1 = _owners[id];\n\n if ((owner1x1 & BURNED_FLAG) == BURNED_FLAG) {\n owner = address(0);\n operatorEnabled = (owner1x1 & OPERATOR_FLAG) == OPERATOR_FLAG;\n return (owner, operatorEnabled);\n }\n\n if (owner1x1 != 0) {\n owner = address(uint160(owner1x1));\n operatorEnabled = (owner1x1 & OPERATOR_FLAG) == OPERATOR_FLAG;\n } else {\n address owner3x3 = address(uint160(_owners[LAYER_3x3 + (x / 3) * 3 + ((y / 3) * 3) * GRID_SIZE]));\n if (owner3x3 != address(uint160(0))) {\n owner = owner3x3;\n operatorEnabled = false;\n } else {\n address owner6x6 = address(uint160(_owners[LAYER_6x6 + (x / 6) * 6 + ((y / 6) * 6) * GRID_SIZE]));\n if (owner6x6 != address(uint160(0))) {\n owner = owner6x6;\n operatorEnabled = false;\n } else {\n address owner12x12 =\n address(uint160(_owners[LAYER_12x12 + (x / 12) * 12 + ((y / 12) * 12) * GRID_SIZE]));\n if (owner12x12 != address(uint160(0))) {\n owner = owner12x12;\n operatorEnabled = false;\n } else {\n owner = address(uint160(_owners[LAYER_24x24 + (x / 24) * 24 + ((y / 24) * 24) * GRID_SIZE]));\n operatorEnabled = false;\n }\n }\n }\n }\n }\n\n // Empty storage space in contracts for future enhancements\n // ref: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/issues/13)\n uint256[49] private __gap;\n}\n" + }, + "src/solc_0.8/polygon/child/land/PolygonLandBaseTokenV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable code-complexity\n\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\";\nimport \"../../../common/BaseWithStorage/ERC721BaseTokenV2.sol\";\nimport \"../../../common/interfaces/IPolygonLand.sol\";\n\n/**\n * @title PolygonLandBaseTokenV2\n * @author The Sandbox\n * @notice Implement LAND and quad functionalities on top of an ERC721 token\n * @dev This contract implements a quad tree structure to handle groups of ERC721 tokens at once\n */\nabstract contract PolygonLandBaseTokenV2 is IPolygonLand, Initializable, ERC721BaseTokenV2 {\n using AddressUpgradeable for address;\n\n uint256 internal constant GRID_SIZE = 408;\n\n uint256 internal constant LAYER = 0xFF00000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_1x1 = 0x0000000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_3x3 = 0x0100000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_6x6 = 0x0200000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_12x12 = 0x0300000000000000000000000000000000000000000000000000000000000000;\n uint256 internal constant LAYER_24x24 = 0x0400000000000000000000000000000000000000000000000000000000000000;\n\n mapping(address => bool) internal _minters;\n\n event Minter(address indexed minter, bool enabled);\n\n struct Land {\n uint256 x;\n uint256 y;\n uint256 size;\n }\n\n /// @notice transfer multiple quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\n /// @param from current owner of the quad\n /// @param to destination\n /// @param sizes list of sizes for each quad\n /// @param xs list of bottom left x coordinates for each quad\n /// @param ys list of bottom left y coordinates for each quad\n /// @param data additional data\n function batchTransferQuad(\n address from,\n address to,\n uint256[] calldata sizes,\n uint256[] calldata xs,\n uint256[] calldata ys,\n bytes calldata data\n ) external override {\n require(from != address(0), \"from is zero address\");\n require(to != address(0), \"can't send to zero address\");\n require(sizes.length == xs.length, \"PolygonLandBaseTokenV2: sizes's and x's length are different\");\n require(xs.length == ys.length, \"PolygonLandBaseTokenV2: x's and y's length are different\");\n if (_msgSender() != from) {\n require(\n _operatorsForAll[from][_msgSender()] || _superOperators[_msgSender()],\n \"not authorized to transferMultiQuads\"\n );\n }\n uint256 numTokensTransfered = 0;\n for (uint256 i = 0; i < sizes.length; i++) {\n uint256 size = sizes[i];\n _transferQuad(from, to, size, xs[i], ys[i]);\n numTokensTransfered += size * size;\n }\n _numNFTPerAddress[from] -= numTokensTransfered;\n _numNFTPerAddress[to] += numTokensTransfered;\n\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n uint256[] memory ids = new uint256[](numTokensTransfered);\n uint256 counter = 0;\n for (uint256 j = 0; j < sizes.length; j++) {\n uint256 size = sizes[j];\n for (uint256 i = 0; i < size * size; i++) {\n ids[counter] = _idInPath(i, size, xs[j], ys[j]);\n counter++;\n }\n }\n require(\n _checkOnERC721BatchReceived(_msgSender(), from, to, ids, data),\n \"erc721 batch transfer rejected by to\"\n );\n }\n }\n\n /// @notice Enable or disable the ability of `minter` to transfer tokens of all (minter rights).\n /// @param minter address that will be given/removed minter right.\n /// @param enabled set whether the minter is enabled or disabled.\n function setMinter(address minter, bool enabled) external onlyAdmin {\n require(minter != address(0), \"PolygonLand: Invalid address\");\n _minters[minter] = enabled;\n emit Minter(minter, enabled);\n }\n\n /// @notice transfer one quad (aligned to a quad tree with size 3, 6, 12 or 24 only)\n /// @param from current owner of the quad\n /// @param to destination\n /// @param size size of the quad\n /// @param x The top left x coordinate of the quad\n /// @param y The top left y coordinate of the quad\n /// @param data additional data for transfer\n function transferQuad(\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external override {\n require(from != address(0), \"from is zero address\");\n require(to != address(0), \"can't send to zero address\");\n if (_msgSender() != from) {\n require(\n _operatorsForAll[from][_msgSender()] || _superOperators[_msgSender()],\n \"not authorized to transferQuad\"\n );\n }\n _transferQuad(from, to, size, x, y);\n _numNFTPerAddress[from] -= size * size;\n _numNFTPerAddress[to] += size * size;\n\n _checkBatchReceiverAcceptQuad(_msgSender(), from, to, size, x, y, data);\n }\n\n /**\n * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\n * @param user The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintQuad(\n address user,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) external virtual override {\n _isValidQuad(size, x, y);\n require(isMinter(_msgSender()), \"!AUTHORIZED\");\n _mintQuad(user, size, x, y, data);\n }\n\n /**\n * @notice Checks if a parent quad has child quads already minted.\n * Then mints the rest child quads and transfers the parent quad.\n * Should only be called by the tunnel.\n * @param to The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintAndTransferQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external virtual {\n require(isMinter(msg.sender), \"!AUTHORIZED\");\n require(to != address(0), \"to is zero address\");\n\n if (exists(size, x, y)) {\n _transferQuad(msg.sender, to, size, x, y);\n _numNFTPerAddress[msg.sender] -= size * size;\n _numNFTPerAddress[to] += size * size;\n _checkBatchReceiverAcceptQuad(msg.sender, msg.sender, to, size, x, y, data);\n } else {\n _mintAndTransferQuad(to, size, x, y, data);\n }\n }\n\n /// @notice x coordinate of Land token\n /// @param id tokenId\n /// @return the x coordinates\n function getX(uint256 id) external pure returns (uint256) {\n return _getX(id);\n }\n\n /// @inheritdoc ERC721BaseTokenV2\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) public virtual override(ILandToken, ERC721BaseTokenV2) {\n super.batchTransferFrom(from, to, ids, data);\n }\n\n /// @notice y coordinate of Land token\n /// @param id tokenId\n /// @return the y coordinates\n function getY(uint256 id) external pure returns (uint256) {\n return _getY(id);\n }\n\n /**\n * @notice Check if the contract supports an interface\n * 0x01ffc9a7 is ERC-165\n * 0x80ac58cd is ERC-721\n * 0x5b5e139f is ERC-721 metadata\n * @param id The id of the interface\n * @return True if the interface is supported\n */\n function supportsInterface(bytes4 id) public pure override returns (bool) {\n return id == 0x01ffc9a7 || id == 0x80ac58cd || id == 0x5b5e139f;\n }\n\n /**\n * @notice Return the name of the token contract\n * @return The name of the token contract\n */\n function name() public pure returns (string memory) {\n return \"Sandbox's LANDs\";\n }\n\n /// @notice check whether address `who` is given minter rights.\n /// @param who The address to query.\n /// @return whether the address has minter rights.\n function isMinter(address who) public view returns (bool) {\n return _minters[who];\n }\n\n /// @notice checks if Land has been minted or not\n /// @param size size of the\n /// @param x x coordinate of the quad\n /// @param y y coordinate of the quad\n /// @return bool for if Land has been minted or not\n function exists(\n uint256 size,\n uint256 x,\n uint256 y\n ) public view override returns (bool) {\n _isValidQuad(size, x, y);\n return _ownerOfQuad(size, x, y) != address(0);\n }\n\n /**\n * @notice Return the symbol of the token contract\n * @return The symbol of the token contract\n */\n function symbol() public pure returns (string memory) {\n return \"LAND\";\n }\n\n /// @notice total width of the map\n /// @return width\n function width() public pure returns (uint256) {\n return GRID_SIZE;\n }\n\n /// @notice total height of the map\n /// @return height\n function height() public pure returns (uint256) {\n return GRID_SIZE;\n }\n\n /**\n * @notice Return the URI of a specific token\n * @param id The id of the token\n * @return The URI of the token\n */\n function tokenURI(uint256 id) public view returns (string memory) {\n require(_ownerOf(id) != address(0), \"Id does not exist\");\n return\n string(\n abi.encodePacked(\"https://api.sandbox.game/lands/\", StringsUpgradeable.toString(id), \"/metadata.json\")\n );\n }\n\n function _isValidQuad(\n uint256 size,\n uint256 x,\n uint256 y\n ) internal pure {\n require(size == 1 || size == 3 || size == 6 || size == 12 || size == 24, \"Invalid size\");\n require(x % size == 0, \"Invalid x coordinate\");\n require(y % size == 0, \"Invalid y coordinate\");\n require(x <= GRID_SIZE - size, \"x out of bounds\");\n require(y <= GRID_SIZE - size, \"y out of bounds\");\n }\n\n function _transferQuad(\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y\n ) internal {\n _isValidQuad(size, x, y);\n if (size == 1) {\n uint256 id1x1 = _getQuadId(LAYER_1x1, x, y);\n address owner = _ownerOf(id1x1);\n require(owner != address(0), \"token does not exist\");\n require(owner == from, \"not owner in _transferQuad\");\n _owners[id1x1] = uint256(uint160(address(to)));\n } else {\n _regroupQuad(from, to, Land({x: x, y: y, size: size}), true, size / 2);\n }\n for (uint256 i = 0; i < size * size; i++) {\n emit Transfer(from, to, _idInPath(i, size, x, y));\n }\n }\n\n function _mintQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) internal {\n require(to != address(0), \"to is zero address\");\n\n (uint256 layer, , ) = _getQuadLayer(size);\n uint256 quadId = _getQuadId(layer, x, y);\n\n _checkOwner(size, x, y, 24);\n for (uint256 i = 0; i < size * size; i++) {\n uint256 _id = _idInPath(i, size, x, y);\n require(_owners[_id] == 0, \"Already minted\");\n emit Transfer(address(0), to, _id);\n }\n\n _owners[quadId] = uint256(uint160(to));\n _numNFTPerAddress[to] += size * size;\n\n _checkBatchReceiverAcceptQuad(msg.sender, address(0), to, size, x, y, data);\n }\n\n /**\n * @dev checks if the child quads in the parent quad (size, x, y) are owned by msg.sender.\n * It recursively checks child quad of every size(exculding Lands of 1x1 size) are minted or not.\n * Quad which are minted are pushed into quadMinted to also check if every Land of size 1x1 in\n * the parent quad is minted or not. While checking if the every child Quad and Land is minted it\n * also checks and clear the owner for quads which are minted. Finally it checks if the new owner\n * if is a contract can handle ERC721 tokens or not and transfers the parent quad to new owner.\n * @param to The address to which the ownership of the quad will be transferred\n * @param size The size of the quad being minted and transfered\n * @param x The x-coordinate of the top-left corner of the quad being minted.\n * @param y The y-coordinate of the top-left corner of the quad being minted.\n * @param y The y-coordinate of the top-left corner of the quad being minted.\n */\n function _mintAndTransferQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) internal {\n (uint256 layer, , ) = _getQuadLayer(size);\n uint256 quadId = _getQuadId(layer, x, y);\n\n // Length of array is equal to number of 3x3 child quad a 24x24 quad can have. Would be used to push the minted Quads.\n Land[] memory quadMinted = new Land[](64);\n // index of last minted quad pushed on quadMinted Array\n uint256 index;\n uint256 landMinted;\n\n // if size of the Quad in land struct to be transfered is greater than 3 we check recursivly if the child quads are minted or not.\n if (size > 3) {\n (index, landMinted) = _checkAndClearOwner(\n Land({x: x, y: y, size: size}),\n quadMinted,\n landMinted,\n index,\n size / 2\n );\n }\n\n // Lopping around the Quad in land struct to generate ids of 1x1 land token and checking if they are owned by msg.sender\n {\n for (uint256 i = 0; i < size * size; i++) {\n uint256 _id = _idInPath(i, size, x, y);\n // checking land with token id \"_id\" is in the quadMinted array.\n bool isAlreadyMinted = _isQuadMinted(quadMinted, Land({x: _getX(_id), y: _getY(_id), size: 1}), index);\n if (isAlreadyMinted) {\n // if land is in the quadMinted array there just emitting transfer event\n emit Transfer(msg.sender, to, _id);\n } else {\n if (address(uint160(_owners[_id])) == msg.sender) {\n if (_operators[_id] != address(0)) _operators[_id] = address(0);\n landMinted += 1;\n emit Transfer(msg.sender, to, _id);\n } else {\n // else is checked if owned by the msg.sender or not. If it is not owned by msg.sender it should not have an owner.\n require(_owners[_id] == 0, \"Already minted\");\n\n emit Transfer(address(0), to, _id);\n }\n }\n }\n }\n\n // checking if the new owner \"to\" is a contract. If yes, checking if it could handle ERC721 tokens.\n _checkBatchReceiverAcceptQuadAndClearOwner(quadMinted, index, landMinted, to, size, x, y, data);\n\n _owners[quadId] = uint256(uint160(to));\n _numNFTPerAddress[to] += size * size;\n _numNFTPerAddress[msg.sender] -= landMinted;\n }\n\n /**\n * @dev recursivly checks if the child quads are minted in land and push them to the quadMinted array.\n * if a child quad is minted in land such quads child quads will be skipped such that there is no overlapping\n * in quads which are minted. it clears the minted child quads owners.\n * @param land the stuct which has the size x and y co-ordinate of Quad to be checked\n * @param quadMinted array in which the minted child quad would be pushed\n * @param landMinted total 1x1 land already minted\n * @param index index of last element of quadMinted array\n * @param quadCompareSize the size of the child quads to be checked.\n * @return the index of last quad pushed in quadMinted array and the total land already minted\n */\n function _checkAndClearOwner(\n Land memory land,\n Land[] memory quadMinted,\n uint256 landMinted,\n uint256 index,\n uint256 quadCompareSize\n ) internal returns (uint256, uint256) {\n (uint256 layer, , ) = _getQuadLayer(quadCompareSize);\n uint256 toX = land.x + land.size;\n uint256 toY = land.y + land.size;\n\n //Lopping around the Quad in land struct to check if the child quad are minted or not\n for (uint256 xi = land.x; xi < toX; xi += quadCompareSize) {\n for (uint256 yi = land.y; yi < toY; yi += quadCompareSize) {\n //checking if the child Quad is minted or not. i.e Checks if the quad is in the quadMinted array.\n bool isQuadChecked = _isQuadMinted(quadMinted, Land({x: xi, y: yi, size: quadCompareSize}), index);\n // if child quad is not already in the quadMinted array.\n if (!isQuadChecked) {\n uint256 id = _getQuadId(layer, xi, yi);\n address owner = address(uint160(_owners[id]));\n // owner of the child quad is checked to be owned by msg.sender else should not be owned by anyone.\n if (owner == msg.sender) {\n // if child quad is minted it would be pushed in quadMinted array.\n quadMinted[index] = Land({x: xi, y: yi, size: quadCompareSize});\n // index of quadMinted is increased\n index++;\n // total land minted is increase by the number if land of 1x1 in child quad\n landMinted += quadCompareSize * quadCompareSize;\n //owner is cleared\n _owners[id] = 0;\n } else {\n require(owner == address(0), \"Already minted\");\n }\n }\n }\n }\n\n // size of the child quad is set to be the next smaller child quad size (12 => 6 => 3)\n quadCompareSize = quadCompareSize / 2;\n // if child quad size is greater than 3 _checkAndClearOwner is checked for new child quads in the quad in land struct.\n if (quadCompareSize >= 3)\n (index, landMinted) = _checkAndClearOwner(land, quadMinted, landMinted, index, quadCompareSize);\n return (index, landMinted);\n }\n\n /// @dev checks the owner of land with 'tokenId' to be 'from' and clears it\n /// @param from the address to be checked agains the owner of the land\n /// @param tokenId th id of land\n /// @return bool for if land is owned by 'from' or not.\n function _checkAndClearLandOwner(address from, uint256 tokenId) internal returns (bool) {\n uint256 currentOwner = _owners[tokenId];\n if (currentOwner != 0) {\n require((currentOwner & BURNED_FLAG) != BURNED_FLAG, \"not owner\");\n require(address(uint160(currentOwner)) == from, \"not owner\");\n _owners[tokenId] = 0;\n return true;\n }\n return false;\n }\n\n function _checkBatchReceiverAcceptQuad(\n address operator,\n address from,\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) internal {\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n uint256[] memory ids = new uint256[](size * size);\n for (uint256 i = 0; i < size * size; i++) {\n ids[i] = _idInPath(i, size, x, y);\n }\n require(_checkOnERC721BatchReceived(operator, from, to, ids, data), \"erc721 batch transfer rejected by to\");\n }\n }\n\n /// @dev checks if the receiver of the quad(size, x, y) is a contact. If yes can it handle ERC721 tokens. It also clears owner of 1x1 land's owned by msg.sender.\n /// @param quadMinted - an array of Land structs in which the minted child quad or Quad to be transfered are.\n /// @param landMinted - the total amount of land that has been minted\n /// @param index - the index of the last element in the quadMinted array\n /// @param to the address of the new owner of Quad to be transfered\n /// @param size The size of the quad being minted and transfered\n /// @param x The x-coordinate of the top-left corner of the quad being minted.\n /// @param y The y-coordinate of the top-left corner of the quad being minted.\n /// @param y The y-coordinate of the top-left corner of the quad being minted.\n function _checkBatchReceiverAcceptQuadAndClearOwner(\n Land[] memory quadMinted,\n uint256 index,\n uint256 landMinted,\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) internal {\n // checks if to is a contract and supports ERC721_MANDATORY_RECEIVER interfaces. if it doesn't it just clears the owner of 1x1 lands in quad(size, x, y)\n if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {\n // array to push minted 1x1 land\n uint256[] memory idsToTransfer = new uint256[](landMinted);\n // index of last land pushed in idsToTransfer array\n uint256 transferIndex;\n // array to push ids to be minted\n uint256[] memory idsToMint = new uint256[]((size * size) - landMinted);\n // index of last land pushed in idsToMint array\n uint256 mintIndex;\n\n // iterating over every 1x1 land in the quad to be pushed in the above arrays\n for (uint256 i = 0; i < size * size; i++) {\n uint256 id = _idInPath(i, size, x, y);\n\n if (_isQuadMinted(quadMinted, Land({x: _getX(id), y: _getY(id), size: 1}), index)) {\n // if land is in the quads already minted it just pushed in to the idsToTransfer array\n idsToTransfer[transferIndex] = id;\n transferIndex++;\n } else if (address(uint160(_owners[id])) == msg.sender) {\n // if it is owned by the msg.sender owner data is removed and it is pused in to idsToTransfer array\n _owners[id] = 0;\n idsToTransfer[transferIndex] = id;\n transferIndex++;\n } else {\n // else it is not owned by any one and and pushed in teh idsToMint array\n idsToMint[mintIndex] = id;\n mintIndex++;\n }\n }\n\n // checking if \"to\" contact can handle ERC721 tokens\n require(\n _checkOnERC721BatchReceived(msg.sender, address(0), to, idsToMint, data),\n \"erc721 batch transfer rejected by to\"\n );\n require(\n _checkOnERC721BatchReceived(msg.sender, msg.sender, to, idsToTransfer, data),\n \"erc721 batch transfer rejected by to\"\n );\n } else {\n for (uint256 i = 0; i < size * size; i++) {\n uint256 id = _idInPath(i, size, x, y);\n if (address(uint160(_owners[id])) == msg.sender) _owners[id] = 0;\n }\n }\n }\n\n function _getX(uint256 id) internal pure returns (uint256) {\n return (id & ~LAYER) % GRID_SIZE;\n }\n\n function _getY(uint256 id) internal pure returns (uint256) {\n return (id & ~LAYER) / GRID_SIZE;\n }\n\n function _isQuadMinted(\n Land[] memory mintedLand,\n Land memory quad,\n uint256 index\n ) internal pure returns (bool) {\n for (uint256 i = 0; i < index; i++) {\n Land memory land = mintedLand[i];\n if (\n land.size > quad.size &&\n quad.x >= land.x &&\n quad.x < land.x + land.size &&\n quad.y >= land.y &&\n quad.y < land.y + land.size\n ) {\n return true;\n }\n }\n return false;\n }\n\n function _getQuadLayer(uint256 size)\n internal\n pure\n returns (\n uint256 layer,\n uint256 parentSize,\n uint256 childLayer\n )\n {\n if (size == 1) {\n layer = LAYER_1x1;\n parentSize = 3;\n } else if (size == 3) {\n layer = LAYER_3x3;\n parentSize = 6;\n } else if (size == 6) {\n layer = LAYER_6x6;\n parentSize = 12;\n childLayer = LAYER_3x3;\n } else if (size == 12) {\n layer = LAYER_12x12;\n parentSize = 24;\n childLayer = LAYER_6x6;\n } else if (size == 24) {\n layer = LAYER_24x24;\n childLayer = LAYER_12x12;\n } else {\n require(false, \"Invalid size\");\n }\n }\n\n function _getQuadId(\n uint256 layer,\n uint256 x,\n uint256 y\n ) internal pure returns (uint256) {\n return layer + x + y * GRID_SIZE;\n }\n\n function _checkOwner(\n uint256 size,\n uint256 x,\n uint256 y,\n uint256 quadCompareSize\n ) internal view {\n (uint256 layer, , ) = _getQuadLayer(quadCompareSize);\n\n if (size <= quadCompareSize) {\n // when the size of the quad is smaller than the quadCompareSize(size to be compared with),\n // then it is checked if the bigger quad which encapsulates the quad to be minted\n // of with size equals the quadCompareSize has been minted or not\n require(\n _owners[\n _getQuadId(layer, (x / quadCompareSize) * quadCompareSize, (y / quadCompareSize) * quadCompareSize)\n ] == 0,\n \"Already minted\"\n );\n } else {\n // when the size is smaller than the quadCompare size the owner of all the smaller quads with size\n // quadCompare size in the quad to be minted are checked if they are minted or not\n uint256 toX = x + size;\n uint256 toY = y + size;\n for (uint256 xi = x; xi < toX; xi += quadCompareSize) {\n for (uint256 yi = y; yi < toY; yi += quadCompareSize) {\n require(_owners[_getQuadId(layer, xi, yi)] == 0, \"Already minted\");\n }\n }\n }\n\n quadCompareSize = quadCompareSize / 2;\n if (quadCompareSize >= 3) _checkOwner(size, x, y, quadCompareSize);\n }\n\n function _idInPath(\n uint256 i,\n uint256 size,\n uint256 x,\n uint256 y\n ) internal pure returns (uint256) {\n uint256 row = i / size;\n if (row % 2 == 0) {\n // allow ids to follow a path in a quad\n return _getQuadId(LAYER_1x1, (x + (i % size)), (y + row));\n } else {\n return _getQuadId(LAYER_1x1, (x + size) - (1 + (i % size)), (y + row));\n }\n }\n\n /// @dev checks if the Land's child quads are owned by the from address and clears all the previous owners\n /// if all the child quads are not owned by the \"from\" address then the owner of parent quad to the land\n /// is checked if owned by the \"from\" address. If from is the owner then land owner is set to \"to\" address\n /// @param from address of the previous owner\n /// @param to address of the new owner\n /// @param land the quad to be regrouped and transferred\n /// @param set for setting the new owner\n /// @param childQuadSize size of the child quad to be checked for owner in the regrouping\n function _regroupQuad(\n address from,\n address to,\n Land memory land,\n bool set,\n uint256 childQuadSize\n ) internal returns (bool) {\n (uint256 layer, , uint256 childLayer) = _getQuadLayer(land.size);\n uint256 quadId = _getQuadId(layer, land.x, land.y);\n bool ownerOfAll = true;\n\n {\n // double for loop iterates and checks owner of all the smaller quads in land\n for (uint256 xi = land.x; xi < land.x + land.size; xi += childQuadSize) {\n for (uint256 yi = land.y; yi < land.y + land.size; yi += childQuadSize) {\n uint256 ownerChild;\n bool ownAllIndividual;\n if (childQuadSize < 3) {\n // case when the smaller quad is 1x1,\n ownAllIndividual = _checkAndClearLandOwner(from, _getQuadId(LAYER_1x1, xi, yi)) && ownerOfAll;\n } else {\n // recursively calling the _regroupQuad function to check the owner of child quads.\n ownAllIndividual = _regroupQuad(\n from,\n to,\n Land({x: xi, y: yi, size: childQuadSize}),\n false,\n childQuadSize / 2\n );\n uint256 idChild = _getQuadId(childLayer, xi, yi);\n ownerChild = _owners[idChild];\n if (ownerChild != 0) {\n // checking the owner of child quad\n if (!ownAllIndividual) {\n require(ownerChild == uint256(uint160(from)), \"not owner of child Quad\");\n }\n // clearing owner of child quad\n _owners[idChild] = 0;\n }\n }\n // ownerOfAll should be true if \"from\" is owner of all the child quads itereated over\n ownerOfAll = (ownAllIndividual || ownerChild != 0) && ownerOfAll;\n }\n }\n }\n\n // if set is true it check if the \"from\" is owner of all else checks for the owner of parent quad is\n // owned by \"from\" and sets the owner for the id of land to \"to\" address.\n if (set) {\n if (!ownerOfAll) {\n require(_ownerOfQuad(land.size, land.x, land.y) == from, \"not owner of all sub quads nor parent quads\");\n }\n _owners[quadId] = uint256(uint160(to));\n return true;\n }\n\n return ownerOfAll;\n }\n\n function _ownerOfQuad(\n uint256 size,\n uint256 x,\n uint256 y\n ) internal view returns (address) {\n (uint256 layer, uint256 parentSize, ) = _getQuadLayer(size);\n address owner = address(uint160(_owners[_getQuadId(layer, (x / size) * size, (y / size) * size)]));\n if (owner != address(0)) {\n return owner;\n } else if (size < 24) {\n return _ownerOfQuad(parentSize, x, y);\n }\n return address(0);\n }\n\n function _getQuadById(uint256 id)\n internal\n pure\n returns (\n uint256 size,\n uint256 x,\n uint256 y\n )\n {\n x = _getX(id);\n y = _getY(id);\n uint256 layer = id & LAYER;\n if (layer == LAYER_1x1) {\n size = 1;\n } else if (layer == LAYER_3x3) {\n size = 3;\n } else if (layer == LAYER_6x6) {\n size = 6;\n } else if (layer == LAYER_12x12) {\n size = 12;\n } else if (layer == LAYER_24x24) {\n size = 24;\n } else {\n require(false, \"Invalid token id\");\n }\n }\n\n function _ownerOf(uint256 id) internal view override returns (address) {\n require(id & LAYER == 0, \"Invalid token id\");\n (uint256 size, uint256 x, uint256 y) = _getQuadById(id);\n require(x % size == 0, \"x coordinate: Invalid token id\");\n require(y % size == 0, \"y coordinate: Invalid token id\");\n if (size == 1) {\n uint256 owner1x1 = _owners[id];\n return (owner1x1 & BURNED_FLAG) == BURNED_FLAG ? address(0) : _ownerOfQuad(size, x, y);\n }\n return _ownerOfQuad(size, x, y);\n }\n\n function _ownerAndOperatorEnabledOf(uint256 id)\n internal\n view\n override\n returns (address owner, bool operatorEnabled)\n {\n require(id & LAYER == 0, \"Invalid token id\");\n uint256 x = id % GRID_SIZE;\n uint256 y = id / GRID_SIZE;\n uint256 owner1x1 = _owners[id];\n\n if ((owner1x1 & BURNED_FLAG) == BURNED_FLAG) {\n owner = address(0);\n operatorEnabled = (owner1x1 & OPERATOR_FLAG) == OPERATOR_FLAG;\n return (owner, operatorEnabled);\n }\n\n if (owner1x1 != 0) {\n owner = address(uint160(owner1x1));\n operatorEnabled = (owner1x1 & OPERATOR_FLAG) == OPERATOR_FLAG;\n } else {\n owner = _ownerOfQuad(3, (x * 3) / 3, (y * 3) / 3);\n operatorEnabled = false;\n }\n }\n\n // Empty storage space in contracts for future enhancements\n // ref: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/issues/13)\n uint256[49] private __gap;\n}\n" + }, + "src/solc_0.8/polygon/child/land/PolygonLandTunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"fx-portal/contracts/tunnel/FxBaseChildTunnel.sol\";\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport \"@openzeppelin/contracts-0.8/security/Pausable.sol\";\n\nimport \"../../../common/interfaces/IPolygonLand.sol\";\nimport \"../../../common/interfaces/IERC721MandatoryTokenReceiver.sol\";\nimport \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\nimport \"./PolygonLandBaseToken.sol\";\n\n/// @title LAND bridge on L2\ncontract PolygonLandTunnel is FxBaseChildTunnel, IERC721MandatoryTokenReceiver, ERC2771Handler, Ownable, Pausable {\n IPolygonLand public immutable childToken;\n uint32 public maxGasLimitOnL1;\n uint256 public maxAllowedQuads;\n bool internal transferringToL1;\n\n mapping(uint8 => uint32) public gasLimits;\n\n event SetGasLimit(uint8 size, uint32 limit);\n event SetMaxGasLimit(uint32 maxGasLimit);\n event SetMaxAllowedQuads(uint256 maxQuads);\n event Deposit(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\n event Withdraw(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\n\n function setMaxLimitOnL1(uint32 _maxGasLimit) external onlyOwner {\n maxGasLimitOnL1 = _maxGasLimit;\n emit SetMaxGasLimit(_maxGasLimit);\n }\n\n function setMaxAllowedQuads(uint256 _maxAllowedQuads) external onlyOwner {\n require(_maxAllowedQuads > 0, \"PolygonLandTunnel: max allowed value cannot be zero\");\n maxAllowedQuads = _maxAllowedQuads;\n emit SetMaxAllowedQuads(_maxAllowedQuads);\n }\n\n function _setLimit(uint8 size, uint32 limit) internal {\n gasLimits[size] = limit;\n emit SetGasLimit(size, limit);\n }\n\n function setLimit(uint8 size, uint32 limit) external onlyOwner {\n _setLimit(size, limit);\n }\n\n // setupLimits([5, 10, 20, 90, 340]);\n function setupLimits(uint32[5] memory limits) public onlyOwner {\n _setLimit(1, limits[0]);\n _setLimit(3, limits[1]);\n _setLimit(6, limits[2]);\n _setLimit(12, limits[3]);\n _setLimit(24, limits[4]);\n }\n\n constructor(\n address _fxChild,\n IPolygonLand _childToken,\n address _trustedForwarder,\n uint32 _maxGasLimit,\n uint256 _maxAllowedQuads,\n uint32[5] memory limits\n ) FxBaseChildTunnel(_fxChild) {\n childToken = _childToken;\n maxGasLimitOnL1 = _maxGasLimit;\n maxAllowedQuads = _maxAllowedQuads;\n setupLimits(limits);\n __ERC2771Handler_initialize(_trustedForwarder);\n }\n\n function batchTransferQuadToL1(\n address to,\n uint256[] calldata sizes,\n uint256[] calldata xs,\n uint256[] calldata ys,\n bytes memory data\n ) external whenNotPaused() {\n require(sizes.length == xs.length && sizes.length == ys.length, \"sizes, xs, ys must be same length\");\n\n uint32 gasLimit = 0;\n uint256 quads = 0;\n for (uint256 i = 0; i < sizes.length; i++) {\n gasLimit += gasLimits[uint8(sizes[i])];\n quads += sizes[i] * sizes[i];\n }\n\n require(quads <= maxAllowedQuads, \"Exceeds max allowed quads.\");\n require(gasLimit < maxGasLimitOnL1, \"Exceeds gas limit on L1.\");\n transferringToL1 = true;\n for (uint256 i = 0; i < sizes.length; i++) {\n childToken.transferQuad(_msgSender(), address(this), sizes[i], xs[i], ys[i], data);\n emit Withdraw(to, sizes[i], xs[i], ys[i], data);\n }\n _sendMessageToRoot(abi.encode(to, sizes, xs, ys, data));\n transferringToL1 = false;\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n }\n\n /// @dev Pauses all token transfers across bridge\n function pause() external onlyOwner {\n _pause();\n }\n\n /// @dev Unpauses all token transfers across bridge\n function unpause() external onlyOwner {\n _unpause();\n }\n\n function _processMessageFromRoot(\n uint256, /* stateId */\n address sender,\n bytes memory data\n ) internal override validateSender(sender) {\n _syncDeposit(data);\n }\n\n function _syncDeposit(bytes memory syncData) internal {\n (address to, uint256 size, uint256 x, uint256 y, bytes memory data) =\n abi.decode(syncData, (address, uint256, uint256, uint256, bytes));\n if (!childToken.exists(size, x, y)) childToken.mintQuad(to, size, x, y, data);\n else childToken.transferQuad(address(this), to, size, x, y, data);\n emit Deposit(to, size, x, y, data);\n }\n\n function _msgSender() internal view override(Context, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n\n function onERC721Received(\n address, /* operator */\n address, /* from */\n uint256, /* tokenId */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(transferringToL1, \"PolygonLandTunnel: !BRIDGING\");\n return this.onERC721Received.selector;\n }\n\n function onERC721BatchReceived(\n address, /* operator */\n address, /* from */\n uint256[] calldata, /* ids */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(transferringToL1, \"PolygonLandTunnel: !BRIDGING\");\n return this.onERC721BatchReceived.selector;\n }\n\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n return interfaceId == 0x5e8bf644 || interfaceId == 0x01ffc9a7;\n }\n}\n" + }, + "src/solc_0.8/polygon/child/land/PolygonLandTunnelMigration.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IPolygonLandWithSetApproval} from \"../../../common/interfaces/IPolygonLandWithSetApproval.sol\";\nimport {IPolygonLandTunnel} from \"../../../common/interfaces/IPolygonLandTunnel.sol\";\nimport {IERC721MandatoryTokenReceiver} from \"../../../common/interfaces/IERC721MandatoryTokenReceiver.sol\";\n\n/// @title Tunnel migration on L2\n/// @author The Sandbox\n/// @notice contract handling the migration of LAND tokens from a tunnel to a new one\ncontract PolygonLandTunnelMigration is IERC721MandatoryTokenReceiver {\n struct OwnerWithLandIds {\n address owner;\n uint256[] sizes;\n uint256[] x;\n uint256[] y;\n }\n\n IPolygonLandWithSetApproval public immutable polygonLand;\n address public immutable newLandTunnel;\n address public immutable oldLandTunnel;\n address private admin;\n\n event TunnelLandsMigrated(address indexed oldLandTunnel, address indexed newLandTunnel, uint256[] ids);\n event TunnelLandsMigratedWithWithdraw(OwnerWithLandIds indexed _ownerWithLandIds);\n event TunnelQuadsMigrated(\n address indexed oldLandTunnel,\n address indexed newLandTunnel,\n uint256[] sizes,\n uint256[] x,\n uint256[] y\n );\n event AdminChanged(address indexed _newAdmin);\n\n modifier isAdmin() {\n require(admin == msg.sender, \"PolygonLandTunnelMigration: !AUTHORISED\");\n _;\n }\n\n /// @notice constructor of the tunnel migration contract\n /// @param _polygonLand LAND token address on the child chain\n /// @param _newLandTunnel tunnel address to migrate to\n /// @param _oldLandTunnel tunnel address to migrate from\n /// @param _admin admin of the contract\n constructor(\n address _polygonLand,\n address _newLandTunnel,\n address _oldLandTunnel,\n address _admin\n ) {\n require(_admin != address(0), \"PolygonLandTunnelMigration: admin can't be zero address\");\n require(_polygonLand != address(0), \"PolygonLandTunnelMigration: polygonLand can't be zero address\");\n require(_newLandTunnel != address(0), \"PolygonLandTunnelMigration: new Tunnel can't be zero address\");\n require(_oldLandTunnel != address(0), \"PolygonLandTunnelMigration: old Tunnel can't be zero address\");\n admin = _admin;\n polygonLand = IPolygonLandWithSetApproval(_polygonLand);\n newLandTunnel = _newLandTunnel;\n oldLandTunnel = _oldLandTunnel;\n\n emit AdminChanged(_admin);\n }\n\n /// @dev Transfers all the passed land ids from the old land tunnel to the new land tunnel\n /// @notice This method needs super operator role to execute\n /// @param ids of land tokens to be migrated\n function migrateLandsToTunnel(uint256[] memory ids) external isAdmin {\n polygonLand.batchTransferFrom(oldLandTunnel, newLandTunnel, ids, \"\");\n emit TunnelLandsMigrated(oldLandTunnel, newLandTunnel, ids);\n }\n\n /// @dev Fetches locked land ids to this contract and withdraws again through the new tunnel\n /// @notice This method needs super operator role to execute\n /// @param _ownerWithLandIds struct containing token owner with their land ids\n function migrateToTunnelWithWithdraw(OwnerWithLandIds memory _ownerWithLandIds) external isAdmin {\n // check for gas limits based on the number of locked tokens\n // Fetch locked tokens to this contract address\n polygonLand.batchTransferQuad(\n oldLandTunnel,\n address(this),\n _ownerWithLandIds.sizes,\n _ownerWithLandIds.x,\n _ownerWithLandIds.y,\n \"\"\n );\n // Withdraw tokens to L1\n IPolygonLandTunnel(newLandTunnel).batchTransferQuadToL1(\n _ownerWithLandIds.owner,\n _ownerWithLandIds.sizes,\n _ownerWithLandIds.x,\n _ownerWithLandIds.y,\n \"\"\n );\n\n emit TunnelLandsMigratedWithWithdraw(_ownerWithLandIds);\n }\n\n ///@dev approves New Land Tunnel to transfer Lands on behalf of this contract\n function approveNewLandTunnel() external isAdmin {\n polygonLand.setApprovalForAll(newLandTunnel, true);\n }\n\n /// @dev Transfers all the passed quads from the old land tunnel to the new land tunnel\n /// @notice This method needs super operator role to execute\n /// @param sizes of land quads to be migrated\n /// @param x coordinate of land quads to be migrated\n /// @param y coordinate of land quads to be migrated\n function migrateQuadsToTunnel(\n uint256[] memory sizes,\n uint256[] memory x,\n uint256[] memory y\n ) external isAdmin {\n polygonLand.batchTransferQuad(oldLandTunnel, newLandTunnel, sizes, x, y, \"\");\n emit TunnelQuadsMigrated(oldLandTunnel, newLandTunnel, sizes, x, y);\n }\n\n /// @notice changes admin to new admin\n /// @param _newAdmin the new admin to be set\n function changeAdmin(address _newAdmin) external isAdmin {\n require(_newAdmin != address(0), \"PolygonLandTunnelMigration: admin can't be zero address\");\n admin = _newAdmin;\n emit AdminChanged(_newAdmin);\n }\n\n /// @dev called on ERC721 transfer to this contract\n /// @return onERC721Received function selector\n function onERC721Received(\n address, /* operator */\n address, /* from */\n uint256, /* tokenId */\n bytes calldata /* data */\n ) external pure override returns (bytes4) {\n return this.onERC721Received.selector;\n }\n\n /// @dev called on ERC721 batch transfer to this contract\n /// @return onERC721BatchReceived function selector\n function onERC721BatchReceived(\n address, /* operator */\n address, /* from */\n uint256[] calldata, /* ids */\n bytes calldata /* data */\n ) external pure override returns (bytes4) {\n return this.onERC721BatchReceived.selector;\n }\n\n /// @dev to be called by external contact to check if this contract supports ERC721 token and batch token receive\n /// @param interfaceId the interface to be checked if supported by the contract\n /// @return 0x5e8bf644 is the interface of IERC721MandatoryTokenReceiver and 0x01ffc9a7 for the Eip 165 supports interface's interface id\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n return interfaceId == 0x5e8bf644 || interfaceId == 0x01ffc9a7;\n }\n}\n" + }, + "src/solc_0.8/polygon/child/land/PolygonLandTunnelV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {FxBaseChildTunnelUpgradeable} from \"../../../common/fx-portal/FxBaseChildTunnelUpgradeable.sol\";\nimport {\n OwnableUpgradeable,\n ContextUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport {IPolygonLandV2} from \"../../../common/interfaces/IPolygonLandV2.sol\";\nimport {IERC721MandatoryTokenReceiver} from \"../../../common/interfaces/IERC721MandatoryTokenReceiver.sol\";\nimport {ERC2771Handler} from \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\n\n/**\n * @title PolygonLandTunnelV2\n * @author The Sandbox\n * @notice LAND tunnel on the child chain\n */\ncontract PolygonLandTunnelV2 is\n FxBaseChildTunnelUpgradeable,\n IERC721MandatoryTokenReceiver,\n ERC2771Handler,\n OwnableUpgradeable,\n PausableUpgradeable\n{\n bool internal transferringToL1;\n uint32 public maxGasLimitOnL1;\n uint256 public maxAllowedLands;\n IPolygonLandV2 public childToken;\n\n mapping(uint8 => uint32) public gasLimits;\n\n event SetGasLimit(uint8 indexed size, uint32 indexed limit);\n event SetMaxGasLimit(uint32 maxGasLimit);\n event SetMaxAllowedLands(uint256 maxLands);\n event Deposit(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\n event Withdraw(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\n\n /// @notice initialize the contract\n /// @param _fxChild child contract for state receiver\n /// @param _childToken address of the token on the child chain\n /// @param _trustedForwarder address of an ERC2771 meta transaction sender contract\n /// @param _maxGasLimit maximum accepted gas limit\n /// @param _maxAllowedLands maximum number of Lands accepted\n /// @param limits the estimated gas that the L1 tx will use per quad size\n function initialize(\n address _fxChild,\n IPolygonLandV2 _childToken,\n address _trustedForwarder,\n uint32 _maxGasLimit,\n uint256 _maxAllowedLands,\n uint32[5] memory limits\n ) public initializer {\n __Ownable_init();\n __Pausable_init();\n childToken = _childToken;\n _setMaxLimitOnL1(_maxGasLimit);\n _setMaxAllowedLands(_maxAllowedLands);\n setupGasLimits(limits);\n __FxBaseChildTunnelUpgradeable_initialize(_fxChild);\n __ERC2771Handler_initialize(_trustedForwarder);\n }\n\n /// @notice set the limit of lands we can send in one tx to L1\n /// @param _maxAllowedLands maximum number of lands accepted\n function setMaxAllowedLands(uint256 _maxAllowedLands) external onlyOwner {\n require(_maxAllowedLands > 0, \"PolygonLandTunnelV2: max allowed value cannot be zero\");\n maxAllowedLands = _maxAllowedLands;\n emit SetMaxAllowedLands(_maxAllowedLands);\n }\n\n /// @notice set the estimate of gas that the L1 transaction will use per quad size\n /// @param size the size of the quad\n /// @param limit the estimated gas that the L1 tx will use\n function setGasLimit(uint8 size, uint32 limit) external onlyOwner {\n require(size == 1 || size == 3 || size == 6 || size == 12 || size == 24, \"PolygonLandTunnelV2: invalid data\");\n\n _setGasLimit(size, limit);\n }\n\n /// @notice set the estimate of gas that the L1 transaction will use per quad size\n /// @param limits the estimated gas that the L1 tx will use per quad size\n function setupGasLimits(uint32[5] memory limits) public onlyOwner {\n _setGasLimit(1, limits[0]);\n _setGasLimit(3, limits[1]);\n _setGasLimit(6, limits[2]);\n _setGasLimit(12, limits[3]);\n _setGasLimit(24, limits[4]);\n }\n\n /// @notice send a batch of quads to L1\n /// @param to address of the receiver on L1\n /// @param sizes sizes of quad\n /// @param xs x coordinates of quads\n /// @param ys y coordinates of quads\n /// @param data data send to the receiver onERC721BatchReceived on L1\n function batchTransferQuadToL1(\n address to,\n uint256[] calldata sizes,\n uint256[] calldata xs,\n uint256[] calldata ys,\n bytes memory data\n ) external whenNotPaused() {\n require(to != address(0), \"PolygonLandTunnelV2: can't send to zero address\");\n require(sizes.length == xs.length, \"PolygonLandTunnelV2: sizes's and x's length are different\");\n require(sizes.length == ys.length, \"PolygonLandTunnelV2: x's and y's length are different\");\n\n uint32 totalGasLimit = 0;\n uint256 lands = 0;\n for (uint256 i = 0; i < sizes.length; i++) {\n totalGasLimit += gasLimits[uint8(sizes[i])];\n lands += sizes[i] * sizes[i];\n }\n\n require(lands <= maxAllowedLands, \"PolygonLandTunnelV2: Exceeds max allowed lands.\");\n require(totalGasLimit < maxGasLimitOnL1, \"PolygonLandTunnelV2: Exceeds gas limit on L1.\");\n transferringToL1 = true;\n for (uint256 i = 0; i < sizes.length; i++) {\n childToken.transferQuad(_msgSender(), address(this), sizes[i], xs[i], ys[i], data);\n emit Withdraw(to, sizes[i], xs[i], ys[i], data);\n }\n _sendMessageToRoot(abi.encode(to, sizes, xs, ys, data));\n transferringToL1 = false;\n }\n\n /// @notice sets the fx-root tunnel\n /// @dev only owner can call this funtion\n /// @param _fxRootTunnel address of the fx-root tunnel\n function setFxRootTunnel(address _fxRootTunnel) external override onlyOwner {\n require(fxRootTunnel == address(0), \"PolygonLandTunnelV2: ROOT_TUNNEL_ALREADY_SET\");\n\n fxRootTunnel = _fxRootTunnel;\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n\n emit TrustedForwarderSet(trustedForwarder);\n }\n\n /// @notice set the limit of estimated gas we accept when sending a batch of quads to L1\n /// @param _maxGasLimit maximum accepted gas limit\n function setMaxLimitOnL1(uint32 _maxGasLimit) external onlyOwner {\n _setMaxLimitOnL1(_maxGasLimit);\n }\n\n /// @dev Pauses all token transfers across bridge\n function pause() external onlyOwner {\n _pause();\n }\n\n /// @dev Unpauses all token transfers across bridge\n function unpause() external onlyOwner {\n _unpause();\n }\n\n /// @dev called on ERC721 transfer to this contract\n /// @param operator address of the one sending the ERC721 Token\n /// @return onERC721Received function selector\n function onERC721Received(\n address operator,\n address,\n uint256,\n bytes calldata\n ) external view override returns (bytes4) {\n require(transferringToL1 || childToken.isSuperOperator(operator), \"PolygonLandTunnelV2: !BRIDGING\");\n return this.onERC721Received.selector;\n }\n\n /// @dev called on ERC721 batch transfer to this contract\n /// @param operator address of the one sending the ERC721 Token\n /// @return onERC721BatchReceived function selector\n function onERC721BatchReceived(\n address operator,\n address,\n uint256[] calldata,\n bytes calldata\n ) external view override returns (bytes4) {\n require(transferringToL1 || childToken.isSuperOperator(operator), \"PolygonLandTunnelV2: !BRIDGING\");\n return this.onERC721BatchReceived.selector;\n }\n\n /// @dev to be called by external contact to check if this contract supports ERC721 token and batch token receive\n /// @param interfaceId the interface to be checked if supported by the contract\n /// @return 0x5e8bf644 is the interface of IERC721MandatoryTokenReceiver and 0x01ffc9a7 for the Eip 165 supports interface's interface id\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n return interfaceId == 0x5e8bf644 || interfaceId == 0x01ffc9a7;\n }\n\n function _processMessageFromRoot(\n uint256,\n address sender,\n bytes memory data\n ) internal override validateSender(sender) {\n _syncDeposit(data);\n }\n\n function _setMaxLimitOnL1(uint32 _maxGasLimit) internal {\n maxGasLimitOnL1 = _maxGasLimit;\n emit SetMaxGasLimit(_maxGasLimit);\n }\n\n function _setMaxAllowedLands(uint256 _maxAllowedLands) internal {\n require(_maxAllowedLands > 0, \"PolygonLandTunnelV2: max allowed value cannot be zero\");\n maxAllowedLands = _maxAllowedLands;\n emit SetMaxAllowedLands(_maxAllowedLands);\n }\n\n function _syncDeposit(bytes memory syncData) internal {\n (address to, uint256 size, uint256 x, uint256 y, bytes memory data) =\n abi.decode(syncData, (address, uint256, uint256, uint256, bytes));\n childToken.mintAndTransferQuad(to, size, x, y, data);\n emit Deposit(to, size, x, y, data);\n }\n\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n\n function _setGasLimit(uint8 size, uint32 limit) internal {\n gasLimits[size] = limit;\n emit SetGasLimit(size, limit);\n }\n\n uint256[50] private __gap;\n}\n" + }, + "src/solc_0.8/polygon/child/land/PolygonLandV1.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"./PolygonLandBaseToken.sol\";\nimport \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\n/// @title LAND token on L2\ncontract PolygonLandV1 is PolygonLandBaseToken, ERC2771Handler {\n function initialize(address trustedForwarder) external initializer {\n _admin = _msgSender();\n __ERC2771Handler_initialize(trustedForwarder);\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyAdmin {\n _trustedForwarder = trustedForwarder;\n }\n\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n}\n" + }, + "src/solc_0.8/polygon/child/land/PolygonLandV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"./PolygonLandBaseTokenV2.sol\";\nimport \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\nimport \"../../../OperatorFilterer/contracts/upgradeable/OperatorFiltererUpgradeable.sol\";\n\n/// @title LAND token on L2\ncontract PolygonLandV2 is PolygonLandBaseTokenV2, ERC2771Handler, OperatorFiltererUpgradeable {\n using AddressUpgradeable for address;\n\n event OperatorRegistrySet(address indexed registry);\n\n function initialize(address trustedForwarder) external initializer {\n _admin = _msgSender();\n __ERC2771Handler_initialize(trustedForwarder);\n emit AdminChanged(address(0), _admin);\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyAdmin {\n _trustedForwarder = trustedForwarder;\n emit TrustedForwarderSet(trustedForwarder);\n }\n\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n\n /**\n * @notice Approve an operator to spend tokens on the sender behalf\n * @param sender The address giving the approval\n * @param operator The address receiving the approval\n * @param id The id of the token\n */\n function approveFor(\n address sender,\n address operator,\n uint256 id\n ) public override onlyAllowedOperatorApproval(operator) {\n super.approveFor(sender, operator, id);\n }\n\n /**\n * @notice Approve an operator to spend tokens on the sender behalf\n * @param operator The address receiving the approval\n * @param id The id of the token\n */\n function approve(address operator, uint256 id) public override onlyAllowedOperatorApproval(operator) {\n super.approve(operator, id);\n }\n\n /**\n * @notice Transfer a token between 2 addresses\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param id The id of the token\n */\n function transferFrom(\n address from,\n address to,\n uint256 id\n ) public override onlyAllowedOperator(from) {\n super.transferFrom(from, to, id);\n }\n\n /**\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\n * @param from The sender of the token\n * @param to The recipient of the token\n * @param id The id of the token\n * @param data Additional data\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) public override onlyAllowedOperator(from) {\n super.safeTransferFrom(from, to, id, data);\n }\n\n /**\n * @notice Transfer a token between 2 addresses letting the receiver knows of the transfer\n * @param from The send of the token\n * @param to The recipient of the token\n * @param id The id of the token\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id\n ) public override onlyAllowedOperator(from) {\n super.safeTransferFrom(from, to, id);\n }\n\n /**\n * @notice Set the approval for an operator to manage all the tokens of the sender\n * @param operator The address receiving the approval\n * @param approved The determination of the approval\n */\n function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {\n super.setApprovalForAll(operator, approved);\n }\n\n /**\n * @notice Set the approval for an operator to manage all the tokens of the sender\n * @param sender The address giving the approval\n * @param operator The address receiving the approval\n * @param approved The determination of the approval\n */\n function setApprovalForAllFor(\n address sender,\n address operator,\n bool approved\n ) public override onlyAllowedOperatorApproval(operator) {\n super.setApprovalForAllFor(sender, operator, approved);\n }\n\n /// @notice This function is used to register Land contract on the Operator Filterer Registry of Opensea.\n /// @dev can only be called by admin.\n /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe.\n /// @param subscribe bool to signify subscription 'true' or to copy the list 'false'.\n function register(address subscriptionOrRegistrantToCopy, bool subscribe) external onlyAdmin {\n require(subscriptionOrRegistrantToCopy != address(0), \"PolygonLandV2: subscription can't be zero address\");\n _register(subscriptionOrRegistrantToCopy, subscribe);\n }\n\n /// @notice sets filter registry address deployed in test\n /// @param registry the address of the registry\n function setOperatorRegistry(address registry) external virtual onlyAdmin {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n emit OperatorRegistrySet(registry);\n }\n}\n" + }, + "src/solc_0.8/polygon/child/sand/interfaces/IPolygonSand.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ninterface IPolygonSand {\n /// @notice update the ChildChainManager Proxy address\n /// @param newChildChainManagerProxy address of the new childChainManagerProxy\n function updateChildChainManager(address newChildChainManagerProxy) external;\n\n /// @notice called when tokens are deposited on root chain\n /// @param user user address for whom deposit is being done\n /// @param depositData abi encoded amount\n function deposit(address user, bytes calldata depositData) external;\n\n /// @notice called when user wants to withdraw tokens back to root chain\n /// @dev Should burn user's tokens. This transaction will be verified when exiting on root chain\n /// @param amount amount to withdraw\n function withdraw(uint256 amount) external;\n\n /// @notice Get the balance of `owner`.\n /// @param owner The address to query the balance of.\n /// @return The amount owned by `owner`.\n function balanceOf(address owner) external returns (uint256);\n\n /// @notice transfer tokens to a specific address.\n /// @param to destination address receiving the tokens.\n /// @param amount number of tokens to transfer.\n /// @return success whether the transfer succeeded.\n function transfer(address to, uint256 amount) external returns (bool success);\n\n /// @notice transfer tokens from one address to another.\n /// @param from address tokens will be sent from.\n /// @param to destination address receiving the tokens.\n /// @param amount number of tokens to transfer.\n /// @return success whether the transfer succeeded.\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool success);\n\n function setTrustedForwarder(address trustedForwarder) external;\n}\n" + }, + "src/solc_0.8/polygon/child/sand/PolygonSand.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\nimport \"../../../Sand/SandBaseToken.sol\";\n\ncontract PolygonSand is SandBaseToken, Ownable, ERC2771Handler {\n address public childChainManagerProxy;\n\n constructor(\n address _childChainManagerProxy,\n address trustedForwarder,\n address sandAdmin,\n address executionAdmin\n ) SandBaseToken(sandAdmin, executionAdmin, address(0), 0) {\n require(_childChainManagerProxy != address(0), \"Bad ChildChainManagerProxy address\");\n childChainManagerProxy = _childChainManagerProxy;\n __ERC2771Handler_initialize(trustedForwarder);\n }\n\n /// @notice update the ChildChainManager Proxy address\n /// @param newChildChainManagerProxy address of the new childChainManagerProxy\n function updateChildChainManager(address newChildChainManagerProxy) external onlyOwner {\n require(newChildChainManagerProxy != address(0), \"Bad ChildChainManagerProxy address\");\n childChainManagerProxy = newChildChainManagerProxy;\n }\n\n /// @notice called when tokens are deposited on root chain\n /// @param user user address for whom deposit is being done\n /// @param depositData abi encoded amount\n function deposit(address user, bytes calldata depositData) external {\n require(_msgSender() == childChainManagerProxy, \"You're not allowed to deposit\");\n uint256 amount = abi.decode(depositData, (uint256));\n _mint(user, amount);\n }\n\n /// @notice called when user wants to withdraw tokens back to root chain\n /// @dev Should burn user's tokens. This transaction will be verified when exiting on root chain\n /// @param amount amount to withdraw\n function withdraw(uint256 amount) external {\n _burn(_msgSender(), amount);\n }\n\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n }\n\n function _msgSender() internal view override(Context, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n}\n" + }, + "src/solc_0.8/polygon/child/sand/PolygonSandClaim.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/security/ReentrancyGuard.sol\";\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport \"./interfaces/IPolygonSand.sol\";\n\ncontract PolygonSandClaim is Ownable, ReentrancyGuard {\n IPolygonSand internal immutable _polygonSand;\n IERC20 internal immutable _fakePolygonSand;\n\n event SandClaimed(address indexed user, uint256 amount);\n\n constructor(IPolygonSand polygonSand, IERC20 fakePolygonSand) {\n _polygonSand = polygonSand;\n _fakePolygonSand = fakePolygonSand;\n }\n\n /**\n * @notice Swaps fake sand with the new polygonSand\n * @param amount the amount of tokens to be swapped\n */\n function claim(uint256 amount) external nonReentrant {\n require(unclaimedSand() >= amount, \"Not enough sand for claim\");\n bool success = _fakePolygonSand.transferFrom(msg.sender, address(this), amount);\n if (success) {\n _polygonSand.transfer(msg.sender, amount);\n emit SandClaimed(msg.sender, amount);\n }\n }\n\n // Getters\n\n /**\n * @notice Getter for amount of sand which is still locked in this contract\n */\n function unclaimedSand() public returns (uint256) {\n return _polygonSand.balanceOf(address(this));\n }\n\n /**\n * @notice Getter for amount of fake Sand swapped\n */\n function claimedSand() external view returns (uint256) {\n return _fakePolygonSand.balanceOf(address(this));\n }\n}\n" + }, + "src/solc_0.8/polygon/common/ERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155Receiver.sol\";\n\nabstract contract ERC1155Receiver is IERC1155Receiver {\n function onERC1155Received(\n address, /* operator */\n address, /* from */\n uint256, /* id */\n uint256, /* value */\n bytes calldata /* data */\n ) external view virtual override returns (bytes4) {\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address, /* operator */\n address, /* from */\n uint256[] calldata, /* ids */\n uint256[] calldata, /* values */\n bytes calldata /* data */\n ) external view virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n}\n" + }, + "src/solc_0.8/polygon/LiquidityMining/IRewardDistributionRecipient.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\n\nabstract contract IRewardDistributionRecipient is Ownable {\n address public rewardDistribution;\n\n function notifyRewardAmount(uint256 reward) external virtual;\n\n modifier onlyRewardDistribution() {\n require(_msgSender() == rewardDistribution, \"Caller is not reward distribution\");\n _;\n }\n\n modifier onlyRewardDistributionOrAccount(address account) {\n require(\n _msgSender() == rewardDistribution || _msgSender() == account,\n \"Caller is not reward distribution or account\"\n );\n _;\n }\n\n function setRewardDistribution(address _rewardDistribution) external onlyOwner {\n rewardDistribution = _rewardDistribution;\n }\n}\n" + }, + "src/solc_0.8/polygon/LiquidityMining/PolygonLandWeightedSANDRewardPool.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/utils/math/SafeMath.sol\";\nimport \"@openzeppelin/contracts-0.8/utils/math/Math.sol\";\nimport \"@openzeppelin/contracts-0.8/security/ReentrancyGuard.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../../common/Libraries/SafeMathWithRequire.sol\";\nimport \"./IRewardDistributionRecipient.sol\";\nimport \"../../common/interfaces/IERC721.sol\";\n\ncontract PolygonLPTokenWrapper {\n using SafeMath for uint256;\n using SafeERC20 for IERC20;\n\n uint256 internal constant DECIMALS_18 = 1000000000000000000;\n\n IERC20 internal _stakeToken;\n\n uint256 private _totalSupply;\n mapping(address => uint256) private _balances;\n\n constructor(IERC20 stakeToken) {\n _stakeToken = stakeToken;\n }\n\n function totalSupply() public view returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view returns (uint256) {\n return _balances[account];\n }\n\n function stake(uint256 amount) public virtual {\n _totalSupply = _totalSupply.add(amount);\n _balances[msg.sender] = _balances[msg.sender].add(amount);\n _stakeToken.safeTransferFrom(msg.sender, address(this), amount);\n }\n\n function withdraw(uint256 amount) public virtual {\n _totalSupply = _totalSupply.sub(amount);\n _balances[msg.sender] = _balances[msg.sender].sub(amount);\n _stakeToken.safeTransfer(msg.sender, amount);\n }\n}\n\n///@notice Reward Pool based on unipool contract : https://github.com/Synthetixio/Unipool/blob/master/contracts/Unipool.sol\n//with the addition of NFT multiplier reward\ncontract PolygonLandWeightedSANDRewardPool is PolygonLPTokenWrapper, IRewardDistributionRecipient, ReentrancyGuard {\n using SafeMath for uint256;\n using SafeMathWithRequire for uint256;\n using SafeERC20 for IERC20;\n using Address for address;\n\n event RewardAdded(uint256 reward);\n event Staked(address indexed user, uint256 amount);\n event Withdrawn(address indexed user, uint256 amount);\n event RewardPaid(address indexed user, uint256 reward);\n event MultiplierComputed(address indexed user, uint256 multiplier, uint256 contribution);\n\n uint256 public immutable duration;\n\n uint256 public periodFinish = 0;\n uint256 public rewardRate = 0;\n uint256 public lastUpdateTime;\n uint256 public rewardPerTokenStored;\n mapping(address => uint256) public userRewardPerTokenPaid;\n mapping(address => uint256) public rewards;\n\n uint256 internal constant DECIMALS_9 = 1000000000;\n uint256 internal constant MIDPOINT_9 = 500000000;\n uint256 internal constant NFT_FACTOR_6 = 10000;\n uint256 internal constant NFT_CONSTANT_3 = 9000;\n uint256 internal constant ROOT3_FACTOR = 697;\n\n IERC20 internal _rewardToken;\n IERC721 internal _multiplierNFToken;\n\n uint256 internal _totalContributions;\n mapping(address => uint256) internal _multipliers;\n mapping(address => uint256) internal _contributions;\n\n constructor(\n IERC20 stakeToken,\n IERC20 rewardToken,\n IERC721 multiplierNFToken,\n uint256 rewardDuration\n ) PolygonLPTokenWrapper(stakeToken) {\n _rewardToken = rewardToken;\n _multiplierNFToken = multiplierNFToken;\n duration = rewardDuration;\n }\n\n function totalContributions() public view returns (uint256) {\n return _totalContributions;\n }\n\n function contributionOf(address account) public view returns (uint256) {\n return _contributions[account];\n }\n\n function multiplierOf(address account) public view returns (uint256) {\n return _multipliers[account];\n }\n\n modifier updateReward(address account) {\n rewardPerTokenStored = rewardPerToken();\n\n if (block.timestamp >= periodFinish || _totalContributions != 0) {\n // ensure reward past the first staker do not get lost\n lastUpdateTime = lastTimeRewardApplicable();\n }\n if (account != address(0)) {\n rewards[account] = earned(account);\n userRewardPerTokenPaid[account] = rewardPerTokenStored;\n }\n _;\n }\n\n function lastTimeRewardApplicable() public view returns (uint256) {\n return Math.min(block.timestamp, periodFinish);\n }\n\n function rewardPerToken() public view returns (uint256) {\n if (totalContributions() == 0) {\n return rewardPerTokenStored;\n }\n return\n rewardPerTokenStored.add(\n lastTimeRewardApplicable().sub(lastUpdateTime).mul(rewardRate).mul(1e24).div(totalContributions())\n );\n }\n\n function earned(address account) public view returns (uint256) {\n return\n contributionOf(account).mul(rewardPerToken().sub(userRewardPerTokenPaid[account])).div(1e24).add(\n rewards[account]\n );\n }\n\n function computeContribution(uint256 amountStaked, uint256 numLands) public pure returns (uint256) {\n if (numLands == 0) {\n return amountStaked;\n }\n uint256 nftContrib = NFT_FACTOR_6.mul(NFT_CONSTANT_3.add(numLands.sub(1).mul(ROOT3_FACTOR).add(1).cbrt3()));\n if (nftContrib > MIDPOINT_9) {\n nftContrib = MIDPOINT_9.add(nftContrib.sub(MIDPOINT_9).div(10));\n }\n return amountStaked.add(amountStaked.mul(nftContrib).div(DECIMALS_9));\n }\n\n function updateContribution(address account) internal {\n _totalContributions = _totalContributions.sub(contributionOf(account));\n _multipliers[account] = _multiplierNFToken.balanceOf(account);\n\n uint256 contribution = computeContribution(balanceOf(account), multiplierOf(account));\n\n _totalContributions = _totalContributions.add(contribution);\n _contributions[account] = contribution;\n }\n\n function computeMultiplier(address account) public onlyRewardDistributionOrAccount(account) updateReward(account) {\n updateContribution(account);\n\n emit MultiplierComputed(account, multiplierOf(account), contributionOf(account));\n }\n\n function stake(uint256 amount) public override nonReentrant updateReward(msg.sender) {\n require(amount > 0, \"Cannot stake 0\");\n\n super.stake(amount);\n\n updateContribution(msg.sender);\n\n emit Staked(msg.sender, amount);\n }\n\n function withdraw(uint256 amount) public override nonReentrant updateReward(msg.sender) {\n require(amount > 0, \"Cannot withdraw 0\");\n\n super.withdraw(amount);\n\n updateContribution(msg.sender);\n\n emit Withdrawn(msg.sender, amount);\n }\n\n function exit() external {\n withdraw(balanceOf(msg.sender));\n getReward();\n }\n\n function getReward() public nonReentrant updateReward(msg.sender) {\n uint256 reward = rewards[msg.sender];\n if (reward > 0) {\n rewards[msg.sender] = 0;\n _rewardToken.safeTransfer(msg.sender, reward);\n emit RewardPaid(msg.sender, reward);\n }\n }\n\n ///@notice to be called after the amount of reward tokens (specified by the reward parameter) has been sent to the contract\n // Note that the reward should be divisible by the duration to avoid reward token lost\n ///@param reward number of token to be distributed over the duration\n function notifyRewardAmount(uint256 reward) external override onlyRewardDistribution updateReward(address(0)) {\n if (block.timestamp >= periodFinish) {\n rewardRate = reward.div(duration);\n } else {\n uint256 remaining = periodFinish.sub(block.timestamp);\n uint256 leftover = remaining.mul(rewardRate);\n rewardRate = reward.add(leftover).div(duration);\n }\n lastUpdateTime = block.timestamp;\n periodFinish = block.timestamp.add(duration);\n emit RewardAdded(reward);\n }\n\n // Add Setter functions for every external contract\n\n function SetRewardToken(address newRewardToken) external onlyOwner {\n require(newRewardToken.isContract(), \"Bad RewardToken address\");\n\n _rewardToken = IERC20(newRewardToken);\n }\n\n function SetStakeLPToken(address newStakeLPToken) external onlyOwner {\n require(newStakeLPToken.isContract(), \"Bad StakeToken address\");\n\n _stakeToken = IERC20(newStakeLPToken);\n }\n\n function SetNFTMultiplierToken(address newNFTMultiplierToken) external onlyOwner {\n require(newNFTMultiplierToken.isContract(), \"Bad NFTMultiplierToken address\");\n\n _multiplierNFToken = IERC721(newNFTMultiplierToken);\n }\n}\n" + }, + "src/solc_0.8/polygon/LiquidityMining/PolygonSANDRewardPool.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/utils/math/SafeMath.sol\";\nimport \"@openzeppelin/contracts-0.8/utils/math/Math.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport \"./IRewardDistributionRecipient.sol\";\nimport \"../../common/interfaces/IERC721.sol\";\n\ncontract LPTokenWrapper {\n using SafeMath for uint256;\n using SafeERC20 for IERC20;\n\n IERC20 internal _stakeToken;\n\n uint256 private _totalSupply;\n mapping(address => uint256) private _balances;\n\n constructor(IERC20 stakeToken) {\n _stakeToken = stakeToken;\n }\n\n function totalSupply() public view returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view returns (uint256) {\n return _balances[account];\n }\n\n function stake(uint256 amount) public virtual {\n _totalSupply = _totalSupply.add(amount);\n _balances[msg.sender] = _balances[msg.sender].add(amount);\n _stakeToken.safeTransferFrom(msg.sender, address(this), amount);\n }\n\n function withdraw(uint256 amount) public virtual {\n _totalSupply = _totalSupply.sub(amount);\n _balances[msg.sender] = _balances[msg.sender].sub(amount);\n _stakeToken.safeTransfer(msg.sender, amount);\n }\n}\n\ncontract PolygonSANDRewardPool is LPTokenWrapper, IRewardDistributionRecipient {\n using SafeMath for uint256;\n using SafeERC20 for IERC20;\n\n uint256 public constant DURATION = 30 days; // Reward period\n\n uint256 public periodFinish = 0;\n uint256 public rewardRate = 0;\n uint256 public lastUpdateTime;\n uint256 public rewardPerTokenStored;\n mapping(address => uint256) public userRewardPerTokenPaid;\n mapping(address => uint256) public rewards;\n\n event RewardAdded(uint256 reward);\n event Staked(address indexed user, uint256 amount);\n event Withdrawn(address indexed user, uint256 amount);\n event RewardPaid(address indexed user, uint256 reward);\n\n IERC20 internal _rewardToken;\n\n constructor(IERC20 stakeToken, IERC20 rewardToken) LPTokenWrapper(stakeToken) {\n _rewardToken = rewardToken;\n }\n\n modifier updateReward(address account) {\n rewardPerTokenStored = rewardPerToken();\n lastUpdateTime = lastTimeRewardApplicable();\n if (account != address(0)) {\n rewards[account] = earned(account);\n userRewardPerTokenPaid[account] = rewardPerTokenStored;\n }\n _;\n }\n\n function lastTimeRewardApplicable() public view returns (uint256) {\n return Math.min(block.timestamp, periodFinish);\n }\n\n function rewardPerToken() public view returns (uint256) {\n if (totalSupply() == 0) {\n return rewardPerTokenStored;\n }\n return\n rewardPerTokenStored.add(\n lastTimeRewardApplicable().sub(lastUpdateTime).mul(rewardRate).mul(1e18).div(totalSupply())\n );\n }\n\n function earned(address account) public view returns (uint256) {\n return\n balanceOf(account).mul(rewardPerToken().sub(userRewardPerTokenPaid[account])).div(1e18).add(\n rewards[account]\n );\n }\n\n // stake visibility is public as overriding LPTokenWrapper's stake() function\n function stake(uint256 amount) public override updateReward(msg.sender) {\n require(amount > 0, \"Cannot stake 0\");\n super.stake(amount);\n emit Staked(msg.sender, amount);\n }\n\n function withdraw(uint256 amount) public override updateReward(msg.sender) {\n require(amount > 0, \"Cannot withdraw 0\");\n super.withdraw(amount);\n emit Withdrawn(msg.sender, amount);\n }\n\n function exit() external {\n withdraw(balanceOf(msg.sender));\n getReward();\n }\n\n function getReward() public updateReward(msg.sender) {\n uint256 reward = earned(msg.sender);\n if (reward > 0) {\n rewards[msg.sender] = 0;\n _rewardToken.safeTransfer(msg.sender, reward);\n emit RewardPaid(msg.sender, reward);\n }\n }\n\n function notifyRewardAmount(uint256 reward) external override onlyRewardDistribution updateReward(address(0)) {\n if (block.timestamp >= periodFinish) {\n rewardRate = reward.div(DURATION);\n } else {\n uint256 remaining = periodFinish.sub(block.timestamp);\n uint256 leftover = remaining.mul(rewardRate);\n rewardRate = reward.add(leftover).div(DURATION);\n }\n lastUpdateTime = block.timestamp;\n periodFinish = block.timestamp.add(DURATION);\n emit RewardAdded(reward);\n }\n\n // Add Setter functions for every external contract\n\n function SetRewardLPToken(address newRewardToken) external onlyOwner {\n require(newRewardToken != address(0), \"Bad RewardToken address\");\n\n _rewardToken = IERC20(newRewardToken);\n }\n\n function SetStakeLPToken(address newStakeLPToken) external onlyOwner {\n require(newStakeLPToken != address(0), \"Bad StakeToken address\");\n\n _stakeToken = IERC20(newStakeLPToken);\n }\n}\n" + }, + "src/solc_0.8/polygon/root/asset/AssetERC1155Tunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../../common/fx-portal/FxBaseRootTunnelUpgradeable.sol\";\nimport \"../../../common/interfaces/IAssetERC1155.sol\";\nimport \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\nimport \"../../common/ERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\n\n/// @title ASSETERC1155 bridge on L1\ncontract AssetERC1155Tunnel is\n Initializable,\n FxBaseRootTunnelUpgradeable,\n ERC1155Receiver,\n ERC2771Handler,\n OwnableUpgradeable,\n PausableUpgradeable\n{\n IAssetERC1155 public rootToken;\n uint256 public maxTransferLimit;\n bool private fetchingAssets = false;\n\n event SetTransferLimit(uint256 limit);\n event Deposit(address user, uint256 id, uint256 value, bytes data);\n event Withdraw(address user, uint256 id, uint256 value, bytes data);\n\n // solhint-disable-next-line no-empty-blocks\n constructor() initializer {}\n\n function initialize(\n address _checkpointManager,\n address _fxRoot,\n IAssetERC1155 _rootToken,\n address trustedForwarder,\n uint256 _maxTransferLimit\n ) public initializer {\n require(address(_rootToken) != address(0), \"AssetERC1155Tunnel: _rootToken can't be zero\");\n rootToken = _rootToken;\n maxTransferLimit = _maxTransferLimit;\n __Ownable_init();\n __Pausable_init();\n __ERC2771Handler_initialize(trustedForwarder);\n __FxBaseRootTunnelUpgradeable_initialize(_checkpointManager, _fxRoot);\n }\n\n function setTransferLimit(uint256 _maxTransferLimit) external onlyOwner {\n maxTransferLimit = _maxTransferLimit;\n emit SetTransferLimit(_maxTransferLimit);\n }\n\n function supportsInterface(bytes4 interfaceId) external pure override returns (bool) {\n return\n interfaceId == 0x4e2312e0 || // ERC1155Receiver\n interfaceId == 0x01ffc9a7; // ERC165\n }\n\n function batchDepositToChild(\n address to,\n uint256[] memory ids,\n uint256[] memory values\n ) public whenNotPaused {\n require(ids.length > 0, \"MISSING_TOKEN_IDS\");\n require(ids.length < maxTransferLimit, \"EXCEEDS_TRANSFER_LIMIT\");\n bytes32[] memory metadataHashes = new bytes32[](ids.length);\n fetchingAssets = true;\n for (uint256 i = 0; i < ids.length; i++) {\n bytes32 metadataHash = rootToken.metadataHash(ids[i]);\n metadataHashes[i] = metadataHash;\n bytes memory metadata = abi.encode(metadataHash);\n rootToken.safeTransferFrom(_msgSender(), address(this), ids[i], values[i], abi.encode(metadataHash));\n emit Deposit(to, ids[i], values[i], metadata);\n }\n fetchingAssets = false;\n _sendMessageToChild(abi.encode(to, ids, values, abi.encode(metadataHashes)));\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n }\n\n /// @dev Pauses all token transfers across bridge\n function pause() public onlyOwner {\n _pause();\n }\n\n /// @dev Unpauses all token transfers across bridge\n function unpause() public onlyOwner {\n _unpause();\n }\n\n function _processMessageFromChild(bytes memory message) internal override {\n (address to, uint256[] memory ids, uint256[] memory values, bytes memory data) =\n abi.decode(message, (address, uint256[], uint256[], bytes));\n bytes32[] memory metadataHashes = abi.decode(data, (bytes32[]));\n for (uint256 i = 0; i < ids.length; i++) {\n bytes memory metadata = abi.encode(metadataHashes[i]);\n if (rootToken.doesHashExist(ids[i])) {\n _depositMinted(to, ids[i], values[i], metadata);\n } else {\n rootToken.mint(to, ids[i], values[i], metadata);\n }\n emit Withdraw(to, ids[i], values[i], metadata);\n }\n }\n\n function _depositMinted(\n address to,\n uint256 id,\n uint256 value,\n bytes memory data\n ) internal {\n uint256 balance = rootToken.balanceOf(address(this), id);\n if (balance >= value) {\n rootToken.safeTransferFrom(address(this), to, id, value, data);\n } else {\n if (balance > 0) rootToken.safeTransferFrom(address(this), to, id, balance, data);\n rootToken.mintDeficit(to, id, (value - balance));\n }\n }\n\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n\n function onERC1155Received(\n address, /*_operator*/\n address, /*_from*/\n uint256, /*_id*/\n uint256, /*_value*/\n bytes calldata /*_data*/\n ) external view override returns (bytes4) {\n require(fetchingAssets == true, \"AssetERC1155Tunnel: can't directly send Assets\");\n return 0xf23a6e61; //bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))\n }\n\n function onERC1155BatchReceived(\n address, /*_operator*/\n address, /*_from*/\n uint256[] calldata, /*_ids*/\n uint256[] calldata, /*_values*/\n bytes calldata /*_data*/\n ) external view override returns (bytes4) {\n require(fetchingAssets == true, \"AssetERC1155Tunnel: can't directly send Assets\");\n return 0xbc197c81; //bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))\n }\n}\n" + }, + "src/solc_0.8/polygon/root/asset/AssetERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\nimport {BaseERC721} from \"../../../assetERC721/BaseERC721.sol\";\nimport {IERC721Base} from \"../../../common/interfaces/IERC721Base.sol\";\nimport {IAssetERC721} from \"../../../common/interfaces/IAssetERC721.sol\";\nimport {\n DefaultOperatorFiltererUpgradeable\n} from \"../../../OperatorFilterer/contracts/upgradeable/DefaultOperatorFiltererUpgradeable.sol\";\nimport {\n OperatorFiltererUpgradeable\n} from \"../../../OperatorFilterer/contracts/upgradeable/OperatorFiltererUpgradeable.sol\";\n\n/// @title This contract is for AssetERC721 which can be minted by a minter role.\n/// @dev This contract supports meta transactions.\n/// @dev This contract is final, don't inherit from it.\ncontract AssetERC721 is BaseERC721, IAssetERC721, OperatorFiltererUpgradeable {\n bytes32 public constant METADATA_ROLE = keccak256(\"METADATA_ROLE\");\n\n /// @notice fulfills the purpose of a constructor in upgradeable contracts\n function initialize(\n address trustedForwarder,\n address admin,\n address subscription\n ) public initializer {\n _setupRole(DEFAULT_ADMIN_ROLE, admin);\n _trustedForwarder = trustedForwarder;\n __ERC721_init(\"Sandbox's ASSETs ERC721\", \"ASSETERC721\");\n __OperatorFilterer_init(subscription, true);\n }\n\n /// @notice Mint an ERC721 Asset with the provided id.\n /// @dev Should be callable only by the AssetTunnel on L1 via MINTER_ROLE.\n /// @param to Address that will receive the token.\n /// @param id ERC721 id to be used.\n function mint(address to, uint256 id) public override(BaseERC721, IERC721Base) onlyRole(MINTER_ROLE) {\n BaseERC721.mint(to, id);\n }\n\n /// @notice Mint an ERC721 Asset with the provided id.\n /// @dev Should be callable only by the AssetTunnel on L1.\n /// @dev If you want to retain token metadata from L2 to L1 during exit, you must implement this method.\n /// @param to Address that will receive the token.\n /// @param id ERC721 id to be used.\n /// @param data Associated token metadata, which is decoded & used to set the token's metadata hash.\n function mint(\n address to,\n uint256 id,\n bytes calldata data\n ) public override(BaseERC721, IERC721Base) onlyRole(MINTER_ROLE) {\n BaseERC721.mint(to, id, data);\n }\n\n /// @notice Set the metadatahash for a given token id.\n /// @dev The metadata hash for the ERC721 may need to be manually set or overridden.\n /// @param id The token id.\n /// @param uri The full token URI to be used for the token id.\n function setTokenURI(uint256 id, string memory uri) external override onlyRole(METADATA_ROLE) {\n tokenUris[id] = uri;\n }\n\n /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.\n /// @param id The token to get the uri of.\n /// @return URI The token's URI string.\n function tokenURI(uint256 id) public view override(BaseERC721, IAssetERC721) returns (string memory) {\n require(ownerOf(id) != address(0), \"ZERO_ADDRESS\");\n return tokenUris[id];\n }\n\n /// @notice Query if a contract implements interface `id`.\n /// @param id the interface identifier, as specified in ERC-165.\n /// @return `true` if the contract implements `id`.\n function supportsInterface(bytes4 id) public view override(BaseERC721, IERC721Base) returns (bool) {\n return BaseERC721.supportsInterface(id);\n }\n\n /// @notice Change the address of the trusted forwarder for meta-transactions\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder)\n public\n override(BaseERC721, IERC721Base)\n onlyRole(DEFAULT_ADMIN_ROLE)\n {\n BaseERC721.setTrustedForwarder(trustedForwarder);\n }\n\n /// @notice Set the approval for an operator to manage all the tokens of the sender.\n /// @param from The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param approved The determination of the approval.\n function setApprovalForAllFor(\n address from,\n address operator,\n bool approved\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperatorApproval(operator) {\n BaseERC721.setApprovalForAllFor(from, operator, approved);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param from Address whose token is to be transferred.\n /// @param to Recipient.\n /// @param tokenId The token id to be transferred.\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperator(from) {\n BaseERC721.safeTransferFrom(from, to, tokenId);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n /// @param data Additional data.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n bytes calldata data\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperator(from) {\n BaseERC721.safeBatchTransferFrom(from, to, ids, data);\n }\n\n /// @notice Checks if address supplierd is that of an forwarder\n /// @param forwarder the address to be checked\n function isTrustedForwarder(address forwarder) public view override(BaseERC721, IERC721Base) returns (bool) {\n return BaseERC721.isTrustedForwarder(forwarder);\n }\n\n /// @notice returns the address of the trusted forwarder\n function getTrustedForwarder() public view override(BaseERC721, IERC721Base) returns (address trustedForwarder) {\n return BaseERC721.getTrustedForwarder();\n }\n\n /// @notice checks if the token id has been minted or not\n /// @param tokenId the id to be checked\n function exists(uint256 tokenId) public view override(BaseERC721, IERC721Base) returns (bool) {\n return BaseERC721.exists(tokenId);\n }\n\n /// @notice Burns token with given `id`.\n /// @param from Address whose token is to be burned.\n /// @param id Token id which will be burned.\n function burnFrom(address from, uint256 id) public override(BaseERC721, IERC721Base) {\n BaseERC721.burnFrom(from, id);\n }\n\n /// @notice Burns token with given `id`.\n /// @dev Used by default fx-portal tunnel which burns rather than locks.\n /// @param id The id of the token to be burned.\n function burn(uint256 id) public override(BaseERC721, IERC721Base) {\n BaseERC721.burn(id);\n }\n\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n function batchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperator(from) {\n BaseERC721.batchTransferFrom(from, to, ids);\n }\n\n /// @notice Approve an operator to operate tokens on the sender's behalf.\n /// @param from The address giving the approval.\n /// @param operator The address receiving the approval.\n /// @param id The id of the token.\n function approveFor(\n address from,\n address operator,\n uint256 id\n ) public override(BaseERC721, IERC721Base) onlyAllowedOperatorApproval(operator) {\n BaseERC721.approveFor(from, operator, id);\n }\n\n function _msgSender() internal view virtual override(BaseERC721, ContextUpgradeable) returns (address sender) {\n return BaseERC721._msgSender();\n }\n\n function _msgData() internal view virtual override(BaseERC721, ContextUpgradeable) returns (bytes calldata) {\n return BaseERC721._msgData();\n }\n}\n" + }, + "src/solc_0.8/polygon/root/asset/AssetERC721Tunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../../../common/fx-portal/FxBaseRootTunnelUpgradeable.sol\";\nimport \"../../../common/interfaces/IAssetERC721.sol\";\nimport \"../../../common/interfaces/IERC721MandatoryTokenReceiver.sol\";\nimport \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\n\n/// @title ASSETERC721 bridge on L1\ncontract AssetERC721Tunnel is\n FxBaseRootTunnelUpgradeable,\n IERC721MandatoryTokenReceiver,\n ERC2771Handler,\n OwnableUpgradeable,\n PausableUpgradeable,\n IERC165Upgradeable\n{\n IAssetERC721 public rootToken;\n uint256 public maxTransferLimit;\n bool private fetchingAssets = false;\n\n event SetTransferLimit(uint256 indexed limit);\n event Deposit(address indexed user, uint256 id, bytes indexed data);\n event Withdraw(address indexed user, uint256 id, bytes indexed data);\n\n // solhint-disable-next-line no-empty-blocks\n constructor() initializer {}\n\n function initialize(\n address _checkpointManager,\n address _fxRoot,\n IAssetERC721 _rootToken,\n address trustedForwarder,\n uint256 _maxTransferLimit\n ) public initializer {\n require(address(_rootToken) != address(0), \"AssetERC721Tunnel: _rootToken can't be zero\");\n require(_maxTransferLimit > 0, \"AssetERC721Tunnel: _maxTransferLimit invalid\");\n rootToken = _rootToken;\n maxTransferLimit = _maxTransferLimit;\n __Ownable_init();\n __Pausable_init();\n __ERC2771Handler_initialize(trustedForwarder);\n __FxBaseRootTunnelUpgradeable_initialize(_checkpointManager, _fxRoot);\n }\n\n function setTransferLimit(uint256 _maxTransferLimit) external onlyOwner {\n maxTransferLimit = _maxTransferLimit;\n emit SetTransferLimit(_maxTransferLimit);\n }\n\n function onERC721Received(\n address, /* operator */\n address, /* from */\n uint256, /* tokenId */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(fetchingAssets == true, \"AssetERC721Tunnel: can't directly send Assets\");\n return this.onERC721Received.selector;\n }\n\n function onERC721BatchReceived(\n address, /* operator */\n address, /* from */\n uint256[] calldata, /* ids */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(fetchingAssets == true, \"AssetERC721Tunnel: can't directly send Assets\");\n return this.onERC721BatchReceived.selector;\n }\n\n function supportsInterface(bytes4 interfaceId) external pure override returns (bool) {\n return interfaceId == 0x5e8bf644 || interfaceId == 0x01ffc9a7;\n }\n\n function batchDepositToChild(address to, uint256[] memory ids) external whenNotPaused {\n string[] memory uris = new string[](ids.length);\n fetchingAssets = true;\n for (uint256 i = 0; i < ids.length; i++) {\n // lock the root tokens in this contract\n uint256 id = ids[i];\n string memory uniqueUri = rootToken.tokenURI(id);\n uris[i] = uniqueUri;\n bytes memory uniqueUriData = abi.encode(uniqueUri);\n rootToken.safeTransferFrom(_msgSender(), address(this), ids[i], uniqueUriData);\n emit Deposit(to, ids[i], uniqueUriData);\n }\n fetchingAssets = false;\n _sendMessageToChild(abi.encode(to, ids, uris));\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n }\n\n /// @dev Pauses all token transfers across bridge\n function pause() external onlyOwner {\n _pause();\n }\n\n /// @dev Unpauses all token transfers across bridge\n function unpause() external onlyOwner {\n _unpause();\n }\n\n function _processMessageFromChild(bytes memory message) internal override {\n (address to, uint256[] memory ids, string[] memory uris) = abi.decode(message, (address, uint256[], string[]));\n for (uint256 i = 0; i < ids.length; i++) {\n bytes memory uniqueUriData = abi.encode(uris[i]);\n if (!rootToken.exists(ids[i])) rootToken.mint(to, ids[i], uniqueUriData);\n else rootToken.safeTransferFrom(address(this), to, ids[i], uniqueUriData);\n emit Withdraw(to, ids[i], uniqueUriData);\n }\n }\n\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n}\n" + }, + "src/solc_0.8/polygon/root/IRootChainManager.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\ninterface IRootChainManager {\n event TokenMapped(address indexed rootToken, address indexed childToken, bytes32 indexed tokenType);\n\n event PredicateRegistered(bytes32 indexed tokenType, address indexed predicateAddress);\n\n function registerPredicate(bytes32 tokenType, address predicateAddress) external;\n\n function mapToken(\n address rootToken,\n address childToken,\n bytes32 tokenType\n ) external;\n\n function cleanMapToken(address rootToken, address childToken) external;\n\n function remapToken(\n address rootToken,\n address childToken,\n bytes32 tokenType\n ) external;\n\n function depositEtherFor(address user) external payable;\n\n function depositFor(\n address user,\n address rootToken,\n bytes calldata depositData\n ) external;\n\n function exit(bytes calldata inputData) external;\n}\n" + }, + "src/solc_0.8/polygon/root/land/LandTunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"fx-portal/contracts/tunnel/FxBaseRootTunnel.sol\";\nimport \"../../../common/interfaces/ILandToken.sol\";\nimport \"../../../common/interfaces/IERC721MandatoryTokenReceiver.sol\";\nimport \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport \"@openzeppelin/contracts-0.8/security/Pausable.sol\";\n\n/// @title LAND bridge on L1\ncontract LandTunnel is FxBaseRootTunnel, IERC721MandatoryTokenReceiver, ERC2771Handler, Ownable, Pausable {\n address public immutable rootToken;\n bool internal transferringToL2;\n\n event Deposit(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\n event Withdraw(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\n\n constructor(\n address _checkpointManager,\n address _fxRoot,\n address _rootToken,\n address _trustedForwarder\n ) FxBaseRootTunnel(_checkpointManager, _fxRoot) {\n rootToken = _rootToken;\n __ERC2771Handler_initialize(_trustedForwarder);\n }\n\n function onERC721Received(\n address, /* operator */\n address, /* from */\n uint256, /* tokenId */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(transferringToL2, \"LandTunnel: !BRIDGING\");\n return this.onERC721Received.selector;\n }\n\n function onERC721BatchReceived(\n address, /* operator */\n address, /* from */\n uint256[] calldata, /* ids */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(transferringToL2, \"LandTunnel: !BRIDGING\");\n return this.onERC721BatchReceived.selector;\n }\n\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n return interfaceId == 0x5e8bf644 || interfaceId == 0x01ffc9a7;\n }\n\n function batchTransferQuadToL2(\n address to,\n uint256[] memory sizes,\n uint256[] memory xs,\n uint256[] memory ys,\n bytes memory data\n ) public whenNotPaused() {\n require(sizes.length == xs.length && xs.length == ys.length, \"l2: invalid data\");\n transferringToL2 = true;\n ILandToken(rootToken).batchTransferQuad(_msgSender(), address(this), sizes, xs, ys, data);\n transferringToL2 = false;\n for (uint256 index = 0; index < sizes.length; index++) {\n bytes memory message = abi.encode(to, sizes[index], xs[index], ys[index], data);\n _sendMessageToChild(message);\n emit Deposit(to, sizes[index], xs[index], ys[index], data);\n }\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n }\n\n /// @dev Pauses all token transfers across bridge\n function pause() external onlyOwner {\n _pause();\n }\n\n /// @dev Unpauses all token transfers across bridge\n function unpause() external onlyOwner {\n _unpause();\n }\n\n function _processMessageFromChild(bytes memory message) internal override {\n (address to, uint256[] memory size, uint256[] memory x, uint256[] memory y, bytes memory data) =\n abi.decode(message, (address, uint256[], uint256[], uint256[], bytes));\n for (uint256 index = 0; index < x.length; index++) {\n ILandToken(rootToken).transferQuad(address(this), to, size[index], x[index], y[index], data);\n emit Withdraw(to, size[index], x[index], y[index], data);\n }\n }\n\n function _msgSender() internal view override(Context, ERC2771Handler) returns (address sender) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(Context, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n}\n" + }, + "src/solc_0.8/polygon/root/land/LandTunnelMigration.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {ILandToken} from \"../../../common/interfaces/ILandToken.sol\";\n\n/// @title Tunnel migration on L1\n/// @author The Sandbox\n/// @notice Contract handling the migration of LAND tokens from a tunnel to a new one\ncontract LandTunnelMigration {\n ILandToken public immutable landToken;\n address public immutable newLandTunnel;\n address public immutable oldLandTunnel;\n address private admin;\n\n event TunnelLandsMigrated(address indexed oldLandTunnel, address indexed newLandTunnel, uint256[] ids);\n event TunnelQuadsMigrated(\n address indexed oldLandTunnel,\n address indexed newLandTunnel,\n uint256[] sizes,\n uint256[] x,\n uint256[] y\n );\n event AdminChanged(address indexed _newAdmin);\n\n modifier isAdmin() {\n require(admin == msg.sender, \"LandTunnelMigration: !AUTHORISED\");\n _;\n }\n\n /// @notice Constructor of the tunnel migration contract\n /// @param _landToken LAND token address\n /// @param _newLandTunnel the tunnel address to migrate to\n /// @param _oldLandTunnel the tunnel address to migrate from\n /// @param _admin admin of the contract\n constructor(\n address _landToken,\n address _newLandTunnel,\n address _oldLandTunnel,\n address _admin\n ) {\n require(_admin != address(0), \"LandTunnelMigration: admin can't be zero address\");\n require(_landToken != address(0), \"LandTunnelMigration: landToken can't be zero address\");\n require(_newLandTunnel != address(0), \"LandTunnelMigration: new Tunnel can't be zero address\");\n require(_oldLandTunnel != address(0), \"LandTunnelMigration: old Tunnel can't be zero address\");\n\n admin = _admin;\n landToken = ILandToken(_landToken);\n newLandTunnel = _newLandTunnel;\n oldLandTunnel = _oldLandTunnel;\n\n emit AdminChanged(_admin);\n }\n\n /// @dev Transfers all the passed land ids from the old land tunnel to the new land tunnel\n /// @notice This method needs super operator role to execute\n /// @param ids of land tokens to be migrated\n function migrateLandsToTunnel(uint256[] memory ids) external isAdmin {\n landToken.batchTransferFrom(oldLandTunnel, newLandTunnel, ids, \"\");\n emit TunnelLandsMigrated(oldLandTunnel, newLandTunnel, ids);\n }\n\n /// @dev Transfers all the passed quads from the old land tunnel to the new land tunnel\n /// @notice This method needs super operator role to execute\n /// @param sizes of land quads to be migrated\n /// @param x coordinate of land quads to be migrated\n /// @param y coordinate of land quads to be migrated\n function migrateQuadsToTunnel(\n uint256[] memory sizes,\n uint256[] memory x,\n uint256[] memory y\n ) external isAdmin {\n landToken.batchTransferQuad(oldLandTunnel, newLandTunnel, sizes, x, y, \"\");\n emit TunnelQuadsMigrated(oldLandTunnel, newLandTunnel, sizes, x, y);\n }\n\n /// @notice changes admin to new admin\n /// @param _newAdmin the new admin to be set\n function changeAdmin(address _newAdmin) external isAdmin {\n require(_newAdmin != address(0), \"LandTunnelMigration: admin can't be zero address\");\n admin = _newAdmin;\n emit AdminChanged(_newAdmin);\n }\n}\n" + }, + "src/solc_0.8/polygon/root/land/LandTunnelV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {\n OwnableUpgradeable,\n ContextUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport {FxBaseRootTunnelUpgradeable} from \"../../../common/fx-portal/FxBaseRootTunnelUpgradeable.sol\";\nimport {ERC2771Handler} from \"../../../common/BaseWithStorage/ERC2771Handler.sol\";\nimport {ILandTokenV2} from \"../../../common/interfaces/ILandTokenV2.sol\";\nimport {IERC721MandatoryTokenReceiver} from \"../../../common/interfaces/IERC721MandatoryTokenReceiver.sol\";\n\n/// @title LandTunnelV2\n/// @author The Sandbox\n/// @notice LAND tunnel on the root chain\ncontract LandTunnelV2 is\n FxBaseRootTunnelUpgradeable,\n IERC721MandatoryTokenReceiver,\n ERC2771Handler,\n OwnableUpgradeable,\n PausableUpgradeable\n{\n ILandTokenV2 public rootToken;\n bool internal transferringToL2;\n\n event Deposit(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\n event Withdraw(address indexed user, uint256 size, uint256 x, uint256 y, bytes data);\n\n /// @notice Initializes the contract\n /// @param _checkpointManager checkpoint manager address\n /// @param _fxRoot state sender contract\n /// @param _rootToken LAND token on the root chain\n /// @param _trustedForwarder trusted forwarder for meta-tx\n function initialize(\n address _checkpointManager,\n address _fxRoot,\n ILandTokenV2 _rootToken,\n address _trustedForwarder\n ) public initializer {\n rootToken = _rootToken;\n __Ownable_init();\n __Pausable_init();\n __FxBaseRootTunnelUpgradeable_initialize(_checkpointManager, _fxRoot);\n __ERC2771Handler_initialize(_trustedForwarder);\n }\n\n /// @dev called on ERC721 transfer to this contract\n /// @param operator address of the one sending the ERC721 Token\n /// @return onERC721Received function selector\n function onERC721Received(\n address operator,\n address, /* from */\n uint256, /* tokenId */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(transferringToL2 || rootToken.isSuperOperator(operator), \"LandTunnelV2: !BRIDGING\");\n return this.onERC721Received.selector;\n }\n\n /// @dev called on ERC721 batch transfer to this contract\n /// @param operator address of the one sending the ERC721 Token\n /// @return onERC721BatchReceived function selector\n function onERC721BatchReceived(\n address operator,\n address, /* from */\n uint256[] calldata, /* ids */\n bytes calldata /* data */\n ) external view override returns (bytes4) {\n require(transferringToL2 || rootToken.isSuperOperator(operator), \"LandTunnelV2: !BRIDGING\");\n return this.onERC721BatchReceived.selector;\n }\n\n /// @dev to be called by external contact to check if this contract supports ERC721 token and batch token receive\n /// @param interfaceId the interface to be checked if supported by the contract\n /// @return 0x5e8bf644 is the interface of IERC721MandatoryTokenReceiver and 0x01ffc9a7 for the Eip 165 supports interface's interface id\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n return interfaceId == 0x5e8bf644 || interfaceId == 0x01ffc9a7;\n }\n\n /// @notice Send a batch of quads to L2\n /// @param to address of the receiver on L2\n /// @param sizes sizes of quad\n /// @param xs x coordinates of quads\n /// @param ys y coordinates of quads\n /// @param data data send to the receiver onERC721BatchReceived on L1\n function batchTransferQuadToL2(\n address to,\n uint256[] memory sizes,\n uint256[] memory xs,\n uint256[] memory ys,\n bytes memory data\n ) external whenNotPaused() {\n require(to != address(0), \"LandTunnelV2: can't send to zero address\");\n require(sizes.length == xs.length, \"LandTunnelV2: sizes's and x's length are different\");\n require(xs.length == ys.length, \"LandTunnelV2: x's and y's length are different\");\n transferringToL2 = true;\n rootToken.batchTransferQuad(_msgSender(), address(this), sizes, xs, ys, data);\n transferringToL2 = false;\n for (uint256 index = 0; index < sizes.length; index++) {\n bytes memory message = abi.encode(to, sizes[index], xs[index], ys[index], data);\n _sendMessageToChild(message);\n emit Deposit(to, sizes[index], xs[index], ys[index], data);\n }\n }\n\n /// @notice sets the fx-child tunnel\n /// @dev only owner can call this funtion\n /// @param _fxChildTunnel address of the fx-child tunnel\n function setFxChildTunnel(address _fxChildTunnel) public override onlyOwner {\n super.setFxChildTunnel(_fxChildTunnel);\n }\n\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyOwner {\n _trustedForwarder = trustedForwarder;\n\n emit TrustedForwarderSet(trustedForwarder);\n }\n\n /// @dev Pauses all token transfers across bridge\n function pause() external onlyOwner {\n _pause();\n }\n\n /// @dev Unpauses all token transfers across bridge\n function unpause() external onlyOwner {\n _unpause();\n }\n\n function _processMessageFromChild(bytes memory message) internal override {\n (address to, uint256[] memory size, uint256[] memory x, uint256[] memory y, bytes memory data) =\n abi.decode(message, (address, uint256[], uint256[], uint256[], bytes));\n for (uint256 index = 0; index < x.length; index++) {\n rootToken.mintAndTransferQuad(to, size[index], x[index], y[index], data);\n emit Withdraw(to, size[index], x[index], y[index], data);\n }\n }\n\n function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address) {\n return ERC2771Handler._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\n return ERC2771Handler._msgData();\n }\n\n uint256[50] private __gap;\n}\n" + }, + "src/solc_0.8/polygon/root/land/MockLandTunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./LandTunnel.sol\";\n\ncontract MockLandTunnel is LandTunnel {\n constructor(\n address _checkpointManager,\n address _fxRoot,\n address _rootToken,\n address _trustedForwarder\n ) LandTunnel(_checkpointManager, _fxRoot, _rootToken, _trustedForwarder) {\n checkpointManager = ICheckpointManager(_checkpointManager);\n fxRoot = IFxStateSender(_fxRoot);\n }\n\n function receiveMessage(bytes memory message) public virtual override {\n _processMessageFromChild(message);\n }\n}\n" + }, + "src/solc_0.8/polygon/root/land/MockLandTunnelV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./LandTunnelV2.sol\";\n\ncontract MockLandTunnelV2 is LandTunnelV2 {\n function receiveMessage(bytes memory inputData) public override {\n _processMessageFromChild(inputData);\n }\n}\n" + }, + "src/solc_0.8/polygon/root/SandPolygonDepositor.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\nimport \"../../common/interfaces/IERC20Extended.sol\";\nimport \"./IRootChainManager.sol\";\n\ncontract SandPolygonDepositor {\n IERC20Extended internal immutable _sand;\n address internal immutable _predicate;\n IRootChainManager internal immutable _rootChainManager;\n\n constructor(\n IERC20Extended sand,\n address predicate,\n IRootChainManager rootChainManager\n ) {\n _sand = sand;\n _predicate = predicate;\n _rootChainManager = rootChainManager;\n }\n\n function depositToPolygon(address beneficiary, uint256 amount) public {\n _sand.transferFrom(beneficiary, address(this), amount);\n _sand.approve(_predicate, amount);\n _rootChainManager.depositFor(beneficiary, address(_sand), abi.encode(amount));\n }\n}\n" + }, + "src/solc_0.8/raffle/CareBears.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"./GenericRaffle.sol\";\n\n/* solhint-disable max-states-count */\ncontract CareBears is GenericRaffle {\n uint256 public constant MAX_SUPPLY = 3_060;\n\n function initialize(\n string memory baseURI,\n string memory _name,\n string memory _symbol,\n address payable _sandOwner,\n address _signAddress,\n address _trustedForwarder\n ) public initializer {\n __GenericRaffle_init(baseURI, _name, _symbol, _sandOwner, _signAddress, _trustedForwarder, MAX_SUPPLY);\n }\n}\n" + }, + "src/solc_0.8/raffle/GenericRaffle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {ERC2771HandlerUpgradeable} from \"../common/BaseWithStorage/ERC2771/ERC2771HandlerUpgradeable.sol\";\n\nimport {Address} from \"@openzeppelin/contracts-0.8/utils/Address.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts-0.8/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts-0.8/security/ReentrancyGuard.sol\";\n\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\";\n\n/* solhint-disable max-states-count */\ncontract GenericRaffle is\n ERC721EnumerableUpgradeable,\n OwnableUpgradeable,\n ReentrancyGuardUpgradeable,\n ERC2771HandlerUpgradeable\n{\n using Address for address;\n uint256 public maxSupply;\n\n event TogglePaused(bool _pause);\n event Personalized(uint256 _tokenId, uint256 _personalizationMask);\n event ContractInitialized(\n string baseURI,\n string _name,\n string _symbol,\n address _sandOwner,\n address _signAddress,\n uint256 _maxSupply\n );\n event WaveSetup(\n uint256 _waveType,\n uint256 _waveMaxTokens,\n uint256 _waveMaxTokensToBuy,\n uint256 _waveSingleTokenPrice\n );\n event AllowedExecuteMintSet(address _address);\n event SandOwnerSet(address _owner);\n event BaseURISet(string baseURI);\n event SignAddressSet(address _signAddress);\n\n uint256 public waveType = 0;\n uint256 public waveMaxTokens;\n uint256 public waveMaxTokensToBuy;\n uint256 public waveSingleTokenPrice;\n uint256 public waveTotalMinted;\n\n uint256 public erc1155Id;\n address public contractAddress;\n\n mapping(address => mapping(uint256 => uint256)) public waveOwnerToClaimedCounts;\n mapping(uint256 => uint256) public personalizationTraits; // stores the personalization for a tokenId\n uint256 public indexWave;\n uint256 public paused;\n\n mapping(uint256 => uint256) private signatureIds;\n mapping(uint256 => uint256) private availableIds;\n\n address public allowedToExecuteMint;\n address public sandOwner;\n address public signAddress;\n string public baseTokenURI;\n\n function __GenericRaffle_init(\n string memory baseURI,\n string memory _name,\n string memory _symbol,\n address payable _sandOwner,\n address _signAddress,\n address _trustedForwarder,\n uint256 _maxSupply\n ) internal onlyInitializing {\n __ERC721_init(_name, _symbol);\n __ERC2771Handler_initialize(_trustedForwarder);\n __Ownable_init_unchained();\n __ReentrancyGuard_init();\n setBaseURI(baseURI);\n require(bytes(baseURI).length != 0, \"baseURI is not set\");\n require(bytes(_name).length != 0, \"_name is not set\");\n require(bytes(_symbol).length != 0, \"_symbol is not set\");\n require(_signAddress != address(0x0), \"Sign address is zero address\");\n require(_trustedForwarder != address(0x0), \"Trusted forwarder is zero address\");\n require(_sandOwner != address(0x0), \"Sand owner is zero address\");\n require(_maxSupply > 0, \"Max supply should be more than 0\");\n sandOwner = _sandOwner;\n signAddress = _signAddress;\n maxSupply = _maxSupply;\n\n emit ContractInitialized(baseURI, _name, _symbol, _sandOwner, _signAddress, _maxSupply);\n }\n\n function setupWave(\n uint256 _waveType,\n uint256 _waveMaxTokens,\n uint256 _waveMaxTokensToBuy,\n uint256 _waveSingleTokenPrice,\n address _contractAddress,\n uint256 _erc1155Id\n ) external onlyOwner {\n require(_waveMaxTokens <= maxSupply, \"_waveMaxTokens should not exceed maxSupply\");\n require(_waveType < 3 && _waveMaxTokens > 0 && _waveMaxTokensToBuy > 0, \"Invalid configuration\");\n if (_waveType != 0) {\n require(_contractAddress != address(0x0), \"Invalid contract address\");\n require(_contractAddress.isContract(), \"Contract address must be that of a contract\");\n }\n require(_waveMaxTokensToBuy <= _waveMaxTokens, \"Invalid supply configuration\");\n\n waveType = _waveType;\n waveMaxTokens = _waveMaxTokens;\n waveMaxTokensToBuy = _waveMaxTokensToBuy;\n waveSingleTokenPrice = _waveSingleTokenPrice;\n waveTotalMinted = 0;\n contractAddress = _waveType == 0 ? address(0x0) : _contractAddress;\n erc1155Id = _waveType == 2 ? _erc1155Id : 0;\n indexWave++;\n\n emit WaveSetup(_waveType, _waveMaxTokens, _waveMaxTokensToBuy, _waveSingleTokenPrice);\n }\n\n function price(uint256 _count) public view virtual returns (uint256) {\n return waveSingleTokenPrice * _count;\n }\n\n function chain() public view returns (uint256) {\n return block.chainid;\n }\n\n function checkWaveNotComplete(uint256 _amount) internal view returns (bool) {\n return _amount > 0 && waveTotalMinted + _amount <= waveMaxTokens;\n }\n\n function checkLimitNotReached(address _wallet, uint256 _amount) internal view returns (bool) {\n return\n waveOwnerToClaimedCounts[_wallet][indexWave - 1] + _amount <= waveMaxTokensToBuy &&\n totalSupply() + _amount <= maxSupply;\n }\n\n function checkMintAllowed(address _wallet, uint256 _amount) public view returns (bool) {\n return checkWaveNotComplete(_amount) && checkLimitNotReached(_wallet, _amount);\n }\n\n function mint(\n address _wallet,\n uint256 _amount,\n uint256 _signatureId,\n bytes memory _signature\n ) external nonReentrant {\n require(indexWave > 0, \"Contract is not configured\");\n require(_msgSender() == allowedToExecuteMint, \"Not allowed\");\n require(paused == 0, \"Contract is paused\");\n require(_wallet != address(0x0), \"Wallet is zero address\");\n require(_amount > 0, \"Amount cannot be 0\");\n require(signatureIds[_signatureId] == 0, \"signatureId already used\");\n require(\n checkSignature(_wallet, _signatureId, address(this), block.chainid, _signature) == signAddress,\n \"Signature failed\"\n );\n\n signatureIds[_signatureId] = 1;\n\n require(checkWaveNotComplete(_amount), \"Wave completed\");\n require(checkLimitNotReached(_wallet, _amount), \"Max allowed\");\n\n if (waveType == 1) {\n require(IERC721(contractAddress).balanceOf(_wallet) > 0, \"No NFT\");\n } else if (waveType == 2) {\n require(IERC1155(contractAddress).balanceOf(_wallet, erc1155Id) > 0, \"No NFT\");\n }\n\n uint256 _price = price(_amount);\n if (_price > 0) {\n SafeERC20.safeTransferFrom(IERC20(_msgSender()), _wallet, sandOwner, _price);\n }\n\n waveOwnerToClaimedCounts[_wallet][indexWave - 1] += _amount;\n\n waveTotalMinted += _amount;\n\n for (uint256 i = 0; i < _amount; i++) {\n uint256 tokenId = getRandomToken(_wallet, totalSupply());\n _safeMint(_wallet, tokenId);\n }\n }\n\n function checkSignature(\n address _wallet,\n uint256 _signatureId,\n address _contractAddress,\n uint256 _chainId,\n bytes memory _signature\n ) public pure returns (address) {\n return\n ECDSA.recover(\n keccak256(\n abi.encodePacked(\n \"\\x19Ethereum Signed Message:\\n32\",\n keccak256(abi.encode(_wallet, _signatureId, _contractAddress, _chainId))\n )\n ),\n _signature\n );\n }\n\n function checkPersonalizationSignature(\n address _wallet,\n uint256 _signatureId,\n address _contractAddress,\n uint256 _chainId,\n uint256 _tokenId,\n uint256 _personalizationMask,\n bytes memory _signature\n ) public pure returns (address) {\n return\n ECDSA.recover(\n keccak256(\n abi.encodePacked(\n \"\\x19Ethereum Signed Message:\\n32\",\n keccak256(\n abi.encode(\n _wallet,\n _signatureId,\n _contractAddress,\n _chainId,\n _tokenId,\n _personalizationMask\n )\n )\n )\n ),\n _signature\n );\n }\n\n // Thx Cyberkongs VX <3\n function getRandomToken(address _wallet, uint256 _totalMinted) private returns (uint256) {\n uint256 remaining = maxSupply - _totalMinted;\n uint256 rand =\n uint256(keccak256(abi.encodePacked(_wallet, block.difficulty, block.timestamp, remaining))) % remaining;\n uint256 value = rand;\n\n if (availableIds[rand] != 0) {\n value = availableIds[rand];\n }\n\n if (availableIds[remaining - 1] == 0) {\n availableIds[rand] = remaining - 1;\n } else {\n availableIds[rand] = availableIds[remaining - 1];\n }\n\n return value;\n }\n\n function personalizationOf(uint256 _tokenId) external view returns (uint256) {\n return personalizationTraits[_tokenId];\n }\n\n function toggleSale() external onlyOwner {\n paused = paused == 0 ? 1 : 0;\n emit TogglePaused(paused == 1);\n }\n\n function personalize(\n uint256 _signatureId,\n bytes memory _signature,\n uint256 _tokenId,\n uint256 _personalizationMask\n ) external {\n require(ownerOf(_tokenId) == _msgSender(), \"You must be the owner of the token in order to personalize it\");\n\n require(signatureIds[_signatureId] == 0, \"SignatureId already used\");\n require(\n checkPersonalizationSignature(\n _msgSender(),\n _signatureId,\n address(this),\n block.chainid,\n _tokenId,\n _personalizationMask,\n _signature\n ) == signAddress,\n \"Signature failed\"\n );\n\n signatureIds[_signatureId] = 1;\n\n personalizationTraits[_tokenId] = _personalizationMask;\n emit Personalized(_tokenId, _personalizationMask);\n }\n\n function setAllowedExecuteMint(address _address) external onlyOwner {\n require(_address != address(0x0), \"Address is zero address\");\n allowedToExecuteMint = _address;\n emit AllowedExecuteMintSet(_address);\n }\n\n function setSandOwnerAddress(address _owner) external onlyOwner {\n require(_owner != address(0x0), \"Owner is zero address\");\n sandOwner = _owner;\n emit SandOwnerSet(_owner);\n }\n\n function _baseURI() internal view virtual override returns (string memory) {\n return baseTokenURI;\n }\n\n function setBaseURI(string memory baseURI) public onlyOwner {\n require(bytes(baseURI).length != 0, \"baseURI is not set\");\n baseTokenURI = baseURI;\n emit BaseURISet(baseURI);\n }\n\n function setSignAddress(address _signAddress) external onlyOwner {\n require(_signAddress != address(0x0), \"Sign address is zero address\");\n signAddress = _signAddress;\n emit SignAddressSet(_signAddress);\n }\n\n function _msgSender()\n internal\n view\n override(ContextUpgradeable, ERC2771HandlerUpgradeable)\n returns (address sender)\n {\n return ERC2771HandlerUpgradeable._msgSender();\n }\n\n function _msgData() internal view override(ContextUpgradeable, ERC2771HandlerUpgradeable) returns (bytes calldata) {\n return ERC2771HandlerUpgradeable._msgData();\n }\n\n function renounceOwnership() public virtual override onlyOwner {\n revert(\"Renounce ownership is not available\");\n }\n\n // Empty storage space in contracts for future enhancements\n // ref: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/issues/13)\n uint256[50] private __gap;\n}\n" + }, + "src/solc_0.8/raffle/PeopleOfCryptoGeneric.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./GenericRaffle.sol\";\n\n/* solhint-disable max-states-count */\ncontract PeopleOfCryptoGeneric is GenericRaffle {\n uint256 public constant MAX_SUPPLY = 8_430;\n\n function initialize(\n string memory baseURI,\n string memory _name,\n string memory _symbol,\n address payable _sandOwner,\n address _signAddress,\n address _trustedForwarder\n ) public initializer {\n __GenericRaffle_init(baseURI, _name, _symbol, _sandOwner, _signAddress, _trustedForwarder, MAX_SUPPLY);\n }\n}\n" + }, + "src/solc_0.8/raffle/PlayboyPartyPeople.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.2;\n\nimport \"./GenericRaffle.sol\";\n\n/* solhint-disable max-states-count */\ncontract PlayboyPartyPeople is GenericRaffle {\n uint256 public constant MAX_SUPPLY = 1_969;\n\n function initialize(\n string memory baseURI,\n string memory _name,\n string memory _symbol,\n address payable _sandOwner,\n address _signAddress,\n address _trustedForwarder\n ) public initializer {\n __GenericRaffle_init(baseURI, _name, _symbol, _sandOwner, _signAddress, _trustedForwarder, MAX_SUPPLY);\n }\n}\n" + }, + "src/solc_0.8/raffle/SteveAoki.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./GenericRaffle.sol\";\n\n/* solhint-disable max-states-count */\ncontract SteveAoki is GenericRaffle {\n uint256 public constant MAX_SUPPLY = 3_333;\n\n function initialize(\n string memory baseURI,\n string memory _name,\n string memory _symbol,\n address payable _sandOwner,\n address _signAddress,\n address _trustedForwarder\n ) public initializer {\n __GenericRaffle_init(baseURI, _name, _symbol, _sandOwner, _signAddress, _trustedForwarder, MAX_SUPPLY);\n }\n}\n" + }, + "src/solc_0.8/Sand/SandBaseToken.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"../common/BaseWithStorage/ERC20/extensions/ERC20BasicApproveExtension.sol\";\nimport \"../common/BaseWithStorage/ERC20/ERC20BaseToken.sol\";\n\ncontract SandBaseToken is ERC20BaseToken, ERC20BasicApproveExtension {\n constructor(\n address sandAdmin,\n address executionAdmin,\n address beneficiary,\n uint256 amount\n ) ERC20BaseToken(\"SAND\", \"SAND\", sandAdmin, executionAdmin) {\n _admin = sandAdmin;\n if (beneficiary != address(0)) {\n uint256 initialSupply = amount * (1 ether);\n _mint(beneficiary, initialSupply);\n }\n }\n}\n" + }, + "src/solc_0.8/StarterPack/PurchaseValidator.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {AccessControl, Context} from \"@openzeppelin/contracts-0.8/access/AccessControl.sol\";\nimport {EIP712, ECDSA} from \"@openzeppelin/contracts-0.8/utils/cryptography/draft-EIP712.sol\";\n\n/// @title Purchase Validator contract that validates the purchase of catalysts and gems bundles with EIP712\n/// @notice This contract manages the validation of purchases\n/// @notice The following privileged roles are used in PurchaseValidator: DEFAULT_ADMIN_ROLE\n/// @dev It is intended that this contract is inherited by StarterPack\ncontract PurchaseValidator is AccessControl, EIP712 {\n address private _signingWallet;\n\n // A parallel-queue mapping to nonces: user => (queueID => nonce)\n mapping(address => mapping(uint128 => uint128)) public queuedNonces;\n\n bytes32 public constant PURCHASE_TYPEHASH =\n keccak256(\n \"Purchase(address buyer,uint16[] catalystIds,uint256[] catalystQuantities,uint16[] gemIds,uint256[] gemQuantities,uint256 nonce)\"\n );\n\n event SigningWallet(address indexed newSigningWallet);\n\n constructor(\n address initialSigningWallet,\n string memory name,\n string memory version\n ) EIP712(name, version) {\n require(initialSigningWallet != address(0), \"WALLET_ZERO_ADDRESS\");\n _signingWallet = initialSigningWallet;\n }\n\n /// @notice Update the signing wallet address\n /// @param newSigningWallet The new address of the signing wallet\n function setSigningWallet(address newSigningWallet) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(newSigningWallet != address(0), \"WALLET_ZERO_ADDRESS\");\n require(newSigningWallet != _signingWallet, \"WALLET_ALREADY_SET\");\n _signingWallet = newSigningWallet;\n emit SigningWallet(newSigningWallet);\n }\n\n /// @notice Function to get the nonce for a given address and queue ID\n /// @param _buyer The address of the starterPack purchaser\n /// @param _queueId The ID of the nonce queue for the given address.\n /// The default is queueID=0, and the max is queueID=2**128-1\n /// @return uint128 representing the requested nonce\n function getNonceByBuyer(address _buyer, uint128 _queueId) external view returns (uint128) {\n return queuedNonces[_buyer][_queueId];\n }\n\n /// @notice Function to get the domain separator\n function domainSeparator() external view returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /// @notice Function to get the chainId\n function getChainId() external view returns (uint256) {\n return block.chainid;\n }\n\n /// @notice Get the wallet authorized for signing purchase-messages.\n /// @return _signingWallet the address of the signing wallet\n function getSigningWallet() external view returns (address) {\n return _signingWallet;\n }\n\n /// @notice Check if a purchase message is valid by verifying a EIP712 signature for the purchase message\n /// @dev It is intended that this contract is inherited so this internal function can be used\n /// @param buyer The address paying for the purchase & receiving tokens\n /// @param catalystIds The catalyst IDs to be purchased\n /// @param catalystQuantities The quantities of the catalysts to be purchased\n /// @param gemIds The gem IDs to be purchased\n /// @param gemQuantities The quantities of the gems to be purchased\n /// @param nonce The current nonce for the user. This is represented as a\n /// uint256 value, but is actually 2 packed uint128's (queueId + nonce)\n /// @param signature A signed message specifying tx details\n /// @return true if the purchase is valid\n function _isPurchaseValid(\n address buyer,\n uint16[] memory catalystIds,\n uint256[] memory catalystQuantities,\n uint16[] memory gemIds,\n uint256[] memory gemQuantities,\n uint256 nonce,\n bytes memory signature\n ) internal returns (bool) {\n require(_checkAndUpdateNonce(buyer, nonce), \"INVALID_NONCE\");\n bytes32 digest =\n _hashTypedDataV4(\n keccak256(\n abi.encode(\n PURCHASE_TYPEHASH,\n buyer,\n keccak256(abi.encodePacked(catalystIds)),\n keccak256(abi.encodePacked(catalystQuantities)),\n keccak256(abi.encodePacked(gemIds)),\n keccak256(abi.encodePacked(gemQuantities)),\n nonce\n )\n )\n );\n address recoveredSigner = ECDSA.recover(digest, signature);\n return recoveredSigner == _signingWallet;\n }\n\n /// @dev Function for validating the nonce for a user.\n /// @param _buyer The address for which we want to check the nonce\n /// @param _packedValue The queueId + nonce, packed together.\n /// @return bool Whether the nonce is valid.\n /// EG: for queueId=42 nonce=7, pass: \"0x0000000000000000000000000000002A00000000000000000000000000000007\"\n function _checkAndUpdateNonce(address _buyer, uint256 _packedValue) private returns (bool) {\n uint128 queueId = uint128(_packedValue / 2**128);\n uint128 nonce = uint128(_packedValue % 2**128);\n uint128 currentNonce = queuedNonces[_buyer][queueId];\n if (nonce == currentNonce) {\n queuedNonces[_buyer][queueId] = currentNonce + 1;\n return true;\n }\n return false;\n }\n}\n" + }, + "src/solc_0.8/StarterPack/StarterPackV2.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {PurchaseValidator, Context, AccessControl} from \"./PurchaseValidator.sol\";\nimport {GemsCatalystsRegistry, ICatalyst, IGem, IERC20} from \"../catalyst/GemsCatalystsRegistry.sol\";\nimport {ERC2771HandlerV2} from \"../common/BaseWithStorage/ERC2771/ERC2771HandlerV2.sol\";\n\n/// @title StarterPack contract for the purchase of StarterPacks (bundles of Catalysts and Gems) with EIP712\n/// @notice This contract enables purchases with SAND when the backend authorizes it via message signing\n/// @notice The following privileged roles are used in StarterPackV2: DEFAULT_ADMIN_ROLE, STARTERPACK_ROLE\n/// @dev DEFAULT_ADMIN_ROLE is intended for contract setup / emergency, STARTERPACK_ROLE is provided for business purposes\ncontract StarterPackV2 is AccessControl, PurchaseValidator, ERC2771HandlerV2 {\n uint256 internal constant MAX_UINT16 = type(uint16).max;\n uint256 private constant DECIMAL_PLACES = 1 ether;\n uint256 private constant MAX_WITHDRAWAL = 100;\n // The delay between calling setPrices() and when the new prices come into effect\n // Minimizes the effect of price changes on pending TXs\n uint256 private constant PRICE_CHANGE_DELAY = 1 hours;\n\n // The timestamp of the last price change\n uint256 private _priceChangeTimestamp;\n\n // The following role is provided for business-related admin functions\n bytes32 public constant STARTERPACK_ROLE = keccak256(\"STARTERPACK_ROLE\");\n\n address internal immutable _sand;\n address internal immutable _registry;\n address payable internal _wallet;\n bool public _sandEnabled;\n\n // Mapping catalyst and gem ids to their prices\n mapping(uint16 => uint256) private _catalystPrices;\n mapping(uint16 => uint256) private _catalystPreviousPrices;\n mapping(uint16 => uint256) private _gemPrices;\n mapping(uint16 => uint256) private _gemPreviousPrices;\n\n event ReceivingWallet(address indexed newReceivingWallet);\n event Purchase(address indexed buyer, Message message, uint256 amountPaid, address indexed token);\n event WithdrawAll(address indexed to, uint16[] catalystIds, uint16[] gemIds);\n event SandEnabled(bool enabled);\n event SetPrices(\n uint16[] catalystIds,\n uint256[] catalystPrices,\n uint16[] gemIds,\n uint256[] gemPrices,\n uint256 priceChangeTimestamp\n );\n\n struct Message {\n address buyer;\n uint16[] catalystIds;\n uint256[] catalystQuantities;\n uint16[] gemIds;\n uint256[] gemQuantities;\n uint256 nonce;\n }\n\n constructor(\n address defaultAdmin,\n address starterPackAdmin,\n address sandContractAddress,\n address trustedForwarder,\n address payable initialWalletAddress,\n address initialSigningWallet,\n address registry\n ) PurchaseValidator(initialSigningWallet, \"Sandbox StarterPack\", \"1.0\") ERC2771HandlerV2(trustedForwarder) {\n require(defaultAdmin != address(0), \"ADMIN_ZERO_ADDRESS\");\n require(starterPackAdmin != address(0), \"STARTERPACK_ADMIN_ZERO_ADDRESS\");\n require(sandContractAddress != address(0), \"SAND_ZERO_ADDRESS\");\n require(trustedForwarder != address(0), \"FORWARDER_ZERO_ADDRESS\");\n require(initialWalletAddress != address(0), \"WALLET_ZERO_ADDRESS\");\n require(registry != address(0), \"REGISTRY_ZERO_ADDRESS\");\n _grantRole(DEFAULT_ADMIN_ROLE, defaultAdmin);\n _grantRole(STARTERPACK_ROLE, starterPackAdmin);\n _sand = sandContractAddress;\n _wallet = initialWalletAddress;\n _registry = registry;\n }\n\n /// @notice Set the wallet receiving the proceeds\n /// @param newReceivingWallet Address of the new receiving wallet\n function setReceivingWallet(address payable newReceivingWallet) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(newReceivingWallet != address(0), \"WALLET_ZERO_ADDRESS\");\n require(newReceivingWallet != _wallet, \"WALLET_ALREADY_SET\");\n _wallet = newReceivingWallet;\n emit ReceivingWallet(newReceivingWallet);\n }\n\n /// @dev Enable / disable the specific SAND payment for StarterPacks\n /// @param enabled Whether to enable or disable\n function setSANDEnabled(bool enabled) external onlyRole(STARTERPACK_ROLE) {\n _sandEnabled = enabled;\n emit SandEnabled(enabled);\n }\n\n /// @notice Enables admin to change the prices (in SAND) of the catalysts and gems in the StarterPack bundle\n /// @param catalystIds Array of catalyst IDs for which new prices will take effect after a delay period\n /// @param catalystPrices Array of new catalyst prices that will take effect after a delay period\n /// @param gemIds Array of gem IDs for which new prices will take effect after a delay period\n /// @param gemPrices Array of new gems prices that will take effect after a delay period\n function setPrices(\n uint16[] calldata catalystIds,\n uint256[] calldata catalystPrices,\n uint16[] calldata gemIds,\n uint256[] calldata gemPrices\n ) external onlyRole(STARTERPACK_ROLE) {\n require(block.timestamp > _priceChangeTimestamp + PRICE_CHANGE_DELAY, \"DELAY_PERIOD_IN_EFFECT\");\n require(catalystIds.length == catalystPrices.length, \"INVALID_CAT_INPUT\");\n require(gemIds.length == gemPrices.length, \"INVALID_GEM_INPUT\");\n require(catalystPrices.length <= MAX_UINT16, \"TOO_MANY_CATALYST_PRICES\");\n require(gemPrices.length <= MAX_UINT16, \"TOO_MANY_GEM_PRICES\");\n for (uint256 i = 0; i < catalystIds.length; i++) {\n uint16 id = catalystIds[i];\n require(_isValidCatalyst(id), \"INVALID_CAT_ID\");\n _catalystPreviousPrices[id] = _catalystPrices[id];\n _catalystPrices[id] = catalystPrices[i];\n }\n for (uint256 i = 0; i < gemIds.length; i++) {\n uint16 id = gemIds[i];\n require(_isValidGem(id), \"INVALID_GEM_ID\");\n _gemPreviousPrices[id] = _gemPrices[id];\n _gemPrices[id] = gemPrices[i];\n }\n _priceChangeTimestamp = block.timestamp;\n emit SetPrices(catalystIds, catalystPrices, gemIds, gemPrices, _priceChangeTimestamp);\n }\n\n /// @notice Enables admin to withdraw any remaining tokens\n /// @param to The destination address for the purchased Catalysts and Gems\n /// @param catalystIds The IDs of the catalysts to be transferred\n /// @param gemIds The IDs of the gems to be transferred\n /// @dev The sum length of catalystIds + gemIds must be <= MAX_WITHDRAWAL\n function withdrawAll(\n address to,\n uint16[] calldata catalystIds,\n uint16[] calldata gemIds\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(catalystIds.length + gemIds.length <= MAX_WITHDRAWAL, \"TOO_MANY_IDS\");\n require(to != address(0), \"ZERO_ADDRESS\");\n for (uint256 i = 0; i < catalystIds.length; i++) {\n uint16 id = catalystIds[i];\n require(_isValidCatalyst(id), \"INVALID_CATALYST_ID\");\n ICatalyst catalyst = _getCatalyst(id);\n uint256 balance = catalyst.balanceOf(address(this));\n _executeRegistryTransferCatalyst(catalyst, address(this), to, balance);\n }\n for (uint256 i = 0; i < gemIds.length; i++) {\n uint16 id = gemIds[i];\n require(_isValidGem(id), \"INVALID_GEM_ID\");\n IGem gem = _getGem(id);\n uint256 balance = gem.balanceOf(address(this));\n _executeRegistryTransferGem(gem, address(this), to, balance);\n }\n emit WithdrawAll(to, catalystIds, gemIds);\n }\n\n /// @notice Purchase StarterPacks with SAND\n /// @dev The buyer param is duplicated outside the message so the function is compatible with Sand approveAndCall\n /// @dev The buyer param is included inside the message so it is clear it is part of the message to be signed\n /// @dev If Sand amount is not approved then Sand amount will fail in Sand transferFrom\n /// @param buyer The recipient of the Catalysts and Gems to be purchased\n /// @param message A message containing information about the Catalysts and Gems to be purchased together with the destination (buyer) and a nonce\n /// @param signature A signed message specifying tx details\n function purchaseWithSAND(\n address buyer,\n Message calldata message,\n bytes calldata signature\n ) external {\n require(buyer == message.buyer, \"INVALID_BUYER\");\n require(_sandEnabled, \"SAND_IS_NOT_ENABLED\");\n require(\n _isPurchaseValid(\n message.buyer,\n message.catalystIds,\n message.catalystQuantities,\n message.gemIds,\n message.gemQuantities,\n message.nonce,\n signature\n ),\n \"INVALID_PURCHASE\"\n );\n uint256 amountInSAND =\n _calculateTotalPriceInSAND(\n message.catalystIds,\n message.catalystQuantities,\n message.gemIds,\n message.gemQuantities\n );\n _transferSANDPayment(message.buyer, _wallet, amountInSAND);\n _transferCatalysts(message.catalystIds, message.catalystQuantities, message.buyer);\n _transferGems(message.gemIds, message.gemQuantities, message.buyer);\n emit Purchase(message.buyer, message, amountInSAND, _sand);\n }\n\n /// @notice Get current StarterPack prices for catalysts and gems by id\n /// @param catalystIds The IDs of the catalysts you want to obtain price information for\n /// @param gemIds The IDs of the gems you want to obtain price information for\n /// @return catalystPricesBeforeSwitch Catalyst prices before price change\n /// @return catalystPricesAfterSwitch Catalyst prices after price change\n /// @return gemPricesBeforeSwitch Gem prices before price change\n /// @return gemPricesAfterSwitch Gem prices after price change\n /// @return switchTime The time the latest price change will take effect, being the time of the price change plus the price change delay\n function getPrices(uint16[] calldata catalystIds, uint16[] calldata gemIds)\n external\n view\n returns (\n uint256[] memory,\n uint256[] memory,\n uint256[] memory,\n uint256[] memory,\n uint256\n )\n {\n uint256 switchTime = 0;\n // check whether any prices have been set; return switchTime = 0 if prices were never set\n if (_priceChangeTimestamp != 0) {\n switchTime = _priceChangeTimestamp + PRICE_CHANGE_DELAY;\n }\n uint256[] memory catalystPricesBeforeSwitch = new uint256[](catalystIds.length);\n uint256[] memory catalystPricesAfterSwitch = new uint256[](catalystIds.length);\n uint256[] memory gemPricesBeforeSwitch = new uint256[](gemIds.length);\n uint256[] memory gemPricesAfterSwitch = new uint256[](gemIds.length);\n for (uint256 i = 0; i < catalystIds.length; i++) {\n uint16 id = catalystIds[i];\n catalystPricesBeforeSwitch[i] = _catalystPreviousPrices[id];\n catalystPricesAfterSwitch[i] = _catalystPrices[id];\n }\n for (uint256 i = 0; i < gemIds.length; i++) {\n uint16 id = gemIds[i];\n gemPricesBeforeSwitch[i] = _gemPreviousPrices[id];\n gemPricesAfterSwitch[i] = _gemPrices[id];\n }\n return (\n catalystPricesBeforeSwitch,\n catalystPricesAfterSwitch,\n gemPricesBeforeSwitch,\n gemPricesAfterSwitch,\n switchTime\n );\n }\n\n /// @notice Return whether SAND payments are enabled\n /// @return Whether SAND payments are enabled\n function isSANDEnabled() external view returns (bool) {\n return _sandEnabled;\n }\n\n /// @notice Get the beneficiary wallet.\n /// @return the address of the receiving wallet\n function getReceivingWallet() external view returns (address) {\n return _wallet;\n }\n\n /// @notice Verify the total expected price to pay in SAND\n /// @param catalystIds An array of catalyst IDs to be purchased\n /// @param catalystQuantities An array of catalyst amounts to be purchased\n /// @param gemIds An array of gem IDs to be purchased\n /// @param gemQuantities An array of gem amounts to be purchased\n /// @return the total price to pay in SAND for the cats and gems in the bundle\n function calculateTotalPriceInSAND(\n uint16[] memory catalystIds,\n uint256[] memory catalystQuantities,\n uint16[] memory gemIds,\n uint256[] memory gemQuantities\n ) external view returns (uint256) {\n return _calculateTotalPriceInSAND(catalystIds, catalystQuantities, gemIds, gemQuantities);\n }\n\n function _transferCatalysts(\n uint16[] memory catalystIds,\n uint256[] memory catalystQuantities,\n address buyer\n ) internal {\n for (uint256 i = 0; i < catalystIds.length; i++) {\n uint16 id = catalystIds[i];\n require(_isValidCatalyst(id), \"INVALID_CATALYST_ID\");\n _executeRegistryTransferCatalyst(_getCatalyst(id), address(this), buyer, catalystQuantities[i]);\n }\n }\n\n function _transferGems(\n uint16[] memory gemIds,\n uint256[] memory gemQuantities,\n address buyer\n ) internal {\n for (uint256 i = 0; i < gemIds.length; i++) {\n uint16 id = gemIds[i];\n require(_isValidGem(id), \"INVALID_GEM_ID\");\n _executeRegistryTransferGem(_getGem(id), address(this), buyer, gemQuantities[i]);\n }\n }\n\n function _executeRegistryTransferCatalyst(\n ICatalyst catalyst,\n address from,\n address to,\n uint256 quantity\n ) private {\n require(catalyst.transferFrom(from, to, quantity), \"CATALYST_TRANSFER_FAILED\");\n }\n\n function _executeRegistryTransferGem(\n IGem gem,\n address from,\n address to,\n uint256 quantity\n ) private {\n require(gem.transferFrom(from, to, quantity), \"GEM_TRANSFER_FAILED\");\n }\n\n function _getCatalyst(uint16 catalystId) internal view returns (ICatalyst) {\n return GemsCatalystsRegistry(_registry).getCatalyst(catalystId);\n }\n\n function _isValidCatalyst(uint16 catalystId) internal view returns (bool) {\n return GemsCatalystsRegistry(_registry).doesCatalystExist(catalystId) && catalystId > 0;\n }\n\n function _getGem(uint16 gemId) internal view returns (IGem) {\n return GemsCatalystsRegistry(_registry).getGem(gemId);\n }\n\n function _isValidGem(uint16 gemId) internal view returns (bool) {\n return GemsCatalystsRegistry(_registry).doesGemExist(gemId) && gemId > 0;\n }\n\n /// @dev Function to calculate the total price in SAND of the StarterPacks to be purchased\n function _calculateTotalPriceInSAND(\n uint16[] memory catalystIds,\n uint256[] memory catalystQuantities,\n uint16[] memory gemIds,\n uint256[] memory gemQuantities\n ) internal view returns (uint256) {\n require(catalystIds.length == catalystQuantities.length, \"INVALID_CAT_INPUT\");\n require(gemIds.length == gemQuantities.length, \"INVALID_GEM_INPUT\");\n uint256 totalPrice;\n bool useCurrentPrices = _priceSelector();\n for (uint256 i = 0; i < catalystIds.length; i++) {\n uint16 id = catalystIds[i];\n uint256 quantity = catalystQuantities[i];\n totalPrice =\n totalPrice +\n (useCurrentPrices ? _catalystPrices[id] * (quantity) : _catalystPreviousPrices[id] * (quantity));\n }\n for (uint256 i = 0; i < gemIds.length; i++) {\n uint16 id = gemIds[i];\n uint256 quantity = gemQuantities[i];\n totalPrice =\n totalPrice +\n (useCurrentPrices ? _gemPrices[id] * (quantity) : _gemPreviousPrices[id] * (quantity));\n }\n return totalPrice;\n }\n\n /// @dev Function to determine whether to purchase with previous or current prices\n function _priceSelector() internal view returns (bool) {\n return block.timestamp >= _priceChangeTimestamp + PRICE_CHANGE_DELAY;\n }\n\n /// @dev Function to handle purchase with SAND\n function _transferSANDPayment(\n address buyer,\n address payable paymentRecipient,\n uint256 amount\n ) internal {\n uint256 amountForDestination = amount;\n require(IERC20(_sand).transferFrom(buyer, paymentRecipient, amountForDestination), \"PAYMENT_TRANSFER_FAILED\");\n }\n\n /// @dev this override is required; two or more base classes define function\n function _msgSender() internal view override(Context, ERC2771HandlerV2) returns (address sender) {\n return ERC2771HandlerV2._msgSender();\n }\n\n /// @dev this override is required; two or more base classes define function\n function _msgData() internal view override(Context, ERC2771HandlerV2) returns (bytes calldata) {\n return ERC2771HandlerV2._msgData();\n }\n}\n" + }, + "src/solc_0.8/test/AssetUpgraderFeeBurner.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../asset/AssetUpgrader.sol\";\n\n/// @notice Allow to upgrade Asset with Catalyst, Gems and Sand, giving the assets attributes through AssetAttributeRegistry\ncontract AssetUpgraderFeeBurner is AssetUpgrader {\n constructor(\n IAssetAttributesRegistry registry,\n IERC20Extended sand,\n IPolygonAssetERC721 assetERC721,\n IPolygonAssetERC1155 assetERC1155,\n GemsCatalystsRegistry gemsCatalystsRegistry,\n uint256 _upgradeFee,\n uint256 _gemAdditionFee,\n address _feeRecipient,\n address trustedForwarder\n )\n AssetUpgrader(\n registry,\n sand,\n assetERC721,\n assetERC1155,\n gemsCatalystsRegistry,\n _upgradeFee,\n _gemAdditionFee,\n _feeRecipient,\n trustedForwarder\n )\n // solhint-disable-next-line no-empty-blocks\n {\n\n }\n}\n" + }, + "src/solc_0.8/test/ContributionCalculatorMock.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"../defi/interfaces/IContributionCalculator.sol\";\n\ncontract ContributionCalculatorMock is IContributionCalculator {\n mapping(address => uint256) public contribution;\n\n function computeContribution(address account, uint256) external view override returns (uint256) {\n return contribution[account];\n }\n\n function setContribution(address account, uint256 contribution_) external {\n contribution[account] = contribution_;\n }\n}\n" + }, + "src/solc_0.8/test/ContributionRulesMock.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"../defi/interfaces/IContributionRules.sol\";\n\ncontract ContributionRulesMock is IContributionRules {\n mapping(address => uint256) public contribution;\n\n function computeMultiplier(address account, uint256) external view override returns (uint256) {\n return contribution[account];\n }\n\n function setContribution(address account, uint256 contribution_) external {\n contribution[account] = contribution_;\n }\n}\n" + }, + "src/solc_0.8/test/EmptyContract.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\n// solhint-disable-next-line no-empty-blocks\ncontract EmptyContract {\n\n}\n" + }, + "src/solc_0.8/test/ERC1155Mintable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {ERC1155} from \"@openzeppelin/contracts-0.8/token/ERC1155/ERC1155.sol\";\n\n/// @dev This is NOT a secure ERC1155\n/// DO NOT USE in production.\ncontract ERC1155Mintable is ERC1155 {\n mapping(uint256 => mapping(address => uint256)) public fakeBalance;\n\n // solhint-disable-next-line no-empty-blocks\n constructor(string memory uri_) ERC1155(uri_) {}\n\n function mint(\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) external {\n _mint(to, id, amount, data);\n }\n\n function balanceOf(address owner, uint256 id) public view override returns (uint256) {\n if (fakeBalance[id][owner] != 0) {\n return fakeBalance[id][owner];\n }\n return ERC1155.balanceOf(owner, id);\n }\n\n function setFakeBalance(\n address owner,\n uint256 id,\n uint256 balance\n ) external {\n fakeBalance[id][owner] = balance;\n }\n}\n" + }, + "src/solc_0.8/test/ERC20Mintable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {ERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/ERC20.sol\";\n\n/// @dev This is NOT a secure ERC20\n/// DO NOT USE in production.\ncontract ERC20Mintable is ERC20 {\n // solhint-disable-next-line no-empty-blocks\n constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) {}\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n" + }, + "src/solc_0.8/test/ERC721Mintable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {ERC721} from \"@openzeppelin/contracts-0.8/token/ERC721/ERC721.sol\";\n\n/// @dev This is NOT a secure ERC721\n/// DO NOT USE in production.\ncontract ERC721Mintable is ERC721 {\n mapping(address => uint256) public fakeBalance;\n\n // solhint-disable-next-line no-empty-blocks\n constructor(string memory name_, string memory symbol_) ERC721(name_, symbol_) {}\n\n function mint(address to, uint256 tokenId) external {\n _mint(to, tokenId);\n }\n\n function balanceOf(address owner) public view override returns (uint256) {\n if (fakeBalance[owner] != 0) {\n return fakeBalance[owner];\n }\n return ERC721.balanceOf(owner);\n }\n\n function ownerOf(uint256 tokenId) public view override returns (address) {\n return ERC721.ownerOf(tokenId);\n }\n\n function setFakeBalance(address owner, uint256 balance) external {\n fakeBalance[owner] = balance;\n }\n}\n" + }, + "src/solc_0.8/test/FakeCheckpointManager.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ncontract ICheckpointManager {\n struct HeaderBlock {\n bytes32 root;\n uint256 start;\n uint256 end;\n uint256 createdAt;\n address proposer;\n }\n\n /**\n * @notice mapping of checkpoint header numbers to block details\n * @dev These checkpoints are submited by plasma contracts\n */\n mapping(uint256 => HeaderBlock) public headerBlocks;\n}\n\ncontract FakeCheckpointManager is ICheckpointManager {\n uint256 public currentCheckpointNumber = 0;\n\n function setCheckpoint(\n bytes32 rootHash,\n uint256 start,\n uint256 end\n ) public {\n HeaderBlock memory headerBlock =\n HeaderBlock({root: rootHash, start: start, end: end, createdAt: block.timestamp, proposer: msg.sender});\n\n currentCheckpointNumber = currentCheckpointNumber + 1;\n headerBlocks[currentCheckpointNumber] = headerBlock;\n }\n}\n" + }, + "src/solc_0.8/test/FakeChildChainManager.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../polygon/child/asset/PolygonAssetERC1155.sol\";\nimport \"../polygon/child/sand/PolygonSand.sol\";\n\n/// @dev This is NOT a secure ChildChainManager contract implementation!\n/// DO NOT USE in production.\n\ncontract FakeChildChainManager {\n address public polygonAsset;\n\n // solhint-disable-next-line no-empty-blocks\n constructor() {}\n\n function setPolygonAsset(address _polygonAsset) external {\n polygonAsset = _polygonAsset;\n }\n\n function callDeposit(address user, bytes calldata depositData) external {\n PolygonAssetERC1155(polygonAsset).deposit(user, depositData);\n }\n\n function callSandDeposit(\n address polygonSand,\n address user,\n bytes calldata depositData\n ) external {\n PolygonSand(polygonSand).deposit(user, depositData);\n }\n}\n" + }, + "src/solc_0.8/test/FakeERC1155Predicate.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {IERC1155} from \"@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol\";\nimport {ERC1155Receiver} from \"@openzeppelin/contracts-0.8/token/ERC1155/utils/ERC1155Receiver.sol\";\n\ninterface IMintableERC1155 is IERC1155 {\n function mint(\n address account,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n function mintBatch(\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n\n/// @dev This is NOT a secure ChildChainManager contract implementation!\n/// DO NOT USE in production.\n\ncontract FakeERC1155Predicate is ERC1155Receiver {\n address private asset;\n\n function setAsset(address _asset) external {\n asset = _asset;\n }\n\n function lockTokens(\n address depositor,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external {\n IMintableERC1155(asset).safeBatchTransferFrom(depositor, address(this), ids, amounts, data);\n }\n\n function exitTokens(\n address withdrawer,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public {\n IMintableERC1155 token = IMintableERC1155(asset);\n uint256[] memory balances = token.balanceOfBatch(makeArrayWithAddress(address(this), ids.length), ids);\n (uint256[] memory toBeMinted, bool needMintStep, bool needTransferStep) =\n calculateAmountsToBeMinted(balances, amounts);\n if (needMintStep) {\n token.mintBatch(\n withdrawer,\n ids,\n toBeMinted,\n data // passing data when minting to withdrawer\n );\n }\n if (needTransferStep) {\n token.safeBatchTransferFrom(\n address(this),\n withdrawer,\n ids,\n balances,\n data // passing data when transferring unlocked tokens to withdrawer\n );\n }\n }\n\n function calculateAmountsToBeMinted(uint256[] memory balances, uint256[] memory exitAmounts)\n internal\n pure\n returns (\n uint256[] memory,\n bool,\n bool\n )\n {\n uint256 count = balances.length;\n require(count == exitAmounts.length, \"ChainExitERC1155Predicate: Array length mismatch found\");\n uint256[] memory toBeMinted = new uint256[](count);\n bool needMintStep;\n bool needTransferStep;\n for (uint256 i = 0; i < count; i++) {\n if (balances[i] < exitAmounts[i]) {\n toBeMinted[i] = exitAmounts[i] - balances[i];\n needMintStep = true;\n }\n if (balances[i] != 0) {\n needTransferStep = true;\n }\n }\n return (toBeMinted, needMintStep, needTransferStep);\n }\n\n function makeArrayWithAddress(address addr, uint256 size) internal pure returns (address[] memory) {\n require(addr != address(0), \"MintableERC1155Predicate: Invalid address\");\n require(size > 0, \"MintableERC1155Predicate: Invalid resulting array length\");\n address[] memory addresses = new address[](size);\n for (uint256 i = 0; i < size; i++) {\n addresses[i] = addr;\n }\n return addresses;\n }\n\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes calldata\n ) external pure override returns (bytes4) {\n return 0;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external pure override returns (bytes4) {\n return ERC1155Receiver(address(0)).onERC1155BatchReceived.selector;\n }\n}\n" + }, + "src/solc_0.8/test/FakeERC20Predicate.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {SafeERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol\";\nimport {IERC20} from \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\n\n/// @dev This is NOT a secure ERC20 Predicate contract implementation!\n/// DO NOT USE in production.\n\ncontract FakeERC20Predicate {\n address private token;\n using SafeERC20 for IERC20;\n\n event LockedERC20(\n address indexed depositor,\n address indexed depositReceiver,\n address indexed rootToken,\n uint256 amount\n );\n\n function setToken(address _token) external {\n token = _token;\n }\n\n function lockTokens(\n address depositor,\n address depositReceiver,\n bytes calldata depositData\n ) external {\n uint256 amount = abi.decode(depositData, (uint256));\n emit LockedERC20(depositor, depositReceiver, token, amount);\n IERC20(token).safeTransferFrom(depositor, address(this), amount);\n }\n\n function exitTokens(address withdrawer, uint256 amount) public {\n IERC20(token).safeTransfer(withdrawer, amount);\n }\n}\n" + }, + "src/solc_0.8/test/FakeFxRoot.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../common/interfaces/IPolygonLand.sol\";\n\n// solhint-disable\n\n/// @dev This is NOT a secure FxRoot contract implementation!\n/// DO NOT USE in production.\n\ninterface IFakeFxChild {\n function onStateReceive(\n uint256 stateId,\n address receiver,\n address rootMessageSender,\n bytes memory data\n ) external;\n}\n\n/**\n * @title FxRoot root contract for fx-portal\n */\ncontract FakeFxRoot {\n address fxChild;\n\n function setFxChild(address _fxChild) public {\n fxChild = _fxChild;\n }\n\n function sendMessageToChild(address _receiver, bytes calldata _data) public {\n IFakeFxChild(fxChild).onStateReceive(0, _receiver, msg.sender, _data);\n }\n}\n" + }, + "src/solc_0.8/test/FakeLPSandMatic.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../common/BaseWithStorage/ERC20/ERC20BaseToken.sol\";\n\ncontract FakeLPSandMatic is ERC20BaseToken {\n constructor() ERC20BaseToken(\"LPSandMatic\", \"LPSM\", msg.sender, msg.sender) {\n _mint(msg.sender, 3000000000 * 10**18);\n }\n}\n" + }, + "src/solc_0.8/test/FakeMintableERC721Predicate.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../common/interfaces/IMintableERC721.sol\";\nimport \"../common/interfaces/IERC721TokenReceiver.sol\";\n\n/// @dev based on: @maticnetwork/pos-portal/contracts/root/TokenPredicates/MintableERC721Predicate.sol\n/// @dev This is NOT a secure ERC721 Predicate contract implementation!\n/// DO NOT USE in production.\n\ncontract FakeMintableERC721Predicate is IERC721TokenReceiver {\n /**\n * @notice Lock ERC721 token(s) for deposit, callable only by manager\n * @param depositor Address who wants to deposit token\n * @param rootToken Token which gets deposited\n * @param depositData ABI encoded tokenId(s). It's possible to deposit batch of tokens.\n */\n function lockTokens(\n address depositor,\n address rootToken,\n bytes calldata depositData\n ) external {\n // Locking single ERC721 token\n if (depositData.length == 32) {\n uint256 tokenId = abi.decode(depositData, (uint256));\n\n // Emitting event that single token is getting locked in predicate\n // emit LockedMintableERC721(depositor, depositReceiver, rootToken, tokenId);\n\n // Transferring token to this address, which will be\n // released when attempted to be unlocked\n IMintableERC721(rootToken).safeTransferFrom(depositor, address(this), tokenId);\n } else {\n // Locking a set a ERC721 token(s)\n\n uint256[] memory tokenIds = abi.decode(depositData, (uint256[]));\n\n // Emitting event that a set of ERC721 tokens are getting lockec\n // in this predicate contract\n // emit LockedMintableERC721Batch(depositor, depositReceiver, rootToken, tokenIds);\n\n // These many tokens are attempted to be deposited\n // by user\n uint256 length = tokenIds.length;\n // Iteratively trying to transfer ERC721 token\n // to this predicate address\n for (uint256 i; i < length; i++) {\n IMintableERC721(rootToken).safeTransferFrom(depositor, address(this), tokenIds[i]);\n }\n }\n }\n\n /**\n * @notice Validates log signature, from and to address\n * then checks if token already exists on root chain\n * if token exits then transfers it to withdrawer\n * if token doesn't exit then it is minted\n * callable only by manager\n */\n function exitTokens(\n address rootToken,\n address withdrawer,\n uint256 tokenId\n ) public {\n // If it's a simple exit ( with out metadata coming from L2 to L1 )\n IMintableERC721 token = IMintableERC721(rootToken);\n\n // topic3 is tokenId field\n if (token.exists(tokenId)) {\n token.safeTransferFrom(address(this), withdrawer, tokenId);\n } else {\n token.mint(withdrawer, tokenId);\n }\n }\n\n function exitTokens(\n address rootToken,\n address withdrawer,\n uint256[] calldata tokenIds\n ) public {\n // topic0 is event sig\n // If it's a simple batch exit, where a set of\n // ERC721s were burnt in child chain with event signature\n // looking like `WithdrawnBatch(address indexed user, uint256[] tokenIds);`\n //\n // @note This doesn't allow transfer of metadata cross chain\n // For that check below `else if` block\n // topic1 is from address\n\n uint256 length = tokenIds.length;\n IMintableERC721 token = IMintableERC721(rootToken);\n for (uint256 i; i < length; i++) {\n uint256 tokenId = tokenIds[i];\n\n // Check if token exists or not\n //\n // If does, transfer token to withdrawer\n if (token.exists(tokenId)) {\n token.safeTransferFrom(address(this), withdrawer, tokenId);\n } else {\n // If token was minted on L2\n // we'll mint it here, on L1, during\n // exiting from L2\n token.mint(withdrawer, tokenId);\n }\n }\n }\n\n function exitTokens(\n address rootToken,\n address withdrawer,\n uint256 tokenId,\n bytes calldata metadata\n ) public {\n // If this is NFT exit with metadata i.e. URI 👆\n //\n // Note: If your token is only minted in L2, you can exit\n // it with metadata. But if it was minted on L1, it'll be\n // simply transferred to withdrawer address. And in that case,\n // it's lot better to exit with `Transfer(address,address,uint256)`\n // i.e. calling `withdraw` method on L2 contract\n // event signature proof, which is defined under first `if` clause\n //\n // If you've called `withdrawWithMetadata`, you should submit\n // proof of event signature `TransferWithMetadata(address,address,uint256,bytes)`\n\n IMintableERC721 token = IMintableERC721(rootToken);\n\n // topic3 is tokenId field\n if (token.exists(tokenId)) {\n token.safeTransferFrom(address(this), withdrawer, tokenId);\n } else {\n token.mint(withdrawer, tokenId, metadata);\n }\n }\n\n /**\n * @notice accepts safe ERC721 transfer\n */\n function onERC721Received(\n address,\n address,\n uint256,\n bytes calldata\n ) external pure override returns (bytes4) {\n return IERC721TokenReceiver.onERC721Received.selector;\n }\n}\n" + }, + "src/solc_0.8/test/FakePolygonLand.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../common/BaseWithStorage/ERC20/ERC20BaseToken.sol\";\n\ncontract FakePolygonLand is ERC20BaseToken {\n constructor() ERC20BaseToken(\"FakePolygonLand\", \"FPL\", msg.sender, msg.sender) {\n _mint(msg.sender, 3000000000 * 10**18);\n }\n}\n" + }, + "src/solc_0.8/test/FakePolygonSand.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../common/BaseWithStorage/ERC20/ERC20BaseToken.sol\";\n\ncontract FakePolygonSand is ERC20BaseToken {\n constructor() ERC20BaseToken(\"FakePolygonSand\", \"FPS\", msg.sender, msg.sender) {\n _mint(msg.sender, 3000000000 * 10**18);\n }\n}\n" + }, + "src/solc_0.8/test/FakePredicateForwarder.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\n/// @dev This is NOT a secure forwarder contract implementation!\n/// DO NOT USE in production.\ncontract FakePredicateForwarder {\n struct Request {\n address from;\n address to;\n uint256 value;\n uint256 gas;\n bytes data;\n }\n\n // solhint-disable-next-line no-empty-blocks\n constructor() {}\n\n function forward(Request calldata req) public returns (bool, bytes memory) {\n // solhint-disable avoid-low-level-calls\n (bool success, bytes memory returndata) =\n req.to.call{gas: req.gas, value: req.value}(abi.encodePacked(req.data, req.from));\n // solhint-enable avoid-low-level-calls\n\n return (success, returndata);\n }\n}\n" + }, + "src/solc_0.8/test/FallbackContract.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ncontract FallBackContract {\n // solhint-disable-next-line payable-fallback\n fallback() external {}\n}\n" + }, + "src/solc_0.8/test/MockAssetAttributesRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\npragma experimental ABIEncoderV2;\n\nimport \"../asset/AssetAttributesRegistry.sol\";\n\n/// @notice Allows setting the gems and catalysts of an asset\ncontract MockAssetAttributesRegistry is AssetAttributesRegistry {\n uint256 private constant IS_NFT = 0x0000000000000000000000000000000000000000800000000000000000000000;\n\n constructor(\n GemsCatalystsRegistry gemsCatalystsRegistry,\n address admin,\n address minter,\n address upgrader\n )\n AssetAttributesRegistry(gemsCatalystsRegistry, admin, minter, upgrader)\n // solhint-disable-next-line no-empty-blocks\n {\n\n }\n\n function setCatalyst(\n uint256 assetId,\n uint16 catalystId,\n uint16[] calldata gemIds\n ) external override {\n // @note access control removed for testing\n _setCatalyst(assetId, catalystId, gemIds, _getBlockNumber(), true);\n }\n\n function _setCatalyst(\n uint256 assetId,\n uint16 catalystId,\n uint16[] memory gemIds,\n uint64 blockNumber,\n bool hasToEmitEvent\n ) internal override {\n // @note access control removed for testing\n require(gemIds.length <= MAX_NUM_GEMS, \"GEMS_MAX_REACHED\");\n uint8 maxGems = _gemsCatalystsRegistry.getMaxGems(catalystId);\n require(gemIds.length <= maxGems, \"GEMS_TOO_MANY\");\n uint16[MAX_NUM_GEMS] memory gemIdsToStore;\n for (uint8 i = 0; i < gemIds.length; i++) {\n require(gemIds[i] != 0, \"INVALID_GEM_ID\");\n gemIdsToStore[i] = gemIds[i];\n }\n _records[assetId] = Record(catalystId, gemIdsToStore);\n if (hasToEmitEvent) {\n emit CatalystApplied(assetId, catalystId, gemIds, blockNumber);\n }\n }\n\n function addGems(uint256 assetId, uint16[] calldata gemIds) external override {\n // @note removed access control for ease of testing.\n require(assetId & IS_NFT != 0, \"INVALID_NOT_NFT\");\n require(gemIds.length != 0, \"INVALID_GEMS_0\");\n\n uint16 catalystId = _records[assetId].catalystId;\n uint16[MAX_NUM_GEMS] memory gemIdsToStore;\n if (catalystId == 0) {\n // fallback on collection catalyst\n uint256 collectionId = _getCollectionId(assetId);\n catalystId = _records[collectionId].catalystId;\n if (catalystId != 0) {\n _records[assetId].catalystId = catalystId;\n gemIdsToStore = _records[collectionId].gemIds;\n }\n } else {\n gemIdsToStore = _records[assetId].gemIds;\n }\n\n require(catalystId != 0, \"NO_CATALYST_SET\");\n uint8 j = 0;\n uint8 i = 0;\n for (i = 0; i < MAX_NUM_GEMS; i++) {\n if (j == gemIds.length) {\n break;\n }\n if (gemIdsToStore[i] == 0) {\n require(gemIds[j] != 0, \"INVALID_GEM_ID\");\n gemIdsToStore[i] = gemIds[j];\n j++;\n }\n }\n uint8 maxGems = _gemsCatalystsRegistry.getMaxGems(catalystId);\n require(i <= maxGems, \"GEMS_TOO_MANY\");\n _records[assetId].gemIds = gemIdsToStore;\n uint64 blockNumber = _getBlockNumber();\n emit GemsAdded(assetId, gemIds, blockNumber);\n }\n}\n" + }, + "src/solc_0.8/test/MockAssetERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {AssetERC1155} from \"../assetERC1155/AssetERC1155.sol\";\nimport \"../asset/libraries/ERC1155ERC721Helper.sol\";\nimport {IOperatorFilterRegistry} from \"../OperatorFilterer/interfaces/IOperatorFilterRegistry.sol\";\n\ncontract MockAssetERC1155 is AssetERC1155 {\n /// @notice sets filter registry address deployed in test\n /// @param registry the address of the registry\n function setOperatorRegistry(address registry) external {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n }\n\n /// @notice registers and substribe to the subscription on the said deployed registry\n /// @param subscription the address to subcribe to\n function registerAndSubscribe(address subscription) external {\n operatorFilterRegistry.registerAndSubscribe(address(this), subscription);\n }\n\n /// @notice sets Approvals with operator filterer check in case to test the transfer.\n /// @param operator address of the operator to be approved\n /// @param approved bool value denoting approved (true) or not Approved(false)\n function setApprovalForAllWithOutFilter(address operator, bool approved) external {\n super._setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /// @notice mint with out the bouncer check for the test\n /// @param creator address of the creator of the token.\n /// @param packId unique packId for that token.\n /// @param hash hash of an IPFS cidv1 folder that contains the metadata of the token type in the file 0.json.\n /// @param supply number of tokens minted for that token type.\n /// @param owner address that will receive the tokens.\n /// @param data extra data to accompany the minting call.\n /// @return id the id of the newly minted token type.\n function mintWithOutBouncerCheck(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256 supply,\n address owner,\n bytes calldata data\n ) external returns (uint256 id) {\n require(hash != 0, \"HASH==0\");\n require(owner != address(0), \"TO==0\");\n id = _generateTokenId(creator, supply, packId, supply == 1 ? 0 : 1, 0);\n uint256 uriId = id & ERC1155ERC721Helper.URI_ID;\n require(uint256(_metadataHash[uriId]) == 0, \"ID_TAKEN\");\n _metadataHash[uriId] = hash;\n _mint(_msgSender(), owner, id, supply, data);\n }\n}\n" + }, + "src/solc_0.8/test/MockAssetERC1155Tunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../polygon/root/asset/AssetERC1155Tunnel.sol\";\n\ncontract MockAssetERC1155Tunnel is AssetERC1155Tunnel {\n function init(\n address _checkpointManager,\n address _fxRoot,\n IAssetERC1155 _rootToken,\n address trustedForwarder,\n uint256 _maxTransferLimit\n ) external {\n AssetERC1155Tunnel.initialize(_checkpointManager, _fxRoot, _rootToken, trustedForwarder, _maxTransferLimit);\n }\n\n function receiveMessage(bytes memory message) public virtual override {\n _processMessageFromChild(message);\n }\n}\n" + }, + "src/solc_0.8/test/MockAssetERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {AssetERC721} from \"../polygon/root/asset/AssetERC721.sol\";\nimport {BaseERC721} from \"../assetERC721/BaseERC721.sol\";\nimport {IOperatorFilterRegistry} from \"../OperatorFilterer/interfaces/IOperatorFilterRegistry.sol\";\n\ncontract MockAssetERC721 is AssetERC721 {\n /// @notice sets filter registry address deployed in test\n /// @param registry the address of the registry\n function setOperatorRegistry(address registry) external {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n }\n\n /// @notice registers and substribe to the subscription on the said deployed registry\n /// @param subscription the address to subcribe to\n function registerAndSubscribe(address subscription) external {\n operatorFilterRegistry.registerAndSubscribe(address(this), subscription);\n }\n\n /// @notice sets Approvals with operator filterer check in case to test the transfer.\n /// @param operator address of the operator to be approved\n /// @param approved bool value denoting approved (true) or not Approved(false)\n function setApprovalForAllWithOutFilter(address operator, bool approved) external {\n super._setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /// @notice Mint without the minter check for test.\n /// @param to Address that will receive the token.\n /// @param id ERC721 id to be used.\n function mintWithOutMinterCheck(address to, uint256 id) external {\n BaseERC721.mint(to, id);\n }\n}\n" + }, + "src/solc_0.8/test/MockAssetERC721Tunnel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../polygon/root/asset/AssetERC721Tunnel.sol\";\nimport \"../common/interfaces/IAssetERC721.sol\";\n\ncontract MockAssetERC721Tunnel is AssetERC721Tunnel {\n function init(\n address _checkpointManager,\n address _fxRoot,\n IAssetERC721 _rootToken,\n address trustedForwarder,\n uint256 _maxTransferLimit\n ) external {\n AssetERC721Tunnel.initialize(_checkpointManager, _fxRoot, _rootToken, trustedForwarder, _maxTransferLimit);\n }\n\n function receiveMessage(bytes memory message) public virtual override {\n _processMessageFromChild(message);\n }\n}\n" + }, + "src/solc_0.8/test/MockERC1155Asset.sol": { + "content": "//SPDX-License-Identifier: MIT\n\n/* solhint-disable no-empty-blocks */\n\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC1155/presets/ERC1155PresetMinterPauser.sol\";\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\n\ncontract MockERC1155Asset is ERC1155PresetMinterPauser, Ownable {\n constructor(string memory uri) ERC1155PresetMinterPauser(uri) Ownable() {}\n}\n" + }, + "src/solc_0.8/test/MockERC20BasicApprovalTarget.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol\";\n\ncontract MockERC20BasicApprovalTarget {\n event LogOnCall(address);\n\n function logOnCall(address sender) external returns (address) {\n emit LogOnCall(sender);\n return sender;\n }\n\n function revertOnCall() external pure {\n revert(\"REVERT_ON_CALL\");\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool) {\n return IERC20(msg.sender).transferFrom(sender, recipient, amount);\n }\n}\n" + }, + "src/solc_0.8/test/MockERC667Reciever.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\nimport \"../common/interfaces/IERC677Receiver.sol\";\n\ncontract MockERC677Receiver is IERC677Receiver {\n event OnTokenTransferEvent(address indexed _sender, uint256 _value, bytes _data);\n\n /// @dev Emits the OnTokenTransferEvent.\n /// @param _sender The address of the sender.\n /// @param _value The value sent with the tx.\n /// @param _data The data sent with the tx.\n function onTokenTransfer(\n address _sender,\n uint256 _value,\n bytes calldata _data\n ) external override {\n emit OnTokenTransferEvent(_sender, _value, _data);\n }\n}\n" + }, + "src/solc_0.8/test/MockERC721Asset.sol": { + "content": "//SPDX-License-Identifier: MIT\n\n/* solhint-disable no-empty-blocks */\n\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/token/ERC721/presets/ERC721PresetMinterPauserAutoId.sol\";\nimport \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\n\ncontract MockERC721Asset is ERC721PresetMinterPauserAutoId, Ownable {\n constructor(\n string memory name,\n string memory symbol,\n string memory uri\n ) ERC721PresetMinterPauserAutoId(name, symbol, uri) Ownable() {}\n}\n" + }, + "src/solc_0.8/test/MockLandV2WithMint.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable code-complexity\npragma solidity 0.8.2;\n\nimport \"../polygon/child/land/PolygonLandBaseTokenV2.sol\";\n\ncontract MockLandV2WithMint is PolygonLandBaseTokenV2 {\n /** @notice Removed caller validations */\n function mintQuad(\n address user,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) external override {\n _mintQuad(user, size, x, y, data);\n }\n\n /** @notice Removed caller validations */\n function mintAndTransferQuad(\n address to,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes calldata data\n ) external override {\n require(to != address(0), \"to is zero address\");\n\n if (exists(size, x, y)) {\n _transferQuad(msg.sender, to, size, x, y);\n _numNFTPerAddress[msg.sender] -= size * size;\n _numNFTPerAddress[to] += size * size;\n _checkBatchReceiverAcceptQuad(msg.sender, msg.sender, to, size, x, y, data);\n } else {\n _mintAndTransferQuad(to, size, x, y, data);\n }\n }\n}\n" + }, + "src/solc_0.8/test/MockLandWithMint.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable code-complexity\npragma solidity 0.8.2;\n\nimport \"../polygon/child/land/PolygonLandBaseToken.sol\";\n\ncontract MockLandWithMint is PolygonLandBaseToken {\n /** @notice Removed caller validations */\n function mint(\n address user,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) external {\n _mintQuad(user, size, x, y, data);\n }\n\n function mintQuad(\n address user,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) external override {\n _mintQuad(user, size, x, y, data);\n }\n}\n" + }, + "src/solc_0.8/test/MockMarketPlace1.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\nimport {IAssetERC721} from \"../common/interfaces/IAssetERC721.sol\";\nimport {IAssetERC1155} from \"../common/interfaces/IAssetERC1155.sol\";\nimport {ILandTokenV3} from \"../common/interfaces/ILandTokenV3.sol\";\n\ncontract MockMarketPlace1 {\n bytes4 private constant ERC721_IS_RECEIVER = 0x150b7a02;\n bytes4 private constant ERC721_RECEIVED = 0x150b7a02;\n bytes4 private constant ERC1155_IS_RECEIVER = 0x4e2312e0;\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param amount amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function transferTokenForERC1155(\n address asset,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) external {\n IAssetERC1155(asset).safeTransferFrom(from, to, id, amount, data);\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param land the contract address on which the token transfer will take place\n /// @param from adderess from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param data aditional data accompanying the transfer.\n function transferLand(\n address land,\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) external {\n ILandTokenV3(land).safeTransferFrom(from, to, id, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param asset the contract address on which the token transfer will take place\n /// @param from Address whose token is to be transferred.\n /// @param to Recipient.\n /// @param id The token id to be transferred.\n function transferTokenERC721(\n address asset,\n address from,\n address to,\n uint256 id\n ) external {\n IAssetERC721(asset).safeTransferFrom(from, to, id);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param amounts amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function batchTransferTokenERC1155(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) external {\n IAssetERC1155(asset).safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param asset the contract address on which the token transfer will take place\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n /// @param data Additional data.\n function batchTransferTokenERC721(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n bytes memory data\n ) external {\n IAssetERC721(asset).safeBatchTransferFrom(from, to, ids, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param land the contract address on which the token transfer will take place\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param id The id of the token to be transferred.\n function transferLand(\n address land,\n address from,\n address to,\n uint256 id\n ) external {\n ILandTokenV3(land).safeTransferFrom(from, to, id);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n\n function onERC721Received(\n address,\n address,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC721_RECEIVED;\n }\n\n function supportsInterface(bytes4 _interfaceId) external pure returns (bool) {\n return _interfaceId == 0x01ffc9a7 || _interfaceId == ERC1155_IS_RECEIVER || _interfaceId == ERC721_IS_RECEIVER;\n }\n}\n" + }, + "src/solc_0.8/test/MockMarketPlace2.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\nimport {IAssetERC721} from \"../common/interfaces/IAssetERC721.sol\";\nimport {IAssetERC1155} from \"../common/interfaces/IAssetERC1155.sol\";\nimport {ILandTokenV3} from \"../common/interfaces/ILandTokenV3.sol\";\n\ncontract MockMarketPlace2 {\n bytes4 private constant ERC721_IS_RECEIVER = 0x150b7a02;\n bytes4 private constant ERC721_RECEIVED = 0x150b7a02;\n bytes4 private constant ERC1155_IS_RECEIVER = 0x4e2312e0;\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param amount amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function transferTokenForERC1155(\n address asset,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) external {\n IAssetERC1155(asset).safeTransferFrom(from, to, id, amount, data);\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param land the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param data aditional data accompanying the transfer.\n function transferLand(\n address land,\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) external {\n ILandTokenV3(land).safeTransferFrom(from, to, id, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param asset the contract address on which the token transfer will take place\n /// @param from Address whose token is to be transferred.\n /// @param to Recipient.\n /// @param id The token id to be transferred.\n function transferTokenERC721(\n address asset,\n address from,\n address to,\n uint256 id\n ) external {\n IAssetERC721(asset).safeTransferFrom(from, to, id);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param amounts amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function batchTransferTokenERC1155(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) external {\n IAssetERC1155(asset).safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param asset the contract address on which the token transfer will take place\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n /// @param data Additional data.\n function batchTransferTokenERC721(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n bytes memory data\n ) external {\n IAssetERC721(asset).safeBatchTransferFrom(from, to, ids, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param land the contract address on which the token transfer will take place\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param id The id of the token to be transferred.\n function transferLand(\n address land,\n address from,\n address to,\n uint256 id\n ) external {\n ILandTokenV3(land).safeTransferFrom(from, to, id);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n\n function onERC721Received(\n address,\n address,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC721_RECEIVED;\n }\n\n function supportsInterface(bytes4 _interfaceId) external pure returns (bool) {\n return _interfaceId == 0x01ffc9a7 || _interfaceId == ERC1155_IS_RECEIVER || _interfaceId == ERC721_IS_RECEIVER;\n }\n}\n" + }, + "src/solc_0.8/test/MockMarketPlace3.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\nimport {IAssetERC721} from \"../common/interfaces/IAssetERC721.sol\";\nimport {IAssetERC1155} from \"../common/interfaces/IAssetERC1155.sol\";\nimport {ILandTokenV3} from \"../common/interfaces/ILandTokenV3.sol\";\n\ncontract MockMarketPlace3 {\n bytes4 private constant ERC721_IS_RECEIVER = 0x150b7a02;\n bytes4 private constant ERC721_RECEIVED = 0x150b7a02;\n bytes4 private constant ERC1155_IS_RECEIVER = 0x4e2312e0;\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param amount amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function transferTokenForERC1155(\n address asset,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) external {\n IAssetERC1155(asset).safeTransferFrom(from, to, id, amount, data);\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param land the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param data aditional data accompanying the transfer.\n function transferLand(\n address land,\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) external {\n ILandTokenV3(land).safeTransferFrom(from, to, id, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param asset the contract address on which the token transfer will take place\n /// @param from Address whose token is to be transferred.\n /// @param to Recipient.\n /// @param id The token id to be transferred.\n function transferTokenERC721(\n address asset,\n address from,\n address to,\n uint256 id\n ) external {\n IAssetERC721(asset).safeTransferFrom(from, to, id);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param amounts amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function batchTransferTokenERC1155(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) external {\n IAssetERC1155(asset).safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param asset the contract address on which the token transfer will take place\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n /// @param data Additional data.\n function batchTransferTokenERC721(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n bytes memory data\n ) external {\n IAssetERC721(asset).safeBatchTransferFrom(from, to, ids, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param land the contract address on which the token transfer will take place\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param id The id of the token to be transferred.\n function transferLand(\n address land,\n address from,\n address to,\n uint256 id\n ) external {\n ILandTokenV3(land).safeTransferFrom(from, to, id);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n\n function onERC721Received(\n address,\n address,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC721_RECEIVED;\n }\n\n function supportsInterface(bytes4 _interfaceId) external pure returns (bool) {\n return _interfaceId == 0x01ffc9a7 || _interfaceId == ERC1155_IS_RECEIVER || _interfaceId == ERC721_IS_RECEIVER;\n }\n}\n" + }, + "src/solc_0.8/test/MockMarketPlace4.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\nimport {IAssetERC721} from \"../common/interfaces/IAssetERC721.sol\";\nimport {IAssetERC1155} from \"../common/interfaces/IAssetERC1155.sol\";\nimport {ILandTokenV3} from \"../common/interfaces/ILandTokenV3.sol\";\n\ncontract MockMarketPlace4 {\n bytes4 private constant ERC721_IS_RECEIVER = 0x150b7a02;\n bytes4 private constant ERC721_RECEIVED = 0x150b7a02;\n bytes4 private constant ERC1155_IS_RECEIVER = 0x4e2312e0;\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param amount amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function transferTokenForERC1155(\n address asset,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) external {\n IAssetERC1155(asset).safeTransferFrom(from, to, id, amount, data);\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param land the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param data aditional data accompanying the transfer.\n function transferLand(\n address land,\n address from,\n address to,\n uint256 id,\n bytes memory data\n ) external {\n ILandTokenV3(land).safeTransferFrom(from, to, id, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param asset the contract address on which the token transfer will take place\n /// @param from Address whose token is to be transferred.\n /// @param to Recipient.\n /// @param id The token id to be transferred.\n function transferTokenERC721(\n address asset,\n address from,\n address to,\n uint256 id\n ) external {\n IAssetERC721(asset).safeTransferFrom(from, to, id);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param amounts amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function batchTransferTokenERC1155(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) external {\n IAssetERC1155(asset).safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param asset the contract address on which the token transfer will take place\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param ids The ids of the tokens to be transferred.\n /// @param data Additional data.\n function batchTransferTokenERC721(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n bytes memory data\n ) external {\n IAssetERC721(asset).safeBatchTransferFrom(from, to, ids, data);\n }\n\n /// @notice Transfer tokens with given ids ensuring the receiving contract has a receiver method.\n /// @param land the contract address on which the token transfer will take place\n /// @param from The sender of the tokens.\n /// @param to The recipient of the tokens.\n /// @param id The id of the token to be transferred.\n function transferLand(\n address land,\n address from,\n address to,\n uint256 id\n ) external {\n ILandTokenV3(land).safeTransferFrom(from, to, id);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n\n function onERC721Received(\n address,\n address,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC721_RECEIVED;\n }\n\n function supportsInterface(bytes4 _interfaceId) external pure returns (bool) {\n return _interfaceId == 0x01ffc9a7 || _interfaceId == ERC1155_IS_RECEIVER || _interfaceId == ERC721_IS_RECEIVER;\n }\n}\n" + }, + "src/solc_0.8/test/MockOperatorFilterRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable code-complexity\npragma solidity 0.8.2;\n\nimport {IOperatorFilterRegistry} from \"../OperatorFilterer/interfaces/IOperatorFilterRegistry.sol\";\nimport {Ownable} from \"@openzeppelin/contracts-0.8/access/Ownable.sol\";\nimport {EnumerableSet} from \"@openzeppelin/contracts-0.8/utils/structs/EnumerableSet.sol\";\nimport {OperatorFilterRegistryEvents} from \"./OperatorFilterRegistryEvents.sol\";\n\n/**\n * @title MockOperatorFilterRegistry\n * @notice Made based on the OperatorFilterRegistry of openSea at https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/OperatorFilterRegistry.sol\n * @notice This contracts allows tokens or token owners to register specific addresses or codeHashes that may be\n * * restricted according to the isOperatorAllowed function.\n */\ncontract MockOperatorFilterRegistry is IOperatorFilterRegistry, OperatorFilterRegistryEvents {\n using EnumerableSet for EnumerableSet.AddressSet;\n using EnumerableSet for EnumerableSet.Bytes32Set;\n\n /// @dev initialized accounts have a nonzero codehash (see https://eips.ethereum.org/EIPS/eip-1052)\n /// Note that this will also be a smart contract's codehash when making calls from its constructor.\n bytes32 public constant EOA_CODEHASH = keccak256(\"\");\n\n mapping(address => EnumerableSet.AddressSet) private _filteredOperators;\n mapping(address => EnumerableSet.Bytes32Set) private _filteredCodeHashes;\n mapping(address => address) private _registrations;\n mapping(address => EnumerableSet.AddressSet) private _subscribers;\n\n constructor(address _defaultSubscribtion, address[] memory _blacklistedAddresses) {\n _registrations[_defaultSubscribtion] = _defaultSubscribtion;\n EnumerableSet.AddressSet storage filteredOperatorsRef = _filteredOperators[_defaultSubscribtion];\n EnumerableSet.Bytes32Set storage filteredCodeHashesRef = _filteredCodeHashes[_defaultSubscribtion];\n for (uint256 i; i < _blacklistedAddresses.length; i++) {\n filteredOperatorsRef.add(_blacklistedAddresses[i]);\n bytes32 codeHash = _blacklistedAddresses[i].codehash;\n filteredCodeHashesRef.add(codeHash);\n }\n }\n\n /**\n * @notice restricts method caller to the address or EIP-173 \"owner()\"\n */\n modifier onlyAddressOrOwner(address addr) {\n if (msg.sender != addr) {\n try Ownable(addr).owner() returns (address owner) {\n if (msg.sender != owner) {\n revert(\"Only Address or Owner\");\n }\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"Not Ownable\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n }\n _;\n }\n\n /**\n * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns\n * true if supplied registrant address is not registered.\n */\n function isOperatorAllowed(address registrant, address operator) external view override returns (bool) {\n address registration = _registrations[registrant];\n if (registration != address(0)) {\n EnumerableSet.AddressSet storage filteredOperatorsRef;\n EnumerableSet.Bytes32Set storage filteredCodeHashesRef;\n\n filteredOperatorsRef = _filteredOperators[registration];\n filteredCodeHashesRef = _filteredCodeHashes[registration];\n\n if (filteredOperatorsRef.contains(operator)) {\n revert(\"Address is filtered\");\n }\n if (operator.code.length > 0) {\n bytes32 codeHash = operator.codehash;\n if (filteredCodeHashesRef.contains(codeHash)) {\n revert(\"Codehash is filtered\");\n }\n }\n }\n return true;\n }\n\n //////////////////\n // AUTH METHODS //\n //////////////////\n\n /**\n * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.\n */\n function register(address registrant) external override onlyAddressOrOwner(registrant) {\n if (_registrations[registrant] != address(0)) {\n revert(\"Already registered\");\n }\n _registrations[registrant] = registrant;\n emit RegistrationUpdated(registrant, true);\n }\n\n /**\n * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.\n * Note that this does not remove any filtered addresses or codeHashes.\n * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.\n */\n function unregister(address registrant) external onlyAddressOrOwner(registrant) {\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert(\"Not registered\");\n }\n if (registration != registrant) {\n _subscribers[registration].remove(registrant);\n emit SubscriptionUpdated(registrant, registration, false);\n }\n _registrations[registrant] = address(0);\n emit RegistrationUpdated(registrant, false);\n }\n\n /**\n * @notice Registers an address with the registry and \"subscribes\" to another address's filtered operators and codeHashes.\n */\n function registerAndSubscribe(address registrant, address subscription)\n external\n override\n onlyAddressOrOwner(registrant)\n {\n address registration = _registrations[registrant];\n if (registration != address(0)) {\n revert(\"Already registered\");\n }\n if (registrant == subscription) {\n revert(\"Cannot subscribe to self\");\n }\n address subscriptionRegistration = _registrations[subscription];\n if (subscriptionRegistration == address(0)) {\n revert(\"Subscribtion not registered\");\n }\n if (subscriptionRegistration != subscription) {\n revert(\"Cannot subscribe to registrant with subscribtion\");\n }\n\n _registrations[registrant] = subscription;\n _subscribers[subscription].add(registrant);\n emit RegistrationUpdated(registrant, true);\n emit SubscriptionUpdated(registrant, subscription, true);\n }\n\n /**\n * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another\n * address without subscribing.\n */\n function registerAndCopyEntries(address registrant, address registrantToCopy)\n external\n override\n onlyAddressOrOwner(registrant)\n {\n if (registrantToCopy == registrant) {\n revert(\"Cannot copy from self\");\n }\n address registration = _registrations[registrant];\n if (registration != address(0)) {\n revert(\"Already registered\");\n }\n address registrantRegistration = _registrations[registrantToCopy];\n if (registrantRegistration == address(0)) {\n revert(\"Registrant to copy from not registered\");\n }\n _registrations[registrant] = registrant;\n emit RegistrationUpdated(registrant, true);\n _copyEntries(registrant, registrantToCopy);\n }\n\n /**\n * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered.\n */\n function updateOperator(\n address registrant,\n address operator,\n bool filtered\n ) external override onlyAddressOrOwner(registrant) {\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert(\"Not registered\");\n }\n if (registration != registrant) {\n revert(\"Cannot update while subscribed\");\n }\n EnumerableSet.AddressSet storage filteredOperatorsRef = _filteredOperators[registrant];\n\n if (!filtered) {\n bool removed = filteredOperatorsRef.remove(operator);\n if (!removed) {\n revert(\"Address not filtered\");\n }\n } else {\n bool added = filteredOperatorsRef.add(operator);\n if (!added) {\n revert(\"Address already filtered\");\n }\n }\n emit OperatorUpdated(registrant, operator, filtered);\n }\n\n /**\n * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.\n */\n function updateCodeHash(\n address registrant,\n bytes32 codeHash,\n bool filtered\n ) external override onlyAddressOrOwner(registrant) {\n if (codeHash == EOA_CODEHASH) {\n revert(\"Cannot filter EOAs\");\n }\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert(\"Not registered\");\n }\n if (registration != registrant) {\n revert(\"Cannot update while subscribed\");\n }\n EnumerableSet.Bytes32Set storage filteredCodeHashesRef = _filteredCodeHashes[registrant];\n\n if (!filtered) {\n bool removed = filteredCodeHashesRef.remove(codeHash);\n if (!removed) {\n revert(\"Codehash not filtered\");\n }\n } else {\n bool added = filteredCodeHashesRef.add(codeHash);\n if (!added) {\n revert(\"Codehash already filtered\");\n }\n }\n emit CodeHashUpdated(registrant, codeHash, filtered);\n }\n\n /**\n * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.\n */\n function updateOperators(\n address registrant,\n address[] calldata operators,\n bool filtered\n ) external override onlyAddressOrOwner(registrant) {\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert(\"Not registered\");\n }\n if (registration != registrant) {\n revert(\"Cannot update while subscribed\");\n }\n EnumerableSet.AddressSet storage filteredOperatorsRef = _filteredOperators[registrant];\n uint256 operatorsLength = operators.length;\n unchecked {\n if (!filtered) {\n for (uint256 i = 0; i < operatorsLength; ++i) {\n address operator = operators[i];\n bool removed = filteredOperatorsRef.remove(operator);\n if (!removed) {\n revert(\"Address not filtered\");\n }\n }\n } else {\n for (uint256 i = 0; i < operatorsLength; ++i) {\n address operator = operators[i];\n bool added = filteredOperatorsRef.add(operator);\n if (!added) {\n revert(\"Address already filtered\");\n }\n }\n }\n }\n emit OperatorsUpdated(registrant, operators, filtered);\n }\n\n /**\n * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.\n */\n function updateCodeHashes(\n address registrant,\n bytes32[] calldata codeHashes,\n bool filtered\n ) external override onlyAddressOrOwner(registrant) {\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert(\"Not registered\");\n }\n if (registration != registrant) {\n revert(\"Cannot update while subscribed\");\n }\n EnumerableSet.Bytes32Set storage filteredCodeHashesRef = _filteredCodeHashes[registrant];\n uint256 codeHashesLength = codeHashes.length;\n unchecked {\n if (!filtered) {\n for (uint256 i = 0; i < codeHashesLength; ++i) {\n bytes32 codeHash = codeHashes[i];\n bool removed = filteredCodeHashesRef.remove(codeHash);\n if (!removed) {\n revert(\"Codehash not filtered\");\n }\n }\n } else {\n for (uint256 i = 0; i < codeHashesLength; ++i) {\n bytes32 codeHash = codeHashes[i];\n if (codeHash == EOA_CODEHASH) {\n revert(\"Cannot filter EOAs\");\n }\n bool added = filteredCodeHashesRef.add(codeHash);\n if (!added) {\n revert(\"Codehash already filtered\");\n }\n }\n }\n }\n emit CodeHashesUpdated(registrant, codeHashes, filtered);\n }\n\n /**\n * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous\n * subscription if present.\n * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,\n * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be\n * used.\n */\n function subscribe(address registrant, address newSubscription) external override onlyAddressOrOwner(registrant) {\n if (registrant == newSubscription) {\n revert(\"Cannot subscribe to self\");\n }\n if (newSubscription == address(0)) {\n revert(\"Cannot subscribe to zero address\");\n }\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert(\"Not registered\");\n }\n if (registration == newSubscription) {\n revert(\"Already subscribed\");\n }\n address newSubscriptionRegistration = _registrations[newSubscription];\n if (newSubscriptionRegistration == address(0)) {\n revert(\"New subscription not registered\");\n }\n if (newSubscriptionRegistration != newSubscription) {\n revert(\"Cannot Subscribe to registrant with subscription\");\n }\n\n if (registration != registrant) {\n _subscribers[registration].remove(registrant);\n emit SubscriptionUpdated(registrant, registration, false);\n }\n _registrations[registrant] = newSubscription;\n _subscribers[newSubscription].add(registrant);\n emit SubscriptionUpdated(registrant, newSubscription, true);\n }\n\n /**\n * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.\n */\n function unsubscribe(address registrant, bool copyExistingEntries)\n external\n override\n onlyAddressOrOwner(registrant)\n {\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert(\"Not registered\");\n }\n if (registration == registrant) {\n revert(\"Not subscribed\");\n }\n _subscribers[registration].remove(registrant);\n _registrations[registrant] = registrant;\n emit SubscriptionUpdated(registrant, registration, false);\n if (copyExistingEntries) {\n _copyEntries(registrant, registration);\n }\n }\n\n /**\n * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.\n */\n function copyEntriesOf(address registrant, address registrantToCopy)\n external\n override\n onlyAddressOrOwner(registrant)\n {\n if (registrant == registrantToCopy) {\n revert(\"Cannot copy from self\");\n }\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert(\"Not registered\");\n }\n if (registration != registrant) {\n revert(\"Cannot upgrade while subscribed\");\n }\n address registrantRegistration = _registrations[registrantToCopy];\n if (registrantRegistration == address(0)) {\n revert(\"Registrant not registered\");\n }\n _copyEntries(registrant, registrantToCopy);\n }\n\n /// @dev helper to copy entries from registrantToCopy to registrant and emit events\n function _copyEntries(address registrant, address registrantToCopy) private {\n EnumerableSet.AddressSet storage filteredOperatorsRef = _filteredOperators[registrantToCopy];\n EnumerableSet.Bytes32Set storage filteredCodeHashesRef = _filteredCodeHashes[registrantToCopy];\n uint256 filteredOperatorsLength = filteredOperatorsRef.length();\n uint256 filteredCodeHashesLength = filteredCodeHashesRef.length();\n unchecked {\n for (uint256 i = 0; i < filteredOperatorsLength; ++i) {\n address operator = filteredOperatorsRef.at(i);\n bool added = _filteredOperators[registrant].add(operator);\n if (added) {\n emit OperatorUpdated(registrant, operator, true);\n }\n }\n for (uint256 i = 0; i < filteredCodeHashesLength; ++i) {\n bytes32 codehash = filteredCodeHashesRef.at(i);\n bool added = _filteredCodeHashes[registrant].add(codehash);\n if (added) {\n emit CodeHashUpdated(registrant, codehash, true);\n }\n }\n }\n }\n\n //////////////////\n // VIEW METHODS //\n //////////////////\n\n /**\n * @notice Get the subscription address of a given registrant, if any.\n */\n function subscriptionOf(address registrant) external view override returns (address subscription) {\n subscription = _registrations[registrant];\n if (subscription == address(0)) {\n revert(\"Not registered\");\n } else if (subscription == registrant) {\n subscription = address(0);\n }\n }\n\n /**\n * @notice Get the set of addresses subscribed to a given registrant.\n * Note that order is not guaranteed as updates are made.\n */\n function subscribers(address registrant) external view override returns (address[] memory) {\n return _subscribers[registrant].values();\n }\n\n /**\n * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.\n * Note that order is not guaranteed as updates are made.\n */\n function subscriberAt(address registrant, uint256 index) external view override returns (address) {\n return _subscribers[registrant].at(index);\n }\n\n /**\n * @notice Returns true if operator is filtered by a given address or its subscription.\n */\n function isOperatorFiltered(address registrant, address operator) external view override returns (bool) {\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredOperators[registration].contains(operator);\n }\n return _filteredOperators[registrant].contains(operator);\n }\n\n /**\n * @notice Returns true if a codeHash is filtered by a given address or its subscription.\n */\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external view override returns (bool) {\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredCodeHashes[registration].contains(codeHash);\n }\n return _filteredCodeHashes[registrant].contains(codeHash);\n }\n\n /**\n * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription.\n */\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external view override returns (bool) {\n bytes32 codeHash = operatorWithCode.codehash;\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredCodeHashes[registration].contains(codeHash);\n }\n return _filteredCodeHashes[registrant].contains(codeHash);\n }\n\n /**\n * @notice Returns true if an address has registered\n */\n function isRegistered(address registrant) external view override returns (bool) {\n return _registrations[registrant] != address(0);\n }\n\n /**\n * @notice Returns a list of filtered operators for a given address or its subscription.\n */\n function filteredOperators(address registrant) external view override returns (address[] memory) {\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredOperators[registration].values();\n }\n return _filteredOperators[registrant].values();\n }\n\n /**\n * @notice Returns the set of filtered codeHashes for a given address or its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredCodeHashes(address registrant) external view override returns (bytes32[] memory) {\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredCodeHashes[registration].values();\n }\n return _filteredCodeHashes[registrant].values();\n }\n\n /**\n * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or\n * its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredOperatorAt(address registrant, uint256 index) external view override returns (address) {\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredOperators[registration].at(index);\n }\n return _filteredOperators[registrant].at(index);\n }\n\n /**\n * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or\n * its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredCodeHashAt(address registrant, uint256 index) external view override returns (bytes32) {\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredCodeHashes[registration].at(index);\n }\n return _filteredCodeHashes[registrant].at(index);\n }\n\n /// @dev Convenience method to compute the code hash of an arbitrary contract\n function codeHashOf(address a) external view override returns (bytes32) {\n return a.codehash;\n }\n}\n" + }, + "src/solc_0.8/test/MockPolygonAssetERC1155.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {PolygonAssetERC1155} from \"../polygon/child/asset/PolygonAssetERC1155.sol\";\nimport \"../asset/libraries/ERC1155ERC721Helper.sol\";\nimport {IOperatorFilterRegistry} from \"../OperatorFilterer/interfaces/IOperatorFilterRegistry.sol\";\n\ncontract MockPolygonAssetERC1155 is PolygonAssetERC1155 {\n function setOperatorRegistry(address registry) external {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n }\n\n function registerAndSubscribe(address subsciption) external {\n operatorFilterRegistry.registerAndSubscribe(address(this), subsciption);\n }\n\n function setApprovalForAllWithOutFilter(address operator, bool approved) external {\n super._setApprovalForAll(_msgSender(), operator, approved);\n }\n\n function mintWithOutBouncerCheck(\n address creator,\n uint40 packId,\n bytes32 hash,\n uint256 supply,\n address owner,\n bytes calldata data\n ) external returns (uint256 id) {\n require(hash != 0, \"HASH==0\");\n require(owner != address(0), \"TO==0\");\n id = _generateTokenId(creator, supply, packId, supply == 1 ? 0 : 1, 0);\n uint256 uriId = id & ERC1155ERC721Helper.URI_ID;\n require(uint256(_metadataHash[uriId]) == 0, \"ID_TAKEN\");\n _metadataHash[uriId] = hash;\n _mint(_msgSender(), owner, id, supply, data);\n }\n}\n" + }, + "src/solc_0.8/test/MockPolygonAssetERC721.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport {PolygonAssetERC721} from \"../polygon/child/asset/PolygonAssetERC721.sol\";\nimport {BaseERC721} from \"../assetERC721/BaseERC721.sol\";\nimport {IOperatorFilterRegistry} from \"../OperatorFilterer/interfaces/IOperatorFilterRegistry.sol\";\n\ncontract MockPolygonAssetERC721 is PolygonAssetERC721 {\n function setOperatorRegistry(address registry) external {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n }\n\n function registerAndSubscribe(address subsciption) external {\n operatorFilterRegistry.registerAndSubscribe(address(this), subsciption);\n }\n\n function setApprovalForAllWithOutFilter(address operator, bool approved) external {\n super._setApprovalForAll(_msgSender(), operator, approved);\n }\n\n function mintWithOutMinterCheck(address to, uint256 id) external {\n BaseERC721.mint(to, id);\n }\n}\n" + }, + "src/solc_0.8/test/MockPolygonLandV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"../polygon/child/land/PolygonLandV2.sol\";\n\ncontract MockPolygonLandV2 is PolygonLandV2 {\n /// @notice sets filter registry address deployed in test\n /// @param registry the address of the registry\n function setOperatorRegistry(address registry) external override {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n }\n\n /// @notice sets Approvals with operator filterer check in case to test the transfer.\n /// @param operator address of the operator to be approved\n /// @param approved bool value denoting approved (true) or not Approved(false)\n function setApprovalForAllWithOutFilter(address operator, bool approved) external {\n super._setApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @notice Mint a new quad without a minter (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)\n * @param user The recipient of the new quad\n * @param size The size of the new quad\n * @param x The top left x coordinate of the new quad\n * @param y The top left y coordinate of the new quad\n * @param data extra data to pass to the transfer\n */\n function mintQuad(\n address user,\n uint256 size,\n uint256 x,\n uint256 y,\n bytes memory data\n ) external override {\n _mintQuad(user, size, x, y, data);\n }\n\n /// @notice This function is used to register Land contract on the Operator Filterer Registry of Opensea.can only be called by admin.\n /// @dev used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.\n /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe.\n /// @param subscribe bool to signify subscription \"true\"\" or to copy the list \"false\".\n function registerFilterer(address subscriptionOrRegistrantToCopy, bool subscribe) external {\n _register(subscriptionOrRegistrantToCopy, subscribe);\n }\n}\n" + }, + "src/solc_0.8/test/MockSafeMathWithRequire.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../common/Libraries/SafeMathWithRequire.sol\";\n\n/**\n * @title SafeMathWithRequire\n * @dev Specific Mock to test SafeMathWithRequire\n */\ncontract MockSafeMathWithRequire {\n function sqrt6(uint256 a) external pure returns (uint256 c) {\n return SafeMathWithRequire.sqrt6(a);\n }\n\n function sqrt3(uint256 a) external pure returns (uint256 c) {\n return SafeMathWithRequire.sqrt3(a);\n }\n\n function cbrt6(uint256 a) external pure returns (uint256 c) {\n return SafeMathWithRequire.cbrt6(a);\n }\n\n function cbrt3(uint256 a) external pure returns (uint256 c) {\n return SafeMathWithRequire.cbrt3(a);\n }\n}\n" + }, + "src/solc_0.8/test/OperatorFilterRegistryEvents.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ncontract OperatorFilterRegistryEvents {\n event RegistrationUpdated(address indexed registrant, bool indexed registered);\n\n event OperatorUpdated(address indexed registrant, address indexed operator, bool indexed filtered);\n\n event OperatorsUpdated(address indexed registrant, address[] operators, bool indexed filtered);\n\n event CodeHashUpdated(address indexed registrant, bytes32 indexed codeHash, bool indexed filtered);\n\n event CodeHashesUpdated(address indexed registrant, bytes32[] codeHashes, bool indexed filtered);\n\n event SubscriptionUpdated(address indexed registrant, address indexed subscription, bool indexed subscribed);\n}\n" + }, + "src/solc_0.8/test/PayableMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\ncontract PayableMock {\n bool public called;\n bool public fallbackCalled;\n bool public receiveCalled;\n\n function payME() external payable {\n called = true;\n }\n\n function callME() external {\n called = true;\n }\n\n fallback() external payable {\n fallbackCalled = true;\n }\n\n receive() external payable {\n receiveCalled = true;\n }\n}\n" + }, + "src/solc_0.8/test/PolygonLandWeightedSANDRewardPoolNFTTest.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.2;\n\nimport \"../polygon/LiquidityMining/PolygonLandWeightedSANDRewardPool.sol\";\n\ncontract PolygonLandWeightedSANDRewardPoolNFTTest is PolygonLandWeightedSANDRewardPool {\n constructor(\n address stakeTokenContract,\n address rewardTokenContract,\n address nftContract,\n uint256 rewardDuration\n )\n PolygonLandWeightedSANDRewardPool(\n IERC20(stakeTokenContract),\n IERC20(rewardTokenContract),\n IERC721(nftContract),\n rewardDuration\n )\n // solhint-disable-next-line no-empty-blocks\n {\n\n }\n}\n" + }, + "src/solc_0.8/test/RewardCalculatorMock.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport \"../defi/interfaces/IRewardCalculator.sol\";\n\ncontract RewardCalculatorMock is IRewardCalculator {\n event RewardRestarted();\n\n uint256 public reward;\n bool public skipRestart;\n\n // At any point in time this function must return the accumulated rewards from last call to restartRewards\n function getRewards() external view override returns (uint256) {\n return reward;\n }\n\n function restartRewards() external override {\n if (!skipRestart) {\n reward = 0;\n }\n emit RewardRestarted();\n }\n\n function setReward(uint256 reward_) external {\n reward = reward_;\n }\n\n function setSkipRestart(bool val) external {\n skipRestart = val;\n }\n}\n" + }, + "src/solc_0.8/test/TestEIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/utils/cryptography/ECDSA.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712 {\n /* solhint-disable var-name-mixedcase */\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n // invalidate the cached domain separator if the chain id changes.\n // bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;\n // uint256 private immutable _CACHED_CHAIN_ID;\n\n bytes32 private immutable _HASHED_NAME;\n bytes32 private immutable _HASHED_VERSION;\n bytes32 private immutable _TYPE_HASH;\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n constructor(string memory name, string memory version) {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n bytes32 typeHash = keccak256(\"EIP712Domain(string name,string version,address verifyingContract)\");\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n // _CACHED_CHAIN_ID = block.chainid;\n // _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n _TYPE_HASH = typeHash;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n // if (block.chainid == _CACHED_CHAIN_ID) {\n // return _CACHED_DOMAIN_SEPARATOR;\n // } else {\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n // }\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 name,\n bytes32 version\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, name, version, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n}\n" + }, + "src/solc_0.8/test/TestMetaTxForwarder.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts-0.8/utils/cryptography/ECDSA.sol\";\nimport \"./TestEIP712.sol\";\n\n// @note !!! For Testing Only !!!\n// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\ncontract TestMetaTxForwarder is EIP712 {\n using ECDSA for bytes32;\n event TXResult(bool success, bytes returndata);\n\n struct ForwardRequest {\n address from;\n address to;\n uint256 value;\n uint256 gas;\n uint256 nonce;\n bytes data;\n }\n\n bytes32 private constant TYPEHASH =\n keccak256(\"ForwardRequest(address from,address to,uint256 value,uint256 gas,uint256 nonce,bytes data)\");\n\n mapping(address => uint256) private _nonces;\n\n // solhint-disable no-empty-blocks\n constructor() EIP712(\"The Sandbox\", \"1\") {}\n\n // solhint-enable no-empty-blocks\n\n function getNonce(address from) public view returns (uint256) {\n return _nonces[from];\n }\n\n function verify(ForwardRequest calldata req, bytes calldata signature) public view returns (bool) {\n address signer =\n _hashTypedDataV4(\n keccak256(abi.encode(TYPEHASH, req.from, req.to, req.value, req.gas, req.nonce, keccak256(req.data)))\n )\n .recover(signature);\n return _nonces[req.from] == req.nonce && signer == req.from;\n }\n\n function execute(ForwardRequest calldata req, bytes calldata signature)\n public\n payable\n returns (bool, bytes memory)\n {\n require(verify(req, signature), \"MinimalForwarder: signature does not match request\");\n _nonces[req.from] = req.nonce + 1;\n\n // solhint-disable avoid-low-level-calls\n (bool success, bytes memory returndata) =\n req.to.call{gas: req.gas, value: req.value}(abi.encodePacked(req.data, req.from));\n // Validate that the relayer has sent enough gas for the call.\n // See https://ronan.eth.link/blog/ethereum-gas-dangers/\n assert(gasleft() > req.gas / 63);\n emit TXResult(success, returndata);\n // solhint-enable avoid-low-level-calls\n return (success, returndata);\n }\n}\n" + }, + "src/solc_0.8/Utils/Batch.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\npragma experimental ABIEncoderV2;\n\nimport \"@openzeppelin/contracts-0.8/utils/Address.sol\";\n\ncontract Batch {\n using Address for address;\n\n struct Execution {\n address target;\n bytes callData;\n }\n\n struct ExecutionWithETH {\n address target;\n bytes callData;\n uint256 value;\n }\n\n struct SingleTargetExecutionWithETH {\n bytes callData;\n uint256 value;\n }\n\n address public immutable executor;\n\n constructor(address _executor) {\n executor = _executor;\n }\n\n modifier onlyExecutor() {\n require(msg.sender == executor, \"NOT_AUTHORIZED\");\n _;\n }\n\n function atomicBatchWithETH(ExecutionWithETH[] calldata executions) external payable onlyExecutor {\n for (uint256 i = 0; i < executions.length; i++) {\n executions[i].target.functionCallWithValue(executions[i].callData, executions[i].value);\n }\n }\n\n function nonAtomicBatchWithETH(ExecutionWithETH[] calldata executions) external payable onlyExecutor {\n for (uint256 i = 0; i < executions.length; i++) {\n _call(executions[i].target, executions[i].callData, executions[i].value);\n }\n }\n\n function atomicBatch(Execution[] calldata executions) external onlyExecutor {\n for (uint256 i = 0; i < executions.length; i++) {\n executions[i].target.functionCall(executions[i].callData);\n }\n }\n\n function nonAtomicBatch(Execution[] calldata executions) external onlyExecutor {\n for (uint256 i = 0; i < executions.length; i++) {\n _call(executions[i].target, executions[i].callData, 0);\n }\n }\n\n function singleTargetAtomicBatchWithETH(address target, SingleTargetExecutionWithETH[] calldata executions)\n external\n payable\n onlyExecutor\n {\n for (uint256 i = 0; i < executions.length; i++) {\n target.functionCallWithValue(executions[i].callData, executions[i].value);\n }\n }\n\n function singleTargetNonAtomicBatchWithETH(address target, SingleTargetExecutionWithETH[] calldata executions)\n external\n payable\n onlyExecutor\n {\n for (uint256 i = 0; i < executions.length; i++) {\n _call(target, executions[i].callData, executions[i].value);\n }\n }\n\n function singleTargetAtomicBatch(address target, bytes[] calldata callDatas) external onlyExecutor {\n for (uint256 i = 0; i < callDatas.length; i++) {\n target.functionCall(callDatas[i]);\n }\n }\n\n function singleTargetNonAtomicBatch(address target, bytes[] calldata callDatas) external onlyExecutor {\n for (uint256 i = 0; i < callDatas.length; i++) {\n _call(target, callDatas[i], 0);\n }\n }\n\n function _call(\n address target,\n bytes calldata data,\n uint256 value\n ) internal returns (bool) {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, ) = target.call{value: value}(data);\n return success;\n }\n\n // ----------------------------------------------------------------------------------------------------\n // TOKEN RECEPTION\n // ----------------------------------------------------------------------------------------------------\n\n // ERC1155\n bytes4 private constant ERC1155_IS_RECEIVER = 0x4e2312e0;\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n\n // ERC721\n\n bytes4 private constant ERC721_IS_RECEIVER = 0x150b7a02;\n bytes4 private constant ERC721_RECEIVED = 0x150b7a02;\n\n function onERC721Received(\n address,\n address,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC721_RECEIVED;\n }\n\n // ERC165\n function supportsInterface(bytes4 _interfaceId) external pure returns (bool) {\n return _interfaceId == 0x01ffc9a7 || _interfaceId == ERC1155_IS_RECEIVER || _interfaceId == ERC721_IS_RECEIVER;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 2000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/core/documentation/audits/Audit Report - LAND & LAND Tunnel [26.05.2023].pdf b/packages/core/documentation/audits/Audit Report - LAND & LAND Tunnel [26.05.2023].pdf new file mode 100644 index 0000000000..a19a513875 Binary files /dev/null and b/packages/core/documentation/audits/Audit Report - LAND & LAND Tunnel [26.05.2023].pdf differ diff --git a/packages/core/hardhat.config.ts b/packages/core/hardhat.config.ts index aadacb4fbe..743488be4d 100644 --- a/packages/core/hardhat.config.ts +++ b/packages/core/hardhat.config.ts @@ -120,7 +120,7 @@ const config: HardhatUserConfig = { sandAdmin: { default: 2, - mainnet: '0xeaa0993e1d21c2103e4f172a20d29371fbaf6d06', + mainnet: '0x6ec4090d0F3cB76d9f3D8c4D5BB058A225E560a1', polygon: '0xfD30a48Bc6c56E24B0ebF1B0117d750e2CFf7531', goerli: '0x39D01ecc951C2c1f20ba0549e62212659c4d1e06', goerli_test: '0x39D01ecc951C2c1f20ba0549e62212659c4d1e06', @@ -169,7 +169,7 @@ const config: HardhatUserConfig = { sandSaleBeneficiary: { default: 3, mainnet: '0x0EB04462D69B1D267d269377E34f60b9De1c8510', - polygon: '0xbc4fE9A8a46442eDaF13Bd5c615D7CFe0953885B', // TODO: get sand admin multi sig contract + polygon: '0x1b47567CBE36e63293A7A2018F79687f942aB24C', // same as treasury goerli: '0xF22455c7F2a81E197AecD951F588a9B650f5b282', goerli_test: '0xF22455c7F2a81E197AecD951F588a9B650f5b282', mumbai: '0xa5Eb9C9Eb4F4c35B9Be8cFaAA7909F9ebe6Cb609', @@ -201,8 +201,8 @@ const config: HardhatUserConfig = { landAdmin: { default: 2, - mainnet: '0xeaa0993e1d21c2103e4f172a20d29371fbaf6d06', - polygon: '0xe75Ce341C98400a45F579e32C95fF49681Fc93fa', // TODO: get sand admin multi sig contract + mainnet: '0x6ec4090d0F3cB76d9f3D8c4D5BB058A225E560a1', + polygon: '0xfD30a48Bc6c56E24B0ebF1B0117d750e2CFf7531', goerli: '0x39D01ecc951C2c1f20ba0549e62212659c4d1e06', goerli_test: '0x39D01ecc951C2c1f20ba0549e62212659c4d1e06', mumbai: '0x49c4D4C94829B9c44052C5f5Cb164Fc612181165', @@ -213,8 +213,8 @@ const config: HardhatUserConfig = { assetAttributesRegistryAdmin: 'sandAdmin', proxyAdminOwner: { default: 2, - mainnet: '0xeaa0993e1d21c2103e4f172a20d29371fbaf6d06', - polygon: '0xe75Ce341C98400a45F579e32C95fF49681Fc93fa', // TODO: get sand admin multi sig contract + mainnet: '0x6ec4090d0F3cB76d9f3D8c4D5BB058A225E560a1', + polygon: '0xfD30a48Bc6c56E24B0ebF1B0117d750e2CFf7531', goerli: '0x39D01ecc951C2c1f20ba0549e62212659c4d1e06', goerli_test: '0x39D01ecc951C2c1f20ba0549e62212659c4d1e06', mumbai: '0x49c4D4C94829B9c44052C5f5Cb164Fc612181165', diff --git a/packages/core/package.json b/packages/core/package.json index 1732bae9d2..f5daa3b34f 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -59,7 +59,7 @@ "fx-portal": "^1.0.3", "googleapis": "^66.0.0", "graphql": "^15.4.0", - "hardhat": "^2.12.5", + "hardhat": "~2.15.0", "hardhat-contract-sizer": "^2.0.3", "hardhat-deploy": "^0.10.5", "hardhat-gas-reporter": "^1.0.4", @@ -74,7 +74,7 @@ "readline": "^1.3.0", "solhint": "^3.3.4", "solhint-plugin-prettier": "^0.0.5", - "solidity-coverage": "^0.8.3", + "solidity-coverage": "0.8.2", "ts-node": "^10.9.1", "typescript": "^4.0.5" }, diff --git a/packages/core/test/Game/testERC721.test.js b/packages/core/test/Game/testERC721.test.js index 20c2b2a1fe..1e651cf3f8 100644 --- a/packages/core/test/Game/testERC721.test.js +++ b/packages/core/test/Game/testERC721.test.js @@ -96,7 +96,7 @@ const erc721Tests = require('../erc721')( const tx = await assetAsAdmin[ 'mint(address,uint40,bytes32,uint256,address,bytes)' ](to, packId, dummyHash, 100, to, '0x'); - const receipt = tx.wait(); + const receipt = await tx.wait(); const event = await expectEventWithArgsFromReceipt( assetContract1155, receipt, diff --git a/packages/dependency-metatx/contracts/test/MockTrustedForwarder.sol b/packages/dependency-metatx/contracts/test/MockTrustedForwarder.sol index 231bc79ae5..0367b1bc49 100644 --- a/packages/dependency-metatx/contracts/test/MockTrustedForwarder.sol +++ b/packages/dependency-metatx/contracts/test/MockTrustedForwarder.sol @@ -16,6 +16,7 @@ contract MockTrustedForwarder { abi.encodePacked(req.data, req.from) ); assert(gasleft() > req.gasLimit / 63); + require(success, "Call execution failed"); return (success, returndata); } } diff --git a/packages/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol b/packages/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol index 41d8dec0a9..f1e93ef679 100644 --- a/packages/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol +++ b/packages/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol @@ -3,11 +3,12 @@ pragma solidity ^0.8.0; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {IOperatorFilterRegistry} from "./interfaces/IOperatorFilterRegistry.sol"; +import {ContextUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"; ///@title OperatorFiltererUpgradeable ///@author The SandBox ///@notice This contract would subscibe or copy or just to the subscription provided or just register to default subscription list. The operator filter registry's addess could be set using a setter which could be implemented in inherting contract -abstract contract OperatorFiltererUpgradeable is Initializable { +abstract contract OperatorFiltererUpgradeable is Initializable, ContextUpgradeable { IOperatorFilterRegistry public operatorFilterRegistry; function __OperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe) internal onlyInitializing { @@ -40,11 +41,11 @@ abstract contract OperatorFiltererUpgradeable is Initializable { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred // from an EOA. - if (from == msg.sender) { + if (from == _msgSender()) { _; return; } - if (!operatorFilterRegistry.isOperatorAllowed(address(this), msg.sender)) { + if (!operatorFilterRegistry.isOperatorAllowed(address(this), _msgSender())) { revert("Operator Not Allowed"); } } diff --git a/packages/dependency-operator-filter/contracts/mock/MockTrustedForwarder.sol b/packages/dependency-operator-filter/contracts/mock/MockTrustedForwarder.sol new file mode 100644 index 0000000000..7048aa7bac --- /dev/null +++ b/packages/dependency-operator-filter/contracts/mock/MockTrustedForwarder.sol @@ -0,0 +1,4 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {MockTrustedForwarder} from "@sandbox-smart-contracts/dependency-metatx/contracts/test/MockTrustedForwarder.sol"; diff --git a/packages/dependency-operator-filter/contracts/mock/TestERC1155.sol b/packages/dependency-operator-filter/contracts/mock/TestERC1155.sol index 5237da2dfe..78c952a896 100644 --- a/packages/dependency-operator-filter/contracts/mock/TestERC1155.sol +++ b/packages/dependency-operator-filter/contracts/mock/TestERC1155.sol @@ -1,13 +1,21 @@ //SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {ERC1155Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol"; +import { + ERC1155Upgradeable, + ContextUpgradeable +} from "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; +import { + ERC2771HandlerUpgradeable +} from "@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol"; import {OperatorFiltererUpgradeable} from "../OperatorFiltererUpgradeable.sol"; + import {IOperatorFilterRegistry} from "../interfaces/IOperatorFilterRegistry.sol"; -contract TestERC1155 is ERC1155Upgradeable, OperatorFiltererUpgradeable { - function initialize(string memory uri_) external initializer() { +contract TestERC1155 is ERC1155Upgradeable, OperatorFiltererUpgradeable, ERC2771HandlerUpgradeable { + function initialize(string memory uri_, address trustedForwarder) external initializer() { __ERC1155_init(uri_); + __ERC2771Handler_init(trustedForwarder); } /// @notice sets registry and subscribe to subscription @@ -30,7 +38,7 @@ contract TestERC1155 is ERC1155Upgradeable, OperatorFiltererUpgradeable { _mint(to, id, amount, ""); } - /// @notice set approval for asset transfer without filtering + /// @notice set approval for token transfer without filtering /// @param operator operator to be approved /// @param approved bool value for giving (true) and canceling (false) approval function setApprovalForAllWithoutFilter(address operator, bool approved) public virtual { @@ -85,4 +93,24 @@ contract TestERC1155 is ERC1155Upgradeable, OperatorFiltererUpgradeable { ) public virtual override onlyAllowedOperator(from) { super.safeTransferFrom(from, to, id, amount, data); } + + function _msgSender() + internal + view + virtual + override(ContextUpgradeable, ERC2771HandlerUpgradeable) + returns (address sender) + { + return ERC2771HandlerUpgradeable._msgSender(); + } + + function _msgData() + internal + view + virtual + override(ContextUpgradeable, ERC2771HandlerUpgradeable) + returns (bytes calldata) + { + return ERC2771HandlerUpgradeable._msgData(); + } } diff --git a/packages/dependency-operator-filter/contracts/mock/TestERC721.sol b/packages/dependency-operator-filter/contracts/mock/TestERC721.sol index 6a6c53d03f..ed48f614af 100644 --- a/packages/dependency-operator-filter/contracts/mock/TestERC721.sol +++ b/packages/dependency-operator-filter/contracts/mock/TestERC721.sol @@ -1,12 +1,23 @@ //SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; +import { + ERC721Upgradeable, + ContextUpgradeable +} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import {OperatorFiltererUpgradeable} from "../OperatorFiltererUpgradeable.sol"; +import { + ERC2771HandlerUpgradeable +} from "@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol"; import {IOperatorFilterRegistry} from "../interfaces/IOperatorFilterRegistry.sol"; -contract TestERC721 is ERC721Upgradeable, OperatorFiltererUpgradeable { - function initialize(string memory name_, string memory symbol_) external initializer() { +contract TestERC721 is ERC721Upgradeable, OperatorFiltererUpgradeable, ERC2771HandlerUpgradeable { + function initialize( + string memory name_, + string memory symbol_, + address trustedForwarder + ) external initializer() { __ERC721_init(name_, symbol_); + __ERC2771Handler_init(trustedForwarder); } /// @notice sets registry and subscribe to subscription @@ -58,4 +69,24 @@ contract TestERC721 is ERC721Upgradeable, OperatorFiltererUpgradeable { ) public virtual override onlyAllowedOperator(from) { super.safeTransferFrom(from, to, id); } + + function _msgSender() + internal + view + virtual + override(ContextUpgradeable, ERC2771HandlerUpgradeable) + returns (address sender) + { + return ERC2771HandlerUpgradeable._msgSender(); + } + + function _msgData() + internal + view + virtual + override(ContextUpgradeable, ERC2771HandlerUpgradeable) + returns (bytes calldata) + { + return ERC2771HandlerUpgradeable._msgData(); + } } diff --git a/packages/dependency-operator-filter/contracts/mock/UnregisteredToken.sol b/packages/dependency-operator-filter/contracts/mock/UnregisteredToken.sol index 32899cc825..7f0e4e7c42 100644 --- a/packages/dependency-operator-filter/contracts/mock/UnregisteredToken.sol +++ b/packages/dependency-operator-filter/contracts/mock/UnregisteredToken.sol @@ -1,18 +1,26 @@ //SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {ERC1155Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol"; +import { + ERC1155Upgradeable, + ContextUpgradeable +} from "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {OperatorFiltererUpgradeable} from "../OperatorFiltererUpgradeable.sol"; +import { + ERC2771HandlerUpgradeable +} from "@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol"; import {IOperatorFilterRegistry} from "../interfaces/IOperatorFilterRegistry.sol"; -contract UnregisteredToken is ERC1155Upgradeable, OperatorFiltererUpgradeable { +contract UnregisteredToken is ERC1155Upgradeable, OperatorFiltererUpgradeable, ERC2771HandlerUpgradeable { function initialize( string memory uri_, address subscription, - bool subscribe + bool subscribe, + address trustedForwarder ) external initializer() { __ERC1155_init(uri_); __OperatorFilterer_init(subscription, subscribe); + __ERC2771Handler_init(trustedForwarder); } /// @notice sets registry @@ -103,4 +111,24 @@ contract UnregisteredToken is ERC1155Upgradeable, OperatorFiltererUpgradeable { ) public virtual override onlyAllowedOperator(from) { super.safeTransferFrom(from, to, id, amount, data); } + + function _msgSender() + internal + view + virtual + override(ContextUpgradeable, ERC2771HandlerUpgradeable) + returns (address sender) + { + return ERC2771HandlerUpgradeable._msgSender(); + } + + function _msgData() + internal + view + virtual + override(ContextUpgradeable, ERC2771HandlerUpgradeable) + returns (bytes calldata) + { + return ERC2771HandlerUpgradeable._msgData(); + } } diff --git a/packages/dependency-operator-filter/docs.example b/packages/dependency-operator-filter/docs.example deleted file mode 100644 index e2d52c7138..0000000000 --- a/packages/dependency-operator-filter/docs.example +++ /dev/null @@ -1,21 +0,0 @@ -Audience - -The intended audience for .md documentation is auditors, internal developers and external developer contributors. - -Features - -Include a summary of the PURPOSE of the smart contract, ensuring to describe any COMMERCIAL INTENT -List any ASSUMPTIONS that have been made about how the smart contract will be used -Who are the INTENDED USERS of the smart contract -What are the privileged / admin ROLES -What are the FEATURES of the smart contract - -Methods - -Describe as a minimum all the external and public methods used in the smart contract and their parameters -Be sure to describe the intended usage of the methods and any limitations - -Links - -Include link(s) here to test files that help to demonstrate the intended usage of the smart contract functions -Include link(s) here to image files that show the smart contract transaction flow diff --git a/packages/dependency-operator-filter/package.json b/packages/dependency-operator-filter/package.json index f69d4975c2..7f93fa82b2 100644 --- a/packages/dependency-operator-filter/package.json +++ b/packages/dependency-operator-filter/package.json @@ -33,6 +33,7 @@ "@openzeppelin/contracts": "^4.9.0", "@openzeppelin/contracts-upgradeable": "^4.9.0", "@openzeppelin/hardhat-upgrades": "^1.28.0", + "@sandbox-smart-contracts/dependency-metatx": "*", "@typechain/ethers-v5": "^10.2.1", "@typechain/hardhat": "^6.1.6", "@types/chai": "^4.3.5", diff --git a/packages/dependency-operator-filter/test/fixtures/testFixture.ts b/packages/dependency-operator-filter/test/fixtures/testFixture.ts index 0cd050c771..eb9e53a5c5 100644 --- a/packages/dependency-operator-filter/test/fixtures/testFixture.ts +++ b/packages/dependency-operator-filter/test/fixtures/testFixture.ts @@ -12,6 +12,10 @@ export async function setupOperatorFilter() { user3, user4, ] = await ethers.getSigners(); + const TrustedForwarderFactory = await ethers.getContractFactory( + 'MockTrustedForwarder' + ); + const TrustedForwarder = await TrustedForwarderFactory.deploy(); const MockERC1155MarketPlace1Factory = await ethers.getContractFactory( 'MockERC1155MarketPlace1' @@ -60,9 +64,13 @@ export async function setupOperatorFilter() { await tnx.wait(); const ERC1155Factory = await ethers.getContractFactory('TestERC1155'); - const ERC1155 = await upgrades.deployProxy(ERC1155Factory, ['testERC1155'], { - initializer: 'initialize', - }); + const ERC1155 = await upgrades.deployProxy( + ERC1155Factory, + ['testERC1155', TrustedForwarder.address], + { + initializer: 'initialize', + } + ); let MockOperatorFilterSubscriptionFactory = await ethers.getContractFactory( 'MockOperatorFilterSubscription' @@ -84,7 +92,7 @@ export async function setupOperatorFilter() { const ERC721Factory = await ethers.getContractFactory('TestERC721'); const ERC721 = await upgrades.deployProxy( ERC721Factory, - ['test', 'testERC721'], + ['test', 'testERC721', TrustedForwarder.address], { initializer: 'initialize', } @@ -107,7 +115,12 @@ export async function setupOperatorFilter() { ); const UnregisteredToken = await upgrades.deployProxy( UnregisteredTokenFactory, - ['UnregisteredToken', operatorFilterSubscription.address, true], + [ + 'UnregisteredToken', + operatorFilterSubscription.address, + true, + TrustedForwarder.address, + ], { initializer: 'initialize', } diff --git a/packages/dependency-royalty-management/contracts/mock/SingleReceiver.sol b/packages/dependency-royalty-management/contracts/mock/SingleReceiver.sol index 151a71e5fb..bcfc5f1803 100644 --- a/packages/dependency-royalty-management/contracts/mock/SingleReceiver.sol +++ b/packages/dependency-royalty-management/contracts/mock/SingleReceiver.sol @@ -1,15 +1,22 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {ERC1155Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol"; +import { + ERC1155Upgradeable, + ContextUpgradeable +} from "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol"; import {RoyaltyDistributor} from "../RoyaltyDistributor.sol"; +import { + ERC2771HandlerUpgradeable +} from "@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol"; -contract SingleReceiver is ERC1155Upgradeable, RoyaltyDistributor { +contract SingleReceiver is ERC1155Upgradeable, RoyaltyDistributor, ERC2771HandlerUpgradeable { /// @notice initiliaze to be called by the proxy /// @dev would run once. /// @param _manager, the address of the Manager contract for common royalty recipient - function initialize(address _manager) external initializer { + function initialize(address _manager, address trustedForwarder) external initializer { __RoyaltyDistributor_init(_manager); + __ERC2771Handler_init(trustedForwarder); } function supportsInterface(bytes4 interfaceId) @@ -21,4 +28,24 @@ contract SingleReceiver is ERC1155Upgradeable, RoyaltyDistributor { { return ERC1155Upgradeable.supportsInterface(interfaceId) || RoyaltyDistributor.supportsInterface(interfaceId); } + + function _msgSender() + internal + view + virtual + override(ContextUpgradeable, ERC2771HandlerUpgradeable) + returns (address sender) + { + return ERC2771HandlerUpgradeable._msgSender(); + } + + function _msgData() + internal + view + virtual + override(ContextUpgradeable, ERC2771HandlerUpgradeable) + returns (bytes calldata) + { + return ERC2771HandlerUpgradeable._msgData(); + } } diff --git a/packages/dependency-royalty-management/contracts/mock/TestERC1155.sol b/packages/dependency-royalty-management/contracts/mock/TestERC1155.sol index e432b272a3..d987fb2f29 100644 --- a/packages/dependency-royalty-management/contracts/mock/TestERC1155.sol +++ b/packages/dependency-royalty-management/contracts/mock/TestERC1155.sol @@ -1,20 +1,27 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {ERC1155Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol"; +import { + ERC1155Upgradeable, + ContextUpgradeable +} from "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol"; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {MultiRoyaltyDistributor} from "../MultiRoyaltyDistributor.sol"; +import { + ERC2771HandlerUpgradeable +} from "@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol"; /// @title Test ERC1155 contract /// @dev Made to test splitter deployment for each creator /// Creator could change his royalty receiving Wallet for his splitter through setRoyaltyRecipient function -contract TestERC1155 is ERC1155Upgradeable, OwnableUpgradeable, MultiRoyaltyDistributor { +contract TestERC1155 is ERC1155Upgradeable, OwnableUpgradeable, MultiRoyaltyDistributor, ERC2771HandlerUpgradeable { /// @notice initiliaze to be called by the proxy /// @dev would run once. /// @param _manager, the address of the Manager contract for common royalty recipient - function initialize(address _manager) external initializer { + function initialize(address _manager, address trustedForwarder) external initializer { __MultiRoyaltyDistributor_init(_manager); __Ownable_init(); + __ERC2771Handler_init(trustedForwarder); } /// @notice function to mint a single ERC1155 token @@ -78,4 +85,24 @@ contract TestERC1155 is ERC1155Upgradeable, OwnableUpgradeable, MultiRoyaltyDist ) external override onlyOwner { _setTokenRoyalties(tokenId, recipient, creator); } + + function _msgSender() + internal + view + virtual + override(ContextUpgradeable, ERC2771HandlerUpgradeable) + returns (address sender) + { + return ERC2771HandlerUpgradeable._msgSender(); + } + + function _msgData() + internal + view + virtual + override(ContextUpgradeable, ERC2771HandlerUpgradeable) + returns (bytes calldata) + { + return ERC2771HandlerUpgradeable._msgData(); + } } diff --git a/packages/dependency-royalty-management/contracts/mock/TestERC721.sol b/packages/dependency-royalty-management/contracts/mock/TestERC721.sol index 68f6854739..817b944ca8 100644 --- a/packages/dependency-royalty-management/contracts/mock/TestERC721.sol +++ b/packages/dependency-royalty-management/contracts/mock/TestERC721.sol @@ -1,17 +1,24 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; +import { + ERC721Upgradeable, + ContextUpgradeable +} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {MultiRoyaltyDistributor} from "../MultiRoyaltyDistributor.sol"; +import { + ERC2771HandlerUpgradeable +} from "@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol"; -contract TestERC721 is ERC721Upgradeable, OwnableUpgradeable, MultiRoyaltyDistributor { +contract TestERC721 is ERC721Upgradeable, OwnableUpgradeable, MultiRoyaltyDistributor, ERC2771HandlerUpgradeable { /// @notice initiliaze to be called by the proxy /// @dev would run once. /// @param _manager, the address of the Manager contract for common royalty recipient - function initialize(address _manager) external initializer { + function initialize(address _manager, address trustedForwarder) external initializer { __MultiRoyaltyDistributor_init(_manager); __Ownable_init(); + __ERC2771Handler_init(trustedForwarder); } /// @notice function to mint a single ERC721 token @@ -67,4 +74,24 @@ contract TestERC721 is ERC721Upgradeable, OwnableUpgradeable, MultiRoyaltyDistri ) external override onlyOwner { _setTokenRoyalties(tokenId, recipient, creator); } + + function _msgSender() + internal + view + virtual + override(ContextUpgradeable, ERC2771HandlerUpgradeable) + returns (address sender) + { + return ERC2771HandlerUpgradeable._msgSender(); + } + + function _msgData() + internal + view + virtual + override(ContextUpgradeable, ERC2771HandlerUpgradeable) + returns (bytes calldata) + { + return ERC2771HandlerUpgradeable._msgData(); + } } diff --git a/packages/dependency-royalty-management/docs.example b/packages/dependency-royalty-management/docs.example deleted file mode 100644 index e2d52c7138..0000000000 --- a/packages/dependency-royalty-management/docs.example +++ /dev/null @@ -1,21 +0,0 @@ -Audience - -The intended audience for .md documentation is auditors, internal developers and external developer contributors. - -Features - -Include a summary of the PURPOSE of the smart contract, ensuring to describe any COMMERCIAL INTENT -List any ASSUMPTIONS that have been made about how the smart contract will be used -Who are the INTENDED USERS of the smart contract -What are the privileged / admin ROLES -What are the FEATURES of the smart contract - -Methods - -Describe as a minimum all the external and public methods used in the smart contract and their parameters -Be sure to describe the intended usage of the methods and any limitations - -Links - -Include link(s) here to test files that help to demonstrate the intended usage of the smart contract functions -Include link(s) here to image files that show the smart contract transaction flow diff --git a/packages/dependency-royalty-management/test/fixture.ts b/packages/dependency-royalty-management/test/fixture.ts index a9b19c9e61..fd41948413 100644 --- a/packages/dependency-royalty-management/test/fixture.ts +++ b/packages/dependency-royalty-management/test/fixture.ts @@ -13,6 +13,7 @@ export async function royaltyDistribution() { managerAdmin, contractRoyaltySetter, ] = await ethers.getSigners(); + const TrustedForwarderFactory = await ethers.getContractFactory( 'MockTrustedForwarder' ); @@ -48,7 +49,7 @@ export async function royaltyDistribution() { const TestERC1155Factory = await ethers.getContractFactory('TestERC1155'); const ERC1155 = await upgrades.deployProxy( TestERC1155Factory, - [RoyaltyManagerContract.address], + [RoyaltyManagerContract.address, TrustedForwarder.address], { initializer: 'initialize', } @@ -59,7 +60,7 @@ export async function royaltyDistribution() { const TestERC721Factory = await ethers.getContractFactory('TestERC721'); const ERC721 = await upgrades.deployProxy( TestERC721Factory, - [RoyaltyManagerContract.address], + [RoyaltyManagerContract.address, TrustedForwarder.address], { initializer: 'initialize', } @@ -70,7 +71,7 @@ export async function royaltyDistribution() { ); const SingleReceiver = await upgrades.deployProxy( SingleReceiverFactory, - [RoyaltyManagerContract.address], + [RoyaltyManagerContract.address, TrustedForwarder.address], { initializer: 'initialize', } diff --git a/packages/deploy/deploy/300_catalyst/302_catalyst_setup.ts b/packages/deploy/deploy/300_catalyst/302_catalyst_setup.ts index a97f7b8443..07111e5c52 100644 --- a/packages/deploy/deploy/300_catalyst/302_catalyst_setup.ts +++ b/packages/deploy/deploy/300_catalyst/302_catalyst_setup.ts @@ -35,16 +35,25 @@ const func: DeployFunction = async function ( const catalyst = await deployments.get('Catalyst'); // TODO this should not be hardcoded here const royaltyAmount = 500; - await catchUnknownSigner( - execute( + if ( + (await read( 'RoyaltyManager', - {from: contractRoyaltySetter, log: true}, - 'setContractRoyalty', - catalyst.address, - royaltyAmount - ) - ); - log(`Catalyst set on RoyaltyManager with ${royaltyAmount} BPS royalty`); + {from: contractRoyaltySetter}, + 'contractRoyalty', + catalyst.address + )) === 0 + ) { + await catchUnknownSigner( + execute( + 'RoyaltyManager', + {from: contractRoyaltySetter, log: true}, + 'setContractRoyalty', + catalyst.address, + royaltyAmount + ) + ); + log(`Catalyst set on RoyaltyManager with ${royaltyAmount} BPS royalty`); + } }; export default func; diff --git a/packages/deploy/deployments/mumbai/Asset.json b/packages/deploy/deployments/mumbai/Asset.json index bd6199fb64..2546f06979 100644 --- a/packages/deploy/deployments/mumbai/Asset.json +++ b/packages/deploy/deployments/mumbai/Asset.json @@ -1,5 +1,5 @@ { - "address": "0xb0fb55e91B58D8db07aaBFF2D6b5A8e2e1bf8D08", + "address": "0x7AF8c95334240026385f7309D9a8b9e4265FC70a", "abi": [ { "anonymous": false, @@ -401,6 +401,31 @@ "name": "TrustedForwarderChanged", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldTrustedForwarder", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newTrustedForwarder", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -856,7 +881,7 @@ "outputs": [ { "internalType": "address", - "name": "trustedForwarder", + "name": "", "type": "address" } ], @@ -1446,35 +1471,50 @@ "type": "constructor" } ], - "transactionHash": "0x507fee0473cc4acfcc0a333288dc0e916acb84262c028cbac7985b0f005ba4b4", + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0xb0fb55e91B58D8db07aaBFF2D6b5A8e2e1bf8D08", - "transactionIndex": 3, - "gasUsed": "924746", - "logsBloom": "0x00000004000000000800000000000010400000010800000000000210100000000002000000008420000000000000000000009000000000000000000000040000000080000000000000000000000002800000000000040000000100000200000008000000020000000000020000000800000000800000000080000000000000000000000000000000000000000000000000000000000080000000020000a04000200000000000000000000000000400000000000000000000001000000400004000000020004000000001000000040200000000000400000100108000001060004000080000000000000000200000000000000000000000000000000000100000", - "blockHash": "0x0a08ddcc9a97f0b7b5f47b6a51628ae7616103ca6f0e9a51f56348b947a4e955", - "transactionHash": "0x507fee0473cc4acfcc0a333288dc0e916acb84262c028cbac7985b0f005ba4b4", + "contractAddress": "0x7AF8c95334240026385f7309D9a8b9e4265FC70a", + "transactionIndex": 16, + "gasUsed": "927601", + "logsBloom": "0x00000004000000000000000000000000400000000800000000000090100800000002000000008420000000000001000000008000000000000000000000040000000080000000000000000000000002800000000000040000000100000000000008000000020000000000020000000800000000800000000080000000000000000200010040000000000000000000000000000800000080000000000000a00000200000000000080000000010000400000000000000000000001000000400004000000020004000000001000000040200000000000400000100108000001060002000080000008000000010240000000004000000000000000000000004100000", + "blockHash": "0x0a1b8afc8f933cb975e4ef5559ea6a8d1e79faf00206505c1fcd974fa252f736", + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", "logs": [ { - "transactionIndex": 3, - "blockNumber": 38596210, - "transactionHash": "0x507fee0473cc4acfcc0a333288dc0e916acb84262c028cbac7985b0f005ba4b4", - "address": "0xb0fb55e91B58D8db07aaBFF2D6b5A8e2e1bf8D08", + "transactionIndex": 16, + "blockNumber": 38730662, + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", + "address": "0x7AF8c95334240026385f7309D9a8b9e4265FC70a", "topics": [ "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", - "0x00000000000000000000000080160a8f1a98cb387ae8e46e8c10931eef07a490" + "0x0000000000000000000000008d4490da283630df4229e76ea7ea99401736bd80" + ], + "data": "0x", + "logIndex": 58, + "blockHash": "0x0a1b8afc8f933cb975e4ef5559ea6a8d1e79faf00206505c1fcd974fa252f736" + }, + { + "transactionIndex": 16, + "blockNumber": 38730662, + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", + "address": "0x7AF8c95334240026385f7309D9a8b9e4265FC70a", + "topics": [ + "0x8ca022029d8ff7ad974913f8970aeed6c5e0e7eaf494a0c5b262249f6b5759e5", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f7", + "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 7, - "blockHash": "0x0a08ddcc9a97f0b7b5f47b6a51628ae7616103ca6f0e9a51f56348b947a4e955" + "logIndex": 59, + "blockHash": "0x0a1b8afc8f933cb975e4ef5559ea6a8d1e79faf00206505c1fcd974fa252f736" }, { - "transactionIndex": 3, - "blockNumber": 38596210, - "transactionHash": "0x507fee0473cc4acfcc0a333288dc0e916acb84262c028cbac7985b0f005ba4b4", - "address": "0xb0fb55e91B58D8db07aaBFF2D6b5A8e2e1bf8D08", + "transactionIndex": 16, + "blockNumber": 38730662, + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", + "address": "0x7AF8c95334240026385f7309D9a8b9e4265FC70a", "topics": [ "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "0x0000000000000000000000000000000000000000000000000000000000000000", @@ -1482,66 +1522,66 @@ "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 8, - "blockHash": "0x0a08ddcc9a97f0b7b5f47b6a51628ae7616103ca6f0e9a51f56348b947a4e955" + "logIndex": 60, + "blockHash": "0x0a1b8afc8f933cb975e4ef5559ea6a8d1e79faf00206505c1fcd974fa252f736" }, { - "transactionIndex": 3, - "blockNumber": 38596210, - "transactionHash": "0x507fee0473cc4acfcc0a333288dc0e916acb84262c028cbac7985b0f005ba4b4", + "transactionIndex": 16, + "blockNumber": 38730662, + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", "address": "0x000000000000AAeB6D7670E522A718067333cd4E", "topics": [ "0x86d03f430c7616021073d7a71766f632f1ce19f289aa989534d9f4732253eb59", - "0x000000000000000000000000b0fb55e91b58d8db07aabff2d6b5a8e2e1bf8d08", + "0x0000000000000000000000007af8c95334240026385f7309d9a8b9e4265fc70a", "0x0000000000000000000000000000000000000000000000000000000000000001" ], "data": "0x", - "logIndex": 9, - "blockHash": "0x0a08ddcc9a97f0b7b5f47b6a51628ae7616103ca6f0e9a51f56348b947a4e955" + "logIndex": 61, + "blockHash": "0x0a1b8afc8f933cb975e4ef5559ea6a8d1e79faf00206505c1fcd974fa252f736" }, { - "transactionIndex": 3, - "blockNumber": 38596210, - "transactionHash": "0x507fee0473cc4acfcc0a333288dc0e916acb84262c028cbac7985b0f005ba4b4", + "transactionIndex": 16, + "blockNumber": 38730662, + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", "address": "0x000000000000AAeB6D7670E522A718067333cd4E", "topics": [ "0x0038c54977604f1a5c0a3604cbbecd0153c81e3131799ead95755e8bb5d5b9e8", - "0x000000000000000000000000b0fb55e91b58d8db07aabff2d6b5a8e2e1bf8d08", + "0x0000000000000000000000007af8c95334240026385f7309d9a8b9e4265fc70a", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", "0x0000000000000000000000000000000000000000000000000000000000000001" ], "data": "0x", - "logIndex": 10, - "blockHash": "0x0a08ddcc9a97f0b7b5f47b6a51628ae7616103ca6f0e9a51f56348b947a4e955" + "logIndex": 62, + "blockHash": "0x0a1b8afc8f933cb975e4ef5559ea6a8d1e79faf00206505c1fcd974fa252f736" }, { - "transactionIndex": 3, - "blockNumber": 38596210, - "transactionHash": "0x507fee0473cc4acfcc0a333288dc0e916acb84262c028cbac7985b0f005ba4b4", - "address": "0xb0fb55e91B58D8db07aaBFF2D6b5A8e2e1bf8D08", + "transactionIndex": 16, + "blockNumber": 38730662, + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", + "address": "0x7AF8c95334240026385f7309D9a8b9e4265FC70a", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x0000000000000000000000000000000000000000000000000000000000000001", - "logIndex": 11, - "blockHash": "0x0a08ddcc9a97f0b7b5f47b6a51628ae7616103ca6f0e9a51f56348b947a4e955" + "logIndex": 63, + "blockHash": "0x0a1b8afc8f933cb975e4ef5559ea6a8d1e79faf00206505c1fcd974fa252f736" }, { - "transactionIndex": 3, - "blockNumber": 38596210, - "transactionHash": "0x507fee0473cc4acfcc0a333288dc0e916acb84262c028cbac7985b0f005ba4b4", - "address": "0xb0fb55e91B58D8db07aaBFF2D6b5A8e2e1bf8D08", + "transactionIndex": 16, + "blockNumber": 38730662, + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", + "address": "0x7AF8c95334240026385f7309D9a8b9e4265FC70a", "topics": [ "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" ], - "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c3c6b8feee55636e949920aa90f093f6f5faf448", - "logIndex": 12, - "blockHash": "0x0a08ddcc9a97f0b7b5f47b6a51628ae7616103ca6f0e9a51f56348b947a4e955" + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c26b12025e378c570fb46249093ba387a2e927bc", + "logIndex": 64, + "blockHash": "0x0a1b8afc8f933cb975e4ef5559ea6a8d1e79faf00206505c1fcd974fa252f736" }, { - "transactionIndex": 3, - "blockNumber": 38596210, - "transactionHash": "0x507fee0473cc4acfcc0a333288dc0e916acb84262c028cbac7985b0f005ba4b4", + "transactionIndex": 16, + "blockNumber": 38730662, + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", @@ -1549,20 +1589,20 @@ "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", "0x000000000000000000000000f903ba9e006193c1527bfbe65fe2123704ea3f99" ], - "data": "0x0000000000000000000000000000000000000000000000000004ed93cf4fb24a00000000000000000000000000000000000000000000001171d2f7373e41ff5700000000000000000000000000000000000000000000103230da795517e95c9a00000000000000000000000000000000000000000000001171ce09a36ef24d0d00000000000000000000000000000000000000000000103230df66e8e7390ee4", - "logIndex": 13, - "blockHash": "0x0a08ddcc9a97f0b7b5f47b6a51628ae7616103ca6f0e9a51f56348b947a4e955" + "data": "0x0000000000000000000000000000000000000000000000000004f178e825bf0000000000000000000000000000000000000000000000001171359991322bac73000000000000000000000000000000000000000000001043e1be1652c1321c770000000000000000000000000000000000000000000000117130a8184a05ed73000000000000000000000000000000000000000000001043e1c307cba957db77", + "logIndex": 65, + "blockHash": "0x0a1b8afc8f933cb975e4ef5559ea6a8d1e79faf00206505c1fcd974fa252f736" } ], - "blockNumber": 38596210, - "cumulativeGasUsed": "1240570", + "blockNumber": 38730662, + "cumulativeGasUsed": "3784885", "status": 1, "byzantium": true }, "args": [ - "0x80160a8f1A98cb387ae8e46E8C10931EEF07a490", - "0xc3C6B8feeE55636e949920Aa90f093f6f5Faf448", - "0xac4a0fb600000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f700000000000000000000000049c4d4c94829b9c44052c5f5cb164fc61218116500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af0200000000000000000000000042017fd22fd371cb717e4895e8a45d17dcde89e60000000000000000000000000000000000000000000000000000000000000007697066733a2f2f00000000000000000000000000000000000000000000000000" + "0x8d4490Da283630df4229E76ea7EA99401736bD80", + "0xc26B12025e378c570Fb46249093Ba387A2e927bc", + "0xac4a0fb600000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f700000000000000000000000049c4d4c94829b9c44052c5f5cb164fc61218116500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af020000000000000000000000004ae9a95ec193fc1b38c246b701de49b8e3f5ef340000000000000000000000000000000000000000000000000000000000000007697066733a2f2f00000000000000000000000000000000000000000000000000" ], "numDeployments": 1, "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", @@ -1576,10 +1616,10 @@ "0x49c4D4C94829B9c44052C5f5Cb164Fc612181165", "ipfs://", "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6" + "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34" ] }, - "implementation": "0x80160a8f1A98cb387ae8e46E8C10931EEF07a490", + "implementation": "0x8d4490Da283630df4229E76ea7EA99401736bD80", "devdoc": { "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", "kind": "dev", diff --git a/packages/deploy/deployments/mumbai/AssetCreate.json b/packages/deploy/deployments/mumbai/AssetCreate.json index 205b8b066f..29899b1789 100644 --- a/packages/deploy/deployments/mumbai/AssetCreate.json +++ b/packages/deploy/deployments/mumbai/AssetCreate.json @@ -1,5 +1,5 @@ { - "address": "0x376fD92FF818C386C996e43faF07314B05874bc1", + "address": "0xc8E11c3eaE08dc17d800d84c8427E6e3E9525892", "abi": [ { "anonymous": false, @@ -360,6 +360,31 @@ "name": "TrustedForwarderChanged", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldTrustedForwarder", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newTrustedForwarder", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, { "inputs": [], "name": "DEFAULT_ADMIN_ROLE", @@ -642,7 +667,7 @@ "outputs": [ { "internalType": "address", - "name": "trustedForwarder", + "name": "", "type": "address" } ], @@ -862,35 +887,50 @@ "type": "constructor" } ], - "transactionHash": "0xcf7b5b2785afda381e69a3332e762059c6c1f7c369b5fe288acc2c34cdb6f54c", + "transactionHash": "0x89256e020ff9a95b5c6817d035f7caf0e36899cdcd0cce4fcb91210da8a5758f", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0x376fD92FF818C386C996e43faF07314B05874bc1", - "transactionIndex": 5, - "gasUsed": "892876", - "logsBloom": "0x00000004000000000000000000010000400000000000000000000010000000000002000000008420000000000000000000008000000000000000000000000000000000000000000000000000000002800000000000000000000100000000000000000000020000000000120000000800000000800000000080000000000000000000000000000000000000008000000000000000000080000000000000a00012200000000000000000000000000600000000000000000000001000000000004000000020000000000001000000040000000000000400000100108000001020000000000000000000000000000000000000000000000000000000000000100000", - "blockHash": "0xcb810e249bd6e05c2d49086299a2246621c63bf3baad263744a2f7d393b9d290", - "transactionHash": "0xcf7b5b2785afda381e69a3332e762059c6c1f7c369b5fe288acc2c34cdb6f54c", + "contractAddress": "0xc8E11c3eaE08dc17d800d84c8427E6e3E9525892", + "transactionIndex": 8, + "gasUsed": "895720", + "logsBloom": "0x00000004000000000000000000000000400800000000000000000080000000000002000000008400000000000001000000008000000000000000000000000000000000000000000000000000000002800000000000000000000100000000004000000000020000000000020000000800000000800000000080000000000000000000010040000000000000000000000000000000000080000000000000a00000208000000000000000000000000400000000000000000000001000000000004000000020000000000001000000040010000000020400000100108040000020802000000000000000000000000000000004000000000000000000000000100000", + "blockHash": "0xf49012b4445a834a8e22019bcea3b3ebf067ee97c2066f059eb2448fd20502c3", + "transactionHash": "0x89256e020ff9a95b5c6817d035f7caf0e36899cdcd0cce4fcb91210da8a5758f", "logs": [ { - "transactionIndex": 5, - "blockNumber": 38596221, - "transactionHash": "0xcf7b5b2785afda381e69a3332e762059c6c1f7c369b5fe288acc2c34cdb6f54c", - "address": "0x376fD92FF818C386C996e43faF07314B05874bc1", + "transactionIndex": 8, + "blockNumber": 38730823, + "transactionHash": "0x89256e020ff9a95b5c6817d035f7caf0e36899cdcd0cce4fcb91210da8a5758f", + "address": "0xc8E11c3eaE08dc17d800d84c8427E6e3E9525892", "topics": [ "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", - "0x000000000000000000000000ab182cfcd654a0fdd6dbb4bb9722adb5d158a2f4" + "0x0000000000000000000000009c4831b0c6bdfd76813726efd7848a247de4993e" + ], + "data": "0x", + "logIndex": 60, + "blockHash": "0xf49012b4445a834a8e22019bcea3b3ebf067ee97c2066f059eb2448fd20502c3" + }, + { + "transactionIndex": 8, + "blockNumber": 38730823, + "transactionHash": "0x89256e020ff9a95b5c6817d035f7caf0e36899cdcd0cce4fcb91210da8a5758f", + "address": "0xc8E11c3eaE08dc17d800d84c8427E6e3E9525892", + "topics": [ + "0x8ca022029d8ff7ad974913f8970aeed6c5e0e7eaf494a0c5b262249f6b5759e5", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f7", + "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 14, - "blockHash": "0xcb810e249bd6e05c2d49086299a2246621c63bf3baad263744a2f7d393b9d290" + "logIndex": 61, + "blockHash": "0xf49012b4445a834a8e22019bcea3b3ebf067ee97c2066f059eb2448fd20502c3" }, { - "transactionIndex": 5, - "blockNumber": 38596221, - "transactionHash": "0xcf7b5b2785afda381e69a3332e762059c6c1f7c369b5fe288acc2c34cdb6f54c", - "address": "0x376fD92FF818C386C996e43faF07314B05874bc1", + "transactionIndex": 8, + "blockNumber": 38730823, + "transactionHash": "0x89256e020ff9a95b5c6817d035f7caf0e36899cdcd0cce4fcb91210da8a5758f", + "address": "0xc8E11c3eaE08dc17d800d84c8427E6e3E9525892", "topics": [ "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "0x0000000000000000000000000000000000000000000000000000000000000000", @@ -898,58 +938,58 @@ "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 15, - "blockHash": "0xcb810e249bd6e05c2d49086299a2246621c63bf3baad263744a2f7d393b9d290" + "logIndex": 62, + "blockHash": "0xf49012b4445a834a8e22019bcea3b3ebf067ee97c2066f059eb2448fd20502c3" }, { - "transactionIndex": 5, - "blockNumber": 38596221, - "transactionHash": "0xcf7b5b2785afda381e69a3332e762059c6c1f7c369b5fe288acc2c34cdb6f54c", - "address": "0x376fD92FF818C386C996e43faF07314B05874bc1", + "transactionIndex": 8, + "blockNumber": 38730823, + "transactionHash": "0x89256e020ff9a95b5c6817d035f7caf0e36899cdcd0cce4fcb91210da8a5758f", + "address": "0xc8E11c3eaE08dc17d800d84c8427E6e3E9525892", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x0000000000000000000000000000000000000000000000000000000000000001", - "logIndex": 16, - "blockHash": "0xcb810e249bd6e05c2d49086299a2246621c63bf3baad263744a2f7d393b9d290" + "logIndex": 63, + "blockHash": "0xf49012b4445a834a8e22019bcea3b3ebf067ee97c2066f059eb2448fd20502c3" }, { - "transactionIndex": 5, - "blockNumber": 38596221, - "transactionHash": "0xcf7b5b2785afda381e69a3332e762059c6c1f7c369b5fe288acc2c34cdb6f54c", - "address": "0x376fD92FF818C386C996e43faF07314B05874bc1", + "transactionIndex": 8, + "blockNumber": 38730823, + "transactionHash": "0x89256e020ff9a95b5c6817d035f7caf0e36899cdcd0cce4fcb91210da8a5758f", + "address": "0xc8E11c3eaE08dc17d800d84c8427E6e3E9525892", "topics": [ "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" ], - "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c3c6b8feee55636e949920aa90f093f6f5faf448", - "logIndex": 17, - "blockHash": "0xcb810e249bd6e05c2d49086299a2246621c63bf3baad263744a2f7d393b9d290" + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c26b12025e378c570fb46249093ba387a2e927bc", + "logIndex": 64, + "blockHash": "0xf49012b4445a834a8e22019bcea3b3ebf067ee97c2066f059eb2448fd20502c3" }, { - "transactionIndex": 5, - "blockNumber": 38596221, - "transactionHash": "0xcf7b5b2785afda381e69a3332e762059c6c1f7c369b5fe288acc2c34cdb6f54c", + "transactionIndex": 8, + "blockNumber": 38730823, + "transactionHash": "0x89256e020ff9a95b5c6817d035f7caf0e36899cdcd0cce4fcb91210da8a5758f", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", - "0x000000000000000000000000f903ba9e006193c1527bfbe65fe2123704ea3f99" + "0x000000000000000000000000be188d6641e8b680743a4815dfa0f6208038960f" ], - "data": "0x0000000000000000000000000000000000000000000000000004c2195736740000000000000000000000000000000000000000000000001171c08020c0ba31ed00000000000000000000000000000000000000000000103232162979ff023f3900000000000000000000000000000000000000000000001171bbbe076983bded000000000000000000000000000000000000000000001032321aeb935638b339", - "logIndex": 18, - "blockHash": "0xcb810e249bd6e05c2d49086299a2246621c63bf3baad263744a2f7d393b9d290" + "data": "0x0000000000000000000000000000000000000000000000000004c5fa98a0980000000000000000000000000000000000000000000000001170f133bc034935c30000000000000000000000000000000000000000000033a6d59d04cd85b4687c00000000000000000000000000000000000000000000001170ec6dc16aa89dc30000000000000000000000000000000000000000000033a6d5a1cac81e55007c", + "logIndex": 65, + "blockHash": "0xf49012b4445a834a8e22019bcea3b3ebf067ee97c2066f059eb2448fd20502c3" } ], - "blockNumber": 38596221, - "cumulativeGasUsed": "1503356", + "blockNumber": 38730823, + "cumulativeGasUsed": "4265291", "status": 1, "byzantium": true }, "args": [ - "0xAB182cfcd654A0fdD6dBb4BB9722adB5D158A2f4", - "0xc3C6B8feeE55636e949920Aa90f093f6f5Faf448", - "0xc91f0c5300000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000b0fb55e91b58d8db07aabff2d6b5a8e2e1bf8d08000000000000000000000000284b028af7cead623c2f99ebe7edc9e1a02eef5e000000000000000000000000b2732c13804d60866606d61b1b9450eb4704e59600000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f700000000000000000000000049c4d4c94829b9c44052c5f5cb164fc612181165000000000000000000000000000000000000000000000000000000000000001453616e64626f78204173736574204372656174650000000000000000000000000000000000000000000000000000000000000000000000000000000000000003312e300000000000000000000000000000000000000000000000000000000000" + "0x9c4831B0c6BDFd76813726efD7848A247dE4993E", + "0xc26B12025e378c570Fb46249093Ba387A2e927bc", + "0xc91f0c5300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000007af8c95334240026385f7309d9a8b9e4265fc70a000000000000000000000000d4d1e504be6d12829c3ddfa59778d35203cc358c0000000000000000000000009f6031f7728ff4de931036477ea9bba5ae7cf97400000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f700000000000000000000000049c4d4c94829b9c44052c5f5cb164fc612181165000000000000000000000000000000000000000000000000000000000000001453616e64626f78204173736574204372656174650000000000000000000000000000000000000000000000000000000000000000000000000000000000000003312e300000000000000000000000000000000000000000000000000000000000" ], "numDeployments": 1, "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", @@ -961,14 +1001,14 @@ "args": [ "Sandbox Asset Create", "1.0", - "0xb0fb55e91B58D8db07aaBFF2D6b5A8e2e1bf8D08", - "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", - "0xb2732c13804D60866606D61B1b9450Eb4704e596", + "0x7AF8c95334240026385f7309D9a8b9e4265FC70a", + "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", + "0x9f6031F7728FF4dE931036477Ea9bBa5aE7Cf974", "0x69015912aa33720b842dcd6ac059ed623f28d9f7", "0x49c4D4C94829B9c44052C5f5Cb164Fc612181165" ] }, - "implementation": "0xAB182cfcd654A0fdD6dBb4BB9722adB5D158A2f4", + "implementation": "0x9c4831B0c6BDFd76813726efD7848A247dE4993E", "devdoc": { "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", "kind": "dev", diff --git a/packages/deploy/deployments/mumbai/AssetCreate_Implementation.json b/packages/deploy/deployments/mumbai/AssetCreate_Implementation.json index 29ccf0458e..f7c2329a55 100644 --- a/packages/deploy/deployments/mumbai/AssetCreate_Implementation.json +++ b/packages/deploy/deployments/mumbai/AssetCreate_Implementation.json @@ -1,5 +1,5 @@ { - "address": "0xAB182cfcd654A0fdD6dBb4BB9722adB5D158A2f4", + "address": "0x9c4831B0c6BDFd76813726efD7848A247dE4993E", "abi": [ { "inputs": [], @@ -242,6 +242,31 @@ "name": "TrustedForwarderChanged", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldTrustedForwarder", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newTrustedForwarder", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, { "inputs": [], "name": "DEFAULT_ADMIN_ROLE", @@ -524,7 +549,7 @@ "outputs": [ { "internalType": "address", - "name": "trustedForwarder", + "name": "", "type": "address" } ], @@ -723,56 +748,56 @@ "type": "function" } ], - "transactionHash": "0x1594cb6bdb59902ef1c56fe796c221528ae57dc9a69cdf68780a8b976b56e923", + "transactionHash": "0x106c6396e72b1eaf5b270eab9e8e83931c85b6ba7108a100e368d65bf8d453e4", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0xAB182cfcd654A0fdD6dBb4BB9722adB5D158A2f4", - "transactionIndex": 13, - "gasUsed": "2540246", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000010000000000002000000000020000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000800000000000000080000000000000200000200000000000000000000000000400000000000000000000000000000000004100000000000000000001000000040000400000000000000000108000001000000000000000000000000000000000000000000000000000000000000000100000", - "blockHash": "0x064f6909d404a142aaf84b2fe561d7bda78175898e29dab4b0cd762c26dc9d3b", - "transactionHash": "0x1594cb6bdb59902ef1c56fe796c221528ae57dc9a69cdf68780a8b976b56e923", + "contractAddress": "0x9c4831B0c6BDFd76813726efD7848A247dE4993E", + "transactionIndex": 2, + "gasUsed": "2614864", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100000000004000000000000000000000000000000000000000000000000080000000800000000000000000000000000000000000000000000000000080000000000000200000200000000000000000000000000400000000000000000000000000000000004000000000000000000001000000040000000000000000000000108040000000000000000000000000000000000000000800000000000000000000000000100004", + "blockHash": "0x2556e70a88c2b75dd99524b06092819ce939970df270255c5935425fd661e6c0", + "transactionHash": "0x106c6396e72b1eaf5b270eab9e8e83931c85b6ba7108a100e368d65bf8d453e4", "logs": [ { - "transactionIndex": 13, - "blockNumber": 38596217, - "transactionHash": "0x1594cb6bdb59902ef1c56fe796c221528ae57dc9a69cdf68780a8b976b56e923", - "address": "0xAB182cfcd654A0fdD6dBb4BB9722adB5D158A2f4", + "transactionIndex": 2, + "blockNumber": 38730821, + "transactionHash": "0x106c6396e72b1eaf5b270eab9e8e83931c85b6ba7108a100e368d65bf8d453e4", + "address": "0x9c4831B0c6BDFd76813726efD7848A247dE4993E", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", - "logIndex": 22, - "blockHash": "0x064f6909d404a142aaf84b2fe561d7bda78175898e29dab4b0cd762c26dc9d3b" + "logIndex": 4, + "blockHash": "0x2556e70a88c2b75dd99524b06092819ce939970df270255c5935425fd661e6c0" }, { - "transactionIndex": 13, - "blockNumber": 38596217, - "transactionHash": "0x1594cb6bdb59902ef1c56fe796c221528ae57dc9a69cdf68780a8b976b56e923", + "transactionIndex": 2, + "blockNumber": 38730821, + "transactionHash": "0x106c6396e72b1eaf5b270eab9e8e83931c85b6ba7108a100e368d65bf8d453e4", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", - "0x000000000000000000000000f903ba9e006193c1527bfbe65fe2123704ea3f99" + "0x000000000000000000000000be188d6641e8b680743a4815dfa0f6208038960f" ], - "data": "0x000000000000000000000000000000000000000000000000000d8982aab54a0000000000000000000000000000000000000000000000001171ce09a36e026c2300000000000000000000000000000000000000000000103231a44a1f912edbf100000000000000000000000000000000000000000000001171c08020c34d222300000000000000000000000000000000000000000000103231b1d3a23be425f1", - "logIndex": 23, - "blockHash": "0x064f6909d404a142aaf84b2fe561d7bda78175898e29dab4b0cd762c26dc9d3b" + "data": "0x000000000000000000000000000000000000000000000000000def4eb3c8b00000000000000000000000000000000000000000000000001170ff230ab9904ac30000000000000000000000000000000000000000000033a6d56fcfcded09d0c100000000000000000000000000000000000000000000001170f133bc05c79ac30000000000000000000000000000000000000000000033a6d57dbf1ca0d280c1", + "logIndex": 5, + "blockHash": "0x2556e70a88c2b75dd99524b06092819ce939970df270255c5935425fd661e6c0" } ], - "blockNumber": 38596217, - "cumulativeGasUsed": "3586441", + "blockNumber": 38730821, + "cumulativeGasUsed": "2712913", "status": 1, "byzantium": true }, "args": [], "numDeployments": 1, - "solcInputHash": "2c3b4b6dffad52d9ee7aef38c085eed3", - "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint8[]\",\"name\":\"tiers\",\"type\":\"uint8[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"string[]\",\"name\":\"metadataHashes\",\"type\":\"string[]\"},{\"indexed\":false,\"internalType\":\"bool[]\",\"name\":\"revealed\",\"type\":\"bool[]\"}],\"name\":\"AssetBatchMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"tier\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"metadataHash\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"revealed\",\"type\":\"bool\"}],\"name\":\"AssetMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"tier\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"metadataHash\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"revealed\",\"type\":\"bool\"}],\"name\":\"SpecialAssetMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newTrustedForwarderAddress\",\"type\":\"address\"}],\"name\":\"TrustedForwarderChanged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_BATCH_TYPEHASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_TYPEHASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SPECIAL_MINTER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"tier\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"revealed\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"metadataHash\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"}],\"name\":\"createAsset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"uint8[]\",\"name\":\"tiers\",\"type\":\"uint8[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bool[]\",\"name\":\"revealed\",\"type\":\"bool[]\"},{\"internalType\":\"string[]\",\"name\":\"metadataHashes\",\"type\":\"string[]\"},{\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"}],\"name\":\"createMultipleAssets\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"metadataHash\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"}],\"name\":\"createSpecialAsset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"creatorNonces\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAssetContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAuthValidator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCatalystContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTrustedForwarder\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_version\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_assetContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_catalystContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_authValidator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_forwarder\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_defaultAdmin\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"}],\"name\":\"isTrustedForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"name\":\"setTrustedForwarder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"signatureNonces\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"The Sandbox\",\"events\":{\"EIP712DomainChanged()\":{\"details\":\"MAY be emitted to signal that the domain could have changed.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"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._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"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`)\"}},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"createAsset(bytes,uint8,uint256,bool,string,address)\":{\"params\":{\"amount\":\"The amount of the asset to mint\",\"metadataHash\":\"The metadata hash of the asset to mint\",\"signature\":\"A signature generated by TSB\",\"tier\":\"The tier of the asset to mint\"}},\"createMultipleAssets(bytes,uint8[],uint256[],bool[],string[],address)\":{\"params\":{\"amounts\":\"The amounts of the assets to mint\",\"metadataHashes\":\"The metadata hashes of the assets to mint\",\"signature\":\"A signature generated by TSB\",\"tiers\":\"The tiers of the assets to mint\"}},\"createSpecialAsset(bytes,uint256,string,address)\":{\"details\":\"Only callable by the special minter\",\"params\":{\"amount\":\"The amount of the asset to mint\",\"creator\":\"The address of the creator\",\"metadataHash\":\"The metadata hash of the asset to mint,\",\"signature\":\"A signature generated by TSB\"}},\"eip712Domain()\":{\"details\":\"See {EIP-5267}. _Available since v4.9._\"},\"getAssetContract()\":{\"returns\":{\"_0\":\"The asset contract address\"}},\"getAuthValidator()\":{\"returns\":{\"_0\":\"The auth validator address\"}},\"getCatalystContract()\":{\"returns\":{\"_0\":\"The catalyst contract address\"}},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"grantRole(bytes32,address)\":{\"details\":\"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.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"initialize(string,string,address,address,address,address,address)\":{\"params\":{\"_assetContract\":\"The address of the asset contract\",\"_authValidator\":\"The address of the AuthSuperValidator contract\",\"_forwarder\":\"The address of the forwarder contract\"}},\"renounceRole(bytes32,address)\":{\"details\":\"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.\"},\"revokeRole(bytes32,address)\":{\"details\":\"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.\"},\"setTrustedForwarder(address)\":{\"details\":\"Change the address of the trusted forwarder for meta-TX\",\"params\":{\"trustedForwarder\":\"The new trustedForwarder\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"title\":\"AssetCreate\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createAsset(bytes,uint8,uint256,bool,string,address)\":{\"notice\":\"Create a new asset\"},\"createMultipleAssets(bytes,uint8[],uint256[],bool[],string[],address)\":{\"notice\":\"Create multiple assets at once\"},\"createSpecialAsset(bytes,uint256,string,address)\":{\"notice\":\"Create special assets, like TSB exclusive tokens\"},\"getAssetContract()\":{\"notice\":\"Get the asset contract address\"},\"getAuthValidator()\":{\"notice\":\"Get the auth validator address\"},\"getCatalystContract()\":{\"notice\":\"Get the catalyst contract address\"},\"initialize(string,string,address,address,address,address,address)\":{\"notice\":\"Initialize the contract\"},\"setTrustedForwarder(address)\":{\"notice\":\"Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\"}},\"notice\":\"User-facing contract for creating new assets\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"@sandbox-smart-contracts/asset/contracts/AssetCreate.sol\":\"AssetCreate\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlUpgradeable.sol\\\";\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\\n function __AccessControl_init() internal onlyInitializing {\\n }\\n\\n function __AccessControl_init_unchained() internal onlyInitializing {\\n }\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n StringsUpgradeable.toHexString(account),\\n \\\" is missing role \\\",\\n StringsUpgradeable.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xfeefb24d068524440e1ba885efdf105d91f83504af3c2d745ffacc4595396831\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControlUpgradeable {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0xb8f5302f12138c5561362e88a78d061573e6298b7a1a5afe84a1e2c8d4d5aeaa\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC5267Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\\n\\npragma solidity ^0.8.0;\\n\\ninterface IERC5267Upgradeable {\\n /**\\n * @dev MAY be emitted to signal that the domain could have changed.\\n */\\n event EIP712DomainChanged();\\n\\n /**\\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\\n * signature.\\n */\\n function eip712Domain()\\n external\\n view\\n returns (\\n bytes1 fields,\\n string memory name,\\n string memory version,\\n uint256 chainId,\\n address verifyingContract,\\n bytes32 salt,\\n uint256[] memory extensions\\n );\\n}\\n\",\"keccak256\":\"0xe562dab443278837fa50faddb76743399e942181881db8dccaea3bd1712994db\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized != type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../StringsUpgradeable.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSAUpgradeable {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\")\\n mstore(0x1c, hash)\\n message := keccak256(0x00, 0x3c)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", StringsUpgradeable.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, \\\"\\\\x19\\\\x01\\\")\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n data := keccak256(ptr, 0x42)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\\n * `validator` and `data` according to the version 0 of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x00\\\", validator, data));\\n }\\n}\\n\",\"keccak256\":\"0xa014f65d84b02827055d99993ccdbfb4b56b2c9e91eb278d82a93330659d06e4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.8;\\n\\nimport \\\"./ECDSAUpgradeable.sol\\\";\\nimport \\\"../../interfaces/IERC5267Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\\n *\\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\\n *\\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\\n * ({_hashTypedDataV4}).\\n *\\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\\n * the chain id to protect against replay attacks on an eventual fork of the chain.\\n *\\n * NOTE: This contract implements the version of the encoding known as \\\"v4\\\", as implemented by the JSON RPC method\\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\\n *\\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\\n *\\n * _Available since v3.4._\\n *\\n * @custom:storage-size 52\\n */\\nabstract contract EIP712Upgradeable is Initializable, IERC5267Upgradeable {\\n bytes32 private constant _TYPE_HASH =\\n keccak256(\\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\");\\n\\n /// @custom:oz-renamed-from _HASHED_NAME\\n bytes32 private _hashedName;\\n /// @custom:oz-renamed-from _HASHED_VERSION\\n bytes32 private _hashedVersion;\\n\\n string private _name;\\n string private _version;\\n\\n /**\\n * @dev Initializes the domain separator and parameter caches.\\n *\\n * The meaning of `name` and `version` is specified in\\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\\n *\\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\\n * - `version`: the current major version of the signing domain.\\n *\\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\\n * contract upgrade].\\n */\\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\\n __EIP712_init_unchained(name, version);\\n }\\n\\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\\n _name = name;\\n _version = version;\\n\\n // Reset prior values in storage if upgrading\\n _hashedName = 0;\\n _hashedVersion = 0;\\n }\\n\\n /**\\n * @dev Returns the domain separator for the current chain.\\n */\\n function _domainSeparatorV4() internal view returns (bytes32) {\\n return _buildDomainSeparator();\\n }\\n\\n function _buildDomainSeparator() private view returns (bytes32) {\\n return keccak256(abi.encode(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this)));\\n }\\n\\n /**\\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\\n * function returns the hash of the fully encoded EIP712 message for this domain.\\n *\\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\\n *\\n * ```solidity\\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\\n * keccak256(\\\"Mail(address to,string contents)\\\"),\\n * mailTo,\\n * keccak256(bytes(mailContents))\\n * )));\\n * address signer = ECDSA.recover(digest, signature);\\n * ```\\n */\\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n\\n /**\\n * @dev See {EIP-5267}.\\n *\\n * _Available since v4.9._\\n */\\n function eip712Domain()\\n public\\n view\\n virtual\\n override\\n returns (\\n bytes1 fields,\\n string memory name,\\n string memory version,\\n uint256 chainId,\\n address verifyingContract,\\n bytes32 salt,\\n uint256[] memory extensions\\n )\\n {\\n // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized\\n // and the EIP712 domain is not reliable, as it will be missing name and version.\\n require(_hashedName == 0 && _hashedVersion == 0, \\\"EIP712: Uninitialized\\\");\\n\\n return (\\n hex\\\"0f\\\", // 01111\\n _EIP712Name(),\\n _EIP712Version(),\\n block.chainid,\\n address(this),\\n bytes32(0),\\n new uint256[](0)\\n );\\n }\\n\\n /**\\n * @dev The name parameter for the EIP712 domain.\\n *\\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\\n * are a concern.\\n */\\n function _EIP712Name() internal virtual view returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev The version parameter for the EIP712 domain.\\n *\\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\\n * are a concern.\\n */\\n function _EIP712Version() internal virtual view returns (string memory) {\\n return _version;\\n }\\n\\n /**\\n * @dev The hash of the name parameter for the EIP712 domain.\\n *\\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.\\n */\\n function _EIP712NameHash() internal view returns (bytes32) {\\n string memory name = _EIP712Name();\\n if (bytes(name).length > 0) {\\n return keccak256(bytes(name));\\n } else {\\n // If the name is empty, the contract may have been upgraded without initializing the new storage.\\n // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.\\n bytes32 hashedName = _hashedName;\\n if (hashedName != 0) {\\n return hashedName;\\n } else {\\n return keccak256(\\\"\\\");\\n }\\n }\\n }\\n\\n /**\\n * @dev The hash of the version parameter for the EIP712 domain.\\n *\\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.\\n */\\n function _EIP712VersionHash() internal view returns (bytes32) {\\n string memory version = _EIP712Version();\\n if (bytes(version).length > 0) {\\n return keccak256(bytes(version));\\n } else {\\n // If the version is empty, the contract may have been upgraded without initializing the new storage.\\n // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.\\n bytes32 hashedVersion = _hashedVersion;\\n if (hashedVersion != 0) {\\n return hashedVersion;\\n } else {\\n return keccak256(\\\"\\\");\\n }\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[48] private __gap;\\n}\\n\",\"keccak256\":\"0xeb8d6be406a373771724922eb41b5d593bc8e2dc705daa22cd1145cfc8f5a3a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary MathUpgradeable {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(account),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0dd6e52cb394d7f5abe5dca2d4908a6be40417914720932de757de34a99ab87f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\")\\n mstore(0x1c, hash)\\n message := keccak256(0x00, 0x3c)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, \\\"\\\\x19\\\\x01\\\")\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n data := keccak256(ptr, 0x42)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\\n * `validator` and `data` according to the version 0 of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x00\\\", validator, data));\\n }\\n}\\n\",\"keccak256\":\"0x809bc3edb4bcbef8263fa616c1b60ee0004b50a8a1bfa164d8f57fd31f520c58\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/AssetCreate.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {EIP712Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\\\";\\nimport {\\n AccessControlUpgradeable,\\n ContextUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\\\";\\nimport {TokenIdUtils} from \\\"./libraries/TokenIdUtils.sol\\\";\\nimport {AuthSuperValidator} from \\\"./AuthSuperValidator.sol\\\";\\nimport {ERC2771Handler} from \\\"./ERC2771Handler.sol\\\";\\nimport {IAsset} from \\\"./interfaces/IAsset.sol\\\";\\nimport {ICatalyst} from \\\"./interfaces/ICatalyst.sol\\\";\\nimport {IAssetCreate} from \\\"./interfaces/IAssetCreate.sol\\\";\\n\\n/// @title AssetCreate\\n/// @author The Sandbox\\n/// @notice User-facing contract for creating new assets\\ncontract AssetCreate is IAssetCreate, Initializable, ERC2771Handler, EIP712Upgradeable, AccessControlUpgradeable {\\n using TokenIdUtils for uint256;\\n\\n IAsset private assetContract;\\n ICatalyst private catalystContract;\\n AuthSuperValidator private authValidator;\\n\\n // mapping of creator address to creator nonce, a nonce is incremented every time a creator mints a new token\\n mapping(address => uint16) public creatorNonces;\\n mapping(address => uint16) public signatureNonces;\\n\\n bytes32 public constant SPECIAL_MINTER_ROLE = keccak256(\\\"SPECIAL_MINTER_ROLE\\\");\\n bytes32 public constant MINT_TYPEHASH =\\n keccak256(\\\"Mint(address creator,uint16 nonce,uint8 tier,uint256 amount,bool revealed,string metadataHash)\\\");\\n bytes32 public constant MINT_BATCH_TYPEHASH =\\n keccak256(\\n \\\"MintBatch(address creator,uint16 nonce,uint8[] tiers,uint256[] amounts,bool[] revealed,string[] metadataHashes)\\\"\\n );\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /// @notice Initialize the contract\\n /// @param _assetContract The address of the asset contract\\n /// @param _authValidator The address of the AuthSuperValidator contract\\n /// @param _forwarder The address of the forwarder contract\\n function initialize(\\n string memory _name,\\n string memory _version,\\n address _assetContract,\\n address _catalystContract,\\n address _authValidator,\\n address _forwarder,\\n address _defaultAdmin\\n ) public initializer {\\n assetContract = IAsset(_assetContract);\\n catalystContract = ICatalyst(_catalystContract);\\n authValidator = AuthSuperValidator(_authValidator);\\n __ERC2771Handler_initialize(_forwarder);\\n __EIP712_init(_name, _version);\\n __AccessControl_init();\\n _grantRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);\\n }\\n\\n /// @notice Create a new asset\\n /// @param signature A signature generated by TSB\\n /// @param tier The tier of the asset to mint\\n /// @param amount The amount of the asset to mint\\n /// @param metadataHash The metadata hash of the asset to mint\\n function createAsset(\\n bytes memory signature,\\n uint8 tier,\\n uint256 amount,\\n bool revealed,\\n string calldata metadataHash,\\n address creator\\n ) external {\\n require(\\n authValidator.verify(\\n signature,\\n _hashMint(creator, signatureNonces[_msgSender()]++, tier, amount, revealed, metadataHash)\\n ),\\n \\\"Invalid signature\\\"\\n );\\n\\n uint256 tokenId =\\n TokenIdUtils.generateTokenId(creator, tier, ++creatorNonces[creator], revealed ? 1 : 0, false);\\n\\n // burn catalyst of a given tier\\n catalystContract.burnFrom(creator, tier, amount);\\n assetContract.mint(creator, tokenId, amount, metadataHash);\\n emit AssetMinted(creator, tokenId, tier, amount, metadataHash, revealed);\\n }\\n\\n /// @notice Create multiple assets at once\\n /// @param signature A signature generated by TSB\\n /// @param tiers The tiers of the assets to mint\\n /// @param amounts The amounts of the assets to mint\\n /// @param metadataHashes The metadata hashes of the assets to mint\\n function createMultipleAssets(\\n bytes memory signature,\\n uint8[] calldata tiers,\\n uint256[] calldata amounts,\\n bool[] calldata revealed,\\n string[] calldata metadataHashes,\\n address creator\\n ) external {\\n require(\\n authValidator.verify(\\n signature,\\n _hashBatchMint(creator, signatureNonces[_msgSender()]++, tiers, amounts, revealed, metadataHashes)\\n ),\\n \\\"Invalid signature\\\"\\n );\\n\\n require(tiers.length == amounts.length, \\\"Arrays must be same length\\\");\\n require(amounts.length == metadataHashes.length, \\\"Arrays must be same length\\\");\\n require(metadataHashes.length == revealed.length, \\\"Arrays must be same length\\\");\\n\\n uint256[] memory tokenIds = new uint256[](tiers.length);\\n uint256[] memory tiersToBurn = new uint256[](tiers.length);\\n for (uint256 i = 0; i < tiers.length; i++) {\\n tiersToBurn[i] = tiers[i];\\n tokenIds[i] = TokenIdUtils.generateTokenId(\\n creator,\\n tiers[i],\\n ++creatorNonces[creator],\\n revealed[i] ? 1 : 0,\\n false\\n );\\n }\\n\\n catalystContract.burnBatchFrom(creator, tiersToBurn, amounts);\\n\\n assetContract.mintBatch(creator, tokenIds, amounts, metadataHashes);\\n emit AssetBatchMinted(creator, tokenIds, tiers, amounts, metadataHashes, revealed);\\n }\\n\\n /// @notice Create special assets, like TSB exclusive tokens\\n /// @dev Only callable by the special minter\\n /// @param signature A signature generated by TSB\\n /// @param amount The amount of the asset to mint\\n /// @param metadataHash The metadata hash of the asset to mint,\\n /// @param creator The address of the creator\\n function createSpecialAsset(\\n bytes memory signature,\\n uint256 amount,\\n string calldata metadataHash,\\n address creator\\n ) external onlyRole(SPECIAL_MINTER_ROLE) {\\n require(\\n authValidator.verify(\\n signature,\\n _hashMint(creator, signatureNonces[_msgSender()]++, 0, amount, true, metadataHash)\\n ),\\n \\\"Invalid signature\\\"\\n );\\n\\n uint256 tokenId = TokenIdUtils.generateTokenId(creator, 0, ++creatorNonces[creator], 1, false);\\n\\n assetContract.mint(creator, tokenId, amount, metadataHash);\\n emit SpecialAssetMinted(creator, tokenId, 0, amount, metadataHash, true);\\n }\\n\\n /// @notice Get the asset contract address\\n /// @return The asset contract address\\n function getAssetContract() external view returns (address) {\\n return address(assetContract);\\n }\\n\\n /// @notice Get the catalyst contract address\\n /// @return The catalyst contract address\\n function getCatalystContract() external view returns (address) {\\n return address(catalystContract);\\n }\\n\\n /// @notice Get the auth validator address\\n /// @return The auth validator address\\n function getAuthValidator() external view returns (address) {\\n return address(authValidator);\\n }\\n\\n /// @notice Creates a hash of the mint data\\n /// @param creator The address of the creator\\n /// @param tier The tier of the asset\\n /// @param amount The amount of copies to mint\\n /// @param metadataHash The metadata hash of the asset\\n /// @return digest The hash of the mint data\\n function _hashMint(\\n address creator,\\n uint16 nonce,\\n uint8 tier,\\n uint256 amount,\\n bool revealed,\\n string calldata metadataHash\\n ) internal view returns (bytes32 digest) {\\n digest = _hashTypedDataV4(\\n keccak256(\\n abi.encode(\\n MINT_TYPEHASH,\\n creator,\\n nonce,\\n tier,\\n amount,\\n revealed,\\n keccak256((abi.encodePacked(metadataHash)))\\n )\\n )\\n );\\n }\\n\\n /// @notice Creates a hash of the mint batch data\\n /// @param creator The address of the creator\\n /// @param tiers The tiers of the assets\\n /// @param amounts The amounts of copies to mint\\n /// @param metadataHashes The metadata hashes of the assets\\n /// @return digest The hash of the mint batch data\\n function _hashBatchMint(\\n address creator,\\n uint16 nonce,\\n uint8[] calldata tiers,\\n uint256[] calldata amounts,\\n bool[] calldata revealed,\\n string[] calldata metadataHashes\\n ) internal view returns (bytes32 digest) {\\n digest = _hashTypedDataV4(\\n keccak256(\\n abi.encode(\\n MINT_BATCH_TYPEHASH,\\n creator,\\n nonce,\\n keccak256(abi.encodePacked(tiers)),\\n keccak256(abi.encodePacked(amounts)),\\n keccak256(abi.encodePacked(revealed)),\\n _encodeHashes(metadataHashes)\\n )\\n )\\n );\\n }\\n\\n /// @notice Encodes the hashes of the metadata for signature verification\\n /// @param metadataHashes The hashes of the metadata\\n /// @return encodedHashes The encoded hashes of the metadata\\n function _encodeHashes(string[] memory metadataHashes) internal pure returns (bytes32) {\\n bytes32[] memory encodedHashes = new bytes32[](metadataHashes.length);\\n for (uint256 i = 0; i < metadataHashes.length; i++) {\\n encodedHashes[i] = keccak256((abi.encodePacked(metadataHashes[i])));\\n }\\n\\n return keccak256(abi.encodePacked(encodedHashes));\\n }\\n\\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\\n /// @dev Change the address of the trusted forwarder for meta-TX\\n /// @param trustedForwarder The new trustedForwarder\\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n require(trustedForwarder != address(0), \\\"AssetReveal: trusted forwarder can't be zero address\\\");\\n _trustedForwarder = trustedForwarder;\\n emit TrustedForwarderChanged(trustedForwarder);\\n }\\n\\n function _msgSender() internal view virtual override(ContextUpgradeable, ERC2771Handler) returns (address sender) {\\n return ERC2771Handler._msgSender();\\n }\\n\\n function _msgData() internal view virtual override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\\n return ERC2771Handler._msgData();\\n }\\n}\\n\",\"keccak256\":\"0x994b0f25e8bcf276a4ccecb6f1af66e549ab0067d00659bc2823ba4a92197daf\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/AuthSuperValidator.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport {AccessControl} from \\\"@openzeppelin/contracts/access/AccessControl.sol\\\";\\nimport {ECDSA} from \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\n/// @title AuthSuperValidator\\n/// @author The Sandbox\\n/// @notice This contract is used to validate the signatures of the backend, each contract can have a separate signer assigned\\ncontract AuthSuperValidator is AccessControl {\\n mapping(address => address) private _signers;\\n\\n /// @dev Constructor\\n /// @param admin Address of the admin that will be able to grant roles\\n constructor(address admin) {\\n _grantRole(DEFAULT_ADMIN_ROLE, admin);\\n }\\n\\n /// @notice Sets the signer for a contract\\n /// @dev Only the admin can call this function\\n /// @param contractAddress Address of the contract to set the signer for\\n /// @param signer Address of the signer\\n function setSigner(address contractAddress, address signer) public onlyRole(DEFAULT_ADMIN_ROLE) {\\n _signers[contractAddress] = signer;\\n }\\n\\n /// @notice Gets the signer for a contract\\n /// @param contractAddress Address of the contract to get the signer for\\n /// @return address of the signer\\n function getSigner(address contractAddress) public view returns (address) {\\n return _signers[contractAddress];\\n }\\n\\n /// @notice Takes the signature and the digest and returns if the signer has a backend signer role assigned\\n /// @dev Multipurpose function that can be used to verify signatures with different digests\\n /// @param signature Signature hash\\n /// @param digest Digest hash\\n /// @return bool\\n function verify(bytes memory signature, bytes32 digest) public view returns (bool) {\\n address signer = _signers[_msgSender()];\\n require(signer != address(0), \\\"AuthSuperValidator: signer not set\\\");\\n address recoveredSigner = ECDSA.recover(digest, signature);\\n return recoveredSigner == signer;\\n }\\n}\\n\",\"keccak256\":\"0x990d27552ffce0f248fadbf539bbc904134ca14d392931bdfab0f02740103be3\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/ERC2771Handler.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\n/// @dev minimal ERC2771 handler to keep bytecode-size down\\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.6.0/contracts/metatx/ERC2771Context.sol\\n/// with an initializer for proxies and a mutable forwarder\\n\\nabstract contract ERC2771Handler {\\n address internal _trustedForwarder;\\n\\n function __ERC2771Handler_initialize(address forwarder) internal {\\n _trustedForwarder = forwarder;\\n }\\n\\n function isTrustedForwarder(address forwarder) public view returns (bool) {\\n return forwarder == _trustedForwarder;\\n }\\n\\n function getTrustedForwarder() external view returns (address trustedForwarder) {\\n return _trustedForwarder;\\n }\\n\\n function _msgSender() internal view virtual returns (address sender) {\\n if (isTrustedForwarder(msg.sender)) {\\n // The assembly code is more direct than the Solidity version using `abi.decode`.\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\\n }\\n } else {\\n return msg.sender;\\n }\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n if (isTrustedForwarder(msg.sender)) {\\n return msg.data[:msg.data.length - 20];\\n } else {\\n return msg.data;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb14f384116bdc60b5fc789de2280bccee214c967416cee1b30fb03e0ce4442d5\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/interfaces/IAsset.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface IAsset {\\n // AssetData reflects the asset tokenId structure\\n // Refer to TokenIdUtils.sol\\n struct AssetData {\\n uint256 tokenId;\\n address creator;\\n uint256 amount;\\n uint8 tier;\\n uint16 creatorNonce;\\n bool revealed;\\n string metadataHash;\\n bool bridged;\\n }\\n\\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\\n\\n // Functions\\n function mint(\\n address to,\\n uint256 id,\\n uint256 amount,\\n string memory metadataHash\\n ) external;\\n\\n function mintBatch(\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n string[] memory metadataHashes\\n ) external;\\n\\n function burnFrom(\\n address account,\\n uint256 id,\\n uint256 amount\\n ) external;\\n\\n function burnBatchFrom(\\n address account,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external;\\n\\n function getTokenIdByMetadataHash(string memory metadataHash) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x2abd2e550ced35090c988e432215f990bf8f192cc346ffac6778fde0025a8206\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/interfaces/IAssetCreate.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface IAssetCreate {\\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\\n event AssetMinted(\\n address indexed creator,\\n uint256 tokenId,\\n uint16 tier,\\n uint256 amount,\\n string metadataHash,\\n bool revealed\\n );\\n event SpecialAssetMinted(\\n address indexed creator,\\n uint256 tokenId,\\n uint16 tier,\\n uint256 amount,\\n string metadataHash,\\n bool revealed\\n );\\n event AssetBatchMinted(\\n address indexed creator,\\n uint256[] tokenIds,\\n uint8[] tiers,\\n uint256[] amounts,\\n string[] metadataHashes,\\n bool[] revealed\\n );\\n}\\n\",\"keccak256\":\"0x66c18365555f5c3e7c2a38496d3e7f9739c93607eac0e993162320dad070c1e5\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/interfaces/ICatalyst.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface ICatalyst {\\n enum CatalystType {TSB_EXCLUSIVE, COMMON, UNCOMMON, RARE, EPIC, LEGENDARY, MYTHIC}\\n\\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\\n event NewCatalystTypeAdded(uint256 catalystId);\\n event DefaultRoyaltyChanged(address indexed newDefaultRoyaltyRecipient, uint256 newDefaultRoyaltyAmount);\\n\\n /// @notice Mints a new token, limited to MINTER_ROLE only\\n /// @param to The address that will own the minted token\\n /// @param id The token id to mint\\n /// @param amount The amount to be minted\\n function mint(\\n address to,\\n uint256 id,\\n uint256 amount\\n ) external;\\n\\n /// @notice Mints a batch of tokens, limited to MINTER_ROLE only\\n /// @param to The address that will own the minted tokens\\n /// @param ids The token ids to mint\\n /// @param amounts The amounts to be minted per token id\\n function mintBatch(\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external;\\n\\n /// @notice Burns a specified amount of tokens from a specific address\\n /// @param account The address to burn from\\n /// @param id The token id to burn\\n /// @param amount The amount to be burned\\n function burnFrom(\\n address account,\\n uint256 id,\\n uint256 amount\\n ) external;\\n\\n /// @notice Burns a batch of tokens from a specific address\\n /// @param account The address to burn from\\n /// @param ids The token ids to burn\\n /// @param amounts The amounts to be burned\\n function burnBatchFrom(\\n address account,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external;\\n\\n /// @notice Add a new catalyst type, limited to DEFAULT_ADMIN_ROLE only\\n /// @param ipfsCID The royalty bps for the catalyst\\n function addNewCatalystType(string memory ipfsCID) external;\\n\\n /// @notice Set a new URI for specific tokenid\\n /// @param tokenId The token id to set URI for\\n /// @param metadataHash The new URI\\n function setMetadataHash(uint256 tokenId, string memory metadataHash) external;\\n\\n /// @notice Set a new base URI\\n /// @param baseURI The new base URI\\n function setBaseURI(string memory baseURI) external;\\n}\\n\",\"keccak256\":\"0x5490f773ea2894927b789486457e4a25cb19508931846469927eb22e22a6a5f8\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/libraries/TokenIdUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {IAsset} from \\\"../interfaces/IAsset.sol\\\";\\n\\nlibrary TokenIdUtils {\\n // Layer masks\\n uint256 public constant TIER_MASK = 0xFF;\\n uint256 public constant NONCE_MASK = 0xFFFF;\\n uint256 public constant REVEAL_NONCE_MASK = 0xFFFF;\\n uint256 public constant BRIDGED_MASK = 0x1;\\n\\n // Bit shifts\\n uint256 public constant CREATOR_SHIFT = 0;\\n uint256 public constant TIER_SHIFT = 160;\\n uint256 public constant NONCE_SHIFT = 168;\\n uint256 public constant REVEAL_NONCE_SHIFT = 184;\\n uint256 public constant BRIDGED_SHIFT = 200;\\n\\n /// @notice Generates a token id for a given asset\\n /// @dev The token id is generated by concatenating the following fields:\\n /// @dev creator address, chain index, tier, asset nonce, reveal nonce and bridged boolean\\n /// @dev The first 160 bits are the creator address\\n /// @dev The next 8 bits are the chain index\\n /// @dev The next 8 bits are the tier\\n /// @dev The next 16 bits are the asset nonce\\n /// @dev The next 16 bits are assets reveal nonce.\\n /// @param creator The address of the creator of the asset\\n /// @param tier The tier of the asset determined by the catalyst used to create it\\n /// @param creatorNonce The nonce of the asset creator\\n /// @param revealNonce The reveal nonce of the asset\\n /// @param bridged Whether the asset is bridged or not\\n /// @return tokenId The generated token id\\n function generateTokenId(\\n address creator,\\n uint8 tier,\\n uint16 creatorNonce,\\n uint16 revealNonce,\\n bool bridged\\n ) internal pure returns (uint256 tokenId) {\\n uint160 creatorAddress = uint160(creator);\\n\\n tokenId = tokenId =\\n uint256(creatorAddress) |\\n (uint256(tier) << TIER_SHIFT) |\\n (uint256(creatorNonce) << NONCE_SHIFT) |\\n (uint256(revealNonce) << REVEAL_NONCE_SHIFT) |\\n (uint256(bridged ? 1 : 0) << BRIDGED_SHIFT);\\n\\n return tokenId;\\n }\\n\\n /// @notice Extracts the creator address from a given token id\\n /// @param tokenId The token id to extract the creator address from\\n /// @return creator The asset creator address\\n function getCreatorAddress(uint256 tokenId) internal pure returns (address creator) {\\n creator = address(uint160(tokenId));\\n return creator;\\n }\\n\\n /// @notice Extracts the tier from a given token id\\n /// @param tokenId The token id to extract the tier from\\n /// @return tier The asset tier, determined by the catalyst used to create it\\n function getTier(uint256 tokenId) internal pure returns (uint8 tier) {\\n tier = uint8((tokenId >> TIER_SHIFT) & TIER_MASK);\\n return tier;\\n }\\n\\n /// @notice Extracts the revealed flag from a given token id\\n /// @param tokenId The token id to extract the revealed flag from\\n /// @return isRevealed Whether the asset is revealed or not\\n function isRevealed(uint256 tokenId) internal pure returns (bool) {\\n uint16 revealNonce = getRevealNonce(tokenId);\\n return revealNonce != 0;\\n }\\n\\n /// @notice Extracts the asset nonce from a given token id\\n /// @param tokenId The token id to extract the asset nonce from\\n /// @return creatorNonce The asset creator nonce\\n function getCreatorNonce(uint256 tokenId) internal pure returns (uint16) {\\n uint16 creatorNonce = uint16((tokenId >> NONCE_SHIFT) & NONCE_MASK);\\n return creatorNonce;\\n }\\n\\n /// @notice Extracts the abilities and enhancements hash from a given token id\\n /// @param tokenId The token id to extract reveal nonce from\\n /// @return revealNonce The reveal nonce of the asset\\n function getRevealNonce(uint256 tokenId) internal pure returns (uint16) {\\n uint16 revealNonce = uint16((tokenId >> REVEAL_NONCE_SHIFT) & REVEAL_NONCE_MASK);\\n return revealNonce;\\n }\\n\\n /// @notice Extracts the bridged flag from a given token id\\n /// @param tokenId The token id to extract the bridged flag from\\n /// @return bridged Whether the asset is bridged or not\\n function isBridged(uint256 tokenId) internal pure returns (bool) {\\n bool bridged = ((tokenId >> BRIDGED_SHIFT) & BRIDGED_MASK) == 1;\\n return bridged;\\n }\\n\\n /// @notice Extracts the asset data from a given token id\\n /// @dev Created to limit the number of functions that need to be called when revealing an asset\\n /// @param tokenId The token id to extract the asset data from\\n function getData(uint256 tokenId) internal pure returns (IAsset.AssetData memory data) {\\n data.creator = getCreatorAddress(tokenId);\\n data.tier = getTier(tokenId);\\n data.revealed = isRevealed(tokenId);\\n data.creatorNonce = getCreatorNonce(tokenId);\\n data.bridged = isBridged(tokenId);\\n }\\n}\\n\",\"keccak256\":\"0x82f6bb065e85497d5486bcecb162c30df83941262ff5ac3fd8e283e946250839\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e3565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b612ca980620000f36000396000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c806384b0196e116100e3578063d547741f1161008c578063dbd8483d11610066578063dbd8483d146103c5578063de743a72146103e9578063f76fc35e1461041057600080fd5b8063d547741f1461038e578063d5f2077c146103a1578063da742228146103b257600080fd5b8063a217fddf116100bd578063a217fddf1461035c578063c91f0c5314610364578063ce1b815f1461037757600080fd5b806384b0196e146102f557806391d14854146103105780639e7495aa1461034957600080fd5b806334dcdd521161014557806359c191e41161011f57806359c191e41461029857806374e3447a146102bd5780637caa719a146102e457600080fd5b806334dcdd521461022657806336568abe1461025d578063572b6c051461027057600080fd5b8063248a9ca311610176578063248a9ca3146101cf5780632d94a9d3146102005780632f2ff15d1461021357600080fd5b806301ffc9a7146101925780631a3101b1146101ba575b600080fd5b6101a56101a0366004611ec5565b610437565b60405190151581526020015b60405180910390f35b6101cd6101c8366004612042565b6104d0565b005b6101f26101dd3660046120ec565b60009081526099602052604090206001015490565b6040519081526020016101b1565b6101cd61020e366004612105565b6107b6565b6101cd61022136600461218a565b610a2b565b61024a6102343660046121b6565b60ce6020526000908152604090205461ffff1681565b60405161ffff90911681526020016101b1565b6101cd61026b36600461218a565b610a55565b6101a561027e3660046121b6565b6000546201000090046001600160a01b0390811691161490565b60cb546001600160a01b03165b6040516001600160a01b0390911681526020016101b1565b6101f27fb696df569c2dfecb5a24edfd39d7f55b0f442be14350cbc68dbe8eb35489d3a681565b60cc546001600160a01b03166102a5565b6102fd610af1565b6040516101b1979695949392919061225c565b6101a561031e36600461218a565b60009182526099602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6101cd61035736600461232b565b610bb3565b6101f2600081565b6101cd610372366004612424565b6110d4565b6000546201000090046001600160a01b03166102a5565b6101cd61039c36600461218a565b611299565b60cd546001600160a01b03166102a5565b6101cd6103c03660046121b6565b6112be565b61024a6103d33660046121b6565b60cf6020526000908152604090205461ffff1681565b6101f27f52955c021a90f71f7afee289089576ce6998f456ca81e444651c71363bf2609581565b6101f27f3b0c69bab62d38b5774be9b5185349bf525ef97a4d288b652e29bb4ec2a4902d81565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806104ca57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60cd546001600160a01b0316636b406341886105418460cf60006104f26113ae565b6001600160a01b0316815260208101919091526040016000908120805461ffff169161051d836124e3565b91906101000a81548161ffff021916908361ffff1602179055508b8b8b8b8b6113bd565b6040518363ffffffff1660e01b815260040161055e929190612504565b602060405180830381865afa15801561057b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059f9190612526565b6105f05760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064015b60405180910390fd5b6001600160a01b038116600090815260ce6020526040812080546106549184918a919085906106229061ffff166124e3565b91906101000a81548161ffff021916908361ffff16021790558861064757600061064a565b60015b60ff166000611481565b60cc546040517f124d91e50000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015260ff8b166024830152604482018a905292935091169063124d91e590606401600060405180830381600087803b1580156106c657600080fd5b505af11580156106da573d6000803e3d6000fd5b505060cb546040517fbb7fde710000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063bb7fde71915061072f90859085908b908a908a9060040161256e565b600060405180830381600087803b15801561074957600080fd5b505af115801561075d573d6000803e3d6000fd5b50505050816001600160a01b03167f293c16277edbc93bfb30f56ac279e45bbdbd421755b0278d19ebcd1cee6a795b82898988888b6040516107a4969594939291906125a8565b60405180910390a25050505050505050565b7fb696df569c2dfecb5a24edfd39d7f55b0f442be14350cbc68dbe8eb35489d3a66107e0816114ce565b60cd546001600160a01b0316636b406341876108538560cf60006108026113ae565b6001600160a01b0316815260208101919091526040016000908120805461ffff169161082d836124e3565b91906101000a81548161ffff021916908361ffff16021790555060008b60018c8c6113bd565b6040518363ffffffff1660e01b8152600401610870929190612504565b602060405180830381865afa15801561088d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b19190612526565b6108fd5760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064016105e7565b6001600160a01b038216600090815260ce602052604081208054610951918591849190829061092f9061ffff166124e3565b91906101000a81548161ffff021916908361ffff160217905560016000611481565b60cb546040517fbb7fde710000000000000000000000000000000000000000000000000000000081529192506001600160a01b03169063bb7fde71906109a390869085908b908b908b9060040161256e565b600060405180830381600087803b1580156109bd57600080fd5b505af11580156109d1573d6000803e3d6000fd5b50505050826001600160a01b03167f07560e268a00bce229c6a07c00d3f177f67674deae28b79a1840dd20712366288260008989896001604051610a1a969594939291906125e6565b60405180910390a250505050505050565b600082815260996020526040902060010154610a46816114ce565b610a5083836114e2565b505050565b610a5d6113ae565b6001600160a01b0316816001600160a01b031614610ae35760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016105e7565b610aed8282611585565b5050565b6000606080600080600060606001546000801b148015610b115750600254155b610b5d5760405162461bcd60e51b815260206004820152601560248201527f4549503731323a20556e696e697469616c697a6564000000000000000000000060448201526064016105e7565b610b65611626565b610b6d6116b8565b604080516000808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009b939a50919850469750309650945092509050565b60cd546001600160a01b0316636b4063418b610c278460cf6000610bd56113ae565b6001600160a01b0316815260208101919091526040016000908120805461ffff1691610c00836124e3565b91906101000a81548161ffff021916908361ffff1602179055508e8e8e8e8e8e8e8e6116c7565b6040518363ffffffff1660e01b8152600401610c44929190612504565b602060405180830381865afa158015610c61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c859190612526565b610cd15760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064016105e7565b878614610d205760405162461bcd60e51b815260206004820152601a60248201527f417272617973206d7573742062652073616d65206c656e67746800000000000060448201526064016105e7565b858214610d6f5760405162461bcd60e51b815260206004820152601a60248201527f417272617973206d7573742062652073616d65206c656e67746800000000000060448201526064016105e7565b818414610dbe5760405162461bcd60e51b815260206004820152601a60248201527f417272617973206d7573742062652073616d65206c656e67746800000000000060448201526064016105e7565b60008867ffffffffffffffff811115610dd957610dd9611f07565b604051908082528060200260200182016040528015610e02578160200160208202803683370190505b50905060008967ffffffffffffffff811115610e2057610e20611f07565b604051908082528060200260200182016040528015610e49578160200160208202803683370190505b50905060005b8a811015610f6e578b8b82818110610e6957610e69612610565b9050602002016020810190610e7e9190612626565b60ff16828281518110610e9357610e93612610565b602002602001018181525050610f3f848d8d84818110610eb557610eb5612610565b9050602002016020810190610eca9190612626565b6001600160a01b038716600090815260ce602052604081208054909190610ef49061ffff166124e3565b91906101000a81548161ffff021916908361ffff16021790558b8b86818110610f1f57610f1f612610565b9050602002016020810190610f349190612641565b61064757600061064a565b838281518110610f5157610f51612610565b602090810291909101015280610f668161265e565b915050610e4f565b5060cc546040517f20820ec30000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906320820ec390610fbe90869085908e908e906004016126c3565b600060405180830381600087803b158015610fd857600080fd5b505af1158015610fec573d6000803e3d6000fd5b505060cb546040517fa55784ef0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063a55784ef915061104390869086908e908e908c908c906004016127a8565b600060405180830381600087803b15801561105d57600080fd5b505af1158015611071573d6000803e3d6000fd5b50505050826001600160a01b03167fdd4b554190cbd4759e711abb655bdaf12557fea0ac84cec4fd4d978db3148bab838d8d8d8d8b8b8f8f6040516110be999897969594939291906127ff565b60405180910390a2505050505050505050505050565b600054610100900460ff16158080156110f45750600054600160ff909116105b8061110e5750303b15801561110e575060005460ff166001145b6111805760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016105e7565b6000805460ff1916600117905580156111a3576000805461ff0019166101001790555b60cb80546001600160a01b038881167fffffffffffffffffffffffff00000000000000000000000000000000000000009283161790925560cc805488841690831617905560cd805487841692169190911790556000805491851662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117905561123688886117d6565b61123e61185d565b6112496000836114e2565b801561128f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b6000828152609960205260409020600101546112b4816114ce565b610a508383611585565b60006112c9816114ce565b6001600160a01b0382166113455760405162461bcd60e51b815260206004820152603460248201527f417373657452657665616c3a207472757374656420666f72776172646572206360448201527f616e2774206265207a65726f206164647265737300000000000000000000000060648201526084016105e7565b600080547fffffffffffffffffffff0000000000000000000000000000000000000000ffff16620100006001600160a01b03851690810291909117825560405190917f871264f4293af7d2865ae7eae628b228f4991c57cb45b39c99f0b774ebe2901891a25050565b60006113b86118dc565b905090565b60006114757f3b0c69bab62d38b5774be9b5185349bf525ef97a4d288b652e29bb4ec2a4902d898989898989896040516020016113fb9291906128c4565b60408051601f198184030181528282528051602091820120908301989098526001600160a01b039096169581019590955261ffff909316606085015260ff909116608084015260a0830152151560c082015260e0810191909152610100015b60405160208183030381529060405280519060200120611925565b98975050505050505050565b60008560c883611492576000611495565b60015b60ff16901b60b88561ffff16901b60a88761ffff16901b60a08960ff16901b846001600160a01b03161717171791505095945050505050565b6114df816114da6113ae565b61196d565b50565b60008281526099602090815260408083206001600160a01b038516845290915290205460ff16610aed5760008281526099602090815260408083206001600160a01b03851684529091529020805460ff191660011790556115416113ae565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526099602090815260408083206001600160a01b038516845290915290205460ff1615610aed5760008281526099602090815260408083206001600160a01b03851684529091529020805460ff191690556115e26113ae565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b606060038054611635906128d4565b80601f0160208091040260200160405190810160405280929190818152602001828054611661906128d4565b80156116ae5780601f10611683576101008083540402835291602001916116ae565b820191906000526020600020905b81548152906001019060200180831161169157829003601f168201915b5050505050905090565b606060048054611635906128d4565b60006117c77f52955c021a90f71f7afee289089576ce6998f456ca81e444651c71363bf260958c8c8c8c60405160200161170292919061290e565b604051602081830303815290604052805190602001208b8b60405160200161172b929190612948565b604051602081830303815290604052805190602001208a8a60405160200161175492919061298a565b60408051601f19818403018152919052805160209091012061177e6117798a8c6129ba565b6119e2565b6040805160208101989098526001600160a01b039096169587019590955261ffff9093166060860152608085019190915260a084015260c083015260e08201526101000161145a565b9b9a5050505050505050505050565b600054610100900460ff166118535760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016105e7565b610aed8282611ad6565b600054610100900460ff166118da5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016105e7565b565b600080546201000090046001600160a01b0316330361192057507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b503390565b60006104ca611932611b7b565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b60008281526099602090815260408083206001600160a01b038516845290915290205460ff16610aed576119a081611b85565b6119ab836020611b97565b6040516020016119bc929190612a3e565b60408051601f198184030181529082905262461bcd60e51b82526105e791600401612abf565b600080825167ffffffffffffffff8111156119ff576119ff611f07565b604051908082528060200260200182016040528015611a28578160200160208202803683370190505b50905060005b8351811015611aa657838181518110611a4957611a49612610565b6020026020010151604051602001611a619190612ad2565b60405160208183030381529060405280519060200120828281518110611a8957611a89612610565b602090810291909101015280611a9e8161265e565b915050611a2e565b5080604051602001611ab89190612aee565b60405160208183030381529060405280519060200120915050919050565b600054610100900460ff16611b535760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016105e7565b6003611b5f8382612b72565b506004611b6c8282612b72565b50506000600181905560025550565b60006113b8611dc7565b60606104ca6001600160a01b03831660145b60606000611ba6836002612c32565b611bb1906002612c49565b67ffffffffffffffff811115611bc957611bc9611f07565b6040519080825280601f01601f191660200182016040528015611bf3576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611c2a57611c2a612610565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611c8d57611c8d612610565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611cc9846002612c32565b611cd4906001612c49565b90505b6001811115611d71577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611d1557611d15612610565b1a60f81b828281518110611d2b57611d2b612610565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611d6a81612c5c565b9050611cd7565b508315611dc05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105e7565b9392505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611df2611e3b565b611dfa611e94565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600080611e46611626565b805190915015611e5d578051602090910120919050565b6001548015611e6c5792915050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709250505090565b600080611e9f6116b8565b805190915015611eb6578051602090910120919050565b6002548015611e6c5792915050565b600060208284031215611ed757600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611dc057600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611f4657611f46611f07565b604052919050565b600082601f830112611f5f57600080fd5b813567ffffffffffffffff811115611f7957611f79611f07565b611f8c6020601f19601f84011601611f1d565b818152846020838601011115611fa157600080fd5b816020850160208301376000918101602001919091529392505050565b803560ff81168114611fcf57600080fd5b919050565b80151581146114df57600080fd5b60008083601f840112611ff457600080fd5b50813567ffffffffffffffff81111561200c57600080fd5b60208301915083602082850101111561202457600080fd5b9250929050565b80356001600160a01b0381168114611fcf57600080fd5b600080600080600080600060c0888a03121561205d57600080fd5b873567ffffffffffffffff8082111561207557600080fd5b6120818b838c01611f4e565b985061208f60208b01611fbe565b975060408a0135965060608a013591506120a882611fd4565b909450608089013590808211156120be57600080fd5b506120cb8a828b01611fe2565b90945092506120de905060a0890161202b565b905092959891949750929550565b6000602082840312156120fe57600080fd5b5035919050565b60008060008060006080868803121561211d57600080fd5b853567ffffffffffffffff8082111561213557600080fd5b61214189838a01611f4e565b965060208801359550604088013591508082111561215e57600080fd5b5061216b88828901611fe2565b909450925061217e90506060870161202b565b90509295509295909350565b6000806040838503121561219d57600080fd5b823591506121ad6020840161202b565b90509250929050565b6000602082840312156121c857600080fd5b611dc08261202b565b60005b838110156121ec5781810151838201526020016121d4565b50506000910152565b6000815180845261220d8160208601602086016121d1565b601f01601f19169290920160200192915050565b600081518084526020808501945080840160005b8381101561225157815187529582019590820190600101612235565b509495945050505050565b7fff000000000000000000000000000000000000000000000000000000000000008816815260e06020820152600061229760e08301896121f5565b82810360408401526122a981896121f5565b90508660608401526001600160a01b03861660808401528460a084015282810360c08401526122d88185612221565b9a9950505050505050505050565b60008083601f8401126122f857600080fd5b50813567ffffffffffffffff81111561231057600080fd5b6020830191508360208260051b850101111561202457600080fd5b60008060008060008060008060008060c08b8d03121561234a57600080fd5b8a3567ffffffffffffffff8082111561236257600080fd5b61236e8e838f01611f4e565b9b5060208d013591508082111561238457600080fd5b6123908e838f016122e6565b909b50995060408d01359150808211156123a957600080fd5b6123b58e838f016122e6565b909950975060608d01359150808211156123ce57600080fd5b6123da8e838f016122e6565b909750955060808d01359150808211156123f357600080fd5b506124008d828e016122e6565b9094509250612413905060a08c0161202b565b90509295989b9194979a5092959850565b600080600080600080600060e0888a03121561243f57600080fd5b873567ffffffffffffffff8082111561245757600080fd5b6124638b838c01611f4e565b985060208a013591508082111561247957600080fd5b506124868a828b01611f4e565b9650506124956040890161202b565b94506124a36060890161202b565b93506124b16080890161202b565b92506124bf60a0890161202b565b91506120de60c0890161202b565b634e487b7160e01b600052601160045260246000fd5b600061ffff8083168181036124fa576124fa6124cd565b6001019392505050565b60408152600061251760408301856121f5565b90508260208301529392505050565b60006020828403121561253857600080fd5b8151611dc081611fd4565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b6001600160a01b038616815284602082015283604082015260806060820152600061259d608083018486612543565b979650505050505050565b86815260ff8616602082015284604082015260a0606082015260006125d160a083018587612543565b90508215156080830152979650505050505050565b86815261ffff8616602082015284604082015260a0606082015260006125d160a083018587612543565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561263857600080fd5b611dc082611fbe565b60006020828403121561265357600080fd5b8135611dc081611fd4565b60006000198203612671576126716124cd565b5060010190565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8311156126aa57600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b03851681526060602082015260006126e56060830186612221565b828103604084015261259d818587612678565b81835260006020808501808196508560051b810191508460005b8781101561279b57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe188360301811261275157600080fd5b8701858101903567ffffffffffffffff81111561276d57600080fd5b80360382131561277c57600080fd5b612787868284612543565b9a87019a9550505090840190600101612712565b5091979650505050505050565b6001600160a01b03871681526080602082015260006127ca6080830188612221565b82810360408401526127dd818789612678565b905082810360608401526127f28185876126f8565b9998505050505050505050565b60a08152600061281260a083018c612221565b8281036020848101919091528a82528b91810160005b8c81101561284e5760ff61283b85611fbe565b1682529282019290820190600101612828565b508481036040860152612862818b8d612678565b925050838203606085015261287882888a6126f8565b8481036080860152858152869250810160005b868110156128b257833561289e81611fd4565b15158252928201929082019060010161288b565b509d9c50505050505050505050505050565b8183823760009101908152919050565b600181811c908216806128e857607f821691505b60208210810361290857634e487b7160e01b600052602260045260246000fd5b50919050565b60008184825b8581101561293d5760ff61292783611fbe565b1683526020928301929190910190600101612914565b509095945050505050565b60007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561297757600080fd5b8260051b80858437919091019392505050565b60008184825b8581101561293d5781356129a381611fd4565b151583526020928301929190910190600101612990565b600067ffffffffffffffff808411156129d5576129d5611f07565b8360051b60206129e6818301611f1d565b8681529185019181810190368411156129fe57600080fd5b865b84811015612a3257803586811115612a185760008081fd5b612a2436828b01611f4e565b845250918301918301612a00565b50979650505050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612a768160178501602088016121d1565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612ab38160288401602088016121d1565b01602801949350505050565b602081526000611dc060208301846121f5565b60008251612ae48184602087016121d1565b9190910192915050565b815160009082906020808601845b83811015612b1857815185529382019390820190600101612afc565b50929695505050505050565b601f821115610a5057600081815260208120601f850160051c81016020861015612b4b5750805b601f850160051c820191505b81811015612b6a57828155600101612b57565b505050505050565b815167ffffffffffffffff811115612b8c57612b8c611f07565b612ba081612b9a84546128d4565b84612b24565b602080601f831160018114612bd55760008415612bbd5750858301515b600019600386901b1c1916600185901b178555612b6a565b600085815260208120601f198616915b82811015612c0457888601518255948401946001909101908401612be5565b5085821015612c225787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b80820281158282048414176104ca576104ca6124cd565b808201808211156104ca576104ca6124cd565b600081612c6b57612c6b6124cd565b50600019019056fea2646970667358221220459813647b978c5bbb414f1e205ce9890cc8725d440c20da4918f21ecfccea9f64736f6c63430008120033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061018d5760003560e01c806384b0196e116100e3578063d547741f1161008c578063dbd8483d11610066578063dbd8483d146103c5578063de743a72146103e9578063f76fc35e1461041057600080fd5b8063d547741f1461038e578063d5f2077c146103a1578063da742228146103b257600080fd5b8063a217fddf116100bd578063a217fddf1461035c578063c91f0c5314610364578063ce1b815f1461037757600080fd5b806384b0196e146102f557806391d14854146103105780639e7495aa1461034957600080fd5b806334dcdd521161014557806359c191e41161011f57806359c191e41461029857806374e3447a146102bd5780637caa719a146102e457600080fd5b806334dcdd521461022657806336568abe1461025d578063572b6c051461027057600080fd5b8063248a9ca311610176578063248a9ca3146101cf5780632d94a9d3146102005780632f2ff15d1461021357600080fd5b806301ffc9a7146101925780631a3101b1146101ba575b600080fd5b6101a56101a0366004611ec5565b610437565b60405190151581526020015b60405180910390f35b6101cd6101c8366004612042565b6104d0565b005b6101f26101dd3660046120ec565b60009081526099602052604090206001015490565b6040519081526020016101b1565b6101cd61020e366004612105565b6107b6565b6101cd61022136600461218a565b610a2b565b61024a6102343660046121b6565b60ce6020526000908152604090205461ffff1681565b60405161ffff90911681526020016101b1565b6101cd61026b36600461218a565b610a55565b6101a561027e3660046121b6565b6000546201000090046001600160a01b0390811691161490565b60cb546001600160a01b03165b6040516001600160a01b0390911681526020016101b1565b6101f27fb696df569c2dfecb5a24edfd39d7f55b0f442be14350cbc68dbe8eb35489d3a681565b60cc546001600160a01b03166102a5565b6102fd610af1565b6040516101b1979695949392919061225c565b6101a561031e36600461218a565b60009182526099602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6101cd61035736600461232b565b610bb3565b6101f2600081565b6101cd610372366004612424565b6110d4565b6000546201000090046001600160a01b03166102a5565b6101cd61039c36600461218a565b611299565b60cd546001600160a01b03166102a5565b6101cd6103c03660046121b6565b6112be565b61024a6103d33660046121b6565b60cf6020526000908152604090205461ffff1681565b6101f27f52955c021a90f71f7afee289089576ce6998f456ca81e444651c71363bf2609581565b6101f27f3b0c69bab62d38b5774be9b5185349bf525ef97a4d288b652e29bb4ec2a4902d81565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806104ca57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60cd546001600160a01b0316636b406341886105418460cf60006104f26113ae565b6001600160a01b0316815260208101919091526040016000908120805461ffff169161051d836124e3565b91906101000a81548161ffff021916908361ffff1602179055508b8b8b8b8b6113bd565b6040518363ffffffff1660e01b815260040161055e929190612504565b602060405180830381865afa15801561057b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059f9190612526565b6105f05760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064015b60405180910390fd5b6001600160a01b038116600090815260ce6020526040812080546106549184918a919085906106229061ffff166124e3565b91906101000a81548161ffff021916908361ffff16021790558861064757600061064a565b60015b60ff166000611481565b60cc546040517f124d91e50000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015260ff8b166024830152604482018a905292935091169063124d91e590606401600060405180830381600087803b1580156106c657600080fd5b505af11580156106da573d6000803e3d6000fd5b505060cb546040517fbb7fde710000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063bb7fde71915061072f90859085908b908a908a9060040161256e565b600060405180830381600087803b15801561074957600080fd5b505af115801561075d573d6000803e3d6000fd5b50505050816001600160a01b03167f293c16277edbc93bfb30f56ac279e45bbdbd421755b0278d19ebcd1cee6a795b82898988888b6040516107a4969594939291906125a8565b60405180910390a25050505050505050565b7fb696df569c2dfecb5a24edfd39d7f55b0f442be14350cbc68dbe8eb35489d3a66107e0816114ce565b60cd546001600160a01b0316636b406341876108538560cf60006108026113ae565b6001600160a01b0316815260208101919091526040016000908120805461ffff169161082d836124e3565b91906101000a81548161ffff021916908361ffff16021790555060008b60018c8c6113bd565b6040518363ffffffff1660e01b8152600401610870929190612504565b602060405180830381865afa15801561088d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b19190612526565b6108fd5760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064016105e7565b6001600160a01b038216600090815260ce602052604081208054610951918591849190829061092f9061ffff166124e3565b91906101000a81548161ffff021916908361ffff160217905560016000611481565b60cb546040517fbb7fde710000000000000000000000000000000000000000000000000000000081529192506001600160a01b03169063bb7fde71906109a390869085908b908b908b9060040161256e565b600060405180830381600087803b1580156109bd57600080fd5b505af11580156109d1573d6000803e3d6000fd5b50505050826001600160a01b03167f07560e268a00bce229c6a07c00d3f177f67674deae28b79a1840dd20712366288260008989896001604051610a1a969594939291906125e6565b60405180910390a250505050505050565b600082815260996020526040902060010154610a46816114ce565b610a5083836114e2565b505050565b610a5d6113ae565b6001600160a01b0316816001600160a01b031614610ae35760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016105e7565b610aed8282611585565b5050565b6000606080600080600060606001546000801b148015610b115750600254155b610b5d5760405162461bcd60e51b815260206004820152601560248201527f4549503731323a20556e696e697469616c697a6564000000000000000000000060448201526064016105e7565b610b65611626565b610b6d6116b8565b604080516000808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009b939a50919850469750309650945092509050565b60cd546001600160a01b0316636b4063418b610c278460cf6000610bd56113ae565b6001600160a01b0316815260208101919091526040016000908120805461ffff1691610c00836124e3565b91906101000a81548161ffff021916908361ffff1602179055508e8e8e8e8e8e8e8e6116c7565b6040518363ffffffff1660e01b8152600401610c44929190612504565b602060405180830381865afa158015610c61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c859190612526565b610cd15760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064016105e7565b878614610d205760405162461bcd60e51b815260206004820152601a60248201527f417272617973206d7573742062652073616d65206c656e67746800000000000060448201526064016105e7565b858214610d6f5760405162461bcd60e51b815260206004820152601a60248201527f417272617973206d7573742062652073616d65206c656e67746800000000000060448201526064016105e7565b818414610dbe5760405162461bcd60e51b815260206004820152601a60248201527f417272617973206d7573742062652073616d65206c656e67746800000000000060448201526064016105e7565b60008867ffffffffffffffff811115610dd957610dd9611f07565b604051908082528060200260200182016040528015610e02578160200160208202803683370190505b50905060008967ffffffffffffffff811115610e2057610e20611f07565b604051908082528060200260200182016040528015610e49578160200160208202803683370190505b50905060005b8a811015610f6e578b8b82818110610e6957610e69612610565b9050602002016020810190610e7e9190612626565b60ff16828281518110610e9357610e93612610565b602002602001018181525050610f3f848d8d84818110610eb557610eb5612610565b9050602002016020810190610eca9190612626565b6001600160a01b038716600090815260ce602052604081208054909190610ef49061ffff166124e3565b91906101000a81548161ffff021916908361ffff16021790558b8b86818110610f1f57610f1f612610565b9050602002016020810190610f349190612641565b61064757600061064a565b838281518110610f5157610f51612610565b602090810291909101015280610f668161265e565b915050610e4f565b5060cc546040517f20820ec30000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906320820ec390610fbe90869085908e908e906004016126c3565b600060405180830381600087803b158015610fd857600080fd5b505af1158015610fec573d6000803e3d6000fd5b505060cb546040517fa55784ef0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063a55784ef915061104390869086908e908e908c908c906004016127a8565b600060405180830381600087803b15801561105d57600080fd5b505af1158015611071573d6000803e3d6000fd5b50505050826001600160a01b03167fdd4b554190cbd4759e711abb655bdaf12557fea0ac84cec4fd4d978db3148bab838d8d8d8d8b8b8f8f6040516110be999897969594939291906127ff565b60405180910390a2505050505050505050505050565b600054610100900460ff16158080156110f45750600054600160ff909116105b8061110e5750303b15801561110e575060005460ff166001145b6111805760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016105e7565b6000805460ff1916600117905580156111a3576000805461ff0019166101001790555b60cb80546001600160a01b038881167fffffffffffffffffffffffff00000000000000000000000000000000000000009283161790925560cc805488841690831617905560cd805487841692169190911790556000805491851662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117905561123688886117d6565b61123e61185d565b6112496000836114e2565b801561128f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b6000828152609960205260409020600101546112b4816114ce565b610a508383611585565b60006112c9816114ce565b6001600160a01b0382166113455760405162461bcd60e51b815260206004820152603460248201527f417373657452657665616c3a207472757374656420666f72776172646572206360448201527f616e2774206265207a65726f206164647265737300000000000000000000000060648201526084016105e7565b600080547fffffffffffffffffffff0000000000000000000000000000000000000000ffff16620100006001600160a01b03851690810291909117825560405190917f871264f4293af7d2865ae7eae628b228f4991c57cb45b39c99f0b774ebe2901891a25050565b60006113b86118dc565b905090565b60006114757f3b0c69bab62d38b5774be9b5185349bf525ef97a4d288b652e29bb4ec2a4902d898989898989896040516020016113fb9291906128c4565b60408051601f198184030181528282528051602091820120908301989098526001600160a01b039096169581019590955261ffff909316606085015260ff909116608084015260a0830152151560c082015260e0810191909152610100015b60405160208183030381529060405280519060200120611925565b98975050505050505050565b60008560c883611492576000611495565b60015b60ff16901b60b88561ffff16901b60a88761ffff16901b60a08960ff16901b846001600160a01b03161717171791505095945050505050565b6114df816114da6113ae565b61196d565b50565b60008281526099602090815260408083206001600160a01b038516845290915290205460ff16610aed5760008281526099602090815260408083206001600160a01b03851684529091529020805460ff191660011790556115416113ae565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526099602090815260408083206001600160a01b038516845290915290205460ff1615610aed5760008281526099602090815260408083206001600160a01b03851684529091529020805460ff191690556115e26113ae565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b606060038054611635906128d4565b80601f0160208091040260200160405190810160405280929190818152602001828054611661906128d4565b80156116ae5780601f10611683576101008083540402835291602001916116ae565b820191906000526020600020905b81548152906001019060200180831161169157829003601f168201915b5050505050905090565b606060048054611635906128d4565b60006117c77f52955c021a90f71f7afee289089576ce6998f456ca81e444651c71363bf260958c8c8c8c60405160200161170292919061290e565b604051602081830303815290604052805190602001208b8b60405160200161172b929190612948565b604051602081830303815290604052805190602001208a8a60405160200161175492919061298a565b60408051601f19818403018152919052805160209091012061177e6117798a8c6129ba565b6119e2565b6040805160208101989098526001600160a01b039096169587019590955261ffff9093166060860152608085019190915260a084015260c083015260e08201526101000161145a565b9b9a5050505050505050505050565b600054610100900460ff166118535760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016105e7565b610aed8282611ad6565b600054610100900460ff166118da5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016105e7565b565b600080546201000090046001600160a01b0316330361192057507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b503390565b60006104ca611932611b7b565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b60008281526099602090815260408083206001600160a01b038516845290915290205460ff16610aed576119a081611b85565b6119ab836020611b97565b6040516020016119bc929190612a3e565b60408051601f198184030181529082905262461bcd60e51b82526105e791600401612abf565b600080825167ffffffffffffffff8111156119ff576119ff611f07565b604051908082528060200260200182016040528015611a28578160200160208202803683370190505b50905060005b8351811015611aa657838181518110611a4957611a49612610565b6020026020010151604051602001611a619190612ad2565b60405160208183030381529060405280519060200120828281518110611a8957611a89612610565b602090810291909101015280611a9e8161265e565b915050611a2e565b5080604051602001611ab89190612aee565b60405160208183030381529060405280519060200120915050919050565b600054610100900460ff16611b535760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016105e7565b6003611b5f8382612b72565b506004611b6c8282612b72565b50506000600181905560025550565b60006113b8611dc7565b60606104ca6001600160a01b03831660145b60606000611ba6836002612c32565b611bb1906002612c49565b67ffffffffffffffff811115611bc957611bc9611f07565b6040519080825280601f01601f191660200182016040528015611bf3576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611c2a57611c2a612610565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611c8d57611c8d612610565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611cc9846002612c32565b611cd4906001612c49565b90505b6001811115611d71577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611d1557611d15612610565b1a60f81b828281518110611d2b57611d2b612610565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611d6a81612c5c565b9050611cd7565b508315611dc05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105e7565b9392505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611df2611e3b565b611dfa611e94565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600080611e46611626565b805190915015611e5d578051602090910120919050565b6001548015611e6c5792915050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709250505090565b600080611e9f6116b8565b805190915015611eb6578051602090910120919050565b6002548015611e6c5792915050565b600060208284031215611ed757600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611dc057600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611f4657611f46611f07565b604052919050565b600082601f830112611f5f57600080fd5b813567ffffffffffffffff811115611f7957611f79611f07565b611f8c6020601f19601f84011601611f1d565b818152846020838601011115611fa157600080fd5b816020850160208301376000918101602001919091529392505050565b803560ff81168114611fcf57600080fd5b919050565b80151581146114df57600080fd5b60008083601f840112611ff457600080fd5b50813567ffffffffffffffff81111561200c57600080fd5b60208301915083602082850101111561202457600080fd5b9250929050565b80356001600160a01b0381168114611fcf57600080fd5b600080600080600080600060c0888a03121561205d57600080fd5b873567ffffffffffffffff8082111561207557600080fd5b6120818b838c01611f4e565b985061208f60208b01611fbe565b975060408a0135965060608a013591506120a882611fd4565b909450608089013590808211156120be57600080fd5b506120cb8a828b01611fe2565b90945092506120de905060a0890161202b565b905092959891949750929550565b6000602082840312156120fe57600080fd5b5035919050565b60008060008060006080868803121561211d57600080fd5b853567ffffffffffffffff8082111561213557600080fd5b61214189838a01611f4e565b965060208801359550604088013591508082111561215e57600080fd5b5061216b88828901611fe2565b909450925061217e90506060870161202b565b90509295509295909350565b6000806040838503121561219d57600080fd5b823591506121ad6020840161202b565b90509250929050565b6000602082840312156121c857600080fd5b611dc08261202b565b60005b838110156121ec5781810151838201526020016121d4565b50506000910152565b6000815180845261220d8160208601602086016121d1565b601f01601f19169290920160200192915050565b600081518084526020808501945080840160005b8381101561225157815187529582019590820190600101612235565b509495945050505050565b7fff000000000000000000000000000000000000000000000000000000000000008816815260e06020820152600061229760e08301896121f5565b82810360408401526122a981896121f5565b90508660608401526001600160a01b03861660808401528460a084015282810360c08401526122d88185612221565b9a9950505050505050505050565b60008083601f8401126122f857600080fd5b50813567ffffffffffffffff81111561231057600080fd5b6020830191508360208260051b850101111561202457600080fd5b60008060008060008060008060008060c08b8d03121561234a57600080fd5b8a3567ffffffffffffffff8082111561236257600080fd5b61236e8e838f01611f4e565b9b5060208d013591508082111561238457600080fd5b6123908e838f016122e6565b909b50995060408d01359150808211156123a957600080fd5b6123b58e838f016122e6565b909950975060608d01359150808211156123ce57600080fd5b6123da8e838f016122e6565b909750955060808d01359150808211156123f357600080fd5b506124008d828e016122e6565b9094509250612413905060a08c0161202b565b90509295989b9194979a5092959850565b600080600080600080600060e0888a03121561243f57600080fd5b873567ffffffffffffffff8082111561245757600080fd5b6124638b838c01611f4e565b985060208a013591508082111561247957600080fd5b506124868a828b01611f4e565b9650506124956040890161202b565b94506124a36060890161202b565b93506124b16080890161202b565b92506124bf60a0890161202b565b91506120de60c0890161202b565b634e487b7160e01b600052601160045260246000fd5b600061ffff8083168181036124fa576124fa6124cd565b6001019392505050565b60408152600061251760408301856121f5565b90508260208301529392505050565b60006020828403121561253857600080fd5b8151611dc081611fd4565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b6001600160a01b038616815284602082015283604082015260806060820152600061259d608083018486612543565b979650505050505050565b86815260ff8616602082015284604082015260a0606082015260006125d160a083018587612543565b90508215156080830152979650505050505050565b86815261ffff8616602082015284604082015260a0606082015260006125d160a083018587612543565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561263857600080fd5b611dc082611fbe565b60006020828403121561265357600080fd5b8135611dc081611fd4565b60006000198203612671576126716124cd565b5060010190565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8311156126aa57600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b03851681526060602082015260006126e56060830186612221565b828103604084015261259d818587612678565b81835260006020808501808196508560051b810191508460005b8781101561279b57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe188360301811261275157600080fd5b8701858101903567ffffffffffffffff81111561276d57600080fd5b80360382131561277c57600080fd5b612787868284612543565b9a87019a9550505090840190600101612712565b5091979650505050505050565b6001600160a01b03871681526080602082015260006127ca6080830188612221565b82810360408401526127dd818789612678565b905082810360608401526127f28185876126f8565b9998505050505050505050565b60a08152600061281260a083018c612221565b8281036020848101919091528a82528b91810160005b8c81101561284e5760ff61283b85611fbe565b1682529282019290820190600101612828565b508481036040860152612862818b8d612678565b925050838203606085015261287882888a6126f8565b8481036080860152858152869250810160005b868110156128b257833561289e81611fd4565b15158252928201929082019060010161288b565b509d9c50505050505050505050505050565b8183823760009101908152919050565b600181811c908216806128e857607f821691505b60208210810361290857634e487b7160e01b600052602260045260246000fd5b50919050565b60008184825b8581101561293d5760ff61292783611fbe565b1683526020928301929190910190600101612914565b509095945050505050565b60007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561297757600080fd5b8260051b80858437919091019392505050565b60008184825b8581101561293d5781356129a381611fd4565b151583526020928301929190910190600101612990565b600067ffffffffffffffff808411156129d5576129d5611f07565b8360051b60206129e6818301611f1d565b8681529185019181810190368411156129fe57600080fd5b865b84811015612a3257803586811115612a185760008081fd5b612a2436828b01611f4e565b845250918301918301612a00565b50979650505050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612a768160178501602088016121d1565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612ab38160288401602088016121d1565b01602801949350505050565b602081526000611dc060208301846121f5565b60008251612ae48184602087016121d1565b9190910192915050565b815160009082906020808601845b83811015612b1857815185529382019390820190600101612afc565b50929695505050505050565b601f821115610a5057600081815260208120601f850160051c81016020861015612b4b5750805b601f850160051c820191505b81811015612b6a57828155600101612b57565b505050505050565b815167ffffffffffffffff811115612b8c57612b8c611f07565b612ba081612b9a84546128d4565b84612b24565b602080601f831160018114612bd55760008415612bbd5750858301515b600019600386901b1c1916600185901b178555612b6a565b600085815260208120601f198616915b82811015612c0457888601518255948401946001909101908401612be5565b5085821015612c225787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b80820281158282048414176104ca576104ca6124cd565b808201808211156104ca576104ca6124cd565b600081612c6b57612c6b6124cd565b50600019019056fea2646970667358221220459813647b978c5bbb414f1e205ce9890cc8725d440c20da4918f21ecfccea9f64736f6c63430008120033", + "solcInputHash": "6f473f7e77d584cdbb9fe0c91f28e82a", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint8[]\",\"name\":\"tiers\",\"type\":\"uint8[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"string[]\",\"name\":\"metadataHashes\",\"type\":\"string[]\"},{\"indexed\":false,\"internalType\":\"bool[]\",\"name\":\"revealed\",\"type\":\"bool[]\"}],\"name\":\"AssetBatchMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"tier\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"metadataHash\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"revealed\",\"type\":\"bool\"}],\"name\":\"AssetMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"tier\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"metadataHash\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"revealed\",\"type\":\"bool\"}],\"name\":\"SpecialAssetMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newTrustedForwarderAddress\",\"type\":\"address\"}],\"name\":\"TrustedForwarderChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldTrustedForwarder\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newTrustedForwarder\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"TrustedForwarderSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_BATCH_TYPEHASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_TYPEHASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SPECIAL_MINTER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"tier\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"revealed\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"metadataHash\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"}],\"name\":\"createAsset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"uint8[]\",\"name\":\"tiers\",\"type\":\"uint8[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bool[]\",\"name\":\"revealed\",\"type\":\"bool[]\"},{\"internalType\":\"string[]\",\"name\":\"metadataHashes\",\"type\":\"string[]\"},{\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"}],\"name\":\"createMultipleAssets\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"metadataHash\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"}],\"name\":\"createSpecialAsset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"creatorNonces\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAssetContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAuthValidator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCatalystContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTrustedForwarder\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_version\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_assetContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_catalystContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_authValidator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_forwarder\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_defaultAdmin\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"}],\"name\":\"isTrustedForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"name\":\"setTrustedForwarder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"signatureNonces\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"The Sandbox\",\"events\":{\"EIP712DomainChanged()\":{\"details\":\"MAY be emitted to signal that the domain could have changed.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"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._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"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`)\"},\"TrustedForwarderSet(address,address,address)\":{\"params\":{\"newTrustedForwarder\":\"new trusted forwarder\",\"oldTrustedForwarder\":\"old trusted forwarder\",\"operator\":\"the sender of the transaction\"}}},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"createAsset(bytes,uint8,uint256,bool,string,address)\":{\"params\":{\"amount\":\"The amount of the asset to mint\",\"metadataHash\":\"The metadata hash of the asset to mint\",\"signature\":\"A signature generated by TSB\",\"tier\":\"The tier of the asset to mint\"}},\"createMultipleAssets(bytes,uint8[],uint256[],bool[],string[],address)\":{\"params\":{\"amounts\":\"The amounts of the assets to mint\",\"metadataHashes\":\"The metadata hashes of the assets to mint\",\"signature\":\"A signature generated by TSB\",\"tiers\":\"The tiers of the assets to mint\"}},\"createSpecialAsset(bytes,uint256,string,address)\":{\"details\":\"Only callable by the special minter\",\"params\":{\"amount\":\"The amount of the asset to mint\",\"creator\":\"The address of the creator\",\"metadataHash\":\"The metadata hash of the asset to mint,\",\"signature\":\"A signature generated by TSB\"}},\"eip712Domain()\":{\"details\":\"See {EIP-5267}. _Available since v4.9._\"},\"getAssetContract()\":{\"returns\":{\"_0\":\"The asset contract address\"}},\"getAuthValidator()\":{\"returns\":{\"_0\":\"The auth validator address\"}},\"getCatalystContract()\":{\"returns\":{\"_0\":\"The catalyst contract address\"}},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getTrustedForwarder()\":{\"returns\":{\"_0\":\"return the address of the trusted forwarder\"}},\"grantRole(bytes32,address)\":{\"details\":\"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.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"initialize(string,string,address,address,address,address,address)\":{\"params\":{\"_assetContract\":\"The address of the asset contract\",\"_authValidator\":\"The address of the AuthSuperValidator contract\",\"_forwarder\":\"The address of the forwarder contract\"}},\"isTrustedForwarder(address)\":{\"params\":{\"forwarder\":\"trusted forwarder address to check\"},\"returns\":{\"_0\":\"true if the address is the same as the trusted forwarder\"}},\"renounceRole(bytes32,address)\":{\"details\":\"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.\"},\"revokeRole(bytes32,address)\":{\"details\":\"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.\"},\"setTrustedForwarder(address)\":{\"details\":\"Change the address of the trusted forwarder for meta-TX\",\"params\":{\"trustedForwarder\":\"The new trustedForwarder\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"title\":\"AssetCreate\",\"version\":1},\"userdoc\":{\"events\":{\"TrustedForwarderSet(address,address,address)\":{\"notice\":\"Emitted when a `newTrustedForwarder` is set, replacing the `oldTrustedForwarder`\"}},\"kind\":\"user\",\"methods\":{\"createAsset(bytes,uint8,uint256,bool,string,address)\":{\"notice\":\"Create a new asset\"},\"createMultipleAssets(bytes,uint8[],uint256[],bool[],string[],address)\":{\"notice\":\"Create multiple assets at once\"},\"createSpecialAsset(bytes,uint256,string,address)\":{\"notice\":\"Create special assets, like TSB exclusive tokens\"},\"getAssetContract()\":{\"notice\":\"Get the asset contract address\"},\"getAuthValidator()\":{\"notice\":\"Get the auth validator address\"},\"getCatalystContract()\":{\"notice\":\"Get the catalyst contract address\"},\"getTrustedForwarder()\":{\"notice\":\"return the address of the trusted forwarder\"},\"initialize(string,string,address,address,address,address,address)\":{\"notice\":\"Initialize the contract\"},\"isTrustedForwarder(address)\":{\"notice\":\"return true if the forwarder is the trusted forwarder\"},\"setTrustedForwarder(address)\":{\"notice\":\"Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\"}},\"notice\":\"User-facing contract for creating new assets\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"@sandbox-smart-contracts/asset/contracts/AssetCreate.sol\":\"AssetCreate\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlUpgradeable.sol\\\";\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\\n function __AccessControl_init() internal onlyInitializing {\\n }\\n\\n function __AccessControl_init_unchained() internal onlyInitializing {\\n }\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n StringsUpgradeable.toHexString(account),\\n \\\" is missing role \\\",\\n StringsUpgradeable.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xfeefb24d068524440e1ba885efdf105d91f83504af3c2d745ffacc4595396831\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControlUpgradeable {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0xb8f5302f12138c5561362e88a78d061573e6298b7a1a5afe84a1e2c8d4d5aeaa\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC5267Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\\n\\npragma solidity ^0.8.0;\\n\\ninterface IERC5267Upgradeable {\\n /**\\n * @dev MAY be emitted to signal that the domain could have changed.\\n */\\n event EIP712DomainChanged();\\n\\n /**\\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\\n * signature.\\n */\\n function eip712Domain()\\n external\\n view\\n returns (\\n bytes1 fields,\\n string memory name,\\n string memory version,\\n uint256 chainId,\\n address verifyingContract,\\n bytes32 salt,\\n uint256[] memory extensions\\n );\\n}\\n\",\"keccak256\":\"0xe562dab443278837fa50faddb76743399e942181881db8dccaea3bd1712994db\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized != type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../StringsUpgradeable.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSAUpgradeable {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\")\\n mstore(0x1c, hash)\\n message := keccak256(0x00, 0x3c)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", StringsUpgradeable.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, \\\"\\\\x19\\\\x01\\\")\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n data := keccak256(ptr, 0x42)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\\n * `validator` and `data` according to the version 0 of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x00\\\", validator, data));\\n }\\n}\\n\",\"keccak256\":\"0xa014f65d84b02827055d99993ccdbfb4b56b2c9e91eb278d82a93330659d06e4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.8;\\n\\nimport \\\"./ECDSAUpgradeable.sol\\\";\\nimport \\\"../../interfaces/IERC5267Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\\n *\\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\\n *\\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\\n * ({_hashTypedDataV4}).\\n *\\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\\n * the chain id to protect against replay attacks on an eventual fork of the chain.\\n *\\n * NOTE: This contract implements the version of the encoding known as \\\"v4\\\", as implemented by the JSON RPC method\\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\\n *\\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\\n *\\n * _Available since v3.4._\\n *\\n * @custom:storage-size 52\\n */\\nabstract contract EIP712Upgradeable is Initializable, IERC5267Upgradeable {\\n bytes32 private constant _TYPE_HASH =\\n keccak256(\\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\");\\n\\n /// @custom:oz-renamed-from _HASHED_NAME\\n bytes32 private _hashedName;\\n /// @custom:oz-renamed-from _HASHED_VERSION\\n bytes32 private _hashedVersion;\\n\\n string private _name;\\n string private _version;\\n\\n /**\\n * @dev Initializes the domain separator and parameter caches.\\n *\\n * The meaning of `name` and `version` is specified in\\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\\n *\\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\\n * - `version`: the current major version of the signing domain.\\n *\\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\\n * contract upgrade].\\n */\\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\\n __EIP712_init_unchained(name, version);\\n }\\n\\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\\n _name = name;\\n _version = version;\\n\\n // Reset prior values in storage if upgrading\\n _hashedName = 0;\\n _hashedVersion = 0;\\n }\\n\\n /**\\n * @dev Returns the domain separator for the current chain.\\n */\\n function _domainSeparatorV4() internal view returns (bytes32) {\\n return _buildDomainSeparator();\\n }\\n\\n function _buildDomainSeparator() private view returns (bytes32) {\\n return keccak256(abi.encode(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this)));\\n }\\n\\n /**\\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\\n * function returns the hash of the fully encoded EIP712 message for this domain.\\n *\\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\\n *\\n * ```solidity\\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\\n * keccak256(\\\"Mail(address to,string contents)\\\"),\\n * mailTo,\\n * keccak256(bytes(mailContents))\\n * )));\\n * address signer = ECDSA.recover(digest, signature);\\n * ```\\n */\\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n\\n /**\\n * @dev See {EIP-5267}.\\n *\\n * _Available since v4.9._\\n */\\n function eip712Domain()\\n public\\n view\\n virtual\\n override\\n returns (\\n bytes1 fields,\\n string memory name,\\n string memory version,\\n uint256 chainId,\\n address verifyingContract,\\n bytes32 salt,\\n uint256[] memory extensions\\n )\\n {\\n // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized\\n // and the EIP712 domain is not reliable, as it will be missing name and version.\\n require(_hashedName == 0 && _hashedVersion == 0, \\\"EIP712: Uninitialized\\\");\\n\\n return (\\n hex\\\"0f\\\", // 01111\\n _EIP712Name(),\\n _EIP712Version(),\\n block.chainid,\\n address(this),\\n bytes32(0),\\n new uint256[](0)\\n );\\n }\\n\\n /**\\n * @dev The name parameter for the EIP712 domain.\\n *\\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\\n * are a concern.\\n */\\n function _EIP712Name() internal virtual view returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev The version parameter for the EIP712 domain.\\n *\\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\\n * are a concern.\\n */\\n function _EIP712Version() internal virtual view returns (string memory) {\\n return _version;\\n }\\n\\n /**\\n * @dev The hash of the name parameter for the EIP712 domain.\\n *\\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.\\n */\\n function _EIP712NameHash() internal view returns (bytes32) {\\n string memory name = _EIP712Name();\\n if (bytes(name).length > 0) {\\n return keccak256(bytes(name));\\n } else {\\n // If the name is empty, the contract may have been upgraded without initializing the new storage.\\n // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.\\n bytes32 hashedName = _hashedName;\\n if (hashedName != 0) {\\n return hashedName;\\n } else {\\n return keccak256(\\\"\\\");\\n }\\n }\\n }\\n\\n /**\\n * @dev The hash of the version parameter for the EIP712 domain.\\n *\\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.\\n */\\n function _EIP712VersionHash() internal view returns (bytes32) {\\n string memory version = _EIP712Version();\\n if (bytes(version).length > 0) {\\n return keccak256(bytes(version));\\n } else {\\n // If the version is empty, the contract may have been upgraded without initializing the new storage.\\n // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.\\n bytes32 hashedVersion = _hashedVersion;\\n if (hashedVersion != 0) {\\n return hashedVersion;\\n } else {\\n return keccak256(\\\"\\\");\\n }\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[48] private __gap;\\n}\\n\",\"keccak256\":\"0xeb8d6be406a373771724922eb41b5d593bc8e2dc705daa22cd1145cfc8f5a3a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary MathUpgradeable {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(account),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0dd6e52cb394d7f5abe5dca2d4908a6be40417914720932de757de34a99ab87f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\")\\n mstore(0x1c, hash)\\n message := keccak256(0x00, 0x3c)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, \\\"\\\\x19\\\\x01\\\")\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n data := keccak256(ptr, 0x42)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\\n * `validator` and `data` according to the version 0 of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x00\\\", validator, data));\\n }\\n}\\n\",\"keccak256\":\"0x809bc3edb4bcbef8263fa616c1b60ee0004b50a8a1bfa164d8f57fd31f520c58\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/AssetCreate.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {EIP712Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\\\";\\nimport {\\n AccessControlUpgradeable,\\n ContextUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\\\";\\nimport {TokenIdUtils} from \\\"./libraries/TokenIdUtils.sol\\\";\\nimport {AuthSuperValidator} from \\\"./AuthSuperValidator.sol\\\";\\nimport {\\n ERC2771HandlerUpgradeable,\\n ERC2771HandlerAbstract\\n} from \\\"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\\\";\\nimport {IAsset} from \\\"./interfaces/IAsset.sol\\\";\\nimport {ICatalyst} from \\\"./interfaces/ICatalyst.sol\\\";\\nimport {IAssetCreate} from \\\"./interfaces/IAssetCreate.sol\\\";\\n\\n/// @title AssetCreate\\n/// @author The Sandbox\\n/// @notice User-facing contract for creating new assets\\ncontract AssetCreate is\\n IAssetCreate,\\n Initializable,\\n ERC2771HandlerUpgradeable,\\n EIP712Upgradeable,\\n AccessControlUpgradeable\\n{\\n using TokenIdUtils for uint256;\\n\\n IAsset private assetContract;\\n ICatalyst private catalystContract;\\n AuthSuperValidator private authValidator;\\n\\n // mapping of creator address to creator nonce, a nonce is incremented every time a creator mints a new token\\n mapping(address => uint16) public creatorNonces;\\n mapping(address => uint16) public signatureNonces;\\n\\n bytes32 public constant SPECIAL_MINTER_ROLE = keccak256(\\\"SPECIAL_MINTER_ROLE\\\");\\n bytes32 public constant MINT_TYPEHASH =\\n keccak256(\\\"Mint(address creator,uint16 nonce,uint8 tier,uint256 amount,bool revealed,string metadataHash)\\\");\\n bytes32 public constant MINT_BATCH_TYPEHASH =\\n keccak256(\\n \\\"MintBatch(address creator,uint16 nonce,uint8[] tiers,uint256[] amounts,bool[] revealed,string[] metadataHashes)\\\"\\n );\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /// @notice Initialize the contract\\n /// @param _assetContract The address of the asset contract\\n /// @param _authValidator The address of the AuthSuperValidator contract\\n /// @param _forwarder The address of the forwarder contract\\n function initialize(\\n string memory _name,\\n string memory _version,\\n address _assetContract,\\n address _catalystContract,\\n address _authValidator,\\n address _forwarder,\\n address _defaultAdmin\\n ) public initializer {\\n assetContract = IAsset(_assetContract);\\n catalystContract = ICatalyst(_catalystContract);\\n authValidator = AuthSuperValidator(_authValidator);\\n __ERC2771Handler_init(_forwarder);\\n __EIP712_init(_name, _version);\\n __AccessControl_init();\\n _grantRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);\\n }\\n\\n /// @notice Create a new asset\\n /// @param signature A signature generated by TSB\\n /// @param tier The tier of the asset to mint\\n /// @param amount The amount of the asset to mint\\n /// @param metadataHash The metadata hash of the asset to mint\\n function createAsset(\\n bytes memory signature,\\n uint8 tier,\\n uint256 amount,\\n bool revealed,\\n string calldata metadataHash,\\n address creator\\n ) external {\\n require(\\n authValidator.verify(\\n signature,\\n _hashMint(creator, signatureNonces[_msgSender()]++, tier, amount, revealed, metadataHash)\\n ),\\n \\\"Invalid signature\\\"\\n );\\n\\n uint256 tokenId =\\n TokenIdUtils.generateTokenId(creator, tier, ++creatorNonces[creator], revealed ? 1 : 0, false);\\n\\n // burn catalyst of a given tier\\n catalystContract.burnFrom(creator, tier, amount);\\n assetContract.mint(creator, tokenId, amount, metadataHash);\\n emit AssetMinted(creator, tokenId, tier, amount, metadataHash, revealed);\\n }\\n\\n /// @notice Create multiple assets at once\\n /// @param signature A signature generated by TSB\\n /// @param tiers The tiers of the assets to mint\\n /// @param amounts The amounts of the assets to mint\\n /// @param metadataHashes The metadata hashes of the assets to mint\\n function createMultipleAssets(\\n bytes memory signature,\\n uint8[] calldata tiers,\\n uint256[] calldata amounts,\\n bool[] calldata revealed,\\n string[] calldata metadataHashes,\\n address creator\\n ) external {\\n require(\\n authValidator.verify(\\n signature,\\n _hashBatchMint(creator, signatureNonces[_msgSender()]++, tiers, amounts, revealed, metadataHashes)\\n ),\\n \\\"Invalid signature\\\"\\n );\\n\\n require(tiers.length == amounts.length, \\\"Arrays must be same length\\\");\\n require(amounts.length == metadataHashes.length, \\\"Arrays must be same length\\\");\\n require(metadataHashes.length == revealed.length, \\\"Arrays must be same length\\\");\\n\\n uint256[] memory tokenIds = new uint256[](tiers.length);\\n uint256[] memory tiersToBurn = new uint256[](tiers.length);\\n for (uint256 i = 0; i < tiers.length; i++) {\\n tiersToBurn[i] = tiers[i];\\n tokenIds[i] = TokenIdUtils.generateTokenId(\\n creator,\\n tiers[i],\\n ++creatorNonces[creator],\\n revealed[i] ? 1 : 0,\\n false\\n );\\n }\\n\\n catalystContract.burnBatchFrom(creator, tiersToBurn, amounts);\\n\\n assetContract.mintBatch(creator, tokenIds, amounts, metadataHashes);\\n emit AssetBatchMinted(creator, tokenIds, tiers, amounts, metadataHashes, revealed);\\n }\\n\\n /// @notice Create special assets, like TSB exclusive tokens\\n /// @dev Only callable by the special minter\\n /// @param signature A signature generated by TSB\\n /// @param amount The amount of the asset to mint\\n /// @param metadataHash The metadata hash of the asset to mint,\\n /// @param creator The address of the creator\\n function createSpecialAsset(\\n bytes memory signature,\\n uint256 amount,\\n string calldata metadataHash,\\n address creator\\n ) external onlyRole(SPECIAL_MINTER_ROLE) {\\n require(\\n authValidator.verify(\\n signature,\\n _hashMint(creator, signatureNonces[_msgSender()]++, 0, amount, true, metadataHash)\\n ),\\n \\\"Invalid signature\\\"\\n );\\n\\n uint256 tokenId = TokenIdUtils.generateTokenId(creator, 0, ++creatorNonces[creator], 1, false);\\n\\n assetContract.mint(creator, tokenId, amount, metadataHash);\\n emit SpecialAssetMinted(creator, tokenId, 0, amount, metadataHash, true);\\n }\\n\\n /// @notice Get the asset contract address\\n /// @return The asset contract address\\n function getAssetContract() external view returns (address) {\\n return address(assetContract);\\n }\\n\\n /// @notice Get the catalyst contract address\\n /// @return The catalyst contract address\\n function getCatalystContract() external view returns (address) {\\n return address(catalystContract);\\n }\\n\\n /// @notice Get the auth validator address\\n /// @return The auth validator address\\n function getAuthValidator() external view returns (address) {\\n return address(authValidator);\\n }\\n\\n /// @notice Creates a hash of the mint data\\n /// @param creator The address of the creator\\n /// @param tier The tier of the asset\\n /// @param amount The amount of copies to mint\\n /// @param metadataHash The metadata hash of the asset\\n /// @return digest The hash of the mint data\\n function _hashMint(\\n address creator,\\n uint16 nonce,\\n uint8 tier,\\n uint256 amount,\\n bool revealed,\\n string calldata metadataHash\\n ) internal view returns (bytes32 digest) {\\n digest = _hashTypedDataV4(\\n keccak256(\\n abi.encode(\\n MINT_TYPEHASH,\\n creator,\\n nonce,\\n tier,\\n amount,\\n revealed,\\n keccak256((abi.encodePacked(metadataHash)))\\n )\\n )\\n );\\n }\\n\\n /// @notice Creates a hash of the mint batch data\\n /// @param creator The address of the creator\\n /// @param tiers The tiers of the assets\\n /// @param amounts The amounts of copies to mint\\n /// @param metadataHashes The metadata hashes of the assets\\n /// @return digest The hash of the mint batch data\\n function _hashBatchMint(\\n address creator,\\n uint16 nonce,\\n uint8[] calldata tiers,\\n uint256[] calldata amounts,\\n bool[] calldata revealed,\\n string[] calldata metadataHashes\\n ) internal view returns (bytes32 digest) {\\n digest = _hashTypedDataV4(\\n keccak256(\\n abi.encode(\\n MINT_BATCH_TYPEHASH,\\n creator,\\n nonce,\\n keccak256(abi.encodePacked(tiers)),\\n keccak256(abi.encodePacked(amounts)),\\n keccak256(abi.encodePacked(revealed)),\\n _encodeHashes(metadataHashes)\\n )\\n )\\n );\\n }\\n\\n /// @notice Encodes the hashes of the metadata for signature verification\\n /// @param metadataHashes The hashes of the metadata\\n /// @return encodedHashes The encoded hashes of the metadata\\n function _encodeHashes(string[] memory metadataHashes) internal pure returns (bytes32) {\\n bytes32[] memory encodedHashes = new bytes32[](metadataHashes.length);\\n for (uint256 i = 0; i < metadataHashes.length; i++) {\\n encodedHashes[i] = keccak256((abi.encodePacked(metadataHashes[i])));\\n }\\n\\n return keccak256(abi.encodePacked(encodedHashes));\\n }\\n\\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\\n /// @dev Change the address of the trusted forwarder for meta-TX\\n /// @param trustedForwarder The new trustedForwarder\\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n require(trustedForwarder != address(0), \\\"AssetCreate: trusted forwarder can't be zero address\\\");\\n _setTrustedForwarder(trustedForwarder);\\n }\\n\\n function _msgSender()\\n internal\\n view\\n virtual\\n override(ContextUpgradeable, ERC2771HandlerAbstract)\\n returns (address sender)\\n {\\n return ERC2771HandlerAbstract._msgSender();\\n }\\n\\n function _msgData()\\n internal\\n view\\n virtual\\n override(ContextUpgradeable, ERC2771HandlerAbstract)\\n returns (bytes calldata)\\n {\\n return ERC2771HandlerAbstract._msgData();\\n }\\n}\\n\",\"keccak256\":\"0x3a21fb7c5389d6922dba76385437fa48dd13bb54a051a05fea879a4ecbe62ada\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/AuthSuperValidator.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport {AccessControl} from \\\"@openzeppelin/contracts/access/AccessControl.sol\\\";\\nimport {ECDSA} from \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\n/// @title AuthSuperValidator\\n/// @author The Sandbox\\n/// @notice This contract is used to validate the signatures of the backend, each contract can have a separate signer assigned\\ncontract AuthSuperValidator is AccessControl {\\n mapping(address => address) private _signers;\\n\\n /// @dev Constructor\\n /// @param admin Address of the admin that will be able to grant roles\\n constructor(address admin) {\\n _grantRole(DEFAULT_ADMIN_ROLE, admin);\\n }\\n\\n /// @notice Sets the signer for a contract\\n /// @dev Only the admin can call this function\\n /// @param contractAddress Address of the contract to set the signer for\\n /// @param signer Address of the signer\\n function setSigner(address contractAddress, address signer) public onlyRole(DEFAULT_ADMIN_ROLE) {\\n _signers[contractAddress] = signer;\\n }\\n\\n /// @notice Gets the signer for a contract\\n /// @param contractAddress Address of the contract to get the signer for\\n /// @return address of the signer\\n function getSigner(address contractAddress) public view returns (address) {\\n return _signers[contractAddress];\\n }\\n\\n /// @notice Takes the signature and the digest and returns if the signer has a backend signer role assigned\\n /// @dev Multipurpose function that can be used to verify signatures with different digests\\n /// @param signature Signature hash\\n /// @param digest Digest hash\\n /// @return bool\\n function verify(bytes memory signature, bytes32 digest) public view returns (bool) {\\n address signer = _signers[_msgSender()];\\n require(signer != address(0), \\\"AuthSuperValidator: signer not set\\\");\\n address recoveredSigner = ECDSA.recover(digest, signature);\\n return recoveredSigner == signer;\\n }\\n}\\n\",\"keccak256\":\"0x990d27552ffce0f248fadbf539bbc904134ca14d392931bdfab0f02740103be3\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/interfaces/IAsset.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface IAsset {\\n // AssetData reflects the asset tokenId structure\\n // Refer to TokenIdUtils.sol\\n struct AssetData {\\n uint256 tokenId;\\n address creator;\\n uint256 amount;\\n uint8 tier;\\n uint16 creatorNonce;\\n bool revealed;\\n string metadataHash;\\n bool bridged;\\n }\\n\\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\\n\\n // Functions\\n function mint(\\n address to,\\n uint256 id,\\n uint256 amount,\\n string memory metadataHash\\n ) external;\\n\\n function mintBatch(\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n string[] memory metadataHashes\\n ) external;\\n\\n function burnFrom(\\n address account,\\n uint256 id,\\n uint256 amount\\n ) external;\\n\\n function burnBatchFrom(\\n address account,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external;\\n\\n function getTokenIdByMetadataHash(string memory metadataHash) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x2abd2e550ced35090c988e432215f990bf8f192cc346ffac6778fde0025a8206\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/interfaces/IAssetCreate.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface IAssetCreate {\\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\\n event AssetMinted(\\n address indexed creator,\\n uint256 tokenId,\\n uint16 tier,\\n uint256 amount,\\n string metadataHash,\\n bool revealed\\n );\\n event SpecialAssetMinted(\\n address indexed creator,\\n uint256 tokenId,\\n uint16 tier,\\n uint256 amount,\\n string metadataHash,\\n bool revealed\\n );\\n event AssetBatchMinted(\\n address indexed creator,\\n uint256[] tokenIds,\\n uint8[] tiers,\\n uint256[] amounts,\\n string[] metadataHashes,\\n bool[] revealed\\n );\\n}\\n\",\"keccak256\":\"0x66c18365555f5c3e7c2a38496d3e7f9739c93607eac0e993162320dad070c1e5\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/interfaces/ICatalyst.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface ICatalyst {\\n enum CatalystType {TSB_EXCLUSIVE, COMMON, UNCOMMON, RARE, EPIC, LEGENDARY, MYTHIC}\\n\\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\\n event NewCatalystTypeAdded(uint256 catalystId);\\n event DefaultRoyaltyChanged(address indexed newDefaultRoyaltyRecipient, uint256 newDefaultRoyaltyAmount);\\n\\n /// @notice Mints a new token, limited to MINTER_ROLE only\\n /// @param to The address that will own the minted token\\n /// @param id The token id to mint\\n /// @param amount The amount to be minted\\n function mint(\\n address to,\\n uint256 id,\\n uint256 amount\\n ) external;\\n\\n /// @notice Mints a batch of tokens, limited to MINTER_ROLE only\\n /// @param to The address that will own the minted tokens\\n /// @param ids The token ids to mint\\n /// @param amounts The amounts to be minted per token id\\n function mintBatch(\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external;\\n\\n /// @notice Burns a specified amount of tokens from a specific address\\n /// @param account The address to burn from\\n /// @param id The token id to burn\\n /// @param amount The amount to be burned\\n function burnFrom(\\n address account,\\n uint256 id,\\n uint256 amount\\n ) external;\\n\\n /// @notice Burns a batch of tokens from a specific address\\n /// @param account The address to burn from\\n /// @param ids The token ids to burn\\n /// @param amounts The amounts to be burned\\n function burnBatchFrom(\\n address account,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external;\\n\\n /// @notice Add a new catalyst type, limited to DEFAULT_ADMIN_ROLE only\\n /// @param ipfsCID The royalty bps for the catalyst\\n function addNewCatalystType(string memory ipfsCID) external;\\n\\n /// @notice Set a new URI for specific tokenid\\n /// @param tokenId The token id to set URI for\\n /// @param metadataHash The new URI\\n function setMetadataHash(uint256 tokenId, string memory metadataHash) external;\\n\\n /// @notice Set a new base URI\\n /// @param baseURI The new base URI\\n function setBaseURI(string memory baseURI) external;\\n}\\n\",\"keccak256\":\"0x5490f773ea2894927b789486457e4a25cb19508931846469927eb22e22a6a5f8\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/libraries/TokenIdUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {IAsset} from \\\"../interfaces/IAsset.sol\\\";\\n\\nlibrary TokenIdUtils {\\n // Layer masks\\n uint256 public constant TIER_MASK = 0xFF;\\n uint256 public constant NONCE_MASK = 0xFFFF;\\n uint256 public constant REVEAL_NONCE_MASK = 0xFFFF;\\n uint256 public constant BRIDGED_MASK = 0x1;\\n\\n // Bit shifts\\n uint256 public constant CREATOR_SHIFT = 0;\\n uint256 public constant TIER_SHIFT = 160;\\n uint256 public constant NONCE_SHIFT = 168;\\n uint256 public constant REVEAL_NONCE_SHIFT = 184;\\n uint256 public constant BRIDGED_SHIFT = 200;\\n\\n /// @notice Generates a token id for a given asset\\n /// @dev The token id is generated by concatenating the following fields:\\n /// @dev creator address, chain index, tier, asset nonce, reveal nonce and bridged boolean\\n /// @dev The first 160 bits are the creator address\\n /// @dev The next 8 bits are the chain index\\n /// @dev The next 8 bits are the tier\\n /// @dev The next 16 bits are the asset nonce\\n /// @dev The next 16 bits are assets reveal nonce.\\n /// @param creator The address of the creator of the asset\\n /// @param tier The tier of the asset determined by the catalyst used to create it\\n /// @param creatorNonce The nonce of the asset creator\\n /// @param revealNonce The reveal nonce of the asset\\n /// @param bridged Whether the asset is bridged or not\\n /// @return tokenId The generated token id\\n function generateTokenId(\\n address creator,\\n uint8 tier,\\n uint16 creatorNonce,\\n uint16 revealNonce,\\n bool bridged\\n ) internal pure returns (uint256 tokenId) {\\n uint160 creatorAddress = uint160(creator);\\n\\n tokenId = tokenId =\\n uint256(creatorAddress) |\\n (uint256(tier) << TIER_SHIFT) |\\n (uint256(creatorNonce) << NONCE_SHIFT) |\\n (uint256(revealNonce) << REVEAL_NONCE_SHIFT) |\\n (uint256(bridged ? 1 : 0) << BRIDGED_SHIFT);\\n\\n return tokenId;\\n }\\n\\n /// @notice Extracts the creator address from a given token id\\n /// @param tokenId The token id to extract the creator address from\\n /// @return creator The asset creator address\\n function getCreatorAddress(uint256 tokenId) internal pure returns (address creator) {\\n creator = address(uint160(tokenId));\\n return creator;\\n }\\n\\n /// @notice Extracts the tier from a given token id\\n /// @param tokenId The token id to extract the tier from\\n /// @return tier The asset tier, determined by the catalyst used to create it\\n function getTier(uint256 tokenId) internal pure returns (uint8 tier) {\\n tier = uint8((tokenId >> TIER_SHIFT) & TIER_MASK);\\n return tier;\\n }\\n\\n /// @notice Extracts the revealed flag from a given token id\\n /// @param tokenId The token id to extract the revealed flag from\\n /// @return isRevealed Whether the asset is revealed or not\\n function isRevealed(uint256 tokenId) internal pure returns (bool) {\\n uint16 revealNonce = getRevealNonce(tokenId);\\n return revealNonce != 0;\\n }\\n\\n /// @notice Extracts the asset nonce from a given token id\\n /// @param tokenId The token id to extract the asset nonce from\\n /// @return creatorNonce The asset creator nonce\\n function getCreatorNonce(uint256 tokenId) internal pure returns (uint16) {\\n uint16 creatorNonce = uint16((tokenId >> NONCE_SHIFT) & NONCE_MASK);\\n return creatorNonce;\\n }\\n\\n /// @notice Extracts the abilities and enhancements hash from a given token id\\n /// @param tokenId The token id to extract reveal nonce from\\n /// @return revealNonce The reveal nonce of the asset\\n function getRevealNonce(uint256 tokenId) internal pure returns (uint16) {\\n uint16 revealNonce = uint16((tokenId >> REVEAL_NONCE_SHIFT) & REVEAL_NONCE_MASK);\\n return revealNonce;\\n }\\n\\n /// @notice Extracts the bridged flag from a given token id\\n /// @param tokenId The token id to extract the bridged flag from\\n /// @return bridged Whether the asset is bridged or not\\n function isBridged(uint256 tokenId) internal pure returns (bool) {\\n bool bridged = ((tokenId >> BRIDGED_SHIFT) & BRIDGED_MASK) == 1;\\n return bridged;\\n }\\n\\n /// @notice Extracts the asset data from a given token id\\n /// @dev Created to limit the number of functions that need to be called when revealing an asset\\n /// @param tokenId The token id to extract the asset data from\\n function getData(uint256 tokenId) internal pure returns (IAsset.AssetData memory data) {\\n data.creator = getCreatorAddress(tokenId);\\n data.tier = getTier(tokenId);\\n data.revealed = isRevealed(tokenId);\\n data.creatorNonce = getCreatorNonce(tokenId);\\n data.bridged = isBridged(tokenId);\\n }\\n}\\n\",\"keccak256\":\"0x82f6bb065e85497d5486bcecb162c30df83941262ff5ac3fd8e283e946250839\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerAbstract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\n/// @dev minimal ERC2771 handler to keep bytecode-size down\\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\\nabstract contract ERC2771HandlerAbstract {\\n /// @notice return true if the forwarder is the trusted forwarder\\n /// @param forwarder trusted forwarder address to check\\n /// @return true if the address is the same as the trusted forwarder\\n function isTrustedForwarder(address forwarder) external view returns (bool) {\\n return _isTrustedForwarder(forwarder);\\n }\\n\\n /// @notice if the call is from the trusted forwarder the sender is extracted from calldata, msg.sender otherwise\\n /// @return sender the calculated address of the sender\\n function _msgSender() internal view virtual returns (address sender) {\\n if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\\n // The assembly code is more direct than the Solidity version using `abi.decode`.\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\\n }\\n } else {\\n sender = msg.sender;\\n }\\n }\\n\\n /// @notice if the call is from the trusted forwarder the sender is removed from calldata\\n /// @return the calldata without the sender\\n function _msgData() internal view virtual returns (bytes calldata) {\\n if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\\n return msg.data[:msg.data.length - 20];\\n } else {\\n return msg.data;\\n }\\n }\\n\\n /// @notice return true if the forwarder is the trusted forwarder\\n /// @param forwarder trusted forwarder address to check\\n /// @return true if the address is the same as the trusted forwarder\\n /// @dev this function must be IMPLEMENTED\\n function _isTrustedForwarder(address forwarder) internal view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xc4f349865ea7146f51b69f1edacdef60e0a2a7cf4dab538a5ae53ee9a0036231\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ERC2771HandlerAbstract} from \\\"./ERC2771HandlerAbstract.sol\\\";\\n\\n/// @dev minimal ERC2771 handler to keep bytecode-size down\\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\\ncontract ERC2771HandlerUpgradeable is Initializable, ERC2771HandlerAbstract {\\n address private _trustedForwarder;\\n\\n /// @notice Emitted when a `newTrustedForwarder` is set, replacing the `oldTrustedForwarder`\\n /// @param oldTrustedForwarder old trusted forwarder\\n /// @param newTrustedForwarder new trusted forwarder\\n /// @param operator the sender of the transaction\\n event TrustedForwarderSet(\\n address indexed oldTrustedForwarder,\\n address indexed newTrustedForwarder,\\n address indexed operator\\n );\\n\\n /// @notice initialize the trusted forwarder address\\n /// @param forwarder trusted forwarder address or zero to disable it\\n function __ERC2771Handler_init(address forwarder) internal onlyInitializing {\\n __ERC2771Handler_init_unchained(forwarder);\\n }\\n\\n /// @notice initialize the trusted forwarder address\\n /// @param forwarder trusted forwarder address or zero to disable it\\n function __ERC2771Handler_init_unchained(address forwarder) internal onlyInitializing {\\n _setTrustedForwarder(forwarder);\\n }\\n\\n /// @notice return the address of the trusted forwarder\\n /// @return return the address of the trusted forwarder\\n function getTrustedForwarder() external view returns (address) {\\n return _trustedForwarder;\\n }\\n\\n /// @notice set the address of the trusted forwarder\\n /// @param newForwarder the address of the new forwarder.\\n function _setTrustedForwarder(address newForwarder) internal virtual {\\n require(newForwarder != _trustedForwarder, \\\"ERC2771HandlerUpgradeable: forwarder already set\\\");\\n emit TrustedForwarderSet(_trustedForwarder, newForwarder, _msgSender());\\n _trustedForwarder = newForwarder;\\n }\\n\\n /// @notice return true if the forwarder is the trusted forwarder\\n /// @param forwarder trusted forwarder address to check\\n /// @return true if the address is the same as the trusted forwarder\\n function _isTrustedForwarder(address forwarder) internal view virtual override returns (bool) {\\n return forwarder == _trustedForwarder;\\n }\\n\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x63e53ca5ec229e51d866b0b8e3c8f36056598d9fbf960bb57b4b9731917af16f\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e3565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b612dff80620000f36000396000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c806384b0196e116100e3578063d547741f1161008c578063dbd8483d11610066578063dbd8483d146103b0578063de743a72146103d5578063f76fc35e146103fc57600080fd5b8063d547741f14610379578063d5f2077c1461038c578063da7422281461039d57600080fd5b8063a217fddf116100bd578063a217fddf14610347578063c91f0c531461034f578063ce1b815f1461036257600080fd5b806384b0196e146102e057806391d14854146102fb5780639e7495aa1461033457600080fd5b806334dcdd521161014557806359c191e41161011f57806359c191e41461028357806374e3447a146102a85780637caa719a146102cf57600080fd5b806334dcdd521461022657806336568abe1461025d578063572b6c051461027057600080fd5b8063248a9ca311610176578063248a9ca3146101cf5780632d94a9d3146102005780632f2ff15d1461021357600080fd5b806301ffc9a7146101925780631a3101b1146101ba575b600080fd5b6101a56101a036600461201b565b610423565b60405190151581526020015b60405180910390f35b6101cd6101c8366004612198565b6104bc565b005b6101f26101dd366004612242565b600090815260ca602052604090206001015490565b6040519081526020016101b1565b6101cd61020e36600461225b565b6107a3565b6101cd6102213660046122e0565b610a19565b61024a61023436600461230c565b60ff6020526000908152604090205461ffff1681565b60405161ffff90911681526020016101b1565b6101cd61026b3660046122e0565b610a43565b6101a561027e36600461230c565b610adf565b60fc546001600160a01b03165b6040516001600160a01b0390911681526020016101b1565b6101f27fb696df569c2dfecb5a24edfd39d7f55b0f442be14350cbc68dbe8eb35489d3a681565b60fd546001600160a01b0316610290565b6102e8610afc565b6040516101b197969594939291906123b2565b6101a56103093660046122e0565b600091825260ca602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6101cd610342366004612481565b610bbe565b6101f2600081565b6101cd61035d36600461257a565b6110e0565b6000546201000090046001600160a01b0316610290565b6101cd6103873660046122e0565b61127a565b60fe546001600160a01b0316610290565b6101cd6103ab36600461230c565b61129f565b61024a6103be36600461230c565b6101006020526000908152604090205461ffff1681565b6101f27f52955c021a90f71f7afee289089576ce6998f456ca81e444651c71363bf2609581565b6101f27f3b0c69bab62d38b5774be9b5185349bf525ef97a4d288b652e29bb4ec2a4902d81565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806104b657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60fe546001600160a01b0316636b4063418861052e8461010060006104df61132f565b6001600160a01b0316815260208101919091526040016000908120805461ffff169161050a83612639565b91906101000a81548161ffff021916908361ffff1602179055508b8b8b8b8b61133e565b6040518363ffffffff1660e01b815260040161054b92919061265a565b602060405180830381865afa158015610568573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058c919061267c565b6105dd5760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064015b60405180910390fd5b6001600160a01b038116600090815260ff6020526040812080546106419184918a9190859061060f9061ffff16612639565b91906101000a81548161ffff021916908361ffff160217905588610634576000610637565b60015b60ff166000611402565b60fd546040517f124d91e50000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015260ff8b166024830152604482018a905292935091169063124d91e590606401600060405180830381600087803b1580156106b357600080fd5b505af11580156106c7573d6000803e3d6000fd5b505060fc546040517fbb7fde710000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063bb7fde71915061071c90859085908b908a908a906004016126c4565b600060405180830381600087803b15801561073657600080fd5b505af115801561074a573d6000803e3d6000fd5b50505050816001600160a01b03167f293c16277edbc93bfb30f56ac279e45bbdbd421755b0278d19ebcd1cee6a795b82898988888b604051610791969594939291906126fe565b60405180910390a25050505050505050565b7fb696df569c2dfecb5a24edfd39d7f55b0f442be14350cbc68dbe8eb35489d3a66107cd8161144f565b60fe546001600160a01b0316636b406341876108418561010060006107f061132f565b6001600160a01b0316815260208101919091526040016000908120805461ffff169161081b83612639565b91906101000a81548161ffff021916908361ffff16021790555060008b60018c8c61133e565b6040518363ffffffff1660e01b815260040161085e92919061265a565b602060405180830381865afa15801561087b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089f919061267c565b6108eb5760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064016105d4565b6001600160a01b038216600090815260ff60205260408120805461093f918591849190829061091d9061ffff16612639565b91906101000a81548161ffff021916908361ffff160217905560016000611402565b60fc546040517fbb7fde710000000000000000000000000000000000000000000000000000000081529192506001600160a01b03169063bb7fde719061099190869085908b908b908b906004016126c4565b600060405180830381600087803b1580156109ab57600080fd5b505af11580156109bf573d6000803e3d6000fd5b50505050826001600160a01b03167f07560e268a00bce229c6a07c00d3f177f67674deae28b79a1840dd20712366288260008989896001604051610a089695949392919061273c565b60405180910390a250505050505050565b600082815260ca6020526040902060010154610a348161144f565b610a3e8383611463565b505050565b610a4b61132f565b6001600160a01b0316816001600160a01b031614610ad15760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016105d4565b610adb8282611506565b5050565b600080546001600160a01b038381166201000090920416146104b6565b6000606080600080600060606032546000801b148015610b1c5750603354155b610b685760405162461bcd60e51b815260206004820152601560248201527f4549503731323a20556e696e697469616c697a6564000000000000000000000060448201526064016105d4565b610b706115a7565b610b78611639565b604080516000808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009b939a50919850469750309650945092509050565b60fe546001600160a01b0316636b4063418b610c33846101006000610be161132f565b6001600160a01b0316815260208101919091526040016000908120805461ffff1691610c0c83612639565b91906101000a81548161ffff021916908361ffff1602179055508e8e8e8e8e8e8e8e611648565b6040518363ffffffff1660e01b8152600401610c5092919061265a565b602060405180830381865afa158015610c6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c91919061267c565b610cdd5760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064016105d4565b878614610d2c5760405162461bcd60e51b815260206004820152601a60248201527f417272617973206d7573742062652073616d65206c656e67746800000000000060448201526064016105d4565b858214610d7b5760405162461bcd60e51b815260206004820152601a60248201527f417272617973206d7573742062652073616d65206c656e67746800000000000060448201526064016105d4565b818414610dca5760405162461bcd60e51b815260206004820152601a60248201527f417272617973206d7573742062652073616d65206c656e67746800000000000060448201526064016105d4565b60008867ffffffffffffffff811115610de557610de561205d565b604051908082528060200260200182016040528015610e0e578160200160208202803683370190505b50905060008967ffffffffffffffff811115610e2c57610e2c61205d565b604051908082528060200260200182016040528015610e55578160200160208202803683370190505b50905060005b8a811015610f7a578b8b82818110610e7557610e75612766565b9050602002016020810190610e8a919061277c565b60ff16828281518110610e9f57610e9f612766565b602002602001018181525050610f4b848d8d84818110610ec157610ec1612766565b9050602002016020810190610ed6919061277c565b6001600160a01b038716600090815260ff602052604081208054909190610f009061ffff16612639565b91906101000a81548161ffff021916908361ffff16021790558b8b86818110610f2b57610f2b612766565b9050602002016020810190610f409190612797565b610634576000610637565b838281518110610f5d57610f5d612766565b602090810291909101015280610f72816127b4565b915050610e5b565b5060fd546040517f20820ec30000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906320820ec390610fca90869085908e908e90600401612819565b600060405180830381600087803b158015610fe457600080fd5b505af1158015610ff8573d6000803e3d6000fd5b505060fc546040517fa55784ef0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063a55784ef915061104f90869086908e908e908c908c906004016128fe565b600060405180830381600087803b15801561106957600080fd5b505af115801561107d573d6000803e3d6000fd5b50505050826001600160a01b03167fdd4b554190cbd4759e711abb655bdaf12557fea0ac84cec4fd4d978db3148bab838d8d8d8d8b8b8f8f6040516110ca99989796959493929190612955565b60405180910390a2505050505050505050505050565b600054610100900460ff16158080156111005750600054600160ff909116105b8061111a5750303b15801561111a575060005460ff166001145b61118c5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016105d4565b6000805460ff1916600117905580156111af576000805461ff0019166101001790555b60fc80546001600160a01b038089167fffffffffffffffffffffffff00000000000000000000000000000000000000009283161790925560fd805488841690831617905560fe80549287169290911691909117905561120d83611757565b61121788886117cb565b61121f611840565b61122a600083611463565b8015611270576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b600082815260ca60205260409020600101546112958161144f565b610a3e8383611506565b60006112aa8161144f565b6001600160a01b0382166113265760405162461bcd60e51b815260206004820152603460248201527f41737365744372656174653a207472757374656420666f72776172646572206360448201527f616e2774206265207a65726f206164647265737300000000000000000000000060648201526084016105d4565b610adb826118ad565b60006113396119c2565b905090565b60006113f67f3b0c69bab62d38b5774be9b5185349bf525ef97a4d288b652e29bb4ec2a4902d8989898989898960405160200161137c929190612a1a565b60408051601f198184030181528282528051602091820120908301989098526001600160a01b039096169581019590955261ffff909316606085015260ff909116608084015260a0830152151560c082015260e0810191909152610100015b60405160208183030381529060405280519060200120611a19565b98975050505050505050565b60008560c883611413576000611416565b60015b60ff16901b60b88561ffff16901b60a88761ffff16901b60a08960ff16901b846001600160a01b03161717171791505095945050505050565b6114608161145b61132f565b611a61565b50565b600082815260ca602090815260408083206001600160a01b038516845290915290205460ff16610adb57600082815260ca602090815260408083206001600160a01b03851684529091529020805460ff191660011790556114c261132f565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260ca602090815260408083206001600160a01b038516845290915290205460ff1615610adb57600082815260ca602090815260408083206001600160a01b03851684529091529020805460ff1916905561156361132f565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b6060603480546115b690612a2a565b80601f01602080910402602001604051908101604052809291908181526020018280546115e290612a2a565b801561162f5780601f106116045761010080835404028352916020019161162f565b820191906000526020600020905b81548152906001019060200180831161161257829003601f168201915b5050505050905090565b6060603580546115b690612a2a565b60006117487f52955c021a90f71f7afee289089576ce6998f456ca81e444651c71363bf260958c8c8c8c604051602001611683929190612a64565b604051602081830303815290604052805190602001208b8b6040516020016116ac929190612a9e565b604051602081830303815290604052805190602001208a8a6040516020016116d5929190612ae0565b60408051601f1981840301815291905280516020909101206116ff6116fa8a8c612b10565b611ad6565b6040805160208101989098526001600160a01b039096169587019590955261ffff9093166060860152608085019190915260a084015260c083015260e0820152610100016113db565b9b9a5050505050505050505050565b600054610100900460ff166117c25760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016105d4565b61146081611bca565b600054610100900460ff166118365760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016105d4565b610adb8282611c3e565b600054610100900460ff166118ab5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016105d4565b565b6000546001600160a01b03620100009091048116908216036119375760405162461bcd60e51b815260206004820152603060248201527f4552433237373148616e646c65725570677261646561626c653a20666f72776160448201527f7264657220616c7265616479207365740000000000000000000000000000000060648201526084016105d4565b61193f61132f565b600080546040516001600160a01b0393841693858116936201000090930416917f8ca022029d8ff7ad974913f8970aeed6c5e0e7eaf494a0c5b262249f6b5759e591a4600080546001600160a01b0390921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b600080546201000090046001600160a01b0316331480156119e4575060143610155b15611a1457507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b503390565b60006104b6611a26611cd1565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b600082815260ca602090815260408083206001600160a01b038516845290915290205460ff16610adb57611a9481611cdb565b611a9f836020611ced565b604051602001611ab0929190612b94565b60408051601f198184030181529082905262461bcd60e51b82526105d491600401612c15565b600080825167ffffffffffffffff811115611af357611af361205d565b604051908082528060200260200182016040528015611b1c578160200160208202803683370190505b50905060005b8351811015611b9a57838181518110611b3d57611b3d612766565b6020026020010151604051602001611b559190612c28565b60405160208183030381529060405280519060200120828281518110611b7d57611b7d612766565b602090810291909101015280611b92816127b4565b915050611b22565b5080604051602001611bac9190612c44565b60405160208183030381529060405280519060200120915050919050565b600054610100900460ff16611c355760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016105d4565b611460816118ad565b600054610100900460ff16611ca95760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016105d4565b6034611cb58382612cc8565b506035611cc28282612cc8565b50506000603281905560335550565b6000611339611f1d565b60606104b66001600160a01b03831660145b60606000611cfc836002612d88565b611d07906002612d9f565b67ffffffffffffffff811115611d1f57611d1f61205d565b6040519080825280601f01601f191660200182016040528015611d49576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611d8057611d80612766565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611de357611de3612766565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611e1f846002612d88565b611e2a906001612d9f565b90505b6001811115611ec7577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611e6b57611e6b612766565b1a60f81b828281518110611e8157611e81612766565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611ec081612db2565b9050611e2d565b508315611f165760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105d4565b9392505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611f48611f91565b611f50611fea565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600080611f9c6115a7565b805190915015611fb3578051602090910120919050565b6032548015611fc25792915050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709250505090565b600080611ff5611639565b80519091501561200c578051602090910120919050565b6033548015611fc25792915050565b60006020828403121561202d57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611f1657600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209c5761209c61205d565b604052919050565b600082601f8301126120b557600080fd5b813567ffffffffffffffff8111156120cf576120cf61205d565b6120e26020601f19601f84011601612073565b8181528460208386010111156120f757600080fd5b816020850160208301376000918101602001919091529392505050565b803560ff8116811461212557600080fd5b919050565b801515811461146057600080fd5b60008083601f84011261214a57600080fd5b50813567ffffffffffffffff81111561216257600080fd5b60208301915083602082850101111561217a57600080fd5b9250929050565b80356001600160a01b038116811461212557600080fd5b600080600080600080600060c0888a0312156121b357600080fd5b873567ffffffffffffffff808211156121cb57600080fd5b6121d78b838c016120a4565b98506121e560208b01612114565b975060408a0135965060608a013591506121fe8261212a565b9094506080890135908082111561221457600080fd5b506122218a828b01612138565b9094509250612234905060a08901612181565b905092959891949750929550565b60006020828403121561225457600080fd5b5035919050565b60008060008060006080868803121561227357600080fd5b853567ffffffffffffffff8082111561228b57600080fd5b61229789838a016120a4565b96506020880135955060408801359150808211156122b457600080fd5b506122c188828901612138565b90945092506122d4905060608701612181565b90509295509295909350565b600080604083850312156122f357600080fd5b8235915061230360208401612181565b90509250929050565b60006020828403121561231e57600080fd5b611f1682612181565b60005b8381101561234257818101518382015260200161232a565b50506000910152565b60008151808452612363816020860160208601612327565b601f01601f19169290920160200192915050565b600081518084526020808501945080840160005b838110156123a75781518752958201959082019060010161238b565b509495945050505050565b7fff000000000000000000000000000000000000000000000000000000000000008816815260e0602082015260006123ed60e083018961234b565b82810360408401526123ff818961234b565b90508660608401526001600160a01b03861660808401528460a084015282810360c084015261242e8185612377565b9a9950505050505050505050565b60008083601f84011261244e57600080fd5b50813567ffffffffffffffff81111561246657600080fd5b6020830191508360208260051b850101111561217a57600080fd5b60008060008060008060008060008060c08b8d0312156124a057600080fd5b8a3567ffffffffffffffff808211156124b857600080fd5b6124c48e838f016120a4565b9b5060208d01359150808211156124da57600080fd5b6124e68e838f0161243c565b909b50995060408d01359150808211156124ff57600080fd5b61250b8e838f0161243c565b909950975060608d013591508082111561252457600080fd5b6125308e838f0161243c565b909750955060808d013591508082111561254957600080fd5b506125568d828e0161243c565b9094509250612569905060a08c01612181565b90509295989b9194979a5092959850565b600080600080600080600060e0888a03121561259557600080fd5b873567ffffffffffffffff808211156125ad57600080fd5b6125b98b838c016120a4565b985060208a01359150808211156125cf57600080fd5b506125dc8a828b016120a4565b9650506125eb60408901612181565b94506125f960608901612181565b935061260760808901612181565b925061261560a08901612181565b915061223460c08901612181565b634e487b7160e01b600052601160045260246000fd5b600061ffff80831681810361265057612650612623565b6001019392505050565b60408152600061266d604083018561234b565b90508260208301529392505050565b60006020828403121561268e57600080fd5b8151611f168161212a565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b6001600160a01b03861681528460208201528360408201526080606082015260006126f3608083018486612699565b979650505050505050565b86815260ff8616602082015284604082015260a06060820152600061272760a083018587612699565b90508215156080830152979650505050505050565b86815261ffff8616602082015284604082015260a06060820152600061272760a083018587612699565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561278e57600080fd5b611f1682612114565b6000602082840312156127a957600080fd5b8135611f168161212a565b600060001982036127c7576127c7612623565b5060010190565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561280057600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b038516815260606020820152600061283b6060830186612377565b82810360408401526126f38185876127ce565b81835260006020808501808196508560051b810191508460005b878110156128f157828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126128a757600080fd5b8701858101903567ffffffffffffffff8111156128c357600080fd5b8036038213156128d257600080fd5b6128dd868284612699565b9a87019a9550505090840190600101612868565b5091979650505050505050565b6001600160a01b03871681526080602082015260006129206080830188612377565b82810360408401526129338187896127ce565b9050828103606084015261294881858761284e565b9998505050505050505050565b60a08152600061296860a083018c612377565b8281036020848101919091528a82528b91810160005b8c8110156129a45760ff61299185612114565b168252928201929082019060010161297e565b5084810360408601526129b8818b8d6127ce565b92505083820360608501526129ce82888a61284e565b8481036080860152858152869250810160005b86811015612a085783356129f48161212a565b1515825292820192908201906001016129e1565b509d9c50505050505050505050505050565b8183823760009101908152919050565b600181811c90821680612a3e57607f821691505b602082108103612a5e57634e487b7160e01b600052602260045260246000fd5b50919050565b60008184825b85811015612a935760ff612a7d83612114565b1683526020928301929190910190600101612a6a565b509095945050505050565b60007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115612acd57600080fd5b8260051b80858437919091019392505050565b60008184825b85811015612a93578135612af98161212a565b151583526020928301929190910190600101612ae6565b600067ffffffffffffffff80841115612b2b57612b2b61205d565b8360051b6020612b3c818301612073565b868152918501918181019036841115612b5457600080fd5b865b84811015612b8857803586811115612b6e5760008081fd5b612b7a36828b016120a4565b845250918301918301612b56565b50979650505050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612bcc816017850160208801612327565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612c09816028840160208801612327565b01602801949350505050565b602081526000611f16602083018461234b565b60008251612c3a818460208701612327565b9190910192915050565b815160009082906020808601845b83811015612c6e57815185529382019390820190600101612c52565b50929695505050505050565b601f821115610a3e57600081815260208120601f850160051c81016020861015612ca15750805b601f850160051c820191505b81811015612cc057828155600101612cad565b505050505050565b815167ffffffffffffffff811115612ce257612ce261205d565b612cf681612cf08454612a2a565b84612c7a565b602080601f831160018114612d2b5760008415612d135750858301515b600019600386901b1c1916600185901b178555612cc0565b600085815260208120601f198616915b82811015612d5a57888601518255948401946001909101908401612d3b565b5085821015612d785787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b80820281158282048414176104b6576104b6612623565b808201808211156104b6576104b6612623565b600081612dc157612dc1612623565b50600019019056fea2646970667358221220153d390573e3eacd0e1bdc1223bf2f50f4f8713a38fc5ea805ae6354090bc9bf64736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061018d5760003560e01c806384b0196e116100e3578063d547741f1161008c578063dbd8483d11610066578063dbd8483d146103b0578063de743a72146103d5578063f76fc35e146103fc57600080fd5b8063d547741f14610379578063d5f2077c1461038c578063da7422281461039d57600080fd5b8063a217fddf116100bd578063a217fddf14610347578063c91f0c531461034f578063ce1b815f1461036257600080fd5b806384b0196e146102e057806391d14854146102fb5780639e7495aa1461033457600080fd5b806334dcdd521161014557806359c191e41161011f57806359c191e41461028357806374e3447a146102a85780637caa719a146102cf57600080fd5b806334dcdd521461022657806336568abe1461025d578063572b6c051461027057600080fd5b8063248a9ca311610176578063248a9ca3146101cf5780632d94a9d3146102005780632f2ff15d1461021357600080fd5b806301ffc9a7146101925780631a3101b1146101ba575b600080fd5b6101a56101a036600461201b565b610423565b60405190151581526020015b60405180910390f35b6101cd6101c8366004612198565b6104bc565b005b6101f26101dd366004612242565b600090815260ca602052604090206001015490565b6040519081526020016101b1565b6101cd61020e36600461225b565b6107a3565b6101cd6102213660046122e0565b610a19565b61024a61023436600461230c565b60ff6020526000908152604090205461ffff1681565b60405161ffff90911681526020016101b1565b6101cd61026b3660046122e0565b610a43565b6101a561027e36600461230c565b610adf565b60fc546001600160a01b03165b6040516001600160a01b0390911681526020016101b1565b6101f27fb696df569c2dfecb5a24edfd39d7f55b0f442be14350cbc68dbe8eb35489d3a681565b60fd546001600160a01b0316610290565b6102e8610afc565b6040516101b197969594939291906123b2565b6101a56103093660046122e0565b600091825260ca602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6101cd610342366004612481565b610bbe565b6101f2600081565b6101cd61035d36600461257a565b6110e0565b6000546201000090046001600160a01b0316610290565b6101cd6103873660046122e0565b61127a565b60fe546001600160a01b0316610290565b6101cd6103ab36600461230c565b61129f565b61024a6103be36600461230c565b6101006020526000908152604090205461ffff1681565b6101f27f52955c021a90f71f7afee289089576ce6998f456ca81e444651c71363bf2609581565b6101f27f3b0c69bab62d38b5774be9b5185349bf525ef97a4d288b652e29bb4ec2a4902d81565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806104b657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60fe546001600160a01b0316636b4063418861052e8461010060006104df61132f565b6001600160a01b0316815260208101919091526040016000908120805461ffff169161050a83612639565b91906101000a81548161ffff021916908361ffff1602179055508b8b8b8b8b61133e565b6040518363ffffffff1660e01b815260040161054b92919061265a565b602060405180830381865afa158015610568573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058c919061267c565b6105dd5760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064015b60405180910390fd5b6001600160a01b038116600090815260ff6020526040812080546106419184918a9190859061060f9061ffff16612639565b91906101000a81548161ffff021916908361ffff160217905588610634576000610637565b60015b60ff166000611402565b60fd546040517f124d91e50000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015260ff8b166024830152604482018a905292935091169063124d91e590606401600060405180830381600087803b1580156106b357600080fd5b505af11580156106c7573d6000803e3d6000fd5b505060fc546040517fbb7fde710000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063bb7fde71915061071c90859085908b908a908a906004016126c4565b600060405180830381600087803b15801561073657600080fd5b505af115801561074a573d6000803e3d6000fd5b50505050816001600160a01b03167f293c16277edbc93bfb30f56ac279e45bbdbd421755b0278d19ebcd1cee6a795b82898988888b604051610791969594939291906126fe565b60405180910390a25050505050505050565b7fb696df569c2dfecb5a24edfd39d7f55b0f442be14350cbc68dbe8eb35489d3a66107cd8161144f565b60fe546001600160a01b0316636b406341876108418561010060006107f061132f565b6001600160a01b0316815260208101919091526040016000908120805461ffff169161081b83612639565b91906101000a81548161ffff021916908361ffff16021790555060008b60018c8c61133e565b6040518363ffffffff1660e01b815260040161085e92919061265a565b602060405180830381865afa15801561087b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089f919061267c565b6108eb5760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064016105d4565b6001600160a01b038216600090815260ff60205260408120805461093f918591849190829061091d9061ffff16612639565b91906101000a81548161ffff021916908361ffff160217905560016000611402565b60fc546040517fbb7fde710000000000000000000000000000000000000000000000000000000081529192506001600160a01b03169063bb7fde719061099190869085908b908b908b906004016126c4565b600060405180830381600087803b1580156109ab57600080fd5b505af11580156109bf573d6000803e3d6000fd5b50505050826001600160a01b03167f07560e268a00bce229c6a07c00d3f177f67674deae28b79a1840dd20712366288260008989896001604051610a089695949392919061273c565b60405180910390a250505050505050565b600082815260ca6020526040902060010154610a348161144f565b610a3e8383611463565b505050565b610a4b61132f565b6001600160a01b0316816001600160a01b031614610ad15760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016105d4565b610adb8282611506565b5050565b600080546001600160a01b038381166201000090920416146104b6565b6000606080600080600060606032546000801b148015610b1c5750603354155b610b685760405162461bcd60e51b815260206004820152601560248201527f4549503731323a20556e696e697469616c697a6564000000000000000000000060448201526064016105d4565b610b706115a7565b610b78611639565b604080516000808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009b939a50919850469750309650945092509050565b60fe546001600160a01b0316636b4063418b610c33846101006000610be161132f565b6001600160a01b0316815260208101919091526040016000908120805461ffff1691610c0c83612639565b91906101000a81548161ffff021916908361ffff1602179055508e8e8e8e8e8e8e8e611648565b6040518363ffffffff1660e01b8152600401610c5092919061265a565b602060405180830381865afa158015610c6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c91919061267c565b610cdd5760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064016105d4565b878614610d2c5760405162461bcd60e51b815260206004820152601a60248201527f417272617973206d7573742062652073616d65206c656e67746800000000000060448201526064016105d4565b858214610d7b5760405162461bcd60e51b815260206004820152601a60248201527f417272617973206d7573742062652073616d65206c656e67746800000000000060448201526064016105d4565b818414610dca5760405162461bcd60e51b815260206004820152601a60248201527f417272617973206d7573742062652073616d65206c656e67746800000000000060448201526064016105d4565b60008867ffffffffffffffff811115610de557610de561205d565b604051908082528060200260200182016040528015610e0e578160200160208202803683370190505b50905060008967ffffffffffffffff811115610e2c57610e2c61205d565b604051908082528060200260200182016040528015610e55578160200160208202803683370190505b50905060005b8a811015610f7a578b8b82818110610e7557610e75612766565b9050602002016020810190610e8a919061277c565b60ff16828281518110610e9f57610e9f612766565b602002602001018181525050610f4b848d8d84818110610ec157610ec1612766565b9050602002016020810190610ed6919061277c565b6001600160a01b038716600090815260ff602052604081208054909190610f009061ffff16612639565b91906101000a81548161ffff021916908361ffff16021790558b8b86818110610f2b57610f2b612766565b9050602002016020810190610f409190612797565b610634576000610637565b838281518110610f5d57610f5d612766565b602090810291909101015280610f72816127b4565b915050610e5b565b5060fd546040517f20820ec30000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906320820ec390610fca90869085908e908e90600401612819565b600060405180830381600087803b158015610fe457600080fd5b505af1158015610ff8573d6000803e3d6000fd5b505060fc546040517fa55784ef0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063a55784ef915061104f90869086908e908e908c908c906004016128fe565b600060405180830381600087803b15801561106957600080fd5b505af115801561107d573d6000803e3d6000fd5b50505050826001600160a01b03167fdd4b554190cbd4759e711abb655bdaf12557fea0ac84cec4fd4d978db3148bab838d8d8d8d8b8b8f8f6040516110ca99989796959493929190612955565b60405180910390a2505050505050505050505050565b600054610100900460ff16158080156111005750600054600160ff909116105b8061111a5750303b15801561111a575060005460ff166001145b61118c5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016105d4565b6000805460ff1916600117905580156111af576000805461ff0019166101001790555b60fc80546001600160a01b038089167fffffffffffffffffffffffff00000000000000000000000000000000000000009283161790925560fd805488841690831617905560fe80549287169290911691909117905561120d83611757565b61121788886117cb565b61121f611840565b61122a600083611463565b8015611270576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b600082815260ca60205260409020600101546112958161144f565b610a3e8383611506565b60006112aa8161144f565b6001600160a01b0382166113265760405162461bcd60e51b815260206004820152603460248201527f41737365744372656174653a207472757374656420666f72776172646572206360448201527f616e2774206265207a65726f206164647265737300000000000000000000000060648201526084016105d4565b610adb826118ad565b60006113396119c2565b905090565b60006113f67f3b0c69bab62d38b5774be9b5185349bf525ef97a4d288b652e29bb4ec2a4902d8989898989898960405160200161137c929190612a1a565b60408051601f198184030181528282528051602091820120908301989098526001600160a01b039096169581019590955261ffff909316606085015260ff909116608084015260a0830152151560c082015260e0810191909152610100015b60405160208183030381529060405280519060200120611a19565b98975050505050505050565b60008560c883611413576000611416565b60015b60ff16901b60b88561ffff16901b60a88761ffff16901b60a08960ff16901b846001600160a01b03161717171791505095945050505050565b6114608161145b61132f565b611a61565b50565b600082815260ca602090815260408083206001600160a01b038516845290915290205460ff16610adb57600082815260ca602090815260408083206001600160a01b03851684529091529020805460ff191660011790556114c261132f565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260ca602090815260408083206001600160a01b038516845290915290205460ff1615610adb57600082815260ca602090815260408083206001600160a01b03851684529091529020805460ff1916905561156361132f565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b6060603480546115b690612a2a565b80601f01602080910402602001604051908101604052809291908181526020018280546115e290612a2a565b801561162f5780601f106116045761010080835404028352916020019161162f565b820191906000526020600020905b81548152906001019060200180831161161257829003601f168201915b5050505050905090565b6060603580546115b690612a2a565b60006117487f52955c021a90f71f7afee289089576ce6998f456ca81e444651c71363bf260958c8c8c8c604051602001611683929190612a64565b604051602081830303815290604052805190602001208b8b6040516020016116ac929190612a9e565b604051602081830303815290604052805190602001208a8a6040516020016116d5929190612ae0565b60408051601f1981840301815291905280516020909101206116ff6116fa8a8c612b10565b611ad6565b6040805160208101989098526001600160a01b039096169587019590955261ffff9093166060860152608085019190915260a084015260c083015260e0820152610100016113db565b9b9a5050505050505050505050565b600054610100900460ff166117c25760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016105d4565b61146081611bca565b600054610100900460ff166118365760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016105d4565b610adb8282611c3e565b600054610100900460ff166118ab5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016105d4565b565b6000546001600160a01b03620100009091048116908216036119375760405162461bcd60e51b815260206004820152603060248201527f4552433237373148616e646c65725570677261646561626c653a20666f72776160448201527f7264657220616c7265616479207365740000000000000000000000000000000060648201526084016105d4565b61193f61132f565b600080546040516001600160a01b0393841693858116936201000090930416917f8ca022029d8ff7ad974913f8970aeed6c5e0e7eaf494a0c5b262249f6b5759e591a4600080546001600160a01b0390921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b600080546201000090046001600160a01b0316331480156119e4575060143610155b15611a1457507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b503390565b60006104b6611a26611cd1565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b600082815260ca602090815260408083206001600160a01b038516845290915290205460ff16610adb57611a9481611cdb565b611a9f836020611ced565b604051602001611ab0929190612b94565b60408051601f198184030181529082905262461bcd60e51b82526105d491600401612c15565b600080825167ffffffffffffffff811115611af357611af361205d565b604051908082528060200260200182016040528015611b1c578160200160208202803683370190505b50905060005b8351811015611b9a57838181518110611b3d57611b3d612766565b6020026020010151604051602001611b559190612c28565b60405160208183030381529060405280519060200120828281518110611b7d57611b7d612766565b602090810291909101015280611b92816127b4565b915050611b22565b5080604051602001611bac9190612c44565b60405160208183030381529060405280519060200120915050919050565b600054610100900460ff16611c355760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016105d4565b611460816118ad565b600054610100900460ff16611ca95760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016105d4565b6034611cb58382612cc8565b506035611cc28282612cc8565b50506000603281905560335550565b6000611339611f1d565b60606104b66001600160a01b03831660145b60606000611cfc836002612d88565b611d07906002612d9f565b67ffffffffffffffff811115611d1f57611d1f61205d565b6040519080825280601f01601f191660200182016040528015611d49576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611d8057611d80612766565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611de357611de3612766565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611e1f846002612d88565b611e2a906001612d9f565b90505b6001811115611ec7577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611e6b57611e6b612766565b1a60f81b828281518110611e8157611e81612766565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611ec081612db2565b9050611e2d565b508315611f165760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105d4565b9392505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611f48611f91565b611f50611fea565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600080611f9c6115a7565b805190915015611fb3578051602090910120919050565b6032548015611fc25792915050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709250505090565b600080611ff5611639565b80519091501561200c578051602090910120919050565b6033548015611fc25792915050565b60006020828403121561202d57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611f1657600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209c5761209c61205d565b604052919050565b600082601f8301126120b557600080fd5b813567ffffffffffffffff8111156120cf576120cf61205d565b6120e26020601f19601f84011601612073565b8181528460208386010111156120f757600080fd5b816020850160208301376000918101602001919091529392505050565b803560ff8116811461212557600080fd5b919050565b801515811461146057600080fd5b60008083601f84011261214a57600080fd5b50813567ffffffffffffffff81111561216257600080fd5b60208301915083602082850101111561217a57600080fd5b9250929050565b80356001600160a01b038116811461212557600080fd5b600080600080600080600060c0888a0312156121b357600080fd5b873567ffffffffffffffff808211156121cb57600080fd5b6121d78b838c016120a4565b98506121e560208b01612114565b975060408a0135965060608a013591506121fe8261212a565b9094506080890135908082111561221457600080fd5b506122218a828b01612138565b9094509250612234905060a08901612181565b905092959891949750929550565b60006020828403121561225457600080fd5b5035919050565b60008060008060006080868803121561227357600080fd5b853567ffffffffffffffff8082111561228b57600080fd5b61229789838a016120a4565b96506020880135955060408801359150808211156122b457600080fd5b506122c188828901612138565b90945092506122d4905060608701612181565b90509295509295909350565b600080604083850312156122f357600080fd5b8235915061230360208401612181565b90509250929050565b60006020828403121561231e57600080fd5b611f1682612181565b60005b8381101561234257818101518382015260200161232a565b50506000910152565b60008151808452612363816020860160208601612327565b601f01601f19169290920160200192915050565b600081518084526020808501945080840160005b838110156123a75781518752958201959082019060010161238b565b509495945050505050565b7fff000000000000000000000000000000000000000000000000000000000000008816815260e0602082015260006123ed60e083018961234b565b82810360408401526123ff818961234b565b90508660608401526001600160a01b03861660808401528460a084015282810360c084015261242e8185612377565b9a9950505050505050505050565b60008083601f84011261244e57600080fd5b50813567ffffffffffffffff81111561246657600080fd5b6020830191508360208260051b850101111561217a57600080fd5b60008060008060008060008060008060c08b8d0312156124a057600080fd5b8a3567ffffffffffffffff808211156124b857600080fd5b6124c48e838f016120a4565b9b5060208d01359150808211156124da57600080fd5b6124e68e838f0161243c565b909b50995060408d01359150808211156124ff57600080fd5b61250b8e838f0161243c565b909950975060608d013591508082111561252457600080fd5b6125308e838f0161243c565b909750955060808d013591508082111561254957600080fd5b506125568d828e0161243c565b9094509250612569905060a08c01612181565b90509295989b9194979a5092959850565b600080600080600080600060e0888a03121561259557600080fd5b873567ffffffffffffffff808211156125ad57600080fd5b6125b98b838c016120a4565b985060208a01359150808211156125cf57600080fd5b506125dc8a828b016120a4565b9650506125eb60408901612181565b94506125f960608901612181565b935061260760808901612181565b925061261560a08901612181565b915061223460c08901612181565b634e487b7160e01b600052601160045260246000fd5b600061ffff80831681810361265057612650612623565b6001019392505050565b60408152600061266d604083018561234b565b90508260208301529392505050565b60006020828403121561268e57600080fd5b8151611f168161212a565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b6001600160a01b03861681528460208201528360408201526080606082015260006126f3608083018486612699565b979650505050505050565b86815260ff8616602082015284604082015260a06060820152600061272760a083018587612699565b90508215156080830152979650505050505050565b86815261ffff8616602082015284604082015260a06060820152600061272760a083018587612699565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561278e57600080fd5b611f1682612114565b6000602082840312156127a957600080fd5b8135611f168161212a565b600060001982036127c7576127c7612623565b5060010190565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561280057600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b038516815260606020820152600061283b6060830186612377565b82810360408401526126f38185876127ce565b81835260006020808501808196508560051b810191508460005b878110156128f157828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126128a757600080fd5b8701858101903567ffffffffffffffff8111156128c357600080fd5b8036038213156128d257600080fd5b6128dd868284612699565b9a87019a9550505090840190600101612868565b5091979650505050505050565b6001600160a01b03871681526080602082015260006129206080830188612377565b82810360408401526129338187896127ce565b9050828103606084015261294881858761284e565b9998505050505050505050565b60a08152600061296860a083018c612377565b8281036020848101919091528a82528b91810160005b8c8110156129a45760ff61299185612114565b168252928201929082019060010161297e565b5084810360408601526129b8818b8d6127ce565b92505083820360608501526129ce82888a61284e565b8481036080860152858152869250810160005b86811015612a085783356129f48161212a565b1515825292820192908201906001016129e1565b509d9c50505050505050505050505050565b8183823760009101908152919050565b600181811c90821680612a3e57607f821691505b602082108103612a5e57634e487b7160e01b600052602260045260246000fd5b50919050565b60008184825b85811015612a935760ff612a7d83612114565b1683526020928301929190910190600101612a6a565b509095945050505050565b60007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115612acd57600080fd5b8260051b80858437919091019392505050565b60008184825b85811015612a93578135612af98161212a565b151583526020928301929190910190600101612ae6565b600067ffffffffffffffff80841115612b2b57612b2b61205d565b8360051b6020612b3c818301612073565b868152918501918181019036841115612b5457600080fd5b865b84811015612b8857803586811115612b6e5760008081fd5b612b7a36828b016120a4565b845250918301918301612b56565b50979650505050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612bcc816017850160208801612327565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612c09816028840160208801612327565b01602801949350505050565b602081526000611f16602083018461234b565b60008251612c3a818460208701612327565b9190910192915050565b815160009082906020808601845b83811015612c6e57815185529382019390820190600101612c52565b50929695505050505050565b601f821115610a3e57600081815260208120601f850160051c81016020861015612ca15750805b601f850160051c820191505b81811015612cc057828155600101612cad565b505050505050565b815167ffffffffffffffff811115612ce257612ce261205d565b612cf681612cf08454612a2a565b84612c7a565b602080601f831160018114612d2b5760008415612d135750858301515b600019600386901b1c1916600185901b178555612cc0565b600085815260208120601f198616915b82811015612d5a57888601518255948401946001909101908401612d3b565b5085821015612d785787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b80820281158282048414176104b6576104b6612623565b808201808211156104b6576104b6612623565b600081612dc157612dc1612623565b50600019019056fea2646970667358221220153d390573e3eacd0e1bdc1223bf2f50f4f8713a38fc5ea805ae6354090bc9bf64736f6c63430008120033", "devdoc": { "author": "The Sandbox", "events": { @@ -790,6 +815,13 @@ }, "RoleRevoked(bytes32,address,address)": { "details": "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`)" + }, + "TrustedForwarderSet(address,address,address)": { + "params": { + "newTrustedForwarder": "new trusted forwarder", + "oldTrustedForwarder": "old trusted forwarder", + "operator": "the sender of the transaction" + } } }, "kind": "dev", @@ -843,6 +875,11 @@ "getRoleAdmin(bytes32)": { "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}." }, + "getTrustedForwarder()": { + "returns": { + "_0": "return the address of the trusted forwarder" + } + }, "grantRole(bytes32,address)": { "details": "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." }, @@ -856,6 +893,14 @@ "_forwarder": "The address of the forwarder contract" } }, + "isTrustedForwarder(address)": { + "params": { + "forwarder": "trusted forwarder address to check" + }, + "returns": { + "_0": "true if the address is the same as the trusted forwarder" + } + }, "renounceRole(bytes32,address)": { "details": "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." }, @@ -876,6 +921,11 @@ "version": 1 }, "userdoc": { + "events": { + "TrustedForwarderSet(address,address,address)": { + "notice": "Emitted when a `newTrustedForwarder` is set, replacing the `oldTrustedForwarder`" + } + }, "kind": "user", "methods": { "createAsset(bytes,uint8,uint256,bool,string,address)": { @@ -896,9 +946,15 @@ "getCatalystContract()": { "notice": "Get the catalyst contract address" }, + "getTrustedForwarder()": { + "notice": "return the address of the trusted forwarder" + }, "initialize(string,string,address,address,address,address,address)": { "notice": "Initialize the contract" }, + "isTrustedForwarder(address)": { + "notice": "return true if the forwarder is the trusted forwarder" + }, "setTrustedForwarder(address)": { "notice": "Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only" } @@ -909,7 +965,7 @@ "storageLayout": { "storage": [ { - "astId": 746, + "astId": 3599, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", "label": "_initialized", "offset": 0, @@ -917,7 +973,7 @@ "type": "t_uint8" }, { - "astId": 749, + "astId": 3602, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", "label": "_initializing", "offset": 1, @@ -925,7 +981,7 @@ "type": "t_bool" }, { - "astId": 10714, + "astId": 17227, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", "label": "_trustedForwarder", "offset": 2, @@ -933,115 +989,123 @@ "type": "t_address" }, { - "astId": 3914, + "astId": 17314, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", - "label": "_hashedName", + "label": "__gap", "offset": 0, "slot": "1", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 6767, + "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", + "label": "_hashedName", + "offset": 0, + "slot": "50", "type": "t_bytes32" }, { - "astId": 3917, + "astId": 6770, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", "label": "_hashedVersion", "offset": 0, - "slot": "2", + "slot": "51", "type": "t_bytes32" }, { - "astId": 3919, + "astId": 6772, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", "label": "_name", "offset": 0, - "slot": "3", + "slot": "52", "type": "t_string_storage" }, { - "astId": 3921, + "astId": 6774, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", "label": "_version", "offset": 0, - "slot": "4", + "slot": "53", "type": "t_string_storage" }, { - "astId": 4179, + "astId": 7032, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", "label": "__gap", "offset": 0, - "slot": "5", + "slot": "54", "type": "t_array(t_uint256)48_storage" }, { - "astId": 3300, + "astId": 6153, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", "label": "__gap", "offset": 0, - "slot": "53", + "slot": "102", "type": "t_array(t_uint256)50_storage" }, { - "astId": 4223, + "astId": 7076, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", "label": "__gap", "offset": 0, - "slot": "103", + "slot": "152", "type": "t_array(t_uint256)50_storage" }, { - "astId": 194, + "astId": 3044, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", "label": "_roles", "offset": 0, - "slot": "153", - "type": "t_mapping(t_bytes32,t_struct(RoleData)189_storage)" + "slot": "202", + "type": "t_mapping(t_bytes32,t_struct(RoleData)3039_storage)" }, { - "astId": 489, + "astId": 3339, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", "label": "__gap", "offset": 0, - "slot": "154", + "slot": "203", "type": "t_array(t_uint256)49_storage" }, { - "astId": 9238, + "astId": 13351, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", "label": "assetContract", "offset": 0, - "slot": "203", - "type": "t_contract(IAsset)10863" + "slot": "252", + "type": "t_contract(IAsset)16079" }, { - "astId": 9241, + "astId": 13354, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", "label": "catalystContract", "offset": 0, - "slot": "204", - "type": "t_contract(ICatalyst)11006" + "slot": "253", + "type": "t_contract(ICatalyst)16281" }, { - "astId": 9244, + "astId": 13357, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", "label": "authValidator", "offset": 0, - "slot": "205", - "type": "t_contract(AuthSuperValidator)9984" + "slot": "254", + "type": "t_contract(AuthSuperValidator)15285" }, { - "astId": 9248, + "astId": 13361, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", "label": "creatorNonces", "offset": 0, - "slot": "206", + "slot": "255", "type": "t_mapping(t_address,t_uint16)" }, { - "astId": 9252, + "astId": 13365, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", "label": "signatureNonces", "offset": 0, - "slot": "207", + "slot": "256", "type": "t_mapping(t_address,t_uint16)" } ], @@ -1079,17 +1143,17 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(AuthSuperValidator)9984": { + "t_contract(AuthSuperValidator)15285": { "encoding": "inplace", "label": "contract AuthSuperValidator", "numberOfBytes": "20" }, - "t_contract(IAsset)10863": { + "t_contract(IAsset)16079": { "encoding": "inplace", "label": "contract IAsset", "numberOfBytes": "20" }, - "t_contract(ICatalyst)11006": { + "t_contract(ICatalyst)16281": { "encoding": "inplace", "label": "contract ICatalyst", "numberOfBytes": "20" @@ -1108,24 +1172,24 @@ "numberOfBytes": "32", "value": "t_uint16" }, - "t_mapping(t_bytes32,t_struct(RoleData)189_storage)": { + "t_mapping(t_bytes32,t_struct(RoleData)3039_storage)": { "encoding": "mapping", "key": "t_bytes32", "label": "mapping(bytes32 => struct AccessControlUpgradeable.RoleData)", "numberOfBytes": "32", - "value": "t_struct(RoleData)189_storage" + "value": "t_struct(RoleData)3039_storage" }, "t_string_storage": { "encoding": "bytes", "label": "string", "numberOfBytes": "32" }, - "t_struct(RoleData)189_storage": { + "t_struct(RoleData)3039_storage": { "encoding": "inplace", "label": "struct AccessControlUpgradeable.RoleData", "members": [ { - "astId": 186, + "astId": 3036, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", "label": "members", "offset": 0, @@ -1133,7 +1197,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 188, + "astId": 3038, "contract": "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol:AssetCreate", "label": "adminRole", "offset": 0, diff --git a/packages/deploy/deployments/mumbai/AssetCreate_Proxy.json b/packages/deploy/deployments/mumbai/AssetCreate_Proxy.json index fa0f74b2d0..15bf57b770 100644 --- a/packages/deploy/deployments/mumbai/AssetCreate_Proxy.json +++ b/packages/deploy/deployments/mumbai/AssetCreate_Proxy.json @@ -1,5 +1,5 @@ { - "address": "0x376fD92FF818C386C996e43faF07314B05874bc1", + "address": "0xc8E11c3eaE08dc17d800d84c8427E6e3E9525892", "abi": [ { "inputs": [ @@ -146,35 +146,50 @@ "type": "receive" } ], - "transactionHash": "0xcf7b5b2785afda381e69a3332e762059c6c1f7c369b5fe288acc2c34cdb6f54c", + "transactionHash": "0x89256e020ff9a95b5c6817d035f7caf0e36899cdcd0cce4fcb91210da8a5758f", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0x376fD92FF818C386C996e43faF07314B05874bc1", - "transactionIndex": 5, - "gasUsed": "892876", - "logsBloom": "0x00000004000000000000000000010000400000000000000000000010000000000002000000008420000000000000000000008000000000000000000000000000000000000000000000000000000002800000000000000000000100000000000000000000020000000000120000000800000000800000000080000000000000000000000000000000000000008000000000000000000080000000000000a00012200000000000000000000000000600000000000000000000001000000000004000000020000000000001000000040000000000000400000100108000001020000000000000000000000000000000000000000000000000000000000000100000", - "blockHash": "0xcb810e249bd6e05c2d49086299a2246621c63bf3baad263744a2f7d393b9d290", - "transactionHash": "0xcf7b5b2785afda381e69a3332e762059c6c1f7c369b5fe288acc2c34cdb6f54c", + "contractAddress": "0xc8E11c3eaE08dc17d800d84c8427E6e3E9525892", + "transactionIndex": 8, + "gasUsed": "895720", + "logsBloom": "0x00000004000000000000000000000000400800000000000000000080000000000002000000008400000000000001000000008000000000000000000000000000000000000000000000000000000002800000000000000000000100000000004000000000020000000000020000000800000000800000000080000000000000000000010040000000000000000000000000000000000080000000000000a00000208000000000000000000000000400000000000000000000001000000000004000000020000000000001000000040010000000020400000100108040000020802000000000000000000000000000000004000000000000000000000000100000", + "blockHash": "0xf49012b4445a834a8e22019bcea3b3ebf067ee97c2066f059eb2448fd20502c3", + "transactionHash": "0x89256e020ff9a95b5c6817d035f7caf0e36899cdcd0cce4fcb91210da8a5758f", "logs": [ { - "transactionIndex": 5, - "blockNumber": 38596221, - "transactionHash": "0xcf7b5b2785afda381e69a3332e762059c6c1f7c369b5fe288acc2c34cdb6f54c", - "address": "0x376fD92FF818C386C996e43faF07314B05874bc1", + "transactionIndex": 8, + "blockNumber": 38730823, + "transactionHash": "0x89256e020ff9a95b5c6817d035f7caf0e36899cdcd0cce4fcb91210da8a5758f", + "address": "0xc8E11c3eaE08dc17d800d84c8427E6e3E9525892", "topics": [ "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", - "0x000000000000000000000000ab182cfcd654a0fdd6dbb4bb9722adb5d158a2f4" + "0x0000000000000000000000009c4831b0c6bdfd76813726efd7848a247de4993e" ], "data": "0x", - "logIndex": 14, - "blockHash": "0xcb810e249bd6e05c2d49086299a2246621c63bf3baad263744a2f7d393b9d290" + "logIndex": 60, + "blockHash": "0xf49012b4445a834a8e22019bcea3b3ebf067ee97c2066f059eb2448fd20502c3" }, { - "transactionIndex": 5, - "blockNumber": 38596221, - "transactionHash": "0xcf7b5b2785afda381e69a3332e762059c6c1f7c369b5fe288acc2c34cdb6f54c", - "address": "0x376fD92FF818C386C996e43faF07314B05874bc1", + "transactionIndex": 8, + "blockNumber": 38730823, + "transactionHash": "0x89256e020ff9a95b5c6817d035f7caf0e36899cdcd0cce4fcb91210da8a5758f", + "address": "0xc8E11c3eaE08dc17d800d84c8427E6e3E9525892", + "topics": [ + "0x8ca022029d8ff7ad974913f8970aeed6c5e0e7eaf494a0c5b262249f6b5759e5", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f7", + "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" + ], + "data": "0x", + "logIndex": 61, + "blockHash": "0xf49012b4445a834a8e22019bcea3b3ebf067ee97c2066f059eb2448fd20502c3" + }, + { + "transactionIndex": 8, + "blockNumber": 38730823, + "transactionHash": "0x89256e020ff9a95b5c6817d035f7caf0e36899cdcd0cce4fcb91210da8a5758f", + "address": "0xc8E11c3eaE08dc17d800d84c8427E6e3E9525892", "topics": [ "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "0x0000000000000000000000000000000000000000000000000000000000000000", @@ -182,58 +197,58 @@ "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 15, - "blockHash": "0xcb810e249bd6e05c2d49086299a2246621c63bf3baad263744a2f7d393b9d290" + "logIndex": 62, + "blockHash": "0xf49012b4445a834a8e22019bcea3b3ebf067ee97c2066f059eb2448fd20502c3" }, { - "transactionIndex": 5, - "blockNumber": 38596221, - "transactionHash": "0xcf7b5b2785afda381e69a3332e762059c6c1f7c369b5fe288acc2c34cdb6f54c", - "address": "0x376fD92FF818C386C996e43faF07314B05874bc1", + "transactionIndex": 8, + "blockNumber": 38730823, + "transactionHash": "0x89256e020ff9a95b5c6817d035f7caf0e36899cdcd0cce4fcb91210da8a5758f", + "address": "0xc8E11c3eaE08dc17d800d84c8427E6e3E9525892", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x0000000000000000000000000000000000000000000000000000000000000001", - "logIndex": 16, - "blockHash": "0xcb810e249bd6e05c2d49086299a2246621c63bf3baad263744a2f7d393b9d290" + "logIndex": 63, + "blockHash": "0xf49012b4445a834a8e22019bcea3b3ebf067ee97c2066f059eb2448fd20502c3" }, { - "transactionIndex": 5, - "blockNumber": 38596221, - "transactionHash": "0xcf7b5b2785afda381e69a3332e762059c6c1f7c369b5fe288acc2c34cdb6f54c", - "address": "0x376fD92FF818C386C996e43faF07314B05874bc1", + "transactionIndex": 8, + "blockNumber": 38730823, + "transactionHash": "0x89256e020ff9a95b5c6817d035f7caf0e36899cdcd0cce4fcb91210da8a5758f", + "address": "0xc8E11c3eaE08dc17d800d84c8427E6e3E9525892", "topics": [ "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" ], - "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c3c6b8feee55636e949920aa90f093f6f5faf448", - "logIndex": 17, - "blockHash": "0xcb810e249bd6e05c2d49086299a2246621c63bf3baad263744a2f7d393b9d290" + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c26b12025e378c570fb46249093ba387a2e927bc", + "logIndex": 64, + "blockHash": "0xf49012b4445a834a8e22019bcea3b3ebf067ee97c2066f059eb2448fd20502c3" }, { - "transactionIndex": 5, - "blockNumber": 38596221, - "transactionHash": "0xcf7b5b2785afda381e69a3332e762059c6c1f7c369b5fe288acc2c34cdb6f54c", + "transactionIndex": 8, + "blockNumber": 38730823, + "transactionHash": "0x89256e020ff9a95b5c6817d035f7caf0e36899cdcd0cce4fcb91210da8a5758f", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", - "0x000000000000000000000000f903ba9e006193c1527bfbe65fe2123704ea3f99" + "0x000000000000000000000000be188d6641e8b680743a4815dfa0f6208038960f" ], - "data": "0x0000000000000000000000000000000000000000000000000004c2195736740000000000000000000000000000000000000000000000001171c08020c0ba31ed00000000000000000000000000000000000000000000103232162979ff023f3900000000000000000000000000000000000000000000001171bbbe076983bded000000000000000000000000000000000000000000001032321aeb935638b339", - "logIndex": 18, - "blockHash": "0xcb810e249bd6e05c2d49086299a2246621c63bf3baad263744a2f7d393b9d290" + "data": "0x0000000000000000000000000000000000000000000000000004c5fa98a0980000000000000000000000000000000000000000000000001170f133bc034935c30000000000000000000000000000000000000000000033a6d59d04cd85b4687c00000000000000000000000000000000000000000000001170ec6dc16aa89dc30000000000000000000000000000000000000000000033a6d5a1cac81e55007c", + "logIndex": 65, + "blockHash": "0xf49012b4445a834a8e22019bcea3b3ebf067ee97c2066f059eb2448fd20502c3" } ], - "blockNumber": 38596221, - "cumulativeGasUsed": "1503356", + "blockNumber": 38730823, + "cumulativeGasUsed": "4265291", "status": 1, "byzantium": true }, "args": [ - "0xAB182cfcd654A0fdD6dBb4BB9722adB5D158A2f4", - "0xc3C6B8feeE55636e949920Aa90f093f6f5Faf448", - "0xc91f0c5300000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000b0fb55e91b58d8db07aabff2d6b5a8e2e1bf8d08000000000000000000000000284b028af7cead623c2f99ebe7edc9e1a02eef5e000000000000000000000000b2732c13804d60866606d61b1b9450eb4704e59600000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f700000000000000000000000049c4d4c94829b9c44052c5f5cb164fc612181165000000000000000000000000000000000000000000000000000000000000001453616e64626f78204173736574204372656174650000000000000000000000000000000000000000000000000000000000000000000000000000000000000003312e300000000000000000000000000000000000000000000000000000000000" + "0x9c4831B0c6BDFd76813726efD7848A247dE4993E", + "0xc26B12025e378c570Fb46249093Ba387A2e927bc", + "0xc91f0c5300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000007af8c95334240026385f7309d9a8b9e4265fc70a000000000000000000000000d4d1e504be6d12829c3ddfa59778d35203cc358c0000000000000000000000009f6031f7728ff4de931036477ea9bba5ae7cf97400000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f700000000000000000000000049c4d4c94829b9c44052c5f5cb164fc612181165000000000000000000000000000000000000000000000000000000000000001453616e64626f78204173736574204372656174650000000000000000000000000000000000000000000000000000000000000000000000000000000000000003312e300000000000000000000000000000000000000000000000000000000000" ], "numDeployments": 1, "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", diff --git a/packages/deploy/deployments/mumbai/AssetReveal.json b/packages/deploy/deployments/mumbai/AssetReveal.json index 435fa4c47b..1fb0e3b46d 100644 --- a/packages/deploy/deployments/mumbai/AssetReveal.json +++ b/packages/deploy/deployments/mumbai/AssetReveal.json @@ -1,5 +1,5 @@ { - "address": "0x1DCfE371272031e6dD9f79d7cDC63B2276298548", + "address": "0xe69cfd1674d44f13F3889F23a8B359742491C754", "abi": [ { "anonymous": false, @@ -355,6 +355,31 @@ "name": "TrustedForwarderChanged", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldTrustedForwarder", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newTrustedForwarder", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, { "inputs": [], "name": "BATCH_REVEAL_TYPEHASH", @@ -539,7 +564,7 @@ "outputs": [ { "internalType": "address", - "name": "trustedForwarder", + "name": "", "type": "address" } ], @@ -856,35 +881,50 @@ "type": "constructor" } ], - "transactionHash": "0xbc15f002e6ac482a02235446d35bc8aeb7f2630a79335af11a8285913c5c8bb1", + "transactionHash": "0x46df2836ef740bc9dda28e8634ca781ac42f3295f7dce7a682b17a15da3a5176", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0x1DCfE371272031e6dD9f79d7cDC63B2276298548", - "transactionIndex": 2, - "gasUsed": "891822", - "logsBloom": "0x00000004000000020001000000000000400000000400000000000000000000000002000000008400000000000000000000008000000000000000000000000000000000000000000000000000000002800000040000000000000100000000000000000000020000000000020000000800000000800000000080000000000000000000000000000000000000000000000000008000000080000000000000a00000200000000000000020000000400400000001000000000000001000000000004000040020000000000001000000040000000000000400000100108000000020000000000000000000000000000000000000000000000000000000000000100000", - "blockHash": "0xf30b5b61e6be2129220334767b39c72959c34340522cdfe71ce42574edba7813", - "transactionHash": "0xbc15f002e6ac482a02235446d35bc8aeb7f2630a79335af11a8285913c5c8bb1", + "contractAddress": "0xe69cfd1674d44f13F3889F23a8B359742491C754", + "transactionIndex": 4, + "gasUsed": "894627", + "logsBloom": "0x00000004000000000000000000000000400000000000000800000080080000000002000000008400000000000001000000008000000000000000000000000000000000000000020000000000000002800000000000000000000100000000004000000000020000000000020000000800000000800000100080000000000000000000010040000000000000000000000000000000000080000000000000a00000200000000000000000000000000400000000000000000000001000000000004040000020000000000001000000040000000000000400000100108040000020002000000000000000000000000000000004000000000000000000000000100000", + "blockHash": "0x02759b457eec4f910b2000ec9d0c7f1d32c38a0dbd86ce35b9abd9abd35d9fb7", + "transactionHash": "0x46df2836ef740bc9dda28e8634ca781ac42f3295f7dce7a682b17a15da3a5176", "logs": [ { - "transactionIndex": 2, - "blockNumber": 38596228, - "transactionHash": "0xbc15f002e6ac482a02235446d35bc8aeb7f2630a79335af11a8285913c5c8bb1", - "address": "0x1DCfE371272031e6dD9f79d7cDC63B2276298548", + "transactionIndex": 4, + "blockNumber": 38730830, + "transactionHash": "0x46df2836ef740bc9dda28e8634ca781ac42f3295f7dce7a682b17a15da3a5176", + "address": "0xe69cfd1674d44f13F3889F23a8B359742491C754", "topics": [ "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", - "0x0000000000000000000000000a6a0a03b2a26f1384ed6234e3cbc6635e3ce5a9" + "0x00000000000000000000000097afc3cdf0ca007dc9f131d1d46d51fa8ea92c9f" ], "data": "0x", - "logIndex": 4, - "blockHash": "0xf30b5b61e6be2129220334767b39c72959c34340522cdfe71ce42574edba7813" + "logIndex": 5, + "blockHash": "0x02759b457eec4f910b2000ec9d0c7f1d32c38a0dbd86ce35b9abd9abd35d9fb7" }, { - "transactionIndex": 2, - "blockNumber": 38596228, - "transactionHash": "0xbc15f002e6ac482a02235446d35bc8aeb7f2630a79335af11a8285913c5c8bb1", - "address": "0x1DCfE371272031e6dD9f79d7cDC63B2276298548", + "transactionIndex": 4, + "blockNumber": 38730830, + "transactionHash": "0x46df2836ef740bc9dda28e8634ca781ac42f3295f7dce7a682b17a15da3a5176", + "address": "0xe69cfd1674d44f13F3889F23a8B359742491C754", + "topics": [ + "0x8ca022029d8ff7ad974913f8970aeed6c5e0e7eaf494a0c5b262249f6b5759e5", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f7", + "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" + ], + "data": "0x", + "logIndex": 6, + "blockHash": "0x02759b457eec4f910b2000ec9d0c7f1d32c38a0dbd86ce35b9abd9abd35d9fb7" + }, + { + "transactionIndex": 4, + "blockNumber": 38730830, + "transactionHash": "0x46df2836ef740bc9dda28e8634ca781ac42f3295f7dce7a682b17a15da3a5176", + "address": "0xe69cfd1674d44f13F3889F23a8B359742491C754", "topics": [ "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "0x0000000000000000000000000000000000000000000000000000000000000000", @@ -892,58 +932,58 @@ "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 5, - "blockHash": "0xf30b5b61e6be2129220334767b39c72959c34340522cdfe71ce42574edba7813" + "logIndex": 7, + "blockHash": "0x02759b457eec4f910b2000ec9d0c7f1d32c38a0dbd86ce35b9abd9abd35d9fb7" }, { - "transactionIndex": 2, - "blockNumber": 38596228, - "transactionHash": "0xbc15f002e6ac482a02235446d35bc8aeb7f2630a79335af11a8285913c5c8bb1", - "address": "0x1DCfE371272031e6dD9f79d7cDC63B2276298548", + "transactionIndex": 4, + "blockNumber": 38730830, + "transactionHash": "0x46df2836ef740bc9dda28e8634ca781ac42f3295f7dce7a682b17a15da3a5176", + "address": "0xe69cfd1674d44f13F3889F23a8B359742491C754", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x0000000000000000000000000000000000000000000000000000000000000001", - "logIndex": 6, - "blockHash": "0xf30b5b61e6be2129220334767b39c72959c34340522cdfe71ce42574edba7813" + "logIndex": 8, + "blockHash": "0x02759b457eec4f910b2000ec9d0c7f1d32c38a0dbd86ce35b9abd9abd35d9fb7" }, { - "transactionIndex": 2, - "blockNumber": 38596228, - "transactionHash": "0xbc15f002e6ac482a02235446d35bc8aeb7f2630a79335af11a8285913c5c8bb1", - "address": "0x1DCfE371272031e6dD9f79d7cDC63B2276298548", + "transactionIndex": 4, + "blockNumber": 38730830, + "transactionHash": "0x46df2836ef740bc9dda28e8634ca781ac42f3295f7dce7a682b17a15da3a5176", + "address": "0xe69cfd1674d44f13F3889F23a8B359742491C754", "topics": [ "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" ], - "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c3c6b8feee55636e949920aa90f093f6f5faf448", - "logIndex": 7, - "blockHash": "0xf30b5b61e6be2129220334767b39c72959c34340522cdfe71ce42574edba7813" + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c26b12025e378c570fb46249093ba387a2e927bc", + "logIndex": 9, + "blockHash": "0x02759b457eec4f910b2000ec9d0c7f1d32c38a0dbd86ce35b9abd9abd35d9fb7" }, { - "transactionIndex": 2, - "blockNumber": 38596228, - "transactionHash": "0xbc15f002e6ac482a02235446d35bc8aeb7f2630a79335af11a8285913c5c8bb1", + "transactionIndex": 4, + "blockNumber": 38730830, + "transactionHash": "0x46df2836ef740bc9dda28e8634ca781ac42f3295f7dce7a682b17a15da3a5176", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", - "0x000000000000000000000000c26880a0af2ea0c7e8130e6ec47af756465452e8" + "0x000000000000000000000000be188d6641e8b680743a4815dfa0f6208038960f" ], - "data": "0x0000000000000000000000000000000000000000000000000005b3fe486df35c00000000000000000000000000000000000000000000001171aaed040893a9490000000000000000000000000000000000000000000021166bbbbbbba24069b800000000000000000000000000000000000000000000001171a53905c025b5ed0000000000000000000000000000000000000000000021166bc16fb9eaae5d14", - "logIndex": 8, - "blockHash": "0xf30b5b61e6be2129220334767b39c72959c34340522cdfe71ce42574edba7813" + "data": "0x0000000000000000000000000000000000000000000000000004c47cdecfed0000000000000000000000000000000000000000000000001170d567f74f390e330000000000000000000000000000000000000000000033a6d654a80d849ca1b700000000000000000000000000000000000000000000001170d0a37a706921330000000000000000000000000000000000000000000033a6d6596c8a636c8eb7", + "logIndex": 10, + "blockHash": "0x02759b457eec4f910b2000ec9d0c7f1d32c38a0dbd86ce35b9abd9abd35d9fb7" } ], - "blockNumber": 38596228, - "cumulativeGasUsed": "1038756", + "blockNumber": 38730830, + "cumulativeGasUsed": "1029192", "status": 1, "byzantium": true }, "args": [ - "0x0A6A0A03b2a26F1384Ed6234E3cBc6635e3CE5A9", - "0xc3C6B8feeE55636e949920Aa90f093f6f5Faf448", - "0xe56f2fe400000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000b0fb55e91b58d8db07aabff2d6b5a8e2e1bf8d08000000000000000000000000b2732c13804d60866606d61b1b9450eb4704e59600000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f700000000000000000000000049c4d4c94829b9c44052c5f5cb164fc612181165000000000000000000000000000000000000000000000000000000000000001453616e64626f782041737365742052657665616c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000003312e300000000000000000000000000000000000000000000000000000000000" + "0x97AfC3CDf0CA007DC9f131d1D46d51Fa8eA92c9F", + "0xc26B12025e378c570Fb46249093Ba387A2e927bc", + "0xe56f2fe400000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000007af8c95334240026385f7309d9a8b9e4265fc70a0000000000000000000000009f6031f7728ff4de931036477ea9bba5ae7cf97400000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f700000000000000000000000049c4d4c94829b9c44052c5f5cb164fc612181165000000000000000000000000000000000000000000000000000000000000001453616e64626f782041737365742052657665616c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000003312e300000000000000000000000000000000000000000000000000000000000" ], "numDeployments": 1, "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", @@ -955,13 +995,13 @@ "args": [ "Sandbox Asset Reveal", "1.0", - "0xb0fb55e91B58D8db07aaBFF2D6b5A8e2e1bf8D08", - "0xb2732c13804D60866606D61B1b9450Eb4704e596", + "0x7AF8c95334240026385f7309D9a8b9e4265FC70a", + "0x9f6031F7728FF4dE931036477Ea9bBa5aE7Cf974", "0x69015912aa33720b842dcd6ac059ed623f28d9f7", "0x49c4D4C94829B9c44052C5f5Cb164Fc612181165" ] }, - "implementation": "0x0A6A0A03b2a26F1384Ed6234E3cBc6635e3CE5A9", + "implementation": "0x97AfC3CDf0CA007DC9f131d1D46d51Fa8eA92c9F", "devdoc": { "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", "kind": "dev", diff --git a/packages/deploy/deployments/mumbai/AssetReveal_Implementation.json b/packages/deploy/deployments/mumbai/AssetReveal_Implementation.json index bc9031fc37..ee6c64aaf3 100644 --- a/packages/deploy/deployments/mumbai/AssetReveal_Implementation.json +++ b/packages/deploy/deployments/mumbai/AssetReveal_Implementation.json @@ -1,5 +1,5 @@ { - "address": "0x0A6A0A03b2a26F1384Ed6234E3cBc6635e3CE5A9", + "address": "0x97AfC3CDf0CA007DC9f131d1D46d51Fa8eA92c9F", "abi": [ { "inputs": [], @@ -237,6 +237,31 @@ "name": "TrustedForwarderChanged", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldTrustedForwarder", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newTrustedForwarder", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, { "inputs": [], "name": "BATCH_REVEAL_TYPEHASH", @@ -421,7 +446,7 @@ "outputs": [ { "internalType": "address", - "name": "trustedForwarder", + "name": "", "type": "address" } ], @@ -717,56 +742,56 @@ "type": "function" } ], - "transactionHash": "0xa5139ad6954d5365dde3c587efddf6fdfa01c5dfa450436c32733070f3153afe", + "transactionHash": "0xdb9487bbc38d9b641e31142f638fb33972abb02bae483528d4e166ed28e8096e", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0x0A6A0A03b2a26F1384Ed6234E3cBc6635e3CE5A9", - "transactionIndex": 5, - "gasUsed": "3155608", - "logsBloom": "0x00000000000000020000000000000000000000000000000000000000000000000002000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100000000000000000000000000000000000000000000000000000000000080000000000000000000000000000020000000000000000000000000000080000000000000600000200000000000000020000000000400000001000000000000000000000000004020000000000000000001000000040000000000000000000000108000000000000000000000000000000000000000000000000000000000000000000000100000", - "blockHash": "0xd7403cdc467578976604fbbf60dbc7b0ddd9edd205dbcd126ec60ce22591d4b5", - "transactionHash": "0xa5139ad6954d5365dde3c587efddf6fdfa01c5dfa450436c32733070f3153afe", + "contractAddress": "0x97AfC3CDf0CA007DC9f131d1D46d51Fa8eA92c9F", + "transactionIndex": 3, + "gasUsed": "3240145", + "logsBloom": "0x00200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100000000004000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000080000000000000200000200000000000000000000000000400000000000000000000000000000000004000000080000000000001000000040000000000000000000000108040000000000000000000000040000000000000000000000000000000000000000000100000", + "blockHash": "0x4b0de452685f89b43c910894408e2328aa1a800d52a1682aadf9390612d48366", + "transactionHash": "0xdb9487bbc38d9b641e31142f638fb33972abb02bae483528d4e166ed28e8096e", "logs": [ { - "transactionIndex": 5, - "blockNumber": 38596224, - "transactionHash": "0xa5139ad6954d5365dde3c587efddf6fdfa01c5dfa450436c32733070f3153afe", - "address": "0x0A6A0A03b2a26F1384Ed6234E3cBc6635e3CE5A9", + "transactionIndex": 3, + "blockNumber": 38730827, + "transactionHash": "0xdb9487bbc38d9b641e31142f638fb33972abb02bae483528d4e166ed28e8096e", + "address": "0x97AfC3CDf0CA007DC9f131d1D46d51Fa8eA92c9F", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", "logIndex": 8, - "blockHash": "0xd7403cdc467578976604fbbf60dbc7b0ddd9edd205dbcd126ec60ce22591d4b5" + "blockHash": "0x4b0de452685f89b43c910894408e2328aa1a800d52a1682aadf9390612d48366" }, { - "transactionIndex": 5, - "blockNumber": 38596224, - "transactionHash": "0xa5139ad6954d5365dde3c587efddf6fdfa01c5dfa450436c32733070f3153afe", + "transactionIndex": 3, + "blockNumber": 38730827, + "transactionHash": "0xdb9487bbc38d9b641e31142f638fb33972abb02bae483528d4e166ed28e8096e", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", - "0x000000000000000000000000c26880a0af2ea0c7e8130e6ec47af756465452e8" + "0x000000000000000000000000be188d6641e8b680743a4815dfa0f6208038960f" ], - "data": "0x0000000000000000000000000000000000000000000000000010d1035cd5e80000000000000000000000000000000000000000000000001171bbbe07689c21610000000000000000000000000000000000000000000021166af1f1a36c6ede1a00000000000000000000000000000000000000000000001171aaed040bc639610000000000000000000000000000000000000000000021166b02c2a6c944c61a", + "data": "0x000000000000000000000000000000000000000000000000001705ca177dd40000000000000000000000000000000000000000000000001170ec6dc169cdef430000000000000000000000000000000000000000000033a6d5f87d6971f111df00000000000000000000000000000000000000000000001170d567f752501b430000000000000000000000000000000000000000000033a6d60f8333896ee5df", "logIndex": 9, - "blockHash": "0xd7403cdc467578976604fbbf60dbc7b0ddd9edd205dbcd126ec60ce22591d4b5" + "blockHash": "0x4b0de452685f89b43c910894408e2328aa1a800d52a1682aadf9390612d48366" } ], - "blockNumber": 38596224, - "cumulativeGasUsed": "3859606", + "blockNumber": 38730827, + "cumulativeGasUsed": "3366311", "status": 1, "byzantium": true }, "args": [], "numDeployments": 1, - "solcInputHash": "2e616d6ee49dab0a55f9d72f1f7a9977", - "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"revealer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"unrevealedTokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"AssetRevealBatchBurn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"unrevealedTokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[][]\",\"name\":\"amounts\",\"type\":\"uint256[][]\"},{\"indexed\":false,\"internalType\":\"uint256[][]\",\"name\":\"newTokenIds\",\"type\":\"uint256[][]\"},{\"indexed\":false,\"internalType\":\"bytes32[][]\",\"name\":\"revealHashes\",\"type\":\"bytes32[][]\"}],\"name\":\"AssetRevealBatchMint\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"revealer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unrevealedTokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"AssetRevealBurn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unrevealedTokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"newTokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"bytes32[]\",\"name\":\"revealHashes\",\"type\":\"bytes32[]\"}],\"name\":\"AssetRevealMint\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newTrustedForwarderAddress\",\"type\":\"address\"}],\"name\":\"TrustedForwarderChanged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BATCH_REVEAL_TYPEHASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"INSTANT_REVEAL_TYPEHASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REVEAL_TYPEHASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"prevTokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"burnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"string[]\",\"name\":\"metadataHashes\",\"type\":\"string[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"revealHashes\",\"type\":\"bytes32[]\"}],\"name\":\"burnAndReveal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAssetContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAuthValidator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTrustedForwarder\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_version\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_assetContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_authValidator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_forwarder\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_defaultAdmin\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"}],\"name\":\"isTrustedForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"revealBatchBurn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"uint256[]\",\"name\":\"prevTokenIds\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[][]\",\"name\":\"amounts\",\"type\":\"uint256[][]\"},{\"internalType\":\"string[][]\",\"name\":\"metadataHashes\",\"type\":\"string[][]\"},{\"internalType\":\"bytes32[][]\",\"name\":\"revealHashes\",\"type\":\"bytes32[][]\"}],\"name\":\"revealBatchMint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"revealBurn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"revealHash\",\"type\":\"bytes32\"}],\"name\":\"revealHashUsed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"prevTokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"string[]\",\"name\":\"metadataHashes\",\"type\":\"string[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"revealHashes\",\"type\":\"bytes32[]\"}],\"name\":\"revealMint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"name\":\"setTrustedForwarder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"The Sandbox\",\"events\":{\"EIP712DomainChanged()\":{\"details\":\"MAY be emitted to signal that the domain could have changed.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"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._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"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`)\"}},\"kind\":\"dev\",\"methods\":{\"burnAndReveal(bytes,uint256,uint256,uint256[],string[],bytes32[])\":{\"details\":\"Should be used where it is not required to keep the metadata secret, e.g. mythical assets where users select their desired abilities and enhancements\",\"params\":{\"amounts\":\"The amount of assets to reveal (sum must be equal to the burnAmount)\",\"burnAmount\":\"The amount of assets to burn\",\"metadataHashes\":\"The array of hashes for asset metadata\",\"prevTokenId\":\"The tokenId of the unrevealed asset\",\"revealHashes\":\"A revealHash array providing a random bytes32 generated by the TSB backend for each new tokenId\",\"signature\":\"Signature created on the TSB backend containing INSTANT_REVEAL_TYPEHASH and associated data, must be signed by authorized signer\"}},\"constructor\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"eip712Domain()\":{\"details\":\"See {EIP-5267}. _Available since v4.9._\"},\"getAssetContract()\":{\"returns\":{\"_0\":\"The asset contract address\"}},\"getAuthValidator()\":{\"returns\":{\"_0\":\"The auth validator address\"}},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"grantRole(bytes32,address)\":{\"details\":\"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.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"initialize(string,string,address,address,address,address)\":{\"params\":{\"_assetContract\":\"The address of the asset contract\",\"_authValidator\":\"The address of the AuthSuperValidator contract\",\"_forwarder\":\"The address of the forwarder contract\"}},\"renounceRole(bytes32,address)\":{\"details\":\"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.\"},\"revealBatchBurn(uint256[],uint256[])\":{\"details\":\"Can be used to burn multiple copies of the same token id, each copy will be revealed separately\",\"params\":{\"amounts\":\"the amounts of the assets to burn\",\"tokenIds\":\"the tokenIds of the assets to burn\"}},\"revealBatchMint(bytes,uint256[],uint256[][],string[][],bytes32[][])\":{\"details\":\"Can be used to reveal multiple copies of the same token id\",\"params\":{\"amounts\":\"The amount of assets to reveal (must be equal to the length of revealHashes)\",\"metadataHashes\":\"The array of hashes for asset metadata\",\"prevTokenIds\":\"The tokenId of the unrevealed asset\",\"revealHashes\":\"Array of revealHash arrays providing random bytes32 generated by the TSB backend for each new tokenId\",\"signature\":\"Signatures created on the TSB backend containing REVEAL_TYPEHASH and associated data, must be signed by authorized signer\"}},\"revealBurn(uint256,uint256)\":{\"details\":\"the reveal mechanism works through burning the asset and minting a new one with updated tokenId\",\"params\":{\"amount\":\"the amount of tokens to reveal\",\"tokenId\":\"the tokenId of id idasset to reveal\"}},\"revealHashUsed(bytes32)\":{\"returns\":{\"_0\":\"Whether it has been used\"}},\"revealMint(bytes,uint256,uint256[],string[],bytes32[])\":{\"details\":\"Can be used to reveal multiple copies of the same token id\",\"params\":{\"amounts\":\"The amount of assets to reveal (length reflects the number of types of reveal tokens and must be equal to the length of revealHashes)\",\"metadataHashes\":\"The array of hashes for revealed asset metadata\",\"prevTokenId\":\"The tokenId of the unrevealed asset\",\"revealHashes\":\"A revealHash array providing a random bytes32 generated by the TSB backend for each new tokenId\",\"signature\":\"Signature created on the TSB backend containing REVEAL_TYPEHASH and associated data, must be signed by authorized signer\"}},\"revokeRole(bytes32,address)\":{\"details\":\"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.\"},\"setTrustedForwarder(address)\":{\"details\":\"Change the address of the trusted forwarder for meta-TX\",\"params\":{\"trustedForwarder\":\"The new trustedForwarder\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"title\":\"AssetReveal\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"burnAndReveal(bytes,uint256,uint256,uint256[],string[],bytes32[])\":{\"notice\":\"Reveal assets to view their abilities and enhancements and mint them in a single transaction\"},\"getAssetContract()\":{\"notice\":\"Get the asset contract address\"},\"getAuthValidator()\":{\"notice\":\"Get the auth validator address\"},\"initialize(string,string,address,address,address,address)\":{\"notice\":\"Initialize the contract\"},\"revealBatchBurn(uint256[],uint256[])\":{\"notice\":\"Burn multiple assets to be able to reveal them later\"},\"revealBatchMint(bytes,uint256[],uint256[][],string[][],bytes32[][])\":{\"notice\":\"Mint multiple assets with revealed abilities and enhancements\"},\"revealBurn(uint256,uint256)\":{\"notice\":\"Reveal an asset to view its abilities and enhancements\"},\"revealHashUsed(bytes32)\":{\"notice\":\"Get the status of a revealHash\"},\"revealMint(bytes,uint256,uint256[],string[],bytes32[])\":{\"notice\":\"Reveal assets to view their abilities and enhancements\"},\"setTrustedForwarder(address)\":{\"notice\":\"Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\"}},\"notice\":\"Contract for burning and revealing assets\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"@sandbox-smart-contracts/asset/contracts/AssetReveal.sol\":\"AssetReveal\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlUpgradeable.sol\\\";\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\\n function __AccessControl_init() internal onlyInitializing {\\n }\\n\\n function __AccessControl_init_unchained() internal onlyInitializing {\\n }\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n StringsUpgradeable.toHexString(account),\\n \\\" is missing role \\\",\\n StringsUpgradeable.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xfeefb24d068524440e1ba885efdf105d91f83504af3c2d745ffacc4595396831\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControlUpgradeable {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0xb8f5302f12138c5561362e88a78d061573e6298b7a1a5afe84a1e2c8d4d5aeaa\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC5267Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\\n\\npragma solidity ^0.8.0;\\n\\ninterface IERC5267Upgradeable {\\n /**\\n * @dev MAY be emitted to signal that the domain could have changed.\\n */\\n event EIP712DomainChanged();\\n\\n /**\\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\\n * signature.\\n */\\n function eip712Domain()\\n external\\n view\\n returns (\\n bytes1 fields,\\n string memory name,\\n string memory version,\\n uint256 chainId,\\n address verifyingContract,\\n bytes32 salt,\\n uint256[] memory extensions\\n );\\n}\\n\",\"keccak256\":\"0xe562dab443278837fa50faddb76743399e942181881db8dccaea3bd1712994db\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized != type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../StringsUpgradeable.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSAUpgradeable {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\")\\n mstore(0x1c, hash)\\n message := keccak256(0x00, 0x3c)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", StringsUpgradeable.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, \\\"\\\\x19\\\\x01\\\")\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n data := keccak256(ptr, 0x42)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\\n * `validator` and `data` according to the version 0 of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x00\\\", validator, data));\\n }\\n}\\n\",\"keccak256\":\"0xa014f65d84b02827055d99993ccdbfb4b56b2c9e91eb278d82a93330659d06e4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.8;\\n\\nimport \\\"./ECDSAUpgradeable.sol\\\";\\nimport \\\"../../interfaces/IERC5267Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\\n *\\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\\n *\\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\\n * ({_hashTypedDataV4}).\\n *\\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\\n * the chain id to protect against replay attacks on an eventual fork of the chain.\\n *\\n * NOTE: This contract implements the version of the encoding known as \\\"v4\\\", as implemented by the JSON RPC method\\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\\n *\\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\\n *\\n * _Available since v3.4._\\n *\\n * @custom:storage-size 52\\n */\\nabstract contract EIP712Upgradeable is Initializable, IERC5267Upgradeable {\\n bytes32 private constant _TYPE_HASH =\\n keccak256(\\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\");\\n\\n /// @custom:oz-renamed-from _HASHED_NAME\\n bytes32 private _hashedName;\\n /// @custom:oz-renamed-from _HASHED_VERSION\\n bytes32 private _hashedVersion;\\n\\n string private _name;\\n string private _version;\\n\\n /**\\n * @dev Initializes the domain separator and parameter caches.\\n *\\n * The meaning of `name` and `version` is specified in\\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\\n *\\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\\n * - `version`: the current major version of the signing domain.\\n *\\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\\n * contract upgrade].\\n */\\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\\n __EIP712_init_unchained(name, version);\\n }\\n\\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\\n _name = name;\\n _version = version;\\n\\n // Reset prior values in storage if upgrading\\n _hashedName = 0;\\n _hashedVersion = 0;\\n }\\n\\n /**\\n * @dev Returns the domain separator for the current chain.\\n */\\n function _domainSeparatorV4() internal view returns (bytes32) {\\n return _buildDomainSeparator();\\n }\\n\\n function _buildDomainSeparator() private view returns (bytes32) {\\n return keccak256(abi.encode(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this)));\\n }\\n\\n /**\\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\\n * function returns the hash of the fully encoded EIP712 message for this domain.\\n *\\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\\n *\\n * ```solidity\\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\\n * keccak256(\\\"Mail(address to,string contents)\\\"),\\n * mailTo,\\n * keccak256(bytes(mailContents))\\n * )));\\n * address signer = ECDSA.recover(digest, signature);\\n * ```\\n */\\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n\\n /**\\n * @dev See {EIP-5267}.\\n *\\n * _Available since v4.9._\\n */\\n function eip712Domain()\\n public\\n view\\n virtual\\n override\\n returns (\\n bytes1 fields,\\n string memory name,\\n string memory version,\\n uint256 chainId,\\n address verifyingContract,\\n bytes32 salt,\\n uint256[] memory extensions\\n )\\n {\\n // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized\\n // and the EIP712 domain is not reliable, as it will be missing name and version.\\n require(_hashedName == 0 && _hashedVersion == 0, \\\"EIP712: Uninitialized\\\");\\n\\n return (\\n hex\\\"0f\\\", // 01111\\n _EIP712Name(),\\n _EIP712Version(),\\n block.chainid,\\n address(this),\\n bytes32(0),\\n new uint256[](0)\\n );\\n }\\n\\n /**\\n * @dev The name parameter for the EIP712 domain.\\n *\\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\\n * are a concern.\\n */\\n function _EIP712Name() internal virtual view returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev The version parameter for the EIP712 domain.\\n *\\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\\n * are a concern.\\n */\\n function _EIP712Version() internal virtual view returns (string memory) {\\n return _version;\\n }\\n\\n /**\\n * @dev The hash of the name parameter for the EIP712 domain.\\n *\\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.\\n */\\n function _EIP712NameHash() internal view returns (bytes32) {\\n string memory name = _EIP712Name();\\n if (bytes(name).length > 0) {\\n return keccak256(bytes(name));\\n } else {\\n // If the name is empty, the contract may have been upgraded without initializing the new storage.\\n // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.\\n bytes32 hashedName = _hashedName;\\n if (hashedName != 0) {\\n return hashedName;\\n } else {\\n return keccak256(\\\"\\\");\\n }\\n }\\n }\\n\\n /**\\n * @dev The hash of the version parameter for the EIP712 domain.\\n *\\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.\\n */\\n function _EIP712VersionHash() internal view returns (bytes32) {\\n string memory version = _EIP712Version();\\n if (bytes(version).length > 0) {\\n return keccak256(bytes(version));\\n } else {\\n // If the version is empty, the contract may have been upgraded without initializing the new storage.\\n // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.\\n bytes32 hashedVersion = _hashedVersion;\\n if (hashedVersion != 0) {\\n return hashedVersion;\\n } else {\\n return keccak256(\\\"\\\");\\n }\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[48] private __gap;\\n}\\n\",\"keccak256\":\"0xeb8d6be406a373771724922eb41b5d593bc8e2dc705daa22cd1145cfc8f5a3a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary MathUpgradeable {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(account),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0dd6e52cb394d7f5abe5dca2d4908a6be40417914720932de757de34a99ab87f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\")\\n mstore(0x1c, hash)\\n message := keccak256(0x00, 0x3c)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, \\\"\\\\x19\\\\x01\\\")\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n data := keccak256(ptr, 0x42)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\\n * `validator` and `data` according to the version 0 of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x00\\\", validator, data));\\n }\\n}\\n\",\"keccak256\":\"0x809bc3edb4bcbef8263fa616c1b60ee0004b50a8a1bfa164d8f57fd31f520c58\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/AssetReveal.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {EIP712Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\\\";\\nimport {\\n AccessControlUpgradeable,\\n ContextUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\\\";\\nimport {TokenIdUtils} from \\\"./libraries/TokenIdUtils.sol\\\";\\nimport {AuthSuperValidator} from \\\"./AuthSuperValidator.sol\\\";\\nimport {ERC2771Handler} from \\\"./ERC2771Handler.sol\\\";\\nimport {IAsset} from \\\"./interfaces/IAsset.sol\\\";\\nimport {IAssetReveal} from \\\"./interfaces/IAssetReveal.sol\\\";\\n\\n/// @title AssetReveal\\n/// @author The Sandbox\\n/// @notice Contract for burning and revealing assets\\ncontract AssetReveal is IAssetReveal, Initializable, AccessControlUpgradeable, ERC2771Handler, EIP712Upgradeable {\\n using TokenIdUtils for uint256;\\n IAsset private assetContract;\\n AuthSuperValidator private authValidator;\\n\\n // mapping of creator to asset id to asset's reveal nonce\\n mapping(address => mapping(uint256 => uint16)) internal revealIds;\\n\\n // mapping for showing whether a revealHash has been used\\n // revealHashes are generated by the TSB backend from reveal burn events and are used for reveal minting\\n mapping(bytes32 => bool) internal revealHashesUsed;\\n\\n bytes32 public constant REVEAL_TYPEHASH =\\n keccak256(\\n \\\"Reveal(address recipient,uint256 prevTokenId,uint256[] amounts,string[] metadataHashes,bytes32[] revealHashes)\\\"\\n );\\n bytes32 public constant BATCH_REVEAL_TYPEHASH =\\n keccak256(\\n \\\"BatchReveal(address recipient,uint256[] prevTokenIds,uint256[][] amounts,string[][] metadataHashes,bytes32[][] revealHashes)\\\"\\n );\\n bytes32 public constant INSTANT_REVEAL_TYPEHASH =\\n keccak256(\\n \\\"InstantReveal(address recipient,uint256 prevTokenId,uint256[] amounts,string[] metadataHashes,bytes32[] revealHashes)\\\"\\n );\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /// @notice Initialize the contract\\n /// @param _assetContract The address of the asset contract\\n /// @param _authValidator The address of the AuthSuperValidator contract\\n /// @param _forwarder The address of the forwarder contract\\n function initialize(\\n string memory _name,\\n string memory _version,\\n address _assetContract,\\n address _authValidator,\\n address _forwarder,\\n address _defaultAdmin\\n ) public initializer {\\n assetContract = IAsset(_assetContract);\\n authValidator = AuthSuperValidator(_authValidator);\\n __ERC2771Handler_initialize(_forwarder);\\n __EIP712_init(_name, _version);\\n _grantRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);\\n }\\n\\n /// @notice Reveal an asset to view its abilities and enhancements\\n /// @dev the reveal mechanism works through burning the asset and minting a new one with updated tokenId\\n /// @param tokenId the tokenId of id idasset to reveal\\n /// @param amount the amount of tokens to reveal\\n function revealBurn(uint256 tokenId, uint256 amount) external {\\n _burnAsset(tokenId, amount);\\n emit AssetRevealBurn(_msgSender(), tokenId, amount);\\n }\\n\\n /// @notice Burn multiple assets to be able to reveal them later\\n /// @dev Can be used to burn multiple copies of the same token id, each copy will be revealed separately\\n /// @param tokenIds the tokenIds of the assets to burn\\n /// @param amounts the amounts of the assets to burn\\n function revealBatchBurn(uint256[] calldata tokenIds, uint256[] calldata amounts) external {\\n _burnAssetBatch(tokenIds, amounts);\\n emit AssetRevealBatchBurn(_msgSender(), tokenIds, amounts);\\n }\\n\\n /// @notice Reveal assets to view their abilities and enhancements\\n /// @dev Can be used to reveal multiple copies of the same token id\\n /// @param signature Signature created on the TSB backend containing REVEAL_TYPEHASH and associated data, must be signed by authorized signer\\n /// @param prevTokenId The tokenId of the unrevealed asset\\n /// @param amounts The amount of assets to reveal (length reflects the number of types of reveal tokens and must be equal to the length of revealHashes)\\n /// @param metadataHashes The array of hashes for revealed asset metadata\\n /// @param revealHashes A revealHash array providing a random bytes32 generated by the TSB backend for each new tokenId\\n function revealMint(\\n bytes memory signature,\\n uint256 prevTokenId,\\n uint256[] calldata amounts,\\n string[] calldata metadataHashes,\\n bytes32[] calldata revealHashes\\n ) external {\\n require(amounts.length == metadataHashes.length, \\\"AssetReveal: Invalid amounts length\\\");\\n require(amounts.length == revealHashes.length, \\\"AssetReveal: Invalid revealHashes length\\\");\\n require(\\n authValidator.verify(\\n signature,\\n _hashReveal(_msgSender(), prevTokenId, amounts, metadataHashes, revealHashes)\\n ),\\n \\\"AssetReveal: Invalid revealMint signature\\\"\\n );\\n uint256[] memory newTokenIds = _revealAsset(prevTokenId, metadataHashes, amounts, revealHashes);\\n emit AssetRevealMint(_msgSender(), prevTokenId, amounts, newTokenIds, revealHashes);\\n }\\n\\n /// @notice Mint multiple assets with revealed abilities and enhancements\\n /// @dev Can be used to reveal multiple copies of the same token id\\n /// @param signature Signatures created on the TSB backend containing REVEAL_TYPEHASH and associated data, must be signed by authorized signer\\n /// @param prevTokenIds The tokenId of the unrevealed asset\\n /// @param amounts The amount of assets to reveal (must be equal to the length of revealHashes)\\n /// @param metadataHashes The array of hashes for asset metadata\\n /// @param revealHashes Array of revealHash arrays providing random bytes32 generated by the TSB backend for each new tokenId\\n function revealBatchMint(\\n bytes calldata signature,\\n uint256[] calldata prevTokenIds,\\n uint256[][] calldata amounts,\\n string[][] calldata metadataHashes,\\n bytes32[][] calldata revealHashes\\n ) external {\\n require(prevTokenIds.length == amounts.length, \\\"AssetReveal: Invalid amounts length\\\");\\n require(amounts.length == metadataHashes.length, \\\"AssetReveal: Invalid metadataHashes length\\\");\\n require(prevTokenIds.length == revealHashes.length, \\\"AssetReveal: Invalid revealHashes length\\\");\\n require(\\n authValidator.verify(\\n signature,\\n _hashBatchReveal(_msgSender(), prevTokenIds, amounts, metadataHashes, revealHashes)\\n ),\\n \\\"AssetReveal: Invalid revealBatchMint signature\\\"\\n );\\n uint256[][] memory newTokenIds = new uint256[][](prevTokenIds.length);\\n for (uint256 i = 0; i < prevTokenIds.length; i++) {\\n newTokenIds[i] = _revealAsset(prevTokenIds[i], metadataHashes[i], amounts[i], revealHashes[i]);\\n }\\n emit AssetRevealBatchMint(_msgSender(), prevTokenIds, amounts, newTokenIds, revealHashes);\\n }\\n\\n /// @notice Reveal assets to view their abilities and enhancements and mint them in a single transaction\\n /// @dev Should be used where it is not required to keep the metadata secret, e.g. mythical assets where users select their desired abilities and enhancements\\n /// @param signature Signature created on the TSB backend containing INSTANT_REVEAL_TYPEHASH and associated data, must be signed by authorized signer\\n /// @param prevTokenId The tokenId of the unrevealed asset\\n /// @param burnAmount The amount of assets to burn\\n /// @param amounts The amount of assets to reveal (sum must be equal to the burnAmount)\\n /// @param metadataHashes The array of hashes for asset metadata\\n /// @param revealHashes A revealHash array providing a random bytes32 generated by the TSB backend for each new tokenId\\n function burnAndReveal(\\n bytes memory signature,\\n uint256 prevTokenId,\\n uint256 burnAmount,\\n uint256[] calldata amounts,\\n string[] calldata metadataHashes,\\n bytes32[] calldata revealHashes\\n ) external {\\n require(amounts.length == metadataHashes.length, \\\"AssetReveal: Invalid amounts length\\\");\\n require(amounts.length == revealHashes.length, \\\"AssetReveal: Invalid revealHashes length\\\");\\n require(\\n authValidator.verify(\\n signature,\\n _hashInstantReveal(_msgSender(), prevTokenId, amounts, metadataHashes, revealHashes)\\n ),\\n \\\"AssetReveal: Invalid burnAndReveal signature\\\"\\n );\\n _burnAsset(prevTokenId, burnAmount);\\n uint256[] memory newTokenIds = _revealAsset(prevTokenId, metadataHashes, amounts, revealHashes);\\n emit AssetRevealMint(_msgSender(), prevTokenId, amounts, newTokenIds, revealHashes);\\n }\\n\\n /// @notice Generate new tokenIds for revealed assets and mint them\\n /// @param prevTokenId The tokenId of the unrevealed asset\\n /// @param metadataHashes The array of hashes for asset metadata\\n /// @param amounts The array of amounts to mint\\n function _revealAsset(\\n uint256 prevTokenId,\\n string[] calldata metadataHashes,\\n uint256[] calldata amounts,\\n bytes32[] calldata revealHashes\\n ) internal returns (uint256[] memory) {\\n uint256[] memory newTokenIds = getRevealedTokenIds(metadataHashes, prevTokenId);\\n for (uint256 i = 0; i < revealHashes.length; i++) {\\n require(revealHashesUsed[revealHashes[i]] == false, \\\"AssetReveal: RevealHash already used\\\");\\n revealHashesUsed[revealHashes[i]] = true;\\n }\\n if (newTokenIds.length == 1) {\\n assetContract.mint(_msgSender(), newTokenIds[0], amounts[0], metadataHashes[0]);\\n } else {\\n assetContract.mintBatch(_msgSender(), newTokenIds, amounts, metadataHashes);\\n }\\n return newTokenIds;\\n }\\n\\n /// @notice Burns an asset to be able to reveal it later\\n /// @param tokenId the tokenId of the asset to burn\\n /// @param amount the amount of the asset to burn\\n function _burnAsset(uint256 tokenId, uint256 amount) internal {\\n _verifyBurnData(tokenId, amount);\\n assetContract.burnFrom(_msgSender(), tokenId, amount);\\n }\\n\\n function _burnAssetBatch(uint256[] calldata tokenIds, uint256[] calldata amounts) internal {\\n require(tokenIds.length == amounts.length, \\\"AssetReveal: Invalid input\\\");\\n for (uint256 i = 0; i < tokenIds.length; i++) {\\n _verifyBurnData(tokenIds[i], amounts[i]);\\n }\\n assetContract.burnBatchFrom(_msgSender(), tokenIds, amounts);\\n }\\n\\n function _verifyBurnData(uint256 tokenId, uint256 amount) internal pure {\\n IAsset.AssetData memory data = tokenId.getData();\\n require(!data.revealed, \\\"AssetReveal: Asset is already revealed\\\");\\n require(amount > 0, \\\"AssetReveal: Burn amount should be greater than 0\\\");\\n }\\n\\n /// @notice Creates a hash of the reveal data\\n /// @param recipient The address of the recipient\\n /// @param prevTokenId The unrevealed token id\\n /// @param amounts The amount of tokens to mint\\n /// @param metadataHashes The array of hashes for new asset metadata\\n /// @param revealHashes The revealHashes used for revealing this particular prevTokenId (length corresponds to the new tokenIds)\\n /// @return digest The hash of the reveal data\\n function _hashInstantReveal(\\n address recipient,\\n uint256 prevTokenId,\\n uint256[] calldata amounts,\\n string[] calldata metadataHashes,\\n bytes32[] calldata revealHashes\\n ) internal view returns (bytes32 digest) {\\n digest = _hashTypedDataV4(\\n keccak256(\\n abi.encode(\\n INSTANT_REVEAL_TYPEHASH,\\n recipient,\\n prevTokenId,\\n keccak256(abi.encodePacked(amounts)),\\n _encodeHashes(metadataHashes),\\n keccak256(abi.encodePacked(revealHashes))\\n )\\n )\\n );\\n }\\n\\n /// @notice Creates a hash of the reveal data\\n /// @param recipient The intended recipient of the revealed token\\n /// @param prevTokenId The previous token id\\n /// @param amounts The amount of tokens to mint\\n /// @param metadataHashes The array of hashes for new asset metadata\\n /// @param revealHashes The revealHashes used for revealing this particular prevTokenId (length corresponds to the new tokenIds)\\n /// @return digest The hash of the reveal data\\n function _hashReveal(\\n address recipient,\\n uint256 prevTokenId,\\n uint256[] calldata amounts,\\n string[] calldata metadataHashes,\\n bytes32[] calldata revealHashes\\n ) internal view returns (bytes32 digest) {\\n digest = _hashTypedDataV4(\\n keccak256(\\n abi.encode(\\n REVEAL_TYPEHASH,\\n recipient,\\n prevTokenId,\\n keccak256(abi.encodePacked(amounts)),\\n _encodeHashes(metadataHashes),\\n keccak256(abi.encodePacked(revealHashes))\\n )\\n )\\n );\\n }\\n\\n /// @notice Creates a hash of the reveal data\\n /// @param recipient The intended recipient of the revealed tokens\\n /// @param prevTokenIds The previous token id\\n /// @param amounts The amounts of tokens to mint\\n /// @param metadataHashes The arrays of hashes for new asset metadata\\n /// @param revealHashes The revealHashes used for these prevTokenIds, (lengths corresponds to the new tokenIds)\\n /// @return digest The hash of the reveal data\\n function _hashBatchReveal(\\n address recipient,\\n uint256[] calldata prevTokenIds,\\n uint256[][] calldata amounts,\\n string[][] calldata metadataHashes,\\n bytes32[][] calldata revealHashes\\n ) internal view returns (bytes32 digest) {\\n digest = _hashTypedDataV4(\\n keccak256(\\n abi.encode(\\n BATCH_REVEAL_TYPEHASH,\\n recipient,\\n keccak256(abi.encodePacked(prevTokenIds)),\\n _encodeBatchAmounts(amounts),\\n _encodeBatchHashes(metadataHashes),\\n _encodeBatchRevealHashes(revealHashes)\\n )\\n )\\n );\\n }\\n\\n /// @notice Encodes the hashes of the metadata for signature verification\\n /// @param metadataHashes The hashes of the metadata\\n /// @return encodedHashes The encoded hashes of the metadata\\n function _encodeHashes(string[] memory metadataHashes) internal pure returns (bytes32) {\\n bytes32[] memory encodedHashes = new bytes32[](metadataHashes.length);\\n for (uint256 i = 0; i < metadataHashes.length; i++) {\\n encodedHashes[i] = keccak256((abi.encodePacked(metadataHashes[i])));\\n }\\n return keccak256(abi.encodePacked(encodedHashes));\\n }\\n\\n /// @notice Encodes the hashes of the metadata for signature verification\\n /// @param metadataHashes The hashes of the metadata\\n /// @return encodedHashes The encoded hashes of the metadata\\n function _encodeBatchHashes(string[][] memory metadataHashes) internal pure returns (bytes32) {\\n bytes32[] memory encodedHashes = new bytes32[](metadataHashes.length);\\n for (uint256 i = 0; i < metadataHashes.length; i++) {\\n encodedHashes[i] = _encodeHashes(metadataHashes[i]);\\n }\\n return keccak256(abi.encodePacked(encodedHashes));\\n }\\n\\n /// @notice Encodes the hashes of the metadata for signature verification\\n /// @param revealHashes The revealHashes\\n /// @return encodedRevealHashes The encoded hashes of the metadata\\n function _encodeBatchRevealHashes(bytes32[][] memory revealHashes) internal pure returns (bytes32) {\\n bytes32[] memory encodedHashes = new bytes32[](revealHashes.length);\\n for (uint256 i = 0; i < revealHashes.length; i++) {\\n encodedHashes[i] = keccak256(abi.encodePacked(revealHashes[i]));\\n }\\n return keccak256(abi.encodePacked(encodedHashes));\\n }\\n\\n /// @notice Encodes the amounts of the tokens for signature verification\\n /// @param amounts The amounts of the tokens\\n /// @return encodedAmounts The encoded amounts of the tokens\\n function _encodeBatchAmounts(uint256[][] memory amounts) internal pure returns (bytes32) {\\n bytes32[] memory encodedAmounts = new bytes32[](amounts.length);\\n for (uint256 i = 0; i < amounts.length; i++) {\\n encodedAmounts[i] = keccak256(abi.encodePacked(amounts[i]));\\n }\\n return keccak256(abi.encodePacked(encodedAmounts));\\n }\\n\\n /// @notice Checks if each metadatahash has been used before to either get the tokenId that was already created for it or generate a new one if it hasn't\\n /// @dev This function also validates that we're not trying to reveal a tokenId that has already been revealed\\n /// @param metadataHashes The hashes of the metadata\\n /// @param prevTokenId The previous token id from which the assets are revealed\\n /// @return tokenIdArray The array of tokenIds to mint\\n function getRevealedTokenIds(string[] calldata metadataHashes, uint256 prevTokenId)\\n internal\\n returns (uint256[] memory)\\n {\\n IAsset.AssetData memory data = prevTokenId.getData();\\n require(!data.revealed, \\\"AssetReveal: already revealed\\\");\\n uint256[] memory tokenIdArray = new uint256[](metadataHashes.length);\\n for (uint256 i = 0; i < metadataHashes.length; i++) {\\n uint256 tokenId = assetContract.getTokenIdByMetadataHash(metadataHashes[i]);\\n if (tokenId == 0) {\\n uint16 revealNonce = ++revealIds[data.creator][prevTokenId];\\n tokenId = TokenIdUtils.generateTokenId(\\n data.creator,\\n data.tier,\\n data.creatorNonce,\\n revealNonce,\\n data.bridged\\n );\\n }\\n tokenIdArray[i] = tokenId;\\n }\\n return tokenIdArray;\\n }\\n\\n /// @notice Get the status of a revealHash\\n /// @return Whether it has been used\\n function revealHashUsed(bytes32 revealHash) external view returns (bool) {\\n return revealHashesUsed[revealHash];\\n }\\n\\n /// @notice Get the asset contract address\\n /// @return The asset contract address\\n function getAssetContract() external view returns (address) {\\n return address(assetContract);\\n }\\n\\n /// @notice Get the auth validator address\\n /// @return The auth validator address\\n function getAuthValidator() external view returns (address) {\\n return address(authValidator);\\n }\\n\\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\\n /// @dev Change the address of the trusted forwarder for meta-TX\\n /// @param trustedForwarder The new trustedForwarder\\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n require(trustedForwarder != address(0), \\\"AssetReveal: trusted forwarder can't be zero address\\\");\\n _trustedForwarder = trustedForwarder;\\n emit TrustedForwarderChanged(trustedForwarder);\\n }\\n\\n function _msgSender() internal view virtual override(ContextUpgradeable, ERC2771Handler) returns (address sender) {\\n return ERC2771Handler._msgSender();\\n }\\n\\n function _msgData() internal view virtual override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\\n return ERC2771Handler._msgData();\\n }\\n}\\n\",\"keccak256\":\"0x933ca1cd79aabdc90534cb1b922bf06e0bee63855b8941c59ff1806792cfe810\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/AuthSuperValidator.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport {AccessControl} from \\\"@openzeppelin/contracts/access/AccessControl.sol\\\";\\nimport {ECDSA} from \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\n/// @title AuthSuperValidator\\n/// @author The Sandbox\\n/// @notice This contract is used to validate the signatures of the backend, each contract can have a separate signer assigned\\ncontract AuthSuperValidator is AccessControl {\\n mapping(address => address) private _signers;\\n\\n /// @dev Constructor\\n /// @param admin Address of the admin that will be able to grant roles\\n constructor(address admin) {\\n _grantRole(DEFAULT_ADMIN_ROLE, admin);\\n }\\n\\n /// @notice Sets the signer for a contract\\n /// @dev Only the admin can call this function\\n /// @param contractAddress Address of the contract to set the signer for\\n /// @param signer Address of the signer\\n function setSigner(address contractAddress, address signer) public onlyRole(DEFAULT_ADMIN_ROLE) {\\n _signers[contractAddress] = signer;\\n }\\n\\n /// @notice Gets the signer for a contract\\n /// @param contractAddress Address of the contract to get the signer for\\n /// @return address of the signer\\n function getSigner(address contractAddress) public view returns (address) {\\n return _signers[contractAddress];\\n }\\n\\n /// @notice Takes the signature and the digest and returns if the signer has a backend signer role assigned\\n /// @dev Multipurpose function that can be used to verify signatures with different digests\\n /// @param signature Signature hash\\n /// @param digest Digest hash\\n /// @return bool\\n function verify(bytes memory signature, bytes32 digest) public view returns (bool) {\\n address signer = _signers[_msgSender()];\\n require(signer != address(0), \\\"AuthSuperValidator: signer not set\\\");\\n address recoveredSigner = ECDSA.recover(digest, signature);\\n return recoveredSigner == signer;\\n }\\n}\\n\",\"keccak256\":\"0x990d27552ffce0f248fadbf539bbc904134ca14d392931bdfab0f02740103be3\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/ERC2771Handler.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\n/// @dev minimal ERC2771 handler to keep bytecode-size down\\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.6.0/contracts/metatx/ERC2771Context.sol\\n/// with an initializer for proxies and a mutable forwarder\\n\\nabstract contract ERC2771Handler {\\n address internal _trustedForwarder;\\n\\n function __ERC2771Handler_initialize(address forwarder) internal {\\n _trustedForwarder = forwarder;\\n }\\n\\n function isTrustedForwarder(address forwarder) public view returns (bool) {\\n return forwarder == _trustedForwarder;\\n }\\n\\n function getTrustedForwarder() external view returns (address trustedForwarder) {\\n return _trustedForwarder;\\n }\\n\\n function _msgSender() internal view virtual returns (address sender) {\\n if (isTrustedForwarder(msg.sender)) {\\n // The assembly code is more direct than the Solidity version using `abi.decode`.\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\\n }\\n } else {\\n return msg.sender;\\n }\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n if (isTrustedForwarder(msg.sender)) {\\n return msg.data[:msg.data.length - 20];\\n } else {\\n return msg.data;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb14f384116bdc60b5fc789de2280bccee214c967416cee1b30fb03e0ce4442d5\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/interfaces/IAsset.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface IAsset {\\n // AssetData reflects the asset tokenId structure\\n // Refer to TokenIdUtils.sol\\n struct AssetData {\\n uint256 tokenId;\\n address creator;\\n uint256 amount;\\n uint8 tier;\\n uint16 creatorNonce;\\n bool revealed;\\n string metadataHash;\\n bool bridged;\\n }\\n\\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\\n\\n // Functions\\n function mint(\\n address to,\\n uint256 id,\\n uint256 amount,\\n string memory metadataHash\\n ) external;\\n\\n function mintBatch(\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n string[] memory metadataHashes\\n ) external;\\n\\n function burnFrom(\\n address account,\\n uint256 id,\\n uint256 amount\\n ) external;\\n\\n function burnBatchFrom(\\n address account,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external;\\n\\n function getTokenIdByMetadataHash(string memory metadataHash) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x2abd2e550ced35090c988e432215f990bf8f192cc346ffac6778fde0025a8206\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/interfaces/IAssetReveal.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface IAssetReveal {\\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\\n event AssetRevealBurn(address revealer, uint256 unrevealedTokenId, uint256 amount);\\n event AssetRevealBatchBurn(address revealer, uint256[] unrevealedTokenIds, uint256[] amounts);\\n event AssetRevealMint(\\n address recipient,\\n uint256 unrevealedTokenId,\\n uint256[] amounts,\\n uint256[] newTokenIds,\\n bytes32[] revealHashes\\n );\\n event AssetRevealBatchMint(\\n address recipient,\\n uint256[] unrevealedTokenIds,\\n uint256[][] amounts,\\n uint256[][] newTokenIds,\\n bytes32[][] revealHashes\\n );\\n}\\n\",\"keccak256\":\"0x5c02c65ea3861d0fff04eec7c28017a17434d924c9474cf95806a16ff33b4731\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/libraries/TokenIdUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {IAsset} from \\\"../interfaces/IAsset.sol\\\";\\n\\nlibrary TokenIdUtils {\\n // Layer masks\\n uint256 public constant TIER_MASK = 0xFF;\\n uint256 public constant NONCE_MASK = 0xFFFF;\\n uint256 public constant REVEAL_NONCE_MASK = 0xFFFF;\\n uint256 public constant BRIDGED_MASK = 0x1;\\n\\n // Bit shifts\\n uint256 public constant CREATOR_SHIFT = 0;\\n uint256 public constant TIER_SHIFT = 160;\\n uint256 public constant NONCE_SHIFT = 168;\\n uint256 public constant REVEAL_NONCE_SHIFT = 184;\\n uint256 public constant BRIDGED_SHIFT = 200;\\n\\n /// @notice Generates a token id for a given asset\\n /// @dev The token id is generated by concatenating the following fields:\\n /// @dev creator address, chain index, tier, asset nonce, reveal nonce and bridged boolean\\n /// @dev The first 160 bits are the creator address\\n /// @dev The next 8 bits are the chain index\\n /// @dev The next 8 bits are the tier\\n /// @dev The next 16 bits are the asset nonce\\n /// @dev The next 16 bits are assets reveal nonce.\\n /// @param creator The address of the creator of the asset\\n /// @param tier The tier of the asset determined by the catalyst used to create it\\n /// @param creatorNonce The nonce of the asset creator\\n /// @param revealNonce The reveal nonce of the asset\\n /// @param bridged Whether the asset is bridged or not\\n /// @return tokenId The generated token id\\n function generateTokenId(\\n address creator,\\n uint8 tier,\\n uint16 creatorNonce,\\n uint16 revealNonce,\\n bool bridged\\n ) internal pure returns (uint256 tokenId) {\\n uint160 creatorAddress = uint160(creator);\\n\\n tokenId = tokenId =\\n uint256(creatorAddress) |\\n (uint256(tier) << TIER_SHIFT) |\\n (uint256(creatorNonce) << NONCE_SHIFT) |\\n (uint256(revealNonce) << REVEAL_NONCE_SHIFT) |\\n (uint256(bridged ? 1 : 0) << BRIDGED_SHIFT);\\n\\n return tokenId;\\n }\\n\\n /// @notice Extracts the creator address from a given token id\\n /// @param tokenId The token id to extract the creator address from\\n /// @return creator The asset creator address\\n function getCreatorAddress(uint256 tokenId) internal pure returns (address creator) {\\n creator = address(uint160(tokenId));\\n return creator;\\n }\\n\\n /// @notice Extracts the tier from a given token id\\n /// @param tokenId The token id to extract the tier from\\n /// @return tier The asset tier, determined by the catalyst used to create it\\n function getTier(uint256 tokenId) internal pure returns (uint8 tier) {\\n tier = uint8((tokenId >> TIER_SHIFT) & TIER_MASK);\\n return tier;\\n }\\n\\n /// @notice Extracts the revealed flag from a given token id\\n /// @param tokenId The token id to extract the revealed flag from\\n /// @return isRevealed Whether the asset is revealed or not\\n function isRevealed(uint256 tokenId) internal pure returns (bool) {\\n uint16 revealNonce = getRevealNonce(tokenId);\\n return revealNonce != 0;\\n }\\n\\n /// @notice Extracts the asset nonce from a given token id\\n /// @param tokenId The token id to extract the asset nonce from\\n /// @return creatorNonce The asset creator nonce\\n function getCreatorNonce(uint256 tokenId) internal pure returns (uint16) {\\n uint16 creatorNonce = uint16((tokenId >> NONCE_SHIFT) & NONCE_MASK);\\n return creatorNonce;\\n }\\n\\n /// @notice Extracts the abilities and enhancements hash from a given token id\\n /// @param tokenId The token id to extract reveal nonce from\\n /// @return revealNonce The reveal nonce of the asset\\n function getRevealNonce(uint256 tokenId) internal pure returns (uint16) {\\n uint16 revealNonce = uint16((tokenId >> REVEAL_NONCE_SHIFT) & REVEAL_NONCE_MASK);\\n return revealNonce;\\n }\\n\\n /// @notice Extracts the bridged flag from a given token id\\n /// @param tokenId The token id to extract the bridged flag from\\n /// @return bridged Whether the asset is bridged or not\\n function isBridged(uint256 tokenId) internal pure returns (bool) {\\n bool bridged = ((tokenId >> BRIDGED_SHIFT) & BRIDGED_MASK) == 1;\\n return bridged;\\n }\\n\\n /// @notice Extracts the asset data from a given token id\\n /// @dev Created to limit the number of functions that need to be called when revealing an asset\\n /// @param tokenId The token id to extract the asset data from\\n function getData(uint256 tokenId) internal pure returns (IAsset.AssetData memory data) {\\n data.creator = getCreatorAddress(tokenId);\\n data.tier = getTier(tokenId);\\n data.revealed = isRevealed(tokenId);\\n data.creatorNonce = getCreatorNonce(tokenId);\\n data.bridged = isBridged(tokenId);\\n }\\n}\\n\",\"keccak256\":\"0x82f6bb065e85497d5486bcecb162c30df83941262ff5ac3fd8e283e946250839\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e3565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6137c580620000f36000396000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c806384b0196e116100e3578063d547741f1161008c578063e56f2fe411610066578063e56f2fe4146103bb578063ecc0382a146103ce578063f30553d5146103e157600080fd5b8063d547741f14610384578063d5f2077c14610397578063da742228146103a857600080fd5b8063b21c2cdc116100bd578063b21c2cdc14610329578063bd2cc82a14610350578063ce1b815f1461037357600080fd5b806384b0196e146102cd57806391d14854146102e8578063a217fddf1461032157600080fd5b806336568abe11610145578063572b6c051161011f578063572b6c051461027357806359c191e4146102955780635aaa24bf146102ba57600080fd5b806336568abe146102265780633a2cf31a14610239578063439ff3ce1461026057600080fd5b806310da53931161017657806310da5393146101cf578063248a9ca3146101e25780632f2ff15d1461021357600080fd5b806301ffc9a7146101925780630c85fbb3146101ba575b600080fd5b6101a56101a036600461261d565b610408565b60405190151581526020015b60405180910390f35b6101cd6101c83660046126ab565b6104a1565b005b6101cd6101dd3660046127ce565b6104f9565b6102056101f0366004612896565b60009081526065602052604090206001015490565b6040519081526020016101b1565b6101cd6102213660046128cb565b61071a565b6101cd6102343660046128cb565b610744565b6102057f1d2951170e2f5d8eb8a7a48a737f5f1680469c14594abd27536867bfb559f88f81565b6101cd61026e366004612939565b6107e0565b6101a5610281366004612a2a565b6097546001600160a01b0391821691161490565b60cc546001600160a01b03165b6040516001600160a01b0390911681526020016101b1565b6101cd6102c8366004612a45565b610b7f565b6102d5610bde565b6040516101b19796959493929190612af2565b6101a56102f63660046128cb565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b610205600081565b6102057f45cf7a9b20b47d492887b813085b48aa1988f1f482fe79948578452b4b4cbedd81565b6101a561035e366004612896565b600090815260cf602052604090205460ff1690565b6097546001600160a01b03166102a2565b6101cd6103923660046128cb565b610ca0565b60cd546001600160a01b03166102a2565b6101cd6103b6366004612a2a565b610cc5565b6101cd6103c9366004612b6e565b610daf565b6101cd6103dc366004612c13565b610f37565b6102057f30ed1d13f34eab3b4d1a3291d48db1d77bbc98ec9480b9131e4360220fd46fb081565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061049b57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6104ad8484848461115e565b7f25601c42b4517e81abacb7c77cd6d6697ea55465121e953721d60becc43b88e26104d661127a565b858585856040516104eb959493929190612d32565b60405180910390a150505050565b8483146105595760405162461bcd60e51b815260206004820152602360248201527f417373657452657665616c3a20496e76616c696420616d6f756e7473206c656e6044820152620cee8d60eb1b60648201526084015b60405180910390fd5b8481146105b95760405162461bcd60e51b815260206004820152602860248201527f417373657452657665616c3a20496e76616c69642072657665616c48617368656044820152670e640d8cadccee8d60c31b6064820152608401610550565b60cd546001600160a01b0316636b406341896105e26105d661127a565b8b8b8b8b8b8b8b611289565b6040518363ffffffff1660e01b81526004016105ff929190612d68565b602060405180830381865afa15801561061c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106409190612d8a565b6106b25760405162461bcd60e51b815260206004820152602960248201527f417373657452657665616c3a20496e76616c69642072657665616c4d696e742060448201527f7369676e617475726500000000000000000000000000000000000000000000006064820152608401610550565b60006106c38886868a8a8888611378565b90507fd19ae26d53e6e3446633338937b673d431c042f61b32854f821bc2b2b025b2c46106ee61127a565b8989898588886040516107079796959493929190612dac565b60405180910390a1505050505050505050565b600082815260656020526040902060010154610735816115e2565b61073f83836115f6565b505050565b61074c61127a565b6001600160a01b0316816001600160a01b0316146107d25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610550565b6107dc8282611699565b5050565b86851461083b5760405162461bcd60e51b815260206004820152602360248201527f417373657452657665616c3a20496e76616c696420616d6f756e7473206c656e6044820152620cee8d60eb1b6064820152608401610550565b8483146108b05760405162461bcd60e51b815260206004820152602a60248201527f417373657452657665616c3a20496e76616c6964206d6574616461746148617360448201527f686573206c656e677468000000000000000000000000000000000000000000006064820152608401610550565b8681146109105760405162461bcd60e51b815260206004820152602860248201527f417373657452657665616c3a20496e76616c69642072657665616c48617368656044820152670e640d8cadccee8d60c31b6064820152608401610550565b60cd546001600160a01b0316636b4063418b8b61093b61092e61127a565b8d8d8d8d8d8d8d8d61173a565b6040518463ffffffff1660e01b815260040161095993929190612e27565b602060405180830381865afa158015610976573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099a9190612d8a565b610a0c5760405162461bcd60e51b815260206004820152602e60248201527f417373657452657665616c3a20496e76616c69642072657665616c426174636860448201527f4d696e74207369676e61747572650000000000000000000000000000000000006064820152608401610550565b60008767ffffffffffffffff811115610a2757610a27612717565b604051908082528060200260200182016040528015610a5a57816020015b6060815260200190600190039081610a455790505b50905060005b88811015610b2557610af58a8a83818110610a7d57610a7d612e4b565b90506020020135878784818110610a9657610a96612e4b565b9050602002810190610aa89190612e61565b8b8b86818110610aba57610aba612e4b565b9050602002810190610acc9190612e61565b898988818110610ade57610ade612e4b565b9050602002810190610af09190612e61565b611378565b828281518110610b0757610b07612e4b565b60200260200101819052508080610b1d90612ec1565b915050610a60565b507f9327e7d8f5446a92ddcaf7ccd64ad67693773944fe2db95200e2d4db20054359610b4f61127a565b8a8a8a8a868989604051610b6a989796959493929190612fc9565b60405180910390a15050505050505050505050565b610b89828261180d565b7f529140d9ae57da9c5515c8fe288c3865d4cbb81cb143062f99a466cb4bb6fa95610bb261127a565b604080516001600160a01b03909216825260208201859052810183905260600160405180910390a15050565b6000606080600080600060606098546000801b148015610bfe5750609954155b610c4a5760405162461bcd60e51b815260206004820152601560248201527f4549503731323a20556e696e697469616c697a656400000000000000000000006044820152606401610550565b610c526118b3565b610c5a611945565b604080516000808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009b939a50919850469750309650945092509050565b600082815260656020526040902060010154610cbb816115e2565b61073f8383611699565b6000610cd0816115e2565b6001600160a01b038216610d4c5760405162461bcd60e51b815260206004820152603460248201527f417373657452657665616c3a207472757374656420666f72776172646572206360448201527f616e2774206265207a65726f20616464726573730000000000000000000000006064820152608401610550565b609780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0384169081179091556040517f871264f4293af7d2865ae7eae628b228f4991c57cb45b39c99f0b774ebe2901890600090a25050565b600054610100900460ff1615808015610dcf5750600054600160ff909116105b80610de95750303b158015610de9575060005460ff166001145b610e5b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610550565b6000805460ff191660011790558015610e7e576000805461ff0019166101001790555b60cc80546001600160a01b038781167fffffffffffffffffffffffff00000000000000000000000000000000000000009283161790925560cd80548784169083161790556097805492861692909116919091179055610edd8787611954565b610ee86000836115f6565b8015610f2e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b848314610f925760405162461bcd60e51b815260206004820152602360248201527f417373657452657665616c3a20496e76616c696420616d6f756e7473206c656e6044820152620cee8d60eb1b6064820152608401610550565b848114610ff25760405162461bcd60e51b815260206004820152602860248201527f417373657452657665616c3a20496e76616c69642072657665616c48617368656044820152670e640d8cadccee8d60c31b6064820152608401610550565b60cd546001600160a01b0316636b4063418a61101b61100f61127a565b8c8b8b8b8b8b8b6119db565b6040518363ffffffff1660e01b8152600401611038929190612d68565b602060405180830381865afa158015611055573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110799190612d8a565b6110eb5760405162461bcd60e51b815260206004820152602c60248201527f417373657452657665616c3a20496e76616c6964206275726e416e645265766560448201527f616c207369676e617475726500000000000000000000000000000000000000006064820152608401610550565b6110f5888861180d565b60006111068986868a8a8888611378565b90507fd19ae26d53e6e3446633338937b673d431c042f61b32854f821bc2b2b025b2c461113161127a565b8a898985888860405161114a9796959493929190612dac565b60405180910390a150505050505050505050565b8281146111ad5760405162461bcd60e51b815260206004820152601a60248201527f417373657452657665616c3a20496e76616c696420696e7075740000000000006044820152606401610550565b60005b83811015611204576111f28585838181106111cd576111cd612e4b565b905060200201358484848181106111e6576111e6612e4b565b90506020020135611a16565b806111fc81612ec1565b9150506111b0565b5060cc546001600160a01b03166320820ec361121e61127a565b868686866040518663ffffffff1660e01b8152600401611242959493929190612d32565b600060405180830381600087803b15801561125c57600080fd5b505af1158015611270573d6000803e3d6000fd5b5050505050505050565b6000611284611b11565b905090565b600061136b7f1d2951170e2f5d8eb8a7a48a737f5f1680469c14594abd27536867bfb559f88f8a8a8a8a6040516020016112c49291906130bf565b60408051601f1981840301815291905280516020909101206112ee6112e98a8c613171565b611b56565b88886040516020016113019291906130bf565b60408051601f198184030181528282528051602091820120908301979097526001600160a01b03909516948101949094526060840192909252608083015260a082015260c081019190915260e0015b60405160208183030381529060405280519060200120611c4a565b9998505050505050505050565b6060600061138788888b611c92565b905060005b838110156114905760cf60008686848181106113aa576113aa612e4b565b602090810292909201358352508101919091526040016000205460ff16156114395760405162461bcd60e51b8152602060048201526024808201527f417373657452657665616c3a2052657665616c4861736820616c72656164792060448201527f75736564000000000000000000000000000000000000000000000000000000006064820152608401610550565b600160cf600087878581811061145157611451612e4b565b90506020020135815260200190815260200160002060006101000a81548160ff021916908315150217905550808061148890612ec1565b91505061138c565b5080516001036115645760cc546001600160a01b031663bb7fde716114b361127a565b836000815181106114c6576114c6612e4b565b6020026020010151898960008181106114e1576114e1612e4b565b905060200201358c8c60008181106114fb576114fb612e4b565b905060200281019061150d919061317e565b6040518663ffffffff1660e01b815260040161152d9594939291906131c5565b600060405180830381600087803b15801561154757600080fd5b505af115801561155b573d6000803e3d6000fd5b505050506115d6565b60cc546001600160a01b031663a55784ef61157d61127a565b8389898d8d6040518763ffffffff1660e01b81526004016115a3969594939291906131ff565b600060405180830381600087803b1580156115bd57600080fd5b505af11580156115d1573d6000803e3d6000fd5b505050505b98975050505050505050565b6115f3816115ee61127a565b611e93565b50565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166107dc5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561165561127a565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16156107dc5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191690556116f661127a565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b60006117ff7f30ed1d13f34eab3b4d1a3291d48db1d77bbc98ec9480b9131e4360220fd46fb08b8b8b6040516020016117749291906130bf565b60408051601f19818403018152919052805160209091012061179e6117998b8d6132d3565b611f08565b6117b06117ab8a8c613399565b611fcc565b6117c26117bd898b613421565b612072565b6040805160208101979097526001600160a01b03909516948601949094526060850192909252608084015260a083015260c082015260e001611350565b9a9950505050505050505050565b6118178282611a16565b60cc546001600160a01b031663124d91e561183061127a565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b0390911660048201526024810185905260448101849052606401600060405180830381600087803b15801561189757600080fd5b505af11580156118ab573d6000803e3d6000fd5b505050505050565b6060609a80546118c2906134da565b80601f01602080910402602001604051908101604052809291908181526020018280546118ee906134da565b801561193b5780601f106119105761010080835404028352916020019161193b565b820191906000526020600020905b81548152906001019060200180831161191e57829003601f168201915b5050505050905090565b6060609b80546118c2906134da565b600054610100900460ff166119d15760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610550565b6107dc8282612136565b600061136b7f45cf7a9b20b47d492887b813085b48aa1988f1f482fe79948578452b4b4cbedd8a8a8a8a6040516020016112c49291906130bf565b6000611a21836121db565b90508060a0015115611a9b5760405162461bcd60e51b815260206004820152602660248201527f417373657452657665616c3a20417373657420697320616c726561647920726560448201527f7665616c656400000000000000000000000000000000000000000000000000006064820152608401610550565b6000821161073f5760405162461bcd60e51b815260206004820152603160248201527f417373657452657665616c3a204275726e20616d6f756e742073686f756c642060448201527f62652067726561746572207468616e20300000000000000000000000000000006064820152608401610550565b6097546000906001600160a01b03163303611b5157507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b503390565b600080825167ffffffffffffffff811115611b7357611b73612717565b604051908082528060200260200182016040528015611b9c578160200160208202803683370190505b50905060005b8351811015611c1a57838181518110611bbd57611bbd612e4b565b6020026020010151604051602001611bd59190613514565b60405160208183030381529060405280519060200120828281518110611bfd57611bfd612e4b565b602090810291909101015280611c1281612ec1565b915050611ba2565b5080604051602001611c2c9190613530565b60405160208183030381529060405280519060200120915050919050565b600061049b611c57612268565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b60606000611c9f836121db565b90508060a0015115611cf35760405162461bcd60e51b815260206004820152601d60248201527f417373657452657665616c3a20616c72656164792072657665616c65640000006044820152606401610550565b60008467ffffffffffffffff811115611d0e57611d0e612717565b604051908082528060200260200182016040528015611d37578160200160208202803683370190505b50905060005b85811015611e895760cc546000906001600160a01b031663fdda1d0e898985818110611d6b57611d6b612e4b565b9050602002810190611d7d919061317e565b6040518363ffffffff1660e01b8152600401611d9a929190613566565b602060405180830381865afa158015611db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddb919061357a565b905080600003611e58576020808501516001600160a01b0316600090815260ce8252604080822089835290925290812080548290611e1c9061ffff16613593565b91906101000a81548161ffff021916908361ffff16021790559050611e54856020015186606001518760800151848960e00151612272565b9150505b80838381518110611e6b57611e6b612e4b565b60209081029190910101525080611e8181612ec1565b915050611d3d565b5095945050505050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166107dc57611ec6816122bf565b611ed18360206122d1565b604051602001611ee29291906135b4565b60408051601f198184030181529082905262461bcd60e51b825261055091600401613635565b600080825167ffffffffffffffff811115611f2557611f25612717565b604051908082528060200260200182016040528015611f4e578160200160208202803683370190505b50905060005b8351811015611c1a57838181518110611f6f57611f6f612e4b565b6020026020010151604051602001611f879190613530565b60405160208183030381529060405280519060200120828281518110611faf57611faf612e4b565b602090810291909101015280611fc481612ec1565b915050611f54565b600080825167ffffffffffffffff811115611fe957611fe9612717565b604051908082528060200260200182016040528015612012578160200160208202803683370190505b50905060005b8351811015611c1a5761204384828151811061203657612036612e4b565b6020026020010151611b56565b82828151811061205557612055612e4b565b60209081029190910101528061206a81612ec1565b915050612018565b600080825167ffffffffffffffff81111561208f5761208f612717565b6040519080825280602002602001820160405280156120b8578160200160208202803683370190505b50905060005b8351811015611c1a578381815181106120d9576120d9612e4b565b60200260200101516040516020016120f19190613530565b6040516020818303038152906040528051906020012082828151811061211957612119612e4b565b60209081029190910101528061212e81612ec1565b9150506120be565b600054610100900460ff166121b35760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610550565b609a6121bf838261368e565b50609b6121cc828261368e565b50506000609881905560995550565b604080516101008101825260008082529181018290526080810182905260a0808201839052606060c0830181905260e08301939093526001600160a01b038416602083015283901c60ff169181019190915261223682612501565b151560a082015261224b8260a81c61ffff1690565b61ffff16608082015260c89190911c60019081161460e082015290565b600061128461251f565b60008560c883612283576000612286565b60015b60ff16901b60b88561ffff16901b60a88761ffff16901b60a08960ff16901b846001600160a01b03161717171791505095945050505050565b606061049b6001600160a01b03831660145b606060006122e083600261374e565b6122eb906002613765565b67ffffffffffffffff81111561230357612303612717565b6040519080825280601f01601f19166020018201604052801561232d576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061236457612364612e4b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106123c7576123c7612e4b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600061240384600261374e565b61240e906001613765565b90505b60018111156124ab577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061244f5761244f612e4b565b1a60f81b82828151811061246557612465612e4b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936124a481613778565b9050612411565b5083156124fa5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610550565b9392505050565b6000806125128360b81c61ffff1690565b61ffff1615159392505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f61254a612593565b6125526125ec565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b60008061259e6118b3565b8051909150156125b5578051602090910120919050565b60985480156125c45792915050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709250505090565b6000806125f7611945565b80519091501561260e578051602090910120919050565b60995480156125c45792915050565b60006020828403121561262f57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146124fa57600080fd5b60008083601f84011261267157600080fd5b50813567ffffffffffffffff81111561268957600080fd5b6020830191508360208260051b85010111156126a457600080fd5b9250929050565b600080600080604085870312156126c157600080fd5b843567ffffffffffffffff808211156126d957600080fd5b6126e58883890161265f565b909650945060208701359150808211156126fe57600080fd5b5061270b8782880161265f565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561275657612756612717565b604052919050565b600082601f83011261276f57600080fd5b813567ffffffffffffffff81111561278957612789612717565b61279c6020601f19601f8401160161272d565b8181528460208386010111156127b157600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060008060008060a0898b0312156127ea57600080fd5b883567ffffffffffffffff8082111561280257600080fd5b61280e8c838d0161275e565b995060208b0135985060408b013591508082111561282b57600080fd5b6128378c838d0161265f565b909850965060608b013591508082111561285057600080fd5b61285c8c838d0161265f565b909650945060808b013591508082111561287557600080fd5b506128828b828c0161265f565b999c989b5096995094979396929594505050565b6000602082840312156128a857600080fd5b5035919050565b80356001600160a01b03811681146128c657600080fd5b919050565b600080604083850312156128de57600080fd5b823591506128ee602084016128af565b90509250929050565b60008083601f84011261290957600080fd5b50813567ffffffffffffffff81111561292157600080fd5b6020830191508360208285010111156126a457600080fd5b60008060008060008060008060008060a08b8d03121561295857600080fd5b8a3567ffffffffffffffff8082111561297057600080fd5b61297c8e838f016128f7565b909c509a5060208d013591508082111561299557600080fd5b6129a18e838f0161265f565b909a50985060408d01359150808211156129ba57600080fd5b6129c68e838f0161265f565b909850965060608d01359150808211156129df57600080fd5b6129eb8e838f0161265f565b909650945060808d0135915080821115612a0457600080fd5b50612a118d828e0161265f565b915080935050809150509295989b9194979a5092959850565b600060208284031215612a3c57600080fd5b6124fa826128af565b60008060408385031215612a5857600080fd5b50508035926020909101359150565b60005b83811015612a82578181015183820152602001612a6a565b50506000910152565b60008151808452612aa3816020860160208601612a67565b601f01601f19169290920160200192915050565b600081518084526020808501945080840160005b83811015612ae757815187529582019590820190600101612acb565b509495945050505050565b7fff000000000000000000000000000000000000000000000000000000000000008816815260e060208201526000612b2d60e0830189612a8b565b8281036040840152612b3f8189612a8b565b90508660608401526001600160a01b03861660808401528460a084015282810360c08401526117ff8185612ab7565b60008060008060008060c08789031215612b8757600080fd5b863567ffffffffffffffff80821115612b9f57600080fd5b612bab8a838b0161275e565b97506020890135915080821115612bc157600080fd5b50612bce89828a0161275e565b955050612bdd604088016128af565b9350612beb606088016128af565b9250612bf9608088016128af565b9150612c0760a088016128af565b90509295509295509295565b600080600080600080600080600060c08a8c031215612c3157600080fd5b893567ffffffffffffffff80821115612c4957600080fd5b612c558d838e0161275e565b9a5060208c0135995060408c0135985060608c0135915080821115612c7957600080fd5b612c858d838e0161265f565b909850965060808c0135915080821115612c9e57600080fd5b612caa8d838e0161265f565b909650945060a08c0135915080821115612cc357600080fd5b50612cd08c828d0161265f565b915080935050809150509295985092959850929598565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115612d1957600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b0386168152606060208201526000612d55606083018688612ce7565b82810360408401526115d6818587612ce7565b604081526000612d7b6040830185612a8b565b90508260208301529392505050565b600060208284031215612d9c57600080fd5b815180151581146124fa57600080fd5b6001600160a01b038816815286602082015260a060408201526000612dd560a083018789612ce7565b8281036060840152612de78187612ab7565b905082810360808401526117ff818587612ce7565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b604081526000612e3b604083018587612dfc565b9050826020830152949350505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112612e7857600080fd5b83018035915067ffffffffffffffff821115612e9357600080fd5b6020019150600581901b36038213156126a457600080fd5b634e487b7160e01b600052601160045260246000fd5b60006000198203612ed457612ed4612eab565b5060010190565b6000808335601e19843603018112612ef257600080fd5b830160208101925035905067ffffffffffffffff811115612f1257600080fd5b8060051b36038213156126a457600080fd5b6000815180845260208085019450848260051b860182860160005b85811015612f69578383038952612f57838351612ab7565b98850198925090840190600101612f3f565b5090979650505050505050565b60008383855260208086019550808560051b8301018460005b87811015612f6957601f19858403018952612faa8288612edb565b612fb5858284612ce7565b9a86019a9450505090830190600101612f8f565b6001600160a01b03891681526000602060a081840152612fed60a084018a8c612ce7565b8381036040850152878152818101600589901b820183018a60005b8b81101561304257601f19858403018452613023828e612edb565b61302e858284612ce7565b958801959450505090850190600101613008565b50508581036060870152613056818a612f24565b9350505050828103608084015261306e818587612f76565b9b9a5050505050505050505050565b60007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8311156130ac57600080fd5b8260051b80838637939093019392505050565b60006130cc82848661307d565b949350505050565b600067ffffffffffffffff8211156130ee576130ee612717565b5060051b60200190565b600061310b613106846130d4565b61272d565b8381529050602080820190600585901b84018681111561312a57600080fd5b845b8181101561316657803567ffffffffffffffff81111561314c5760008081fd5b6131588982890161275e565b85525092820192820161312c565b505050509392505050565b60006124fa3684846130f8565b6000808335601e1984360301811261319557600080fd5b83018035915067ffffffffffffffff8211156131b057600080fd5b6020019150368190038213156126a457600080fd5b6001600160a01b03861681528460208201528360408201526080606082015260006131f4608083018486612dfc565b979650505050505050565b6001600160a01b0387168152600060206080818401526132226080840189612ab7565b838103604085015261323581888a612ce7565b84810360608601528581529050818101600586901b820183018760005b888110156132c157601f198584030184528135601e198b360301811261327757600080fd5b8a01868101903567ffffffffffffffff81111561329357600080fd5b8036038213156132a257600080fd5b6132ad858284612dfc565b958801959450505090850190600101613252565b50909c9b505050505050505050505050565b60006132e1613106846130d4565b83815260208082019190600586811b8601368111156132ff57600080fd5b865b8181101561338c57803567ffffffffffffffff8111156133215760008081fd5b880136601f8201126133335760008081fd5b8035613341613106826130d4565b81815290851b8201860190868101903683111561335e5760008081fd5b928701925b8284101561337c57833582529287019290870190613363565b8952505050948301948301613301565b5092979650505050505050565b60006133a7613106846130d4565b80848252602080830192508560051b8501368111156133c557600080fd5b855b8181101561341557803567ffffffffffffffff8111156133e75760008081fd5b870136601f8201126133f95760008081fd5b6134073682358684016130f8565b8652509382019382016133c7565b50919695505050505050565b600061342f613106846130d4565b83815260208082019190600586811b86013681111561344d57600080fd5b865b8181101561338c57803567ffffffffffffffff81111561346f5760008081fd5b880136601f8201126134815760008081fd5b803561348f613106826130d4565b81815290851b820186019086810190368311156134ac5760008081fd5b928701925b828410156134ca578335825292870192908701906134b1565b895250505094830194830161344f565b600181811c908216806134ee57607f821691505b60208210810361350e57634e487b7160e01b600052602260045260246000fd5b50919050565b60008251613526818460208701612a67565b9190910192915050565b815160009082906020808601845b8381101561355a5781518552938201939082019060010161353e565b50929695505050505050565b6020815260006130cc602083018486612dfc565b60006020828403121561358c57600080fd5b5051919050565b600061ffff8083168181036135aa576135aa612eab565b6001019392505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516135ec816017850160208801612a67565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351613629816028840160208801612a67565b01602801949350505050565b6020815260006124fa6020830184612a8b565b601f82111561073f57600081815260208120601f850160051c8101602086101561366f5750805b601f850160051c820191505b818110156118ab5782815560010161367b565b815167ffffffffffffffff8111156136a8576136a8612717565b6136bc816136b684546134da565b84613648565b602080601f8311600181146136f157600084156136d95750858301515b600019600386901b1c1916600185901b1785556118ab565b600085815260208120601f198616915b8281101561372057888601518255948401946001909101908401613701565b508582101561373e5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b808202811582820484141761049b5761049b612eab565b8082018082111561049b5761049b612eab565b60008161378757613787612eab565b50600019019056fea264697066735822122048a34c31e5af5787bded90c5e3f5f6c80691a60f38bf1dd0fb048374fc24b83f64736f6c63430008120033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061018d5760003560e01c806384b0196e116100e3578063d547741f1161008c578063e56f2fe411610066578063e56f2fe4146103bb578063ecc0382a146103ce578063f30553d5146103e157600080fd5b8063d547741f14610384578063d5f2077c14610397578063da742228146103a857600080fd5b8063b21c2cdc116100bd578063b21c2cdc14610329578063bd2cc82a14610350578063ce1b815f1461037357600080fd5b806384b0196e146102cd57806391d14854146102e8578063a217fddf1461032157600080fd5b806336568abe11610145578063572b6c051161011f578063572b6c051461027357806359c191e4146102955780635aaa24bf146102ba57600080fd5b806336568abe146102265780633a2cf31a14610239578063439ff3ce1461026057600080fd5b806310da53931161017657806310da5393146101cf578063248a9ca3146101e25780632f2ff15d1461021357600080fd5b806301ffc9a7146101925780630c85fbb3146101ba575b600080fd5b6101a56101a036600461261d565b610408565b60405190151581526020015b60405180910390f35b6101cd6101c83660046126ab565b6104a1565b005b6101cd6101dd3660046127ce565b6104f9565b6102056101f0366004612896565b60009081526065602052604090206001015490565b6040519081526020016101b1565b6101cd6102213660046128cb565b61071a565b6101cd6102343660046128cb565b610744565b6102057f1d2951170e2f5d8eb8a7a48a737f5f1680469c14594abd27536867bfb559f88f81565b6101cd61026e366004612939565b6107e0565b6101a5610281366004612a2a565b6097546001600160a01b0391821691161490565b60cc546001600160a01b03165b6040516001600160a01b0390911681526020016101b1565b6101cd6102c8366004612a45565b610b7f565b6102d5610bde565b6040516101b19796959493929190612af2565b6101a56102f63660046128cb565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b610205600081565b6102057f45cf7a9b20b47d492887b813085b48aa1988f1f482fe79948578452b4b4cbedd81565b6101a561035e366004612896565b600090815260cf602052604090205460ff1690565b6097546001600160a01b03166102a2565b6101cd6103923660046128cb565b610ca0565b60cd546001600160a01b03166102a2565b6101cd6103b6366004612a2a565b610cc5565b6101cd6103c9366004612b6e565b610daf565b6101cd6103dc366004612c13565b610f37565b6102057f30ed1d13f34eab3b4d1a3291d48db1d77bbc98ec9480b9131e4360220fd46fb081565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061049b57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6104ad8484848461115e565b7f25601c42b4517e81abacb7c77cd6d6697ea55465121e953721d60becc43b88e26104d661127a565b858585856040516104eb959493929190612d32565b60405180910390a150505050565b8483146105595760405162461bcd60e51b815260206004820152602360248201527f417373657452657665616c3a20496e76616c696420616d6f756e7473206c656e6044820152620cee8d60eb1b60648201526084015b60405180910390fd5b8481146105b95760405162461bcd60e51b815260206004820152602860248201527f417373657452657665616c3a20496e76616c69642072657665616c48617368656044820152670e640d8cadccee8d60c31b6064820152608401610550565b60cd546001600160a01b0316636b406341896105e26105d661127a565b8b8b8b8b8b8b8b611289565b6040518363ffffffff1660e01b81526004016105ff929190612d68565b602060405180830381865afa15801561061c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106409190612d8a565b6106b25760405162461bcd60e51b815260206004820152602960248201527f417373657452657665616c3a20496e76616c69642072657665616c4d696e742060448201527f7369676e617475726500000000000000000000000000000000000000000000006064820152608401610550565b60006106c38886868a8a8888611378565b90507fd19ae26d53e6e3446633338937b673d431c042f61b32854f821bc2b2b025b2c46106ee61127a565b8989898588886040516107079796959493929190612dac565b60405180910390a1505050505050505050565b600082815260656020526040902060010154610735816115e2565b61073f83836115f6565b505050565b61074c61127a565b6001600160a01b0316816001600160a01b0316146107d25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610550565b6107dc8282611699565b5050565b86851461083b5760405162461bcd60e51b815260206004820152602360248201527f417373657452657665616c3a20496e76616c696420616d6f756e7473206c656e6044820152620cee8d60eb1b6064820152608401610550565b8483146108b05760405162461bcd60e51b815260206004820152602a60248201527f417373657452657665616c3a20496e76616c6964206d6574616461746148617360448201527f686573206c656e677468000000000000000000000000000000000000000000006064820152608401610550565b8681146109105760405162461bcd60e51b815260206004820152602860248201527f417373657452657665616c3a20496e76616c69642072657665616c48617368656044820152670e640d8cadccee8d60c31b6064820152608401610550565b60cd546001600160a01b0316636b4063418b8b61093b61092e61127a565b8d8d8d8d8d8d8d8d61173a565b6040518463ffffffff1660e01b815260040161095993929190612e27565b602060405180830381865afa158015610976573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099a9190612d8a565b610a0c5760405162461bcd60e51b815260206004820152602e60248201527f417373657452657665616c3a20496e76616c69642072657665616c426174636860448201527f4d696e74207369676e61747572650000000000000000000000000000000000006064820152608401610550565b60008767ffffffffffffffff811115610a2757610a27612717565b604051908082528060200260200182016040528015610a5a57816020015b6060815260200190600190039081610a455790505b50905060005b88811015610b2557610af58a8a83818110610a7d57610a7d612e4b565b90506020020135878784818110610a9657610a96612e4b565b9050602002810190610aa89190612e61565b8b8b86818110610aba57610aba612e4b565b9050602002810190610acc9190612e61565b898988818110610ade57610ade612e4b565b9050602002810190610af09190612e61565b611378565b828281518110610b0757610b07612e4b565b60200260200101819052508080610b1d90612ec1565b915050610a60565b507f9327e7d8f5446a92ddcaf7ccd64ad67693773944fe2db95200e2d4db20054359610b4f61127a565b8a8a8a8a868989604051610b6a989796959493929190612fc9565b60405180910390a15050505050505050505050565b610b89828261180d565b7f529140d9ae57da9c5515c8fe288c3865d4cbb81cb143062f99a466cb4bb6fa95610bb261127a565b604080516001600160a01b03909216825260208201859052810183905260600160405180910390a15050565b6000606080600080600060606098546000801b148015610bfe5750609954155b610c4a5760405162461bcd60e51b815260206004820152601560248201527f4549503731323a20556e696e697469616c697a656400000000000000000000006044820152606401610550565b610c526118b3565b610c5a611945565b604080516000808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009b939a50919850469750309650945092509050565b600082815260656020526040902060010154610cbb816115e2565b61073f8383611699565b6000610cd0816115e2565b6001600160a01b038216610d4c5760405162461bcd60e51b815260206004820152603460248201527f417373657452657665616c3a207472757374656420666f72776172646572206360448201527f616e2774206265207a65726f20616464726573730000000000000000000000006064820152608401610550565b609780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0384169081179091556040517f871264f4293af7d2865ae7eae628b228f4991c57cb45b39c99f0b774ebe2901890600090a25050565b600054610100900460ff1615808015610dcf5750600054600160ff909116105b80610de95750303b158015610de9575060005460ff166001145b610e5b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610550565b6000805460ff191660011790558015610e7e576000805461ff0019166101001790555b60cc80546001600160a01b038781167fffffffffffffffffffffffff00000000000000000000000000000000000000009283161790925560cd80548784169083161790556097805492861692909116919091179055610edd8787611954565b610ee86000836115f6565b8015610f2e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b848314610f925760405162461bcd60e51b815260206004820152602360248201527f417373657452657665616c3a20496e76616c696420616d6f756e7473206c656e6044820152620cee8d60eb1b6064820152608401610550565b848114610ff25760405162461bcd60e51b815260206004820152602860248201527f417373657452657665616c3a20496e76616c69642072657665616c48617368656044820152670e640d8cadccee8d60c31b6064820152608401610550565b60cd546001600160a01b0316636b4063418a61101b61100f61127a565b8c8b8b8b8b8b8b6119db565b6040518363ffffffff1660e01b8152600401611038929190612d68565b602060405180830381865afa158015611055573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110799190612d8a565b6110eb5760405162461bcd60e51b815260206004820152602c60248201527f417373657452657665616c3a20496e76616c6964206275726e416e645265766560448201527f616c207369676e617475726500000000000000000000000000000000000000006064820152608401610550565b6110f5888861180d565b60006111068986868a8a8888611378565b90507fd19ae26d53e6e3446633338937b673d431c042f61b32854f821bc2b2b025b2c461113161127a565b8a898985888860405161114a9796959493929190612dac565b60405180910390a150505050505050505050565b8281146111ad5760405162461bcd60e51b815260206004820152601a60248201527f417373657452657665616c3a20496e76616c696420696e7075740000000000006044820152606401610550565b60005b83811015611204576111f28585838181106111cd576111cd612e4b565b905060200201358484848181106111e6576111e6612e4b565b90506020020135611a16565b806111fc81612ec1565b9150506111b0565b5060cc546001600160a01b03166320820ec361121e61127a565b868686866040518663ffffffff1660e01b8152600401611242959493929190612d32565b600060405180830381600087803b15801561125c57600080fd5b505af1158015611270573d6000803e3d6000fd5b5050505050505050565b6000611284611b11565b905090565b600061136b7f1d2951170e2f5d8eb8a7a48a737f5f1680469c14594abd27536867bfb559f88f8a8a8a8a6040516020016112c49291906130bf565b60408051601f1981840301815291905280516020909101206112ee6112e98a8c613171565b611b56565b88886040516020016113019291906130bf565b60408051601f198184030181528282528051602091820120908301979097526001600160a01b03909516948101949094526060840192909252608083015260a082015260c081019190915260e0015b60405160208183030381529060405280519060200120611c4a565b9998505050505050505050565b6060600061138788888b611c92565b905060005b838110156114905760cf60008686848181106113aa576113aa612e4b565b602090810292909201358352508101919091526040016000205460ff16156114395760405162461bcd60e51b8152602060048201526024808201527f417373657452657665616c3a2052657665616c4861736820616c72656164792060448201527f75736564000000000000000000000000000000000000000000000000000000006064820152608401610550565b600160cf600087878581811061145157611451612e4b565b90506020020135815260200190815260200160002060006101000a81548160ff021916908315150217905550808061148890612ec1565b91505061138c565b5080516001036115645760cc546001600160a01b031663bb7fde716114b361127a565b836000815181106114c6576114c6612e4b565b6020026020010151898960008181106114e1576114e1612e4b565b905060200201358c8c60008181106114fb576114fb612e4b565b905060200281019061150d919061317e565b6040518663ffffffff1660e01b815260040161152d9594939291906131c5565b600060405180830381600087803b15801561154757600080fd5b505af115801561155b573d6000803e3d6000fd5b505050506115d6565b60cc546001600160a01b031663a55784ef61157d61127a565b8389898d8d6040518763ffffffff1660e01b81526004016115a3969594939291906131ff565b600060405180830381600087803b1580156115bd57600080fd5b505af11580156115d1573d6000803e3d6000fd5b505050505b98975050505050505050565b6115f3816115ee61127a565b611e93565b50565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166107dc5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561165561127a565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16156107dc5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191690556116f661127a565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b60006117ff7f30ed1d13f34eab3b4d1a3291d48db1d77bbc98ec9480b9131e4360220fd46fb08b8b8b6040516020016117749291906130bf565b60408051601f19818403018152919052805160209091012061179e6117998b8d6132d3565b611f08565b6117b06117ab8a8c613399565b611fcc565b6117c26117bd898b613421565b612072565b6040805160208101979097526001600160a01b03909516948601949094526060850192909252608084015260a083015260c082015260e001611350565b9a9950505050505050505050565b6118178282611a16565b60cc546001600160a01b031663124d91e561183061127a565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b0390911660048201526024810185905260448101849052606401600060405180830381600087803b15801561189757600080fd5b505af11580156118ab573d6000803e3d6000fd5b505050505050565b6060609a80546118c2906134da565b80601f01602080910402602001604051908101604052809291908181526020018280546118ee906134da565b801561193b5780601f106119105761010080835404028352916020019161193b565b820191906000526020600020905b81548152906001019060200180831161191e57829003601f168201915b5050505050905090565b6060609b80546118c2906134da565b600054610100900460ff166119d15760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610550565b6107dc8282612136565b600061136b7f45cf7a9b20b47d492887b813085b48aa1988f1f482fe79948578452b4b4cbedd8a8a8a8a6040516020016112c49291906130bf565b6000611a21836121db565b90508060a0015115611a9b5760405162461bcd60e51b815260206004820152602660248201527f417373657452657665616c3a20417373657420697320616c726561647920726560448201527f7665616c656400000000000000000000000000000000000000000000000000006064820152608401610550565b6000821161073f5760405162461bcd60e51b815260206004820152603160248201527f417373657452657665616c3a204275726e20616d6f756e742073686f756c642060448201527f62652067726561746572207468616e20300000000000000000000000000000006064820152608401610550565b6097546000906001600160a01b03163303611b5157507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b503390565b600080825167ffffffffffffffff811115611b7357611b73612717565b604051908082528060200260200182016040528015611b9c578160200160208202803683370190505b50905060005b8351811015611c1a57838181518110611bbd57611bbd612e4b565b6020026020010151604051602001611bd59190613514565b60405160208183030381529060405280519060200120828281518110611bfd57611bfd612e4b565b602090810291909101015280611c1281612ec1565b915050611ba2565b5080604051602001611c2c9190613530565b60405160208183030381529060405280519060200120915050919050565b600061049b611c57612268565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b60606000611c9f836121db565b90508060a0015115611cf35760405162461bcd60e51b815260206004820152601d60248201527f417373657452657665616c3a20616c72656164792072657665616c65640000006044820152606401610550565b60008467ffffffffffffffff811115611d0e57611d0e612717565b604051908082528060200260200182016040528015611d37578160200160208202803683370190505b50905060005b85811015611e895760cc546000906001600160a01b031663fdda1d0e898985818110611d6b57611d6b612e4b565b9050602002810190611d7d919061317e565b6040518363ffffffff1660e01b8152600401611d9a929190613566565b602060405180830381865afa158015611db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddb919061357a565b905080600003611e58576020808501516001600160a01b0316600090815260ce8252604080822089835290925290812080548290611e1c9061ffff16613593565b91906101000a81548161ffff021916908361ffff16021790559050611e54856020015186606001518760800151848960e00151612272565b9150505b80838381518110611e6b57611e6b612e4b565b60209081029190910101525080611e8181612ec1565b915050611d3d565b5095945050505050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166107dc57611ec6816122bf565b611ed18360206122d1565b604051602001611ee29291906135b4565b60408051601f198184030181529082905262461bcd60e51b825261055091600401613635565b600080825167ffffffffffffffff811115611f2557611f25612717565b604051908082528060200260200182016040528015611f4e578160200160208202803683370190505b50905060005b8351811015611c1a57838181518110611f6f57611f6f612e4b565b6020026020010151604051602001611f879190613530565b60405160208183030381529060405280519060200120828281518110611faf57611faf612e4b565b602090810291909101015280611fc481612ec1565b915050611f54565b600080825167ffffffffffffffff811115611fe957611fe9612717565b604051908082528060200260200182016040528015612012578160200160208202803683370190505b50905060005b8351811015611c1a5761204384828151811061203657612036612e4b565b6020026020010151611b56565b82828151811061205557612055612e4b565b60209081029190910101528061206a81612ec1565b915050612018565b600080825167ffffffffffffffff81111561208f5761208f612717565b6040519080825280602002602001820160405280156120b8578160200160208202803683370190505b50905060005b8351811015611c1a578381815181106120d9576120d9612e4b565b60200260200101516040516020016120f19190613530565b6040516020818303038152906040528051906020012082828151811061211957612119612e4b565b60209081029190910101528061212e81612ec1565b9150506120be565b600054610100900460ff166121b35760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610550565b609a6121bf838261368e565b50609b6121cc828261368e565b50506000609881905560995550565b604080516101008101825260008082529181018290526080810182905260a0808201839052606060c0830181905260e08301939093526001600160a01b038416602083015283901c60ff169181019190915261223682612501565b151560a082015261224b8260a81c61ffff1690565b61ffff16608082015260c89190911c60019081161460e082015290565b600061128461251f565b60008560c883612283576000612286565b60015b60ff16901b60b88561ffff16901b60a88761ffff16901b60a08960ff16901b846001600160a01b03161717171791505095945050505050565b606061049b6001600160a01b03831660145b606060006122e083600261374e565b6122eb906002613765565b67ffffffffffffffff81111561230357612303612717565b6040519080825280601f01601f19166020018201604052801561232d576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061236457612364612e4b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106123c7576123c7612e4b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600061240384600261374e565b61240e906001613765565b90505b60018111156124ab577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061244f5761244f612e4b565b1a60f81b82828151811061246557612465612e4b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936124a481613778565b9050612411565b5083156124fa5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610550565b9392505050565b6000806125128360b81c61ffff1690565b61ffff1615159392505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f61254a612593565b6125526125ec565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b60008061259e6118b3565b8051909150156125b5578051602090910120919050565b60985480156125c45792915050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709250505090565b6000806125f7611945565b80519091501561260e578051602090910120919050565b60995480156125c45792915050565b60006020828403121561262f57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146124fa57600080fd5b60008083601f84011261267157600080fd5b50813567ffffffffffffffff81111561268957600080fd5b6020830191508360208260051b85010111156126a457600080fd5b9250929050565b600080600080604085870312156126c157600080fd5b843567ffffffffffffffff808211156126d957600080fd5b6126e58883890161265f565b909650945060208701359150808211156126fe57600080fd5b5061270b8782880161265f565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561275657612756612717565b604052919050565b600082601f83011261276f57600080fd5b813567ffffffffffffffff81111561278957612789612717565b61279c6020601f19601f8401160161272d565b8181528460208386010111156127b157600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060008060008060a0898b0312156127ea57600080fd5b883567ffffffffffffffff8082111561280257600080fd5b61280e8c838d0161275e565b995060208b0135985060408b013591508082111561282b57600080fd5b6128378c838d0161265f565b909850965060608b013591508082111561285057600080fd5b61285c8c838d0161265f565b909650945060808b013591508082111561287557600080fd5b506128828b828c0161265f565b999c989b5096995094979396929594505050565b6000602082840312156128a857600080fd5b5035919050565b80356001600160a01b03811681146128c657600080fd5b919050565b600080604083850312156128de57600080fd5b823591506128ee602084016128af565b90509250929050565b60008083601f84011261290957600080fd5b50813567ffffffffffffffff81111561292157600080fd5b6020830191508360208285010111156126a457600080fd5b60008060008060008060008060008060a08b8d03121561295857600080fd5b8a3567ffffffffffffffff8082111561297057600080fd5b61297c8e838f016128f7565b909c509a5060208d013591508082111561299557600080fd5b6129a18e838f0161265f565b909a50985060408d01359150808211156129ba57600080fd5b6129c68e838f0161265f565b909850965060608d01359150808211156129df57600080fd5b6129eb8e838f0161265f565b909650945060808d0135915080821115612a0457600080fd5b50612a118d828e0161265f565b915080935050809150509295989b9194979a5092959850565b600060208284031215612a3c57600080fd5b6124fa826128af565b60008060408385031215612a5857600080fd5b50508035926020909101359150565b60005b83811015612a82578181015183820152602001612a6a565b50506000910152565b60008151808452612aa3816020860160208601612a67565b601f01601f19169290920160200192915050565b600081518084526020808501945080840160005b83811015612ae757815187529582019590820190600101612acb565b509495945050505050565b7fff000000000000000000000000000000000000000000000000000000000000008816815260e060208201526000612b2d60e0830189612a8b565b8281036040840152612b3f8189612a8b565b90508660608401526001600160a01b03861660808401528460a084015282810360c08401526117ff8185612ab7565b60008060008060008060c08789031215612b8757600080fd5b863567ffffffffffffffff80821115612b9f57600080fd5b612bab8a838b0161275e565b97506020890135915080821115612bc157600080fd5b50612bce89828a0161275e565b955050612bdd604088016128af565b9350612beb606088016128af565b9250612bf9608088016128af565b9150612c0760a088016128af565b90509295509295509295565b600080600080600080600080600060c08a8c031215612c3157600080fd5b893567ffffffffffffffff80821115612c4957600080fd5b612c558d838e0161275e565b9a5060208c0135995060408c0135985060608c0135915080821115612c7957600080fd5b612c858d838e0161265f565b909850965060808c0135915080821115612c9e57600080fd5b612caa8d838e0161265f565b909650945060a08c0135915080821115612cc357600080fd5b50612cd08c828d0161265f565b915080935050809150509295985092959850929598565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115612d1957600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b0386168152606060208201526000612d55606083018688612ce7565b82810360408401526115d6818587612ce7565b604081526000612d7b6040830185612a8b565b90508260208301529392505050565b600060208284031215612d9c57600080fd5b815180151581146124fa57600080fd5b6001600160a01b038816815286602082015260a060408201526000612dd560a083018789612ce7565b8281036060840152612de78187612ab7565b905082810360808401526117ff818587612ce7565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b604081526000612e3b604083018587612dfc565b9050826020830152949350505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112612e7857600080fd5b83018035915067ffffffffffffffff821115612e9357600080fd5b6020019150600581901b36038213156126a457600080fd5b634e487b7160e01b600052601160045260246000fd5b60006000198203612ed457612ed4612eab565b5060010190565b6000808335601e19843603018112612ef257600080fd5b830160208101925035905067ffffffffffffffff811115612f1257600080fd5b8060051b36038213156126a457600080fd5b6000815180845260208085019450848260051b860182860160005b85811015612f69578383038952612f57838351612ab7565b98850198925090840190600101612f3f565b5090979650505050505050565b60008383855260208086019550808560051b8301018460005b87811015612f6957601f19858403018952612faa8288612edb565b612fb5858284612ce7565b9a86019a9450505090830190600101612f8f565b6001600160a01b03891681526000602060a081840152612fed60a084018a8c612ce7565b8381036040850152878152818101600589901b820183018a60005b8b81101561304257601f19858403018452613023828e612edb565b61302e858284612ce7565b958801959450505090850190600101613008565b50508581036060870152613056818a612f24565b9350505050828103608084015261306e818587612f76565b9b9a5050505050505050505050565b60007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8311156130ac57600080fd5b8260051b80838637939093019392505050565b60006130cc82848661307d565b949350505050565b600067ffffffffffffffff8211156130ee576130ee612717565b5060051b60200190565b600061310b613106846130d4565b61272d565b8381529050602080820190600585901b84018681111561312a57600080fd5b845b8181101561316657803567ffffffffffffffff81111561314c5760008081fd5b6131588982890161275e565b85525092820192820161312c565b505050509392505050565b60006124fa3684846130f8565b6000808335601e1984360301811261319557600080fd5b83018035915067ffffffffffffffff8211156131b057600080fd5b6020019150368190038213156126a457600080fd5b6001600160a01b03861681528460208201528360408201526080606082015260006131f4608083018486612dfc565b979650505050505050565b6001600160a01b0387168152600060206080818401526132226080840189612ab7565b838103604085015261323581888a612ce7565b84810360608601528581529050818101600586901b820183018760005b888110156132c157601f198584030184528135601e198b360301811261327757600080fd5b8a01868101903567ffffffffffffffff81111561329357600080fd5b8036038213156132a257600080fd5b6132ad858284612dfc565b958801959450505090850190600101613252565b50909c9b505050505050505050505050565b60006132e1613106846130d4565b83815260208082019190600586811b8601368111156132ff57600080fd5b865b8181101561338c57803567ffffffffffffffff8111156133215760008081fd5b880136601f8201126133335760008081fd5b8035613341613106826130d4565b81815290851b8201860190868101903683111561335e5760008081fd5b928701925b8284101561337c57833582529287019290870190613363565b8952505050948301948301613301565b5092979650505050505050565b60006133a7613106846130d4565b80848252602080830192508560051b8501368111156133c557600080fd5b855b8181101561341557803567ffffffffffffffff8111156133e75760008081fd5b870136601f8201126133f95760008081fd5b6134073682358684016130f8565b8652509382019382016133c7565b50919695505050505050565b600061342f613106846130d4565b83815260208082019190600586811b86013681111561344d57600080fd5b865b8181101561338c57803567ffffffffffffffff81111561346f5760008081fd5b880136601f8201126134815760008081fd5b803561348f613106826130d4565b81815290851b820186019086810190368311156134ac5760008081fd5b928701925b828410156134ca578335825292870192908701906134b1565b895250505094830194830161344f565b600181811c908216806134ee57607f821691505b60208210810361350e57634e487b7160e01b600052602260045260246000fd5b50919050565b60008251613526818460208701612a67565b9190910192915050565b815160009082906020808601845b8381101561355a5781518552938201939082019060010161353e565b50929695505050505050565b6020815260006130cc602083018486612dfc565b60006020828403121561358c57600080fd5b5051919050565b600061ffff8083168181036135aa576135aa612eab565b6001019392505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516135ec816017850160208801612a67565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351613629816028840160208801612a67565b01602801949350505050565b6020815260006124fa6020830184612a8b565b601f82111561073f57600081815260208120601f850160051c8101602086101561366f5750805b601f850160051c820191505b818110156118ab5782815560010161367b565b815167ffffffffffffffff8111156136a8576136a8612717565b6136bc816136b684546134da565b84613648565b602080601f8311600181146136f157600084156136d95750858301515b600019600386901b1c1916600185901b1785556118ab565b600085815260208120601f198616915b8281101561372057888601518255948401946001909101908401613701565b508582101561373e5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b808202811582820484141761049b5761049b612eab565b8082018082111561049b5761049b612eab565b60008161378757613787612eab565b50600019019056fea264697066735822122048a34c31e5af5787bded90c5e3f5f6c80691a60f38bf1dd0fb048374fc24b83f64736f6c63430008120033", + "solcInputHash": "6f473f7e77d584cdbb9fe0c91f28e82a", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"revealer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"unrevealedTokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"AssetRevealBatchBurn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"unrevealedTokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[][]\",\"name\":\"amounts\",\"type\":\"uint256[][]\"},{\"indexed\":false,\"internalType\":\"uint256[][]\",\"name\":\"newTokenIds\",\"type\":\"uint256[][]\"},{\"indexed\":false,\"internalType\":\"bytes32[][]\",\"name\":\"revealHashes\",\"type\":\"bytes32[][]\"}],\"name\":\"AssetRevealBatchMint\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"revealer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unrevealedTokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"AssetRevealBurn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unrevealedTokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"newTokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"bytes32[]\",\"name\":\"revealHashes\",\"type\":\"bytes32[]\"}],\"name\":\"AssetRevealMint\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newTrustedForwarderAddress\",\"type\":\"address\"}],\"name\":\"TrustedForwarderChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldTrustedForwarder\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newTrustedForwarder\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"TrustedForwarderSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BATCH_REVEAL_TYPEHASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"INSTANT_REVEAL_TYPEHASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REVEAL_TYPEHASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"prevTokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"burnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"string[]\",\"name\":\"metadataHashes\",\"type\":\"string[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"revealHashes\",\"type\":\"bytes32[]\"}],\"name\":\"burnAndReveal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAssetContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAuthValidator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTrustedForwarder\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_version\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_assetContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_authValidator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_forwarder\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_defaultAdmin\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"}],\"name\":\"isTrustedForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"revealBatchBurn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"uint256[]\",\"name\":\"prevTokenIds\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[][]\",\"name\":\"amounts\",\"type\":\"uint256[][]\"},{\"internalType\":\"string[][]\",\"name\":\"metadataHashes\",\"type\":\"string[][]\"},{\"internalType\":\"bytes32[][]\",\"name\":\"revealHashes\",\"type\":\"bytes32[][]\"}],\"name\":\"revealBatchMint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"revealBurn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"revealHash\",\"type\":\"bytes32\"}],\"name\":\"revealHashUsed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"prevTokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"string[]\",\"name\":\"metadataHashes\",\"type\":\"string[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"revealHashes\",\"type\":\"bytes32[]\"}],\"name\":\"revealMint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"name\":\"setTrustedForwarder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"The Sandbox\",\"events\":{\"EIP712DomainChanged()\":{\"details\":\"MAY be emitted to signal that the domain could have changed.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"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._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"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`)\"},\"TrustedForwarderSet(address,address,address)\":{\"params\":{\"newTrustedForwarder\":\"new trusted forwarder\",\"oldTrustedForwarder\":\"old trusted forwarder\",\"operator\":\"the sender of the transaction\"}}},\"kind\":\"dev\",\"methods\":{\"burnAndReveal(bytes,uint256,uint256,uint256[],string[],bytes32[])\":{\"details\":\"Should be used where it is not required to keep the metadata secret, e.g. mythical assets where users select their desired abilities and enhancements\",\"params\":{\"amounts\":\"The amount of assets to reveal (sum must be equal to the burnAmount)\",\"burnAmount\":\"The amount of assets to burn\",\"metadataHashes\":\"The array of hashes for asset metadata\",\"prevTokenId\":\"The tokenId of the unrevealed asset\",\"revealHashes\":\"A revealHash array providing a random bytes32 generated by the TSB backend for each new tokenId\",\"signature\":\"Signature created on the TSB backend containing INSTANT_REVEAL_TYPEHASH and associated data, must be signed by authorized signer\"}},\"constructor\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"eip712Domain()\":{\"details\":\"See {EIP-5267}. _Available since v4.9._\"},\"getAssetContract()\":{\"returns\":{\"_0\":\"The asset contract address\"}},\"getAuthValidator()\":{\"returns\":{\"_0\":\"The auth validator address\"}},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getTrustedForwarder()\":{\"returns\":{\"_0\":\"return the address of the trusted forwarder\"}},\"grantRole(bytes32,address)\":{\"details\":\"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.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"initialize(string,string,address,address,address,address)\":{\"params\":{\"_assetContract\":\"The address of the asset contract\",\"_authValidator\":\"The address of the AuthSuperValidator contract\",\"_forwarder\":\"The address of the forwarder contract\"}},\"isTrustedForwarder(address)\":{\"params\":{\"forwarder\":\"trusted forwarder address to check\"},\"returns\":{\"_0\":\"true if the address is the same as the trusted forwarder\"}},\"renounceRole(bytes32,address)\":{\"details\":\"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.\"},\"revealBatchBurn(uint256[],uint256[])\":{\"details\":\"Can be used to burn multiple copies of the same token id, each copy will be revealed separately\",\"params\":{\"amounts\":\"the amounts of the assets to burn\",\"tokenIds\":\"the tokenIds of the assets to burn\"}},\"revealBatchMint(bytes,uint256[],uint256[][],string[][],bytes32[][])\":{\"details\":\"Can be used to reveal multiple copies of the same token id\",\"params\":{\"amounts\":\"The amount of assets to reveal (must be equal to the length of revealHashes)\",\"metadataHashes\":\"The array of hashes for asset metadata\",\"prevTokenIds\":\"The tokenId of the unrevealed asset\",\"revealHashes\":\"Array of revealHash arrays providing random bytes32 generated by the TSB backend for each new tokenId\",\"signature\":\"Signatures created on the TSB backend containing REVEAL_TYPEHASH and associated data, must be signed by authorized signer\"}},\"revealBurn(uint256,uint256)\":{\"details\":\"the reveal mechanism works through burning the asset and minting a new one with updated tokenId\",\"params\":{\"amount\":\"the amount of tokens to reveal\",\"tokenId\":\"the tokenId of id idasset to reveal\"}},\"revealHashUsed(bytes32)\":{\"returns\":{\"_0\":\"Whether it has been used\"}},\"revealMint(bytes,uint256,uint256[],string[],bytes32[])\":{\"details\":\"Can be used to reveal multiple copies of the same token id\",\"params\":{\"amounts\":\"The amount of assets to reveal (length reflects the number of types of reveal tokens and must be equal to the length of revealHashes)\",\"metadataHashes\":\"The array of hashes for revealed asset metadata\",\"prevTokenId\":\"The tokenId of the unrevealed asset\",\"revealHashes\":\"A revealHash array providing a random bytes32 generated by the TSB backend for each new tokenId\",\"signature\":\"Signature created on the TSB backend containing REVEAL_TYPEHASH and associated data, must be signed by authorized signer\"}},\"revokeRole(bytes32,address)\":{\"details\":\"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.\"},\"setTrustedForwarder(address)\":{\"details\":\"Change the address of the trusted forwarder for meta-TX\",\"params\":{\"trustedForwarder\":\"The new trustedForwarder\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"title\":\"AssetReveal\",\"version\":1},\"userdoc\":{\"events\":{\"TrustedForwarderSet(address,address,address)\":{\"notice\":\"Emitted when a `newTrustedForwarder` is set, replacing the `oldTrustedForwarder`\"}},\"kind\":\"user\",\"methods\":{\"burnAndReveal(bytes,uint256,uint256,uint256[],string[],bytes32[])\":{\"notice\":\"Reveal assets to view their abilities and enhancements and mint them in a single transaction\"},\"getAssetContract()\":{\"notice\":\"Get the asset contract address\"},\"getAuthValidator()\":{\"notice\":\"Get the auth validator address\"},\"getTrustedForwarder()\":{\"notice\":\"return the address of the trusted forwarder\"},\"initialize(string,string,address,address,address,address)\":{\"notice\":\"Initialize the contract\"},\"isTrustedForwarder(address)\":{\"notice\":\"return true if the forwarder is the trusted forwarder\"},\"revealBatchBurn(uint256[],uint256[])\":{\"notice\":\"Burn multiple assets to be able to reveal them later\"},\"revealBatchMint(bytes,uint256[],uint256[][],string[][],bytes32[][])\":{\"notice\":\"Mint multiple assets with revealed abilities and enhancements\"},\"revealBurn(uint256,uint256)\":{\"notice\":\"Reveal an asset to view its abilities and enhancements\"},\"revealHashUsed(bytes32)\":{\"notice\":\"Get the status of a revealHash\"},\"revealMint(bytes,uint256,uint256[],string[],bytes32[])\":{\"notice\":\"Reveal assets to view their abilities and enhancements\"},\"setTrustedForwarder(address)\":{\"notice\":\"Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\"}},\"notice\":\"Contract for burning and revealing assets\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"@sandbox-smart-contracts/asset/contracts/AssetReveal.sol\":\"AssetReveal\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlUpgradeable.sol\\\";\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\\n function __AccessControl_init() internal onlyInitializing {\\n }\\n\\n function __AccessControl_init_unchained() internal onlyInitializing {\\n }\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n StringsUpgradeable.toHexString(account),\\n \\\" is missing role \\\",\\n StringsUpgradeable.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xfeefb24d068524440e1ba885efdf105d91f83504af3c2d745ffacc4595396831\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControlUpgradeable {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0xb8f5302f12138c5561362e88a78d061573e6298b7a1a5afe84a1e2c8d4d5aeaa\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC5267Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\\n\\npragma solidity ^0.8.0;\\n\\ninterface IERC5267Upgradeable {\\n /**\\n * @dev MAY be emitted to signal that the domain could have changed.\\n */\\n event EIP712DomainChanged();\\n\\n /**\\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\\n * signature.\\n */\\n function eip712Domain()\\n external\\n view\\n returns (\\n bytes1 fields,\\n string memory name,\\n string memory version,\\n uint256 chainId,\\n address verifyingContract,\\n bytes32 salt,\\n uint256[] memory extensions\\n );\\n}\\n\",\"keccak256\":\"0xe562dab443278837fa50faddb76743399e942181881db8dccaea3bd1712994db\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized != type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../StringsUpgradeable.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSAUpgradeable {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\")\\n mstore(0x1c, hash)\\n message := keccak256(0x00, 0x3c)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", StringsUpgradeable.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, \\\"\\\\x19\\\\x01\\\")\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n data := keccak256(ptr, 0x42)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\\n * `validator` and `data` according to the version 0 of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x00\\\", validator, data));\\n }\\n}\\n\",\"keccak256\":\"0xa014f65d84b02827055d99993ccdbfb4b56b2c9e91eb278d82a93330659d06e4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.8;\\n\\nimport \\\"./ECDSAUpgradeable.sol\\\";\\nimport \\\"../../interfaces/IERC5267Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\\n *\\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\\n *\\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\\n * ({_hashTypedDataV4}).\\n *\\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\\n * the chain id to protect against replay attacks on an eventual fork of the chain.\\n *\\n * NOTE: This contract implements the version of the encoding known as \\\"v4\\\", as implemented by the JSON RPC method\\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\\n *\\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\\n *\\n * _Available since v3.4._\\n *\\n * @custom:storage-size 52\\n */\\nabstract contract EIP712Upgradeable is Initializable, IERC5267Upgradeable {\\n bytes32 private constant _TYPE_HASH =\\n keccak256(\\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\");\\n\\n /// @custom:oz-renamed-from _HASHED_NAME\\n bytes32 private _hashedName;\\n /// @custom:oz-renamed-from _HASHED_VERSION\\n bytes32 private _hashedVersion;\\n\\n string private _name;\\n string private _version;\\n\\n /**\\n * @dev Initializes the domain separator and parameter caches.\\n *\\n * The meaning of `name` and `version` is specified in\\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\\n *\\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\\n * - `version`: the current major version of the signing domain.\\n *\\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\\n * contract upgrade].\\n */\\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\\n __EIP712_init_unchained(name, version);\\n }\\n\\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\\n _name = name;\\n _version = version;\\n\\n // Reset prior values in storage if upgrading\\n _hashedName = 0;\\n _hashedVersion = 0;\\n }\\n\\n /**\\n * @dev Returns the domain separator for the current chain.\\n */\\n function _domainSeparatorV4() internal view returns (bytes32) {\\n return _buildDomainSeparator();\\n }\\n\\n function _buildDomainSeparator() private view returns (bytes32) {\\n return keccak256(abi.encode(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this)));\\n }\\n\\n /**\\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\\n * function returns the hash of the fully encoded EIP712 message for this domain.\\n *\\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\\n *\\n * ```solidity\\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\\n * keccak256(\\\"Mail(address to,string contents)\\\"),\\n * mailTo,\\n * keccak256(bytes(mailContents))\\n * )));\\n * address signer = ECDSA.recover(digest, signature);\\n * ```\\n */\\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n\\n /**\\n * @dev See {EIP-5267}.\\n *\\n * _Available since v4.9._\\n */\\n function eip712Domain()\\n public\\n view\\n virtual\\n override\\n returns (\\n bytes1 fields,\\n string memory name,\\n string memory version,\\n uint256 chainId,\\n address verifyingContract,\\n bytes32 salt,\\n uint256[] memory extensions\\n )\\n {\\n // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized\\n // and the EIP712 domain is not reliable, as it will be missing name and version.\\n require(_hashedName == 0 && _hashedVersion == 0, \\\"EIP712: Uninitialized\\\");\\n\\n return (\\n hex\\\"0f\\\", // 01111\\n _EIP712Name(),\\n _EIP712Version(),\\n block.chainid,\\n address(this),\\n bytes32(0),\\n new uint256[](0)\\n );\\n }\\n\\n /**\\n * @dev The name parameter for the EIP712 domain.\\n *\\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\\n * are a concern.\\n */\\n function _EIP712Name() internal virtual view returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev The version parameter for the EIP712 domain.\\n *\\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\\n * are a concern.\\n */\\n function _EIP712Version() internal virtual view returns (string memory) {\\n return _version;\\n }\\n\\n /**\\n * @dev The hash of the name parameter for the EIP712 domain.\\n *\\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.\\n */\\n function _EIP712NameHash() internal view returns (bytes32) {\\n string memory name = _EIP712Name();\\n if (bytes(name).length > 0) {\\n return keccak256(bytes(name));\\n } else {\\n // If the name is empty, the contract may have been upgraded without initializing the new storage.\\n // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.\\n bytes32 hashedName = _hashedName;\\n if (hashedName != 0) {\\n return hashedName;\\n } else {\\n return keccak256(\\\"\\\");\\n }\\n }\\n }\\n\\n /**\\n * @dev The hash of the version parameter for the EIP712 domain.\\n *\\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.\\n */\\n function _EIP712VersionHash() internal view returns (bytes32) {\\n string memory version = _EIP712Version();\\n if (bytes(version).length > 0) {\\n return keccak256(bytes(version));\\n } else {\\n // If the version is empty, the contract may have been upgraded without initializing the new storage.\\n // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.\\n bytes32 hashedVersion = _hashedVersion;\\n if (hashedVersion != 0) {\\n return hashedVersion;\\n } else {\\n return keccak256(\\\"\\\");\\n }\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[48] private __gap;\\n}\\n\",\"keccak256\":\"0xeb8d6be406a373771724922eb41b5d593bc8e2dc705daa22cd1145cfc8f5a3a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary MathUpgradeable {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(account),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0dd6e52cb394d7f5abe5dca2d4908a6be40417914720932de757de34a99ab87f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\")\\n mstore(0x1c, hash)\\n message := keccak256(0x00, 0x3c)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, \\\"\\\\x19\\\\x01\\\")\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n data := keccak256(ptr, 0x42)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\\n * `validator` and `data` according to the version 0 of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x00\\\", validator, data));\\n }\\n}\\n\",\"keccak256\":\"0x809bc3edb4bcbef8263fa616c1b60ee0004b50a8a1bfa164d8f57fd31f520c58\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/AssetReveal.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {EIP712Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\\\";\\nimport {\\n AccessControlUpgradeable,\\n ContextUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\\\";\\nimport {TokenIdUtils} from \\\"./libraries/TokenIdUtils.sol\\\";\\nimport {AuthSuperValidator} from \\\"./AuthSuperValidator.sol\\\";\\nimport {\\n ERC2771HandlerUpgradeable,\\n ERC2771HandlerAbstract\\n} from \\\"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\\\";\\nimport {IAsset} from \\\"./interfaces/IAsset.sol\\\";\\nimport {IAssetReveal} from \\\"./interfaces/IAssetReveal.sol\\\";\\n\\n/// @title AssetReveal\\n/// @author The Sandbox\\n/// @notice Contract for burning and revealing assets\\ncontract AssetReveal is\\n IAssetReveal,\\n Initializable,\\n AccessControlUpgradeable,\\n ERC2771HandlerUpgradeable,\\n EIP712Upgradeable\\n{\\n using TokenIdUtils for uint256;\\n IAsset private assetContract;\\n AuthSuperValidator private authValidator;\\n\\n // mapping of creator to asset id to asset's reveal nonce\\n mapping(address => mapping(uint256 => uint16)) internal revealIds;\\n\\n // mapping for showing whether a revealHash has been used\\n // revealHashes are generated by the TSB backend from reveal burn events and are used for reveal minting\\n mapping(bytes32 => bool) internal revealHashesUsed;\\n\\n bytes32 public constant REVEAL_TYPEHASH =\\n keccak256(\\n \\\"Reveal(address recipient,uint256 prevTokenId,uint256[] amounts,string[] metadataHashes,bytes32[] revealHashes)\\\"\\n );\\n bytes32 public constant BATCH_REVEAL_TYPEHASH =\\n keccak256(\\n \\\"BatchReveal(address recipient,uint256[] prevTokenIds,uint256[][] amounts,string[][] metadataHashes,bytes32[][] revealHashes)\\\"\\n );\\n bytes32 public constant INSTANT_REVEAL_TYPEHASH =\\n keccak256(\\n \\\"InstantReveal(address recipient,uint256 prevTokenId,uint256[] amounts,string[] metadataHashes,bytes32[] revealHashes)\\\"\\n );\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /// @notice Initialize the contract\\n /// @param _assetContract The address of the asset contract\\n /// @param _authValidator The address of the AuthSuperValidator contract\\n /// @param _forwarder The address of the forwarder contract\\n function initialize(\\n string memory _name,\\n string memory _version,\\n address _assetContract,\\n address _authValidator,\\n address _forwarder,\\n address _defaultAdmin\\n ) public initializer {\\n assetContract = IAsset(_assetContract);\\n authValidator = AuthSuperValidator(_authValidator);\\n __ERC2771Handler_init(_forwarder);\\n __EIP712_init(_name, _version);\\n _grantRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);\\n }\\n\\n /// @notice Reveal an asset to view its abilities and enhancements\\n /// @dev the reveal mechanism works through burning the asset and minting a new one with updated tokenId\\n /// @param tokenId the tokenId of id idasset to reveal\\n /// @param amount the amount of tokens to reveal\\n function revealBurn(uint256 tokenId, uint256 amount) external {\\n _burnAsset(tokenId, amount);\\n emit AssetRevealBurn(_msgSender(), tokenId, amount);\\n }\\n\\n /// @notice Burn multiple assets to be able to reveal them later\\n /// @dev Can be used to burn multiple copies of the same token id, each copy will be revealed separately\\n /// @param tokenIds the tokenIds of the assets to burn\\n /// @param amounts the amounts of the assets to burn\\n function revealBatchBurn(uint256[] calldata tokenIds, uint256[] calldata amounts) external {\\n _burnAssetBatch(tokenIds, amounts);\\n emit AssetRevealBatchBurn(_msgSender(), tokenIds, amounts);\\n }\\n\\n /// @notice Reveal assets to view their abilities and enhancements\\n /// @dev Can be used to reveal multiple copies of the same token id\\n /// @param signature Signature created on the TSB backend containing REVEAL_TYPEHASH and associated data, must be signed by authorized signer\\n /// @param prevTokenId The tokenId of the unrevealed asset\\n /// @param amounts The amount of assets to reveal (length reflects the number of types of reveal tokens and must be equal to the length of revealHashes)\\n /// @param metadataHashes The array of hashes for revealed asset metadata\\n /// @param revealHashes A revealHash array providing a random bytes32 generated by the TSB backend for each new tokenId\\n function revealMint(\\n bytes memory signature,\\n uint256 prevTokenId,\\n uint256[] calldata amounts,\\n string[] calldata metadataHashes,\\n bytes32[] calldata revealHashes\\n ) external {\\n require(amounts.length == metadataHashes.length, \\\"AssetReveal: Invalid amounts length\\\");\\n require(amounts.length == revealHashes.length, \\\"AssetReveal: Invalid revealHashes length\\\");\\n require(\\n authValidator.verify(\\n signature,\\n _hashReveal(_msgSender(), prevTokenId, amounts, metadataHashes, revealHashes)\\n ),\\n \\\"AssetReveal: Invalid revealMint signature\\\"\\n );\\n uint256[] memory newTokenIds = _revealAsset(prevTokenId, metadataHashes, amounts, revealHashes);\\n emit AssetRevealMint(_msgSender(), prevTokenId, amounts, newTokenIds, revealHashes);\\n }\\n\\n /// @notice Mint multiple assets with revealed abilities and enhancements\\n /// @dev Can be used to reveal multiple copies of the same token id\\n /// @param signature Signatures created on the TSB backend containing REVEAL_TYPEHASH and associated data, must be signed by authorized signer\\n /// @param prevTokenIds The tokenId of the unrevealed asset\\n /// @param amounts The amount of assets to reveal (must be equal to the length of revealHashes)\\n /// @param metadataHashes The array of hashes for asset metadata\\n /// @param revealHashes Array of revealHash arrays providing random bytes32 generated by the TSB backend for each new tokenId\\n function revealBatchMint(\\n bytes calldata signature,\\n uint256[] calldata prevTokenIds,\\n uint256[][] calldata amounts,\\n string[][] calldata metadataHashes,\\n bytes32[][] calldata revealHashes\\n ) external {\\n require(prevTokenIds.length == amounts.length, \\\"AssetReveal: Invalid amounts length\\\");\\n require(amounts.length == metadataHashes.length, \\\"AssetReveal: Invalid metadataHashes length\\\");\\n require(prevTokenIds.length == revealHashes.length, \\\"AssetReveal: Invalid revealHashes length\\\");\\n require(\\n authValidator.verify(\\n signature,\\n _hashBatchReveal(_msgSender(), prevTokenIds, amounts, metadataHashes, revealHashes)\\n ),\\n \\\"AssetReveal: Invalid revealBatchMint signature\\\"\\n );\\n uint256[][] memory newTokenIds = new uint256[][](prevTokenIds.length);\\n for (uint256 i = 0; i < prevTokenIds.length; i++) {\\n newTokenIds[i] = _revealAsset(prevTokenIds[i], metadataHashes[i], amounts[i], revealHashes[i]);\\n }\\n emit AssetRevealBatchMint(_msgSender(), prevTokenIds, amounts, newTokenIds, revealHashes);\\n }\\n\\n /// @notice Reveal assets to view their abilities and enhancements and mint them in a single transaction\\n /// @dev Should be used where it is not required to keep the metadata secret, e.g. mythical assets where users select their desired abilities and enhancements\\n /// @param signature Signature created on the TSB backend containing INSTANT_REVEAL_TYPEHASH and associated data, must be signed by authorized signer\\n /// @param prevTokenId The tokenId of the unrevealed asset\\n /// @param burnAmount The amount of assets to burn\\n /// @param amounts The amount of assets to reveal (sum must be equal to the burnAmount)\\n /// @param metadataHashes The array of hashes for asset metadata\\n /// @param revealHashes A revealHash array providing a random bytes32 generated by the TSB backend for each new tokenId\\n function burnAndReveal(\\n bytes memory signature,\\n uint256 prevTokenId,\\n uint256 burnAmount,\\n uint256[] calldata amounts,\\n string[] calldata metadataHashes,\\n bytes32[] calldata revealHashes\\n ) external {\\n require(amounts.length == metadataHashes.length, \\\"AssetReveal: Invalid amounts length\\\");\\n require(amounts.length == revealHashes.length, \\\"AssetReveal: Invalid revealHashes length\\\");\\n require(\\n authValidator.verify(\\n signature,\\n _hashInstantReveal(_msgSender(), prevTokenId, amounts, metadataHashes, revealHashes)\\n ),\\n \\\"AssetReveal: Invalid burnAndReveal signature\\\"\\n );\\n _burnAsset(prevTokenId, burnAmount);\\n uint256[] memory newTokenIds = _revealAsset(prevTokenId, metadataHashes, amounts, revealHashes);\\n emit AssetRevealMint(_msgSender(), prevTokenId, amounts, newTokenIds, revealHashes);\\n }\\n\\n /// @notice Generate new tokenIds for revealed assets and mint them\\n /// @param prevTokenId The tokenId of the unrevealed asset\\n /// @param metadataHashes The array of hashes for asset metadata\\n /// @param amounts The array of amounts to mint\\n function _revealAsset(\\n uint256 prevTokenId,\\n string[] calldata metadataHashes,\\n uint256[] calldata amounts,\\n bytes32[] calldata revealHashes\\n ) internal returns (uint256[] memory) {\\n uint256[] memory newTokenIds = getRevealedTokenIds(metadataHashes, prevTokenId);\\n for (uint256 i = 0; i < revealHashes.length; i++) {\\n require(revealHashesUsed[revealHashes[i]] == false, \\\"AssetReveal: RevealHash already used\\\");\\n revealHashesUsed[revealHashes[i]] = true;\\n }\\n if (newTokenIds.length == 1) {\\n assetContract.mint(_msgSender(), newTokenIds[0], amounts[0], metadataHashes[0]);\\n } else {\\n assetContract.mintBatch(_msgSender(), newTokenIds, amounts, metadataHashes);\\n }\\n return newTokenIds;\\n }\\n\\n /// @notice Burns an asset to be able to reveal it later\\n /// @param tokenId the tokenId of the asset to burn\\n /// @param amount the amount of the asset to burn\\n function _burnAsset(uint256 tokenId, uint256 amount) internal {\\n _verifyBurnData(tokenId, amount);\\n assetContract.burnFrom(_msgSender(), tokenId, amount);\\n }\\n\\n function _burnAssetBatch(uint256[] calldata tokenIds, uint256[] calldata amounts) internal {\\n require(tokenIds.length == amounts.length, \\\"AssetReveal: Invalid input\\\");\\n for (uint256 i = 0; i < tokenIds.length; i++) {\\n _verifyBurnData(tokenIds[i], amounts[i]);\\n }\\n assetContract.burnBatchFrom(_msgSender(), tokenIds, amounts);\\n }\\n\\n function _verifyBurnData(uint256 tokenId, uint256 amount) internal pure {\\n IAsset.AssetData memory data = tokenId.getData();\\n require(!data.revealed, \\\"AssetReveal: Asset is already revealed\\\");\\n require(amount > 0, \\\"AssetReveal: Burn amount should be greater than 0\\\");\\n }\\n\\n /// @notice Creates a hash of the reveal data\\n /// @param recipient The address of the recipient\\n /// @param prevTokenId The unrevealed token id\\n /// @param amounts The amount of tokens to mint\\n /// @param metadataHashes The array of hashes for new asset metadata\\n /// @param revealHashes The revealHashes used for revealing this particular prevTokenId (length corresponds to the new tokenIds)\\n /// @return digest The hash of the reveal data\\n function _hashInstantReveal(\\n address recipient,\\n uint256 prevTokenId,\\n uint256[] calldata amounts,\\n string[] calldata metadataHashes,\\n bytes32[] calldata revealHashes\\n ) internal view returns (bytes32 digest) {\\n digest = _hashTypedDataV4(\\n keccak256(\\n abi.encode(\\n INSTANT_REVEAL_TYPEHASH,\\n recipient,\\n prevTokenId,\\n keccak256(abi.encodePacked(amounts)),\\n _encodeHashes(metadataHashes),\\n keccak256(abi.encodePacked(revealHashes))\\n )\\n )\\n );\\n }\\n\\n /// @notice Creates a hash of the reveal data\\n /// @param recipient The intended recipient of the revealed token\\n /// @param prevTokenId The previous token id\\n /// @param amounts The amount of tokens to mint\\n /// @param metadataHashes The array of hashes for new asset metadata\\n /// @param revealHashes The revealHashes used for revealing this particular prevTokenId (length corresponds to the new tokenIds)\\n /// @return digest The hash of the reveal data\\n function _hashReveal(\\n address recipient,\\n uint256 prevTokenId,\\n uint256[] calldata amounts,\\n string[] calldata metadataHashes,\\n bytes32[] calldata revealHashes\\n ) internal view returns (bytes32 digest) {\\n digest = _hashTypedDataV4(\\n keccak256(\\n abi.encode(\\n REVEAL_TYPEHASH,\\n recipient,\\n prevTokenId,\\n keccak256(abi.encodePacked(amounts)),\\n _encodeHashes(metadataHashes),\\n keccak256(abi.encodePacked(revealHashes))\\n )\\n )\\n );\\n }\\n\\n /// @notice Creates a hash of the reveal data\\n /// @param recipient The intended recipient of the revealed tokens\\n /// @param prevTokenIds The previous token id\\n /// @param amounts The amounts of tokens to mint\\n /// @param metadataHashes The arrays of hashes for new asset metadata\\n /// @param revealHashes The revealHashes used for these prevTokenIds, (lengths corresponds to the new tokenIds)\\n /// @return digest The hash of the reveal data\\n function _hashBatchReveal(\\n address recipient,\\n uint256[] calldata prevTokenIds,\\n uint256[][] calldata amounts,\\n string[][] calldata metadataHashes,\\n bytes32[][] calldata revealHashes\\n ) internal view returns (bytes32 digest) {\\n digest = _hashTypedDataV4(\\n keccak256(\\n abi.encode(\\n BATCH_REVEAL_TYPEHASH,\\n recipient,\\n keccak256(abi.encodePacked(prevTokenIds)),\\n _encodeBatchAmounts(amounts),\\n _encodeBatchHashes(metadataHashes),\\n _encodeBatchRevealHashes(revealHashes)\\n )\\n )\\n );\\n }\\n\\n /// @notice Encodes the hashes of the metadata for signature verification\\n /// @param metadataHashes The hashes of the metadata\\n /// @return encodedHashes The encoded hashes of the metadata\\n function _encodeHashes(string[] memory metadataHashes) internal pure returns (bytes32) {\\n bytes32[] memory encodedHashes = new bytes32[](metadataHashes.length);\\n for (uint256 i = 0; i < metadataHashes.length; i++) {\\n encodedHashes[i] = keccak256((abi.encodePacked(metadataHashes[i])));\\n }\\n return keccak256(abi.encodePacked(encodedHashes));\\n }\\n\\n /// @notice Encodes the hashes of the metadata for signature verification\\n /// @param metadataHashes The hashes of the metadata\\n /// @return encodedHashes The encoded hashes of the metadata\\n function _encodeBatchHashes(string[][] memory metadataHashes) internal pure returns (bytes32) {\\n bytes32[] memory encodedHashes = new bytes32[](metadataHashes.length);\\n for (uint256 i = 0; i < metadataHashes.length; i++) {\\n encodedHashes[i] = _encodeHashes(metadataHashes[i]);\\n }\\n return keccak256(abi.encodePacked(encodedHashes));\\n }\\n\\n /// @notice Encodes the hashes of the metadata for signature verification\\n /// @param revealHashes The revealHashes\\n /// @return encodedRevealHashes The encoded hashes of the metadata\\n function _encodeBatchRevealHashes(bytes32[][] memory revealHashes) internal pure returns (bytes32) {\\n bytes32[] memory encodedHashes = new bytes32[](revealHashes.length);\\n for (uint256 i = 0; i < revealHashes.length; i++) {\\n encodedHashes[i] = keccak256(abi.encodePacked(revealHashes[i]));\\n }\\n return keccak256(abi.encodePacked(encodedHashes));\\n }\\n\\n /// @notice Encodes the amounts of the tokens for signature verification\\n /// @param amounts The amounts of the tokens\\n /// @return encodedAmounts The encoded amounts of the tokens\\n function _encodeBatchAmounts(uint256[][] memory amounts) internal pure returns (bytes32) {\\n bytes32[] memory encodedAmounts = new bytes32[](amounts.length);\\n for (uint256 i = 0; i < amounts.length; i++) {\\n encodedAmounts[i] = keccak256(abi.encodePacked(amounts[i]));\\n }\\n return keccak256(abi.encodePacked(encodedAmounts));\\n }\\n\\n /// @notice Checks if each metadatahash has been used before to either get the tokenId that was already created for it or generate a new one if it hasn't\\n /// @dev This function also validates that we're not trying to reveal a tokenId that has already been revealed\\n /// @param metadataHashes The hashes of the metadata\\n /// @param prevTokenId The previous token id from which the assets are revealed\\n /// @return tokenIdArray The array of tokenIds to mint\\n function getRevealedTokenIds(string[] calldata metadataHashes, uint256 prevTokenId)\\n internal\\n returns (uint256[] memory)\\n {\\n IAsset.AssetData memory data = prevTokenId.getData();\\n require(!data.revealed, \\\"AssetReveal: already revealed\\\");\\n uint256[] memory tokenIdArray = new uint256[](metadataHashes.length);\\n for (uint256 i = 0; i < metadataHashes.length; i++) {\\n uint256 tokenId = assetContract.getTokenIdByMetadataHash(metadataHashes[i]);\\n if (tokenId == 0) {\\n uint16 revealNonce = ++revealIds[data.creator][prevTokenId];\\n tokenId = TokenIdUtils.generateTokenId(\\n data.creator,\\n data.tier,\\n data.creatorNonce,\\n revealNonce,\\n data.bridged\\n );\\n }\\n tokenIdArray[i] = tokenId;\\n }\\n return tokenIdArray;\\n }\\n\\n /// @notice Get the status of a revealHash\\n /// @return Whether it has been used\\n function revealHashUsed(bytes32 revealHash) external view returns (bool) {\\n return revealHashesUsed[revealHash];\\n }\\n\\n /// @notice Get the asset contract address\\n /// @return The asset contract address\\n function getAssetContract() external view returns (address) {\\n return address(assetContract);\\n }\\n\\n /// @notice Get the auth validator address\\n /// @return The auth validator address\\n function getAuthValidator() external view returns (address) {\\n return address(authValidator);\\n }\\n\\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\\n /// @dev Change the address of the trusted forwarder for meta-TX\\n /// @param trustedForwarder The new trustedForwarder\\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n require(trustedForwarder != address(0), \\\"AssetReveal: trusted forwarder can't be zero address\\\");\\n _setTrustedForwarder(trustedForwarder);\\n }\\n\\n function _msgSender()\\n internal\\n view\\n virtual\\n override(ContextUpgradeable, ERC2771HandlerAbstract)\\n returns (address sender)\\n {\\n return ERC2771HandlerAbstract._msgSender();\\n }\\n\\n function _msgData()\\n internal\\n view\\n virtual\\n override(ContextUpgradeable, ERC2771HandlerAbstract)\\n returns (bytes calldata)\\n {\\n return ERC2771HandlerAbstract._msgData();\\n }\\n}\\n\",\"keccak256\":\"0xa69df5abf7c2e13cba5074cd5a159439c1ef85ea2540ece222a4f869dd5e0741\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/AuthSuperValidator.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport {AccessControl} from \\\"@openzeppelin/contracts/access/AccessControl.sol\\\";\\nimport {ECDSA} from \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\n/// @title AuthSuperValidator\\n/// @author The Sandbox\\n/// @notice This contract is used to validate the signatures of the backend, each contract can have a separate signer assigned\\ncontract AuthSuperValidator is AccessControl {\\n mapping(address => address) private _signers;\\n\\n /// @dev Constructor\\n /// @param admin Address of the admin that will be able to grant roles\\n constructor(address admin) {\\n _grantRole(DEFAULT_ADMIN_ROLE, admin);\\n }\\n\\n /// @notice Sets the signer for a contract\\n /// @dev Only the admin can call this function\\n /// @param contractAddress Address of the contract to set the signer for\\n /// @param signer Address of the signer\\n function setSigner(address contractAddress, address signer) public onlyRole(DEFAULT_ADMIN_ROLE) {\\n _signers[contractAddress] = signer;\\n }\\n\\n /// @notice Gets the signer for a contract\\n /// @param contractAddress Address of the contract to get the signer for\\n /// @return address of the signer\\n function getSigner(address contractAddress) public view returns (address) {\\n return _signers[contractAddress];\\n }\\n\\n /// @notice Takes the signature and the digest and returns if the signer has a backend signer role assigned\\n /// @dev Multipurpose function that can be used to verify signatures with different digests\\n /// @param signature Signature hash\\n /// @param digest Digest hash\\n /// @return bool\\n function verify(bytes memory signature, bytes32 digest) public view returns (bool) {\\n address signer = _signers[_msgSender()];\\n require(signer != address(0), \\\"AuthSuperValidator: signer not set\\\");\\n address recoveredSigner = ECDSA.recover(digest, signature);\\n return recoveredSigner == signer;\\n }\\n}\\n\",\"keccak256\":\"0x990d27552ffce0f248fadbf539bbc904134ca14d392931bdfab0f02740103be3\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/interfaces/IAsset.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface IAsset {\\n // AssetData reflects the asset tokenId structure\\n // Refer to TokenIdUtils.sol\\n struct AssetData {\\n uint256 tokenId;\\n address creator;\\n uint256 amount;\\n uint8 tier;\\n uint16 creatorNonce;\\n bool revealed;\\n string metadataHash;\\n bool bridged;\\n }\\n\\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\\n\\n // Functions\\n function mint(\\n address to,\\n uint256 id,\\n uint256 amount,\\n string memory metadataHash\\n ) external;\\n\\n function mintBatch(\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n string[] memory metadataHashes\\n ) external;\\n\\n function burnFrom(\\n address account,\\n uint256 id,\\n uint256 amount\\n ) external;\\n\\n function burnBatchFrom(\\n address account,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external;\\n\\n function getTokenIdByMetadataHash(string memory metadataHash) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x2abd2e550ced35090c988e432215f990bf8f192cc346ffac6778fde0025a8206\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/interfaces/IAssetReveal.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface IAssetReveal {\\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\\n event AssetRevealBurn(address revealer, uint256 unrevealedTokenId, uint256 amount);\\n event AssetRevealBatchBurn(address revealer, uint256[] unrevealedTokenIds, uint256[] amounts);\\n event AssetRevealMint(\\n address recipient,\\n uint256 unrevealedTokenId,\\n uint256[] amounts,\\n uint256[] newTokenIds,\\n bytes32[] revealHashes\\n );\\n event AssetRevealBatchMint(\\n address recipient,\\n uint256[] unrevealedTokenIds,\\n uint256[][] amounts,\\n uint256[][] newTokenIds,\\n bytes32[][] revealHashes\\n );\\n}\\n\",\"keccak256\":\"0x5c02c65ea3861d0fff04eec7c28017a17434d924c9474cf95806a16ff33b4731\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/libraries/TokenIdUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {IAsset} from \\\"../interfaces/IAsset.sol\\\";\\n\\nlibrary TokenIdUtils {\\n // Layer masks\\n uint256 public constant TIER_MASK = 0xFF;\\n uint256 public constant NONCE_MASK = 0xFFFF;\\n uint256 public constant REVEAL_NONCE_MASK = 0xFFFF;\\n uint256 public constant BRIDGED_MASK = 0x1;\\n\\n // Bit shifts\\n uint256 public constant CREATOR_SHIFT = 0;\\n uint256 public constant TIER_SHIFT = 160;\\n uint256 public constant NONCE_SHIFT = 168;\\n uint256 public constant REVEAL_NONCE_SHIFT = 184;\\n uint256 public constant BRIDGED_SHIFT = 200;\\n\\n /// @notice Generates a token id for a given asset\\n /// @dev The token id is generated by concatenating the following fields:\\n /// @dev creator address, chain index, tier, asset nonce, reveal nonce and bridged boolean\\n /// @dev The first 160 bits are the creator address\\n /// @dev The next 8 bits are the chain index\\n /// @dev The next 8 bits are the tier\\n /// @dev The next 16 bits are the asset nonce\\n /// @dev The next 16 bits are assets reveal nonce.\\n /// @param creator The address of the creator of the asset\\n /// @param tier The tier of the asset determined by the catalyst used to create it\\n /// @param creatorNonce The nonce of the asset creator\\n /// @param revealNonce The reveal nonce of the asset\\n /// @param bridged Whether the asset is bridged or not\\n /// @return tokenId The generated token id\\n function generateTokenId(\\n address creator,\\n uint8 tier,\\n uint16 creatorNonce,\\n uint16 revealNonce,\\n bool bridged\\n ) internal pure returns (uint256 tokenId) {\\n uint160 creatorAddress = uint160(creator);\\n\\n tokenId = tokenId =\\n uint256(creatorAddress) |\\n (uint256(tier) << TIER_SHIFT) |\\n (uint256(creatorNonce) << NONCE_SHIFT) |\\n (uint256(revealNonce) << REVEAL_NONCE_SHIFT) |\\n (uint256(bridged ? 1 : 0) << BRIDGED_SHIFT);\\n\\n return tokenId;\\n }\\n\\n /// @notice Extracts the creator address from a given token id\\n /// @param tokenId The token id to extract the creator address from\\n /// @return creator The asset creator address\\n function getCreatorAddress(uint256 tokenId) internal pure returns (address creator) {\\n creator = address(uint160(tokenId));\\n return creator;\\n }\\n\\n /// @notice Extracts the tier from a given token id\\n /// @param tokenId The token id to extract the tier from\\n /// @return tier The asset tier, determined by the catalyst used to create it\\n function getTier(uint256 tokenId) internal pure returns (uint8 tier) {\\n tier = uint8((tokenId >> TIER_SHIFT) & TIER_MASK);\\n return tier;\\n }\\n\\n /// @notice Extracts the revealed flag from a given token id\\n /// @param tokenId The token id to extract the revealed flag from\\n /// @return isRevealed Whether the asset is revealed or not\\n function isRevealed(uint256 tokenId) internal pure returns (bool) {\\n uint16 revealNonce = getRevealNonce(tokenId);\\n return revealNonce != 0;\\n }\\n\\n /// @notice Extracts the asset nonce from a given token id\\n /// @param tokenId The token id to extract the asset nonce from\\n /// @return creatorNonce The asset creator nonce\\n function getCreatorNonce(uint256 tokenId) internal pure returns (uint16) {\\n uint16 creatorNonce = uint16((tokenId >> NONCE_SHIFT) & NONCE_MASK);\\n return creatorNonce;\\n }\\n\\n /// @notice Extracts the abilities and enhancements hash from a given token id\\n /// @param tokenId The token id to extract reveal nonce from\\n /// @return revealNonce The reveal nonce of the asset\\n function getRevealNonce(uint256 tokenId) internal pure returns (uint16) {\\n uint16 revealNonce = uint16((tokenId >> REVEAL_NONCE_SHIFT) & REVEAL_NONCE_MASK);\\n return revealNonce;\\n }\\n\\n /// @notice Extracts the bridged flag from a given token id\\n /// @param tokenId The token id to extract the bridged flag from\\n /// @return bridged Whether the asset is bridged or not\\n function isBridged(uint256 tokenId) internal pure returns (bool) {\\n bool bridged = ((tokenId >> BRIDGED_SHIFT) & BRIDGED_MASK) == 1;\\n return bridged;\\n }\\n\\n /// @notice Extracts the asset data from a given token id\\n /// @dev Created to limit the number of functions that need to be called when revealing an asset\\n /// @param tokenId The token id to extract the asset data from\\n function getData(uint256 tokenId) internal pure returns (IAsset.AssetData memory data) {\\n data.creator = getCreatorAddress(tokenId);\\n data.tier = getTier(tokenId);\\n data.revealed = isRevealed(tokenId);\\n data.creatorNonce = getCreatorNonce(tokenId);\\n data.bridged = isBridged(tokenId);\\n }\\n}\\n\",\"keccak256\":\"0x82f6bb065e85497d5486bcecb162c30df83941262ff5ac3fd8e283e946250839\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerAbstract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\n/// @dev minimal ERC2771 handler to keep bytecode-size down\\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\\nabstract contract ERC2771HandlerAbstract {\\n /// @notice return true if the forwarder is the trusted forwarder\\n /// @param forwarder trusted forwarder address to check\\n /// @return true if the address is the same as the trusted forwarder\\n function isTrustedForwarder(address forwarder) external view returns (bool) {\\n return _isTrustedForwarder(forwarder);\\n }\\n\\n /// @notice if the call is from the trusted forwarder the sender is extracted from calldata, msg.sender otherwise\\n /// @return sender the calculated address of the sender\\n function _msgSender() internal view virtual returns (address sender) {\\n if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\\n // The assembly code is more direct than the Solidity version using `abi.decode`.\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\\n }\\n } else {\\n sender = msg.sender;\\n }\\n }\\n\\n /// @notice if the call is from the trusted forwarder the sender is removed from calldata\\n /// @return the calldata without the sender\\n function _msgData() internal view virtual returns (bytes calldata) {\\n if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\\n return msg.data[:msg.data.length - 20];\\n } else {\\n return msg.data;\\n }\\n }\\n\\n /// @notice return true if the forwarder is the trusted forwarder\\n /// @param forwarder trusted forwarder address to check\\n /// @return true if the address is the same as the trusted forwarder\\n /// @dev this function must be IMPLEMENTED\\n function _isTrustedForwarder(address forwarder) internal view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xc4f349865ea7146f51b69f1edacdef60e0a2a7cf4dab538a5ae53ee9a0036231\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ERC2771HandlerAbstract} from \\\"./ERC2771HandlerAbstract.sol\\\";\\n\\n/// @dev minimal ERC2771 handler to keep bytecode-size down\\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\\ncontract ERC2771HandlerUpgradeable is Initializable, ERC2771HandlerAbstract {\\n address private _trustedForwarder;\\n\\n /// @notice Emitted when a `newTrustedForwarder` is set, replacing the `oldTrustedForwarder`\\n /// @param oldTrustedForwarder old trusted forwarder\\n /// @param newTrustedForwarder new trusted forwarder\\n /// @param operator the sender of the transaction\\n event TrustedForwarderSet(\\n address indexed oldTrustedForwarder,\\n address indexed newTrustedForwarder,\\n address indexed operator\\n );\\n\\n /// @notice initialize the trusted forwarder address\\n /// @param forwarder trusted forwarder address or zero to disable it\\n function __ERC2771Handler_init(address forwarder) internal onlyInitializing {\\n __ERC2771Handler_init_unchained(forwarder);\\n }\\n\\n /// @notice initialize the trusted forwarder address\\n /// @param forwarder trusted forwarder address or zero to disable it\\n function __ERC2771Handler_init_unchained(address forwarder) internal onlyInitializing {\\n _setTrustedForwarder(forwarder);\\n }\\n\\n /// @notice return the address of the trusted forwarder\\n /// @return return the address of the trusted forwarder\\n function getTrustedForwarder() external view returns (address) {\\n return _trustedForwarder;\\n }\\n\\n /// @notice set the address of the trusted forwarder\\n /// @param newForwarder the address of the new forwarder.\\n function _setTrustedForwarder(address newForwarder) internal virtual {\\n require(newForwarder != _trustedForwarder, \\\"ERC2771HandlerUpgradeable: forwarder already set\\\");\\n emit TrustedForwarderSet(_trustedForwarder, newForwarder, _msgSender());\\n _trustedForwarder = newForwarder;\\n }\\n\\n /// @notice return true if the forwarder is the trusted forwarder\\n /// @param forwarder trusted forwarder address to check\\n /// @return true if the address is the same as the trusted forwarder\\n function _isTrustedForwarder(address forwarder) internal view virtual override returns (bool) {\\n return forwarder == _trustedForwarder;\\n }\\n\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x63e53ca5ec229e51d866b0b8e3c8f36056598d9fbf960bb57b4b9731917af16f\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e3565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61394b80620000f36000396000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c806384b0196e116100e3578063d547741f1161008c578063e56f2fe411610066578063e56f2fe4146103ad578063ecc0382a146103c0578063f30553d5146103d357600080fd5b8063d547741f14610376578063d5f2077c14610389578063da7422281461039a57600080fd5b8063b21c2cdc116100bd578063b21c2cdc1461031a578063bd2cc82a14610341578063ce1b815f1461036557600080fd5b806384b0196e146102be57806391d14854146102d9578063a217fddf1461031257600080fd5b806336568abe11610145578063572b6c051161011f578063572b6c051461027357806359c191e4146102865780635aaa24bf146102ab57600080fd5b806336568abe146102265780633a2cf31a14610239578063439ff3ce1461026057600080fd5b806310da53931161017657806310da5393146101cf578063248a9ca3146101e25780632f2ff15d1461021357600080fd5b806301ffc9a7146101925780630c85fbb3146101ba575b600080fd5b6101a56101a03660046127a3565b6103fa565b60405190151581526020015b60405180910390f35b6101cd6101c8366004612831565b610493565b005b6101cd6101dd366004612954565b6104eb565b6102056101f0366004612a1c565b60009081526065602052604090206001015490565b6040519081526020016101b1565b6101cd610221366004612a51565b61070c565b6101cd610234366004612a51565b610736565b6102057f1d2951170e2f5d8eb8a7a48a737f5f1680469c14594abd27536867bfb559f88f81565b6101cd61026e366004612abf565b6107d2565b6101a5610281366004612bb0565b610b71565b60fd546001600160a01b03165b6040516001600160a01b0390911681526020016101b1565b6101cd6102b9366004612bcb565b610b8b565b6102c6610bea565b6040516101b19796959493929190612c78565b6101a56102e7366004612a51565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b610205600081565b6102057f45cf7a9b20b47d492887b813085b48aa1988f1f482fe79948578452b4b4cbedd81565b6101a561034f366004612a1c565b6000908152610100602052604090205460ff1690565b6097546001600160a01b0316610293565b6101cd610384366004612a51565b610cac565b60fe546001600160a01b0316610293565b6101cd6103a8366004612bb0565b610cd1565b6101cd6103bb366004612cf4565b610d61565b6101cd6103ce366004612d99565b610ee5565b6102057f30ed1d13f34eab3b4d1a3291d48db1d77bbc98ec9480b9131e4360220fd46fb081565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061048d57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b61049f8484848461110c565b7f25601c42b4517e81abacb7c77cd6d6697ea55465121e953721d60becc43b88e26104c8611228565b858585856040516104dd959493929190612eb8565b60405180910390a150505050565b84831461054b5760405162461bcd60e51b815260206004820152602360248201527f417373657452657665616c3a20496e76616c696420616d6f756e7473206c656e6044820152620cee8d60eb1b60648201526084015b60405180910390fd5b8481146105ab5760405162461bcd60e51b815260206004820152602860248201527f417373657452657665616c3a20496e76616c69642072657665616c48617368656044820152670e640d8cadccee8d60c31b6064820152608401610542565b60fe546001600160a01b0316636b406341896105d46105c8611228565b8b8b8b8b8b8b8b611237565b6040518363ffffffff1660e01b81526004016105f1929190612eee565b602060405180830381865afa15801561060e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106329190612f10565b6106a45760405162461bcd60e51b815260206004820152602960248201527f417373657452657665616c3a20496e76616c69642072657665616c4d696e742060448201527f7369676e617475726500000000000000000000000000000000000000000000006064820152608401610542565b60006106b58886868a8a8888611326565b90507fd19ae26d53e6e3446633338937b673d431c042f61b32854f821bc2b2b025b2c46106e0611228565b8989898588886040516106f99796959493929190612f32565b60405180910390a1505050505050505050565b60008281526065602052604090206001015461072781611592565b61073183836115a6565b505050565b61073e611228565b6001600160a01b0316816001600160a01b0316146107c45760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610542565b6107ce8282611649565b5050565b86851461082d5760405162461bcd60e51b815260206004820152602360248201527f417373657452657665616c3a20496e76616c696420616d6f756e7473206c656e6044820152620cee8d60eb1b6064820152608401610542565b8483146108a25760405162461bcd60e51b815260206004820152602a60248201527f417373657452657665616c3a20496e76616c6964206d6574616461746148617360448201527f686573206c656e677468000000000000000000000000000000000000000000006064820152608401610542565b8681146109025760405162461bcd60e51b815260206004820152602860248201527f417373657452657665616c3a20496e76616c69642072657665616c48617368656044820152670e640d8cadccee8d60c31b6064820152608401610542565b60fe546001600160a01b0316636b4063418b8b61092d610920611228565b8d8d8d8d8d8d8d8d6116ea565b6040518463ffffffff1660e01b815260040161094b93929190612fad565b602060405180830381865afa158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098c9190612f10565b6109fe5760405162461bcd60e51b815260206004820152602e60248201527f417373657452657665616c3a20496e76616c69642072657665616c426174636860448201527f4d696e74207369676e61747572650000000000000000000000000000000000006064820152608401610542565b60008767ffffffffffffffff811115610a1957610a1961289d565b604051908082528060200260200182016040528015610a4c57816020015b6060815260200190600190039081610a375790505b50905060005b88811015610b1757610ae78a8a83818110610a6f57610a6f612fd1565b90506020020135878784818110610a8857610a88612fd1565b9050602002810190610a9a9190612fe7565b8b8b86818110610aac57610aac612fd1565b9050602002810190610abe9190612fe7565b898988818110610ad057610ad0612fd1565b9050602002810190610ae29190612fe7565b611326565b828281518110610af957610af9612fd1565b60200260200101819052508080610b0f90613047565b915050610a52565b507f9327e7d8f5446a92ddcaf7ccd64ad67693773944fe2db95200e2d4db20054359610b41611228565b8a8a8a8a868989604051610b5c98979695949392919061314f565b60405180910390a15050505050505050505050565b600061048d826097546001600160a01b0391821691161490565b610b9582826117bd565b7f529140d9ae57da9c5515c8fe288c3865d4cbb81cb143062f99a466cb4bb6fa95610bbe611228565b604080516001600160a01b03909216825260208201859052810183905260600160405180910390a15050565b60006060806000806000606060c9546000801b148015610c0a575060ca54155b610c565760405162461bcd60e51b815260206004820152601560248201527f4549503731323a20556e696e697469616c697a656400000000000000000000006044820152606401610542565b610c5e611863565b610c666118f5565b604080516000808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009b939a50919850469750309650945092509050565b600082815260656020526040902060010154610cc781611592565b6107318383611649565b6000610cdc81611592565b6001600160a01b038216610d585760405162461bcd60e51b815260206004820152603460248201527f417373657452657665616c3a207472757374656420666f72776172646572206360448201527f616e2774206265207a65726f20616464726573730000000000000000000000006064820152608401610542565b6107ce82611904565b600054610100900460ff1615808015610d815750600054600160ff909116105b80610d9b5750303b158015610d9b575060005460ff166001145b610e0d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610542565b6000805460ff191660011790558015610e30576000805461ff0019166101001790555b60fd80546001600160a01b038088167fffffffffffffffffffffffff00000000000000000000000000000000000000009283161790925560fe805492871692909116919091179055610e8183611a08565b610e8b8787611a7c565b610e966000836115a6565b8015610edc576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b848314610f405760405162461bcd60e51b815260206004820152602360248201527f417373657452657665616c3a20496e76616c696420616d6f756e7473206c656e6044820152620cee8d60eb1b6064820152608401610542565b848114610fa05760405162461bcd60e51b815260206004820152602860248201527f417373657452657665616c3a20496e76616c69642072657665616c48617368656044820152670e640d8cadccee8d60c31b6064820152608401610542565b60fe546001600160a01b0316636b4063418a610fc9610fbd611228565b8c8b8b8b8b8b8b611af1565b6040518363ffffffff1660e01b8152600401610fe6929190612eee565b602060405180830381865afa158015611003573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110279190612f10565b6110995760405162461bcd60e51b815260206004820152602c60248201527f417373657452657665616c3a20496e76616c6964206275726e416e645265766560448201527f616c207369676e617475726500000000000000000000000000000000000000006064820152608401610542565b6110a388886117bd565b60006110b48986868a8a8888611326565b90507fd19ae26d53e6e3446633338937b673d431c042f61b32854f821bc2b2b025b2c46110df611228565b8a89898588886040516110f89796959493929190612f32565b60405180910390a150505050505050505050565b82811461115b5760405162461bcd60e51b815260206004820152601a60248201527f417373657452657665616c3a20496e76616c696420696e7075740000000000006044820152606401610542565b60005b838110156111b2576111a085858381811061117b5761117b612fd1565b9050602002013584848481811061119457611194612fd1565b90506020020135611b2c565b806111aa81613047565b91505061115e565b5060fd546001600160a01b03166320820ec36111cc611228565b868686866040518663ffffffff1660e01b81526004016111f0959493929190612eb8565b600060405180830381600087803b15801561120a57600080fd5b505af115801561121e573d6000803e3d6000fd5b5050505050505050565b6000611232611c27565b905090565b60006113197f1d2951170e2f5d8eb8a7a48a737f5f1680469c14594abd27536867bfb559f88f8a8a8a8a604051602001611272929190613245565b60408051601f19818403018152919052805160209091012061129c6112978a8c6132f7565b611c7a565b88886040516020016112af929190613245565b60408051601f198184030181528282528051602091820120908301979097526001600160a01b03909516948101949094526060840192909252608083015260a082015260c081019190915260e0015b60405160208183030381529060405280519060200120611d6e565b9998505050505050505050565b6060600061133588888b611db6565b905060005b8381101561144057610100600086868481811061135957611359612fd1565b602090810292909201358352508101919091526040016000205460ff16156113e85760405162461bcd60e51b8152602060048201526024808201527f417373657452657665616c3a2052657665616c4861736820616c72656164792060448201527f75736564000000000000000000000000000000000000000000000000000000006064820152608401610542565b6001610100600087878581811061140157611401612fd1565b90506020020135815260200190815260200160002060006101000a81548160ff021916908315150217905550808061143890613047565b91505061133a565b5080516001036115145760fd546001600160a01b031663bb7fde71611463611228565b8360008151811061147657611476612fd1565b60200260200101518989600081811061149157611491612fd1565b905060200201358c8c60008181106114ab576114ab612fd1565b90506020028101906114bd9190613304565b6040518663ffffffff1660e01b81526004016114dd95949392919061334b565b600060405180830381600087803b1580156114f757600080fd5b505af115801561150b573d6000803e3d6000fd5b50505050611586565b60fd546001600160a01b031663a55784ef61152d611228565b8389898d8d6040518763ffffffff1660e01b815260040161155396959493929190613385565b600060405180830381600087803b15801561156d57600080fd5b505af1158015611581573d6000803e3d6000fd5b505050505b98975050505050505050565b6115a38161159e611228565b611fb7565b50565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166107ce5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611605611228565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16156107ce5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191690556116a6611228565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b60006117af7f30ed1d13f34eab3b4d1a3291d48db1d77bbc98ec9480b9131e4360220fd46fb08b8b8b604051602001611724929190613245565b60408051601f19818403018152919052805160209091012061174e6117498b8d613459565b61202c565b61176061175b8a8c61351f565b6120f0565b61177261176d898b6135a7565b612196565b6040805160208101979097526001600160a01b03909516948601949094526060850192909252608084015260a083015260c082015260e0016112fe565b9a9950505050505050505050565b6117c78282611b2c565b60fd546001600160a01b031663124d91e56117e0611228565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b0390911660048201526024810185905260448101849052606401600060405180830381600087803b15801561184757600080fd5b505af115801561185b573d6000803e3d6000fd5b505050505050565b606060cb805461187290613660565b80601f016020809104026020016040519081016040528092919081815260200182805461189e90613660565b80156118eb5780601f106118c0576101008083540402835291602001916118eb565b820191906000526020600020905b8154815290600101906020018083116118ce57829003601f168201915b5050505050905090565b606060cc805461187290613660565b6097546001600160a01b03908116908216036119885760405162461bcd60e51b815260206004820152603060248201527f4552433237373148616e646c65725570677261646561626c653a20666f72776160448201527f7264657220616c726561647920736574000000000000000000000000000000006064820152608401610542565b611990611228565b6097546040516001600160a01b03928316928481169216907f8ca022029d8ff7ad974913f8970aeed6c5e0e7eaf494a0c5b262249f6b5759e590600090a4609780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b600054610100900460ff16611a735760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610542565b6115a38161225a565b600054610100900460ff16611ae75760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610542565b6107ce82826122ce565b60006113197f45cf7a9b20b47d492887b813085b48aa1988f1f482fe79948578452b4b4cbedd8a8a8a8a604051602001611272929190613245565b6000611b3783612361565b90508060a0015115611bb15760405162461bcd60e51b815260206004820152602660248201527f417373657452657665616c3a20417373657420697320616c726561647920726560448201527f7665616c656400000000000000000000000000000000000000000000000000006064820152608401610542565b600082116107315760405162461bcd60e51b815260206004820152603160248201527f417373657452657665616c3a204275726e20616d6f756e742073686f756c642060448201527f62652067726561746572207468616e20300000000000000000000000000000006064820152608401610542565b6097546000906001600160a01b031633148015611c45575060143610155b15611c7557507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b503390565b600080825167ffffffffffffffff811115611c9757611c9761289d565b604051908082528060200260200182016040528015611cc0578160200160208202803683370190505b50905060005b8351811015611d3e57838181518110611ce157611ce1612fd1565b6020026020010151604051602001611cf9919061369a565b60405160208183030381529060405280519060200120828281518110611d2157611d21612fd1565b602090810291909101015280611d3681613047565b915050611cc6565b5080604051602001611d5091906136b6565b60405160208183030381529060405280519060200120915050919050565b600061048d611d7b6123ee565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b60606000611dc383612361565b90508060a0015115611e175760405162461bcd60e51b815260206004820152601d60248201527f417373657452657665616c3a20616c72656164792072657665616c65640000006044820152606401610542565b60008467ffffffffffffffff811115611e3257611e3261289d565b604051908082528060200260200182016040528015611e5b578160200160208202803683370190505b50905060005b85811015611fad5760fd546000906001600160a01b031663fdda1d0e898985818110611e8f57611e8f612fd1565b9050602002810190611ea19190613304565b6040518363ffffffff1660e01b8152600401611ebe9291906136ec565b602060405180830381865afa158015611edb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eff9190613700565b905080600003611f7c576020808501516001600160a01b0316600090815260ff8252604080822089835290925290812080548290611f409061ffff16613719565b91906101000a81548161ffff021916908361ffff16021790559050611f78856020015186606001518760800151848960e001516123f8565b9150505b80838381518110611f8f57611f8f612fd1565b60209081029190910101525080611fa581613047565b915050611e61565b5095945050505050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166107ce57611fea81612445565b611ff5836020612457565b60405160200161200692919061373a565b60408051601f198184030181529082905262461bcd60e51b8252610542916004016137bb565b600080825167ffffffffffffffff8111156120495761204961289d565b604051908082528060200260200182016040528015612072578160200160208202803683370190505b50905060005b8351811015611d3e5783818151811061209357612093612fd1565b60200260200101516040516020016120ab91906136b6565b604051602081830303815290604052805190602001208282815181106120d3576120d3612fd1565b6020908102919091010152806120e881613047565b915050612078565b600080825167ffffffffffffffff81111561210d5761210d61289d565b604051908082528060200260200182016040528015612136578160200160208202803683370190505b50905060005b8351811015611d3e5761216784828151811061215a5761215a612fd1565b6020026020010151611c7a565b82828151811061217957612179612fd1565b60209081029190910101528061218e81613047565b91505061213c565b600080825167ffffffffffffffff8111156121b3576121b361289d565b6040519080825280602002602001820160405280156121dc578160200160208202803683370190505b50905060005b8351811015611d3e578381815181106121fd576121fd612fd1565b602002602001015160405160200161221591906136b6565b6040516020818303038152906040528051906020012082828151811061223d5761223d612fd1565b60209081029190910101528061225281613047565b9150506121e2565b600054610100900460ff166122c55760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610542565b6115a381611904565b600054610100900460ff166123395760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610542565b60cb6123458382613814565b5060cc6123528282613814565b5050600060c981905560ca5550565b604080516101008101825260008082529181018290526080810182905260a0808201839052606060c0830181905260e08301939093526001600160a01b038416602083015283901c60ff16918101919091526123bc82612687565b151560a08201526123d18260a81c61ffff1690565b61ffff16608082015260c89190911c60019081161460e082015290565b60006112326126a5565b60008560c88361240957600061240c565b60015b60ff16901b60b88561ffff16901b60a88761ffff16901b60a08960ff16901b846001600160a01b03161717171791505095945050505050565b606061048d6001600160a01b03831660145b606060006124668360026138d4565b6124719060026138eb565b67ffffffffffffffff8111156124895761248961289d565b6040519080825280601f01601f1916602001820160405280156124b3576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106124ea576124ea612fd1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061254d5761254d612fd1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006125898460026138d4565b6125949060016138eb565b90505b6001811115612631577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106125d5576125d5612fd1565b1a60f81b8282815181106125eb576125eb612fd1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c9361262a816138fe565b9050612597565b5083156126805760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610542565b9392505050565b6000806126988360b81c61ffff1690565b61ffff1615159392505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6126d0612719565b6126d8612772565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600080612724611863565b80519091501561273b578051602090910120919050565b60c954801561274a5792915050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709250505090565b60008061277d6118f5565b805190915015612794578051602090910120919050565b60ca54801561274a5792915050565b6000602082840312156127b557600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461268057600080fd5b60008083601f8401126127f757600080fd5b50813567ffffffffffffffff81111561280f57600080fd5b6020830191508360208260051b850101111561282a57600080fd5b9250929050565b6000806000806040858703121561284757600080fd5b843567ffffffffffffffff8082111561285f57600080fd5b61286b888389016127e5565b9096509450602087013591508082111561288457600080fd5b50612891878288016127e5565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156128dc576128dc61289d565b604052919050565b600082601f8301126128f557600080fd5b813567ffffffffffffffff81111561290f5761290f61289d565b6129226020601f19601f840116016128b3565b81815284602083860101111561293757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060008060008060a0898b03121561297057600080fd5b883567ffffffffffffffff8082111561298857600080fd5b6129948c838d016128e4565b995060208b0135985060408b01359150808211156129b157600080fd5b6129bd8c838d016127e5565b909850965060608b01359150808211156129d657600080fd5b6129e28c838d016127e5565b909650945060808b01359150808211156129fb57600080fd5b50612a088b828c016127e5565b999c989b5096995094979396929594505050565b600060208284031215612a2e57600080fd5b5035919050565b80356001600160a01b0381168114612a4c57600080fd5b919050565b60008060408385031215612a6457600080fd5b82359150612a7460208401612a35565b90509250929050565b60008083601f840112612a8f57600080fd5b50813567ffffffffffffffff811115612aa757600080fd5b60208301915083602082850101111561282a57600080fd5b60008060008060008060008060008060a08b8d031215612ade57600080fd5b8a3567ffffffffffffffff80821115612af657600080fd5b612b028e838f01612a7d565b909c509a5060208d0135915080821115612b1b57600080fd5b612b278e838f016127e5565b909a50985060408d0135915080821115612b4057600080fd5b612b4c8e838f016127e5565b909850965060608d0135915080821115612b6557600080fd5b612b718e838f016127e5565b909650945060808d0135915080821115612b8a57600080fd5b50612b978d828e016127e5565b915080935050809150509295989b9194979a5092959850565b600060208284031215612bc257600080fd5b61268082612a35565b60008060408385031215612bde57600080fd5b50508035926020909101359150565b60005b83811015612c08578181015183820152602001612bf0565b50506000910152565b60008151808452612c29816020860160208601612bed565b601f01601f19169290920160200192915050565b600081518084526020808501945080840160005b83811015612c6d57815187529582019590820190600101612c51565b509495945050505050565b7fff000000000000000000000000000000000000000000000000000000000000008816815260e060208201526000612cb360e0830189612c11565b8281036040840152612cc58189612c11565b90508660608401526001600160a01b03861660808401528460a084015282810360c08401526117af8185612c3d565b60008060008060008060c08789031215612d0d57600080fd5b863567ffffffffffffffff80821115612d2557600080fd5b612d318a838b016128e4565b97506020890135915080821115612d4757600080fd5b50612d5489828a016128e4565b955050612d6360408801612a35565b9350612d7160608801612a35565b9250612d7f60808801612a35565b9150612d8d60a08801612a35565b90509295509295509295565b600080600080600080600080600060c08a8c031215612db757600080fd5b893567ffffffffffffffff80821115612dcf57600080fd5b612ddb8d838e016128e4565b9a5060208c0135995060408c0135985060608c0135915080821115612dff57600080fd5b612e0b8d838e016127e5565b909850965060808c0135915080821115612e2457600080fd5b612e308d838e016127e5565b909650945060a08c0135915080821115612e4957600080fd5b50612e568c828d016127e5565b915080935050809150509295985092959850929598565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115612e9f57600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b0386168152606060208201526000612edb606083018688612e6d565b8281036040840152611586818587612e6d565b604081526000612f016040830185612c11565b90508260208301529392505050565b600060208284031215612f2257600080fd5b8151801515811461268057600080fd5b6001600160a01b038816815286602082015260a060408201526000612f5b60a083018789612e6d565b8281036060840152612f6d8187612c3d565b905082810360808401526117af818587612e6d565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b604081526000612fc1604083018587612f82565b9050826020830152949350505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112612ffe57600080fd5b83018035915067ffffffffffffffff82111561301957600080fd5b6020019150600581901b360382131561282a57600080fd5b634e487b7160e01b600052601160045260246000fd5b6000600019820361305a5761305a613031565b5060010190565b6000808335601e1984360301811261307857600080fd5b830160208101925035905067ffffffffffffffff81111561309857600080fd5b8060051b360382131561282a57600080fd5b600081518084526020808501808196508360051b8101915082860160005b858110156130f25782840389526130e0848351612c3d565b988501989350908401906001016130c8565b5091979650505050505050565b81835260006020808501808196508560051b810191508460005b878110156130f25782840389526131308288613061565b61313b868284612e6d565b9a87019a9550505090840190600101613119565b6001600160a01b03891681526000602060a08184015261317360a084018a8c612e6d565b8381036040850152878152818101600589901b820183018a60005b8b8110156131c857601f198584030184526131a9828e613061565b6131b4858284612e6d565b95880195945050509085019060010161318e565b505085810360608701526131dc818a6130aa565b935050505082810360808401526131f48185876130ff565b9b9a5050505050505050505050565b60007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561323257600080fd5b8260051b80838637939093019392505050565b6000613252828486613203565b949350505050565b600067ffffffffffffffff8211156132745761327461289d565b5060051b60200190565b600061329161328c8461325a565b6128b3565b8381529050602080820190600585901b8401868111156132b057600080fd5b845b818110156132ec57803567ffffffffffffffff8111156132d25760008081fd5b6132de898289016128e4565b8552509282019282016132b2565b505050509392505050565b600061268036848461327e565b6000808335601e1984360301811261331b57600080fd5b83018035915067ffffffffffffffff82111561333657600080fd5b60200191503681900382131561282a57600080fd5b6001600160a01b038616815284602082015283604082015260806060820152600061337a608083018486612f82565b979650505050505050565b6001600160a01b0387168152600060206080818401526133a86080840189612c3d565b83810360408501526133bb81888a612e6d565b84810360608601528581529050818101600586901b820183018760005b8881101561344757601f198584030184528135601e198b36030181126133fd57600080fd5b8a01868101903567ffffffffffffffff81111561341957600080fd5b80360382131561342857600080fd5b613433858284612f82565b9588019594505050908501906001016133d8565b50909c9b505050505050505050505050565b600061346761328c8461325a565b83815260208082019190600586811b86013681111561348557600080fd5b865b8181101561351257803567ffffffffffffffff8111156134a75760008081fd5b880136601f8201126134b95760008081fd5b80356134c761328c8261325a565b81815290851b820186019086810190368311156134e45760008081fd5b928701925b82841015613502578335825292870192908701906134e9565b8952505050948301948301613487565b5092979650505050505050565b600061352d61328c8461325a565b80848252602080830192508560051b85013681111561354b57600080fd5b855b8181101561359b57803567ffffffffffffffff81111561356d5760008081fd5b870136601f82011261357f5760008081fd5b61358d36823586840161327e565b86525093820193820161354d565b50919695505050505050565b60006135b561328c8461325a565b83815260208082019190600586811b8601368111156135d357600080fd5b865b8181101561351257803567ffffffffffffffff8111156135f55760008081fd5b880136601f8201126136075760008081fd5b803561361561328c8261325a565b81815290851b820186019086810190368311156136325760008081fd5b928701925b8284101561365057833582529287019290870190613637565b89525050509483019483016135d5565b600181811c9082168061367457607f821691505b60208210810361369457634e487b7160e01b600052602260045260246000fd5b50919050565b600082516136ac818460208701612bed565b9190910192915050565b815160009082906020808601845b838110156136e0578151855293820193908201906001016136c4565b50929695505050505050565b602081526000613252602083018486612f82565b60006020828403121561371257600080fd5b5051919050565b600061ffff80831681810361373057613730613031565b6001019392505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613772816017850160208801612bed565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516137af816028840160208801612bed565b01602801949350505050565b6020815260006126806020830184612c11565b601f82111561073157600081815260208120601f850160051c810160208610156137f55750805b601f850160051c820191505b8181101561185b57828155600101613801565b815167ffffffffffffffff81111561382e5761382e61289d565b6138428161383c8454613660565b846137ce565b602080601f831160018114613877576000841561385f5750858301515b600019600386901b1c1916600185901b17855561185b565b600085815260208120601f198616915b828110156138a657888601518255948401946001909101908401613887565b50858210156138c45787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b808202811582820484141761048d5761048d613031565b8082018082111561048d5761048d613031565b60008161390d5761390d613031565b50600019019056fea264697066735822122009be43805209f4688576eda21887af3be6f6c62b94b789da9e5ddebf12a3a9ce64736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061018d5760003560e01c806384b0196e116100e3578063d547741f1161008c578063e56f2fe411610066578063e56f2fe4146103ad578063ecc0382a146103c0578063f30553d5146103d357600080fd5b8063d547741f14610376578063d5f2077c14610389578063da7422281461039a57600080fd5b8063b21c2cdc116100bd578063b21c2cdc1461031a578063bd2cc82a14610341578063ce1b815f1461036557600080fd5b806384b0196e146102be57806391d14854146102d9578063a217fddf1461031257600080fd5b806336568abe11610145578063572b6c051161011f578063572b6c051461027357806359c191e4146102865780635aaa24bf146102ab57600080fd5b806336568abe146102265780633a2cf31a14610239578063439ff3ce1461026057600080fd5b806310da53931161017657806310da5393146101cf578063248a9ca3146101e25780632f2ff15d1461021357600080fd5b806301ffc9a7146101925780630c85fbb3146101ba575b600080fd5b6101a56101a03660046127a3565b6103fa565b60405190151581526020015b60405180910390f35b6101cd6101c8366004612831565b610493565b005b6101cd6101dd366004612954565b6104eb565b6102056101f0366004612a1c565b60009081526065602052604090206001015490565b6040519081526020016101b1565b6101cd610221366004612a51565b61070c565b6101cd610234366004612a51565b610736565b6102057f1d2951170e2f5d8eb8a7a48a737f5f1680469c14594abd27536867bfb559f88f81565b6101cd61026e366004612abf565b6107d2565b6101a5610281366004612bb0565b610b71565b60fd546001600160a01b03165b6040516001600160a01b0390911681526020016101b1565b6101cd6102b9366004612bcb565b610b8b565b6102c6610bea565b6040516101b19796959493929190612c78565b6101a56102e7366004612a51565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b610205600081565b6102057f45cf7a9b20b47d492887b813085b48aa1988f1f482fe79948578452b4b4cbedd81565b6101a561034f366004612a1c565b6000908152610100602052604090205460ff1690565b6097546001600160a01b0316610293565b6101cd610384366004612a51565b610cac565b60fe546001600160a01b0316610293565b6101cd6103a8366004612bb0565b610cd1565b6101cd6103bb366004612cf4565b610d61565b6101cd6103ce366004612d99565b610ee5565b6102057f30ed1d13f34eab3b4d1a3291d48db1d77bbc98ec9480b9131e4360220fd46fb081565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061048d57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b61049f8484848461110c565b7f25601c42b4517e81abacb7c77cd6d6697ea55465121e953721d60becc43b88e26104c8611228565b858585856040516104dd959493929190612eb8565b60405180910390a150505050565b84831461054b5760405162461bcd60e51b815260206004820152602360248201527f417373657452657665616c3a20496e76616c696420616d6f756e7473206c656e6044820152620cee8d60eb1b60648201526084015b60405180910390fd5b8481146105ab5760405162461bcd60e51b815260206004820152602860248201527f417373657452657665616c3a20496e76616c69642072657665616c48617368656044820152670e640d8cadccee8d60c31b6064820152608401610542565b60fe546001600160a01b0316636b406341896105d46105c8611228565b8b8b8b8b8b8b8b611237565b6040518363ffffffff1660e01b81526004016105f1929190612eee565b602060405180830381865afa15801561060e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106329190612f10565b6106a45760405162461bcd60e51b815260206004820152602960248201527f417373657452657665616c3a20496e76616c69642072657665616c4d696e742060448201527f7369676e617475726500000000000000000000000000000000000000000000006064820152608401610542565b60006106b58886868a8a8888611326565b90507fd19ae26d53e6e3446633338937b673d431c042f61b32854f821bc2b2b025b2c46106e0611228565b8989898588886040516106f99796959493929190612f32565b60405180910390a1505050505050505050565b60008281526065602052604090206001015461072781611592565b61073183836115a6565b505050565b61073e611228565b6001600160a01b0316816001600160a01b0316146107c45760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610542565b6107ce8282611649565b5050565b86851461082d5760405162461bcd60e51b815260206004820152602360248201527f417373657452657665616c3a20496e76616c696420616d6f756e7473206c656e6044820152620cee8d60eb1b6064820152608401610542565b8483146108a25760405162461bcd60e51b815260206004820152602a60248201527f417373657452657665616c3a20496e76616c6964206d6574616461746148617360448201527f686573206c656e677468000000000000000000000000000000000000000000006064820152608401610542565b8681146109025760405162461bcd60e51b815260206004820152602860248201527f417373657452657665616c3a20496e76616c69642072657665616c48617368656044820152670e640d8cadccee8d60c31b6064820152608401610542565b60fe546001600160a01b0316636b4063418b8b61092d610920611228565b8d8d8d8d8d8d8d8d6116ea565b6040518463ffffffff1660e01b815260040161094b93929190612fad565b602060405180830381865afa158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098c9190612f10565b6109fe5760405162461bcd60e51b815260206004820152602e60248201527f417373657452657665616c3a20496e76616c69642072657665616c426174636860448201527f4d696e74207369676e61747572650000000000000000000000000000000000006064820152608401610542565b60008767ffffffffffffffff811115610a1957610a1961289d565b604051908082528060200260200182016040528015610a4c57816020015b6060815260200190600190039081610a375790505b50905060005b88811015610b1757610ae78a8a83818110610a6f57610a6f612fd1565b90506020020135878784818110610a8857610a88612fd1565b9050602002810190610a9a9190612fe7565b8b8b86818110610aac57610aac612fd1565b9050602002810190610abe9190612fe7565b898988818110610ad057610ad0612fd1565b9050602002810190610ae29190612fe7565b611326565b828281518110610af957610af9612fd1565b60200260200101819052508080610b0f90613047565b915050610a52565b507f9327e7d8f5446a92ddcaf7ccd64ad67693773944fe2db95200e2d4db20054359610b41611228565b8a8a8a8a868989604051610b5c98979695949392919061314f565b60405180910390a15050505050505050505050565b600061048d826097546001600160a01b0391821691161490565b610b9582826117bd565b7f529140d9ae57da9c5515c8fe288c3865d4cbb81cb143062f99a466cb4bb6fa95610bbe611228565b604080516001600160a01b03909216825260208201859052810183905260600160405180910390a15050565b60006060806000806000606060c9546000801b148015610c0a575060ca54155b610c565760405162461bcd60e51b815260206004820152601560248201527f4549503731323a20556e696e697469616c697a656400000000000000000000006044820152606401610542565b610c5e611863565b610c666118f5565b604080516000808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009b939a50919850469750309650945092509050565b600082815260656020526040902060010154610cc781611592565b6107318383611649565b6000610cdc81611592565b6001600160a01b038216610d585760405162461bcd60e51b815260206004820152603460248201527f417373657452657665616c3a207472757374656420666f72776172646572206360448201527f616e2774206265207a65726f20616464726573730000000000000000000000006064820152608401610542565b6107ce82611904565b600054610100900460ff1615808015610d815750600054600160ff909116105b80610d9b5750303b158015610d9b575060005460ff166001145b610e0d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610542565b6000805460ff191660011790558015610e30576000805461ff0019166101001790555b60fd80546001600160a01b038088167fffffffffffffffffffffffff00000000000000000000000000000000000000009283161790925560fe805492871692909116919091179055610e8183611a08565b610e8b8787611a7c565b610e966000836115a6565b8015610edc576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b848314610f405760405162461bcd60e51b815260206004820152602360248201527f417373657452657665616c3a20496e76616c696420616d6f756e7473206c656e6044820152620cee8d60eb1b6064820152608401610542565b848114610fa05760405162461bcd60e51b815260206004820152602860248201527f417373657452657665616c3a20496e76616c69642072657665616c48617368656044820152670e640d8cadccee8d60c31b6064820152608401610542565b60fe546001600160a01b0316636b4063418a610fc9610fbd611228565b8c8b8b8b8b8b8b611af1565b6040518363ffffffff1660e01b8152600401610fe6929190612eee565b602060405180830381865afa158015611003573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110279190612f10565b6110995760405162461bcd60e51b815260206004820152602c60248201527f417373657452657665616c3a20496e76616c6964206275726e416e645265766560448201527f616c207369676e617475726500000000000000000000000000000000000000006064820152608401610542565b6110a388886117bd565b60006110b48986868a8a8888611326565b90507fd19ae26d53e6e3446633338937b673d431c042f61b32854f821bc2b2b025b2c46110df611228565b8a89898588886040516110f89796959493929190612f32565b60405180910390a150505050505050505050565b82811461115b5760405162461bcd60e51b815260206004820152601a60248201527f417373657452657665616c3a20496e76616c696420696e7075740000000000006044820152606401610542565b60005b838110156111b2576111a085858381811061117b5761117b612fd1565b9050602002013584848481811061119457611194612fd1565b90506020020135611b2c565b806111aa81613047565b91505061115e565b5060fd546001600160a01b03166320820ec36111cc611228565b868686866040518663ffffffff1660e01b81526004016111f0959493929190612eb8565b600060405180830381600087803b15801561120a57600080fd5b505af115801561121e573d6000803e3d6000fd5b5050505050505050565b6000611232611c27565b905090565b60006113197f1d2951170e2f5d8eb8a7a48a737f5f1680469c14594abd27536867bfb559f88f8a8a8a8a604051602001611272929190613245565b60408051601f19818403018152919052805160209091012061129c6112978a8c6132f7565b611c7a565b88886040516020016112af929190613245565b60408051601f198184030181528282528051602091820120908301979097526001600160a01b03909516948101949094526060840192909252608083015260a082015260c081019190915260e0015b60405160208183030381529060405280519060200120611d6e565b9998505050505050505050565b6060600061133588888b611db6565b905060005b8381101561144057610100600086868481811061135957611359612fd1565b602090810292909201358352508101919091526040016000205460ff16156113e85760405162461bcd60e51b8152602060048201526024808201527f417373657452657665616c3a2052657665616c4861736820616c72656164792060448201527f75736564000000000000000000000000000000000000000000000000000000006064820152608401610542565b6001610100600087878581811061140157611401612fd1565b90506020020135815260200190815260200160002060006101000a81548160ff021916908315150217905550808061143890613047565b91505061133a565b5080516001036115145760fd546001600160a01b031663bb7fde71611463611228565b8360008151811061147657611476612fd1565b60200260200101518989600081811061149157611491612fd1565b905060200201358c8c60008181106114ab576114ab612fd1565b90506020028101906114bd9190613304565b6040518663ffffffff1660e01b81526004016114dd95949392919061334b565b600060405180830381600087803b1580156114f757600080fd5b505af115801561150b573d6000803e3d6000fd5b50505050611586565b60fd546001600160a01b031663a55784ef61152d611228565b8389898d8d6040518763ffffffff1660e01b815260040161155396959493929190613385565b600060405180830381600087803b15801561156d57600080fd5b505af1158015611581573d6000803e3d6000fd5b505050505b98975050505050505050565b6115a38161159e611228565b611fb7565b50565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166107ce5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611605611228565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16156107ce5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191690556116a6611228565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b60006117af7f30ed1d13f34eab3b4d1a3291d48db1d77bbc98ec9480b9131e4360220fd46fb08b8b8b604051602001611724929190613245565b60408051601f19818403018152919052805160209091012061174e6117498b8d613459565b61202c565b61176061175b8a8c61351f565b6120f0565b61177261176d898b6135a7565b612196565b6040805160208101979097526001600160a01b03909516948601949094526060850192909252608084015260a083015260c082015260e0016112fe565b9a9950505050505050505050565b6117c78282611b2c565b60fd546001600160a01b031663124d91e56117e0611228565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b0390911660048201526024810185905260448101849052606401600060405180830381600087803b15801561184757600080fd5b505af115801561185b573d6000803e3d6000fd5b505050505050565b606060cb805461187290613660565b80601f016020809104026020016040519081016040528092919081815260200182805461189e90613660565b80156118eb5780601f106118c0576101008083540402835291602001916118eb565b820191906000526020600020905b8154815290600101906020018083116118ce57829003601f168201915b5050505050905090565b606060cc805461187290613660565b6097546001600160a01b03908116908216036119885760405162461bcd60e51b815260206004820152603060248201527f4552433237373148616e646c65725570677261646561626c653a20666f72776160448201527f7264657220616c726561647920736574000000000000000000000000000000006064820152608401610542565b611990611228565b6097546040516001600160a01b03928316928481169216907f8ca022029d8ff7ad974913f8970aeed6c5e0e7eaf494a0c5b262249f6b5759e590600090a4609780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b600054610100900460ff16611a735760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610542565b6115a38161225a565b600054610100900460ff16611ae75760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610542565b6107ce82826122ce565b60006113197f45cf7a9b20b47d492887b813085b48aa1988f1f482fe79948578452b4b4cbedd8a8a8a8a604051602001611272929190613245565b6000611b3783612361565b90508060a0015115611bb15760405162461bcd60e51b815260206004820152602660248201527f417373657452657665616c3a20417373657420697320616c726561647920726560448201527f7665616c656400000000000000000000000000000000000000000000000000006064820152608401610542565b600082116107315760405162461bcd60e51b815260206004820152603160248201527f417373657452657665616c3a204275726e20616d6f756e742073686f756c642060448201527f62652067726561746572207468616e20300000000000000000000000000000006064820152608401610542565b6097546000906001600160a01b031633148015611c45575060143610155b15611c7557507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b503390565b600080825167ffffffffffffffff811115611c9757611c9761289d565b604051908082528060200260200182016040528015611cc0578160200160208202803683370190505b50905060005b8351811015611d3e57838181518110611ce157611ce1612fd1565b6020026020010151604051602001611cf9919061369a565b60405160208183030381529060405280519060200120828281518110611d2157611d21612fd1565b602090810291909101015280611d3681613047565b915050611cc6565b5080604051602001611d5091906136b6565b60405160208183030381529060405280519060200120915050919050565b600061048d611d7b6123ee565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b60606000611dc383612361565b90508060a0015115611e175760405162461bcd60e51b815260206004820152601d60248201527f417373657452657665616c3a20616c72656164792072657665616c65640000006044820152606401610542565b60008467ffffffffffffffff811115611e3257611e3261289d565b604051908082528060200260200182016040528015611e5b578160200160208202803683370190505b50905060005b85811015611fad5760fd546000906001600160a01b031663fdda1d0e898985818110611e8f57611e8f612fd1565b9050602002810190611ea19190613304565b6040518363ffffffff1660e01b8152600401611ebe9291906136ec565b602060405180830381865afa158015611edb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eff9190613700565b905080600003611f7c576020808501516001600160a01b0316600090815260ff8252604080822089835290925290812080548290611f409061ffff16613719565b91906101000a81548161ffff021916908361ffff16021790559050611f78856020015186606001518760800151848960e001516123f8565b9150505b80838381518110611f8f57611f8f612fd1565b60209081029190910101525080611fa581613047565b915050611e61565b5095945050505050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166107ce57611fea81612445565b611ff5836020612457565b60405160200161200692919061373a565b60408051601f198184030181529082905262461bcd60e51b8252610542916004016137bb565b600080825167ffffffffffffffff8111156120495761204961289d565b604051908082528060200260200182016040528015612072578160200160208202803683370190505b50905060005b8351811015611d3e5783818151811061209357612093612fd1565b60200260200101516040516020016120ab91906136b6565b604051602081830303815290604052805190602001208282815181106120d3576120d3612fd1565b6020908102919091010152806120e881613047565b915050612078565b600080825167ffffffffffffffff81111561210d5761210d61289d565b604051908082528060200260200182016040528015612136578160200160208202803683370190505b50905060005b8351811015611d3e5761216784828151811061215a5761215a612fd1565b6020026020010151611c7a565b82828151811061217957612179612fd1565b60209081029190910101528061218e81613047565b91505061213c565b600080825167ffffffffffffffff8111156121b3576121b361289d565b6040519080825280602002602001820160405280156121dc578160200160208202803683370190505b50905060005b8351811015611d3e578381815181106121fd576121fd612fd1565b602002602001015160405160200161221591906136b6565b6040516020818303038152906040528051906020012082828151811061223d5761223d612fd1565b60209081029190910101528061225281613047565b9150506121e2565b600054610100900460ff166122c55760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610542565b6115a381611904565b600054610100900460ff166123395760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610542565b60cb6123458382613814565b5060cc6123528282613814565b5050600060c981905560ca5550565b604080516101008101825260008082529181018290526080810182905260a0808201839052606060c0830181905260e08301939093526001600160a01b038416602083015283901c60ff16918101919091526123bc82612687565b151560a08201526123d18260a81c61ffff1690565b61ffff16608082015260c89190911c60019081161460e082015290565b60006112326126a5565b60008560c88361240957600061240c565b60015b60ff16901b60b88561ffff16901b60a88761ffff16901b60a08960ff16901b846001600160a01b03161717171791505095945050505050565b606061048d6001600160a01b03831660145b606060006124668360026138d4565b6124719060026138eb565b67ffffffffffffffff8111156124895761248961289d565b6040519080825280601f01601f1916602001820160405280156124b3576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106124ea576124ea612fd1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061254d5761254d612fd1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006125898460026138d4565b6125949060016138eb565b90505b6001811115612631577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106125d5576125d5612fd1565b1a60f81b8282815181106125eb576125eb612fd1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c9361262a816138fe565b9050612597565b5083156126805760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610542565b9392505050565b6000806126988360b81c61ffff1690565b61ffff1615159392505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6126d0612719565b6126d8612772565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600080612724611863565b80519091501561273b578051602090910120919050565b60c954801561274a5792915050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709250505090565b60008061277d6118f5565b805190915015612794578051602090910120919050565b60ca54801561274a5792915050565b6000602082840312156127b557600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461268057600080fd5b60008083601f8401126127f757600080fd5b50813567ffffffffffffffff81111561280f57600080fd5b6020830191508360208260051b850101111561282a57600080fd5b9250929050565b6000806000806040858703121561284757600080fd5b843567ffffffffffffffff8082111561285f57600080fd5b61286b888389016127e5565b9096509450602087013591508082111561288457600080fd5b50612891878288016127e5565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156128dc576128dc61289d565b604052919050565b600082601f8301126128f557600080fd5b813567ffffffffffffffff81111561290f5761290f61289d565b6129226020601f19601f840116016128b3565b81815284602083860101111561293757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060008060008060a0898b03121561297057600080fd5b883567ffffffffffffffff8082111561298857600080fd5b6129948c838d016128e4565b995060208b0135985060408b01359150808211156129b157600080fd5b6129bd8c838d016127e5565b909850965060608b01359150808211156129d657600080fd5b6129e28c838d016127e5565b909650945060808b01359150808211156129fb57600080fd5b50612a088b828c016127e5565b999c989b5096995094979396929594505050565b600060208284031215612a2e57600080fd5b5035919050565b80356001600160a01b0381168114612a4c57600080fd5b919050565b60008060408385031215612a6457600080fd5b82359150612a7460208401612a35565b90509250929050565b60008083601f840112612a8f57600080fd5b50813567ffffffffffffffff811115612aa757600080fd5b60208301915083602082850101111561282a57600080fd5b60008060008060008060008060008060a08b8d031215612ade57600080fd5b8a3567ffffffffffffffff80821115612af657600080fd5b612b028e838f01612a7d565b909c509a5060208d0135915080821115612b1b57600080fd5b612b278e838f016127e5565b909a50985060408d0135915080821115612b4057600080fd5b612b4c8e838f016127e5565b909850965060608d0135915080821115612b6557600080fd5b612b718e838f016127e5565b909650945060808d0135915080821115612b8a57600080fd5b50612b978d828e016127e5565b915080935050809150509295989b9194979a5092959850565b600060208284031215612bc257600080fd5b61268082612a35565b60008060408385031215612bde57600080fd5b50508035926020909101359150565b60005b83811015612c08578181015183820152602001612bf0565b50506000910152565b60008151808452612c29816020860160208601612bed565b601f01601f19169290920160200192915050565b600081518084526020808501945080840160005b83811015612c6d57815187529582019590820190600101612c51565b509495945050505050565b7fff000000000000000000000000000000000000000000000000000000000000008816815260e060208201526000612cb360e0830189612c11565b8281036040840152612cc58189612c11565b90508660608401526001600160a01b03861660808401528460a084015282810360c08401526117af8185612c3d565b60008060008060008060c08789031215612d0d57600080fd5b863567ffffffffffffffff80821115612d2557600080fd5b612d318a838b016128e4565b97506020890135915080821115612d4757600080fd5b50612d5489828a016128e4565b955050612d6360408801612a35565b9350612d7160608801612a35565b9250612d7f60808801612a35565b9150612d8d60a08801612a35565b90509295509295509295565b600080600080600080600080600060c08a8c031215612db757600080fd5b893567ffffffffffffffff80821115612dcf57600080fd5b612ddb8d838e016128e4565b9a5060208c0135995060408c0135985060608c0135915080821115612dff57600080fd5b612e0b8d838e016127e5565b909850965060808c0135915080821115612e2457600080fd5b612e308d838e016127e5565b909650945060a08c0135915080821115612e4957600080fd5b50612e568c828d016127e5565b915080935050809150509295985092959850929598565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115612e9f57600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b0386168152606060208201526000612edb606083018688612e6d565b8281036040840152611586818587612e6d565b604081526000612f016040830185612c11565b90508260208301529392505050565b600060208284031215612f2257600080fd5b8151801515811461268057600080fd5b6001600160a01b038816815286602082015260a060408201526000612f5b60a083018789612e6d565b8281036060840152612f6d8187612c3d565b905082810360808401526117af818587612e6d565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b604081526000612fc1604083018587612f82565b9050826020830152949350505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112612ffe57600080fd5b83018035915067ffffffffffffffff82111561301957600080fd5b6020019150600581901b360382131561282a57600080fd5b634e487b7160e01b600052601160045260246000fd5b6000600019820361305a5761305a613031565b5060010190565b6000808335601e1984360301811261307857600080fd5b830160208101925035905067ffffffffffffffff81111561309857600080fd5b8060051b360382131561282a57600080fd5b600081518084526020808501808196508360051b8101915082860160005b858110156130f25782840389526130e0848351612c3d565b988501989350908401906001016130c8565b5091979650505050505050565b81835260006020808501808196508560051b810191508460005b878110156130f25782840389526131308288613061565b61313b868284612e6d565b9a87019a9550505090840190600101613119565b6001600160a01b03891681526000602060a08184015261317360a084018a8c612e6d565b8381036040850152878152818101600589901b820183018a60005b8b8110156131c857601f198584030184526131a9828e613061565b6131b4858284612e6d565b95880195945050509085019060010161318e565b505085810360608701526131dc818a6130aa565b935050505082810360808401526131f48185876130ff565b9b9a5050505050505050505050565b60007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561323257600080fd5b8260051b80838637939093019392505050565b6000613252828486613203565b949350505050565b600067ffffffffffffffff8211156132745761327461289d565b5060051b60200190565b600061329161328c8461325a565b6128b3565b8381529050602080820190600585901b8401868111156132b057600080fd5b845b818110156132ec57803567ffffffffffffffff8111156132d25760008081fd5b6132de898289016128e4565b8552509282019282016132b2565b505050509392505050565b600061268036848461327e565b6000808335601e1984360301811261331b57600080fd5b83018035915067ffffffffffffffff82111561333657600080fd5b60200191503681900382131561282a57600080fd5b6001600160a01b038616815284602082015283604082015260806060820152600061337a608083018486612f82565b979650505050505050565b6001600160a01b0387168152600060206080818401526133a86080840189612c3d565b83810360408501526133bb81888a612e6d565b84810360608601528581529050818101600586901b820183018760005b8881101561344757601f198584030184528135601e198b36030181126133fd57600080fd5b8a01868101903567ffffffffffffffff81111561341957600080fd5b80360382131561342857600080fd5b613433858284612f82565b9588019594505050908501906001016133d8565b50909c9b505050505050505050505050565b600061346761328c8461325a565b83815260208082019190600586811b86013681111561348557600080fd5b865b8181101561351257803567ffffffffffffffff8111156134a75760008081fd5b880136601f8201126134b95760008081fd5b80356134c761328c8261325a565b81815290851b820186019086810190368311156134e45760008081fd5b928701925b82841015613502578335825292870192908701906134e9565b8952505050948301948301613487565b5092979650505050505050565b600061352d61328c8461325a565b80848252602080830192508560051b85013681111561354b57600080fd5b855b8181101561359b57803567ffffffffffffffff81111561356d5760008081fd5b870136601f82011261357f5760008081fd5b61358d36823586840161327e565b86525093820193820161354d565b50919695505050505050565b60006135b561328c8461325a565b83815260208082019190600586811b8601368111156135d357600080fd5b865b8181101561351257803567ffffffffffffffff8111156135f55760008081fd5b880136601f8201126136075760008081fd5b803561361561328c8261325a565b81815290851b820186019086810190368311156136325760008081fd5b928701925b8284101561365057833582529287019290870190613637565b89525050509483019483016135d5565b600181811c9082168061367457607f821691505b60208210810361369457634e487b7160e01b600052602260045260246000fd5b50919050565b600082516136ac818460208701612bed565b9190910192915050565b815160009082906020808601845b838110156136e0578151855293820193908201906001016136c4565b50929695505050505050565b602081526000613252602083018486612f82565b60006020828403121561371257600080fd5b5051919050565b600061ffff80831681810361373057613730613031565b6001019392505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613772816017850160208801612bed565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516137af816028840160208801612bed565b01602801949350505050565b6020815260006126806020830184612c11565b601f82111561073157600081815260208120601f850160051c810160208610156137f55750805b601f850160051c820191505b8181101561185b57828155600101613801565b815167ffffffffffffffff81111561382e5761382e61289d565b6138428161383c8454613660565b846137ce565b602080601f831160018114613877576000841561385f5750858301515b600019600386901b1c1916600185901b17855561185b565b600085815260208120601f198616915b828110156138a657888601518255948401946001909101908401613887565b50858210156138c45787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b808202811582820484141761048d5761048d613031565b8082018082111561048d5761048d613031565b60008161390d5761390d613031565b50600019019056fea264697066735822122009be43805209f4688576eda21887af3be6f6c62b94b789da9e5ddebf12a3a9ce64736f6c63430008120033", "devdoc": { "author": "The Sandbox", "events": { @@ -784,6 +809,13 @@ }, "RoleRevoked(bytes32,address,address)": { "details": "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`)" + }, + "TrustedForwarderSet(address,address,address)": { + "params": { + "newTrustedForwarder": "new trusted forwarder", + "oldTrustedForwarder": "old trusted forwarder", + "operator": "the sender of the transaction" + } } }, "kind": "dev", @@ -818,6 +850,11 @@ "getRoleAdmin(bytes32)": { "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}." }, + "getTrustedForwarder()": { + "returns": { + "_0": "return the address of the trusted forwarder" + } + }, "grantRole(bytes32,address)": { "details": "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." }, @@ -831,6 +868,14 @@ "_forwarder": "The address of the forwarder contract" } }, + "isTrustedForwarder(address)": { + "params": { + "forwarder": "trusted forwarder address to check" + }, + "returns": { + "_0": "true if the address is the same as the trusted forwarder" + } + }, "renounceRole(bytes32,address)": { "details": "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." }, @@ -890,6 +935,11 @@ "version": 1 }, "userdoc": { + "events": { + "TrustedForwarderSet(address,address,address)": { + "notice": "Emitted when a `newTrustedForwarder` is set, replacing the `oldTrustedForwarder`" + } + }, "kind": "user", "methods": { "burnAndReveal(bytes,uint256,uint256,uint256[],string[],bytes32[])": { @@ -901,9 +951,15 @@ "getAuthValidator()": { "notice": "Get the auth validator address" }, + "getTrustedForwarder()": { + "notice": "return the address of the trusted forwarder" + }, "initialize(string,string,address,address,address,address)": { "notice": "Initialize the contract" }, + "isTrustedForwarder(address)": { + "notice": "return true if the forwarder is the trusted forwarder" + }, "revealBatchBurn(uint256[],uint256[])": { "notice": "Burn multiple assets to be able to reveal them later" }, @@ -929,7 +985,7 @@ "storageLayout": { "storage": [ { - "astId": 565, + "astId": 3599, "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", "label": "_initialized", "offset": 0, @@ -937,7 +993,7 @@ "type": "t_uint8" }, { - "astId": 568, + "astId": 3602, "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", "label": "_initializing", "offset": 1, @@ -945,7 +1001,7 @@ "type": "t_bool" }, { - "astId": 2901, + "astId": 6153, "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", "label": "__gap", "offset": 0, @@ -953,7 +1009,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 3824, + "astId": 7076, "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", "label": "__gap", "offset": 0, @@ -961,15 +1017,15 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 164, + "astId": 3044, "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", "label": "_roles", "offset": 0, "slot": "101", - "type": "t_mapping(t_bytes32,t_struct(RoleData)159_storage)" + "type": "t_mapping(t_bytes32,t_struct(RoleData)3039_storage)" }, { - "astId": 459, + "astId": 3339, "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", "label": "__gap", "offset": 0, @@ -977,7 +1033,7 @@ "type": "t_array(t_uint256)49_storage" }, { - "astId": 10411, + "astId": 17227, "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", "label": "_trustedForwarder", "offset": 0, @@ -985,75 +1041,83 @@ "type": "t_address" }, { - "astId": 3515, + "astId": 17314, "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", - "label": "_hashedName", + "label": "__gap", "offset": 0, "slot": "152", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 6767, + "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", + "label": "_hashedName", + "offset": 0, + "slot": "201", "type": "t_bytes32" }, { - "astId": 3518, + "astId": 6770, "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", "label": "_hashedVersion", "offset": 0, - "slot": "153", + "slot": "202", "type": "t_bytes32" }, { - "astId": 3520, + "astId": 6772, "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", "label": "_name", "offset": 0, - "slot": "154", + "slot": "203", "type": "t_string_storage" }, { - "astId": 3522, + "astId": 6774, "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", "label": "_version", "offset": 0, - "slot": "155", + "slot": "204", "type": "t_string_storage" }, { - "astId": 3780, + "astId": 7032, "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", "label": "__gap", "offset": 0, - "slot": "156", + "slot": "205", "type": "t_array(t_uint256)48_storage" }, { - "astId": 9150, + "astId": 14033, "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", "label": "assetContract", "offset": 0, - "slot": "204", - "type": "t_contract(IAsset)10560" + "slot": "253", + "type": "t_contract(IAsset)16079" }, { - "astId": 9153, + "astId": 14036, "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", "label": "authValidator", "offset": 0, - "slot": "205", - "type": "t_contract(AuthSuperValidator)10406" + "slot": "254", + "type": "t_contract(AuthSuperValidator)15285" }, { - "astId": 9159, + "astId": 14042, "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", "label": "revealIds", "offset": 0, - "slot": "206", + "slot": "255", "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint16))" }, { - "astId": 9163, + "astId": 14046, "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", "label": "revealHashesUsed", "offset": 0, - "slot": "207", + "slot": "256", "type": "t_mapping(t_bytes32,t_bool)" } ], @@ -1091,12 +1155,12 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(AuthSuperValidator)10406": { + "t_contract(AuthSuperValidator)15285": { "encoding": "inplace", "label": "contract AuthSuperValidator", "numberOfBytes": "20" }, - "t_contract(IAsset)10560": { + "t_contract(IAsset)16079": { "encoding": "inplace", "label": "contract IAsset", "numberOfBytes": "20" @@ -1122,12 +1186,12 @@ "numberOfBytes": "32", "value": "t_bool" }, - "t_mapping(t_bytes32,t_struct(RoleData)159_storage)": { + "t_mapping(t_bytes32,t_struct(RoleData)3039_storage)": { "encoding": "mapping", "key": "t_bytes32", "label": "mapping(bytes32 => struct AccessControlUpgradeable.RoleData)", "numberOfBytes": "32", - "value": "t_struct(RoleData)159_storage" + "value": "t_struct(RoleData)3039_storage" }, "t_mapping(t_uint256,t_uint16)": { "encoding": "mapping", @@ -1141,12 +1205,12 @@ "label": "string", "numberOfBytes": "32" }, - "t_struct(RoleData)159_storage": { + "t_struct(RoleData)3039_storage": { "encoding": "inplace", "label": "struct AccessControlUpgradeable.RoleData", "members": [ { - "astId": 156, + "astId": 3036, "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", "label": "members", "offset": 0, @@ -1154,7 +1218,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 158, + "astId": 3038, "contract": "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol:AssetReveal", "label": "adminRole", "offset": 0, diff --git a/packages/deploy/deployments/mumbai/AssetReveal_Proxy.json b/packages/deploy/deployments/mumbai/AssetReveal_Proxy.json index 8bcf933dac..10297d2dbd 100644 --- a/packages/deploy/deployments/mumbai/AssetReveal_Proxy.json +++ b/packages/deploy/deployments/mumbai/AssetReveal_Proxy.json @@ -1,5 +1,5 @@ { - "address": "0x1DCfE371272031e6dD9f79d7cDC63B2276298548", + "address": "0xe69cfd1674d44f13F3889F23a8B359742491C754", "abi": [ { "inputs": [ @@ -146,35 +146,50 @@ "type": "receive" } ], - "transactionHash": "0xbc15f002e6ac482a02235446d35bc8aeb7f2630a79335af11a8285913c5c8bb1", + "transactionHash": "0x46df2836ef740bc9dda28e8634ca781ac42f3295f7dce7a682b17a15da3a5176", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0x1DCfE371272031e6dD9f79d7cDC63B2276298548", - "transactionIndex": 2, - "gasUsed": "891822", - "logsBloom": "0x00000004000000020001000000000000400000000400000000000000000000000002000000008400000000000000000000008000000000000000000000000000000000000000000000000000000002800000040000000000000100000000000000000000020000000000020000000800000000800000000080000000000000000000000000000000000000000000000000008000000080000000000000a00000200000000000000020000000400400000001000000000000001000000000004000040020000000000001000000040000000000000400000100108000000020000000000000000000000000000000000000000000000000000000000000100000", - "blockHash": "0xf30b5b61e6be2129220334767b39c72959c34340522cdfe71ce42574edba7813", - "transactionHash": "0xbc15f002e6ac482a02235446d35bc8aeb7f2630a79335af11a8285913c5c8bb1", + "contractAddress": "0xe69cfd1674d44f13F3889F23a8B359742491C754", + "transactionIndex": 4, + "gasUsed": "894627", + "logsBloom": "0x00000004000000000000000000000000400000000000000800000080080000000002000000008400000000000001000000008000000000000000000000000000000000000000020000000000000002800000000000000000000100000000004000000000020000000000020000000800000000800000100080000000000000000000010040000000000000000000000000000000000080000000000000a00000200000000000000000000000000400000000000000000000001000000000004040000020000000000001000000040000000000000400000100108040000020002000000000000000000000000000000004000000000000000000000000100000", + "blockHash": "0x02759b457eec4f910b2000ec9d0c7f1d32c38a0dbd86ce35b9abd9abd35d9fb7", + "transactionHash": "0x46df2836ef740bc9dda28e8634ca781ac42f3295f7dce7a682b17a15da3a5176", "logs": [ { - "transactionIndex": 2, - "blockNumber": 38596228, - "transactionHash": "0xbc15f002e6ac482a02235446d35bc8aeb7f2630a79335af11a8285913c5c8bb1", - "address": "0x1DCfE371272031e6dD9f79d7cDC63B2276298548", + "transactionIndex": 4, + "blockNumber": 38730830, + "transactionHash": "0x46df2836ef740bc9dda28e8634ca781ac42f3295f7dce7a682b17a15da3a5176", + "address": "0xe69cfd1674d44f13F3889F23a8B359742491C754", "topics": [ "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", - "0x0000000000000000000000000a6a0a03b2a26f1384ed6234e3cbc6635e3ce5a9" + "0x00000000000000000000000097afc3cdf0ca007dc9f131d1d46d51fa8ea92c9f" ], "data": "0x", - "logIndex": 4, - "blockHash": "0xf30b5b61e6be2129220334767b39c72959c34340522cdfe71ce42574edba7813" + "logIndex": 5, + "blockHash": "0x02759b457eec4f910b2000ec9d0c7f1d32c38a0dbd86ce35b9abd9abd35d9fb7" }, { - "transactionIndex": 2, - "blockNumber": 38596228, - "transactionHash": "0xbc15f002e6ac482a02235446d35bc8aeb7f2630a79335af11a8285913c5c8bb1", - "address": "0x1DCfE371272031e6dD9f79d7cDC63B2276298548", + "transactionIndex": 4, + "blockNumber": 38730830, + "transactionHash": "0x46df2836ef740bc9dda28e8634ca781ac42f3295f7dce7a682b17a15da3a5176", + "address": "0xe69cfd1674d44f13F3889F23a8B359742491C754", + "topics": [ + "0x8ca022029d8ff7ad974913f8970aeed6c5e0e7eaf494a0c5b262249f6b5759e5", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f7", + "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" + ], + "data": "0x", + "logIndex": 6, + "blockHash": "0x02759b457eec4f910b2000ec9d0c7f1d32c38a0dbd86ce35b9abd9abd35d9fb7" + }, + { + "transactionIndex": 4, + "blockNumber": 38730830, + "transactionHash": "0x46df2836ef740bc9dda28e8634ca781ac42f3295f7dce7a682b17a15da3a5176", + "address": "0xe69cfd1674d44f13F3889F23a8B359742491C754", "topics": [ "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "0x0000000000000000000000000000000000000000000000000000000000000000", @@ -182,58 +197,58 @@ "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 5, - "blockHash": "0xf30b5b61e6be2129220334767b39c72959c34340522cdfe71ce42574edba7813" + "logIndex": 7, + "blockHash": "0x02759b457eec4f910b2000ec9d0c7f1d32c38a0dbd86ce35b9abd9abd35d9fb7" }, { - "transactionIndex": 2, - "blockNumber": 38596228, - "transactionHash": "0xbc15f002e6ac482a02235446d35bc8aeb7f2630a79335af11a8285913c5c8bb1", - "address": "0x1DCfE371272031e6dD9f79d7cDC63B2276298548", + "transactionIndex": 4, + "blockNumber": 38730830, + "transactionHash": "0x46df2836ef740bc9dda28e8634ca781ac42f3295f7dce7a682b17a15da3a5176", + "address": "0xe69cfd1674d44f13F3889F23a8B359742491C754", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x0000000000000000000000000000000000000000000000000000000000000001", - "logIndex": 6, - "blockHash": "0xf30b5b61e6be2129220334767b39c72959c34340522cdfe71ce42574edba7813" + "logIndex": 8, + "blockHash": "0x02759b457eec4f910b2000ec9d0c7f1d32c38a0dbd86ce35b9abd9abd35d9fb7" }, { - "transactionIndex": 2, - "blockNumber": 38596228, - "transactionHash": "0xbc15f002e6ac482a02235446d35bc8aeb7f2630a79335af11a8285913c5c8bb1", - "address": "0x1DCfE371272031e6dD9f79d7cDC63B2276298548", + "transactionIndex": 4, + "blockNumber": 38730830, + "transactionHash": "0x46df2836ef740bc9dda28e8634ca781ac42f3295f7dce7a682b17a15da3a5176", + "address": "0xe69cfd1674d44f13F3889F23a8B359742491C754", "topics": [ "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" ], - "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c3c6b8feee55636e949920aa90f093f6f5faf448", - "logIndex": 7, - "blockHash": "0xf30b5b61e6be2129220334767b39c72959c34340522cdfe71ce42574edba7813" + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c26b12025e378c570fb46249093ba387a2e927bc", + "logIndex": 9, + "blockHash": "0x02759b457eec4f910b2000ec9d0c7f1d32c38a0dbd86ce35b9abd9abd35d9fb7" }, { - "transactionIndex": 2, - "blockNumber": 38596228, - "transactionHash": "0xbc15f002e6ac482a02235446d35bc8aeb7f2630a79335af11a8285913c5c8bb1", + "transactionIndex": 4, + "blockNumber": 38730830, + "transactionHash": "0x46df2836ef740bc9dda28e8634ca781ac42f3295f7dce7a682b17a15da3a5176", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", - "0x000000000000000000000000c26880a0af2ea0c7e8130e6ec47af756465452e8" + "0x000000000000000000000000be188d6641e8b680743a4815dfa0f6208038960f" ], - "data": "0x0000000000000000000000000000000000000000000000000005b3fe486df35c00000000000000000000000000000000000000000000001171aaed040893a9490000000000000000000000000000000000000000000021166bbbbbbba24069b800000000000000000000000000000000000000000000001171a53905c025b5ed0000000000000000000000000000000000000000000021166bc16fb9eaae5d14", - "logIndex": 8, - "blockHash": "0xf30b5b61e6be2129220334767b39c72959c34340522cdfe71ce42574edba7813" + "data": "0x0000000000000000000000000000000000000000000000000004c47cdecfed0000000000000000000000000000000000000000000000001170d567f74f390e330000000000000000000000000000000000000000000033a6d654a80d849ca1b700000000000000000000000000000000000000000000001170d0a37a706921330000000000000000000000000000000000000000000033a6d6596c8a636c8eb7", + "logIndex": 10, + "blockHash": "0x02759b457eec4f910b2000ec9d0c7f1d32c38a0dbd86ce35b9abd9abd35d9fb7" } ], - "blockNumber": 38596228, - "cumulativeGasUsed": "1038756", + "blockNumber": 38730830, + "cumulativeGasUsed": "1029192", "status": 1, "byzantium": true }, "args": [ - "0x0A6A0A03b2a26F1384Ed6234E3cBc6635e3CE5A9", - "0xc3C6B8feeE55636e949920Aa90f093f6f5Faf448", - "0xe56f2fe400000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000b0fb55e91b58d8db07aabff2d6b5a8e2e1bf8d08000000000000000000000000b2732c13804d60866606d61b1b9450eb4704e59600000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f700000000000000000000000049c4d4c94829b9c44052c5f5cb164fc612181165000000000000000000000000000000000000000000000000000000000000001453616e64626f782041737365742052657665616c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000003312e300000000000000000000000000000000000000000000000000000000000" + "0x97AfC3CDf0CA007DC9f131d1D46d51Fa8eA92c9F", + "0xc26B12025e378c570Fb46249093Ba387A2e927bc", + "0xe56f2fe400000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000007af8c95334240026385f7309d9a8b9e4265fc70a0000000000000000000000009f6031f7728ff4de931036477ea9bba5ae7cf97400000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f700000000000000000000000049c4d4c94829b9c44052c5f5cb164fc612181165000000000000000000000000000000000000000000000000000000000000001453616e64626f782041737365742052657665616c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000003312e300000000000000000000000000000000000000000000000000000000000" ], "numDeployments": 1, "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", diff --git a/packages/deploy/deployments/mumbai/Asset_Implementation.json b/packages/deploy/deployments/mumbai/Asset_Implementation.json index 7fd5decc7e..29f4880f36 100644 --- a/packages/deploy/deployments/mumbai/Asset_Implementation.json +++ b/packages/deploy/deployments/mumbai/Asset_Implementation.json @@ -1,5 +1,5 @@ { - "address": "0x80160a8f1A98cb387ae8e46E8C10931EEF07a490", + "address": "0x8d4490Da283630df4229E76ea7EA99401736bD80", "abi": [ { "inputs": [], @@ -283,6 +283,31 @@ "name": "TrustedForwarderChanged", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldTrustedForwarder", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newTrustedForwarder", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -738,7 +763,7 @@ "outputs": [ { "internalType": "address", - "name": "trustedForwarder", + "name": "", "type": "address" } ], @@ -1307,33 +1332,33 @@ "type": "function" } ], - "transactionHash": "0xce908acb88e5141bf28749f09b6a7aa64b3069553b4cc495b5cc7d0054303233", + "transactionHash": "0x539baf3f55add1530fafaa9723989aad7ee070c7f9db21d8478bc9dc1499e67a", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0x80160a8f1A98cb387ae8e46E8C10931EEF07a490", - "transactionIndex": 7, - "gasUsed": "4441641", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000010000002000002000000000020000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100000000000000000000000000000800000000000000000000000000000080000000000000000000000000000000000000000000000000020000000080000000000000200000200000000000000000000000000400000000000000000000000000000000004000000000000000000001000000040000000000000000000000108000001000000000000000000000000000000000000000000000000000000000000000100000", - "blockHash": "0xb35cd6862181290c2bbc3d81e2dd7ef9e2faffebcde061341ba6bd98eb25025b", - "transactionHash": "0xce908acb88e5141bf28749f09b6a7aa64b3069553b4cc495b5cc7d0054303233", + "contractAddress": "0x8d4490Da283630df4229E76ea7EA99401736bD80", + "transactionIndex": 5, + "gasUsed": "4507969", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000010000000000002000000000020000000004000000001008000000000000000000000000000000000000000000000000000000000800000000000000000000100000000200000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000080000000000000200000200000000000000000000000000400000000000000000000000000000000004000000000000000000001000000040000000000000000000000108000001000000000000000000000000000000000000000000000000000000000000000100000", + "blockHash": "0x35034de99def5e9bcabe899136b4d4c9225850d6de24d8d9d9963aedd3e78810", + "transactionHash": "0x539baf3f55add1530fafaa9723989aad7ee070c7f9db21d8478bc9dc1499e67a", "logs": [ { - "transactionIndex": 7, - "blockNumber": 38596208, - "transactionHash": "0xce908acb88e5141bf28749f09b6a7aa64b3069553b4cc495b5cc7d0054303233", - "address": "0x80160a8f1A98cb387ae8e46E8C10931EEF07a490", + "transactionIndex": 5, + "blockNumber": 38730660, + "transactionHash": "0x539baf3f55add1530fafaa9723989aad7ee070c7f9db21d8478bc9dc1499e67a", + "address": "0x8d4490Da283630df4229E76ea7EA99401736bD80", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", - "logIndex": 21, - "blockHash": "0xb35cd6862181290c2bbc3d81e2dd7ef9e2faffebcde061341ba6bd98eb25025b" + "logIndex": 30, + "blockHash": "0x35034de99def5e9bcabe899136b4d4c9225850d6de24d8d9d9963aedd3e78810" }, { - "transactionIndex": 7, - "blockNumber": 38596208, - "transactionHash": "0xce908acb88e5141bf28749f09b6a7aa64b3069553b4cc495b5cc7d0054303233", + "transactionIndex": 5, + "blockNumber": 38730660, + "transactionHash": "0x539baf3f55add1530fafaa9723989aad7ee070c7f9db21d8478bc9dc1499e67a", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", @@ -1341,22 +1366,22 @@ "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", "0x000000000000000000000000f903ba9e006193c1527bfbe65fe2123704ea3f99" ], - "data": "0x0000000000000000000000000000000000000000000000000017ab79334d4d2900000000000000000000000000000000000000000000001171eaa2b075cbaf100000000000000000000000000000000000000000000010323085dc4dba16a76d00000000000000000000000000000000000000000000001171d2f737427e61e7000000000000000000000000000000000000000000001032309d87c6ed63f496", - "logIndex": 22, - "blockHash": "0xb35cd6862181290c2bbc3d81e2dd7ef9e2faffebcde061341ba6bd98eb25025b" + "data": "0x000000000000000000000000000000000000000000000000001805f5fc5aef00000000000000000000000000000000000000000000000011714d9f8732d32f83000000000000000000000000000000000000000000001043e0c00a6cd70d1c6b0000000000000000000000000000000000000000000000117135999136784083000000000000000000000000000000000000000000001043e0d81062d3680b6b", + "logIndex": 31, + "blockHash": "0x35034de99def5e9bcabe899136b4d4c9225850d6de24d8d9d9963aedd3e78810" } ], - "blockNumber": 38596208, - "cumulativeGasUsed": "5635356", + "blockNumber": 38730660, + "cumulativeGasUsed": "5911637", "status": 1, "byzantium": true }, "args": [], "numDeployments": 1, - "solcInputHash": "2c3b4b6dffad52d9ee7aef38c085eed3", - "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"royaltyBPS\",\"type\":\"uint16\"}],\"name\":\"DefaultRoyaltyBpsSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"DefaultRoyaltyReceiverSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"splitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"RoyaltyRecipientSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"TokenRoyaltyRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"TokenRoyaltySet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"name\":\"TransferBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"TransferSingle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newTrustedForwarderAddress\",\"type\":\"address\"}],\"name\":\"TrustedForwarderChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"URI\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINTER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MODERATOR_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"_tokenRoyaltiesSplitter\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"balanceOfBatch\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"name\":\"burnBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"burnBatchFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burnFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"exists\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllSplits\",\"outputs\":[{\"internalType\":\"address payable[]\",\"name\":\"splits\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getCreatorAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getCreatorNonce\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getRecipients\",\"outputs\":[{\"components\":[{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"bps\",\"type\":\"uint16\"}],\"internalType\":\"struct Recipient[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getRevealNonce\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getTier\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"tier\",\"type\":\"uint8\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"metadataHash\",\"type\":\"string\"}],\"name\":\"getTokenIdByMetadataHash\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTokenRoyalties\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint16\",\"name\":\"royaltyBPS\",\"type\":\"uint16\"},{\"components\":[{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"bps\",\"type\":\"uint16\"}],\"internalType\":\"struct Recipient[]\",\"name\":\"recipients\",\"type\":\"tuple[]\"}],\"internalType\":\"struct IMultiRoyaltyDistributor.TokenRoyaltyConfig[]\",\"name\":\"royaltyConfigs\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTrustedForwarder\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"name\":\"hashUsed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"assetAdmin\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"baseUri\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"commonSubscription\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_manager\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"isBridged\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"isRevealed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"}],\"name\":\"isTrustedForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"metadataHash\",\"type\":\"string\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"string[]\",\"name\":\"metadataHashes\",\"type\":\"string[]\"}],\"name\":\"mintBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"operatorFilterRegistry\",\"outputs\":[{\"internalType\":\"contract IOperatorFilterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"subscriptionOrRegistrantToCopy\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"subscribe\",\"type\":\"bool\"}],\"name\":\"registerAndSubscribe\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"royaltyInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"royaltyManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeBatchTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"baseURI\",\"type\":\"string\"}],\"name\":\"setBaseURI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"registry\",\"type\":\"address\"}],\"name\":\"setOperatorRegistry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"}],\"name\":\"setTokenRoyalties\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"metadata\",\"type\":\"string\"}],\"name\":\"setTokenURI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"name\":\"setTrustedForwarder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"id\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"ApprovalForAll(address,address,bool)\":{\"details\":\"Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to `approved`.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"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._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"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`)\"},\"TransferBatch(address,address,address,uint256[],uint256[])\":{\"details\":\"Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all transfers.\"},\"TransferSingle(address,address,address,uint256,uint256)\":{\"details\":\"Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\"},\"URI(string,uint256)\":{\"details\":\"Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. If an {URI} event was emitted for `id`, the standard https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value returned by {IERC1155MetadataURI-uri}.\"}},\"kind\":\"dev\",\"methods\":{\"balanceOf(address,uint256)\":{\"details\":\"See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address.\"},\"balanceOfBatch(address[],uint256[])\":{\"details\":\"See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length.\"},\"burnBatchFrom(address,uint256[],uint256[])\":{\"details\":\"Only the minter role can burn tokensThis function was added with token recycling and bridging in mind but may have other use casesThe length of the ids and amounts arrays must be the same\",\"params\":{\"account\":\"The account to burn tokens from\",\"amounts\":\"An array of amounts of tokens to burn\",\"ids\":\"An array of token ids to burn\"}},\"burnFrom(address,uint256,uint256)\":{\"details\":\"Only the minter role can burn tokensThis function was added with token recycling and bridging in mind but may have other use cases\",\"params\":{\"account\":\"The account to burn tokens from\",\"amount\":\"The amount of tokens to burn\",\"id\":\"The token id to burn\"}},\"constructor\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"exists(uint256)\":{\"details\":\"Indicates whether any token exist with a given id, or not.\"},\"getAllSplits()\":{\"returns\":{\"splits\":\"the royalty receiver's array\"}},\"getCreatorAddress(uint256)\":{\"params\":{\"tokenId\":\"The token id to extract the creator address from\"},\"returns\":{\"creator\":\"The asset creator address\"}},\"getCreatorNonce(uint256)\":{\"params\":{\"tokenId\":\"The token id to extract the asset nonce from\"},\"returns\":{\"_0\":\"creatorNonce The asset creator nonce\"}},\"getRecipients(uint256)\":{\"details\":\"returns the default address for tokens with no recipients.\",\"params\":{\"tokenId\":\"is the token id for which the recipient should be returned.\"},\"returns\":{\"_0\":\"addresses of royalty recipient of the token.\"}},\"getRevealNonce(uint256)\":{\"params\":{\"tokenId\":\"The token id to extract reveal nonce from\"},\"returns\":{\"_0\":\"revealNonce The reveal nonce of the asset\"}},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getTier(uint256)\":{\"params\":{\"tokenId\":\"The token id to extract the tier from\"},\"returns\":{\"tier\":\"The asset tier, determined by the catalyst used to create it\"}},\"getTokenRoyalties()\":{\"returns\":{\"royaltyConfigs\":\"receivers and their split array as long as the number of tokens.\"}},\"grantRole(bytes32,address)\":{\"details\":\"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.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC1155-isApprovedForAll}.\"},\"isBridged(uint256)\":{\"params\":{\"tokenId\":\"The token id to extract the bridged flag from\"},\"returns\":{\"_0\":\"bridged Whether the asset is bridged or not\"}},\"isRevealed(uint256)\":{\"params\":{\"tokenId\":\"The token id to extract the revealed flag from\"},\"returns\":{\"_0\":\"isRevealed Whether the asset is revealed or not\"}},\"mint(address,uint256,uint256,string)\":{\"details\":\"Only callable by the minter role\",\"params\":{\"amount\":\"The amount of the token to mint\",\"id\":\"The id of the token to mint\",\"to\":\"The address of the recipient\"}},\"mintBatch(address,uint256[],uint256[],string[])\":{\"details\":\"Only callable by the minter role\",\"params\":{\"amounts\":\"The amounts of the tokens to mint\",\"ids\":\"The ids of the tokens to mint\",\"to\":\"The address of the recipient\"}},\"registerAndSubscribe(address,bool)\":{\"details\":\"used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.\",\"params\":{\"subscribe\":\"bool to signify subscription \\\"true\\\"\\\" or to copy the list \\\"false\\\".\",\"subscriptionOrRegistrantToCopy\":\"registration address of the list to subscribe.\"}},\"renounceRole(bytes32,address)\":{\"details\":\"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.\"},\"revokeRole(bytes32,address)\":{\"details\":\"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.\"},\"royaltyInfo(uint256,uint256)\":{\"params\":{\"tokenId\":\"of the token for which the royalty is needed to be distributed\",\"value\":\"the amount on which the royalty is calculated\"},\"returns\":{\"_0\":\"address the royalty receiver\",\"_1\":\"value the EIP2981 royalty\"}},\"safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)\":{\"details\":\"call data should be optimized to order ids so packedBalance can be used efficiently.\",\"params\":{\"amounts\":\"amount of each token type transfered.\",\"data\":\"aditional data accompanying the transfer.\",\"from\":\"address from which tokens are transfered.\",\"ids\":\"ids of each token type transfered.\",\"to\":\"address to which the token will be transfered.\"}},\"safeTransferFrom(address,address,uint256,uint256,bytes)\":{\"params\":{\"amount\":\"amount of token transfered.\",\"data\":\"aditional data accompanying the transfer.\",\"from\":\"address from which tokens are transfered.\",\"id\":\"the token type transfered.\",\"to\":\"address to which the token will be transfered.\"}},\"setApprovalForAll(address,bool)\":{\"params\":{\"approved\":\"whether to approve or revoke\",\"operator\":\"address which will be granted rights to transfer all tokens of the caller.\"}},\"setBaseURI(string)\":{\"params\":{\"baseURI\":\"The new base URI\"}},\"setOperatorRegistry(address)\":{\"params\":{\"registry\":\"the address of the registry\"}},\"setTokenRoyalties(uint256,address,address)\":{\"params\":{\"creator\":\"the creactor of the tokens.\",\"recipient\":\"the royalty recipient for the splitter of the creator.\",\"tokenId\":\"the id of the token for which the EIP2981 royalty is set for.\"}},\"setTokenURI(uint256,string)\":{\"details\":\"The metadata hash should be the IPFS CIDv1 base32 encoded hash\",\"params\":{\"metadata\":\"The new URI for asset's metadata\",\"tokenId\":\"The token id to set URI for\"}},\"setTrustedForwarder(address)\":{\"details\":\"Change the address of the trusted forwarder for meta-TX\",\"params\":{\"trustedForwarder\":\"The new trustedForwarder\"}},\"supportsInterface(bytes4)\":{\"params\":{\"id\":\"the interface identifier, as specified in ERC-165.\"},\"returns\":{\"_0\":\"`true` if the contract implements `id`.\"}},\"totalSupply(uint256)\":{\"details\":\"Total amount of tokens in with a given id.\"},\"uri(uint256)\":{\"params\":{\"tokenId\":\"The token id to get URI for\"},\"returns\":{\"_0\":\"tokenURI the URI of the token\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"burnBatchFrom(address,uint256[],uint256[])\":{\"notice\":\"Burn a batch of tokens from a given account\"},\"burnFrom(address,uint256,uint256)\":{\"notice\":\"Burn a token from a given account\"},\"getAllSplits()\":{\"notice\":\"returns the EIP-2981 royalty receiver for each token (i.e. splitters) including the default royalty receiver.\"},\"getCreatorAddress(uint256)\":{\"notice\":\"Extracts the creator address from a given token id\"},\"getCreatorNonce(uint256)\":{\"notice\":\"Extracts the asset nonce from a given token id\"},\"getRecipients(uint256)\":{\"notice\":\"returns the royalty recipients for each tokenId.\"},\"getRevealNonce(uint256)\":{\"notice\":\"Extracts the abilities and enhancements hash from a given token id\"},\"getTier(uint256)\":{\"notice\":\"Extracts the tier from a given token id\"},\"getTokenRoyalties()\":{\"notice\":\"Returns royalty receivers and their split of royalty for each token\"},\"isBridged(uint256)\":{\"notice\":\"Extracts the bridged flag from a given token id\"},\"isRevealed(uint256)\":{\"notice\":\"Extracts the revealed flag from a given token id\"},\"mint(address,uint256,uint256,string)\":{\"notice\":\"Mint new tokens\"},\"mintBatch(address,uint256[],uint256[],string[])\":{\"notice\":\"Mint new tokens with catalyst tier chosen by the creator\"},\"registerAndSubscribe(address,bool)\":{\"notice\":\"This function is used to register Asset contract on the Operator Filterer Registry of Opensea.can only be called by admin.\"},\"royaltyInfo(uint256,uint256)\":{\"notice\":\"EIP 2981 royalty info function to return the royalty receiver and royalty amount\"},\"safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)\":{\"notice\":\"Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\"},\"safeTransferFrom(address,address,uint256,uint256,bytes)\":{\"notice\":\"Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\"},\"setApprovalForAll(address,bool)\":{\"notice\":\"Enable or disable approval for `operator` to manage all of the caller's tokens.\"},\"setBaseURI(string)\":{\"notice\":\"Set a new base URI\"},\"setOperatorRegistry(address)\":{\"notice\":\"sets filter registry address deployed in test\"},\"setTokenRoyalties(uint256,address,address)\":{\"notice\":\"could be used to deploy splitter and set tokens royalties\"},\"setTokenURI(uint256,string)\":{\"notice\":\"Set a new URI for specific tokenid\"},\"setTrustedForwarder(address)\":{\"notice\":\"Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\"},\"supportsInterface(bytes4)\":{\"notice\":\"Query if a contract implements interface `id`.\"},\"uri(uint256)\":{\"notice\":\"returns full token URI, including baseURI and token metadata URI\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@sandbox-smart-contracts/asset/contracts/Asset.sol\":\"Asset\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/// @author: manifold.xyz\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\nstruct Recipient {\\n address payable recipient;\\n uint16 bps;\\n}\\n\\ninterface IRoyaltySplitter is IERC165 {\\n /**\\n * @dev Set the splitter recipients. Total bps must total 10000.\\n */\\n function setRecipients(Recipient[] calldata recipients) external;\\n\\n /**\\n * @dev Get the splitter recipients;\\n */\\n function getRecipients() external view returns (Recipient[] memory);\\n}\\n\",\"keccak256\":\"0xc507963f66c4238d25e69d2d05ac5995c549aa89789e89e7a556403221547c6d\",\"license\":\"MIT\"},\"@manifoldxyz/royalty-registry-solidity/contracts/specs/IEIP2981.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * EIP-2981\\n */\\ninterface IEIP2981 {\\n /**\\n * bytes4(keccak256(\\\"royaltyInfo(uint256,uint256)\\\")) == 0x2a55205a\\n *\\n * => 0x2a55205a = 0x2a55205a\\n */\\n function royaltyInfo(uint256 tokenId, uint256 value) external view returns (address, uint256);\\n}\\n\",\"keccak256\":\"0xd5313c1f5939b5a98bc48824082c337a6205d78f6346465fe3c3944de274f6bd\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlUpgradeable.sol\\\";\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\\n function __AccessControl_init() internal onlyInitializing {\\n }\\n\\n function __AccessControl_init_unchained() internal onlyInitializing {\\n }\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n StringsUpgradeable.toHexString(account),\\n \\\" is missing role \\\",\\n StringsUpgradeable.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xfeefb24d068524440e1ba885efdf105d91f83504af3c2d745ffacc4595396831\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControlUpgradeable {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0xb8f5302f12138c5561362e88a78d061573e6298b7a1a5afe84a1e2c8d4d5aeaa\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized != type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC1155Upgradeable.sol\\\";\\nimport \\\"./IERC1155ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC1155MetadataURIUpgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the basic standard multi-token.\\n * See https://eips.ethereum.org/EIPS/eip-1155\\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\\n *\\n * _Available since v3.1._\\n */\\ncontract ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155Upgradeable, IERC1155MetadataURIUpgradeable {\\n using AddressUpgradeable for address;\\n\\n // Mapping from token ID to account balances\\n mapping(uint256 => mapping(address => uint256)) private _balances;\\n\\n // Mapping from account to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json\\n string private _uri;\\n\\n /**\\n * @dev See {_setURI}.\\n */\\n function __ERC1155_init(string memory uri_) internal onlyInitializing {\\n __ERC1155_init_unchained(uri_);\\n }\\n\\n function __ERC1155_init_unchained(string memory uri_) internal onlyInitializing {\\n _setURI(uri_);\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return\\n interfaceId == type(IERC1155Upgradeable).interfaceId ||\\n interfaceId == type(IERC1155MetadataURIUpgradeable).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC1155MetadataURI-uri}.\\n *\\n * This implementation returns the same URI for *all* token types. It relies\\n * on the token type ID substitution mechanism\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\\n *\\n * Clients calling this function must replace the `\\\\{id\\\\}` substring with the\\n * actual token type ID.\\n */\\n function uri(uint256) public view virtual override returns (string memory) {\\n return _uri;\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {\\n require(account != address(0), \\\"ERC1155: address zero is not a valid owner\\\");\\n return _balances[id][account];\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOfBatch}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] memory accounts,\\n uint256[] memory ids\\n ) public view virtual override returns (uint256[] memory) {\\n require(accounts.length == ids.length, \\\"ERC1155: accounts and ids length mismatch\\\");\\n\\n uint256[] memory batchBalances = new uint256[](accounts.length);\\n\\n for (uint256 i = 0; i < accounts.length; ++i) {\\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\\n }\\n\\n return batchBalances;\\n }\\n\\n /**\\n * @dev See {IERC1155-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC1155-isApprovedForAll}.\\n */\\n function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[account][operator];\\n }\\n\\n /**\\n * @dev See {IERC1155-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) public virtual override {\\n require(\\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\\n \\\"ERC1155: caller is not token owner or approved\\\"\\n );\\n _safeTransferFrom(from, to, id, amount, data);\\n }\\n\\n /**\\n * @dev See {IERC1155-safeBatchTransferFrom}.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) public virtual override {\\n require(\\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\\n \\\"ERC1155: caller is not token owner or approved\\\"\\n );\\n _safeBatchTransferFrom(from, to, ids, amounts, data);\\n }\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function _safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) internal virtual {\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n\\n address operator = _msgSender();\\n uint256[] memory ids = _asSingletonArray(id);\\n uint256[] memory amounts = _asSingletonArray(amount);\\n\\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n uint256 fromBalance = _balances[id][from];\\n require(fromBalance >= amount, \\\"ERC1155: insufficient balance for transfer\\\");\\n unchecked {\\n _balances[id][from] = fromBalance - amount;\\n }\\n _balances[id][to] += amount;\\n\\n emit TransferSingle(operator, from, to, id, amount);\\n\\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);\\n }\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function _safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual {\\n require(ids.length == amounts.length, \\\"ERC1155: ids and amounts length mismatch\\\");\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n\\n address operator = _msgSender();\\n\\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n for (uint256 i = 0; i < ids.length; ++i) {\\n uint256 id = ids[i];\\n uint256 amount = amounts[i];\\n\\n uint256 fromBalance = _balances[id][from];\\n require(fromBalance >= amount, \\\"ERC1155: insufficient balance for transfer\\\");\\n unchecked {\\n _balances[id][from] = fromBalance - amount;\\n }\\n _balances[id][to] += amount;\\n }\\n\\n emit TransferBatch(operator, from, to, ids, amounts);\\n\\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);\\n }\\n\\n /**\\n * @dev Sets a new URI for all token types, by relying on the token type ID\\n * substitution mechanism\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\\n *\\n * By this mechanism, any occurrence of the `\\\\{id\\\\}` substring in either the\\n * URI or any of the amounts in the JSON file at said URI will be replaced by\\n * clients with the token type ID.\\n *\\n * For example, the `https://token-cdn-domain/\\\\{id\\\\}.json` URI would be\\n * interpreted by clients as\\n * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\\n * for token type ID 0x4cce0.\\n *\\n * See {uri}.\\n *\\n * Because these URIs cannot be meaningfully represented by the {URI} event,\\n * this function emits no events.\\n */\\n function _setURI(string memory newuri) internal virtual {\\n _uri = newuri;\\n }\\n\\n /**\\n * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\\n require(to != address(0), \\\"ERC1155: mint to the zero address\\\");\\n\\n address operator = _msgSender();\\n uint256[] memory ids = _asSingletonArray(id);\\n uint256[] memory amounts = _asSingletonArray(amount);\\n\\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\\n\\n _balances[id][to] += amount;\\n emit TransferSingle(operator, address(0), to, id, amount);\\n\\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\\n\\n _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);\\n }\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function _mintBatch(\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual {\\n require(to != address(0), \\\"ERC1155: mint to the zero address\\\");\\n require(ids.length == amounts.length, \\\"ERC1155: ids and amounts length mismatch\\\");\\n\\n address operator = _msgSender();\\n\\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\\n\\n for (uint256 i = 0; i < ids.length; i++) {\\n _balances[ids[i]][to] += amounts[i];\\n }\\n\\n emit TransferBatch(operator, address(0), to, ids, amounts);\\n\\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\\n\\n _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens of token type `id` from `from`\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `from` must have at least `amount` tokens of token type `id`.\\n */\\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\\n require(from != address(0), \\\"ERC1155: burn from the zero address\\\");\\n\\n address operator = _msgSender();\\n uint256[] memory ids = _asSingletonArray(id);\\n uint256[] memory amounts = _asSingletonArray(amount);\\n\\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \\\"\\\");\\n\\n uint256 fromBalance = _balances[id][from];\\n require(fromBalance >= amount, \\\"ERC1155: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[id][from] = fromBalance - amount;\\n }\\n\\n emit TransferSingle(operator, from, address(0), id, amount);\\n\\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \\\"\\\");\\n }\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n */\\n function _burnBatch(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual {\\n require(from != address(0), \\\"ERC1155: burn from the zero address\\\");\\n require(ids.length == amounts.length, \\\"ERC1155: ids and amounts length mismatch\\\");\\n\\n address operator = _msgSender();\\n\\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \\\"\\\");\\n\\n for (uint256 i = 0; i < ids.length; i++) {\\n uint256 id = ids[i];\\n uint256 amount = amounts[i];\\n\\n uint256 fromBalance = _balances[id][from];\\n require(fromBalance >= amount, \\\"ERC1155: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[id][from] = fromBalance - amount;\\n }\\n }\\n\\n emit TransferBatch(operator, from, address(0), ids, amounts);\\n\\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \\\"\\\");\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\\n require(owner != operator, \\\"ERC1155: setting approval status for self\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting\\n * and burning, as well as batched variants.\\n *\\n * The same hook is called on both single and batched variants. For single\\n * transfers, the length of the `ids` and `amounts` arrays will be 1.\\n *\\n * Calling conditions (for each `id` and `amount` pair):\\n *\\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * of token type `id` will be transferred to `to`.\\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\\n * for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\\n * will be burned.\\n * - `from` and `to` are never both zero.\\n * - `ids` and `amounts` have the same, non-zero length.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting\\n * and burning, as well as batched variants.\\n *\\n * The same hook is called on both single and batched variants. For single\\n * transfers, the length of the `id` and `amount` arrays will be 1.\\n *\\n * Calling conditions (for each `id` and `amount` pair):\\n *\\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * of token type `id` will be transferred to `to`.\\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\\n * for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\\n * will be burned.\\n * - `from` and `to` are never both zero.\\n * - `ids` and `amounts` have the same, non-zero length.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual {}\\n\\n function _doSafeTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try IERC1155ReceiverUpgradeable(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {\\n if (response != IERC1155ReceiverUpgradeable.onERC1155Received.selector) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non-ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n function _doSafeBatchTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (\\n bytes4 response\\n ) {\\n if (response != IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non-ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {\\n uint256[] memory array = new uint256[](1);\\n array[0] = element;\\n\\n return array;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[47] private __gap;\\n}\\n\",\"keccak256\":\"0xc3e465e1fdd0e491688ad75ef1b946e1680e7f9f78bf5beeefd6daed8693c856\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\ninterface IERC1155ReceiverUpgradeable is IERC165Upgradeable {\\n /**\\n * @dev Handles the receipt of a single ERC1155 token type. This function is\\n * called at the end of a `safeTransferFrom` after the balance has been updated.\\n *\\n * NOTE: To accept the transfer, this must return\\n * `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))`\\n * (i.e. 0xf23a6e61, or its own function selector).\\n *\\n * @param operator The address which initiated the transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param id The ID of the token being transferred\\n * @param value The amount of tokens being transferred\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155Received(\\n address operator,\\n address from,\\n uint256 id,\\n uint256 value,\\n bytes calldata data\\n ) external returns (bytes4);\\n\\n /**\\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\\n * is called at the end of a `safeBatchTransferFrom` after the balances have\\n * been updated.\\n *\\n * NOTE: To accept the transfer(s), this must return\\n * `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))`\\n * (i.e. 0xbc197c81, or its own function selector).\\n *\\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xffcb29612efb57efc8f0d4897deb5abaeac830022c59a3aa17446d698dbc856b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155Upgradeable is IERC165Upgradeable {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xf51f292659a77777c0ed7375a39683d8bee53b86a6e7bd0c76f34ce7aa37a3a8\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/extensions/ERC1155Burnable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1155Upgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Extension of {ERC1155} that allows token holders to destroy both their\\n * own tokens and those that they have been approved to use.\\n *\\n * _Available since v3.1._\\n */\\nabstract contract ERC1155BurnableUpgradeable is Initializable, ERC1155Upgradeable {\\n function __ERC1155Burnable_init() internal onlyInitializing {\\n }\\n\\n function __ERC1155Burnable_init_unchained() internal onlyInitializing {\\n }\\n function burn(address account, uint256 id, uint256 value) public virtual {\\n require(\\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\\n \\\"ERC1155: caller is not token owner or approved\\\"\\n );\\n\\n _burn(account, id, value);\\n }\\n\\n function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {\\n require(\\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\\n \\\"ERC1155: caller is not token owner or approved\\\"\\n );\\n\\n _burnBatch(account, ids, values);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x048a492eee88c80ecc0354486e8e0ab99490b44a6fb28833b3cfb45d573f18d7\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1155Upgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Extension of ERC1155 that adds tracking of total supply per id.\\n *\\n * Useful for scenarios where Fungible and Non-fungible tokens have to be\\n * clearly identified. Note: While a totalSupply of 1 might mean the\\n * corresponding is an NFT, there is no guarantees that no other token with the\\n * same id are not going to be minted.\\n */\\nabstract contract ERC1155SupplyUpgradeable is Initializable, ERC1155Upgradeable {\\n function __ERC1155Supply_init() internal onlyInitializing {\\n }\\n\\n function __ERC1155Supply_init_unchained() internal onlyInitializing {\\n }\\n mapping(uint256 => uint256) private _totalSupply;\\n\\n /**\\n * @dev Total amount of tokens in with a given id.\\n */\\n function totalSupply(uint256 id) public view virtual returns (uint256) {\\n return _totalSupply[id];\\n }\\n\\n /**\\n * @dev Indicates whether any token exist with a given id, or not.\\n */\\n function exists(uint256 id) public view virtual returns (bool) {\\n return ERC1155SupplyUpgradeable.totalSupply(id) > 0;\\n }\\n\\n /**\\n * @dev See {ERC1155-_beforeTokenTransfer}.\\n */\\n function _beforeTokenTransfer(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual override {\\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n if (from == address(0)) {\\n for (uint256 i = 0; i < ids.length; ++i) {\\n _totalSupply[ids[i]] += amounts[i];\\n }\\n }\\n\\n if (to == address(0)) {\\n for (uint256 i = 0; i < ids.length; ++i) {\\n uint256 id = ids[i];\\n uint256 amount = amounts[i];\\n uint256 supply = _totalSupply[id];\\n require(supply >= amount, \\\"ERC1155: burn amount exceeds totalSupply\\\");\\n unchecked {\\n _totalSupply[id] = supply - amount;\\n }\\n }\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xf7bdbcbb9fcf42997f280db8c02070e9c561406e6971ff680c6c43f92065ac9e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155URIStorage.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../ERC1155Upgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev ERC1155 token with storage based token URI management.\\n * Inspired by the ERC721URIStorage extension\\n *\\n * _Available since v4.6._\\n */\\nabstract contract ERC1155URIStorageUpgradeable is Initializable, ERC1155Upgradeable {\\n function __ERC1155URIStorage_init() internal onlyInitializing {\\n __ERC1155URIStorage_init_unchained();\\n }\\n\\n function __ERC1155URIStorage_init_unchained() internal onlyInitializing {\\n _baseURI = \\\"\\\";\\n }\\n using StringsUpgradeable for uint256;\\n\\n // Optional base URI\\n string private _baseURI;\\n\\n // Optional mapping for token URIs\\n mapping(uint256 => string) private _tokenURIs;\\n\\n /**\\n * @dev See {IERC1155MetadataURI-uri}.\\n *\\n * This implementation returns the concatenation of the `_baseURI`\\n * and the token-specific uri if the latter is set\\n *\\n * This enables the following behaviors:\\n *\\n * - if `_tokenURIs[tokenId]` is set, then the result is the concatenation\\n * of `_baseURI` and `_tokenURIs[tokenId]` (keep in mind that `_baseURI`\\n * is empty per default);\\n *\\n * - if `_tokenURIs[tokenId]` is NOT set then we fallback to `super.uri()`\\n * which in most cases will contain `ERC1155._uri`;\\n *\\n * - if `_tokenURIs[tokenId]` is NOT set, and if the parents do not have a\\n * uri value set, then the result is empty.\\n */\\n function uri(uint256 tokenId) public view virtual override returns (string memory) {\\n string memory tokenURI = _tokenURIs[tokenId];\\n\\n // If token URI is set, concatenate base URI and tokenURI (via abi.encodePacked).\\n return bytes(tokenURI).length > 0 ? string(abi.encodePacked(_baseURI, tokenURI)) : super.uri(tokenId);\\n }\\n\\n /**\\n * @dev Sets `tokenURI` as the tokenURI of `tokenId`.\\n */\\n function _setURI(uint256 tokenId, string memory tokenURI) internal virtual {\\n _tokenURIs[tokenId] = tokenURI;\\n emit URI(uri(tokenId), tokenId);\\n }\\n\\n /**\\n * @dev Sets `baseURI` as the `_baseURI` for all tokens\\n */\\n function _setBaseURI(string memory baseURI) internal virtual {\\n _baseURI = baseURI;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[48] private __gap;\\n}\\n\",\"keccak256\":\"0x9a1218747a17239e2fcab2efc14099379387f114c7ad22c69a23b7d67ec0eaa2\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/IERC1155MetadataURIUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC1155Upgradeable.sol\\\";\\n\\n/**\\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155MetadataURIUpgradeable is IERC1155Upgradeable {\\n /**\\n * @dev Returns the URI for token type `id`.\\n *\\n * If the `\\\\{id\\\\}` substring is present in the URI, it must be replaced by\\n * clients with the actual token type ID.\\n */\\n function uri(uint256 id) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xa350df12a8c10e821af05e0863f44e8317a0efa44df27bfd5dc1d63fdfa3c448\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary MathUpgradeable {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Clones.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\\n * deploying minimal proxy contracts, also known as \\\"clones\\\".\\n *\\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\\n *\\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\\n * deterministic method.\\n *\\n * _Available since v3.4._\\n */\\nlibrary Clones {\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create opcode, which should never revert.\\n */\\n function clone(address implementation) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create(0, 0x09, 0x37)\\n }\\n require(instance != address(0), \\\"ERC1167: create failed\\\");\\n }\\n\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create2 opcode and a `salt` to deterministically deploy\\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\\n * the clones cannot be deployed twice at the same address.\\n */\\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create2(0, 0x09, 0x37, salt)\\n }\\n require(instance != address(0), \\\"ERC1167: create2 failed\\\");\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt,\\n address deployer\\n ) internal pure returns (address predicted) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(add(ptr, 0x38), deployer)\\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\\n mstore(add(ptr, 0x14), implementation)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\\n mstore(add(ptr, 0x58), salt)\\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\\n predicted := keccak256(add(ptr, 0x43), 0x55)\\n }\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt\\n ) internal view returns (address predicted) {\\n return predictDeterministicAddress(implementation, salt, address(this));\\n }\\n}\\n\",\"keccak256\":\"0x01f055f5c26ba25d7f83e9aa9ba877fbea4d0bf22227de046ea67494bc932999\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)\\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```solidity\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n *\\n * [WARNING]\\n * ====\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\\n * unusable.\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\n *\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\\n * array of EnumerableSet.\\n * ====\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastValue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastValue;\\n // Update the index for the moved value\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n bytes32[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x9f4357008a8f7d8c8bf5d48902e789637538d8c016be5766610901b4bba81514\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/Asset.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport {\\n AccessControlUpgradeable,\\n ContextUpgradeable,\\n IAccessControlUpgradeable,\\n IERC165Upgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\\\";\\nimport {\\n ERC1155BurnableUpgradeable,\\n ERC1155Upgradeable,\\n IERC1155Upgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol\\\";\\nimport {\\n ERC1155SupplyUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol\\\";\\nimport {\\n ERC1155URIStorageUpgradeable,\\n IERC1155MetadataURIUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport {ERC2771Handler} from \\\"./ERC2771Handler.sol\\\";\\nimport {\\n MultiRoyaltyDistributor\\n} from \\\"@sandbox-smart-contracts/dependency-royalty-management/contracts/MultiRoyaltyDistributor.sol\\\";\\nimport {\\n OperatorFiltererUpgradeable,\\n IOperatorFilterRegistry\\n} from \\\"@sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol\\\";\\nimport {TokenIdUtils} from \\\"./libraries/TokenIdUtils.sol\\\";\\nimport {IAsset} from \\\"./interfaces/IAsset.sol\\\";\\nimport {ITokenUtils, IRoyaltyUGC} from \\\"./interfaces/ITokenUtils.sol\\\";\\n\\ncontract Asset is\\n IAsset,\\n Initializable,\\n ERC2771Handler,\\n ERC1155BurnableUpgradeable,\\n AccessControlUpgradeable,\\n ERC1155SupplyUpgradeable,\\n ERC1155URIStorageUpgradeable,\\n OperatorFiltererUpgradeable,\\n MultiRoyaltyDistributor,\\n ITokenUtils\\n{\\n using TokenIdUtils for uint256;\\n\\n bytes32 public constant MINTER_ROLE = keccak256(\\\"MINTER_ROLE\\\");\\n bytes32 public constant BURNER_ROLE = keccak256(\\\"BURNER_ROLE\\\");\\n bytes32 public constant MODERATOR_ROLE = keccak256(\\\"MODERATOR_ROLE\\\");\\n\\n // mapping of ipfs metadata token hash to token id\\n mapping(string => uint256) public hashUsed;\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor() {\\n _disableInitializers();\\n }\\n\\n function initialize(\\n address forwarder,\\n address assetAdmin,\\n string memory baseUri,\\n address commonSubscription,\\n address _manager\\n ) external initializer {\\n _setBaseURI(baseUri);\\n __AccessControl_init();\\n __ERC1155Supply_init();\\n __ERC2771Handler_initialize(forwarder);\\n __ERC1155Burnable_init();\\n _grantRole(DEFAULT_ADMIN_ROLE, assetAdmin);\\n __OperatorFilterer_init(commonSubscription, true);\\n __MultiRoyaltyDistributor_init(_manager);\\n }\\n\\n /// @notice Mint new tokens\\n /// @dev Only callable by the minter role\\n /// @param to The address of the recipient\\n /// @param id The id of the token to mint\\n /// @param amount The amount of the token to mint\\n function mint(\\n address to,\\n uint256 id,\\n uint256 amount,\\n string memory metadataHash\\n ) external onlyRole(MINTER_ROLE) {\\n _setMetadataHash(id, metadataHash);\\n _mint(to, id, amount, \\\"\\\");\\n address creator = id.getCreatorAddress();\\n _setTokenRoyalties(id, payable(creator), creator);\\n }\\n\\n /// @notice Mint new tokens with catalyst tier chosen by the creator\\n /// @dev Only callable by the minter role\\n /// @param to The address of the recipient\\n /// @param ids The ids of the tokens to mint\\n /// @param amounts The amounts of the tokens to mint\\n function mintBatch(\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n string[] memory metadataHashes\\n ) external onlyRole(MINTER_ROLE) {\\n require(ids.length == metadataHashes.length, \\\"Asset: ids and metadataHash length mismatch\\\");\\n require(ids.length == amounts.length, \\\"Asset: ids and amounts length mismatch\\\");\\n for (uint256 i = 0; i < ids.length; i++) {\\n _setMetadataHash(ids[i], metadataHashes[i]);\\n }\\n _mintBatch(to, ids, amounts, \\\"\\\");\\n for (uint256 i; i < ids.length; i++) {\\n address creator = ids[i].getCreatorAddress();\\n _setTokenRoyalties(ids[i], payable(creator), creator);\\n }\\n }\\n\\n /// @notice Burn a token from a given account\\n /// @dev Only the minter role can burn tokens\\n /// @dev This function was added with token recycling and bridging in mind but may have other use cases\\n /// @param account The account to burn tokens from\\n /// @param id The token id to burn\\n /// @param amount The amount of tokens to burn\\n function burnFrom(\\n address account,\\n uint256 id,\\n uint256 amount\\n ) external onlyRole(BURNER_ROLE) {\\n _burn(account, id, amount);\\n }\\n\\n /// @notice Burn a batch of tokens from a given account\\n /// @dev Only the minter role can burn tokens\\n /// @dev This function was added with token recycling and bridging in mind but may have other use cases\\n /// @dev The length of the ids and amounts arrays must be the same\\n /// @param account The account to burn tokens from\\n /// @param ids An array of token ids to burn\\n /// @param amounts An array of amounts of tokens to burn\\n function burnBatchFrom(\\n address account,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external onlyRole(BURNER_ROLE) {\\n _burnBatch(account, ids, amounts);\\n }\\n\\n /// @notice Set a new URI for specific tokenid\\n /// @dev The metadata hash should be the IPFS CIDv1 base32 encoded hash\\n /// @param tokenId The token id to set URI for\\n /// @param metadata The new URI for asset's metadata\\n function setTokenURI(uint256 tokenId, string memory metadata) external onlyRole(MODERATOR_ROLE) {\\n _setURI(tokenId, metadata);\\n }\\n\\n /// @notice Set a new base URI\\n /// @param baseURI The new base URI\\n function setBaseURI(string memory baseURI) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n _setBaseURI(baseURI);\\n }\\n\\n /// @notice returns full token URI, including baseURI and token metadata URI\\n /// @param tokenId The token id to get URI for\\n /// @return tokenURI the URI of the token\\n function uri(uint256 tokenId)\\n public\\n view\\n override(ERC1155Upgradeable, ERC1155URIStorageUpgradeable)\\n returns (string memory)\\n {\\n return ERC1155URIStorageUpgradeable.uri(tokenId);\\n }\\n\\n function getTokenIdByMetadataHash(string memory metadataHash) public view returns (uint256) {\\n return hashUsed[metadataHash];\\n }\\n\\n function _setMetadataHash(uint256 tokenId, string memory metadataHash) internal {\\n if (hashUsed[metadataHash] != 0) {\\n require(hashUsed[metadataHash] == tokenId, \\\"Asset: not allowed to reuse metadata hash\\\");\\n } else {\\n hashUsed[metadataHash] = tokenId;\\n _setURI(tokenId, metadataHash);\\n }\\n }\\n\\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\\n /// @dev Change the address of the trusted forwarder for meta-TX\\n /// @param trustedForwarder The new trustedForwarder\\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n require(trustedForwarder != address(0), \\\"Asset: trusted forwarder can't be zero address\\\");\\n _trustedForwarder = trustedForwarder;\\n emit TrustedForwarderChanged(trustedForwarder);\\n }\\n\\n /// @notice Query if a contract implements interface `id`.\\n /// @param id the interface identifier, as specified in ERC-165.\\n /// @return `true` if the contract implements `id`.\\n function supportsInterface(bytes4 id)\\n public\\n view\\n virtual\\n override(ERC1155Upgradeable, AccessControlUpgradeable, MultiRoyaltyDistributor)\\n returns (bool)\\n {\\n return\\n id == type(IRoyaltyUGC).interfaceId ||\\n id == 0x572b6c05 || // ERC2771\\n super.supportsInterface(id);\\n }\\n\\n function _msgSender() internal view virtual override(ContextUpgradeable, ERC2771Handler) returns (address sender) {\\n return ERC2771Handler._msgSender();\\n }\\n\\n function _msgData() internal view virtual override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\\n return ERC2771Handler._msgData();\\n }\\n\\n function _beforeTokenTransfer(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) {\\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\\n }\\n\\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\\n /// @dev call data should be optimized to order ids so packedBalance can be used efficiently.\\n /// @param from address from which tokens are transfered.\\n /// @param to address to which the token will be transfered.\\n /// @param ids ids of each token type transfered.\\n /// @param amounts amount of each token type transfered.\\n /// @param data aditional data accompanying the transfer.\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) public virtual override onlyAllowedOperator(from) {\\n super.safeBatchTransferFrom(from, to, ids, amounts, data);\\n }\\n\\n /// @notice Enable or disable approval for `operator` to manage all of the caller's tokens.\\n /// @param operator address which will be granted rights to transfer all tokens of the caller.\\n /// @param approved whether to approve or revoke\\n function setApprovalForAll(address operator, bool approved)\\n public\\n virtual\\n override\\n onlyAllowedOperatorApproval(operator)\\n {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\\n /// @param from address from which tokens are transfered.\\n /// @param to address to which the token will be transfered.\\n /// @param id the token type transfered.\\n /// @param amount amount of token transfered.\\n /// @param data aditional data accompanying the transfer.\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) public virtual override onlyAllowedOperator(from) {\\n require(\\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\\n \\\"ERC1155: caller is not token owner or approved\\\"\\n );\\n _safeTransferFrom(from, to, id, amount, data);\\n }\\n\\n /// @notice could be used to deploy splitter and set tokens royalties\\n /// @param tokenId the id of the token for which the EIP2981 royalty is set for.\\n /// @param recipient the royalty recipient for the splitter of the creator.\\n /// @param creator the creactor of the tokens.\\n function setTokenRoyalties(\\n uint256 tokenId,\\n address payable recipient,\\n address creator\\n ) external override onlyRole(DEFAULT_ADMIN_ROLE) {\\n _setTokenRoyalties(tokenId, recipient, creator);\\n }\\n\\n /// @notice Extracts the creator address from a given token id\\n /// @param tokenId The token id to extract the creator address from\\n /// @return creator The asset creator address\\n function getCreatorAddress(uint256 tokenId) external pure returns (address creator) {\\n return TokenIdUtils.getCreatorAddress(tokenId);\\n }\\n\\n /// @notice Extracts the tier from a given token id\\n /// @param tokenId The token id to extract the tier from\\n /// @return tier The asset tier, determined by the catalyst used to create it\\n function getTier(uint256 tokenId) external pure returns (uint8 tier) {\\n return TokenIdUtils.getTier(tokenId);\\n }\\n\\n /// @notice Extracts the revealed flag from a given token id\\n /// @param tokenId The token id to extract the revealed flag from\\n /// @return isRevealed Whether the asset is revealed or not\\n function isRevealed(uint256 tokenId) external pure returns (bool) {\\n return TokenIdUtils.isRevealed(tokenId);\\n }\\n\\n /// @notice Extracts the asset nonce from a given token id\\n /// @param tokenId The token id to extract the asset nonce from\\n /// @return creatorNonce The asset creator nonce\\n function getCreatorNonce(uint256 tokenId) external pure returns (uint16) {\\n return TokenIdUtils.getCreatorNonce(tokenId);\\n }\\n\\n /// @notice Extracts the abilities and enhancements hash from a given token id\\n /// @param tokenId The token id to extract reveal nonce from\\n /// @return revealNonce The reveal nonce of the asset\\n function getRevealNonce(uint256 tokenId) external pure returns (uint16) {\\n return TokenIdUtils.getRevealNonce(tokenId);\\n }\\n\\n /// @notice Extracts the bridged flag from a given token id\\n /// @param tokenId The token id to extract the bridged flag from\\n /// @return bridged Whether the asset is bridged or not\\n function isBridged(uint256 tokenId) external pure returns (bool) {\\n return TokenIdUtils.isBridged(tokenId);\\n }\\n\\n /// @notice This function is used to register Asset contract on the Operator Filterer Registry of Opensea.can only be called by admin.\\n /// @dev used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.\\n /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe.\\n /// @param subscribe bool to signify subscription \\\"true\\\"\\\" or to copy the list \\\"false\\\".\\n function registerAndSubscribe(address subscriptionOrRegistrantToCopy, bool subscribe)\\n external\\n onlyRole(DEFAULT_ADMIN_ROLE)\\n {\\n require(subscriptionOrRegistrantToCopy != address(0), \\\"Asset: subscription can't be zero address\\\");\\n _registerAndSubscribe(subscriptionOrRegistrantToCopy, subscribe);\\n }\\n\\n /// @notice sets filter registry address deployed in test\\n /// @param registry the address of the registry\\n function setOperatorRegistry(address registry) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n require(registry != address(0), \\\"Asset: registry can't be zero address\\\");\\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\\n }\\n}\\n\",\"keccak256\":\"0x5de7a2126a7cda3f9b8b52062025b3ff70cd202bc0c583e7a19cc6c1ea30d48e\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/ERC2771Handler.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\n/// @dev minimal ERC2771 handler to keep bytecode-size down\\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.6.0/contracts/metatx/ERC2771Context.sol\\n/// with an initializer for proxies and a mutable forwarder\\n\\nabstract contract ERC2771Handler {\\n address internal _trustedForwarder;\\n\\n function __ERC2771Handler_initialize(address forwarder) internal {\\n _trustedForwarder = forwarder;\\n }\\n\\n function isTrustedForwarder(address forwarder) public view returns (bool) {\\n return forwarder == _trustedForwarder;\\n }\\n\\n function getTrustedForwarder() external view returns (address trustedForwarder) {\\n return _trustedForwarder;\\n }\\n\\n function _msgSender() internal view virtual returns (address sender) {\\n if (isTrustedForwarder(msg.sender)) {\\n // The assembly code is more direct than the Solidity version using `abi.decode`.\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\\n }\\n } else {\\n return msg.sender;\\n }\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n if (isTrustedForwarder(msg.sender)) {\\n return msg.data[:msg.data.length - 20];\\n } else {\\n return msg.data;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb14f384116bdc60b5fc789de2280bccee214c967416cee1b30fb03e0ce4442d5\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/interfaces/IAsset.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface IAsset {\\n // AssetData reflects the asset tokenId structure\\n // Refer to TokenIdUtils.sol\\n struct AssetData {\\n uint256 tokenId;\\n address creator;\\n uint256 amount;\\n uint8 tier;\\n uint16 creatorNonce;\\n bool revealed;\\n string metadataHash;\\n bool bridged;\\n }\\n\\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\\n\\n // Functions\\n function mint(\\n address to,\\n uint256 id,\\n uint256 amount,\\n string memory metadataHash\\n ) external;\\n\\n function mintBatch(\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n string[] memory metadataHashes\\n ) external;\\n\\n function burnFrom(\\n address account,\\n uint256 id,\\n uint256 amount\\n ) external;\\n\\n function burnBatchFrom(\\n address account,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external;\\n\\n function getTokenIdByMetadataHash(string memory metadataHash) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x2abd2e550ced35090c988e432215f990bf8f192cc346ffac6778fde0025a8206\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/interfaces/ITokenUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport {IRoyaltyUGC} from \\\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyUGC.sol\\\";\\n\\ninterface ITokenUtils is IRoyaltyUGC {\\n function getTier(uint256 tokenId) external pure returns (uint8 tier);\\n\\n function isRevealed(uint256 tokenId) external pure returns (bool);\\n\\n function getCreatorNonce(uint256 tokenId) external pure returns (uint16);\\n\\n function getRevealNonce(uint256 tokenId) external pure returns (uint16);\\n\\n function isBridged(uint256 tokenId) external pure returns (bool);\\n}\\n\",\"keccak256\":\"0x04b5c64d755016f18cd8422dda072eae8a5151402631723e2cccedc623b7bb66\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/libraries/TokenIdUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {IAsset} from \\\"../interfaces/IAsset.sol\\\";\\n\\nlibrary TokenIdUtils {\\n // Layer masks\\n uint256 public constant TIER_MASK = 0xFF;\\n uint256 public constant NONCE_MASK = 0xFFFF;\\n uint256 public constant REVEAL_NONCE_MASK = 0xFFFF;\\n uint256 public constant BRIDGED_MASK = 0x1;\\n\\n // Bit shifts\\n uint256 public constant CREATOR_SHIFT = 0;\\n uint256 public constant TIER_SHIFT = 160;\\n uint256 public constant NONCE_SHIFT = 168;\\n uint256 public constant REVEAL_NONCE_SHIFT = 184;\\n uint256 public constant BRIDGED_SHIFT = 200;\\n\\n /// @notice Generates a token id for a given asset\\n /// @dev The token id is generated by concatenating the following fields:\\n /// @dev creator address, chain index, tier, asset nonce, reveal nonce and bridged boolean\\n /// @dev The first 160 bits are the creator address\\n /// @dev The next 8 bits are the chain index\\n /// @dev The next 8 bits are the tier\\n /// @dev The next 16 bits are the asset nonce\\n /// @dev The next 16 bits are assets reveal nonce.\\n /// @param creator The address of the creator of the asset\\n /// @param tier The tier of the asset determined by the catalyst used to create it\\n /// @param creatorNonce The nonce of the asset creator\\n /// @param revealNonce The reveal nonce of the asset\\n /// @param bridged Whether the asset is bridged or not\\n /// @return tokenId The generated token id\\n function generateTokenId(\\n address creator,\\n uint8 tier,\\n uint16 creatorNonce,\\n uint16 revealNonce,\\n bool bridged\\n ) internal pure returns (uint256 tokenId) {\\n uint160 creatorAddress = uint160(creator);\\n\\n tokenId = tokenId =\\n uint256(creatorAddress) |\\n (uint256(tier) << TIER_SHIFT) |\\n (uint256(creatorNonce) << NONCE_SHIFT) |\\n (uint256(revealNonce) << REVEAL_NONCE_SHIFT) |\\n (uint256(bridged ? 1 : 0) << BRIDGED_SHIFT);\\n\\n return tokenId;\\n }\\n\\n /// @notice Extracts the creator address from a given token id\\n /// @param tokenId The token id to extract the creator address from\\n /// @return creator The asset creator address\\n function getCreatorAddress(uint256 tokenId) internal pure returns (address creator) {\\n creator = address(uint160(tokenId));\\n return creator;\\n }\\n\\n /// @notice Extracts the tier from a given token id\\n /// @param tokenId The token id to extract the tier from\\n /// @return tier The asset tier, determined by the catalyst used to create it\\n function getTier(uint256 tokenId) internal pure returns (uint8 tier) {\\n tier = uint8((tokenId >> TIER_SHIFT) & TIER_MASK);\\n return tier;\\n }\\n\\n /// @notice Extracts the revealed flag from a given token id\\n /// @param tokenId The token id to extract the revealed flag from\\n /// @return isRevealed Whether the asset is revealed or not\\n function isRevealed(uint256 tokenId) internal pure returns (bool) {\\n uint16 revealNonce = getRevealNonce(tokenId);\\n return revealNonce != 0;\\n }\\n\\n /// @notice Extracts the asset nonce from a given token id\\n /// @param tokenId The token id to extract the asset nonce from\\n /// @return creatorNonce The asset creator nonce\\n function getCreatorNonce(uint256 tokenId) internal pure returns (uint16) {\\n uint16 creatorNonce = uint16((tokenId >> NONCE_SHIFT) & NONCE_MASK);\\n return creatorNonce;\\n }\\n\\n /// @notice Extracts the abilities and enhancements hash from a given token id\\n /// @param tokenId The token id to extract reveal nonce from\\n /// @return revealNonce The reveal nonce of the asset\\n function getRevealNonce(uint256 tokenId) internal pure returns (uint16) {\\n uint16 revealNonce = uint16((tokenId >> REVEAL_NONCE_SHIFT) & REVEAL_NONCE_MASK);\\n return revealNonce;\\n }\\n\\n /// @notice Extracts the bridged flag from a given token id\\n /// @param tokenId The token id to extract the bridged flag from\\n /// @return bridged Whether the asset is bridged or not\\n function isBridged(uint256 tokenId) internal pure returns (bool) {\\n bool bridged = ((tokenId >> BRIDGED_SHIFT) & BRIDGED_MASK) == 1;\\n return bridged;\\n }\\n\\n /// @notice Extracts the asset data from a given token id\\n /// @dev Created to limit the number of functions that need to be called when revealing an asset\\n /// @param tokenId The token id to extract the asset data from\\n function getData(uint256 tokenId) internal pure returns (IAsset.AssetData memory data) {\\n data.creator = getCreatorAddress(tokenId);\\n data.tier = getTier(tokenId);\\n data.revealed = isRevealed(tokenId);\\n data.creatorNonce = getCreatorNonce(tokenId);\\n data.bridged = isBridged(tokenId);\\n }\\n}\\n\",\"keccak256\":\"0x82f6bb065e85497d5486bcecb162c30df83941262ff5ac3fd8e283e946250839\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {IOperatorFilterRegistry} from \\\"./interfaces/IOperatorFilterRegistry.sol\\\";\\n\\n///@title OperatorFiltererUpgradeable\\n///@author The SandBox\\n///@notice This contract would subscibe or copy or just to the subscription provided or just register to default subscription list. The operator filter registry's addess could be set using a setter which could be implemented in inherting contract\\nabstract contract OperatorFiltererUpgradeable is Initializable {\\n IOperatorFilterRegistry public operatorFilterRegistry;\\n\\n function __OperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe) internal onlyInitializing {\\n operatorFilterRegistry = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); // Address of the operator filterer registry\\n // If an inheriting token contract is deployed to a network without the registry deployed, the modifier\\n // will not revert, but the contract will need to be registered with the registry once it is deployed in\\n // order for the modifier to filter addresses.\\n _registerAndSubscribe(subscriptionOrRegistrantToCopy, subscribe);\\n }\\n\\n function _registerAndSubscribe(address subscriptionOrRegistrantToCopy, bool subscribe) internal {\\n if (address(operatorFilterRegistry).code.length > 0) {\\n if (!operatorFilterRegistry.isRegistered(address(this))) {\\n if (subscribe) {\\n operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);\\n } else {\\n if (subscriptionOrRegistrantToCopy != address(0)) {\\n operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);\\n } else {\\n operatorFilterRegistry.register(address(this));\\n }\\n }\\n }\\n }\\n }\\n\\n modifier onlyAllowedOperator(address from) virtual {\\n // Check registry code length to facilitate testing in environments without a deployed registry.\\n if (address(operatorFilterRegistry).code.length > 0) {\\n // Allow spending tokens from addresses with balance\\n // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred\\n // from an EOA.\\n if (from == msg.sender) {\\n _;\\n return;\\n }\\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), msg.sender)) {\\n revert(\\\"Operator Not Allowed\\\");\\n }\\n }\\n _;\\n }\\n\\n modifier onlyAllowedOperatorApproval(address operator) virtual {\\n // Check registry code length to facilitate testing in environments without a deployed registry.\\n if (address(operatorFilterRegistry).code.length > 0) {\\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), operator)) {\\n revert(\\\"Operator Not Allowed\\\");\\n }\\n }\\n _;\\n }\\n}\\n\",\"keccak256\":\"0xf6ef88f614515540138818e5a41c4765445b8f4650713476b2f0435af61e70eb\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-operator-filter/contracts/interfaces/IOperatorFilterRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IOperatorFilterRegistry {\\n /**\\n * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns\\n * true if supplied registrant address is not registered.\\n */\\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\\n\\n /**\\n * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.\\n */\\n function register(address registrant) external;\\n\\n /**\\n * @notice Registers an address with the registry and \\\"subscribes\\\" to another address's filtered operators and codeHashes.\\n */\\n function registerAndSubscribe(address registrant, address subscription) external;\\n\\n /**\\n * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another\\n * address without subscribing.\\n */\\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\\n\\n /**\\n * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.\\n * Note that this does not remove any filtered addresses or codeHashes.\\n * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.\\n */\\n function unregister(address addr) external;\\n\\n /**\\n * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered.\\n */\\n function updateOperator(\\n address registrant,\\n address operator,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.\\n */\\n function updateOperators(\\n address registrant,\\n address[] calldata operators,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.\\n */\\n function updateCodeHash(\\n address registrant,\\n bytes32 codehash,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.\\n */\\n function updateCodeHashes(\\n address registrant,\\n bytes32[] calldata codeHashes,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous\\n * subscription if present.\\n * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,\\n * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be\\n * used.\\n */\\n function subscribe(address registrant, address registrantToSubscribe) external;\\n\\n /**\\n * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.\\n */\\n function unsubscribe(address registrant, bool copyExistingEntries) external;\\n\\n /**\\n * @notice Get the subscription address of a given registrant, if any.\\n */\\n function subscriptionOf(address addr) external returns (address registrant);\\n\\n /**\\n * @notice Get the set of addresses subscribed to a given registrant.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function subscribers(address registrant) external returns (address[] memory);\\n\\n /**\\n * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function subscriberAt(address registrant, uint256 index) external returns (address);\\n\\n /**\\n * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.\\n */\\n function copyEntriesOf(address registrant, address registrantToCopy) external;\\n\\n /**\\n * @notice Returns true if operator is filtered by a given address or its subscription.\\n */\\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\\n\\n /**\\n * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription.\\n */\\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\\n\\n /**\\n * @notice Returns true if a codeHash is filtered by a given address or its subscription.\\n */\\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\\n\\n /**\\n * @notice Returns a list of filtered operators for a given address or its subscription.\\n */\\n function filteredOperators(address addr) external returns (address[] memory);\\n\\n /**\\n * @notice Returns the set of filtered codeHashes for a given address or its subscription.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\\n\\n /**\\n * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or\\n * its subscription.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\\n\\n /**\\n * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or\\n * its subscription.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\\n\\n /**\\n * @notice Returns true if an address has registered\\n */\\n function isRegistered(address addr) external returns (bool);\\n\\n /**\\n * @dev Convenience method to compute the code hash of an arbitrary contract\\n */\\n function codeHashOf(address addr) external returns (bytes32);\\n}\\n\",\"keccak256\":\"0xbb4f80a4688ec5c4057fcf1e93d1683cee27bbc2eb9ba45fe02664057a4a14c6\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/MultiRoyaltyDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {ERC165Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\\\";\\nimport {EnumerableSet} from \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\nimport {Clones} from \\\"@openzeppelin/contracts/proxy/Clones.sol\\\";\\nimport {IMultiRoyaltyDistributor, IMultiRoyaltyRecipients} from \\\"./interfaces/IMultiRoyaltyDistributor.sol\\\";\\nimport {\\n IRoyaltySplitter,\\n IERC165\\n} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\nimport {IEIP2981} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/specs/IEIP2981.sol\\\";\\nimport {IRoyaltyManager, Recipient} from \\\"./interfaces/IRoyaltyManager.sol\\\";\\n\\n/// @title MultiRoyaltyDistributer\\n/// @author The Sandbox\\n/// @dev The MultiRoyaltyDistributer contract implements the ERC-2981 and ERC-165 interfaces for a royalty payment system. This payment system can be used to pay royalties to multiple recipients through splitters.\\n/// @dev This contract calls to the Royalties manager contract to deploy RoyaltySplitter for a creator to slip its royalty between the creator and Sandbox and use it for every token minted by that creator.\\nabstract contract MultiRoyaltyDistributor is IEIP2981, IMultiRoyaltyDistributor, ERC165Upgradeable {\\n uint16 internal constant TOTAL_BASIS_POINTS = 10000;\\n address public royaltyManager;\\n\\n mapping(uint256 => address payable) public _tokenRoyaltiesSplitter;\\n uint256[] private _tokensWithRoyalties;\\n\\n function __MultiRoyaltyDistributor_init(address _royaltyManager) internal {\\n royaltyManager = _royaltyManager;\\n }\\n\\n /// @notice EIP 165 interface function\\n /// @dev used to check the interface implemented\\n /// @param interfaceId to be checked for implementation\\n function supportsInterface(bytes4 interfaceId)\\n public\\n view\\n virtual\\n override(ERC165Upgradeable, IERC165)\\n returns (bool)\\n {\\n return\\n interfaceId == type(IEIP2981).interfaceId ||\\n interfaceId == type(IMultiRoyaltyDistributor).interfaceId ||\\n interfaceId == type(IMultiRoyaltyRecipients).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /// @notice sets token royalty\\n /// @dev deploys a splitter if a creator doesn't have one\\n /// @param tokenId id of token\\n /// @param creator of the token\\n function _setTokenRoyalties(\\n uint256 tokenId,\\n address payable recipient,\\n address creator\\n ) internal {\\n address payable creatorSplitterAddress = IRoyaltyManager(royaltyManager).deploySplitter(creator, recipient);\\n _tokenRoyaltiesSplitter[tokenId] = creatorSplitterAddress;\\n _tokensWithRoyalties.push(tokenId);\\n emit TokenRoyaltySet(tokenId, recipient);\\n }\\n\\n /// @notice Returns royalty receivers and their split of royalty for each token\\n /// @return royaltyConfigs receivers and their split array as long as the number of tokens.\\n function getTokenRoyalties() external view override returns (TokenRoyaltyConfig[] memory royaltyConfigs) {\\n royaltyConfigs = new TokenRoyaltyConfig[](_tokensWithRoyalties.length);\\n for (uint256 i; i < _tokensWithRoyalties.length; ++i) {\\n TokenRoyaltyConfig memory royaltyConfig;\\n uint256 tokenId = _tokensWithRoyalties[i];\\n address splitterAddress = _tokenRoyaltiesSplitter[tokenId];\\n if (splitterAddress != address(0)) {\\n royaltyConfig.recipients = IRoyaltySplitter(splitterAddress).getRecipients();\\n }\\n royaltyConfig.tokenId = tokenId;\\n royaltyConfigs[i] = royaltyConfig;\\n }\\n }\\n\\n /// @notice EIP 2981 royalty info function to return the royalty receiver and royalty amount\\n /// @param tokenId of the token for which the royalty is needed to be distributed\\n /// @param value the amount on which the royalty is calculated\\n /// @return address the royalty receiver\\n /// @return value the EIP2981 royalty\\n function royaltyInfo(uint256 tokenId, uint256 value) public view override returns (address, uint256) {\\n (address payable _defaultRoyaltyReceiver, uint16 _defaultRoyaltyBPS) =\\n IRoyaltyManager(royaltyManager).getRoyaltyInfo();\\n if (_tokenRoyaltiesSplitter[tokenId] != address(0)) {\\n return (_tokenRoyaltiesSplitter[tokenId], (value * _defaultRoyaltyBPS) / TOTAL_BASIS_POINTS);\\n }\\n if (_defaultRoyaltyReceiver != address(0) && _defaultRoyaltyBPS != 0) {\\n return (_defaultRoyaltyReceiver, (value * _defaultRoyaltyBPS) / TOTAL_BASIS_POINTS);\\n }\\n return (address(0), 0);\\n }\\n\\n /// @notice returns the EIP-2981 royalty receiver for each token (i.e. splitters) including the default royalty receiver.\\n /// @return splits the royalty receiver's array\\n function getAllSplits() external view override returns (address payable[] memory splits) {\\n uint256 startingIndex;\\n uint256 endingIndex = _tokensWithRoyalties.length;\\n (address payable _defaultRoyaltyReceiver, ) = IRoyaltyManager(royaltyManager).getRoyaltyInfo();\\n if (_defaultRoyaltyReceiver != address(0)) {\\n splits = new address payable[](1 + _tokensWithRoyalties.length);\\n splits[0] = _defaultRoyaltyReceiver;\\n startingIndex = 1;\\n ++endingIndex;\\n } else {\\n // unreachable in practice\\n splits = new address payable[](_tokensWithRoyalties.length);\\n }\\n for (uint256 i = startingIndex; i < endingIndex; ++i) {\\n splits[i] = _tokenRoyaltiesSplitter[_tokensWithRoyalties[i - startingIndex]];\\n }\\n }\\n\\n /// @notice returns the royalty recipients for each tokenId.\\n /// @dev returns the default address for tokens with no recipients.\\n /// @param tokenId is the token id for which the recipient should be returned.\\n /// @return addresses of royalty recipient of the token.\\n function getRecipients(uint256 tokenId) public view returns (Recipient[] memory) {\\n address payable splitterAddress = _tokenRoyaltiesSplitter[tokenId];\\n (address payable _defaultRoyaltyReceiver, ) = IRoyaltyManager(royaltyManager).getRoyaltyInfo();\\n if (splitterAddress != address(0)) {\\n return IRoyaltySplitter(splitterAddress).getRecipients();\\n }\\n Recipient[] memory defaultRecipient = new Recipient[](1);\\n defaultRecipient[0] = Recipient({recipient: _defaultRoyaltyReceiver, bps: TOTAL_BASIS_POINTS});\\n return defaultRecipient;\\n }\\n}\\n\",\"keccak256\":\"0x59272aee3bab952e4af9b5c28ce60cda251e2c08582795e4fc7321e643b92205\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IMultiRoyaltyDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {IMultiRoyaltyRecipients} from \\\"./IMultiRoyaltyRecipients.sol\\\";\\nimport {\\n IRoyaltySplitter,\\n Recipient\\n} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\n\\n/**\\n * Multi-receiver EIP2981 reference override implementation\\n */\\ninterface IMultiRoyaltyDistributor is IERC165, IMultiRoyaltyRecipients {\\n event TokenRoyaltyRemoved(uint256 tokenId);\\n event TokenRoyaltySet(uint256 tokenId, address recipient);\\n event DefaultRoyaltyBpsSet(uint16 royaltyBPS);\\n\\n event DefaultRoyaltyReceiverSet(address recipient);\\n\\n event RoyaltyRecipientSet(address splitter, address recipient);\\n\\n struct TokenRoyaltyConfig {\\n uint256 tokenId;\\n uint16 royaltyBPS;\\n Recipient[] recipients;\\n }\\n\\n /**\\n * @dev Set per token royalties. Passing a recipient of address(0) will delete any existing configuration\\n */\\n function setTokenRoyalties(\\n uint256 tokenId,\\n address payable recipient,\\n address creator\\n ) external;\\n\\n /**\\n * @dev Get all token royalty configurations\\n */\\n function getTokenRoyalties() external view returns (TokenRoyaltyConfig[] memory);\\n\\n /**\\n * @dev Helper function to get all splits contracts\\n */\\n function getAllSplits() external view returns (address payable[] memory);\\n}\\n\",\"keccak256\":\"0x8b3ef711d6cb368d65ac7c6c5b617cab63b918ef474da891527f7e176c480f9f\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IMultiRoyaltyRecipients.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {Recipient} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\n\\n/**\\n * Multi-receiver EIP2981 reference override implementation\\n */\\ninterface IMultiRoyaltyRecipients is IERC165 {\\n /**\\n * @dev Helper function to get all recipients\\n */\\n function getRecipients(uint256 tokenId) external view returns (Recipient[] memory);\\n}\\n\",\"keccak256\":\"0x06f13c04f2840fdec87edbb15f4805977f8d18562e942cad023fe65685369ebf\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {Recipient} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\n\\ninterface IRoyaltyManager {\\n event RecipientSet(address commonRecipient);\\n\\n event SplitSet(uint16 commonSplit);\\n\\n event RoyaltySet(uint16 royaltyBps, address contractAddress);\\n\\n function setRecipient(address payable _commonRecipient) external;\\n\\n function setSplit(uint16 commonSplit) external;\\n\\n function getCommonRecipient() external view returns (Recipient memory recipient);\\n\\n function getCreatorSplit() external view returns (uint16);\\n\\n function getRoyaltyInfo() external view returns (address payable, uint16);\\n\\n function deploySplitter(address creator, address payable recipient) external returns (address payable);\\n\\n function getCreatorRoyaltySplitter(address creator) external view returns (address payable);\\n\\n function getContractRoyalty(address _contractAddress) external view returns (uint16 royaltyBps);\\n}\\n\",\"keccak256\":\"0x1f6fdc5bfbb8962735c03f6881670f147ca90443cf09934e338cdb0585cb8cd2\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyUGC.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IRoyaltyUGC {\\n function getCreatorAddress(uint256 tokenId) external pure returns (address creator);\\n}\\n\",\"keccak256\":\"0xa43870e62369bafb23450ad5e3948906ee832adcc5b8f1812c802533ea6f32a0\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e3565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b614f2880620000f36000396000f3fe608060405234801561001057600080fd5b506004361061032a5760003560e01c806381de2dc2116101b2578063bb7fde71116100f9578063da742228116100a2578063f242432a1161007c578063f242432a1461081c578063f5298aca1461082f578063fd90e89714610842578063fdda1d0e1461086257600080fd5b8063da742228146107b9578063e985e9c5146107cc578063ee295d621461080857600080fd5b8063ce1b815f116100d3578063ce1b815f14610768578063d53913931461077f578063d547741f146107a657600080fd5b8063bb7fde7114610720578063bd85b03914610733578063befa66451461075357600080fd5b8063a22cb4651161015b578063abe3960311610135578063abe39603146106cd578063ac4a0fb6146106f9578063b0ccc31e1461070c57600080fd5b8063a22cb46514610694578063a30b4db9146106a7578063a55784ef146106ba57600080fd5b806397905c1e1161018c57806397905c1e146106645780639d28fb8614610679578063a217fddf1461068c57600080fd5b806381de2dc21461060557806391d1485414610618578063933f39581461065157600080fd5b806336568abe1161027657806355f804b31161021f5780636b566cb2116101f95780636b566cb214610589578063791459ea146105cb578063797669c9146105de57600080fd5b806355f804b31461053b578063572b6c051461054e5780636b20c4541461057657600080fd5b80634f124995116102505780634f124995146104f35780634f558e79146105065780635055fbc31461052857600080fd5b806336568abe1461049b5780634e1273f4146104ae5780634f062c5a146104ce57600080fd5b8063248a9ca3116102d85780632a55205a116102b25780632a55205a146104435780632eb2c2d6146104755780632f2ff15d1461048857600080fd5b8063248a9ca3146103d3578063282c51f3146103f65780632a41a3551461041d57600080fd5b8063124d91e511610309578063124d91e514610398578063162094c4146103ad57806320820ec3146103c057600080fd5b8062fdd58e1461032f57806301ffc9a7146103555780630e89341c14610378575b600080fd5b61034261033d366004613ed1565b610875565b6040519081526020015b60405180910390f35b610368610363366004613f13565b610923565b604051901515815260200161034c565b61038b610386366004613f30565b610995565b60405161034c9190613f99565b6103ab6103a6366004613fac565b6109a0565b005b6103ab6103bb3660046140be565b6109db565b6103ab6103ce36600461419a565b610a14565b6103426103e1366004613f30565b600090815260c9602052604090206001015490565b6103427f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84881565b61043061042b366004613f30565b610a49565b60405161ffff909116815260200161034c565b610456610451366004614210565b610a59565b604080516001600160a01b03909316835260208301919091520161034c565b6103ab610483366004614232565b610b7b565b6103ab6104963660046142e0565b610c86565b6103ab6104a93660046142e0565b610cab565b6104c16104bc366004614310565b610d47565b60405161034c919061440e565b6104e16104dc366004613f30565b610e85565b60405160ff909116815260200161034c565b6103ab610501366004614421565b610e94565b610368610514366004613f30565b600090815260fb6020526040902054151590565b610368610536366004613f30565b610eaa565b6103ab610549366004614463565b610eb5565b61036861055c366004614498565b6000546201000090046001600160a01b0390811691161490565b6103ab61058436600461419a565b610ec9565b6105b3610597366004613f30565b610161602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200161034c565b6103ab6105d93660046144c3565b610f65565b6103427f71f3d55856e4058ed06ee057d79ada615f65cdf5f9ee88181b914225088f834f81565b610430610613366004613f30565b610ff6565b6103686106263660046142e0565b600091825260c9602090815260408084206001600160a01b0393909316845291905290205460ff1690565b61036861065f366004613f30565b611006565b61066c611017565b60405161034c9190614539565b6103ab610687366004614498565b61119d565b610342600081565b6103ab6106a23660046144c3565b61123d565b6105b36106b5366004613f30565b611325565b6103ab6106c83660046145da565b61132d565b6103426106db366004614463565b80516020818301810180516101638252928201919093012091525481565b6103ab6107073660046146f2565b611522565b61015f546105b3906001600160a01b031681565b6103ab61072e36600461477c565b6116d6565b610342610741366004613f30565b600090815260fb602052604090205490565b61075b611731565b60405161034c91906147df565b6000546201000090046001600160a01b03166105b3565b6103427f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6103ab6107b43660046142e0565b61194b565b6103ab6107c7366004614498565b611970565b6103686107da36600461482c565b6001600160a01b03918216600090815260666020908152604080832093909416825291909152205460ff1690565b610160546105b3906001600160a01b031681565b6103ab61082a36600461485a565b611a60565b6103ab61083d366004613fac565b611c80565b610855610850366004613f30565b611d1c565b60405161034c91906148c3565b610342610870366004614463565b611ec1565b60006001600160a01b0383166108f85760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201527f616c6964206f776e65720000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b5060008181526065602090815260408083206001600160a01b03861684529091529020545b92915050565b60006001600160e01b031982167fa30b4db900000000000000000000000000000000000000000000000000000000148061098657507f572b6c05000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b8061091d575061091d82611eea565b606061091d82611f90565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a8486109ca81612072565b6109d5848484612086565b50505050565b7f71f3d55856e4058ed06ee057d79ada615f65cdf5f9ee88181b914225088f834f610a0581612072565b610a0f838361225d565b505050565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848610a3e81612072565b6109d58484846122bb565b600061091d8260b81c61ffff1690565b60008060008061016060009054906101000a90046001600160a01b03166001600160a01b031663a86a28d16040518163ffffffff1660e01b81526004016040805180830381865afa158015610ab2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad691906148ed565b6000888152610161602052604090205491935091506001600160a01b031615610b3857600086815261016160205260409020546001600160a01b0316612710610b2361ffff841688614938565b610b2d919061494f565b935093505050610b74565b6001600160a01b03821615801590610b53575061ffff811615155b15610b6a5781612710610b2361ffff841688614938565b6000809350935050505b9250929050565b61015f5485906001600160a01b03163b15610c7157336001600160a01b03821603610bb257610bad868686868661254d565b610c7e565b61015f54604051633185c44d60e21b81523060048201523360248201526001600160a01b039091169063c617113490604401602060405180830381865afa158015610c01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c259190614971565b610c715760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f77656400000000000000000000000060448201526064016108ef565b610c7e868686868661254d565b505050505050565b600082815260c96020526040902060010154610ca181612072565b610a0f83836125f2565b610cb3612695565b6001600160a01b0316816001600160a01b031614610d395760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016108ef565b610d4382826126a4565b5050565b60608151835114610dc05760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d61746368000000000000000000000000000000000000000000000060648201526084016108ef565b6000835167ffffffffffffffff811115610ddc57610ddc613fe1565b604051908082528060200260200182016040528015610e05578160200160208202803683370190505b50905060005b8451811015610e7d57610e50858281518110610e2957610e2961498e565b6020026020010151858381518110610e4357610e4361498e565b6020026020010151610875565b828281518110610e6257610e6261498e565b6020908102919091010152610e76816149a4565b9050610e0b565b509392505050565b600061091d8260a01c60ff1690565b6000610e9f81612072565b6109d5848484612745565b600061091d82612897565b6000610ec081612072565b610d43826128b5565b610ed1612695565b6001600160a01b0316836001600160a01b03161480610ef75750610ef7836107da612695565b610f5a5760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108ef565b610a0f8383836122bb565b6000610f7081612072565b6001600160a01b038316610fec5760405162461bcd60e51b815260206004820152602960248201527f41737365743a20737562736372697074696f6e2063616e2774206265207a657260448201527f6f2061646472657373000000000000000000000000000000000000000000000060648201526084016108ef565b610a0f83836128c2565b600061091d8260a81c61ffff1690565b6000600160c883901c81161461091d565b6101625460609067ffffffffffffffff81111561103657611036613fe1565b60405190808252806020026020018201604052801561108357816020015b604080516060808201835260008083526020830152918101919091528152602001906001900390816110545790505b50905060005b610162548110156111995760408051606080820183526000808352602083015291810191909152600061016283815481106110c6576110c661498e565b60009182526020808320909101548083526101619091526040909120549091506001600160a01b0316801561116157806001600160a01b031663d78d610b6040518163ffffffff1660e01b8152600401600060405180830381865afa158015611133573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261115b91908101906149be565b60408401525b8183528451839086908690811061117a5761117a61498e565b602002602001018190525050505080611192906149a4565b9050611089565b5090565b60006111a881612072565b6001600160a01b03821661120c5760405162461bcd60e51b815260206004820152602560248201527f41737365743a2072656769737472792063616e2774206265207a65726f206164604482015264647265737360d81b60648201526084016108ef565b5061015f805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b61015f5482906001600160a01b03163b156113135761015f54604051633185c44d60e21b81523060048201526001600160a01b0383811660248301529091169063c617113490604401602060405180830381865afa1580156112a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c79190614971565b6113135760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f77656400000000000000000000000060448201526064016108ef565b610a0f61131e612695565b8484612a8e565b60008161091d565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661135781612072565b81518451146113ce5760405162461bcd60e51b815260206004820152602b60248201527f41737365743a2069647320616e64206d6574616461746148617368206c656e6760448201527f7468206d69736d6174636800000000000000000000000000000000000000000060648201526084016108ef565b82518451146114455760405162461bcd60e51b815260206004820152602660248201527f41737365743a2069647320616e6420616d6f756e7473206c656e677468206d6960448201527f736d61746368000000000000000000000000000000000000000000000000000060648201526084016108ef565b60005b845181101561149f5761148d8582815181106114665761146661498e565b60200260200101518483815181106114805761148061498e565b6020026020010151612b82565b80611497816149a4565b915050611448565b506114bb85858560405180602001604052806000815250612c69565b60005b8451811015610c7e5760006114e98683815181106114de576114de61498e565b602002602001015190565b905061150f8683815181106115005761150061498e565b60200260200101518283612745565b508061151a816149a4565b9150506114be565b600054610100900460ff16158080156115425750600054600160ff909116105b8061155c5750303b15801561155c575060005460ff166001145b6115ce5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016108ef565b6000805460ff1916600117905580156115f1576000805461ff0019166101001790555b6115fa846128b5565b611602612e66565b61160a612e66565b600080547fffffffffffffffffffff0000000000000000000000000000000000000000ffff16620100006001600160a01b0389160217905561164a612e66565b6116556000866125f2565b611660836001612ee5565b610160805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384161790558015610c7e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661170081612072565b61170a8483612b82565b61172585858560405180602001604052806000815250612f9a565b83610c7e818080612745565b6101625461016054604080517fa86a28d10000000000000000000000000000000000000000000000000000000081528151606094600094909385936001600160a01b039092169263a86a28d19260048082019392918290030181865afa15801561179f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117c391906148ed565b5090506001600160a01b0381161561186857610162546117e4906001614a91565b67ffffffffffffffff8111156117fc576117fc613fe1565b604051908082528060200260200182016040528015611825578160200160208202803683370190505b509350808460008151811061183c5761183c61498e565b6001600160a01b039092166020928302919091019091015260019250611861826149a4565b91506118b1565b6101625467ffffffffffffffff81111561188457611884613fe1565b6040519080825280602002602001820160405280156118ad578160200160208202803683370190505b5093505b825b828110156119445761016160006101626118cd8785614aa4565b815481106118dd576118dd61498e565b9060005260206000200154815260200190815260200160002060009054906101000a90046001600160a01b031685828151811061191c5761191c61498e565b6001600160a01b039092166020928302919091019091015261193d816149a4565b90506118b3565b5050505090565b600082815260c9602052604090206001015461196681612072565b610a0f83836126a4565b600061197b81612072565b6001600160a01b0382166119f75760405162461bcd60e51b815260206004820152602e60248201527f41737365743a207472757374656420666f727761726465722063616e2774206260448201527f65207a65726f206164647265737300000000000000000000000000000000000060648201526084016108ef565b600080547fffffffffffffffffffff0000000000000000000000000000000000000000ffff16620100006001600160a01b03851690810291909117825560405190917f871264f4293af7d2865ae7eae628b228f4991c57cb45b39c99f0b774ebe2901891a25050565b61015f5485906001600160a01b03163b15611be257336001600160a01b03821603611b2357611a8d612695565b6001600160a01b0316866001600160a01b03161480611ab35750611ab3866107da612695565b611b165760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108ef565b610bad86868686866130dd565b61015f54604051633185c44d60e21b81523060048201523360248201526001600160a01b039091169063c617113490604401602060405180830381865afa158015611b72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b969190614971565b611be25760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f77656400000000000000000000000060448201526064016108ef565b611bea612695565b6001600160a01b0316866001600160a01b03161480611c105750611c10866107da612695565b611c735760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108ef565b610c7e86868686866130dd565b611c88612695565b6001600160a01b0316836001600160a01b03161480611cae5750611cae836107da612695565b611d115760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108ef565b610a0f838383612086565b60008181526101616020526040808220546101605482517fa86a28d100000000000000000000000000000000000000000000000000000000815283516060956001600160a01b039485169590949093169263a86a28d192600480820193918290030181865afa158015611d93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611db791906148ed565b5090506001600160a01b03821615611e3757816001600160a01b031663d78d610b6040518163ffffffff1660e01b8152600401600060405180830381865afa158015611e07573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611e2f91908101906149be565b949350505050565b604080516001808252818301909252600091816020015b6040805180820190915260008082526020820152815260200190600190039081611e4e5790505090506040518060400160405280836001600160a01b0316815260200161271061ffff1681525081600081518110611eae57611eae61498e565b6020908102919091010152949350505050565b600061016382604051611ed49190614ab7565b9081526020016040518091039020549050919050565b60006001600160e01b031982167f2a55205a000000000000000000000000000000000000000000000000000000001480611f4d57506001600160e01b031982167f667873ce00000000000000000000000000000000000000000000000000000000145b80611f8157506001600160e01b031982167ffd90e89700000000000000000000000000000000000000000000000000000000145b8061091d575061091d826132b8565b600081815261012e6020526040812080546060929190611faf90614ad3565b80601f0160208091040260200160405190810160405280929190818152602001828054611fdb90614ad3565b80156120285780601f10611ffd57610100808354040283529160200191612028565b820191906000526020600020905b81548152906001019060200180831161200b57829003601f168201915b50505050509050600081511161204657612041836132f6565b61206b565b61012d8160405160200161205b929190614b0d565b6040516020818303038152906040525b9392505050565b6120838161207e612695565b61338a565b50565b6001600160a01b0383166121025760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016108ef565b600061210c612695565b90506000612119846133ff565b90506000612126846133ff565b90506121468387600085856040518060200160405280600081525061344a565b60008581526065602090815260408083206001600160a01b038a168452909152902054848110156121de5760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e63650000000000000000000000000000000000000000000000000000000060648201526084016108ef565b60008681526065602090815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46040805160208101909152600090525b50505050505050565b600082815261012e602052604090206122768282614bda565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b6122a284610995565b6040516122af9190613f99565b60405180910390a25050565b6001600160a01b0383166123375760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016108ef565b80518251146123995760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016108ef565b60006123a3612695565b90506123c38185600086866040518060200160405280600081525061344a565b60005b83518110156124e05760008482815181106123e3576123e361498e565b6020026020010151905060008483815181106124015761240161498e565b60209081029190910181015160008481526065835260408082206001600160a01b038c1683529093529190912054909150818110156124a75760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e63650000000000000000000000000000000000000000000000000000000060648201526084016108ef565b60009283526065602090815260408085206001600160a01b038b16865290915290922091039055806124d8816149a4565b9150506123c6565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051612531929190614c9a565b60405180910390a46040805160208101909152600090526109d5565b612555612695565b6001600160a01b0316856001600160a01b0316148061257b575061257b856107da612695565b6125de5760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108ef565b6125eb8585858585613458565b5050505050565b600082815260c9602090815260408083206001600160a01b038516845290915290205460ff16610d4357600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612651612695565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061269f6136dd565b905090565b600082815260c9602090815260408083206001600160a01b038516845290915290205460ff1615610d4357600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff19169055612701612695565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b610160546040517ff06040b40000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301528481166024830152600092169063f06040b4906044016020604051808303816000875af11580156127b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d89190614cc8565b6000858152610161602052604080822080546001600160a01b03851673ffffffffffffffffffffffffffffffffffffffff19909116179055610162805460018101825592527f29af0939a5988989bfee913a9ad10b9335cb63ebc9fd2b69e5f877d0455ac919909101869055519091507f5fe98ba0109a6edc7f59e8c943b6a42a0d8508aebe2e37c874eca88f747bb0779061288990869086909182526001600160a01b0316602082015260400190565b60405180910390a150505050565b6000806128a88360b81c61ffff1690565b61ffff1615159392505050565b61012d610d438282614bda565b61015f546001600160a01b03163b15610d435761015f546040517fc3c5a5470000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b039091169063c3c5a547906024016020604051808303816000875af1158015612939573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061295d9190614971565b610d435780156129e35761015f546040517f7d3e3dbe0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03848116602483015290911690637d3e3dbe906044015b600060405180830381600087803b1580156129cf57600080fd5b505af1158015610c7e573d6000803e3d6000fd5b6001600160a01b03821615612a445761015f546040517fa0af29030000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0384811660248301529091169063a0af2903906044016129b5565b61015f546040517f4420e4860000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0390911690634420e486906024016129b5565b816001600160a01b0316836001600160a01b031603612b155760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084016108ef565b6001600160a01b03838116600081815260666020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61016381604051612b939190614ab7565b908152602001604051809103902054600014612c3d578161016382604051612bbb9190614ab7565b90815260200160405180910390205414610d435760405162461bcd60e51b815260206004820152602960248201527f41737365743a206e6f7420616c6c6f77656420746f207265757365206d65746160448201527f646174612068617368000000000000000000000000000000000000000000000060648201526084016108ef565b8161016382604051612c4f9190614ab7565b90815260405190819003602001902055610d43828261225d565b6001600160a01b038416612ce55760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016108ef565b8151835114612d475760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016108ef565b6000612d51612695565b9050612d628160008787878761344a565b60005b8451811015612dfe57838181518110612d8057612d8061498e565b602002602001015160656000878481518110612d9e57612d9e61498e565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b031681526020019081526020016000206000828254612de69190614a91565b90915550819050612df6816149a4565b915050612d65565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051612e4f929190614c9a565b60405180910390a46125eb81600087878787613729565b600054610100900460ff16612ee35760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016108ef565b565b600054610100900460ff16612f625760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016108ef565b61015f805473ffffffffffffffffffffffffffffffffffffffff19166daaeb6d7670e522a718067333cd4e179055610d4382826128c2565b6001600160a01b0384166130165760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016108ef565b6000613020612695565b9050600061302d856133ff565b9050600061303a856133ff565b905061304b8360008985858961344a565b60008681526065602090815260408083206001600160a01b038b1684529091528120805487929061307d908490614a91565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461225483600089898989613915565b6001600160a01b0384166131415760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b60648201526084016108ef565b600061314b612695565b90506000613158856133ff565b90506000613165856133ff565b905061317583898985858961344a565b60008681526065602090815260408083206001600160a01b038c1684529091529020548581101561320e5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016108ef565b60008781526065602090815260408083206001600160a01b038d8116855292528083208985039055908a1682528120805488929061324d908490614a91565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46132ad848a8a8a8a8a613915565b505050505050505050565b60006001600160e01b031982167f7965db0b00000000000000000000000000000000000000000000000000000000148061091d575061091d82613a58565b60606067805461330590614ad3565b80601f016020809104026020016040519081016040528092919081815260200182805461333190614ad3565b801561337e5780601f106133535761010080835404028352916020019161337e565b820191906000526020600020905b81548152906001019060200180831161336157829003601f168201915b50505050509050919050565b600082815260c9602090815260408083206001600160a01b038516845290915290205460ff16610d43576133bd81613af3565b6133c8836020613b05565b6040516020016133d9929190614ce5565b60408051601f198184030181529082905262461bcd60e51b82526108ef91600401613f99565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106134395761343961498e565b602090810291909101015292915050565b610c7e868686868686613d2e565b81518351146134ba5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016108ef565b6001600160a01b03841661351e5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b60648201526084016108ef565b6000613528612695565b905061353881878787878761344a565b60005b84518110156136775760008582815181106135585761355861498e565b6020026020010151905060008583815181106135765761357661498e565b60209081029190910181015160008481526065835260408082206001600160a01b038e16835290935291909120549091508181101561361d5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016108ef565b60008381526065602090815260408083206001600160a01b038e8116855292528083208585039055908b1682528120805484929061365c908490614a91565b9250508190555050505080613670906149a4565b905061353b565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516136c7929190614c9a565b60405180910390a4610c7e818787878787613729565b600080546201000090046001600160a01b0316330361372157507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b503390565b90565b6001600160a01b0384163b15610c7e576040517fbc197c810000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063bc197c81906137869089908990889088908890600401614d66565b6020604051808303816000875af19250505080156137c1575060408051601f3d908101601f191682019092526137be91810190614db8565b60015b613876576137cd614dd5565b806308c379a00361380657506137e1614df0565b806137ec5750613808565b8060405162461bcd60e51b81526004016108ef9190613f99565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d4552433131353560448201527f526563656976657220696d706c656d656e74657200000000000000000000000060648201526084016108ef565b6001600160e01b031981167fbc197c8100000000000000000000000000000000000000000000000000000000146122545760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016108ef565b6001600160a01b0384163b15610c7e576040517ff23a6e610000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063f23a6e61906139729089908990889088908890600401614e98565b6020604051808303816000875af19250505080156139ad575060408051601f3d908101601f191682019092526139aa91810190614db8565b60015b6139b9576137cd614dd5565b6001600160e01b031981167ff23a6e6100000000000000000000000000000000000000000000000000000000146122545760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016108ef565b60006001600160e01b031982167fd9b67a26000000000000000000000000000000000000000000000000000000001480613abb57506001600160e01b031982167f0e89341c00000000000000000000000000000000000000000000000000000000145b8061091d57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161461091d565b606061091d6001600160a01b03831660145b60606000613b14836002614938565b613b1f906002614a91565b67ffffffffffffffff811115613b3757613b37613fe1565b6040519080825280601f01601f191660200182016040528015613b61576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110613b9857613b9861498e565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110613bfb57613bfb61498e565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000613c37846002614938565b613c42906001614a91565b90505b6001811115613cdf577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110613c8357613c8361498e565b1a60f81b828281518110613c9957613c9961498e565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93613cd881614edb565b9050613c45565b50831561206b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108ef565b6001600160a01b038516613db55760005b8351811015613db357828181518110613d5a57613d5a61498e565b602002602001015160fb6000868481518110613d7857613d7861498e565b602002602001015181526020019081526020016000206000828254613d9d9190614a91565b90915550613dac9050816149a4565b9050613d3f565b505b6001600160a01b038416610c7e5760005b8351811015612254576000848281518110613de357613de361498e565b602002602001015190506000848381518110613e0157613e0161498e565b60200260200101519050600060fb600084815260200190815260200160002054905081811015613e995760405162461bcd60e51b815260206004820152602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f7460448201527f616c537570706c7900000000000000000000000000000000000000000000000060648201526084016108ef565b600092835260fb602052604090922091039055613eb5816149a4565b9050613dc6565b6001600160a01b038116811461208357600080fd5b60008060408385031215613ee457600080fd5b8235613eef81613ebc565b946020939093013593505050565b6001600160e01b03198116811461208357600080fd5b600060208284031215613f2557600080fd5b813561206b81613efd565b600060208284031215613f4257600080fd5b5035919050565b60005b83811015613f64578181015183820152602001613f4c565b50506000910152565b60008151808452613f85816020860160208601613f49565b601f01601f19169290920160200192915050565b60208152600061206b6020830184613f6d565b600080600060608486031215613fc157600080fd5b8335613fcc81613ebc565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b6040810181811067ffffffffffffffff8211171561401757614017613fe1565b60405250565b601f19601f830116810181811067ffffffffffffffff8211171561404357614043613fe1565b6040525050565b600082601f83011261405b57600080fd5b813567ffffffffffffffff81111561407557614075613fe1565b60405161408c6020601f19601f850116018261401d565b8181528460208386010111156140a157600080fd5b816020850160208301376000918101602001919091529392505050565b600080604083850312156140d157600080fd5b82359150602083013567ffffffffffffffff8111156140ef57600080fd5b6140fb8582860161404a565b9150509250929050565b600067ffffffffffffffff82111561411f5761411f613fe1565b5060051b60200190565b600082601f83011261413a57600080fd5b8135602061414782614105565b604051614154828261401d565b83815260059390931b850182019282810191508684111561417457600080fd5b8286015b8481101561418f5780358352918301918301614178565b509695505050505050565b6000806000606084860312156141af57600080fd5b83356141ba81613ebc565b9250602084013567ffffffffffffffff808211156141d757600080fd5b6141e387838801614129565b935060408601359150808211156141f957600080fd5b5061420686828701614129565b9150509250925092565b6000806040838503121561422357600080fd5b50508035926020909101359150565b600080600080600060a0868803121561424a57600080fd5b853561425581613ebc565b9450602086013561426581613ebc565b9350604086013567ffffffffffffffff8082111561428257600080fd5b61428e89838a01614129565b945060608801359150808211156142a457600080fd5b6142b089838a01614129565b935060808801359150808211156142c657600080fd5b506142d38882890161404a565b9150509295509295909350565b600080604083850312156142f357600080fd5b82359150602083013561430581613ebc565b809150509250929050565b6000806040838503121561432357600080fd5b823567ffffffffffffffff8082111561433b57600080fd5b818501915085601f83011261434f57600080fd5b8135602061435c82614105565b604051614369828261401d565b83815260059390931b850182019282810191508984111561438957600080fd5b948201945b838610156143b05785356143a181613ebc565b8252948201949082019061438e565b965050860135925050808211156143c657600080fd5b506140fb85828601614129565b600081518084526020808501945080840160005b83811015614403578151875295820195908201906001016143e7565b509495945050505050565b60208152600061206b60208301846143d3565b60008060006060848603121561443657600080fd5b83359250602084013561444881613ebc565b9150604084013561445881613ebc565b809150509250925092565b60006020828403121561447557600080fd5b813567ffffffffffffffff81111561448c57600080fd5b611e2f8482850161404a565b6000602082840312156144aa57600080fd5b813561206b81613ebc565b801515811461208357600080fd5b600080604083850312156144d657600080fd5b82356144e181613ebc565b91506020830135614305816144b5565b600081518084526020808501945080840160005b8381101561440357815180516001600160a01b0316885283015161ffff168388015260409096019590820190600101614505565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b838110156145cc578883037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00185528151805184528781015161ffff168885015286015160608785018190526145b8818601836144f1565b968901969450505090860190600101614560565b509098975050505050505050565b600080600080608085870312156145f057600080fd5b84356145fb81613ebc565b935060208581013567ffffffffffffffff8082111561461957600080fd5b61462589838a01614129565b9550604088013591508082111561463b57600080fd5b61464789838a01614129565b9450606088013591508082111561465d57600080fd5b818801915088601f83011261467157600080fd5b813561467c81614105565b604051614689828261401d565b82815260059290921b840185019185810191508b8311156146a957600080fd5b8585015b838110156146e1578035858111156146c55760008081fd5b6146d38e89838a010161404a565b8452509186019186016146ad565b50989b979a50959850505050505050565b600080600080600060a0868803121561470a57600080fd5b853561471581613ebc565b9450602086013561472581613ebc565b9350604086013567ffffffffffffffff81111561474157600080fd5b61474d8882890161404a565b935050606086013561475e81613ebc565b9150608086013561476e81613ebc565b809150509295509295909350565b6000806000806080858703121561479257600080fd5b843561479d81613ebc565b93506020850135925060408501359150606085013567ffffffffffffffff8111156147c757600080fd5b6147d38782880161404a565b91505092959194509250565b6020808252825182820181905260009190848201906040850190845b818110156148205783516001600160a01b0316835292840192918401916001016147fb565b50909695505050505050565b6000806040838503121561483f57600080fd5b823561484a81613ebc565b9150602083013561430581613ebc565b600080600080600060a0868803121561487257600080fd5b853561487d81613ebc565b9450602086013561488d81613ebc565b93506040860135925060608601359150608086013567ffffffffffffffff8111156148b757600080fd5b6142d38882890161404a565b60208152600061206b60208301846144f1565b805161ffff811681146148e857600080fd5b919050565b6000806040838503121561490057600080fd5b825161490b81613ebc565b9150614919602084016148d6565b90509250929050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761091d5761091d614922565b60008261496c57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561498357600080fd5b815161206b816144b5565b634e487b7160e01b600052603260045260246000fd5b600060001982036149b7576149b7614922565b5060010190565b600060208083850312156149d157600080fd5b825167ffffffffffffffff8111156149e857600080fd5b8301601f810185136149f957600080fd5b8051614a0481614105565b60408051614a12838261401d565b83815260069390931b8401850192858101925088841115614a3257600080fd5b938501935b83851015614a855781858a031215614a4f5760008081fd5b8151614a5a81613ff7565b8551614a6581613ebc565b8152614a728688016148d6565b8188015283529381019391850191614a37565b98975050505050505050565b8082018082111561091d5761091d614922565b8181038181111561091d5761091d614922565b60008251614ac9818460208701613f49565b9190910192915050565b600181811c90821680614ae757607f821691505b602082108103614b0757634e487b7160e01b600052602260045260246000fd5b50919050565b6000808454614b1b81614ad3565b60018281168015614b335760018114614b4857614b77565b60ff1984168752821515830287019450614b77565b8860005260208060002060005b85811015614b6e5781548a820152908401908201614b55565b50505082870194505b505050508351614b8b818360208801613f49565b01949350505050565b601f821115610a0f57600081815260208120601f850160051c81016020861015614bbb5750805b601f850160051c820191505b81811015610c7e57828155600101614bc7565b815167ffffffffffffffff811115614bf457614bf4613fe1565b614c0881614c028454614ad3565b84614b94565b602080601f831160018114614c3d5760008415614c255750858301515b600019600386901b1c1916600185901b178555610c7e565b600085815260208120601f198616915b82811015614c6c57888601518255948401946001909101908401614c4d565b5085821015614c8a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000614cad60408301856143d3565b8281036020840152614cbf81856143d3565b95945050505050565b600060208284031215614cda57600080fd5b815161206b81613ebc565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614d1d816017850160208801613f49565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351614d5a816028840160208801613f49565b01602801949350505050565b60006001600160a01b03808816835280871660208401525060a06040830152614d9260a08301866143d3565b8281036060840152614da481866143d3565b90508281036080840152614a858185613f6d565b600060208284031215614dca57600080fd5b815161206b81613efd565b600060033d11156137265760046000803e5060005160e01c90565b600060443d1015614dfe5790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff8160248401118184111715614e4c57505050505090565b8285019150815181811115614e645750505050505090565b843d8701016020828501011115614e7e5750505050505090565b614e8d6020828601018761401d565b509095945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152614ed060a0830184613f6d565b979650505050505050565b600081614eea57614eea614922565b50600019019056fea26469706673582212203102588adb6a1f3bb1811ad62789a6e859f5e3893f0ddd02aeb321fca956ba3764736f6c63430008120033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061032a5760003560e01c806381de2dc2116101b2578063bb7fde71116100f9578063da742228116100a2578063f242432a1161007c578063f242432a1461081c578063f5298aca1461082f578063fd90e89714610842578063fdda1d0e1461086257600080fd5b8063da742228146107b9578063e985e9c5146107cc578063ee295d621461080857600080fd5b8063ce1b815f116100d3578063ce1b815f14610768578063d53913931461077f578063d547741f146107a657600080fd5b8063bb7fde7114610720578063bd85b03914610733578063befa66451461075357600080fd5b8063a22cb4651161015b578063abe3960311610135578063abe39603146106cd578063ac4a0fb6146106f9578063b0ccc31e1461070c57600080fd5b8063a22cb46514610694578063a30b4db9146106a7578063a55784ef146106ba57600080fd5b806397905c1e1161018c57806397905c1e146106645780639d28fb8614610679578063a217fddf1461068c57600080fd5b806381de2dc21461060557806391d1485414610618578063933f39581461065157600080fd5b806336568abe1161027657806355f804b31161021f5780636b566cb2116101f95780636b566cb214610589578063791459ea146105cb578063797669c9146105de57600080fd5b806355f804b31461053b578063572b6c051461054e5780636b20c4541461057657600080fd5b80634f124995116102505780634f124995146104f35780634f558e79146105065780635055fbc31461052857600080fd5b806336568abe1461049b5780634e1273f4146104ae5780634f062c5a146104ce57600080fd5b8063248a9ca3116102d85780632a55205a116102b25780632a55205a146104435780632eb2c2d6146104755780632f2ff15d1461048857600080fd5b8063248a9ca3146103d3578063282c51f3146103f65780632a41a3551461041d57600080fd5b8063124d91e511610309578063124d91e514610398578063162094c4146103ad57806320820ec3146103c057600080fd5b8062fdd58e1461032f57806301ffc9a7146103555780630e89341c14610378575b600080fd5b61034261033d366004613ed1565b610875565b6040519081526020015b60405180910390f35b610368610363366004613f13565b610923565b604051901515815260200161034c565b61038b610386366004613f30565b610995565b60405161034c9190613f99565b6103ab6103a6366004613fac565b6109a0565b005b6103ab6103bb3660046140be565b6109db565b6103ab6103ce36600461419a565b610a14565b6103426103e1366004613f30565b600090815260c9602052604090206001015490565b6103427f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84881565b61043061042b366004613f30565b610a49565b60405161ffff909116815260200161034c565b610456610451366004614210565b610a59565b604080516001600160a01b03909316835260208301919091520161034c565b6103ab610483366004614232565b610b7b565b6103ab6104963660046142e0565b610c86565b6103ab6104a93660046142e0565b610cab565b6104c16104bc366004614310565b610d47565b60405161034c919061440e565b6104e16104dc366004613f30565b610e85565b60405160ff909116815260200161034c565b6103ab610501366004614421565b610e94565b610368610514366004613f30565b600090815260fb6020526040902054151590565b610368610536366004613f30565b610eaa565b6103ab610549366004614463565b610eb5565b61036861055c366004614498565b6000546201000090046001600160a01b0390811691161490565b6103ab61058436600461419a565b610ec9565b6105b3610597366004613f30565b610161602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200161034c565b6103ab6105d93660046144c3565b610f65565b6103427f71f3d55856e4058ed06ee057d79ada615f65cdf5f9ee88181b914225088f834f81565b610430610613366004613f30565b610ff6565b6103686106263660046142e0565b600091825260c9602090815260408084206001600160a01b0393909316845291905290205460ff1690565b61036861065f366004613f30565b611006565b61066c611017565b60405161034c9190614539565b6103ab610687366004614498565b61119d565b610342600081565b6103ab6106a23660046144c3565b61123d565b6105b36106b5366004613f30565b611325565b6103ab6106c83660046145da565b61132d565b6103426106db366004614463565b80516020818301810180516101638252928201919093012091525481565b6103ab6107073660046146f2565b611522565b61015f546105b3906001600160a01b031681565b6103ab61072e36600461477c565b6116d6565b610342610741366004613f30565b600090815260fb602052604090205490565b61075b611731565b60405161034c91906147df565b6000546201000090046001600160a01b03166105b3565b6103427f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6103ab6107b43660046142e0565b61194b565b6103ab6107c7366004614498565b611970565b6103686107da36600461482c565b6001600160a01b03918216600090815260666020908152604080832093909416825291909152205460ff1690565b610160546105b3906001600160a01b031681565b6103ab61082a36600461485a565b611a60565b6103ab61083d366004613fac565b611c80565b610855610850366004613f30565b611d1c565b60405161034c91906148c3565b610342610870366004614463565b611ec1565b60006001600160a01b0383166108f85760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201527f616c6964206f776e65720000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b5060008181526065602090815260408083206001600160a01b03861684529091529020545b92915050565b60006001600160e01b031982167fa30b4db900000000000000000000000000000000000000000000000000000000148061098657507f572b6c05000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b8061091d575061091d82611eea565b606061091d82611f90565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a8486109ca81612072565b6109d5848484612086565b50505050565b7f71f3d55856e4058ed06ee057d79ada615f65cdf5f9ee88181b914225088f834f610a0581612072565b610a0f838361225d565b505050565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848610a3e81612072565b6109d58484846122bb565b600061091d8260b81c61ffff1690565b60008060008061016060009054906101000a90046001600160a01b03166001600160a01b031663a86a28d16040518163ffffffff1660e01b81526004016040805180830381865afa158015610ab2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad691906148ed565b6000888152610161602052604090205491935091506001600160a01b031615610b3857600086815261016160205260409020546001600160a01b0316612710610b2361ffff841688614938565b610b2d919061494f565b935093505050610b74565b6001600160a01b03821615801590610b53575061ffff811615155b15610b6a5781612710610b2361ffff841688614938565b6000809350935050505b9250929050565b61015f5485906001600160a01b03163b15610c7157336001600160a01b03821603610bb257610bad868686868661254d565b610c7e565b61015f54604051633185c44d60e21b81523060048201523360248201526001600160a01b039091169063c617113490604401602060405180830381865afa158015610c01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c259190614971565b610c715760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f77656400000000000000000000000060448201526064016108ef565b610c7e868686868661254d565b505050505050565b600082815260c96020526040902060010154610ca181612072565b610a0f83836125f2565b610cb3612695565b6001600160a01b0316816001600160a01b031614610d395760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016108ef565b610d4382826126a4565b5050565b60608151835114610dc05760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d61746368000000000000000000000000000000000000000000000060648201526084016108ef565b6000835167ffffffffffffffff811115610ddc57610ddc613fe1565b604051908082528060200260200182016040528015610e05578160200160208202803683370190505b50905060005b8451811015610e7d57610e50858281518110610e2957610e2961498e565b6020026020010151858381518110610e4357610e4361498e565b6020026020010151610875565b828281518110610e6257610e6261498e565b6020908102919091010152610e76816149a4565b9050610e0b565b509392505050565b600061091d8260a01c60ff1690565b6000610e9f81612072565b6109d5848484612745565b600061091d82612897565b6000610ec081612072565b610d43826128b5565b610ed1612695565b6001600160a01b0316836001600160a01b03161480610ef75750610ef7836107da612695565b610f5a5760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108ef565b610a0f8383836122bb565b6000610f7081612072565b6001600160a01b038316610fec5760405162461bcd60e51b815260206004820152602960248201527f41737365743a20737562736372697074696f6e2063616e2774206265207a657260448201527f6f2061646472657373000000000000000000000000000000000000000000000060648201526084016108ef565b610a0f83836128c2565b600061091d8260a81c61ffff1690565b6000600160c883901c81161461091d565b6101625460609067ffffffffffffffff81111561103657611036613fe1565b60405190808252806020026020018201604052801561108357816020015b604080516060808201835260008083526020830152918101919091528152602001906001900390816110545790505b50905060005b610162548110156111995760408051606080820183526000808352602083015291810191909152600061016283815481106110c6576110c661498e565b60009182526020808320909101548083526101619091526040909120549091506001600160a01b0316801561116157806001600160a01b031663d78d610b6040518163ffffffff1660e01b8152600401600060405180830381865afa158015611133573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261115b91908101906149be565b60408401525b8183528451839086908690811061117a5761117a61498e565b602002602001018190525050505080611192906149a4565b9050611089565b5090565b60006111a881612072565b6001600160a01b03821661120c5760405162461bcd60e51b815260206004820152602560248201527f41737365743a2072656769737472792063616e2774206265207a65726f206164604482015264647265737360d81b60648201526084016108ef565b5061015f805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b61015f5482906001600160a01b03163b156113135761015f54604051633185c44d60e21b81523060048201526001600160a01b0383811660248301529091169063c617113490604401602060405180830381865afa1580156112a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c79190614971565b6113135760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f77656400000000000000000000000060448201526064016108ef565b610a0f61131e612695565b8484612a8e565b60008161091d565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661135781612072565b81518451146113ce5760405162461bcd60e51b815260206004820152602b60248201527f41737365743a2069647320616e64206d6574616461746148617368206c656e6760448201527f7468206d69736d6174636800000000000000000000000000000000000000000060648201526084016108ef565b82518451146114455760405162461bcd60e51b815260206004820152602660248201527f41737365743a2069647320616e6420616d6f756e7473206c656e677468206d6960448201527f736d61746368000000000000000000000000000000000000000000000000000060648201526084016108ef565b60005b845181101561149f5761148d8582815181106114665761146661498e565b60200260200101518483815181106114805761148061498e565b6020026020010151612b82565b80611497816149a4565b915050611448565b506114bb85858560405180602001604052806000815250612c69565b60005b8451811015610c7e5760006114e98683815181106114de576114de61498e565b602002602001015190565b905061150f8683815181106115005761150061498e565b60200260200101518283612745565b508061151a816149a4565b9150506114be565b600054610100900460ff16158080156115425750600054600160ff909116105b8061155c5750303b15801561155c575060005460ff166001145b6115ce5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016108ef565b6000805460ff1916600117905580156115f1576000805461ff0019166101001790555b6115fa846128b5565b611602612e66565b61160a612e66565b600080547fffffffffffffffffffff0000000000000000000000000000000000000000ffff16620100006001600160a01b0389160217905561164a612e66565b6116556000866125f2565b611660836001612ee5565b610160805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384161790558015610c7e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661170081612072565b61170a8483612b82565b61172585858560405180602001604052806000815250612f9a565b83610c7e818080612745565b6101625461016054604080517fa86a28d10000000000000000000000000000000000000000000000000000000081528151606094600094909385936001600160a01b039092169263a86a28d19260048082019392918290030181865afa15801561179f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117c391906148ed565b5090506001600160a01b0381161561186857610162546117e4906001614a91565b67ffffffffffffffff8111156117fc576117fc613fe1565b604051908082528060200260200182016040528015611825578160200160208202803683370190505b509350808460008151811061183c5761183c61498e565b6001600160a01b039092166020928302919091019091015260019250611861826149a4565b91506118b1565b6101625467ffffffffffffffff81111561188457611884613fe1565b6040519080825280602002602001820160405280156118ad578160200160208202803683370190505b5093505b825b828110156119445761016160006101626118cd8785614aa4565b815481106118dd576118dd61498e565b9060005260206000200154815260200190815260200160002060009054906101000a90046001600160a01b031685828151811061191c5761191c61498e565b6001600160a01b039092166020928302919091019091015261193d816149a4565b90506118b3565b5050505090565b600082815260c9602052604090206001015461196681612072565b610a0f83836126a4565b600061197b81612072565b6001600160a01b0382166119f75760405162461bcd60e51b815260206004820152602e60248201527f41737365743a207472757374656420666f727761726465722063616e2774206260448201527f65207a65726f206164647265737300000000000000000000000000000000000060648201526084016108ef565b600080547fffffffffffffffffffff0000000000000000000000000000000000000000ffff16620100006001600160a01b03851690810291909117825560405190917f871264f4293af7d2865ae7eae628b228f4991c57cb45b39c99f0b774ebe2901891a25050565b61015f5485906001600160a01b03163b15611be257336001600160a01b03821603611b2357611a8d612695565b6001600160a01b0316866001600160a01b03161480611ab35750611ab3866107da612695565b611b165760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108ef565b610bad86868686866130dd565b61015f54604051633185c44d60e21b81523060048201523360248201526001600160a01b039091169063c617113490604401602060405180830381865afa158015611b72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b969190614971565b611be25760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f77656400000000000000000000000060448201526064016108ef565b611bea612695565b6001600160a01b0316866001600160a01b03161480611c105750611c10866107da612695565b611c735760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108ef565b610c7e86868686866130dd565b611c88612695565b6001600160a01b0316836001600160a01b03161480611cae5750611cae836107da612695565b611d115760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108ef565b610a0f838383612086565b60008181526101616020526040808220546101605482517fa86a28d100000000000000000000000000000000000000000000000000000000815283516060956001600160a01b039485169590949093169263a86a28d192600480820193918290030181865afa158015611d93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611db791906148ed565b5090506001600160a01b03821615611e3757816001600160a01b031663d78d610b6040518163ffffffff1660e01b8152600401600060405180830381865afa158015611e07573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611e2f91908101906149be565b949350505050565b604080516001808252818301909252600091816020015b6040805180820190915260008082526020820152815260200190600190039081611e4e5790505090506040518060400160405280836001600160a01b0316815260200161271061ffff1681525081600081518110611eae57611eae61498e565b6020908102919091010152949350505050565b600061016382604051611ed49190614ab7565b9081526020016040518091039020549050919050565b60006001600160e01b031982167f2a55205a000000000000000000000000000000000000000000000000000000001480611f4d57506001600160e01b031982167f667873ce00000000000000000000000000000000000000000000000000000000145b80611f8157506001600160e01b031982167ffd90e89700000000000000000000000000000000000000000000000000000000145b8061091d575061091d826132b8565b600081815261012e6020526040812080546060929190611faf90614ad3565b80601f0160208091040260200160405190810160405280929190818152602001828054611fdb90614ad3565b80156120285780601f10611ffd57610100808354040283529160200191612028565b820191906000526020600020905b81548152906001019060200180831161200b57829003601f168201915b50505050509050600081511161204657612041836132f6565b61206b565b61012d8160405160200161205b929190614b0d565b6040516020818303038152906040525b9392505050565b6120838161207e612695565b61338a565b50565b6001600160a01b0383166121025760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016108ef565b600061210c612695565b90506000612119846133ff565b90506000612126846133ff565b90506121468387600085856040518060200160405280600081525061344a565b60008581526065602090815260408083206001600160a01b038a168452909152902054848110156121de5760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e63650000000000000000000000000000000000000000000000000000000060648201526084016108ef565b60008681526065602090815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46040805160208101909152600090525b50505050505050565b600082815261012e602052604090206122768282614bda565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b6122a284610995565b6040516122af9190613f99565b60405180910390a25050565b6001600160a01b0383166123375760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016108ef565b80518251146123995760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016108ef565b60006123a3612695565b90506123c38185600086866040518060200160405280600081525061344a565b60005b83518110156124e05760008482815181106123e3576123e361498e565b6020026020010151905060008483815181106124015761240161498e565b60209081029190910181015160008481526065835260408082206001600160a01b038c1683529093529190912054909150818110156124a75760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e63650000000000000000000000000000000000000000000000000000000060648201526084016108ef565b60009283526065602090815260408085206001600160a01b038b16865290915290922091039055806124d8816149a4565b9150506123c6565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051612531929190614c9a565b60405180910390a46040805160208101909152600090526109d5565b612555612695565b6001600160a01b0316856001600160a01b0316148061257b575061257b856107da612695565b6125de5760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108ef565b6125eb8585858585613458565b5050505050565b600082815260c9602090815260408083206001600160a01b038516845290915290205460ff16610d4357600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612651612695565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061269f6136dd565b905090565b600082815260c9602090815260408083206001600160a01b038516845290915290205460ff1615610d4357600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff19169055612701612695565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b610160546040517ff06040b40000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301528481166024830152600092169063f06040b4906044016020604051808303816000875af11580156127b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d89190614cc8565b6000858152610161602052604080822080546001600160a01b03851673ffffffffffffffffffffffffffffffffffffffff19909116179055610162805460018101825592527f29af0939a5988989bfee913a9ad10b9335cb63ebc9fd2b69e5f877d0455ac919909101869055519091507f5fe98ba0109a6edc7f59e8c943b6a42a0d8508aebe2e37c874eca88f747bb0779061288990869086909182526001600160a01b0316602082015260400190565b60405180910390a150505050565b6000806128a88360b81c61ffff1690565b61ffff1615159392505050565b61012d610d438282614bda565b61015f546001600160a01b03163b15610d435761015f546040517fc3c5a5470000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b039091169063c3c5a547906024016020604051808303816000875af1158015612939573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061295d9190614971565b610d435780156129e35761015f546040517f7d3e3dbe0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03848116602483015290911690637d3e3dbe906044015b600060405180830381600087803b1580156129cf57600080fd5b505af1158015610c7e573d6000803e3d6000fd5b6001600160a01b03821615612a445761015f546040517fa0af29030000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0384811660248301529091169063a0af2903906044016129b5565b61015f546040517f4420e4860000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0390911690634420e486906024016129b5565b816001600160a01b0316836001600160a01b031603612b155760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084016108ef565b6001600160a01b03838116600081815260666020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61016381604051612b939190614ab7565b908152602001604051809103902054600014612c3d578161016382604051612bbb9190614ab7565b90815260200160405180910390205414610d435760405162461bcd60e51b815260206004820152602960248201527f41737365743a206e6f7420616c6c6f77656420746f207265757365206d65746160448201527f646174612068617368000000000000000000000000000000000000000000000060648201526084016108ef565b8161016382604051612c4f9190614ab7565b90815260405190819003602001902055610d43828261225d565b6001600160a01b038416612ce55760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016108ef565b8151835114612d475760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016108ef565b6000612d51612695565b9050612d628160008787878761344a565b60005b8451811015612dfe57838181518110612d8057612d8061498e565b602002602001015160656000878481518110612d9e57612d9e61498e565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b031681526020019081526020016000206000828254612de69190614a91565b90915550819050612df6816149a4565b915050612d65565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051612e4f929190614c9a565b60405180910390a46125eb81600087878787613729565b600054610100900460ff16612ee35760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016108ef565b565b600054610100900460ff16612f625760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016108ef565b61015f805473ffffffffffffffffffffffffffffffffffffffff19166daaeb6d7670e522a718067333cd4e179055610d4382826128c2565b6001600160a01b0384166130165760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016108ef565b6000613020612695565b9050600061302d856133ff565b9050600061303a856133ff565b905061304b8360008985858961344a565b60008681526065602090815260408083206001600160a01b038b1684529091528120805487929061307d908490614a91565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461225483600089898989613915565b6001600160a01b0384166131415760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b60648201526084016108ef565b600061314b612695565b90506000613158856133ff565b90506000613165856133ff565b905061317583898985858961344a565b60008681526065602090815260408083206001600160a01b038c1684529091529020548581101561320e5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016108ef565b60008781526065602090815260408083206001600160a01b038d8116855292528083208985039055908a1682528120805488929061324d908490614a91565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46132ad848a8a8a8a8a613915565b505050505050505050565b60006001600160e01b031982167f7965db0b00000000000000000000000000000000000000000000000000000000148061091d575061091d82613a58565b60606067805461330590614ad3565b80601f016020809104026020016040519081016040528092919081815260200182805461333190614ad3565b801561337e5780601f106133535761010080835404028352916020019161337e565b820191906000526020600020905b81548152906001019060200180831161336157829003601f168201915b50505050509050919050565b600082815260c9602090815260408083206001600160a01b038516845290915290205460ff16610d43576133bd81613af3565b6133c8836020613b05565b6040516020016133d9929190614ce5565b60408051601f198184030181529082905262461bcd60e51b82526108ef91600401613f99565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106134395761343961498e565b602090810291909101015292915050565b610c7e868686868686613d2e565b81518351146134ba5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016108ef565b6001600160a01b03841661351e5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b60648201526084016108ef565b6000613528612695565b905061353881878787878761344a565b60005b84518110156136775760008582815181106135585761355861498e565b6020026020010151905060008583815181106135765761357661498e565b60209081029190910181015160008481526065835260408082206001600160a01b038e16835290935291909120549091508181101561361d5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016108ef565b60008381526065602090815260408083206001600160a01b038e8116855292528083208585039055908b1682528120805484929061365c908490614a91565b9250508190555050505080613670906149a4565b905061353b565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516136c7929190614c9a565b60405180910390a4610c7e818787878787613729565b600080546201000090046001600160a01b0316330361372157507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b503390565b90565b6001600160a01b0384163b15610c7e576040517fbc197c810000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063bc197c81906137869089908990889088908890600401614d66565b6020604051808303816000875af19250505080156137c1575060408051601f3d908101601f191682019092526137be91810190614db8565b60015b613876576137cd614dd5565b806308c379a00361380657506137e1614df0565b806137ec5750613808565b8060405162461bcd60e51b81526004016108ef9190613f99565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d4552433131353560448201527f526563656976657220696d706c656d656e74657200000000000000000000000060648201526084016108ef565b6001600160e01b031981167fbc197c8100000000000000000000000000000000000000000000000000000000146122545760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016108ef565b6001600160a01b0384163b15610c7e576040517ff23a6e610000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063f23a6e61906139729089908990889088908890600401614e98565b6020604051808303816000875af19250505080156139ad575060408051601f3d908101601f191682019092526139aa91810190614db8565b60015b6139b9576137cd614dd5565b6001600160e01b031981167ff23a6e6100000000000000000000000000000000000000000000000000000000146122545760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016108ef565b60006001600160e01b031982167fd9b67a26000000000000000000000000000000000000000000000000000000001480613abb57506001600160e01b031982167f0e89341c00000000000000000000000000000000000000000000000000000000145b8061091d57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161461091d565b606061091d6001600160a01b03831660145b60606000613b14836002614938565b613b1f906002614a91565b67ffffffffffffffff811115613b3757613b37613fe1565b6040519080825280601f01601f191660200182016040528015613b61576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110613b9857613b9861498e565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110613bfb57613bfb61498e565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000613c37846002614938565b613c42906001614a91565b90505b6001811115613cdf577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110613c8357613c8361498e565b1a60f81b828281518110613c9957613c9961498e565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93613cd881614edb565b9050613c45565b50831561206b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108ef565b6001600160a01b038516613db55760005b8351811015613db357828181518110613d5a57613d5a61498e565b602002602001015160fb6000868481518110613d7857613d7861498e565b602002602001015181526020019081526020016000206000828254613d9d9190614a91565b90915550613dac9050816149a4565b9050613d3f565b505b6001600160a01b038416610c7e5760005b8351811015612254576000848281518110613de357613de361498e565b602002602001015190506000848381518110613e0157613e0161498e565b60200260200101519050600060fb600084815260200190815260200160002054905081811015613e995760405162461bcd60e51b815260206004820152602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f7460448201527f616c537570706c7900000000000000000000000000000000000000000000000060648201526084016108ef565b600092835260fb602052604090922091039055613eb5816149a4565b9050613dc6565b6001600160a01b038116811461208357600080fd5b60008060408385031215613ee457600080fd5b8235613eef81613ebc565b946020939093013593505050565b6001600160e01b03198116811461208357600080fd5b600060208284031215613f2557600080fd5b813561206b81613efd565b600060208284031215613f4257600080fd5b5035919050565b60005b83811015613f64578181015183820152602001613f4c565b50506000910152565b60008151808452613f85816020860160208601613f49565b601f01601f19169290920160200192915050565b60208152600061206b6020830184613f6d565b600080600060608486031215613fc157600080fd5b8335613fcc81613ebc565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b6040810181811067ffffffffffffffff8211171561401757614017613fe1565b60405250565b601f19601f830116810181811067ffffffffffffffff8211171561404357614043613fe1565b6040525050565b600082601f83011261405b57600080fd5b813567ffffffffffffffff81111561407557614075613fe1565b60405161408c6020601f19601f850116018261401d565b8181528460208386010111156140a157600080fd5b816020850160208301376000918101602001919091529392505050565b600080604083850312156140d157600080fd5b82359150602083013567ffffffffffffffff8111156140ef57600080fd5b6140fb8582860161404a565b9150509250929050565b600067ffffffffffffffff82111561411f5761411f613fe1565b5060051b60200190565b600082601f83011261413a57600080fd5b8135602061414782614105565b604051614154828261401d565b83815260059390931b850182019282810191508684111561417457600080fd5b8286015b8481101561418f5780358352918301918301614178565b509695505050505050565b6000806000606084860312156141af57600080fd5b83356141ba81613ebc565b9250602084013567ffffffffffffffff808211156141d757600080fd5b6141e387838801614129565b935060408601359150808211156141f957600080fd5b5061420686828701614129565b9150509250925092565b6000806040838503121561422357600080fd5b50508035926020909101359150565b600080600080600060a0868803121561424a57600080fd5b853561425581613ebc565b9450602086013561426581613ebc565b9350604086013567ffffffffffffffff8082111561428257600080fd5b61428e89838a01614129565b945060608801359150808211156142a457600080fd5b6142b089838a01614129565b935060808801359150808211156142c657600080fd5b506142d38882890161404a565b9150509295509295909350565b600080604083850312156142f357600080fd5b82359150602083013561430581613ebc565b809150509250929050565b6000806040838503121561432357600080fd5b823567ffffffffffffffff8082111561433b57600080fd5b818501915085601f83011261434f57600080fd5b8135602061435c82614105565b604051614369828261401d565b83815260059390931b850182019282810191508984111561438957600080fd5b948201945b838610156143b05785356143a181613ebc565b8252948201949082019061438e565b965050860135925050808211156143c657600080fd5b506140fb85828601614129565b600081518084526020808501945080840160005b83811015614403578151875295820195908201906001016143e7565b509495945050505050565b60208152600061206b60208301846143d3565b60008060006060848603121561443657600080fd5b83359250602084013561444881613ebc565b9150604084013561445881613ebc565b809150509250925092565b60006020828403121561447557600080fd5b813567ffffffffffffffff81111561448c57600080fd5b611e2f8482850161404a565b6000602082840312156144aa57600080fd5b813561206b81613ebc565b801515811461208357600080fd5b600080604083850312156144d657600080fd5b82356144e181613ebc565b91506020830135614305816144b5565b600081518084526020808501945080840160005b8381101561440357815180516001600160a01b0316885283015161ffff168388015260409096019590820190600101614505565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b838110156145cc578883037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00185528151805184528781015161ffff168885015286015160608785018190526145b8818601836144f1565b968901969450505090860190600101614560565b509098975050505050505050565b600080600080608085870312156145f057600080fd5b84356145fb81613ebc565b935060208581013567ffffffffffffffff8082111561461957600080fd5b61462589838a01614129565b9550604088013591508082111561463b57600080fd5b61464789838a01614129565b9450606088013591508082111561465d57600080fd5b818801915088601f83011261467157600080fd5b813561467c81614105565b604051614689828261401d565b82815260059290921b840185019185810191508b8311156146a957600080fd5b8585015b838110156146e1578035858111156146c55760008081fd5b6146d38e89838a010161404a565b8452509186019186016146ad565b50989b979a50959850505050505050565b600080600080600060a0868803121561470a57600080fd5b853561471581613ebc565b9450602086013561472581613ebc565b9350604086013567ffffffffffffffff81111561474157600080fd5b61474d8882890161404a565b935050606086013561475e81613ebc565b9150608086013561476e81613ebc565b809150509295509295909350565b6000806000806080858703121561479257600080fd5b843561479d81613ebc565b93506020850135925060408501359150606085013567ffffffffffffffff8111156147c757600080fd5b6147d38782880161404a565b91505092959194509250565b6020808252825182820181905260009190848201906040850190845b818110156148205783516001600160a01b0316835292840192918401916001016147fb565b50909695505050505050565b6000806040838503121561483f57600080fd5b823561484a81613ebc565b9150602083013561430581613ebc565b600080600080600060a0868803121561487257600080fd5b853561487d81613ebc565b9450602086013561488d81613ebc565b93506040860135925060608601359150608086013567ffffffffffffffff8111156148b757600080fd5b6142d38882890161404a565b60208152600061206b60208301846144f1565b805161ffff811681146148e857600080fd5b919050565b6000806040838503121561490057600080fd5b825161490b81613ebc565b9150614919602084016148d6565b90509250929050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761091d5761091d614922565b60008261496c57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561498357600080fd5b815161206b816144b5565b634e487b7160e01b600052603260045260246000fd5b600060001982036149b7576149b7614922565b5060010190565b600060208083850312156149d157600080fd5b825167ffffffffffffffff8111156149e857600080fd5b8301601f810185136149f957600080fd5b8051614a0481614105565b60408051614a12838261401d565b83815260069390931b8401850192858101925088841115614a3257600080fd5b938501935b83851015614a855781858a031215614a4f5760008081fd5b8151614a5a81613ff7565b8551614a6581613ebc565b8152614a728688016148d6565b8188015283529381019391850191614a37565b98975050505050505050565b8082018082111561091d5761091d614922565b8181038181111561091d5761091d614922565b60008251614ac9818460208701613f49565b9190910192915050565b600181811c90821680614ae757607f821691505b602082108103614b0757634e487b7160e01b600052602260045260246000fd5b50919050565b6000808454614b1b81614ad3565b60018281168015614b335760018114614b4857614b77565b60ff1984168752821515830287019450614b77565b8860005260208060002060005b85811015614b6e5781548a820152908401908201614b55565b50505082870194505b505050508351614b8b818360208801613f49565b01949350505050565b601f821115610a0f57600081815260208120601f850160051c81016020861015614bbb5750805b601f850160051c820191505b81811015610c7e57828155600101614bc7565b815167ffffffffffffffff811115614bf457614bf4613fe1565b614c0881614c028454614ad3565b84614b94565b602080601f831160018114614c3d5760008415614c255750858301515b600019600386901b1c1916600185901b178555610c7e565b600085815260208120601f198616915b82811015614c6c57888601518255948401946001909101908401614c4d565b5085821015614c8a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000614cad60408301856143d3565b8281036020840152614cbf81856143d3565b95945050505050565b600060208284031215614cda57600080fd5b815161206b81613ebc565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614d1d816017850160208801613f49565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351614d5a816028840160208801613f49565b01602801949350505050565b60006001600160a01b03808816835280871660208401525060a06040830152614d9260a08301866143d3565b8281036060840152614da481866143d3565b90508281036080840152614a858185613f6d565b600060208284031215614dca57600080fd5b815161206b81613efd565b600060033d11156137265760046000803e5060005160e01c90565b600060443d1015614dfe5790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff8160248401118184111715614e4c57505050505090565b8285019150815181811115614e645750505050505090565b843d8701016020828501011115614e7e5750505050505090565b614e8d6020828601018761401d565b509095945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152614ed060a0830184613f6d565b979650505050505050565b600081614eea57614eea614922565b50600019019056fea26469706673582212203102588adb6a1f3bb1811ad62789a6e859f5e3893f0ddd02aeb321fca956ba3764736f6c63430008120033", + "solcInputHash": "e64fd56b3bfae7f817a31de5cae19a1b", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"royaltyBPS\",\"type\":\"uint16\"}],\"name\":\"DefaultRoyaltyBpsSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"DefaultRoyaltyReceiverSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"splitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"RoyaltyRecipientSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"TokenRoyaltyRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"TokenRoyaltySet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"name\":\"TransferBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"TransferSingle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newTrustedForwarderAddress\",\"type\":\"address\"}],\"name\":\"TrustedForwarderChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldTrustedForwarder\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newTrustedForwarder\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"TrustedForwarderSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"URI\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINTER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MODERATOR_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"_tokenRoyaltiesSplitter\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"balanceOfBatch\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"name\":\"burnBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"burnBatchFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burnFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"exists\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllSplits\",\"outputs\":[{\"internalType\":\"address payable[]\",\"name\":\"splits\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getCreatorAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getCreatorNonce\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getRecipients\",\"outputs\":[{\"components\":[{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"bps\",\"type\":\"uint16\"}],\"internalType\":\"struct Recipient[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getRevealNonce\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getTier\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"tier\",\"type\":\"uint8\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"metadataHash\",\"type\":\"string\"}],\"name\":\"getTokenIdByMetadataHash\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTokenRoyalties\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint16\",\"name\":\"royaltyBPS\",\"type\":\"uint16\"},{\"components\":[{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"bps\",\"type\":\"uint16\"}],\"internalType\":\"struct Recipient[]\",\"name\":\"recipients\",\"type\":\"tuple[]\"}],\"internalType\":\"struct IMultiRoyaltyDistributor.TokenRoyaltyConfig[]\",\"name\":\"royaltyConfigs\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTrustedForwarder\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"name\":\"hashUsed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"assetAdmin\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"baseUri\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"commonSubscription\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_manager\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"isBridged\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"isRevealed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"}],\"name\":\"isTrustedForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"metadataHash\",\"type\":\"string\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"string[]\",\"name\":\"metadataHashes\",\"type\":\"string[]\"}],\"name\":\"mintBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"operatorFilterRegistry\",\"outputs\":[{\"internalType\":\"contract IOperatorFilterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"subscriptionOrRegistrantToCopy\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"subscribe\",\"type\":\"bool\"}],\"name\":\"registerAndSubscribe\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"royaltyInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"royaltyManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeBatchTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"baseURI\",\"type\":\"string\"}],\"name\":\"setBaseURI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"registry\",\"type\":\"address\"}],\"name\":\"setOperatorRegistry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"}],\"name\":\"setTokenRoyalties\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"metadata\",\"type\":\"string\"}],\"name\":\"setTokenURI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"name\":\"setTrustedForwarder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"id\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"ApprovalForAll(address,address,bool)\":{\"details\":\"Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to `approved`.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"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._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"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`)\"},\"TransferBatch(address,address,address,uint256[],uint256[])\":{\"details\":\"Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all transfers.\"},\"TransferSingle(address,address,address,uint256,uint256)\":{\"details\":\"Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\"},\"TrustedForwarderSet(address,address,address)\":{\"params\":{\"newTrustedForwarder\":\"new trusted forwarder\",\"oldTrustedForwarder\":\"old trusted forwarder\",\"operator\":\"the sender of the transaction\"}},\"URI(string,uint256)\":{\"details\":\"Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. If an {URI} event was emitted for `id`, the standard https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value returned by {IERC1155MetadataURI-uri}.\"}},\"kind\":\"dev\",\"methods\":{\"balanceOf(address,uint256)\":{\"details\":\"See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address.\"},\"balanceOfBatch(address[],uint256[])\":{\"details\":\"See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length.\"},\"burnBatchFrom(address,uint256[],uint256[])\":{\"details\":\"Only the minter role can burn tokensThis function was added with token recycling and bridging in mind but may have other use casesThe length of the ids and amounts arrays must be the same\",\"params\":{\"account\":\"The account to burn tokens from\",\"amounts\":\"An array of amounts of tokens to burn\",\"ids\":\"An array of token ids to burn\"}},\"burnFrom(address,uint256,uint256)\":{\"details\":\"Only the minter role can burn tokensThis function was added with token recycling and bridging in mind but may have other use cases\",\"params\":{\"account\":\"The account to burn tokens from\",\"amount\":\"The amount of tokens to burn\",\"id\":\"The token id to burn\"}},\"constructor\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"exists(uint256)\":{\"details\":\"Indicates whether any token exist with a given id, or not.\"},\"getAllSplits()\":{\"returns\":{\"splits\":\"the royalty receiver's array\"}},\"getCreatorAddress(uint256)\":{\"params\":{\"tokenId\":\"The token id to extract the creator address from\"},\"returns\":{\"creator\":\"The asset creator address\"}},\"getCreatorNonce(uint256)\":{\"params\":{\"tokenId\":\"The token id to extract the asset nonce from\"},\"returns\":{\"_0\":\"creatorNonce The asset creator nonce\"}},\"getRecipients(uint256)\":{\"details\":\"returns the default address for tokens with no recipients.\",\"params\":{\"tokenId\":\"is the token id for which the recipient should be returned.\"},\"returns\":{\"_0\":\"addresses of royalty recipient of the token.\"}},\"getRevealNonce(uint256)\":{\"params\":{\"tokenId\":\"The token id to extract reveal nonce from\"},\"returns\":{\"_0\":\"revealNonce The reveal nonce of the asset\"}},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getTier(uint256)\":{\"params\":{\"tokenId\":\"The token id to extract the tier from\"},\"returns\":{\"tier\":\"The asset tier, determined by the catalyst used to create it\"}},\"getTokenRoyalties()\":{\"returns\":{\"royaltyConfigs\":\"receivers and their split array as long as the number of tokens.\"}},\"getTrustedForwarder()\":{\"returns\":{\"_0\":\"return the address of the trusted forwarder\"}},\"grantRole(bytes32,address)\":{\"details\":\"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.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC1155-isApprovedForAll}.\"},\"isBridged(uint256)\":{\"params\":{\"tokenId\":\"The token id to extract the bridged flag from\"},\"returns\":{\"_0\":\"bridged Whether the asset is bridged or not\"}},\"isRevealed(uint256)\":{\"params\":{\"tokenId\":\"The token id to extract the revealed flag from\"},\"returns\":{\"_0\":\"isRevealed Whether the asset is revealed or not\"}},\"isTrustedForwarder(address)\":{\"params\":{\"forwarder\":\"trusted forwarder address to check\"},\"returns\":{\"_0\":\"true if the address is the same as the trusted forwarder\"}},\"mint(address,uint256,uint256,string)\":{\"details\":\"Only callable by the minter role\",\"params\":{\"amount\":\"The amount of the token to mint\",\"id\":\"The id of the token to mint\",\"to\":\"The address of the recipient\"}},\"mintBatch(address,uint256[],uint256[],string[])\":{\"details\":\"Only callable by the minter role\",\"params\":{\"amounts\":\"The amounts of the tokens to mint\",\"ids\":\"The ids of the tokens to mint\",\"to\":\"The address of the recipient\"}},\"registerAndSubscribe(address,bool)\":{\"details\":\"used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.\",\"params\":{\"subscribe\":\"bool to signify subscription \\\"true\\\"\\\" or to copy the list \\\"false\\\".\",\"subscriptionOrRegistrantToCopy\":\"registration address of the list to subscribe.\"}},\"renounceRole(bytes32,address)\":{\"details\":\"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.\"},\"revokeRole(bytes32,address)\":{\"details\":\"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.\"},\"royaltyInfo(uint256,uint256)\":{\"params\":{\"tokenId\":\"of the token for which the royalty is needed to be distributed\",\"value\":\"the amount on which the royalty is calculated\"},\"returns\":{\"_0\":\"address the royalty receiver\",\"_1\":\"value the EIP2981 royalty\"}},\"safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)\":{\"details\":\"call data should be optimized to order ids so packedBalance can be used efficiently.\",\"params\":{\"amounts\":\"amount of each token type transfered.\",\"data\":\"aditional data accompanying the transfer.\",\"from\":\"address from which tokens are transfered.\",\"ids\":\"ids of each token type transfered.\",\"to\":\"address to which the token will be transfered.\"}},\"safeTransferFrom(address,address,uint256,uint256,bytes)\":{\"params\":{\"amount\":\"amount of token transfered.\",\"data\":\"aditional data accompanying the transfer.\",\"from\":\"address from which tokens are transfered.\",\"id\":\"the token type transfered.\",\"to\":\"address to which the token will be transfered.\"}},\"setApprovalForAll(address,bool)\":{\"params\":{\"approved\":\"whether to approve or revoke\",\"operator\":\"address which will be granted rights to transfer all tokens of the caller.\"}},\"setBaseURI(string)\":{\"params\":{\"baseURI\":\"The new base URI\"}},\"setOperatorRegistry(address)\":{\"params\":{\"registry\":\"the address of the registry\"}},\"setTokenRoyalties(uint256,address,address)\":{\"params\":{\"creator\":\"the creactor of the tokens.\",\"recipient\":\"the royalty recipient for the splitter of the creator.\",\"tokenId\":\"the id of the token for which the EIP2981 royalty is set for.\"}},\"setTokenURI(uint256,string)\":{\"details\":\"The metadata hash should be the IPFS CIDv1 base32 encoded hash\",\"params\":{\"metadata\":\"The new URI for asset's metadata\",\"tokenId\":\"The token id to set URI for\"}},\"setTrustedForwarder(address)\":{\"details\":\"Change the address of the trusted forwarder for meta-TX\",\"params\":{\"trustedForwarder\":\"The new trustedForwarder\"}},\"supportsInterface(bytes4)\":{\"params\":{\"id\":\"the interface identifier, as specified in ERC-165.\"},\"returns\":{\"_0\":\"`true` if the contract implements `id`.\"}},\"totalSupply(uint256)\":{\"details\":\"Total amount of tokens in with a given id.\"},\"uri(uint256)\":{\"params\":{\"tokenId\":\"The token id to get URI for\"},\"returns\":{\"_0\":\"tokenURI the URI of the token\"}}},\"version\":1},\"userdoc\":{\"events\":{\"TrustedForwarderSet(address,address,address)\":{\"notice\":\"Emitted when a `newTrustedForwarder` is set, replacing the `oldTrustedForwarder`\"}},\"kind\":\"user\",\"methods\":{\"burnBatchFrom(address,uint256[],uint256[])\":{\"notice\":\"Burn a batch of tokens from a given account\"},\"burnFrom(address,uint256,uint256)\":{\"notice\":\"Burn a token from a given account\"},\"getAllSplits()\":{\"notice\":\"returns the EIP-2981 royalty receiver for each token (i.e. splitters) including the default royalty receiver.\"},\"getCreatorAddress(uint256)\":{\"notice\":\"Extracts the creator address from a given token id\"},\"getCreatorNonce(uint256)\":{\"notice\":\"Extracts the asset nonce from a given token id\"},\"getRecipients(uint256)\":{\"notice\":\"returns the royalty recipients for each tokenId.\"},\"getRevealNonce(uint256)\":{\"notice\":\"Extracts the abilities and enhancements hash from a given token id\"},\"getTier(uint256)\":{\"notice\":\"Extracts the tier from a given token id\"},\"getTokenRoyalties()\":{\"notice\":\"Returns royalty receivers and their split of royalty for each token\"},\"getTrustedForwarder()\":{\"notice\":\"return the address of the trusted forwarder\"},\"isBridged(uint256)\":{\"notice\":\"Extracts the bridged flag from a given token id\"},\"isRevealed(uint256)\":{\"notice\":\"Extracts the revealed flag from a given token id\"},\"isTrustedForwarder(address)\":{\"notice\":\"return true if the forwarder is the trusted forwarder\"},\"mint(address,uint256,uint256,string)\":{\"notice\":\"Mint new tokens\"},\"mintBatch(address,uint256[],uint256[],string[])\":{\"notice\":\"Mint new tokens with catalyst tier chosen by the creator\"},\"registerAndSubscribe(address,bool)\":{\"notice\":\"This function is used to register Asset contract on the Operator Filterer Registry of Opensea.can only be called by admin.\"},\"royaltyInfo(uint256,uint256)\":{\"notice\":\"EIP 2981 royalty info function to return the royalty receiver and royalty amount\"},\"safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)\":{\"notice\":\"Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\"},\"safeTransferFrom(address,address,uint256,uint256,bytes)\":{\"notice\":\"Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\"},\"setApprovalForAll(address,bool)\":{\"notice\":\"Enable or disable approval for `operator` to manage all of the caller's tokens.\"},\"setBaseURI(string)\":{\"notice\":\"Set a new base URI\"},\"setOperatorRegistry(address)\":{\"notice\":\"sets filter registry address deployed in test\"},\"setTokenRoyalties(uint256,address,address)\":{\"notice\":\"could be used to deploy splitter and set tokens royalties\"},\"setTokenURI(uint256,string)\":{\"notice\":\"Set a new URI for specific tokenid\"},\"setTrustedForwarder(address)\":{\"notice\":\"Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\"},\"supportsInterface(bytes4)\":{\"notice\":\"Query if a contract implements interface `id`.\"},\"uri(uint256)\":{\"notice\":\"returns full token URI, including baseURI and token metadata URI\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@sandbox-smart-contracts/asset/contracts/Asset.sol\":\"Asset\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/// @author: manifold.xyz\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\nstruct Recipient {\\n address payable recipient;\\n uint16 bps;\\n}\\n\\ninterface IRoyaltySplitter is IERC165 {\\n /**\\n * @dev Set the splitter recipients. Total bps must total 10000.\\n */\\n function setRecipients(Recipient[] calldata recipients) external;\\n\\n /**\\n * @dev Get the splitter recipients;\\n */\\n function getRecipients() external view returns (Recipient[] memory);\\n}\\n\",\"keccak256\":\"0xc507963f66c4238d25e69d2d05ac5995c549aa89789e89e7a556403221547c6d\",\"license\":\"MIT\"},\"@manifoldxyz/royalty-registry-solidity/contracts/specs/IEIP2981.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * EIP-2981\\n */\\ninterface IEIP2981 {\\n /**\\n * bytes4(keccak256(\\\"royaltyInfo(uint256,uint256)\\\")) == 0x2a55205a\\n *\\n * => 0x2a55205a = 0x2a55205a\\n */\\n function royaltyInfo(uint256 tokenId, uint256 value) external view returns (address, uint256);\\n}\\n\",\"keccak256\":\"0xd5313c1f5939b5a98bc48824082c337a6205d78f6346465fe3c3944de274f6bd\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlUpgradeable.sol\\\";\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\\n function __AccessControl_init() internal onlyInitializing {\\n }\\n\\n function __AccessControl_init_unchained() internal onlyInitializing {\\n }\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n StringsUpgradeable.toHexString(account),\\n \\\" is missing role \\\",\\n StringsUpgradeable.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xfeefb24d068524440e1ba885efdf105d91f83504af3c2d745ffacc4595396831\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControlUpgradeable {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0xb8f5302f12138c5561362e88a78d061573e6298b7a1a5afe84a1e2c8d4d5aeaa\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized != type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC1155Upgradeable.sol\\\";\\nimport \\\"./IERC1155ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC1155MetadataURIUpgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the basic standard multi-token.\\n * See https://eips.ethereum.org/EIPS/eip-1155\\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\\n *\\n * _Available since v3.1._\\n */\\ncontract ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155Upgradeable, IERC1155MetadataURIUpgradeable {\\n using AddressUpgradeable for address;\\n\\n // Mapping from token ID to account balances\\n mapping(uint256 => mapping(address => uint256)) private _balances;\\n\\n // Mapping from account to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json\\n string private _uri;\\n\\n /**\\n * @dev See {_setURI}.\\n */\\n function __ERC1155_init(string memory uri_) internal onlyInitializing {\\n __ERC1155_init_unchained(uri_);\\n }\\n\\n function __ERC1155_init_unchained(string memory uri_) internal onlyInitializing {\\n _setURI(uri_);\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return\\n interfaceId == type(IERC1155Upgradeable).interfaceId ||\\n interfaceId == type(IERC1155MetadataURIUpgradeable).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC1155MetadataURI-uri}.\\n *\\n * This implementation returns the same URI for *all* token types. It relies\\n * on the token type ID substitution mechanism\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\\n *\\n * Clients calling this function must replace the `\\\\{id\\\\}` substring with the\\n * actual token type ID.\\n */\\n function uri(uint256) public view virtual override returns (string memory) {\\n return _uri;\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {\\n require(account != address(0), \\\"ERC1155: address zero is not a valid owner\\\");\\n return _balances[id][account];\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOfBatch}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] memory accounts,\\n uint256[] memory ids\\n ) public view virtual override returns (uint256[] memory) {\\n require(accounts.length == ids.length, \\\"ERC1155: accounts and ids length mismatch\\\");\\n\\n uint256[] memory batchBalances = new uint256[](accounts.length);\\n\\n for (uint256 i = 0; i < accounts.length; ++i) {\\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\\n }\\n\\n return batchBalances;\\n }\\n\\n /**\\n * @dev See {IERC1155-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC1155-isApprovedForAll}.\\n */\\n function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[account][operator];\\n }\\n\\n /**\\n * @dev See {IERC1155-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) public virtual override {\\n require(\\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\\n \\\"ERC1155: caller is not token owner or approved\\\"\\n );\\n _safeTransferFrom(from, to, id, amount, data);\\n }\\n\\n /**\\n * @dev See {IERC1155-safeBatchTransferFrom}.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) public virtual override {\\n require(\\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\\n \\\"ERC1155: caller is not token owner or approved\\\"\\n );\\n _safeBatchTransferFrom(from, to, ids, amounts, data);\\n }\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function _safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) internal virtual {\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n\\n address operator = _msgSender();\\n uint256[] memory ids = _asSingletonArray(id);\\n uint256[] memory amounts = _asSingletonArray(amount);\\n\\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n uint256 fromBalance = _balances[id][from];\\n require(fromBalance >= amount, \\\"ERC1155: insufficient balance for transfer\\\");\\n unchecked {\\n _balances[id][from] = fromBalance - amount;\\n }\\n _balances[id][to] += amount;\\n\\n emit TransferSingle(operator, from, to, id, amount);\\n\\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);\\n }\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function _safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual {\\n require(ids.length == amounts.length, \\\"ERC1155: ids and amounts length mismatch\\\");\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n\\n address operator = _msgSender();\\n\\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n for (uint256 i = 0; i < ids.length; ++i) {\\n uint256 id = ids[i];\\n uint256 amount = amounts[i];\\n\\n uint256 fromBalance = _balances[id][from];\\n require(fromBalance >= amount, \\\"ERC1155: insufficient balance for transfer\\\");\\n unchecked {\\n _balances[id][from] = fromBalance - amount;\\n }\\n _balances[id][to] += amount;\\n }\\n\\n emit TransferBatch(operator, from, to, ids, amounts);\\n\\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);\\n }\\n\\n /**\\n * @dev Sets a new URI for all token types, by relying on the token type ID\\n * substitution mechanism\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\\n *\\n * By this mechanism, any occurrence of the `\\\\{id\\\\}` substring in either the\\n * URI or any of the amounts in the JSON file at said URI will be replaced by\\n * clients with the token type ID.\\n *\\n * For example, the `https://token-cdn-domain/\\\\{id\\\\}.json` URI would be\\n * interpreted by clients as\\n * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\\n * for token type ID 0x4cce0.\\n *\\n * See {uri}.\\n *\\n * Because these URIs cannot be meaningfully represented by the {URI} event,\\n * this function emits no events.\\n */\\n function _setURI(string memory newuri) internal virtual {\\n _uri = newuri;\\n }\\n\\n /**\\n * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\\n require(to != address(0), \\\"ERC1155: mint to the zero address\\\");\\n\\n address operator = _msgSender();\\n uint256[] memory ids = _asSingletonArray(id);\\n uint256[] memory amounts = _asSingletonArray(amount);\\n\\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\\n\\n _balances[id][to] += amount;\\n emit TransferSingle(operator, address(0), to, id, amount);\\n\\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\\n\\n _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);\\n }\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function _mintBatch(\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual {\\n require(to != address(0), \\\"ERC1155: mint to the zero address\\\");\\n require(ids.length == amounts.length, \\\"ERC1155: ids and amounts length mismatch\\\");\\n\\n address operator = _msgSender();\\n\\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\\n\\n for (uint256 i = 0; i < ids.length; i++) {\\n _balances[ids[i]][to] += amounts[i];\\n }\\n\\n emit TransferBatch(operator, address(0), to, ids, amounts);\\n\\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\\n\\n _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens of token type `id` from `from`\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `from` must have at least `amount` tokens of token type `id`.\\n */\\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\\n require(from != address(0), \\\"ERC1155: burn from the zero address\\\");\\n\\n address operator = _msgSender();\\n uint256[] memory ids = _asSingletonArray(id);\\n uint256[] memory amounts = _asSingletonArray(amount);\\n\\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \\\"\\\");\\n\\n uint256 fromBalance = _balances[id][from];\\n require(fromBalance >= amount, \\\"ERC1155: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[id][from] = fromBalance - amount;\\n }\\n\\n emit TransferSingle(operator, from, address(0), id, amount);\\n\\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \\\"\\\");\\n }\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n */\\n function _burnBatch(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual {\\n require(from != address(0), \\\"ERC1155: burn from the zero address\\\");\\n require(ids.length == amounts.length, \\\"ERC1155: ids and amounts length mismatch\\\");\\n\\n address operator = _msgSender();\\n\\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \\\"\\\");\\n\\n for (uint256 i = 0; i < ids.length; i++) {\\n uint256 id = ids[i];\\n uint256 amount = amounts[i];\\n\\n uint256 fromBalance = _balances[id][from];\\n require(fromBalance >= amount, \\\"ERC1155: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[id][from] = fromBalance - amount;\\n }\\n }\\n\\n emit TransferBatch(operator, from, address(0), ids, amounts);\\n\\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \\\"\\\");\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\\n require(owner != operator, \\\"ERC1155: setting approval status for self\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting\\n * and burning, as well as batched variants.\\n *\\n * The same hook is called on both single and batched variants. For single\\n * transfers, the length of the `ids` and `amounts` arrays will be 1.\\n *\\n * Calling conditions (for each `id` and `amount` pair):\\n *\\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * of token type `id` will be transferred to `to`.\\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\\n * for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\\n * will be burned.\\n * - `from` and `to` are never both zero.\\n * - `ids` and `amounts` have the same, non-zero length.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting\\n * and burning, as well as batched variants.\\n *\\n * The same hook is called on both single and batched variants. For single\\n * transfers, the length of the `id` and `amount` arrays will be 1.\\n *\\n * Calling conditions (for each `id` and `amount` pair):\\n *\\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * of token type `id` will be transferred to `to`.\\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\\n * for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\\n * will be burned.\\n * - `from` and `to` are never both zero.\\n * - `ids` and `amounts` have the same, non-zero length.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual {}\\n\\n function _doSafeTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try IERC1155ReceiverUpgradeable(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {\\n if (response != IERC1155ReceiverUpgradeable.onERC1155Received.selector) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non-ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n function _doSafeBatchTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (\\n bytes4 response\\n ) {\\n if (response != IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non-ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {\\n uint256[] memory array = new uint256[](1);\\n array[0] = element;\\n\\n return array;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[47] private __gap;\\n}\\n\",\"keccak256\":\"0xc3e465e1fdd0e491688ad75ef1b946e1680e7f9f78bf5beeefd6daed8693c856\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\ninterface IERC1155ReceiverUpgradeable is IERC165Upgradeable {\\n /**\\n * @dev Handles the receipt of a single ERC1155 token type. This function is\\n * called at the end of a `safeTransferFrom` after the balance has been updated.\\n *\\n * NOTE: To accept the transfer, this must return\\n * `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))`\\n * (i.e. 0xf23a6e61, or its own function selector).\\n *\\n * @param operator The address which initiated the transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param id The ID of the token being transferred\\n * @param value The amount of tokens being transferred\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155Received(\\n address operator,\\n address from,\\n uint256 id,\\n uint256 value,\\n bytes calldata data\\n ) external returns (bytes4);\\n\\n /**\\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\\n * is called at the end of a `safeBatchTransferFrom` after the balances have\\n * been updated.\\n *\\n * NOTE: To accept the transfer(s), this must return\\n * `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))`\\n * (i.e. 0xbc197c81, or its own function selector).\\n *\\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xffcb29612efb57efc8f0d4897deb5abaeac830022c59a3aa17446d698dbc856b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155Upgradeable is IERC165Upgradeable {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xf51f292659a77777c0ed7375a39683d8bee53b86a6e7bd0c76f34ce7aa37a3a8\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/extensions/ERC1155Burnable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1155Upgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Extension of {ERC1155} that allows token holders to destroy both their\\n * own tokens and those that they have been approved to use.\\n *\\n * _Available since v3.1._\\n */\\nabstract contract ERC1155BurnableUpgradeable is Initializable, ERC1155Upgradeable {\\n function __ERC1155Burnable_init() internal onlyInitializing {\\n }\\n\\n function __ERC1155Burnable_init_unchained() internal onlyInitializing {\\n }\\n function burn(address account, uint256 id, uint256 value) public virtual {\\n require(\\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\\n \\\"ERC1155: caller is not token owner or approved\\\"\\n );\\n\\n _burn(account, id, value);\\n }\\n\\n function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {\\n require(\\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\\n \\\"ERC1155: caller is not token owner or approved\\\"\\n );\\n\\n _burnBatch(account, ids, values);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x048a492eee88c80ecc0354486e8e0ab99490b44a6fb28833b3cfb45d573f18d7\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1155Upgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Extension of ERC1155 that adds tracking of total supply per id.\\n *\\n * Useful for scenarios where Fungible and Non-fungible tokens have to be\\n * clearly identified. Note: While a totalSupply of 1 might mean the\\n * corresponding is an NFT, there is no guarantees that no other token with the\\n * same id are not going to be minted.\\n */\\nabstract contract ERC1155SupplyUpgradeable is Initializable, ERC1155Upgradeable {\\n function __ERC1155Supply_init() internal onlyInitializing {\\n }\\n\\n function __ERC1155Supply_init_unchained() internal onlyInitializing {\\n }\\n mapping(uint256 => uint256) private _totalSupply;\\n\\n /**\\n * @dev Total amount of tokens in with a given id.\\n */\\n function totalSupply(uint256 id) public view virtual returns (uint256) {\\n return _totalSupply[id];\\n }\\n\\n /**\\n * @dev Indicates whether any token exist with a given id, or not.\\n */\\n function exists(uint256 id) public view virtual returns (bool) {\\n return ERC1155SupplyUpgradeable.totalSupply(id) > 0;\\n }\\n\\n /**\\n * @dev See {ERC1155-_beforeTokenTransfer}.\\n */\\n function _beforeTokenTransfer(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual override {\\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n if (from == address(0)) {\\n for (uint256 i = 0; i < ids.length; ++i) {\\n _totalSupply[ids[i]] += amounts[i];\\n }\\n }\\n\\n if (to == address(0)) {\\n for (uint256 i = 0; i < ids.length; ++i) {\\n uint256 id = ids[i];\\n uint256 amount = amounts[i];\\n uint256 supply = _totalSupply[id];\\n require(supply >= amount, \\\"ERC1155: burn amount exceeds totalSupply\\\");\\n unchecked {\\n _totalSupply[id] = supply - amount;\\n }\\n }\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xf7bdbcbb9fcf42997f280db8c02070e9c561406e6971ff680c6c43f92065ac9e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155URIStorage.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../ERC1155Upgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev ERC1155 token with storage based token URI management.\\n * Inspired by the ERC721URIStorage extension\\n *\\n * _Available since v4.6._\\n */\\nabstract contract ERC1155URIStorageUpgradeable is Initializable, ERC1155Upgradeable {\\n function __ERC1155URIStorage_init() internal onlyInitializing {\\n __ERC1155URIStorage_init_unchained();\\n }\\n\\n function __ERC1155URIStorage_init_unchained() internal onlyInitializing {\\n _baseURI = \\\"\\\";\\n }\\n using StringsUpgradeable for uint256;\\n\\n // Optional base URI\\n string private _baseURI;\\n\\n // Optional mapping for token URIs\\n mapping(uint256 => string) private _tokenURIs;\\n\\n /**\\n * @dev See {IERC1155MetadataURI-uri}.\\n *\\n * This implementation returns the concatenation of the `_baseURI`\\n * and the token-specific uri if the latter is set\\n *\\n * This enables the following behaviors:\\n *\\n * - if `_tokenURIs[tokenId]` is set, then the result is the concatenation\\n * of `_baseURI` and `_tokenURIs[tokenId]` (keep in mind that `_baseURI`\\n * is empty per default);\\n *\\n * - if `_tokenURIs[tokenId]` is NOT set then we fallback to `super.uri()`\\n * which in most cases will contain `ERC1155._uri`;\\n *\\n * - if `_tokenURIs[tokenId]` is NOT set, and if the parents do not have a\\n * uri value set, then the result is empty.\\n */\\n function uri(uint256 tokenId) public view virtual override returns (string memory) {\\n string memory tokenURI = _tokenURIs[tokenId];\\n\\n // If token URI is set, concatenate base URI and tokenURI (via abi.encodePacked).\\n return bytes(tokenURI).length > 0 ? string(abi.encodePacked(_baseURI, tokenURI)) : super.uri(tokenId);\\n }\\n\\n /**\\n * @dev Sets `tokenURI` as the tokenURI of `tokenId`.\\n */\\n function _setURI(uint256 tokenId, string memory tokenURI) internal virtual {\\n _tokenURIs[tokenId] = tokenURI;\\n emit URI(uri(tokenId), tokenId);\\n }\\n\\n /**\\n * @dev Sets `baseURI` as the `_baseURI` for all tokens\\n */\\n function _setBaseURI(string memory baseURI) internal virtual {\\n _baseURI = baseURI;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[48] private __gap;\\n}\\n\",\"keccak256\":\"0x9a1218747a17239e2fcab2efc14099379387f114c7ad22c69a23b7d67ec0eaa2\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/IERC1155MetadataURIUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC1155Upgradeable.sol\\\";\\n\\n/**\\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155MetadataURIUpgradeable is IERC1155Upgradeable {\\n /**\\n * @dev Returns the URI for token type `id`.\\n *\\n * If the `\\\\{id\\\\}` substring is present in the URI, it must be replaced by\\n * clients with the actual token type ID.\\n */\\n function uri(uint256 id) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xa350df12a8c10e821af05e0863f44e8317a0efa44df27bfd5dc1d63fdfa3c448\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary MathUpgradeable {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Clones.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\\n * deploying minimal proxy contracts, also known as \\\"clones\\\".\\n *\\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\\n *\\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\\n * deterministic method.\\n *\\n * _Available since v3.4._\\n */\\nlibrary Clones {\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create opcode, which should never revert.\\n */\\n function clone(address implementation) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create(0, 0x09, 0x37)\\n }\\n require(instance != address(0), \\\"ERC1167: create failed\\\");\\n }\\n\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create2 opcode and a `salt` to deterministically deploy\\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\\n * the clones cannot be deployed twice at the same address.\\n */\\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create2(0, 0x09, 0x37, salt)\\n }\\n require(instance != address(0), \\\"ERC1167: create2 failed\\\");\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt,\\n address deployer\\n ) internal pure returns (address predicted) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(add(ptr, 0x38), deployer)\\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\\n mstore(add(ptr, 0x14), implementation)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\\n mstore(add(ptr, 0x58), salt)\\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\\n predicted := keccak256(add(ptr, 0x43), 0x55)\\n }\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt\\n ) internal view returns (address predicted) {\\n return predictDeterministicAddress(implementation, salt, address(this));\\n }\\n}\\n\",\"keccak256\":\"0x01f055f5c26ba25d7f83e9aa9ba877fbea4d0bf22227de046ea67494bc932999\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)\\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```solidity\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n *\\n * [WARNING]\\n * ====\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\\n * unusable.\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\n *\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\\n * array of EnumerableSet.\\n * ====\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastValue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastValue;\\n // Update the index for the moved value\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n bytes32[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x9f4357008a8f7d8c8bf5d48902e789637538d8c016be5766610901b4bba81514\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/Asset.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport {\\n AccessControlUpgradeable,\\n ContextUpgradeable,\\n IAccessControlUpgradeable,\\n IERC165Upgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\\\";\\nimport {\\n ERC1155BurnableUpgradeable,\\n ERC1155Upgradeable,\\n IERC1155Upgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol\\\";\\nimport {\\n ERC1155SupplyUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol\\\";\\nimport {\\n ERC1155URIStorageUpgradeable,\\n IERC1155MetadataURIUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport {\\n ERC2771HandlerUpgradeable,\\n ERC2771HandlerAbstract\\n} from \\\"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\\\";\\nimport {\\n MultiRoyaltyDistributor\\n} from \\\"@sandbox-smart-contracts/dependency-royalty-management/contracts/MultiRoyaltyDistributor.sol\\\";\\nimport {\\n OperatorFiltererUpgradeable,\\n IOperatorFilterRegistry\\n} from \\\"@sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol\\\";\\nimport {TokenIdUtils} from \\\"./libraries/TokenIdUtils.sol\\\";\\nimport {IAsset} from \\\"./interfaces/IAsset.sol\\\";\\nimport {ITokenUtils, IRoyaltyUGC} from \\\"./interfaces/ITokenUtils.sol\\\";\\n\\ncontract Asset is\\n IAsset,\\n Initializable,\\n ERC2771HandlerUpgradeable,\\n ERC1155BurnableUpgradeable,\\n AccessControlUpgradeable,\\n ERC1155SupplyUpgradeable,\\n ERC1155URIStorageUpgradeable,\\n OperatorFiltererUpgradeable,\\n MultiRoyaltyDistributor,\\n ITokenUtils\\n{\\n using TokenIdUtils for uint256;\\n\\n bytes32 public constant MINTER_ROLE = keccak256(\\\"MINTER_ROLE\\\");\\n bytes32 public constant BURNER_ROLE = keccak256(\\\"BURNER_ROLE\\\");\\n bytes32 public constant MODERATOR_ROLE = keccak256(\\\"MODERATOR_ROLE\\\");\\n\\n // mapping of ipfs metadata token hash to token id\\n mapping(string => uint256) public hashUsed;\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor() {\\n _disableInitializers();\\n }\\n\\n function initialize(\\n address forwarder,\\n address assetAdmin,\\n string memory baseUri,\\n address commonSubscription,\\n address _manager\\n ) external initializer {\\n _setBaseURI(baseUri);\\n __AccessControl_init();\\n __ERC1155Supply_init();\\n __ERC2771Handler_init(forwarder);\\n __ERC1155Burnable_init();\\n _grantRole(DEFAULT_ADMIN_ROLE, assetAdmin);\\n __OperatorFilterer_init(commonSubscription, true);\\n __MultiRoyaltyDistributor_init(_manager);\\n }\\n\\n /// @notice Mint new tokens\\n /// @dev Only callable by the minter role\\n /// @param to The address of the recipient\\n /// @param id The id of the token to mint\\n /// @param amount The amount of the token to mint\\n function mint(\\n address to,\\n uint256 id,\\n uint256 amount,\\n string memory metadataHash\\n ) external onlyRole(MINTER_ROLE) {\\n _setMetadataHash(id, metadataHash);\\n _mint(to, id, amount, \\\"\\\");\\n address creator = id.getCreatorAddress();\\n _setTokenRoyalties(id, payable(creator), creator);\\n }\\n\\n /// @notice Mint new tokens with catalyst tier chosen by the creator\\n /// @dev Only callable by the minter role\\n /// @param to The address of the recipient\\n /// @param ids The ids of the tokens to mint\\n /// @param amounts The amounts of the tokens to mint\\n function mintBatch(\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n string[] memory metadataHashes\\n ) external onlyRole(MINTER_ROLE) {\\n require(ids.length == metadataHashes.length, \\\"Asset: ids and metadataHash length mismatch\\\");\\n require(ids.length == amounts.length, \\\"Asset: ids and amounts length mismatch\\\");\\n for (uint256 i = 0; i < ids.length; i++) {\\n _setMetadataHash(ids[i], metadataHashes[i]);\\n }\\n _mintBatch(to, ids, amounts, \\\"\\\");\\n for (uint256 i; i < ids.length; i++) {\\n address creator = ids[i].getCreatorAddress();\\n _setTokenRoyalties(ids[i], payable(creator), creator);\\n }\\n }\\n\\n /// @notice Burn a token from a given account\\n /// @dev Only the minter role can burn tokens\\n /// @dev This function was added with token recycling and bridging in mind but may have other use cases\\n /// @param account The account to burn tokens from\\n /// @param id The token id to burn\\n /// @param amount The amount of tokens to burn\\n function burnFrom(\\n address account,\\n uint256 id,\\n uint256 amount\\n ) external onlyRole(BURNER_ROLE) {\\n _burn(account, id, amount);\\n }\\n\\n /// @notice Burn a batch of tokens from a given account\\n /// @dev Only the minter role can burn tokens\\n /// @dev This function was added with token recycling and bridging in mind but may have other use cases\\n /// @dev The length of the ids and amounts arrays must be the same\\n /// @param account The account to burn tokens from\\n /// @param ids An array of token ids to burn\\n /// @param amounts An array of amounts of tokens to burn\\n function burnBatchFrom(\\n address account,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external onlyRole(BURNER_ROLE) {\\n _burnBatch(account, ids, amounts);\\n }\\n\\n /// @notice Set a new URI for specific tokenid\\n /// @dev The metadata hash should be the IPFS CIDv1 base32 encoded hash\\n /// @param tokenId The token id to set URI for\\n /// @param metadata The new URI for asset's metadata\\n function setTokenURI(uint256 tokenId, string memory metadata) external onlyRole(MODERATOR_ROLE) {\\n _setURI(tokenId, metadata);\\n }\\n\\n /// @notice Set a new base URI\\n /// @param baseURI The new base URI\\n function setBaseURI(string memory baseURI) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n _setBaseURI(baseURI);\\n }\\n\\n /// @notice returns full token URI, including baseURI and token metadata URI\\n /// @param tokenId The token id to get URI for\\n /// @return tokenURI the URI of the token\\n function uri(uint256 tokenId)\\n public\\n view\\n override(ERC1155Upgradeable, ERC1155URIStorageUpgradeable)\\n returns (string memory)\\n {\\n return ERC1155URIStorageUpgradeable.uri(tokenId);\\n }\\n\\n function getTokenIdByMetadataHash(string memory metadataHash) public view returns (uint256) {\\n return hashUsed[metadataHash];\\n }\\n\\n function _setMetadataHash(uint256 tokenId, string memory metadataHash) internal {\\n if (hashUsed[metadataHash] != 0) {\\n require(hashUsed[metadataHash] == tokenId, \\\"Asset: not allowed to reuse metadata hash\\\");\\n } else {\\n hashUsed[metadataHash] = tokenId;\\n _setURI(tokenId, metadataHash);\\n }\\n }\\n\\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\\n /// @dev Change the address of the trusted forwarder for meta-TX\\n /// @param trustedForwarder The new trustedForwarder\\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n require(trustedForwarder != address(0), \\\"Asset: trusted forwarder can't be zero address\\\");\\n _setTrustedForwarder(trustedForwarder);\\n }\\n\\n /// @notice Query if a contract implements interface `id`.\\n /// @param id the interface identifier, as specified in ERC-165.\\n /// @return `true` if the contract implements `id`.\\n function supportsInterface(bytes4 id)\\n public\\n view\\n virtual\\n override(ERC1155Upgradeable, AccessControlUpgradeable, MultiRoyaltyDistributor)\\n returns (bool)\\n {\\n return id == type(IRoyaltyUGC).interfaceId || super.supportsInterface(id);\\n }\\n\\n function _msgSender()\\n internal\\n view\\n virtual\\n override(ContextUpgradeable, ERC2771HandlerAbstract)\\n returns (address sender)\\n {\\n return ERC2771HandlerAbstract._msgSender();\\n }\\n\\n function _msgData()\\n internal\\n view\\n virtual\\n override(ContextUpgradeable, ERC2771HandlerAbstract)\\n returns (bytes calldata)\\n {\\n return ERC2771HandlerAbstract._msgData();\\n }\\n\\n function _beforeTokenTransfer(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) {\\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\\n }\\n\\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\\n /// @dev call data should be optimized to order ids so packedBalance can be used efficiently.\\n /// @param from address from which tokens are transfered.\\n /// @param to address to which the token will be transfered.\\n /// @param ids ids of each token type transfered.\\n /// @param amounts amount of each token type transfered.\\n /// @param data aditional data accompanying the transfer.\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) public virtual override onlyAllowedOperator(from) {\\n super.safeBatchTransferFrom(from, to, ids, amounts, data);\\n }\\n\\n /// @notice Enable or disable approval for `operator` to manage all of the caller's tokens.\\n /// @param operator address which will be granted rights to transfer all tokens of the caller.\\n /// @param approved whether to approve or revoke\\n function setApprovalForAll(address operator, bool approved)\\n public\\n virtual\\n override\\n onlyAllowedOperatorApproval(operator)\\n {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\\n /// @param from address from which tokens are transfered.\\n /// @param to address to which the token will be transfered.\\n /// @param id the token type transfered.\\n /// @param amount amount of token transfered.\\n /// @param data aditional data accompanying the transfer.\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) public virtual override onlyAllowedOperator(from) {\\n require(\\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\\n \\\"ERC1155: caller is not token owner or approved\\\"\\n );\\n _safeTransferFrom(from, to, id, amount, data);\\n }\\n\\n /// @notice could be used to deploy splitter and set tokens royalties\\n /// @param tokenId the id of the token for which the EIP2981 royalty is set for.\\n /// @param recipient the royalty recipient for the splitter of the creator.\\n /// @param creator the creactor of the tokens.\\n function setTokenRoyalties(\\n uint256 tokenId,\\n address payable recipient,\\n address creator\\n ) external override onlyRole(DEFAULT_ADMIN_ROLE) {\\n _setTokenRoyalties(tokenId, recipient, creator);\\n }\\n\\n /// @notice Extracts the creator address from a given token id\\n /// @param tokenId The token id to extract the creator address from\\n /// @return creator The asset creator address\\n function getCreatorAddress(uint256 tokenId) external pure returns (address creator) {\\n return TokenIdUtils.getCreatorAddress(tokenId);\\n }\\n\\n /// @notice Extracts the tier from a given token id\\n /// @param tokenId The token id to extract the tier from\\n /// @return tier The asset tier, determined by the catalyst used to create it\\n function getTier(uint256 tokenId) external pure returns (uint8 tier) {\\n return TokenIdUtils.getTier(tokenId);\\n }\\n\\n /// @notice Extracts the revealed flag from a given token id\\n /// @param tokenId The token id to extract the revealed flag from\\n /// @return isRevealed Whether the asset is revealed or not\\n function isRevealed(uint256 tokenId) external pure returns (bool) {\\n return TokenIdUtils.isRevealed(tokenId);\\n }\\n\\n /// @notice Extracts the asset nonce from a given token id\\n /// @param tokenId The token id to extract the asset nonce from\\n /// @return creatorNonce The asset creator nonce\\n function getCreatorNonce(uint256 tokenId) external pure returns (uint16) {\\n return TokenIdUtils.getCreatorNonce(tokenId);\\n }\\n\\n /// @notice Extracts the abilities and enhancements hash from a given token id\\n /// @param tokenId The token id to extract reveal nonce from\\n /// @return revealNonce The reveal nonce of the asset\\n function getRevealNonce(uint256 tokenId) external pure returns (uint16) {\\n return TokenIdUtils.getRevealNonce(tokenId);\\n }\\n\\n /// @notice Extracts the bridged flag from a given token id\\n /// @param tokenId The token id to extract the bridged flag from\\n /// @return bridged Whether the asset is bridged or not\\n function isBridged(uint256 tokenId) external pure returns (bool) {\\n return TokenIdUtils.isBridged(tokenId);\\n }\\n\\n /// @notice This function is used to register Asset contract on the Operator Filterer Registry of Opensea.can only be called by admin.\\n /// @dev used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.\\n /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe.\\n /// @param subscribe bool to signify subscription \\\"true\\\"\\\" or to copy the list \\\"false\\\".\\n function registerAndSubscribe(address subscriptionOrRegistrantToCopy, bool subscribe)\\n external\\n onlyRole(DEFAULT_ADMIN_ROLE)\\n {\\n require(subscriptionOrRegistrantToCopy != address(0), \\\"Asset: subscription can't be zero address\\\");\\n _registerAndSubscribe(subscriptionOrRegistrantToCopy, subscribe);\\n }\\n\\n /// @notice sets filter registry address deployed in test\\n /// @param registry the address of the registry\\n function setOperatorRegistry(address registry) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n require(registry != address(0), \\\"Asset: registry can't be zero address\\\");\\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\\n }\\n}\\n\",\"keccak256\":\"0x8d6c7e70c363c8e8c69486f78a39a61469e3e116f910560264a43c0f59dd6ad7\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/interfaces/IAsset.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface IAsset {\\n // AssetData reflects the asset tokenId structure\\n // Refer to TokenIdUtils.sol\\n struct AssetData {\\n uint256 tokenId;\\n address creator;\\n uint256 amount;\\n uint8 tier;\\n uint16 creatorNonce;\\n bool revealed;\\n string metadataHash;\\n bool bridged;\\n }\\n\\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\\n\\n // Functions\\n function mint(\\n address to,\\n uint256 id,\\n uint256 amount,\\n string memory metadataHash\\n ) external;\\n\\n function mintBatch(\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n string[] memory metadataHashes\\n ) external;\\n\\n function burnFrom(\\n address account,\\n uint256 id,\\n uint256 amount\\n ) external;\\n\\n function burnBatchFrom(\\n address account,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external;\\n\\n function getTokenIdByMetadataHash(string memory metadataHash) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x2abd2e550ced35090c988e432215f990bf8f192cc346ffac6778fde0025a8206\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/interfaces/ITokenUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport {IRoyaltyUGC} from \\\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyUGC.sol\\\";\\n\\ninterface ITokenUtils is IRoyaltyUGC {\\n function getTier(uint256 tokenId) external pure returns (uint8 tier);\\n\\n function isRevealed(uint256 tokenId) external pure returns (bool);\\n\\n function getCreatorNonce(uint256 tokenId) external pure returns (uint16);\\n\\n function getRevealNonce(uint256 tokenId) external pure returns (uint16);\\n\\n function isBridged(uint256 tokenId) external pure returns (bool);\\n}\\n\",\"keccak256\":\"0x04b5c64d755016f18cd8422dda072eae8a5151402631723e2cccedc623b7bb66\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/libraries/TokenIdUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {IAsset} from \\\"../interfaces/IAsset.sol\\\";\\n\\nlibrary TokenIdUtils {\\n // Layer masks\\n uint256 public constant TIER_MASK = 0xFF;\\n uint256 public constant NONCE_MASK = 0xFFFF;\\n uint256 public constant REVEAL_NONCE_MASK = 0xFFFF;\\n uint256 public constant BRIDGED_MASK = 0x1;\\n\\n // Bit shifts\\n uint256 public constant CREATOR_SHIFT = 0;\\n uint256 public constant TIER_SHIFT = 160;\\n uint256 public constant NONCE_SHIFT = 168;\\n uint256 public constant REVEAL_NONCE_SHIFT = 184;\\n uint256 public constant BRIDGED_SHIFT = 200;\\n\\n /// @notice Generates a token id for a given asset\\n /// @dev The token id is generated by concatenating the following fields:\\n /// @dev creator address, chain index, tier, asset nonce, reveal nonce and bridged boolean\\n /// @dev The first 160 bits are the creator address\\n /// @dev The next 8 bits are the chain index\\n /// @dev The next 8 bits are the tier\\n /// @dev The next 16 bits are the asset nonce\\n /// @dev The next 16 bits are assets reveal nonce.\\n /// @param creator The address of the creator of the asset\\n /// @param tier The tier of the asset determined by the catalyst used to create it\\n /// @param creatorNonce The nonce of the asset creator\\n /// @param revealNonce The reveal nonce of the asset\\n /// @param bridged Whether the asset is bridged or not\\n /// @return tokenId The generated token id\\n function generateTokenId(\\n address creator,\\n uint8 tier,\\n uint16 creatorNonce,\\n uint16 revealNonce,\\n bool bridged\\n ) internal pure returns (uint256 tokenId) {\\n uint160 creatorAddress = uint160(creator);\\n\\n tokenId = tokenId =\\n uint256(creatorAddress) |\\n (uint256(tier) << TIER_SHIFT) |\\n (uint256(creatorNonce) << NONCE_SHIFT) |\\n (uint256(revealNonce) << REVEAL_NONCE_SHIFT) |\\n (uint256(bridged ? 1 : 0) << BRIDGED_SHIFT);\\n\\n return tokenId;\\n }\\n\\n /// @notice Extracts the creator address from a given token id\\n /// @param tokenId The token id to extract the creator address from\\n /// @return creator The asset creator address\\n function getCreatorAddress(uint256 tokenId) internal pure returns (address creator) {\\n creator = address(uint160(tokenId));\\n return creator;\\n }\\n\\n /// @notice Extracts the tier from a given token id\\n /// @param tokenId The token id to extract the tier from\\n /// @return tier The asset tier, determined by the catalyst used to create it\\n function getTier(uint256 tokenId) internal pure returns (uint8 tier) {\\n tier = uint8((tokenId >> TIER_SHIFT) & TIER_MASK);\\n return tier;\\n }\\n\\n /// @notice Extracts the revealed flag from a given token id\\n /// @param tokenId The token id to extract the revealed flag from\\n /// @return isRevealed Whether the asset is revealed or not\\n function isRevealed(uint256 tokenId) internal pure returns (bool) {\\n uint16 revealNonce = getRevealNonce(tokenId);\\n return revealNonce != 0;\\n }\\n\\n /// @notice Extracts the asset nonce from a given token id\\n /// @param tokenId The token id to extract the asset nonce from\\n /// @return creatorNonce The asset creator nonce\\n function getCreatorNonce(uint256 tokenId) internal pure returns (uint16) {\\n uint16 creatorNonce = uint16((tokenId >> NONCE_SHIFT) & NONCE_MASK);\\n return creatorNonce;\\n }\\n\\n /// @notice Extracts the abilities and enhancements hash from a given token id\\n /// @param tokenId The token id to extract reveal nonce from\\n /// @return revealNonce The reveal nonce of the asset\\n function getRevealNonce(uint256 tokenId) internal pure returns (uint16) {\\n uint16 revealNonce = uint16((tokenId >> REVEAL_NONCE_SHIFT) & REVEAL_NONCE_MASK);\\n return revealNonce;\\n }\\n\\n /// @notice Extracts the bridged flag from a given token id\\n /// @param tokenId The token id to extract the bridged flag from\\n /// @return bridged Whether the asset is bridged or not\\n function isBridged(uint256 tokenId) internal pure returns (bool) {\\n bool bridged = ((tokenId >> BRIDGED_SHIFT) & BRIDGED_MASK) == 1;\\n return bridged;\\n }\\n\\n /// @notice Extracts the asset data from a given token id\\n /// @dev Created to limit the number of functions that need to be called when revealing an asset\\n /// @param tokenId The token id to extract the asset data from\\n function getData(uint256 tokenId) internal pure returns (IAsset.AssetData memory data) {\\n data.creator = getCreatorAddress(tokenId);\\n data.tier = getTier(tokenId);\\n data.revealed = isRevealed(tokenId);\\n data.creatorNonce = getCreatorNonce(tokenId);\\n data.bridged = isBridged(tokenId);\\n }\\n}\\n\",\"keccak256\":\"0x82f6bb065e85497d5486bcecb162c30df83941262ff5ac3fd8e283e946250839\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerAbstract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\n/// @dev minimal ERC2771 handler to keep bytecode-size down\\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\\nabstract contract ERC2771HandlerAbstract {\\n /// @notice return true if the forwarder is the trusted forwarder\\n /// @param forwarder trusted forwarder address to check\\n /// @return true if the address is the same as the trusted forwarder\\n function isTrustedForwarder(address forwarder) external view returns (bool) {\\n return _isTrustedForwarder(forwarder);\\n }\\n\\n /// @notice if the call is from the trusted forwarder the sender is extracted from calldata, msg.sender otherwise\\n /// @return sender the calculated address of the sender\\n function _msgSender() internal view virtual returns (address sender) {\\n if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\\n // The assembly code is more direct than the Solidity version using `abi.decode`.\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\\n }\\n } else {\\n sender = msg.sender;\\n }\\n }\\n\\n /// @notice if the call is from the trusted forwarder the sender is removed from calldata\\n /// @return the calldata without the sender\\n function _msgData() internal view virtual returns (bytes calldata) {\\n if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\\n return msg.data[:msg.data.length - 20];\\n } else {\\n return msg.data;\\n }\\n }\\n\\n /// @notice return true if the forwarder is the trusted forwarder\\n /// @param forwarder trusted forwarder address to check\\n /// @return true if the address is the same as the trusted forwarder\\n /// @dev this function must be IMPLEMENTED\\n function _isTrustedForwarder(address forwarder) internal view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xc4f349865ea7146f51b69f1edacdef60e0a2a7cf4dab538a5ae53ee9a0036231\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ERC2771HandlerAbstract} from \\\"./ERC2771HandlerAbstract.sol\\\";\\n\\n/// @dev minimal ERC2771 handler to keep bytecode-size down\\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\\ncontract ERC2771HandlerUpgradeable is Initializable, ERC2771HandlerAbstract {\\n address private _trustedForwarder;\\n\\n /// @notice Emitted when a `newTrustedForwarder` is set, replacing the `oldTrustedForwarder`\\n /// @param oldTrustedForwarder old trusted forwarder\\n /// @param newTrustedForwarder new trusted forwarder\\n /// @param operator the sender of the transaction\\n event TrustedForwarderSet(\\n address indexed oldTrustedForwarder,\\n address indexed newTrustedForwarder,\\n address indexed operator\\n );\\n\\n /// @notice initialize the trusted forwarder address\\n /// @param forwarder trusted forwarder address or zero to disable it\\n function __ERC2771Handler_init(address forwarder) internal onlyInitializing {\\n __ERC2771Handler_init_unchained(forwarder);\\n }\\n\\n /// @notice initialize the trusted forwarder address\\n /// @param forwarder trusted forwarder address or zero to disable it\\n function __ERC2771Handler_init_unchained(address forwarder) internal onlyInitializing {\\n _setTrustedForwarder(forwarder);\\n }\\n\\n /// @notice return the address of the trusted forwarder\\n /// @return return the address of the trusted forwarder\\n function getTrustedForwarder() external view returns (address) {\\n return _trustedForwarder;\\n }\\n\\n /// @notice set the address of the trusted forwarder\\n /// @param newForwarder the address of the new forwarder.\\n function _setTrustedForwarder(address newForwarder) internal virtual {\\n require(newForwarder != _trustedForwarder, \\\"ERC2771HandlerUpgradeable: forwarder already set\\\");\\n emit TrustedForwarderSet(_trustedForwarder, newForwarder, _msgSender());\\n _trustedForwarder = newForwarder;\\n }\\n\\n /// @notice return true if the forwarder is the trusted forwarder\\n /// @param forwarder trusted forwarder address to check\\n /// @return true if the address is the same as the trusted forwarder\\n function _isTrustedForwarder(address forwarder) internal view virtual override returns (bool) {\\n return forwarder == _trustedForwarder;\\n }\\n\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x63e53ca5ec229e51d866b0b8e3c8f36056598d9fbf960bb57b4b9731917af16f\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {IOperatorFilterRegistry} from \\\"./interfaces/IOperatorFilterRegistry.sol\\\";\\n\\n///@title OperatorFiltererUpgradeable\\n///@author The SandBox\\n///@notice This contract would subscibe or copy or just to the subscription provided or just register to default subscription list. The operator filter registry's addess could be set using a setter which could be implemented in inherting contract\\nabstract contract OperatorFiltererUpgradeable is Initializable {\\n IOperatorFilterRegistry public operatorFilterRegistry;\\n\\n function __OperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe) internal onlyInitializing {\\n operatorFilterRegistry = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); // Address of the operator filterer registry\\n // If an inheriting token contract is deployed to a network without the registry deployed, the modifier\\n // will not revert, but the contract will need to be registered with the registry once it is deployed in\\n // order for the modifier to filter addresses.\\n _registerAndSubscribe(subscriptionOrRegistrantToCopy, subscribe);\\n }\\n\\n function _registerAndSubscribe(address subscriptionOrRegistrantToCopy, bool subscribe) internal {\\n if (address(operatorFilterRegistry).code.length > 0) {\\n if (!operatorFilterRegistry.isRegistered(address(this))) {\\n if (subscribe) {\\n operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);\\n } else {\\n if (subscriptionOrRegistrantToCopy != address(0)) {\\n operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);\\n } else {\\n operatorFilterRegistry.register(address(this));\\n }\\n }\\n }\\n }\\n }\\n\\n modifier onlyAllowedOperator(address from) virtual {\\n // Check registry code length to facilitate testing in environments without a deployed registry.\\n if (address(operatorFilterRegistry).code.length > 0) {\\n // Allow spending tokens from addresses with balance\\n // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred\\n // from an EOA.\\n if (from == msg.sender) {\\n _;\\n return;\\n }\\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), msg.sender)) {\\n revert(\\\"Operator Not Allowed\\\");\\n }\\n }\\n _;\\n }\\n\\n modifier onlyAllowedOperatorApproval(address operator) virtual {\\n // Check registry code length to facilitate testing in environments without a deployed registry.\\n if (address(operatorFilterRegistry).code.length > 0) {\\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), operator)) {\\n revert(\\\"Operator Not Allowed\\\");\\n }\\n }\\n _;\\n }\\n}\\n\",\"keccak256\":\"0xf6ef88f614515540138818e5a41c4765445b8f4650713476b2f0435af61e70eb\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-operator-filter/contracts/interfaces/IOperatorFilterRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IOperatorFilterRegistry {\\n /**\\n * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns\\n * true if supplied registrant address is not registered.\\n */\\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\\n\\n /**\\n * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.\\n */\\n function register(address registrant) external;\\n\\n /**\\n * @notice Registers an address with the registry and \\\"subscribes\\\" to another address's filtered operators and codeHashes.\\n */\\n function registerAndSubscribe(address registrant, address subscription) external;\\n\\n /**\\n * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another\\n * address without subscribing.\\n */\\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\\n\\n /**\\n * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.\\n * Note that this does not remove any filtered addresses or codeHashes.\\n * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.\\n */\\n function unregister(address addr) external;\\n\\n /**\\n * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered.\\n */\\n function updateOperator(\\n address registrant,\\n address operator,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.\\n */\\n function updateOperators(\\n address registrant,\\n address[] calldata operators,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.\\n */\\n function updateCodeHash(\\n address registrant,\\n bytes32 codehash,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.\\n */\\n function updateCodeHashes(\\n address registrant,\\n bytes32[] calldata codeHashes,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous\\n * subscription if present.\\n * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,\\n * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be\\n * used.\\n */\\n function subscribe(address registrant, address registrantToSubscribe) external;\\n\\n /**\\n * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.\\n */\\n function unsubscribe(address registrant, bool copyExistingEntries) external;\\n\\n /**\\n * @notice Get the subscription address of a given registrant, if any.\\n */\\n function subscriptionOf(address addr) external returns (address registrant);\\n\\n /**\\n * @notice Get the set of addresses subscribed to a given registrant.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function subscribers(address registrant) external returns (address[] memory);\\n\\n /**\\n * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function subscriberAt(address registrant, uint256 index) external returns (address);\\n\\n /**\\n * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.\\n */\\n function copyEntriesOf(address registrant, address registrantToCopy) external;\\n\\n /**\\n * @notice Returns true if operator is filtered by a given address or its subscription.\\n */\\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\\n\\n /**\\n * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription.\\n */\\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\\n\\n /**\\n * @notice Returns true if a codeHash is filtered by a given address or its subscription.\\n */\\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\\n\\n /**\\n * @notice Returns a list of filtered operators for a given address or its subscription.\\n */\\n function filteredOperators(address addr) external returns (address[] memory);\\n\\n /**\\n * @notice Returns the set of filtered codeHashes for a given address or its subscription.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\\n\\n /**\\n * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or\\n * its subscription.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\\n\\n /**\\n * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or\\n * its subscription.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\\n\\n /**\\n * @notice Returns true if an address has registered\\n */\\n function isRegistered(address addr) external returns (bool);\\n\\n /**\\n * @dev Convenience method to compute the code hash of an arbitrary contract\\n */\\n function codeHashOf(address addr) external returns (bytes32);\\n}\\n\",\"keccak256\":\"0xbb4f80a4688ec5c4057fcf1e93d1683cee27bbc2eb9ba45fe02664057a4a14c6\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/MultiRoyaltyDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {ERC165Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\\\";\\nimport {EnumerableSet} from \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\nimport {Clones} from \\\"@openzeppelin/contracts/proxy/Clones.sol\\\";\\nimport {IMultiRoyaltyDistributor, IMultiRoyaltyRecipients} from \\\"./interfaces/IMultiRoyaltyDistributor.sol\\\";\\nimport {\\n IRoyaltySplitter,\\n IERC165\\n} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\nimport {IEIP2981} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/specs/IEIP2981.sol\\\";\\nimport {IRoyaltyManager, Recipient} from \\\"./interfaces/IRoyaltyManager.sol\\\";\\n\\n/// @title MultiRoyaltyDistributer\\n/// @author The Sandbox\\n/// @dev The MultiRoyaltyDistributer contract implements the ERC-2981 and ERC-165 interfaces for a royalty payment system. This payment system can be used to pay royalties to multiple recipients through splitters.\\n/// @dev This contract calls to the Royalties manager contract to deploy RoyaltySplitter for a creator to slip its royalty between the creator and Sandbox and use it for every token minted by that creator.\\nabstract contract MultiRoyaltyDistributor is IEIP2981, IMultiRoyaltyDistributor, ERC165Upgradeable {\\n uint16 internal constant TOTAL_BASIS_POINTS = 10000;\\n address public royaltyManager;\\n\\n mapping(uint256 => address payable) public _tokenRoyaltiesSplitter;\\n uint256[] private _tokensWithRoyalties;\\n\\n function __MultiRoyaltyDistributor_init(address _royaltyManager) internal {\\n royaltyManager = _royaltyManager;\\n }\\n\\n /// @notice EIP 165 interface function\\n /// @dev used to check the interface implemented\\n /// @param interfaceId to be checked for implementation\\n function supportsInterface(bytes4 interfaceId)\\n public\\n view\\n virtual\\n override(ERC165Upgradeable, IERC165)\\n returns (bool)\\n {\\n return\\n interfaceId == type(IEIP2981).interfaceId ||\\n interfaceId == type(IMultiRoyaltyDistributor).interfaceId ||\\n interfaceId == type(IMultiRoyaltyRecipients).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /// @notice sets token royalty\\n /// @dev deploys a splitter if a creator doesn't have one\\n /// @param tokenId id of token\\n /// @param creator of the token\\n function _setTokenRoyalties(\\n uint256 tokenId,\\n address payable recipient,\\n address creator\\n ) internal {\\n address payable creatorSplitterAddress = IRoyaltyManager(royaltyManager).deploySplitter(creator, recipient);\\n _tokenRoyaltiesSplitter[tokenId] = creatorSplitterAddress;\\n _tokensWithRoyalties.push(tokenId);\\n emit TokenRoyaltySet(tokenId, recipient);\\n }\\n\\n /// @notice Returns royalty receivers and their split of royalty for each token\\n /// @return royaltyConfigs receivers and their split array as long as the number of tokens.\\n function getTokenRoyalties() external view override returns (TokenRoyaltyConfig[] memory royaltyConfigs) {\\n royaltyConfigs = new TokenRoyaltyConfig[](_tokensWithRoyalties.length);\\n for (uint256 i; i < _tokensWithRoyalties.length; ++i) {\\n TokenRoyaltyConfig memory royaltyConfig;\\n uint256 tokenId = _tokensWithRoyalties[i];\\n address splitterAddress = _tokenRoyaltiesSplitter[tokenId];\\n if (splitterAddress != address(0)) {\\n royaltyConfig.recipients = IRoyaltySplitter(splitterAddress).getRecipients();\\n }\\n royaltyConfig.tokenId = tokenId;\\n royaltyConfigs[i] = royaltyConfig;\\n }\\n }\\n\\n /// @notice EIP 2981 royalty info function to return the royalty receiver and royalty amount\\n /// @param tokenId of the token for which the royalty is needed to be distributed\\n /// @param value the amount on which the royalty is calculated\\n /// @return address the royalty receiver\\n /// @return value the EIP2981 royalty\\n function royaltyInfo(uint256 tokenId, uint256 value) public view override returns (address, uint256) {\\n (address payable _defaultRoyaltyReceiver, uint16 _defaultRoyaltyBPS) =\\n IRoyaltyManager(royaltyManager).getRoyaltyInfo();\\n if (_tokenRoyaltiesSplitter[tokenId] != address(0)) {\\n return (_tokenRoyaltiesSplitter[tokenId], (value * _defaultRoyaltyBPS) / TOTAL_BASIS_POINTS);\\n }\\n if (_defaultRoyaltyReceiver != address(0) && _defaultRoyaltyBPS != 0) {\\n return (_defaultRoyaltyReceiver, (value * _defaultRoyaltyBPS) / TOTAL_BASIS_POINTS);\\n }\\n return (address(0), 0);\\n }\\n\\n /// @notice returns the EIP-2981 royalty receiver for each token (i.e. splitters) including the default royalty receiver.\\n /// @return splits the royalty receiver's array\\n function getAllSplits() external view override returns (address payable[] memory splits) {\\n uint256 startingIndex;\\n uint256 endingIndex = _tokensWithRoyalties.length;\\n (address payable _defaultRoyaltyReceiver, ) = IRoyaltyManager(royaltyManager).getRoyaltyInfo();\\n if (_defaultRoyaltyReceiver != address(0)) {\\n splits = new address payable[](1 + _tokensWithRoyalties.length);\\n splits[0] = _defaultRoyaltyReceiver;\\n startingIndex = 1;\\n ++endingIndex;\\n } else {\\n // unreachable in practice\\n splits = new address payable[](_tokensWithRoyalties.length);\\n }\\n for (uint256 i = startingIndex; i < endingIndex; ++i) {\\n splits[i] = _tokenRoyaltiesSplitter[_tokensWithRoyalties[i - startingIndex]];\\n }\\n }\\n\\n /// @notice returns the royalty recipients for each tokenId.\\n /// @dev returns the default address for tokens with no recipients.\\n /// @param tokenId is the token id for which the recipient should be returned.\\n /// @return addresses of royalty recipient of the token.\\n function getRecipients(uint256 tokenId) public view returns (Recipient[] memory) {\\n address payable splitterAddress = _tokenRoyaltiesSplitter[tokenId];\\n (address payable _defaultRoyaltyReceiver, ) = IRoyaltyManager(royaltyManager).getRoyaltyInfo();\\n if (splitterAddress != address(0)) {\\n return IRoyaltySplitter(splitterAddress).getRecipients();\\n }\\n Recipient[] memory defaultRecipient = new Recipient[](1);\\n defaultRecipient[0] = Recipient({recipient: _defaultRoyaltyReceiver, bps: TOTAL_BASIS_POINTS});\\n return defaultRecipient;\\n }\\n}\\n\",\"keccak256\":\"0x59272aee3bab952e4af9b5c28ce60cda251e2c08582795e4fc7321e643b92205\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IMultiRoyaltyDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {IMultiRoyaltyRecipients} from \\\"./IMultiRoyaltyRecipients.sol\\\";\\nimport {\\n IRoyaltySplitter,\\n Recipient\\n} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\n\\n/**\\n * Multi-receiver EIP2981 reference override implementation\\n */\\ninterface IMultiRoyaltyDistributor is IERC165, IMultiRoyaltyRecipients {\\n event TokenRoyaltyRemoved(uint256 tokenId);\\n event TokenRoyaltySet(uint256 tokenId, address recipient);\\n event DefaultRoyaltyBpsSet(uint16 royaltyBPS);\\n\\n event DefaultRoyaltyReceiverSet(address recipient);\\n\\n event RoyaltyRecipientSet(address splitter, address recipient);\\n\\n struct TokenRoyaltyConfig {\\n uint256 tokenId;\\n uint16 royaltyBPS;\\n Recipient[] recipients;\\n }\\n\\n /**\\n * @dev Set per token royalties. Passing a recipient of address(0) will delete any existing configuration\\n */\\n function setTokenRoyalties(\\n uint256 tokenId,\\n address payable recipient,\\n address creator\\n ) external;\\n\\n /**\\n * @dev Get all token royalty configurations\\n */\\n function getTokenRoyalties() external view returns (TokenRoyaltyConfig[] memory);\\n\\n /**\\n * @dev Helper function to get all splits contracts\\n */\\n function getAllSplits() external view returns (address payable[] memory);\\n}\\n\",\"keccak256\":\"0x8b3ef711d6cb368d65ac7c6c5b617cab63b918ef474da891527f7e176c480f9f\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IMultiRoyaltyRecipients.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {Recipient} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\n\\n/**\\n * Multi-receiver EIP2981 reference override implementation\\n */\\ninterface IMultiRoyaltyRecipients is IERC165 {\\n /**\\n * @dev Helper function to get all recipients\\n */\\n function getRecipients(uint256 tokenId) external view returns (Recipient[] memory);\\n}\\n\",\"keccak256\":\"0x06f13c04f2840fdec87edbb15f4805977f8d18562e942cad023fe65685369ebf\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {Recipient} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\n\\ninterface IRoyaltyManager {\\n event RecipientSet(address commonRecipient);\\n\\n event SplitSet(uint16 commonSplit);\\n\\n event RoyaltySet(uint16 royaltyBps, address contractAddress);\\n\\n function setRecipient(address payable _commonRecipient) external;\\n\\n function setSplit(uint16 commonSplit) external;\\n\\n function getCommonRecipient() external view returns (Recipient memory recipient);\\n\\n function getCreatorSplit() external view returns (uint16);\\n\\n function getRoyaltyInfo() external view returns (address payable, uint16);\\n\\n function deploySplitter(address creator, address payable recipient) external returns (address payable);\\n\\n function getCreatorRoyaltySplitter(address creator) external view returns (address payable);\\n\\n function getContractRoyalty(address _contractAddress) external view returns (uint16 royaltyBps);\\n\\n function setTrustedForwarder(address _newForwarder) external;\\n\\n function getTrustedForwarder() external view returns (address);\\n}\\n\",\"keccak256\":\"0x5193f7ce9bce4ac3facefdaa6172e0a0b8868356ca232d33cfb70a24e7b84cc2\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyUGC.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IRoyaltyUGC {\\n function getCreatorAddress(uint256 tokenId) external pure returns (address creator);\\n}\\n\",\"keccak256\":\"0xa43870e62369bafb23450ad5e3948906ee832adcc5b8f1812c802533ea6f32a0\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e3565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61505780620000f36000396000f3fe608060405234801561001057600080fd5b506004361061032a5760003560e01c806381de2dc2116101b2578063bb7fde71116100f9578063da742228116100a2578063f242432a1161007c578063f242432a14610809578063f5298aca1461081c578063fd90e8971461082f578063fdda1d0e1461084f57600080fd5b8063da742228146107a6578063e985e9c5146107b9578063ee295d62146107f557600080fd5b8063ce1b815f116100d3578063ce1b815f14610755578063d53913931461076c578063d547741f1461079357600080fd5b8063bb7fde711461070c578063bd85b0391461071f578063befa66451461074057600080fd5b8063a22cb4651161015b578063abe3960311610135578063abe39603146106b9578063ac4a0fb6146106e5578063b0ccc31e146106f857600080fd5b8063a22cb46514610680578063a30b4db914610693578063a55784ef146106a657600080fd5b806397905c1e1161018c57806397905c1e146106505780639d28fb8614610665578063a217fddf1461067857600080fd5b806381de2dc2146105f157806391d1485414610604578063933f39581461063d57600080fd5b806336568abe1161027657806355f804b31161021f5780636b566cb2116101f95780636b566cb214610575578063791459ea146105b7578063797669c9146105ca57600080fd5b806355f804b31461053c578063572b6c051461054f5780636b20c4541461056257600080fd5b80634f124995116102505780634f124995146104f35780634f558e79146105065780635055fbc31461052957600080fd5b806336568abe1461049b5780634e1273f4146104ae5780634f062c5a146104ce57600080fd5b8063248a9ca3116102d85780632a55205a116102b25780632a55205a146104435780632eb2c2d6146104755780632f2ff15d1461048857600080fd5b8063248a9ca3146103d3578063282c51f3146103f65780632a41a3551461041d57600080fd5b8063124d91e511610309578063124d91e514610398578063162094c4146103ad57806320820ec3146103c057600080fd5b8062fdd58e1461032f57806301ffc9a7146103555780630e89341c14610378575b600080fd5b61034261033d366004614000565b610862565b6040519081526020015b60405180910390f35b610368610363366004614042565b610910565b604051901515815260200161034c565b61038b61038636600461405f565b61094e565b60405161034c91906140c8565b6103ab6103a63660046140db565b610959565b005b6103ab6103bb3660046141ed565b610994565b6103ab6103ce3660046142c9565b6109cd565b6103426103e136600461405f565b600090815260fa602052604090206001015490565b6103427f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84881565b61043061042b36600461405f565b610a02565b60405161ffff909116815260200161034c565b61045661045136600461433f565b610a12565b604080516001600160a01b03909316835260208301919091520161034c565b6103ab610483366004614361565b610b34565b6103ab61049636600461440f565b610c3f565b6103ab6104a936600461440f565b610c64565b6104c16104bc36600461443f565b610d00565b60405161034c919061453d565b6104e16104dc36600461405f565b610e3e565b60405160ff909116815260200161034c565b6103ab610501366004614550565b610e4d565b61036861051436600461405f565b600090815261012c6020526040902054151590565b61036861053736600461405f565b610e63565b6103ab61054a366004614592565b610e6e565b61036861055d3660046145c7565b610e82565b6103ab6105703660046142c9565b610e9f565b61059f61058336600461405f565b610192602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200161034c565b6103ab6105c53660046145f2565b610f3b565b6103427f71f3d55856e4058ed06ee057d79ada615f65cdf5f9ee88181b914225088f834f81565b6104306105ff36600461405f565b610fcc565b61036861061236600461440f565b600091825260fa602090815260408084206001600160a01b0393909316845291905290205460ff1690565b61036861064b36600461405f565b610fdc565b610658610fed565b60405161034c9190614668565b6103ab6106733660046145c7565b611173565b610342600081565b6103ab61068e3660046145f2565b611213565b61059f6106a136600461405f565b6112fb565b6103ab6106b4366004614709565b611303565b6103426106c7366004614592565b80516020818301810180516101948252928201919093012091525481565b6103ab6106f3366004614821565b6114f8565b6101905461059f906001600160a01b031681565b6103ab61071a3660046148ab565b61167d565b61034261072d36600461405f565b600090815261012c602052604090205490565b6107486116d8565b60405161034c919061490e565b6000546201000090046001600160a01b031661059f565b6103427f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6103ab6107a136600461440f565b6118f2565b6103ab6107b43660046145c7565b611917565b6103686107c736600461495b565b6001600160a01b03918216600090815260976020908152604080832093909416825291909152205460ff1690565b6101915461059f906001600160a01b031681565b6103ab610817366004614989565b6119a7565b6103ab61082a3660046140db565b611bc7565b61084261083d36600461405f565b611c63565b60405161034c91906149f2565b61034261085d366004614592565b611e08565b60006001600160a01b0383166108e55760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201527f616c6964206f776e65720000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b5060008181526096602090815260408083206001600160a01b03861684529091529020545b92915050565b60006001600160e01b031982167fa30b4db900000000000000000000000000000000000000000000000000000000148061090a575061090a82611e31565b606061090a82611ed7565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84861098381611fb9565b61098e848484611fcd565b50505050565b7f71f3d55856e4058ed06ee057d79ada615f65cdf5f9ee88181b914225088f834f6109be81611fb9565b6109c883836121a4565b505050565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a8486109f781611fb9565b61098e848484612202565b600061090a8260b81c61ffff1690565b60008060008061019160009054906101000a90046001600160a01b03166001600160a01b031663a86a28d16040518163ffffffff1660e01b81526004016040805180830381865afa158015610a6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8f9190614a1c565b6000888152610192602052604090205491935091506001600160a01b031615610af157600086815261019260205260409020546001600160a01b0316612710610adc61ffff841688614a67565b610ae69190614a7e565b935093505050610b2d565b6001600160a01b03821615801590610b0c575061ffff811615155b15610b235781612710610adc61ffff841688614a67565b6000809350935050505b9250929050565b6101905485906001600160a01b03163b15610c2a57336001600160a01b03821603610b6b57610b668686868686612494565b610c37565b61019054604051633185c44d60e21b81523060048201523360248201526001600160a01b039091169063c617113490604401602060405180830381865afa158015610bba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bde9190614aa0565b610c2a5760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f77656400000000000000000000000060448201526064016108dc565b610c378686868686612494565b505050505050565b600082815260fa6020526040902060010154610c5a81611fb9565b6109c88383612539565b610c6c6125dc565b6001600160a01b0316816001600160a01b031614610cf25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016108dc565b610cfc82826125eb565b5050565b60608151835114610d795760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d61746368000000000000000000000000000000000000000000000060648201526084016108dc565b6000835167ffffffffffffffff811115610d9557610d95614110565b604051908082528060200260200182016040528015610dbe578160200160208202803683370190505b50905060005b8451811015610e3657610e09858281518110610de257610de2614abd565b6020026020010151858381518110610dfc57610dfc614abd565b6020026020010151610862565b828281518110610e1b57610e1b614abd565b6020908102919091010152610e2f81614ad3565b9050610dc4565b509392505050565b600061090a8260a01c60ff1690565b6000610e5881611fb9565b61098e84848461268c565b600061090a826127de565b6000610e7981611fb9565b610cfc826127fc565b600080546001600160a01b0383811662010000909204161461090a565b610ea76125dc565b6001600160a01b0316836001600160a01b03161480610ecd5750610ecd836107c76125dc565b610f305760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108dc565b6109c8838383612202565b6000610f4681611fb9565b6001600160a01b038316610fc25760405162461bcd60e51b815260206004820152602960248201527f41737365743a20737562736372697074696f6e2063616e2774206265207a657260448201527f6f2061646472657373000000000000000000000000000000000000000000000060648201526084016108dc565b6109c88383612809565b600061090a8260a81c61ffff1690565b6000600160c883901c81161461090a565b6101935460609067ffffffffffffffff81111561100c5761100c614110565b60405190808252806020026020018201604052801561105957816020015b6040805160608082018352600080835260208301529181019190915281526020019060019003908161102a5790505b50905060005b6101935481101561116f57604080516060808201835260008083526020830152918101919091526000610193838154811061109c5761109c614abd565b60009182526020808320909101548083526101929091526040909120549091506001600160a01b0316801561113757806001600160a01b031663d78d610b6040518163ffffffff1660e01b8152600401600060405180830381865afa158015611109573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111319190810190614aed565b60408401525b8183528451839086908690811061115057611150614abd565b60200260200101819052505050508061116890614ad3565b905061105f565b5090565b600061117e81611fb9565b6001600160a01b0382166111e25760405162461bcd60e51b815260206004820152602560248201527f41737365743a2072656769737472792063616e2774206265207a65726f206164604482015264647265737360d81b60648201526084016108dc565b50610190805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6101905482906001600160a01b03163b156112e95761019054604051633185c44d60e21b81523060048201526001600160a01b0383811660248301529091169063c617113490604401602060405180830381865afa158015611279573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129d9190614aa0565b6112e95760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f77656400000000000000000000000060448201526064016108dc565b6109c86112f46125dc565b84846129d5565b60008161090a565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661132d81611fb9565b81518451146113a45760405162461bcd60e51b815260206004820152602b60248201527f41737365743a2069647320616e64206d6574616461746148617368206c656e6760448201527f7468206d69736d6174636800000000000000000000000000000000000000000060648201526084016108dc565b825184511461141b5760405162461bcd60e51b815260206004820152602660248201527f41737365743a2069647320616e6420616d6f756e7473206c656e677468206d6960448201527f736d61746368000000000000000000000000000000000000000000000000000060648201526084016108dc565b60005b84518110156114755761146385828151811061143c5761143c614abd565b602002602001015184838151811061145657611456614abd565b6020026020010151612ac9565b8061146d81614ad3565b91505061141e565b5061149185858560405180602001604052806000815250612bb0565b60005b8451811015610c375760006114bf8683815181106114b4576114b4614abd565b602002602001015190565b90506114e58683815181106114d6576114d6614abd565b6020026020010151828361268c565b50806114f081614ad3565b915050611494565b600054610100900460ff16158080156115185750600054600160ff909116105b806115325750303b158015611532575060005460ff166001145b6115a45760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016108dc565b6000805460ff1916600117905580156115c7576000805461ff0019166101001790555b6115d0846127fc565b6115d8612dad565b6115e0612dad565b6115e986612e1a565b6115f1612dad565b6115fc600086612539565b611607836001612e8e565b610191805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384161790558015610c37576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a66116a781611fb9565b6116b18483612ac9565b6116cc85858560405180602001604052806000815250612f31565b83610c3781808061268c565b6101935461019154604080517fa86a28d10000000000000000000000000000000000000000000000000000000081528151606094600094909385936001600160a01b039092169263a86a28d19260048082019392918290030181865afa158015611746573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176a9190614a1c565b5090506001600160a01b0381161561180f576101935461178b906001614bc0565b67ffffffffffffffff8111156117a3576117a3614110565b6040519080825280602002602001820160405280156117cc578160200160208202803683370190505b50935080846000815181106117e3576117e3614abd565b6001600160a01b03909216602092830291909101909101526001925061180882614ad3565b9150611858565b6101935467ffffffffffffffff81111561182b5761182b614110565b604051908082528060200260200182016040528015611854578160200160208202803683370190505b5093505b825b828110156118eb5761019260006101936118748785614bd3565b8154811061188457611884614abd565b9060005260206000200154815260200190815260200160002060009054906101000a90046001600160a01b03168582815181106118c3576118c3614abd565b6001600160a01b03909216602092830291909101909101526118e481614ad3565b905061185a565b5050505090565b600082815260fa602052604090206001015461190d81611fb9565b6109c883836125eb565b600061192281611fb9565b6001600160a01b03821661199e5760405162461bcd60e51b815260206004820152602e60248201527f41737365743a207472757374656420666f727761726465722063616e2774206260448201527f65207a65726f206164647265737300000000000000000000000000000000000060648201526084016108dc565b610cfc82613074565b6101905485906001600160a01b03163b15611b2957336001600160a01b03821603611a6a576119d46125dc565b6001600160a01b0316866001600160a01b031614806119fa57506119fa866107c76125dc565b611a5d5760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108dc565b610b668686868686613189565b61019054604051633185c44d60e21b81523060048201523360248201526001600160a01b039091169063c617113490604401602060405180830381865afa158015611ab9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611add9190614aa0565b611b295760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f77656400000000000000000000000060448201526064016108dc565b611b316125dc565b6001600160a01b0316866001600160a01b03161480611b575750611b57866107c76125dc565b611bba5760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108dc565b610c378686868686613189565b611bcf6125dc565b6001600160a01b0316836001600160a01b03161480611bf55750611bf5836107c76125dc565b611c585760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108dc565b6109c8838383611fcd565b60008181526101926020526040808220546101915482517fa86a28d100000000000000000000000000000000000000000000000000000000815283516060956001600160a01b039485169590949093169263a86a28d192600480820193918290030181865afa158015611cda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cfe9190614a1c565b5090506001600160a01b03821615611d7e57816001600160a01b031663d78d610b6040518163ffffffff1660e01b8152600401600060405180830381865afa158015611d4e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d769190810190614aed565b949350505050565b604080516001808252818301909252600091816020015b6040805180820190915260008082526020820152815260200190600190039081611d955790505090506040518060400160405280836001600160a01b0316815260200161271061ffff1681525081600081518110611df557611df5614abd565b6020908102919091010152949350505050565b600061019482604051611e1b9190614be6565b9081526020016040518091039020549050919050565b60006001600160e01b031982167f2a55205a000000000000000000000000000000000000000000000000000000001480611e9457506001600160e01b031982167f667873ce00000000000000000000000000000000000000000000000000000000145b80611ec857506001600160e01b031982167ffd90e89700000000000000000000000000000000000000000000000000000000145b8061090a575061090a82613364565b600081815261015f6020526040812080546060929190611ef690614c02565b80601f0160208091040260200160405190810160405280929190818152602001828054611f2290614c02565b8015611f6f5780601f10611f4457610100808354040283529160200191611f6f565b820191906000526020600020905b815481529060010190602001808311611f5257829003601f168201915b505050505090506000815111611f8d57611f88836133a2565b611fb2565b61015e81604051602001611fa2929190614c3c565b6040516020818303038152906040525b9392505050565b611fca81611fc56125dc565b613436565b50565b6001600160a01b0383166120495760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016108dc565b60006120536125dc565b90506000612060846134ab565b9050600061206d846134ab565b905061208d838760008585604051806020016040528060008152506134f6565b60008581526096602090815260408083206001600160a01b038a168452909152902054848110156121255760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e63650000000000000000000000000000000000000000000000000000000060648201526084016108dc565b60008681526096602090815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46040805160208101909152600090525b50505050505050565b600082815261015f602052604090206121bd8282614d09565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b6121e98461094e565b6040516121f691906140c8565b60405180910390a25050565b6001600160a01b03831661227e5760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016108dc565b80518251146122e05760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016108dc565b60006122ea6125dc565b905061230a818560008686604051806020016040528060008152506134f6565b60005b835181101561242757600084828151811061232a5761232a614abd565b60200260200101519050600084838151811061234857612348614abd565b60209081029190910181015160008481526096835260408082206001600160a01b038c1683529093529190912054909150818110156123ee5760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e63650000000000000000000000000000000000000000000000000000000060648201526084016108dc565b60009283526096602090815260408085206001600160a01b038b168652909152909220910390558061241f81614ad3565b91505061230d565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051612478929190614dc9565b60405180910390a460408051602081019091526000905261098e565b61249c6125dc565b6001600160a01b0316856001600160a01b031614806124c257506124c2856107c76125dc565b6125255760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108dc565b6125328585858585613504565b5050505050565b600082815260fa602090815260408083206001600160a01b038516845290915290205460ff16610cfc57600082815260fa602090815260408083206001600160a01b03851684529091529020805460ff191660011790556125986125dc565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006125e6613789565b905090565b600082815260fa602090815260408083206001600160a01b038516845290915290205460ff1615610cfc57600082815260fa602090815260408083206001600160a01b03851684529091529020805460ff191690556126486125dc565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b610191546040517ff06040b40000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301528481166024830152600092169063f06040b4906044016020604051808303816000875af11580156126fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061271f9190614df7565b6000858152610192602052604080822080546001600160a01b03851673ffffffffffffffffffffffffffffffffffffffff19909116179055610193805460018101825592527ffc8af01f449989052b52093a58fc9f42d0b11f0c6dd5dca0463dab62346ccc68909101869055519091507f5fe98ba0109a6edc7f59e8c943b6a42a0d8508aebe2e37c874eca88f747bb077906127d090869086909182526001600160a01b0316602082015260400190565b60405180910390a150505050565b6000806127ef8360b81c61ffff1690565b61ffff1615159392505050565b61015e610cfc8282614d09565b610190546001600160a01b03163b15610cfc57610190546040517fc3c5a5470000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b039091169063c3c5a547906024016020604051808303816000875af1158015612880573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128a49190614aa0565b610cfc57801561292a57610190546040517f7d3e3dbe0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03848116602483015290911690637d3e3dbe906044015b600060405180830381600087803b15801561291657600080fd5b505af1158015610c37573d6000803e3d6000fd5b6001600160a01b0382161561298b57610190546040517fa0af29030000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0384811660248301529091169063a0af2903906044016128fc565b610190546040517f4420e4860000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0390911690634420e486906024016128fc565b816001600160a01b0316836001600160a01b031603612a5c5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084016108dc565b6001600160a01b03838116600081815260976020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61019481604051612ada9190614be6565b908152602001604051809103902054600014612b84578161019482604051612b029190614be6565b90815260200160405180910390205414610cfc5760405162461bcd60e51b815260206004820152602960248201527f41737365743a206e6f7420616c6c6f77656420746f207265757365206d65746160448201527f646174612068617368000000000000000000000000000000000000000000000060648201526084016108dc565b8161019482604051612b969190614be6565b90815260405190819003602001902055610cfc82826121a4565b6001600160a01b038416612c2c5760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016108dc565b8151835114612c8e5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016108dc565b6000612c986125dc565b9050612ca9816000878787876134f6565b60005b8451811015612d4557838181518110612cc757612cc7614abd565b602002602001015160966000878481518110612ce557612ce5614abd565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b031681526020019081526020016000206000828254612d2d9190614bc0565b90915550819050612d3d81614ad3565b915050612cac565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051612d96929190614dc9565b60405180910390a4612532816000878787876137e1565b600054610100900460ff16612e185760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016108dc565b565b600054610100900460ff16612e855760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016108dc565b611fca816139cd565b600054610100900460ff16612ef95760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016108dc565b610190805473ffffffffffffffffffffffffffffffffffffffff19166daaeb6d7670e522a718067333cd4e179055610cfc8282612809565b6001600160a01b038416612fad5760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016108dc565b6000612fb76125dc565b90506000612fc4856134ab565b90506000612fd1856134ab565b9050612fe2836000898585896134f6565b60008681526096602090815260408083206001600160a01b038b16845290915281208054879290613014908490614bc0565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461219b83600089898989613a41565b6000546001600160a01b03620100009091048116908216036130fe5760405162461bcd60e51b815260206004820152603060248201527f4552433237373148616e646c65725570677261646561626c653a20666f72776160448201527f7264657220616c7265616479207365740000000000000000000000000000000060648201526084016108dc565b6131066125dc565b600080546040516001600160a01b0393841693858116936201000090930416917f8ca022029d8ff7ad974913f8970aeed6c5e0e7eaf494a0c5b262249f6b5759e591a4600080546001600160a01b0390921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6001600160a01b0384166131ed5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b60648201526084016108dc565b60006131f76125dc565b90506000613204856134ab565b90506000613211856134ab565b90506132218389898585896134f6565b60008681526096602090815260408083206001600160a01b038c168452909152902054858110156132ba5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016108dc565b60008781526096602090815260408083206001600160a01b038d8116855292528083208985039055908a168252812080548892906132f9908490614bc0565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4613359848a8a8a8a8a613a41565b505050505050505050565b60006001600160e01b031982167f7965db0b00000000000000000000000000000000000000000000000000000000148061090a575061090a82613b84565b6060609880546133b190614c02565b80601f01602080910402602001604051908101604052809291908181526020018280546133dd90614c02565b801561342a5780601f106133ff5761010080835404028352916020019161342a565b820191906000526020600020905b81548152906001019060200180831161340d57829003601f168201915b50505050509050919050565b600082815260fa602090815260408083206001600160a01b038516845290915290205460ff16610cfc5761346981613c1f565b613474836020613c31565b604051602001613485929190614e14565b60408051601f198184030181529082905262461bcd60e51b82526108dc916004016140c8565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106134e5576134e5614abd565b602090810291909101015292915050565b610c37868686868686613e5a565b81518351146135665760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016108dc565b6001600160a01b0384166135ca5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b60648201526084016108dc565b60006135d46125dc565b90506135e48187878787876134f6565b60005b845181101561372357600085828151811061360457613604614abd565b60200260200101519050600085838151811061362257613622614abd565b60209081029190910181015160008481526096835260408082206001600160a01b038e1683529093529190912054909150818110156136c95760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016108dc565b60008381526096602090815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290613708908490614bc0565b925050819055505050508061371c90614ad3565b90506135e7565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051613773929190614dc9565b60405180910390a4610c378187878787876137e1565b600080546201000090046001600160a01b0316331480156137ab575060143610155b156137db57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b50335b90565b6001600160a01b0384163b15610c37576040517fbc197c810000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063bc197c819061383e9089908990889088908890600401614e95565b6020604051808303816000875af1925050508015613879575060408051601f3d908101601f1916820190925261387691810190614ee7565b60015b61392e57613885614f04565b806308c379a0036138be5750613899614f1f565b806138a457506138c0565b8060405162461bcd60e51b81526004016108dc91906140c8565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d4552433131353560448201527f526563656976657220696d706c656d656e74657200000000000000000000000060648201526084016108dc565b6001600160e01b031981167fbc197c81000000000000000000000000000000000000000000000000000000001461219b5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016108dc565b600054610100900460ff16613a385760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016108dc565b611fca81613074565b6001600160a01b0384163b15610c37576040517ff23a6e610000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063f23a6e6190613a9e9089908990889088908890600401614fc7565b6020604051808303816000875af1925050508015613ad9575060408051601f3d908101601f19168201909252613ad691810190614ee7565b60015b613ae557613885614f04565b6001600160e01b031981167ff23a6e61000000000000000000000000000000000000000000000000000000001461219b5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016108dc565b60006001600160e01b031982167fd9b67a26000000000000000000000000000000000000000000000000000000001480613be757506001600160e01b031982167f0e89341c00000000000000000000000000000000000000000000000000000000145b8061090a57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161461090a565b606061090a6001600160a01b03831660145b60606000613c40836002614a67565b613c4b906002614bc0565b67ffffffffffffffff811115613c6357613c63614110565b6040519080825280601f01601f191660200182016040528015613c8d576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110613cc457613cc4614abd565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110613d2757613d27614abd565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000613d63846002614a67565b613d6e906001614bc0565b90505b6001811115613e0b577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110613daf57613daf614abd565b1a60f81b828281518110613dc557613dc5614abd565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93613e048161500a565b9050613d71565b508315611fb25760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108dc565b6001600160a01b038516613ee25760005b8351811015613ee057828181518110613e8657613e86614abd565b602002602001015161012c6000868481518110613ea557613ea5614abd565b602002602001015181526020019081526020016000206000828254613eca9190614bc0565b90915550613ed9905081614ad3565b9050613e6b565b505b6001600160a01b038416610c375760005b835181101561219b576000848281518110613f1057613f10614abd565b602002602001015190506000848381518110613f2e57613f2e614abd565b60200260200101519050600061012c600084815260200190815260200160002054905081811015613fc75760405162461bcd60e51b815260206004820152602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f7460448201527f616c537570706c7900000000000000000000000000000000000000000000000060648201526084016108dc565b600092835261012c602052604090922091039055613fe481614ad3565b9050613ef3565b6001600160a01b0381168114611fca57600080fd5b6000806040838503121561401357600080fd5b823561401e81613feb565b946020939093013593505050565b6001600160e01b031981168114611fca57600080fd5b60006020828403121561405457600080fd5b8135611fb28161402c565b60006020828403121561407157600080fd5b5035919050565b60005b8381101561409357818101518382015260200161407b565b50506000910152565b600081518084526140b4816020860160208601614078565b601f01601f19169290920160200192915050565b602081526000611fb2602083018461409c565b6000806000606084860312156140f057600080fd5b83356140fb81613feb565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b6040810181811067ffffffffffffffff8211171561414657614146614110565b60405250565b601f19601f830116810181811067ffffffffffffffff8211171561417257614172614110565b6040525050565b600082601f83011261418a57600080fd5b813567ffffffffffffffff8111156141a4576141a4614110565b6040516141bb6020601f19601f850116018261414c565b8181528460208386010111156141d057600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561420057600080fd5b82359150602083013567ffffffffffffffff81111561421e57600080fd5b61422a85828601614179565b9150509250929050565b600067ffffffffffffffff82111561424e5761424e614110565b5060051b60200190565b600082601f83011261426957600080fd5b8135602061427682614234565b604051614283828261414c565b83815260059390931b85018201928281019150868411156142a357600080fd5b8286015b848110156142be57803583529183019183016142a7565b509695505050505050565b6000806000606084860312156142de57600080fd5b83356142e981613feb565b9250602084013567ffffffffffffffff8082111561430657600080fd5b61431287838801614258565b9350604086013591508082111561432857600080fd5b5061433586828701614258565b9150509250925092565b6000806040838503121561435257600080fd5b50508035926020909101359150565b600080600080600060a0868803121561437957600080fd5b853561438481613feb565b9450602086013561439481613feb565b9350604086013567ffffffffffffffff808211156143b157600080fd5b6143bd89838a01614258565b945060608801359150808211156143d357600080fd5b6143df89838a01614258565b935060808801359150808211156143f557600080fd5b5061440288828901614179565b9150509295509295909350565b6000806040838503121561442257600080fd5b82359150602083013561443481613feb565b809150509250929050565b6000806040838503121561445257600080fd5b823567ffffffffffffffff8082111561446a57600080fd5b818501915085601f83011261447e57600080fd5b8135602061448b82614234565b604051614498828261414c565b83815260059390931b85018201928281019150898411156144b857600080fd5b948201945b838610156144df5785356144d081613feb565b825294820194908201906144bd565b965050860135925050808211156144f557600080fd5b5061422a85828601614258565b600081518084526020808501945080840160005b8381101561453257815187529582019590820190600101614516565b509495945050505050565b602081526000611fb26020830184614502565b60008060006060848603121561456557600080fd5b83359250602084013561457781613feb565b9150604084013561458781613feb565b809150509250925092565b6000602082840312156145a457600080fd5b813567ffffffffffffffff8111156145bb57600080fd5b611d7684828501614179565b6000602082840312156145d957600080fd5b8135611fb281613feb565b8015158114611fca57600080fd5b6000806040838503121561460557600080fd5b823561461081613feb565b91506020830135614434816145e4565b600081518084526020808501945080840160005b8381101561453257815180516001600160a01b0316885283015161ffff168388015260409096019590820190600101614634565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b838110156146fb578883037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00185528151805184528781015161ffff168885015286015160608785018190526146e781860183614620565b96890196945050509086019060010161468f565b509098975050505050505050565b6000806000806080858703121561471f57600080fd5b843561472a81613feb565b935060208581013567ffffffffffffffff8082111561474857600080fd5b61475489838a01614258565b9550604088013591508082111561476a57600080fd5b61477689838a01614258565b9450606088013591508082111561478c57600080fd5b818801915088601f8301126147a057600080fd5b81356147ab81614234565b6040516147b8828261414c565b82815260059290921b840185019185810191508b8311156147d857600080fd5b8585015b83811015614810578035858111156147f45760008081fd5b6148028e89838a0101614179565b8452509186019186016147dc565b50989b979a50959850505050505050565b600080600080600060a0868803121561483957600080fd5b853561484481613feb565b9450602086013561485481613feb565b9350604086013567ffffffffffffffff81111561487057600080fd5b61487c88828901614179565b935050606086013561488d81613feb565b9150608086013561489d81613feb565b809150509295509295909350565b600080600080608085870312156148c157600080fd5b84356148cc81613feb565b93506020850135925060408501359150606085013567ffffffffffffffff8111156148f657600080fd5b61490287828801614179565b91505092959194509250565b6020808252825182820181905260009190848201906040850190845b8181101561494f5783516001600160a01b03168352928401929184019160010161492a565b50909695505050505050565b6000806040838503121561496e57600080fd5b823561497981613feb565b9150602083013561443481613feb565b600080600080600060a086880312156149a157600080fd5b85356149ac81613feb565b945060208601356149bc81613feb565b93506040860135925060608601359150608086013567ffffffffffffffff8111156149e657600080fd5b61440288828901614179565b602081526000611fb26020830184614620565b805161ffff81168114614a1757600080fd5b919050565b60008060408385031215614a2f57600080fd5b8251614a3a81613feb565b9150614a4860208401614a05565b90509250929050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761090a5761090a614a51565b600082614a9b57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215614ab257600080fd5b8151611fb2816145e4565b634e487b7160e01b600052603260045260246000fd5b60006000198203614ae657614ae6614a51565b5060010190565b60006020808385031215614b0057600080fd5b825167ffffffffffffffff811115614b1757600080fd5b8301601f81018513614b2857600080fd5b8051614b3381614234565b60408051614b41838261414c565b83815260069390931b8401850192858101925088841115614b6157600080fd5b938501935b83851015614bb45781858a031215614b7e5760008081fd5b8151614b8981614126565b8551614b9481613feb565b8152614ba1868801614a05565b8188015283529381019391850191614b66565b98975050505050505050565b8082018082111561090a5761090a614a51565b8181038181111561090a5761090a614a51565b60008251614bf8818460208701614078565b9190910192915050565b600181811c90821680614c1657607f821691505b602082108103614c3657634e487b7160e01b600052602260045260246000fd5b50919050565b6000808454614c4a81614c02565b60018281168015614c625760018114614c7757614ca6565b60ff1984168752821515830287019450614ca6565b8860005260208060002060005b85811015614c9d5781548a820152908401908201614c84565b50505082870194505b505050508351614cba818360208801614078565b01949350505050565b601f8211156109c857600081815260208120601f850160051c81016020861015614cea5750805b601f850160051c820191505b81811015610c3757828155600101614cf6565b815167ffffffffffffffff811115614d2357614d23614110565b614d3781614d318454614c02565b84614cc3565b602080601f831160018114614d6c5760008415614d545750858301515b600019600386901b1c1916600185901b178555610c37565b600085815260208120601f198616915b82811015614d9b57888601518255948401946001909101908401614d7c565b5085821015614db95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000614ddc6040830185614502565b8281036020840152614dee8185614502565b95945050505050565b600060208284031215614e0957600080fd5b8151611fb281613feb565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614e4c816017850160208801614078565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351614e89816028840160208801614078565b01602801949350505050565b60006001600160a01b03808816835280871660208401525060a06040830152614ec160a0830186614502565b8281036060840152614ed38186614502565b90508281036080840152614bb4818561409c565b600060208284031215614ef957600080fd5b8151611fb28161402c565b600060033d11156137de5760046000803e5060005160e01c90565b600060443d1015614f2d5790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff8160248401118184111715614f7b57505050505090565b8285019150815181811115614f935750505050505090565b843d8701016020828501011115614fad5750505050505090565b614fbc6020828601018761414c565b509095945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152614fff60a083018461409c565b979650505050505050565b60008161501957615019614a51565b50600019019056fea2646970667358221220a3e246bc82a18932f1515ef30b71f1db320dfb57fefb24e64182297694f9f4da64736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061032a5760003560e01c806381de2dc2116101b2578063bb7fde71116100f9578063da742228116100a2578063f242432a1161007c578063f242432a14610809578063f5298aca1461081c578063fd90e8971461082f578063fdda1d0e1461084f57600080fd5b8063da742228146107a6578063e985e9c5146107b9578063ee295d62146107f557600080fd5b8063ce1b815f116100d3578063ce1b815f14610755578063d53913931461076c578063d547741f1461079357600080fd5b8063bb7fde711461070c578063bd85b0391461071f578063befa66451461074057600080fd5b8063a22cb4651161015b578063abe3960311610135578063abe39603146106b9578063ac4a0fb6146106e5578063b0ccc31e146106f857600080fd5b8063a22cb46514610680578063a30b4db914610693578063a55784ef146106a657600080fd5b806397905c1e1161018c57806397905c1e146106505780639d28fb8614610665578063a217fddf1461067857600080fd5b806381de2dc2146105f157806391d1485414610604578063933f39581461063d57600080fd5b806336568abe1161027657806355f804b31161021f5780636b566cb2116101f95780636b566cb214610575578063791459ea146105b7578063797669c9146105ca57600080fd5b806355f804b31461053c578063572b6c051461054f5780636b20c4541461056257600080fd5b80634f124995116102505780634f124995146104f35780634f558e79146105065780635055fbc31461052957600080fd5b806336568abe1461049b5780634e1273f4146104ae5780634f062c5a146104ce57600080fd5b8063248a9ca3116102d85780632a55205a116102b25780632a55205a146104435780632eb2c2d6146104755780632f2ff15d1461048857600080fd5b8063248a9ca3146103d3578063282c51f3146103f65780632a41a3551461041d57600080fd5b8063124d91e511610309578063124d91e514610398578063162094c4146103ad57806320820ec3146103c057600080fd5b8062fdd58e1461032f57806301ffc9a7146103555780630e89341c14610378575b600080fd5b61034261033d366004614000565b610862565b6040519081526020015b60405180910390f35b610368610363366004614042565b610910565b604051901515815260200161034c565b61038b61038636600461405f565b61094e565b60405161034c91906140c8565b6103ab6103a63660046140db565b610959565b005b6103ab6103bb3660046141ed565b610994565b6103ab6103ce3660046142c9565b6109cd565b6103426103e136600461405f565b600090815260fa602052604090206001015490565b6103427f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84881565b61043061042b36600461405f565b610a02565b60405161ffff909116815260200161034c565b61045661045136600461433f565b610a12565b604080516001600160a01b03909316835260208301919091520161034c565b6103ab610483366004614361565b610b34565b6103ab61049636600461440f565b610c3f565b6103ab6104a936600461440f565b610c64565b6104c16104bc36600461443f565b610d00565b60405161034c919061453d565b6104e16104dc36600461405f565b610e3e565b60405160ff909116815260200161034c565b6103ab610501366004614550565b610e4d565b61036861051436600461405f565b600090815261012c6020526040902054151590565b61036861053736600461405f565b610e63565b6103ab61054a366004614592565b610e6e565b61036861055d3660046145c7565b610e82565b6103ab6105703660046142c9565b610e9f565b61059f61058336600461405f565b610192602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200161034c565b6103ab6105c53660046145f2565b610f3b565b6103427f71f3d55856e4058ed06ee057d79ada615f65cdf5f9ee88181b914225088f834f81565b6104306105ff36600461405f565b610fcc565b61036861061236600461440f565b600091825260fa602090815260408084206001600160a01b0393909316845291905290205460ff1690565b61036861064b36600461405f565b610fdc565b610658610fed565b60405161034c9190614668565b6103ab6106733660046145c7565b611173565b610342600081565b6103ab61068e3660046145f2565b611213565b61059f6106a136600461405f565b6112fb565b6103ab6106b4366004614709565b611303565b6103426106c7366004614592565b80516020818301810180516101948252928201919093012091525481565b6103ab6106f3366004614821565b6114f8565b6101905461059f906001600160a01b031681565b6103ab61071a3660046148ab565b61167d565b61034261072d36600461405f565b600090815261012c602052604090205490565b6107486116d8565b60405161034c919061490e565b6000546201000090046001600160a01b031661059f565b6103427f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6103ab6107a136600461440f565b6118f2565b6103ab6107b43660046145c7565b611917565b6103686107c736600461495b565b6001600160a01b03918216600090815260976020908152604080832093909416825291909152205460ff1690565b6101915461059f906001600160a01b031681565b6103ab610817366004614989565b6119a7565b6103ab61082a3660046140db565b611bc7565b61084261083d36600461405f565b611c63565b60405161034c91906149f2565b61034261085d366004614592565b611e08565b60006001600160a01b0383166108e55760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201527f616c6964206f776e65720000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b5060008181526096602090815260408083206001600160a01b03861684529091529020545b92915050565b60006001600160e01b031982167fa30b4db900000000000000000000000000000000000000000000000000000000148061090a575061090a82611e31565b606061090a82611ed7565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84861098381611fb9565b61098e848484611fcd565b50505050565b7f71f3d55856e4058ed06ee057d79ada615f65cdf5f9ee88181b914225088f834f6109be81611fb9565b6109c883836121a4565b505050565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a8486109f781611fb9565b61098e848484612202565b600061090a8260b81c61ffff1690565b60008060008061019160009054906101000a90046001600160a01b03166001600160a01b031663a86a28d16040518163ffffffff1660e01b81526004016040805180830381865afa158015610a6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8f9190614a1c565b6000888152610192602052604090205491935091506001600160a01b031615610af157600086815261019260205260409020546001600160a01b0316612710610adc61ffff841688614a67565b610ae69190614a7e565b935093505050610b2d565b6001600160a01b03821615801590610b0c575061ffff811615155b15610b235781612710610adc61ffff841688614a67565b6000809350935050505b9250929050565b6101905485906001600160a01b03163b15610c2a57336001600160a01b03821603610b6b57610b668686868686612494565b610c37565b61019054604051633185c44d60e21b81523060048201523360248201526001600160a01b039091169063c617113490604401602060405180830381865afa158015610bba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bde9190614aa0565b610c2a5760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f77656400000000000000000000000060448201526064016108dc565b610c378686868686612494565b505050505050565b600082815260fa6020526040902060010154610c5a81611fb9565b6109c88383612539565b610c6c6125dc565b6001600160a01b0316816001600160a01b031614610cf25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016108dc565b610cfc82826125eb565b5050565b60608151835114610d795760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d61746368000000000000000000000000000000000000000000000060648201526084016108dc565b6000835167ffffffffffffffff811115610d9557610d95614110565b604051908082528060200260200182016040528015610dbe578160200160208202803683370190505b50905060005b8451811015610e3657610e09858281518110610de257610de2614abd565b6020026020010151858381518110610dfc57610dfc614abd565b6020026020010151610862565b828281518110610e1b57610e1b614abd565b6020908102919091010152610e2f81614ad3565b9050610dc4565b509392505050565b600061090a8260a01c60ff1690565b6000610e5881611fb9565b61098e84848461268c565b600061090a826127de565b6000610e7981611fb9565b610cfc826127fc565b600080546001600160a01b0383811662010000909204161461090a565b610ea76125dc565b6001600160a01b0316836001600160a01b03161480610ecd5750610ecd836107c76125dc565b610f305760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108dc565b6109c8838383612202565b6000610f4681611fb9565b6001600160a01b038316610fc25760405162461bcd60e51b815260206004820152602960248201527f41737365743a20737562736372697074696f6e2063616e2774206265207a657260448201527f6f2061646472657373000000000000000000000000000000000000000000000060648201526084016108dc565b6109c88383612809565b600061090a8260a81c61ffff1690565b6000600160c883901c81161461090a565b6101935460609067ffffffffffffffff81111561100c5761100c614110565b60405190808252806020026020018201604052801561105957816020015b6040805160608082018352600080835260208301529181019190915281526020019060019003908161102a5790505b50905060005b6101935481101561116f57604080516060808201835260008083526020830152918101919091526000610193838154811061109c5761109c614abd565b60009182526020808320909101548083526101929091526040909120549091506001600160a01b0316801561113757806001600160a01b031663d78d610b6040518163ffffffff1660e01b8152600401600060405180830381865afa158015611109573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111319190810190614aed565b60408401525b8183528451839086908690811061115057611150614abd565b60200260200101819052505050508061116890614ad3565b905061105f565b5090565b600061117e81611fb9565b6001600160a01b0382166111e25760405162461bcd60e51b815260206004820152602560248201527f41737365743a2072656769737472792063616e2774206265207a65726f206164604482015264647265737360d81b60648201526084016108dc565b50610190805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6101905482906001600160a01b03163b156112e95761019054604051633185c44d60e21b81523060048201526001600160a01b0383811660248301529091169063c617113490604401602060405180830381865afa158015611279573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129d9190614aa0565b6112e95760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f77656400000000000000000000000060448201526064016108dc565b6109c86112f46125dc565b84846129d5565b60008161090a565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661132d81611fb9565b81518451146113a45760405162461bcd60e51b815260206004820152602b60248201527f41737365743a2069647320616e64206d6574616461746148617368206c656e6760448201527f7468206d69736d6174636800000000000000000000000000000000000000000060648201526084016108dc565b825184511461141b5760405162461bcd60e51b815260206004820152602660248201527f41737365743a2069647320616e6420616d6f756e7473206c656e677468206d6960448201527f736d61746368000000000000000000000000000000000000000000000000000060648201526084016108dc565b60005b84518110156114755761146385828151811061143c5761143c614abd565b602002602001015184838151811061145657611456614abd565b6020026020010151612ac9565b8061146d81614ad3565b91505061141e565b5061149185858560405180602001604052806000815250612bb0565b60005b8451811015610c375760006114bf8683815181106114b4576114b4614abd565b602002602001015190565b90506114e58683815181106114d6576114d6614abd565b6020026020010151828361268c565b50806114f081614ad3565b915050611494565b600054610100900460ff16158080156115185750600054600160ff909116105b806115325750303b158015611532575060005460ff166001145b6115a45760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016108dc565b6000805460ff1916600117905580156115c7576000805461ff0019166101001790555b6115d0846127fc565b6115d8612dad565b6115e0612dad565b6115e986612e1a565b6115f1612dad565b6115fc600086612539565b611607836001612e8e565b610191805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384161790558015610c37576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a66116a781611fb9565b6116b18483612ac9565b6116cc85858560405180602001604052806000815250612f31565b83610c3781808061268c565b6101935461019154604080517fa86a28d10000000000000000000000000000000000000000000000000000000081528151606094600094909385936001600160a01b039092169263a86a28d19260048082019392918290030181865afa158015611746573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176a9190614a1c565b5090506001600160a01b0381161561180f576101935461178b906001614bc0565b67ffffffffffffffff8111156117a3576117a3614110565b6040519080825280602002602001820160405280156117cc578160200160208202803683370190505b50935080846000815181106117e3576117e3614abd565b6001600160a01b03909216602092830291909101909101526001925061180882614ad3565b9150611858565b6101935467ffffffffffffffff81111561182b5761182b614110565b604051908082528060200260200182016040528015611854578160200160208202803683370190505b5093505b825b828110156118eb5761019260006101936118748785614bd3565b8154811061188457611884614abd565b9060005260206000200154815260200190815260200160002060009054906101000a90046001600160a01b03168582815181106118c3576118c3614abd565b6001600160a01b03909216602092830291909101909101526118e481614ad3565b905061185a565b5050505090565b600082815260fa602052604090206001015461190d81611fb9565b6109c883836125eb565b600061192281611fb9565b6001600160a01b03821661199e5760405162461bcd60e51b815260206004820152602e60248201527f41737365743a207472757374656420666f727761726465722063616e2774206260448201527f65207a65726f206164647265737300000000000000000000000000000000000060648201526084016108dc565b610cfc82613074565b6101905485906001600160a01b03163b15611b2957336001600160a01b03821603611a6a576119d46125dc565b6001600160a01b0316866001600160a01b031614806119fa57506119fa866107c76125dc565b611a5d5760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108dc565b610b668686868686613189565b61019054604051633185c44d60e21b81523060048201523360248201526001600160a01b039091169063c617113490604401602060405180830381865afa158015611ab9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611add9190614aa0565b611b295760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f77656400000000000000000000000060448201526064016108dc565b611b316125dc565b6001600160a01b0316866001600160a01b03161480611b575750611b57866107c76125dc565b611bba5760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108dc565b610c378686868686613189565b611bcf6125dc565b6001600160a01b0316836001600160a01b03161480611bf55750611bf5836107c76125dc565b611c585760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108dc565b6109c8838383611fcd565b60008181526101926020526040808220546101915482517fa86a28d100000000000000000000000000000000000000000000000000000000815283516060956001600160a01b039485169590949093169263a86a28d192600480820193918290030181865afa158015611cda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cfe9190614a1c565b5090506001600160a01b03821615611d7e57816001600160a01b031663d78d610b6040518163ffffffff1660e01b8152600401600060405180830381865afa158015611d4e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d769190810190614aed565b949350505050565b604080516001808252818301909252600091816020015b6040805180820190915260008082526020820152815260200190600190039081611d955790505090506040518060400160405280836001600160a01b0316815260200161271061ffff1681525081600081518110611df557611df5614abd565b6020908102919091010152949350505050565b600061019482604051611e1b9190614be6565b9081526020016040518091039020549050919050565b60006001600160e01b031982167f2a55205a000000000000000000000000000000000000000000000000000000001480611e9457506001600160e01b031982167f667873ce00000000000000000000000000000000000000000000000000000000145b80611ec857506001600160e01b031982167ffd90e89700000000000000000000000000000000000000000000000000000000145b8061090a575061090a82613364565b600081815261015f6020526040812080546060929190611ef690614c02565b80601f0160208091040260200160405190810160405280929190818152602001828054611f2290614c02565b8015611f6f5780601f10611f4457610100808354040283529160200191611f6f565b820191906000526020600020905b815481529060010190602001808311611f5257829003601f168201915b505050505090506000815111611f8d57611f88836133a2565b611fb2565b61015e81604051602001611fa2929190614c3c565b6040516020818303038152906040525b9392505050565b611fca81611fc56125dc565b613436565b50565b6001600160a01b0383166120495760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016108dc565b60006120536125dc565b90506000612060846134ab565b9050600061206d846134ab565b905061208d838760008585604051806020016040528060008152506134f6565b60008581526096602090815260408083206001600160a01b038a168452909152902054848110156121255760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e63650000000000000000000000000000000000000000000000000000000060648201526084016108dc565b60008681526096602090815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46040805160208101909152600090525b50505050505050565b600082815261015f602052604090206121bd8282614d09565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b6121e98461094e565b6040516121f691906140c8565b60405180910390a25050565b6001600160a01b03831661227e5760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016108dc565b80518251146122e05760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016108dc565b60006122ea6125dc565b905061230a818560008686604051806020016040528060008152506134f6565b60005b835181101561242757600084828151811061232a5761232a614abd565b60200260200101519050600084838151811061234857612348614abd565b60209081029190910181015160008481526096835260408082206001600160a01b038c1683529093529190912054909150818110156123ee5760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e63650000000000000000000000000000000000000000000000000000000060648201526084016108dc565b60009283526096602090815260408085206001600160a01b038b168652909152909220910390558061241f81614ad3565b91505061230d565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051612478929190614dc9565b60405180910390a460408051602081019091526000905261098e565b61249c6125dc565b6001600160a01b0316856001600160a01b031614806124c257506124c2856107c76125dc565b6125255760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b60648201526084016108dc565b6125328585858585613504565b5050505050565b600082815260fa602090815260408083206001600160a01b038516845290915290205460ff16610cfc57600082815260fa602090815260408083206001600160a01b03851684529091529020805460ff191660011790556125986125dc565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006125e6613789565b905090565b600082815260fa602090815260408083206001600160a01b038516845290915290205460ff1615610cfc57600082815260fa602090815260408083206001600160a01b03851684529091529020805460ff191690556126486125dc565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b610191546040517ff06040b40000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301528481166024830152600092169063f06040b4906044016020604051808303816000875af11580156126fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061271f9190614df7565b6000858152610192602052604080822080546001600160a01b03851673ffffffffffffffffffffffffffffffffffffffff19909116179055610193805460018101825592527ffc8af01f449989052b52093a58fc9f42d0b11f0c6dd5dca0463dab62346ccc68909101869055519091507f5fe98ba0109a6edc7f59e8c943b6a42a0d8508aebe2e37c874eca88f747bb077906127d090869086909182526001600160a01b0316602082015260400190565b60405180910390a150505050565b6000806127ef8360b81c61ffff1690565b61ffff1615159392505050565b61015e610cfc8282614d09565b610190546001600160a01b03163b15610cfc57610190546040517fc3c5a5470000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b039091169063c3c5a547906024016020604051808303816000875af1158015612880573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128a49190614aa0565b610cfc57801561292a57610190546040517f7d3e3dbe0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03848116602483015290911690637d3e3dbe906044015b600060405180830381600087803b15801561291657600080fd5b505af1158015610c37573d6000803e3d6000fd5b6001600160a01b0382161561298b57610190546040517fa0af29030000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0384811660248301529091169063a0af2903906044016128fc565b610190546040517f4420e4860000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0390911690634420e486906024016128fc565b816001600160a01b0316836001600160a01b031603612a5c5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084016108dc565b6001600160a01b03838116600081815260976020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61019481604051612ada9190614be6565b908152602001604051809103902054600014612b84578161019482604051612b029190614be6565b90815260200160405180910390205414610cfc5760405162461bcd60e51b815260206004820152602960248201527f41737365743a206e6f7420616c6c6f77656420746f207265757365206d65746160448201527f646174612068617368000000000000000000000000000000000000000000000060648201526084016108dc565b8161019482604051612b969190614be6565b90815260405190819003602001902055610cfc82826121a4565b6001600160a01b038416612c2c5760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016108dc565b8151835114612c8e5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016108dc565b6000612c986125dc565b9050612ca9816000878787876134f6565b60005b8451811015612d4557838181518110612cc757612cc7614abd565b602002602001015160966000878481518110612ce557612ce5614abd565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b031681526020019081526020016000206000828254612d2d9190614bc0565b90915550819050612d3d81614ad3565b915050612cac565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051612d96929190614dc9565b60405180910390a4612532816000878787876137e1565b600054610100900460ff16612e185760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016108dc565b565b600054610100900460ff16612e855760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016108dc565b611fca816139cd565b600054610100900460ff16612ef95760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016108dc565b610190805473ffffffffffffffffffffffffffffffffffffffff19166daaeb6d7670e522a718067333cd4e179055610cfc8282612809565b6001600160a01b038416612fad5760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016108dc565b6000612fb76125dc565b90506000612fc4856134ab565b90506000612fd1856134ab565b9050612fe2836000898585896134f6565b60008681526096602090815260408083206001600160a01b038b16845290915281208054879290613014908490614bc0565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461219b83600089898989613a41565b6000546001600160a01b03620100009091048116908216036130fe5760405162461bcd60e51b815260206004820152603060248201527f4552433237373148616e646c65725570677261646561626c653a20666f72776160448201527f7264657220616c7265616479207365740000000000000000000000000000000060648201526084016108dc565b6131066125dc565b600080546040516001600160a01b0393841693858116936201000090930416917f8ca022029d8ff7ad974913f8970aeed6c5e0e7eaf494a0c5b262249f6b5759e591a4600080546001600160a01b0390921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6001600160a01b0384166131ed5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b60648201526084016108dc565b60006131f76125dc565b90506000613204856134ab565b90506000613211856134ab565b90506132218389898585896134f6565b60008681526096602090815260408083206001600160a01b038c168452909152902054858110156132ba5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016108dc565b60008781526096602090815260408083206001600160a01b038d8116855292528083208985039055908a168252812080548892906132f9908490614bc0565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4613359848a8a8a8a8a613a41565b505050505050505050565b60006001600160e01b031982167f7965db0b00000000000000000000000000000000000000000000000000000000148061090a575061090a82613b84565b6060609880546133b190614c02565b80601f01602080910402602001604051908101604052809291908181526020018280546133dd90614c02565b801561342a5780601f106133ff5761010080835404028352916020019161342a565b820191906000526020600020905b81548152906001019060200180831161340d57829003601f168201915b50505050509050919050565b600082815260fa602090815260408083206001600160a01b038516845290915290205460ff16610cfc5761346981613c1f565b613474836020613c31565b604051602001613485929190614e14565b60408051601f198184030181529082905262461bcd60e51b82526108dc916004016140c8565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106134e5576134e5614abd565b602090810291909101015292915050565b610c37868686868686613e5a565b81518351146135665760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016108dc565b6001600160a01b0384166135ca5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b60648201526084016108dc565b60006135d46125dc565b90506135e48187878787876134f6565b60005b845181101561372357600085828151811061360457613604614abd565b60200260200101519050600085838151811061362257613622614abd565b60209081029190910181015160008481526096835260408082206001600160a01b038e1683529093529190912054909150818110156136c95760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016108dc565b60008381526096602090815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290613708908490614bc0565b925050819055505050508061371c90614ad3565b90506135e7565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051613773929190614dc9565b60405180910390a4610c378187878787876137e1565b600080546201000090046001600160a01b0316331480156137ab575060143610155b156137db57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b50335b90565b6001600160a01b0384163b15610c37576040517fbc197c810000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063bc197c819061383e9089908990889088908890600401614e95565b6020604051808303816000875af1925050508015613879575060408051601f3d908101601f1916820190925261387691810190614ee7565b60015b61392e57613885614f04565b806308c379a0036138be5750613899614f1f565b806138a457506138c0565b8060405162461bcd60e51b81526004016108dc91906140c8565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d4552433131353560448201527f526563656976657220696d706c656d656e74657200000000000000000000000060648201526084016108dc565b6001600160e01b031981167fbc197c81000000000000000000000000000000000000000000000000000000001461219b5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016108dc565b600054610100900460ff16613a385760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016108dc565b611fca81613074565b6001600160a01b0384163b15610c37576040517ff23a6e610000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063f23a6e6190613a9e9089908990889088908890600401614fc7565b6020604051808303816000875af1925050508015613ad9575060408051601f3d908101601f19168201909252613ad691810190614ee7565b60015b613ae557613885614f04565b6001600160e01b031981167ff23a6e61000000000000000000000000000000000000000000000000000000001461219b5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016108dc565b60006001600160e01b031982167fd9b67a26000000000000000000000000000000000000000000000000000000001480613be757506001600160e01b031982167f0e89341c00000000000000000000000000000000000000000000000000000000145b8061090a57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161461090a565b606061090a6001600160a01b03831660145b60606000613c40836002614a67565b613c4b906002614bc0565b67ffffffffffffffff811115613c6357613c63614110565b6040519080825280601f01601f191660200182016040528015613c8d576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110613cc457613cc4614abd565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110613d2757613d27614abd565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000613d63846002614a67565b613d6e906001614bc0565b90505b6001811115613e0b577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110613daf57613daf614abd565b1a60f81b828281518110613dc557613dc5614abd565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93613e048161500a565b9050613d71565b508315611fb25760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108dc565b6001600160a01b038516613ee25760005b8351811015613ee057828181518110613e8657613e86614abd565b602002602001015161012c6000868481518110613ea557613ea5614abd565b602002602001015181526020019081526020016000206000828254613eca9190614bc0565b90915550613ed9905081614ad3565b9050613e6b565b505b6001600160a01b038416610c375760005b835181101561219b576000848281518110613f1057613f10614abd565b602002602001015190506000848381518110613f2e57613f2e614abd565b60200260200101519050600061012c600084815260200190815260200160002054905081811015613fc75760405162461bcd60e51b815260206004820152602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f7460448201527f616c537570706c7900000000000000000000000000000000000000000000000060648201526084016108dc565b600092835261012c602052604090922091039055613fe481614ad3565b9050613ef3565b6001600160a01b0381168114611fca57600080fd5b6000806040838503121561401357600080fd5b823561401e81613feb565b946020939093013593505050565b6001600160e01b031981168114611fca57600080fd5b60006020828403121561405457600080fd5b8135611fb28161402c565b60006020828403121561407157600080fd5b5035919050565b60005b8381101561409357818101518382015260200161407b565b50506000910152565b600081518084526140b4816020860160208601614078565b601f01601f19169290920160200192915050565b602081526000611fb2602083018461409c565b6000806000606084860312156140f057600080fd5b83356140fb81613feb565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b6040810181811067ffffffffffffffff8211171561414657614146614110565b60405250565b601f19601f830116810181811067ffffffffffffffff8211171561417257614172614110565b6040525050565b600082601f83011261418a57600080fd5b813567ffffffffffffffff8111156141a4576141a4614110565b6040516141bb6020601f19601f850116018261414c565b8181528460208386010111156141d057600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561420057600080fd5b82359150602083013567ffffffffffffffff81111561421e57600080fd5b61422a85828601614179565b9150509250929050565b600067ffffffffffffffff82111561424e5761424e614110565b5060051b60200190565b600082601f83011261426957600080fd5b8135602061427682614234565b604051614283828261414c565b83815260059390931b85018201928281019150868411156142a357600080fd5b8286015b848110156142be57803583529183019183016142a7565b509695505050505050565b6000806000606084860312156142de57600080fd5b83356142e981613feb565b9250602084013567ffffffffffffffff8082111561430657600080fd5b61431287838801614258565b9350604086013591508082111561432857600080fd5b5061433586828701614258565b9150509250925092565b6000806040838503121561435257600080fd5b50508035926020909101359150565b600080600080600060a0868803121561437957600080fd5b853561438481613feb565b9450602086013561439481613feb565b9350604086013567ffffffffffffffff808211156143b157600080fd5b6143bd89838a01614258565b945060608801359150808211156143d357600080fd5b6143df89838a01614258565b935060808801359150808211156143f557600080fd5b5061440288828901614179565b9150509295509295909350565b6000806040838503121561442257600080fd5b82359150602083013561443481613feb565b809150509250929050565b6000806040838503121561445257600080fd5b823567ffffffffffffffff8082111561446a57600080fd5b818501915085601f83011261447e57600080fd5b8135602061448b82614234565b604051614498828261414c565b83815260059390931b85018201928281019150898411156144b857600080fd5b948201945b838610156144df5785356144d081613feb565b825294820194908201906144bd565b965050860135925050808211156144f557600080fd5b5061422a85828601614258565b600081518084526020808501945080840160005b8381101561453257815187529582019590820190600101614516565b509495945050505050565b602081526000611fb26020830184614502565b60008060006060848603121561456557600080fd5b83359250602084013561457781613feb565b9150604084013561458781613feb565b809150509250925092565b6000602082840312156145a457600080fd5b813567ffffffffffffffff8111156145bb57600080fd5b611d7684828501614179565b6000602082840312156145d957600080fd5b8135611fb281613feb565b8015158114611fca57600080fd5b6000806040838503121561460557600080fd5b823561461081613feb565b91506020830135614434816145e4565b600081518084526020808501945080840160005b8381101561453257815180516001600160a01b0316885283015161ffff168388015260409096019590820190600101614634565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b838110156146fb578883037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00185528151805184528781015161ffff168885015286015160608785018190526146e781860183614620565b96890196945050509086019060010161468f565b509098975050505050505050565b6000806000806080858703121561471f57600080fd5b843561472a81613feb565b935060208581013567ffffffffffffffff8082111561474857600080fd5b61475489838a01614258565b9550604088013591508082111561476a57600080fd5b61477689838a01614258565b9450606088013591508082111561478c57600080fd5b818801915088601f8301126147a057600080fd5b81356147ab81614234565b6040516147b8828261414c565b82815260059290921b840185019185810191508b8311156147d857600080fd5b8585015b83811015614810578035858111156147f45760008081fd5b6148028e89838a0101614179565b8452509186019186016147dc565b50989b979a50959850505050505050565b600080600080600060a0868803121561483957600080fd5b853561484481613feb565b9450602086013561485481613feb565b9350604086013567ffffffffffffffff81111561487057600080fd5b61487c88828901614179565b935050606086013561488d81613feb565b9150608086013561489d81613feb565b809150509295509295909350565b600080600080608085870312156148c157600080fd5b84356148cc81613feb565b93506020850135925060408501359150606085013567ffffffffffffffff8111156148f657600080fd5b61490287828801614179565b91505092959194509250565b6020808252825182820181905260009190848201906040850190845b8181101561494f5783516001600160a01b03168352928401929184019160010161492a565b50909695505050505050565b6000806040838503121561496e57600080fd5b823561497981613feb565b9150602083013561443481613feb565b600080600080600060a086880312156149a157600080fd5b85356149ac81613feb565b945060208601356149bc81613feb565b93506040860135925060608601359150608086013567ffffffffffffffff8111156149e657600080fd5b61440288828901614179565b602081526000611fb26020830184614620565b805161ffff81168114614a1757600080fd5b919050565b60008060408385031215614a2f57600080fd5b8251614a3a81613feb565b9150614a4860208401614a05565b90509250929050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761090a5761090a614a51565b600082614a9b57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215614ab257600080fd5b8151611fb2816145e4565b634e487b7160e01b600052603260045260246000fd5b60006000198203614ae657614ae6614a51565b5060010190565b60006020808385031215614b0057600080fd5b825167ffffffffffffffff811115614b1757600080fd5b8301601f81018513614b2857600080fd5b8051614b3381614234565b60408051614b41838261414c565b83815260069390931b8401850192858101925088841115614b6157600080fd5b938501935b83851015614bb45781858a031215614b7e5760008081fd5b8151614b8981614126565b8551614b9481613feb565b8152614ba1868801614a05565b8188015283529381019391850191614b66565b98975050505050505050565b8082018082111561090a5761090a614a51565b8181038181111561090a5761090a614a51565b60008251614bf8818460208701614078565b9190910192915050565b600181811c90821680614c1657607f821691505b602082108103614c3657634e487b7160e01b600052602260045260246000fd5b50919050565b6000808454614c4a81614c02565b60018281168015614c625760018114614c7757614ca6565b60ff1984168752821515830287019450614ca6565b8860005260208060002060005b85811015614c9d5781548a820152908401908201614c84565b50505082870194505b505050508351614cba818360208801614078565b01949350505050565b601f8211156109c857600081815260208120601f850160051c81016020861015614cea5750805b601f850160051c820191505b81811015610c3757828155600101614cf6565b815167ffffffffffffffff811115614d2357614d23614110565b614d3781614d318454614c02565b84614cc3565b602080601f831160018114614d6c5760008415614d545750858301515b600019600386901b1c1916600185901b178555610c37565b600085815260208120601f198616915b82811015614d9b57888601518255948401946001909101908401614d7c565b5085821015614db95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000614ddc6040830185614502565b8281036020840152614dee8185614502565b95945050505050565b600060208284031215614e0957600080fd5b8151611fb281613feb565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614e4c816017850160208801614078565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351614e89816028840160208801614078565b01602801949350505050565b60006001600160a01b03808816835280871660208401525060a06040830152614ec160a0830186614502565b8281036060840152614ed38186614502565b90508281036080840152614bb4818561409c565b600060208284031215614ef957600080fd5b8151611fb28161402c565b600060033d11156137de5760046000803e5060005160e01c90565b600060443d1015614f2d5790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff8160248401118184111715614f7b57505050505090565b8285019150815181811115614f935750505050505090565b843d8701016020828501011115614fad5750505050505090565b614fbc6020828601018761414c565b509095945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152614fff60a083018461409c565b979650505050505050565b60008161501957615019614a51565b50600019019056fea2646970667358221220a3e246bc82a18932f1515ef30b71f1db320dfb57fefb24e64182297694f9f4da64736f6c63430008120033", "devdoc": { "events": { "ApprovalForAll(address,address,bool)": { @@ -1380,6 +1405,13 @@ "TransferSingle(address,address,address,uint256,uint256)": { "details": "Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`." }, + "TrustedForwarderSet(address,address,address)": { + "params": { + "newTrustedForwarder": "new trusted forwarder", + "oldTrustedForwarder": "old trusted forwarder", + "operator": "the sender of the transaction" + } + }, "URI(string,uint256)": { "details": "Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. If an {URI} event was emitted for `id`, the standard https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value returned by {IERC1155MetadataURI-uri}." } @@ -1468,6 +1500,11 @@ "royaltyConfigs": "receivers and their split array as long as the number of tokens." } }, + "getTrustedForwarder()": { + "returns": { + "_0": "return the address of the trusted forwarder" + } + }, "grantRole(bytes32,address)": { "details": "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." }, @@ -1493,6 +1530,14 @@ "_0": "isRevealed Whether the asset is revealed or not" } }, + "isTrustedForwarder(address)": { + "params": { + "forwarder": "trusted forwarder address to check" + }, + "returns": { + "_0": "true if the address is the same as the trusted forwarder" + } + }, "mint(address,uint256,uint256,string)": { "details": "Only callable by the minter role", "params": { @@ -1610,6 +1655,11 @@ "version": 1 }, "userdoc": { + "events": { + "TrustedForwarderSet(address,address,address)": { + "notice": "Emitted when a `newTrustedForwarder` is set, replacing the `oldTrustedForwarder`" + } + }, "kind": "user", "methods": { "burnBatchFrom(address,uint256[],uint256[])": { @@ -1639,12 +1689,18 @@ "getTokenRoyalties()": { "notice": "Returns royalty receivers and their split of royalty for each token" }, + "getTrustedForwarder()": { + "notice": "return the address of the trusted forwarder" + }, "isBridged(uint256)": { "notice": "Extracts the bridged flag from a given token id" }, "isRevealed(uint256)": { "notice": "Extracts the revealed flag from a given token id" }, + "isTrustedForwarder(address)": { + "notice": "return true if the forwarder is the trusted forwarder" + }, "mint(address,uint256,uint256,string)": { "notice": "Mint new tokens" }, @@ -1709,7 +1765,7 @@ "type": "t_bool" }, { - "astId": 10714, + "astId": 12771, "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "_trustedForwarder", "offset": 2, @@ -1717,11 +1773,19 @@ "type": "t_address" }, { - "astId": 3300, + "astId": 12858, "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "__gap", "offset": 0, "slot": "1", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 3300, + "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", + "label": "__gap", + "offset": 0, + "slot": "50", "type": "t_array(t_uint256)50_storage" }, { @@ -1729,7 +1793,7 @@ "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "__gap", "offset": 0, - "slot": "51", + "slot": "100", "type": "t_array(t_uint256)50_storage" }, { @@ -1737,7 +1801,7 @@ "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "_balances", "offset": 0, - "slot": "101", + "slot": "150", "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" }, { @@ -1745,7 +1809,7 @@ "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "_operatorApprovals", "offset": 0, - "slot": "102", + "slot": "151", "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" }, { @@ -1753,7 +1817,7 @@ "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "_uri", "offset": 0, - "slot": "103", + "slot": "152", "type": "t_string_storage" }, { @@ -1761,7 +1825,7 @@ "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "__gap", "offset": 0, - "slot": "104", + "slot": "153", "type": "t_array(t_uint256)47_storage" }, { @@ -1769,7 +1833,7 @@ "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "__gap", "offset": 0, - "slot": "151", + "slot": "200", "type": "t_array(t_uint256)50_storage" }, { @@ -1777,7 +1841,7 @@ "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "_roles", "offset": 0, - "slot": "201", + "slot": "250", "type": "t_mapping(t_bytes32,t_struct(RoleData)189_storage)" }, { @@ -1785,7 +1849,7 @@ "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "__gap", "offset": 0, - "slot": "202", + "slot": "251", "type": "t_array(t_uint256)49_storage" }, { @@ -1793,7 +1857,7 @@ "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "_totalSupply", "offset": 0, - "slot": "251", + "slot": "300", "type": "t_mapping(t_uint256,t_uint256)" }, { @@ -1801,7 +1865,7 @@ "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "__gap", "offset": 0, - "slot": "252", + "slot": "301", "type": "t_array(t_uint256)49_storage" }, { @@ -1809,7 +1873,7 @@ "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "_baseURI", "offset": 0, - "slot": "301", + "slot": "350", "type": "t_string_storage" }, { @@ -1817,7 +1881,7 @@ "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "_tokenURIs", "offset": 0, - "slot": "302", + "slot": "351", "type": "t_mapping(t_uint256,t_string_storage)" }, { @@ -1825,47 +1889,47 @@ "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "__gap", "offset": 0, - "slot": "303", + "slot": "352", "type": "t_array(t_uint256)48_storage" }, { - "astId": 11515, + "astId": 12871, "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "operatorFilterRegistry", "offset": 0, - "slot": "351", - "type": "t_contract(IOperatorFilterRegistry)11896" + "slot": "400", + "type": "t_contract(IOperatorFilterRegistry)13252" }, { - "astId": 11927, + "astId": 13283, "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "royaltyManager", "offset": 0, - "slot": "352", + "slot": "401", "type": "t_address" }, { - "astId": 11931, + "astId": 13287, "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "_tokenRoyaltiesSplitter", "offset": 0, - "slot": "353", + "slot": "402", "type": "t_mapping(t_uint256,t_address_payable)" }, { - "astId": 11934, + "astId": 13290, "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "_tokensWithRoyalties", "offset": 0, - "slot": "354", + "slot": "403", "type": "t_array(t_uint256)dyn_storage" }, { - "astId": 8501, + "astId": 8502, "contract": "@sandbox-smart-contracts/asset/contracts/Asset.sol:Asset", "label": "hashUsed", "offset": 0, - "slot": "355", + "slot": "404", "type": "t_mapping(t_string_memory_ptr,t_uint256)" } ], @@ -1920,7 +1984,7 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(IOperatorFilterRegistry)11896": { + "t_contract(IOperatorFilterRegistry)13252": { "encoding": "inplace", "label": "contract IOperatorFilterRegistry", "numberOfBytes": "20" diff --git a/packages/deploy/deployments/mumbai/Asset_Proxy.json b/packages/deploy/deployments/mumbai/Asset_Proxy.json index f22ec7a934..2191aa5398 100644 --- a/packages/deploy/deployments/mumbai/Asset_Proxy.json +++ b/packages/deploy/deployments/mumbai/Asset_Proxy.json @@ -1,5 +1,5 @@ { - "address": "0xb0fb55e91B58D8db07aaBFF2D6b5A8e2e1bf8D08", + "address": "0x7AF8c95334240026385f7309D9a8b9e4265FC70a", "abi": [ { "inputs": [ @@ -146,35 +146,50 @@ "type": "receive" } ], - "transactionHash": "0x507fee0473cc4acfcc0a333288dc0e916acb84262c028cbac7985b0f005ba4b4", + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0xb0fb55e91B58D8db07aaBFF2D6b5A8e2e1bf8D08", - "transactionIndex": 3, - "gasUsed": "924746", - "logsBloom": "0x00000004000000000800000000000010400000010800000000000210100000000002000000008420000000000000000000009000000000000000000000040000000080000000000000000000000002800000000000040000000100000200000008000000020000000000020000000800000000800000000080000000000000000000000000000000000000000000000000000000000080000000020000a04000200000000000000000000000000400000000000000000000001000000400004000000020004000000001000000040200000000000400000100108000001060004000080000000000000000200000000000000000000000000000000000100000", - "blockHash": "0x0a08ddcc9a97f0b7b5f47b6a51628ae7616103ca6f0e9a51f56348b947a4e955", - "transactionHash": "0x507fee0473cc4acfcc0a333288dc0e916acb84262c028cbac7985b0f005ba4b4", + "contractAddress": "0x7AF8c95334240026385f7309D9a8b9e4265FC70a", + "transactionIndex": 16, + "gasUsed": "927601", + "logsBloom": "0x00000004000000000000000000000000400000000800000000000090100800000002000000008420000000000001000000008000000000000000000000040000000080000000000000000000000002800000000000040000000100000000000008000000020000000000020000000800000000800000000080000000000000000200010040000000000000000000000000000800000080000000000000a00000200000000000080000000010000400000000000000000000001000000400004000000020004000000001000000040200000000000400000100108000001060002000080000008000000010240000000004000000000000000000000004100000", + "blockHash": "0x0a1b8afc8f933cb975e4ef5559ea6a8d1e79faf00206505c1fcd974fa252f736", + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", "logs": [ { - "transactionIndex": 3, - "blockNumber": 38596210, - "transactionHash": "0x507fee0473cc4acfcc0a333288dc0e916acb84262c028cbac7985b0f005ba4b4", - "address": "0xb0fb55e91B58D8db07aaBFF2D6b5A8e2e1bf8D08", + "transactionIndex": 16, + "blockNumber": 38730662, + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", + "address": "0x7AF8c95334240026385f7309D9a8b9e4265FC70a", "topics": [ "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", - "0x00000000000000000000000080160a8f1a98cb387ae8e46e8c10931eef07a490" + "0x0000000000000000000000008d4490da283630df4229e76ea7ea99401736bd80" ], "data": "0x", - "logIndex": 7, - "blockHash": "0x0a08ddcc9a97f0b7b5f47b6a51628ae7616103ca6f0e9a51f56348b947a4e955" + "logIndex": 58, + "blockHash": "0x0a1b8afc8f933cb975e4ef5559ea6a8d1e79faf00206505c1fcd974fa252f736" }, { - "transactionIndex": 3, - "blockNumber": 38596210, - "transactionHash": "0x507fee0473cc4acfcc0a333288dc0e916acb84262c028cbac7985b0f005ba4b4", - "address": "0xb0fb55e91B58D8db07aaBFF2D6b5A8e2e1bf8D08", + "transactionIndex": 16, + "blockNumber": 38730662, + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", + "address": "0x7AF8c95334240026385f7309D9a8b9e4265FC70a", + "topics": [ + "0x8ca022029d8ff7ad974913f8970aeed6c5e0e7eaf494a0c5b262249f6b5759e5", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f7", + "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" + ], + "data": "0x", + "logIndex": 59, + "blockHash": "0x0a1b8afc8f933cb975e4ef5559ea6a8d1e79faf00206505c1fcd974fa252f736" + }, + { + "transactionIndex": 16, + "blockNumber": 38730662, + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", + "address": "0x7AF8c95334240026385f7309D9a8b9e4265FC70a", "topics": [ "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "0x0000000000000000000000000000000000000000000000000000000000000000", @@ -182,66 +197,66 @@ "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 8, - "blockHash": "0x0a08ddcc9a97f0b7b5f47b6a51628ae7616103ca6f0e9a51f56348b947a4e955" + "logIndex": 60, + "blockHash": "0x0a1b8afc8f933cb975e4ef5559ea6a8d1e79faf00206505c1fcd974fa252f736" }, { - "transactionIndex": 3, - "blockNumber": 38596210, - "transactionHash": "0x507fee0473cc4acfcc0a333288dc0e916acb84262c028cbac7985b0f005ba4b4", + "transactionIndex": 16, + "blockNumber": 38730662, + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", "address": "0x000000000000AAeB6D7670E522A718067333cd4E", "topics": [ "0x86d03f430c7616021073d7a71766f632f1ce19f289aa989534d9f4732253eb59", - "0x000000000000000000000000b0fb55e91b58d8db07aabff2d6b5a8e2e1bf8d08", + "0x0000000000000000000000007af8c95334240026385f7309d9a8b9e4265fc70a", "0x0000000000000000000000000000000000000000000000000000000000000001" ], "data": "0x", - "logIndex": 9, - "blockHash": "0x0a08ddcc9a97f0b7b5f47b6a51628ae7616103ca6f0e9a51f56348b947a4e955" + "logIndex": 61, + "blockHash": "0x0a1b8afc8f933cb975e4ef5559ea6a8d1e79faf00206505c1fcd974fa252f736" }, { - "transactionIndex": 3, - "blockNumber": 38596210, - "transactionHash": "0x507fee0473cc4acfcc0a333288dc0e916acb84262c028cbac7985b0f005ba4b4", + "transactionIndex": 16, + "blockNumber": 38730662, + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", "address": "0x000000000000AAeB6D7670E522A718067333cd4E", "topics": [ "0x0038c54977604f1a5c0a3604cbbecd0153c81e3131799ead95755e8bb5d5b9e8", - "0x000000000000000000000000b0fb55e91b58d8db07aabff2d6b5a8e2e1bf8d08", + "0x0000000000000000000000007af8c95334240026385f7309d9a8b9e4265fc70a", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", "0x0000000000000000000000000000000000000000000000000000000000000001" ], "data": "0x", - "logIndex": 10, - "blockHash": "0x0a08ddcc9a97f0b7b5f47b6a51628ae7616103ca6f0e9a51f56348b947a4e955" + "logIndex": 62, + "blockHash": "0x0a1b8afc8f933cb975e4ef5559ea6a8d1e79faf00206505c1fcd974fa252f736" }, { - "transactionIndex": 3, - "blockNumber": 38596210, - "transactionHash": "0x507fee0473cc4acfcc0a333288dc0e916acb84262c028cbac7985b0f005ba4b4", - "address": "0xb0fb55e91B58D8db07aaBFF2D6b5A8e2e1bf8D08", + "transactionIndex": 16, + "blockNumber": 38730662, + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", + "address": "0x7AF8c95334240026385f7309D9a8b9e4265FC70a", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x0000000000000000000000000000000000000000000000000000000000000001", - "logIndex": 11, - "blockHash": "0x0a08ddcc9a97f0b7b5f47b6a51628ae7616103ca6f0e9a51f56348b947a4e955" + "logIndex": 63, + "blockHash": "0x0a1b8afc8f933cb975e4ef5559ea6a8d1e79faf00206505c1fcd974fa252f736" }, { - "transactionIndex": 3, - "blockNumber": 38596210, - "transactionHash": "0x507fee0473cc4acfcc0a333288dc0e916acb84262c028cbac7985b0f005ba4b4", - "address": "0xb0fb55e91B58D8db07aaBFF2D6b5A8e2e1bf8D08", + "transactionIndex": 16, + "blockNumber": 38730662, + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", + "address": "0x7AF8c95334240026385f7309D9a8b9e4265FC70a", "topics": [ "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" ], - "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c3c6b8feee55636e949920aa90f093f6f5faf448", - "logIndex": 12, - "blockHash": "0x0a08ddcc9a97f0b7b5f47b6a51628ae7616103ca6f0e9a51f56348b947a4e955" + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c26b12025e378c570fb46249093ba387a2e927bc", + "logIndex": 64, + "blockHash": "0x0a1b8afc8f933cb975e4ef5559ea6a8d1e79faf00206505c1fcd974fa252f736" }, { - "transactionIndex": 3, - "blockNumber": 38596210, - "transactionHash": "0x507fee0473cc4acfcc0a333288dc0e916acb84262c028cbac7985b0f005ba4b4", + "transactionIndex": 16, + "blockNumber": 38730662, + "transactionHash": "0x731d637e4fad84afbebd9d5cd801addb7bdead1a9630569fb2ea7698b024458e", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", @@ -249,20 +264,20 @@ "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", "0x000000000000000000000000f903ba9e006193c1527bfbe65fe2123704ea3f99" ], - "data": "0x0000000000000000000000000000000000000000000000000004ed93cf4fb24a00000000000000000000000000000000000000000000001171d2f7373e41ff5700000000000000000000000000000000000000000000103230da795517e95c9a00000000000000000000000000000000000000000000001171ce09a36ef24d0d00000000000000000000000000000000000000000000103230df66e8e7390ee4", - "logIndex": 13, - "blockHash": "0x0a08ddcc9a97f0b7b5f47b6a51628ae7616103ca6f0e9a51f56348b947a4e955" + "data": "0x0000000000000000000000000000000000000000000000000004f178e825bf0000000000000000000000000000000000000000000000001171359991322bac73000000000000000000000000000000000000000000001043e1be1652c1321c770000000000000000000000000000000000000000000000117130a8184a05ed73000000000000000000000000000000000000000000001043e1c307cba957db77", + "logIndex": 65, + "blockHash": "0x0a1b8afc8f933cb975e4ef5559ea6a8d1e79faf00206505c1fcd974fa252f736" } ], - "blockNumber": 38596210, - "cumulativeGasUsed": "1240570", + "blockNumber": 38730662, + "cumulativeGasUsed": "3784885", "status": 1, "byzantium": true }, "args": [ - "0x80160a8f1A98cb387ae8e46E8C10931EEF07a490", - "0xc3C6B8feeE55636e949920Aa90f093f6f5Faf448", - "0xac4a0fb600000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f700000000000000000000000049c4d4c94829b9c44052c5f5cb164fc61218116500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af0200000000000000000000000042017fd22fd371cb717e4895e8a45d17dcde89e60000000000000000000000000000000000000000000000000000000000000007697066733a2f2f00000000000000000000000000000000000000000000000000" + "0x8d4490Da283630df4229E76ea7EA99401736bD80", + "0xc26B12025e378c570Fb46249093Ba387A2e927bc", + "0xac4a0fb600000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f700000000000000000000000049c4d4c94829b9c44052c5f5cb164fc61218116500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af020000000000000000000000004ae9a95ec193fc1b38c246b701de49b8e3f5ef340000000000000000000000000000000000000000000000000000000000000007697066733a2f2f00000000000000000000000000000000000000000000000000" ], "numDeployments": 1, "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", diff --git a/packages/deploy/deployments/mumbai/AuthSuperValidator.json b/packages/deploy/deployments/mumbai/AuthSuperValidator.json index 8e8023c491..16d9dac03f 100644 --- a/packages/deploy/deployments/mumbai/AuthSuperValidator.json +++ b/packages/deploy/deployments/mumbai/AuthSuperValidator.json @@ -1,5 +1,5 @@ { - "address": "0xb2732c13804D60866606D61B1b9450Eb4704e596", + "address": "0x9f6031F7728FF4dE931036477Ea9bBa5aE7Cf974", "abi": [ { "inputs": [ @@ -278,22 +278,22 @@ "type": "function" } ], - "transactionHash": "0x7c97dc921f5fe19f56d411273f81330dfc844d82a14e983fef65ddf2805be75b", + "transactionHash": "0xddffd26021c1fbdcd0c9572da14b9c4d4f80a1f6aacebbe71683068f0e922e5c", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0xb2732c13804D60866606D61B1b9450Eb4704e596", - "transactionIndex": 9, + "contractAddress": "0x9f6031F7728FF4dE931036477Ea9bBa5aE7Cf974", + "transactionIndex": 8, "gasUsed": "869188", - "logsBloom": "0x00000004000000000000000000000000000000000000000000000000000000000002000000008400000000000000000000008000000000000000000000008000000000000000000000000000000000800000000000000000000100000000000000000000020000000000020000000800000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000200000202000000000000000080000000000000000000000000000001000000000004000000000000000000001002000400100000000000000000100108000000020000000000000000000000000000000000000000000000000000000000000100000", - "blockHash": "0xa77925726d9e548b8612c868df0b39eb0c57cca731401477eeff1559b2cf428b", - "transactionHash": "0x7c97dc921f5fe19f56d411273f81330dfc844d82a14e983fef65ddf2805be75b", + "logsBloom": "0x10000004000000000000000000000000000000000000000000000000000000000002000000008400000000000000000000008000000000000000000000000000000000000000000000000004000000800000000000000000000100000000004000000000020000000000020000000800000000000000000080000000000000000000000000000000000000000000000000000000000080000000000000200000200000000000000000000000000000000000000000000000001000000000004000000000000000000001000000000000000000000000000100108040000020000000000000000000000040000000000000000000000000000000000000100000", + "blockHash": "0xbc117003237ed393dd243baba3517394b09f5d9f6dd2a70e27f089479260ad3c", + "transactionHash": "0xddffd26021c1fbdcd0c9572da14b9c4d4f80a1f6aacebbe71683068f0e922e5c", "logs": [ { - "transactionIndex": 9, - "blockNumber": 38493740, - "transactionHash": "0x7c97dc921f5fe19f56d411273f81330dfc844d82a14e983fef65ddf2805be75b", - "address": "0xb2732c13804D60866606D61B1b9450Eb4704e596", + "transactionIndex": 8, + "blockNumber": 38730816, + "transactionHash": "0xddffd26021c1fbdcd0c9572da14b9c4d4f80a1f6aacebbe71683068f0e922e5c", + "address": "0x9f6031F7728FF4dE931036477Ea9bBa5aE7Cf974", "topics": [ "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "0x0000000000000000000000000000000000000000000000000000000000000000", @@ -301,27 +301,27 @@ "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 38, - "blockHash": "0xa77925726d9e548b8612c868df0b39eb0c57cca731401477eeff1559b2cf428b" + "logIndex": 25, + "blockHash": "0xbc117003237ed393dd243baba3517394b09f5d9f6dd2a70e27f089479260ad3c" }, { - "transactionIndex": 9, - "blockNumber": 38493740, - "transactionHash": "0x7c97dc921f5fe19f56d411273f81330dfc844d82a14e983fef65ddf2805be75b", + "transactionIndex": 8, + "blockNumber": 38730816, + "transactionHash": "0xddffd26021c1fbdcd0c9572da14b9c4d4f80a1f6aacebbe71683068f0e922e5c", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", - "0x0000000000000000000000003a22c8bc68e98b0faf40f349dd2b2890fae01484" + "0x000000000000000000000000be188d6641e8b680743a4815dfa0f6208038960f" ], - "data": "0x0000000000000000000000000000000000000000000000000004a1c866f97c0000000000000000000000000000000000000000000000001173a2885273a43117000000000000000000000000000000000000000000000d1f6404957aad604b34000000000000000000000000000000000000000000000011739de68a0caab517000000000000000000000000000000000000000000000d1f640937431459c734", - "logIndex": 39, - "blockHash": "0xa77925726d9e548b8612c868df0b39eb0c57cca731401477eeff1559b2cf428b" + "data": "0x0000000000000000000000000000000000000000000000000004a1c866f97c000000000000000000000000000000000000000000000000117103c4d3215dfb030000000000000000000000000000000000000000000033a6d50994c2d051af7200000000000000000000000000000000000000000000001170ff230aba647f030000000000000000000000000000000000000000000033a6d50e368b374b2b72", + "logIndex": 26, + "blockHash": "0xbc117003237ed393dd243baba3517394b09f5d9f6dd2a70e27f089479260ad3c" } ], - "blockNumber": 38493740, - "cumulativeGasUsed": "2178266", + "blockNumber": 38730816, + "cumulativeGasUsed": "2039900", "status": 1, "byzantium": true }, @@ -329,7 +329,7 @@ "0x49c4D4C94829B9c44052C5f5Cb164Fc612181165" ], "numDeployments": 1, - "solcInputHash": "eebf437e3a918f2514b50d71228bf8a9", + "solcInputHash": "6f473f7e77d584cdbb9fe0c91f28e82a", "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"}],\"name\":\"getSigner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"}],\"name\":\"setSigner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"digest\",\"type\":\"bytes32\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"The Sandbox\",\"events\":{\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"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._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"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`)\"}},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Constructor\",\"params\":{\"admin\":\"Address of the admin that will be able to grant roles\"}},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getSigner(address)\":{\"params\":{\"contractAddress\":\"Address of the contract to get the signer for\"},\"returns\":{\"_0\":\"address of the signer\"}},\"grantRole(bytes32,address)\":{\"details\":\"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.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"renounceRole(bytes32,address)\":{\"details\":\"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.\"},\"revokeRole(bytes32,address)\":{\"details\":\"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.\"},\"setSigner(address,address)\":{\"details\":\"Only the admin can call this function\",\"params\":{\"contractAddress\":\"Address of the contract to set the signer for\",\"signer\":\"Address of the signer\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"verify(bytes,bytes32)\":{\"details\":\"Multipurpose function that can be used to verify signatures with different digests\",\"params\":{\"digest\":\"Digest hash\",\"signature\":\"Signature hash\"},\"returns\":{\"_0\":\"bool\"}}},\"title\":\"AuthSuperValidator\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getSigner(address)\":{\"notice\":\"Gets the signer for a contract\"},\"setSigner(address,address)\":{\"notice\":\"Sets the signer for a contract\"},\"verify(bytes,bytes32)\":{\"notice\":\"Takes the signature and the digest and returns if the signer has a backend signer role assigned\"}},\"notice\":\"This contract is used to validate the signatures of the backend, each contract can have a separate signer assigned\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"@sandbox-smart-contracts/asset/contracts/AuthSuperValidator.sol\":\"AuthSuperValidator\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(account),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0dd6e52cb394d7f5abe5dca2d4908a6be40417914720932de757de34a99ab87f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\")\\n mstore(0x1c, hash)\\n message := keccak256(0x00, 0x3c)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, \\\"\\\\x19\\\\x01\\\")\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n data := keccak256(ptr, 0x42)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\\n * `validator` and `data` according to the version 0 of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x00\\\", validator, data));\\n }\\n}\\n\",\"keccak256\":\"0x809bc3edb4bcbef8263fa616c1b60ee0004b50a8a1bfa164d8f57fd31f520c58\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/AuthSuperValidator.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport {AccessControl} from \\\"@openzeppelin/contracts/access/AccessControl.sol\\\";\\nimport {ECDSA} from \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\n/// @title AuthSuperValidator\\n/// @author The Sandbox\\n/// @notice This contract is used to validate the signatures of the backend, each contract can have a separate signer assigned\\ncontract AuthSuperValidator is AccessControl {\\n mapping(address => address) private _signers;\\n\\n /// @dev Constructor\\n /// @param admin Address of the admin that will be able to grant roles\\n constructor(address admin) {\\n _grantRole(DEFAULT_ADMIN_ROLE, admin);\\n }\\n\\n /// @notice Sets the signer for a contract\\n /// @dev Only the admin can call this function\\n /// @param contractAddress Address of the contract to set the signer for\\n /// @param signer Address of the signer\\n function setSigner(address contractAddress, address signer) public onlyRole(DEFAULT_ADMIN_ROLE) {\\n _signers[contractAddress] = signer;\\n }\\n\\n /// @notice Gets the signer for a contract\\n /// @param contractAddress Address of the contract to get the signer for\\n /// @return address of the signer\\n function getSigner(address contractAddress) public view returns (address) {\\n return _signers[contractAddress];\\n }\\n\\n /// @notice Takes the signature and the digest and returns if the signer has a backend signer role assigned\\n /// @dev Multipurpose function that can be used to verify signatures with different digests\\n /// @param signature Signature hash\\n /// @param digest Digest hash\\n /// @return bool\\n function verify(bytes memory signature, bytes32 digest) public view returns (bool) {\\n address signer = _signers[_msgSender()];\\n require(signer != address(0), \\\"AuthSuperValidator: signer not set\\\");\\n address recoveredSigner = ECDSA.recover(digest, signature);\\n return recoveredSigner == signer;\\n }\\n}\\n\",\"keccak256\":\"0x990d27552ffce0f248fadbf539bbc904134ca14d392931bdfab0f02740103be3\",\"license\":\"MIT\"}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b50604051610f6d380380610f6d83398101604081905261002f916100df565b61003a600082610040565b5061010f565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166100db576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561009a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000602082840312156100f157600080fd5b81516001600160a01b038116811461010857600080fd5b9392505050565b610e4f8061011e6000396000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c806336568abe1161007657806391d148541161005b57806391d14854146101ae578063a217fddf146101e5578063d547741f146101ed57600080fd5b806336568abe146101885780636b4063411461019b57600080fd5b806317f9fad1116100a757806317f9fad11461012f578063248a9ca3146101445780632f2ff15d1461017557600080fd5b806301ffc9a7146100c35780631180b553146100eb575b600080fd5b6100d66100d1366004610aed565b610200565b60405190151581526020015b60405180910390f35b6101176100f9366004610b4b565b6001600160a01b039081166000908152600160205260409020541690565b6040516001600160a01b0390911681526020016100e2565b61014261013d366004610b66565b610299565b005b610167610152366004610b99565b60009081526020819052604090206001015490565b6040519081526020016100e2565b610142610183366004610bb2565b6102eb565b610142610196366004610bb2565b610315565b6100d66101a9366004610beb565b6103a6565b6100d66101bc366004610bb2565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b610167600081565b6101426101fb366004610bb2565b610457565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061029357507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60006102a48161047c565b506001600160a01b03918216600090815260016020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001691909216179055565b6000828152602081905260409020600101546103068161047c565b6103108383610489565b505050565b6001600160a01b03811633146103985760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6103a28282610527565b5050565b336000908152600160205260408120546001600160a01b0316806104325760405162461bcd60e51b815260206004820152602260248201527f41757468537570657256616c696461746f723a207369676e6572206e6f74207360448201527f6574000000000000000000000000000000000000000000000000000000000000606482015260840161038f565b600061043e84866105a6565b6001600160a01b03908116921691909114949350505050565b6000828152602081905260409020600101546104728161047c565b6103108383610527565b61048681336105ca565b50565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166103a2576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556104e33390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16156103a2576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008060006105b5858561063d565b915091506105c281610682565b509392505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166103a2576105fb816107e7565b6106068360206107f9565b604051602001610617929190610cc4565b60408051601f198184030181529082905262461bcd60e51b825261038f91600401610d45565b60008082516041036106735760208301516040840151606085015160001a61066787828585610a29565b9450945050505061067b565b506000905060025b9250929050565b600081600481111561069657610696610d78565b0361069e5750565b60018160048111156106b2576106b2610d78565b036106ff5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161038f565b600281600481111561071357610713610d78565b036107605760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161038f565b600381600481111561077457610774610d78565b036104865760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f7565000000000000000000000000000000000000000000000000000000000000606482015260840161038f565b60606102936001600160a01b03831660145b60606000610808836002610da4565b610813906002610dbb565b67ffffffffffffffff81111561082b5761082b610bd5565b6040519080825280601f01601f191660200182016040528015610855576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061088c5761088c610dce565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106108ef576108ef610dce565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600061092b846002610da4565b610936906001610dbb565b90505b60018111156109d3577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061097757610977610dce565b1a60f81b82828151811061098d5761098d610dce565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936109cc81610de4565b9050610939565b508315610a225760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161038f565b9392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610a605750600090506003610ae4565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610ab4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610add57600060019250925050610ae4565b9150600090505b94509492505050565b600060208284031215610aff57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610a2257600080fd5b80356001600160a01b0381168114610b4657600080fd5b919050565b600060208284031215610b5d57600080fd5b610a2282610b2f565b60008060408385031215610b7957600080fd5b610b8283610b2f565b9150610b9060208401610b2f565b90509250929050565b600060208284031215610bab57600080fd5b5035919050565b60008060408385031215610bc557600080fd5b82359150610b9060208401610b2f565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215610bfe57600080fd5b823567ffffffffffffffff80821115610c1657600080fd5b818501915085601f830112610c2a57600080fd5b813581811115610c3c57610c3c610bd5565b604051601f8201601f19908116603f01168101908382118183101715610c6457610c64610bd5565b81604052828152886020848701011115610c7d57600080fd5b826020860160208301376000602093820184015298969091013596505050505050565b60005b83811015610cbb578181015183820152602001610ca3565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351610cfc816017850160208801610ca0565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351610d39816028840160208801610ca0565b01602801949350505050565b6020815260008251806020840152610d64816040850160208701610ca0565b601f01601f19169190910160400192915050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761029357610293610d8e565b8082018082111561029357610293610d8e565b634e487b7160e01b600052603260045260246000fd5b600081610df357610df3610d8e565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea264697066735822122098e499a14f03530492387f85a1265231435a1d8f7eb4b05dc5c856cc0b8545f964736f6c63430008120033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100be5760003560e01c806336568abe1161007657806391d148541161005b57806391d14854146101ae578063a217fddf146101e5578063d547741f146101ed57600080fd5b806336568abe146101885780636b4063411461019b57600080fd5b806317f9fad1116100a757806317f9fad11461012f578063248a9ca3146101445780632f2ff15d1461017557600080fd5b806301ffc9a7146100c35780631180b553146100eb575b600080fd5b6100d66100d1366004610aed565b610200565b60405190151581526020015b60405180910390f35b6101176100f9366004610b4b565b6001600160a01b039081166000908152600160205260409020541690565b6040516001600160a01b0390911681526020016100e2565b61014261013d366004610b66565b610299565b005b610167610152366004610b99565b60009081526020819052604090206001015490565b6040519081526020016100e2565b610142610183366004610bb2565b6102eb565b610142610196366004610bb2565b610315565b6100d66101a9366004610beb565b6103a6565b6100d66101bc366004610bb2565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b610167600081565b6101426101fb366004610bb2565b610457565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061029357507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60006102a48161047c565b506001600160a01b03918216600090815260016020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001691909216179055565b6000828152602081905260409020600101546103068161047c565b6103108383610489565b505050565b6001600160a01b03811633146103985760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6103a28282610527565b5050565b336000908152600160205260408120546001600160a01b0316806104325760405162461bcd60e51b815260206004820152602260248201527f41757468537570657256616c696461746f723a207369676e6572206e6f74207360448201527f6574000000000000000000000000000000000000000000000000000000000000606482015260840161038f565b600061043e84866105a6565b6001600160a01b03908116921691909114949350505050565b6000828152602081905260409020600101546104728161047c565b6103108383610527565b61048681336105ca565b50565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166103a2576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556104e33390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16156103a2576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008060006105b5858561063d565b915091506105c281610682565b509392505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166103a2576105fb816107e7565b6106068360206107f9565b604051602001610617929190610cc4565b60408051601f198184030181529082905262461bcd60e51b825261038f91600401610d45565b60008082516041036106735760208301516040840151606085015160001a61066787828585610a29565b9450945050505061067b565b506000905060025b9250929050565b600081600481111561069657610696610d78565b0361069e5750565b60018160048111156106b2576106b2610d78565b036106ff5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161038f565b600281600481111561071357610713610d78565b036107605760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161038f565b600381600481111561077457610774610d78565b036104865760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f7565000000000000000000000000000000000000000000000000000000000000606482015260840161038f565b60606102936001600160a01b03831660145b60606000610808836002610da4565b610813906002610dbb565b67ffffffffffffffff81111561082b5761082b610bd5565b6040519080825280601f01601f191660200182016040528015610855576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061088c5761088c610dce565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106108ef576108ef610dce565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600061092b846002610da4565b610936906001610dbb565b90505b60018111156109d3577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061097757610977610dce565b1a60f81b82828151811061098d5761098d610dce565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936109cc81610de4565b9050610939565b508315610a225760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161038f565b9392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610a605750600090506003610ae4565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610ab4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610add57600060019250925050610ae4565b9150600090505b94509492505050565b600060208284031215610aff57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610a2257600080fd5b80356001600160a01b0381168114610b4657600080fd5b919050565b600060208284031215610b5d57600080fd5b610a2282610b2f565b60008060408385031215610b7957600080fd5b610b8283610b2f565b9150610b9060208401610b2f565b90509250929050565b600060208284031215610bab57600080fd5b5035919050565b60008060408385031215610bc557600080fd5b82359150610b9060208401610b2f565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215610bfe57600080fd5b823567ffffffffffffffff80821115610c1657600080fd5b818501915085601f830112610c2a57600080fd5b813581811115610c3c57610c3c610bd5565b604051601f8201601f19908116603f01168101908382118183101715610c6457610c64610bd5565b81604052828152886020848701011115610c7d57600080fd5b826020860160208301376000602093820184015298969091013596505050505050565b60005b83811015610cbb578181015183820152602001610ca3565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351610cfc816017850160208801610ca0565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351610d39816028840160208801610ca0565b01602801949350505050565b6020815260008251806020840152610d64816040850160208701610ca0565b601f01601f19169190910160400192915050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761029357610293610d8e565b8082018082111561029357610293610d8e565b634e487b7160e01b600052603260045260246000fd5b600081610df357610df3610d8e565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea264697066735822122098e499a14f03530492387f85a1265231435a1d8f7eb4b05dc5c856cc0b8545f964736f6c63430008120033", @@ -420,15 +420,15 @@ "storageLayout": { "storage": [ { - "astId": 8167, + "astId": 8085, "contract": "@sandbox-smart-contracts/asset/contracts/AuthSuperValidator.sol:AuthSuperValidator", "label": "_roles", "offset": 0, "slot": "0", - "type": "t_mapping(t_bytes32,t_struct(RoleData)8162_storage)" + "type": "t_mapping(t_bytes32,t_struct(RoleData)8080_storage)" }, { - "astId": 15216, + "astId": 15201, "contract": "@sandbox-smart-contracts/asset/contracts/AuthSuperValidator.sol:AuthSuperValidator", "label": "_signers", "offset": 0, @@ -466,19 +466,19 @@ "numberOfBytes": "32", "value": "t_bool" }, - "t_mapping(t_bytes32,t_struct(RoleData)8162_storage)": { + "t_mapping(t_bytes32,t_struct(RoleData)8080_storage)": { "encoding": "mapping", "key": "t_bytes32", "label": "mapping(bytes32 => struct AccessControl.RoleData)", "numberOfBytes": "32", - "value": "t_struct(RoleData)8162_storage" + "value": "t_struct(RoleData)8080_storage" }, - "t_struct(RoleData)8162_storage": { + "t_struct(RoleData)8080_storage": { "encoding": "inplace", "label": "struct AccessControl.RoleData", "members": [ { - "astId": 8159, + "astId": 8077, "contract": "@sandbox-smart-contracts/asset/contracts/AuthSuperValidator.sol:AuthSuperValidator", "label": "members", "offset": 0, @@ -486,7 +486,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 8161, + "astId": 8079, "contract": "@sandbox-smart-contracts/asset/contracts/AuthSuperValidator.sol:AuthSuperValidator", "label": "adminRole", "offset": 0, diff --git a/packages/deploy/deployments/mumbai/Catalyst.json b/packages/deploy/deployments/mumbai/Catalyst.json index f54e3072db..580cc8dfe2 100644 --- a/packages/deploy/deployments/mumbai/Catalyst.json +++ b/packages/deploy/deployments/mumbai/Catalyst.json @@ -1,5 +1,5 @@ { - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "abi": [ { "anonymous": false, @@ -356,6 +356,31 @@ "name": "TrustedForwarderChanged", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldTrustedForwarder", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newTrustedForwarder", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -611,7 +636,7 @@ "outputs": [ { "internalType": "address", - "name": "trustedForwarder", + "name": "", "type": "address" } ], @@ -818,6 +843,24 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "subscriptionOrRegistrantToCopy", + "type": "address" + }, + { + "internalType": "bool", + "name": "subscribe", + "type": "bool" + } + ], + "name": "registerAndSubscribe", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -1011,6 +1054,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "registry", + "type": "address" + } + ], + "name": "setOperatorRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -1103,64 +1159,79 @@ "type": "constructor" } ], - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", - "transactionIndex": 12, - "gasUsed": "1555981", - "logsBloom": "0x04000004000000000000001000040000400000000800000000000000100000000002000000008400000000000000004000008000020400000000000000048000000090000000010000000020000002820000000000040000000100000000000008000000020000000000020000000800000000800200000080000000001000000000000400000000000000010000001000000800000080000000000000a00002200000000000000000080100000400000000000000800000003000080400404000000020004000000001040000040300001000008400000100108020000060004000180000000800040000200000000000000000008000000000000000100000", - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f", - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", + "contractAddress": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", + "transactionIndex": 18, + "gasUsed": "1558973", + "logsBloom": "0x04000004000000000000000000000020400000000800000000000090100000000002000000008420000000000001004000008000024400000000000000040000000090000000010100000020000002800000000000040000000100000000000008100000020000000000020000000800080000800000000180000000001000080000011440000000000000000000001000000800000080000000000000a00000200000000000000000000100000400000000000000800040003000080400404000000020104000000001000000040200001000048400000100108000001060002000080000000000000000200001000004000000008000000000000000100000", + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb", + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", "logs": [ { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", - "0x000000000000000000000000f2f9e0b0c8e557ba796d8a129e3e8dd521a9fc76" + "0x000000000000000000000000b24c71efea030ac79915fd41def45b3b759cd802" + ], + "data": "0x", + "logIndex": 37, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" + }, + { + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", + "topics": [ + "0x8ca022029d8ff7ad974913f8970aeed6c5e0e7eaf494a0c5b262249f6b5759e5", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f7", + "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 117, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 38, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", "address": "0x000000000000AAeB6D7670E522A718067333cd4E", "topics": [ "0x86d03f430c7616021073d7a71766f632f1ce19f289aa989534d9f4732253eb59", - "0x000000000000000000000000284b028af7cead623c2f99ebe7edc9e1a02eef5e", + "0x000000000000000000000000d4d1e504be6d12829c3ddfa59778d35203cc358c", "0x0000000000000000000000000000000000000000000000000000000000000001" ], "data": "0x", - "logIndex": 118, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 39, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", "address": "0x000000000000AAeB6D7670E522A718067333cd4E", "topics": [ "0x0038c54977604f1a5c0a3604cbbecd0153c81e3131799ead95755e8bb5d5b9e8", - "0x000000000000000000000000284b028af7cead623c2f99ebe7edc9e1a02eef5e", - "0x000000000000000000000000d7e1d0670359324e9ed9aacb7ee7c1ef7636268e", + "0x000000000000000000000000d4d1e504be6d12829c3ddfa59778d35203cc358c", + "0x00000000000000000000000028ef45183e30200b216456f995ad8ff00eba402f", "0x0000000000000000000000000000000000000000000000000000000000000001" ], "data": "0x", - "logIndex": 119, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 40, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "0x0000000000000000000000000000000000000000000000000000000000000000", @@ -1168,14 +1239,14 @@ "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 120, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 41, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "0x9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6", @@ -1183,149 +1254,149 @@ "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 121, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 42, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b", "0x0000000000000000000000000000000000000000000000000000000000000000" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261667962656965636e7a37736e7837363374637877627369746275636c74637870376d6135736971626764613335626c3374736665657469346d000000000000000000000000000000000000000000000000000000000000", - "logIndex": 122, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 43, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b", "0x0000000000000000000000000000000000000000000000000000000000000001" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b7265696235746b793364677363377a793633376466756e62347a77776e707a6f33773369357465706266656534326571337372776e7771000000000000000000000000000000000000000000000000000000000000", - "logIndex": 123, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 44, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b", "0x0000000000000000000000000000000000000000000000000000000000000002" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b7265696567657676696d357133617469346874736e63787773656a6663336c626b7a6237776e326132667a7468633674736f663776376d000000000000000000000000000000000000000000000000000000000000", - "logIndex": 124, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 45, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b", "0x0000000000000000000000000000000000000000000000000000000000000003" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b7265696668746b6f75356133327872746b746476667172766768346d70326f68766c79716473696835786b346b67636679777478656669000000000000000000000000000000000000000000000000000000000000", - "logIndex": 125, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 46, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b", "0x0000000000000000000000000000000000000000000000000000000000000004" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b7265696771706237716f3369716b61343234336f6168336e6b6136616778336e6d76777a6175787a65326a7a6e6f7478337a776f7a7165000000000000000000000000000000000000000000000000000000000000", - "logIndex": 126, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 47, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b", "0x0000000000000000000000000000000000000000000000000000000000000005" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b726569683369747369776b6e3275727a66766732366d627933737367667368766472367a6661627236727878726c7a68656471696c3465000000000000000000000000000000000000000000000000000000000000", - "logIndex": 127, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 48, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b", "0x0000000000000000000000000000000000000000000000000000000000000006" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b726569626d6e6761756f7a7a69647a3265657679796233756d66326577377a6578696e673367687570366c37696f32616f3532326d7679000000000000000000000000000000000000000000000000000000000000", - "logIndex": 128, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 49, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x0000000000000000000000000000000000000000000000000000000000000001", - "logIndex": 129, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 50, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" ], - "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c3c6b8feee55636e949920aa90f093f6f5faf448", - "logIndex": 130, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c26b12025e378c570fb46249093ba387a2e927bc", + "logIndex": 51, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", - "0x0000000000000000000000003a22c8bc68e98b0faf40f349dd2b2890fae01484" + "0x000000000000000000000000f903ba9e006193c1527bfbe65fe2123704ea3f99" ], - "data": "0x00000000000000000000000000000000000000000000000000084abc162c630000000000000000000000000000000000000000000000001173aad30e8b93af0e000000000000000000000000000000000000000000000d1f6344cbfa78f10afe00000000000000000000000000000000000000000000001173a2885275674c0e000000000000000000000000000000000000000000000d1f634d16b68f1d6dfe", - "logIndex": 131, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "data": "0x00000000000000000000000000000000000000000000000000084ed107d1b3000000000000000000000000000000000000000000000000117119f8fd62155a93000000000000000000000000000000000000000000001043e257271476ed79ad0000000000000000000000000000000000000000000000117111aa2c5a43a793000000000000000000000000000000000000000000001043e25f75e57ebf2cad", + "logIndex": 52, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" } ], - "blockNumber": 38493737, - "cumulativeGasUsed": "5816390", + "blockNumber": 38730669, + "cumulativeGasUsed": "2763286", "status": 1, "byzantium": true }, "args": [ - "0xF2F9E0b0C8E557Ba796D8a129e3e8DD521A9FC76", - "0xc3C6B8feeE55636e949920Aa90f093f6f5Faf448", - "0xf3bdecc100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f7000000000000000000000000d7e1d0670359324e9ed9aacb7ee7c1ef7636268e00000000000000000000000049c4d4c94829b9c44052c5f5cb164fc61218116500000000000000000000000049c4d4c94829b9c44052c5f5cb164fc612181165000000000000000000000000000000000000000000000000000000000000012000000000000000000000000042017fd22fd371cb717e4895e8a45d17dcde89e60000000000000000000000000000000000000000000000000000000000000007697066733a2f2f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000003b6261667962656965636e7a37736e7837363374637877627369746275636c74637870376d6135736971626764613335626c3374736665657469346d0000000000000000000000000000000000000000000000000000000000000000000000003b6261666b7265696235746b793364677363377a793633376466756e62347a77776e707a6f33773369357465706266656534326571337372776e77710000000000000000000000000000000000000000000000000000000000000000000000003b6261666b7265696567657676696d357133617469346874736e63787773656a6663336c626b7a6237776e326132667a7468633674736f663776376d0000000000000000000000000000000000000000000000000000000000000000000000003b6261666b7265696668746b6f75356133327872746b746476667172766768346d70326f68766c79716473696835786b346b676366797774786566690000000000000000000000000000000000000000000000000000000000000000000000003b6261666b7265696771706237716f3369716b61343234336f6168336e6b6136616778336e6d76777a6175787a65326a7a6e6f7478337a776f7a71650000000000000000000000000000000000000000000000000000000000000000000000003b6261666b726569683369747369776b6e3275727a66766732366d627933737367667368766472367a6661627236727878726c7a68656471696c34650000000000000000000000000000000000000000000000000000000000000000000000003b6261666b726569626d6e6761756f7a7a69647a3265657679796233756d66326577377a6578696e673367687570366c37696f32616f3532326d76790000000000" + "0xb24c71EFeA030ac79915fD41deF45b3B759cD802", + "0xc26B12025e378c570Fb46249093Ba387A2e927bc", + "0xf3bdecc100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f700000000000000000000000028ef45183e30200b216456f995ad8ff00eba402f00000000000000000000000049c4d4c94829b9c44052c5f5cb164fc61218116500000000000000000000000049c4d4c94829b9c44052c5f5cb164fc61218116500000000000000000000000000000000000000000000000000000000000001200000000000000000000000004ae9a95ec193fc1b38c246b701de49b8e3f5ef340000000000000000000000000000000000000000000000000000000000000007697066733a2f2f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000003b6261667962656965636e7a37736e7837363374637877627369746275636c74637870376d6135736971626764613335626c3374736665657469346d0000000000000000000000000000000000000000000000000000000000000000000000003b6261666b7265696235746b793364677363377a793633376466756e62347a77776e707a6f33773369357465706266656534326571337372776e77710000000000000000000000000000000000000000000000000000000000000000000000003b6261666b7265696567657676696d357133617469346874736e63787773656a6663336c626b7a6237776e326132667a7468633674736f663776376d0000000000000000000000000000000000000000000000000000000000000000000000003b6261666b7265696668746b6f75356133327872746b746476667172766768346d70326f68766c79716473696835786b346b676366797774786566690000000000000000000000000000000000000000000000000000000000000000000000003b6261666b7265696771706237716f3369716b61343234336f6168336e6b6136616778336e6d76777a6175787a65326a7a6e6f7478337a776f7a71650000000000000000000000000000000000000000000000000000000000000000000000003b6261666b726569683369747369776b6e3275727a66766732366d627933737367667368766472367a6661627236727878726c7a68656471696c34650000000000000000000000000000000000000000000000000000000000000000000000003b6261666b726569626d6e6761756f7a7a69647a3265657679796233756d66326577377a6578696e673367687570366c37696f32616f3532326d76790000000000" ], "numDeployments": 1, "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", @@ -1337,7 +1408,7 @@ "args": [ "ipfs://", "0x69015912aa33720b842dcd6ac059ed623f28d9f7", - "0xd7e1D0670359324E9Ed9AAcB7ee7c1EF7636268e", + "0x28EF45183E30200B216456f995Ad8FF00Eba402F", "0x49c4D4C94829B9c44052C5f5Cb164Fc612181165", "0x49c4D4C94829B9c44052C5f5Cb164Fc612181165", [ @@ -1349,10 +1420,10 @@ "bafkreih3itsiwkn2urzfvg26mby3ssgfshvdr6zfabr6rxxrlzhedqil4e", "bafkreibmngauozzidz2eevyyb3umf2ew7zexing3ghup6l7io2ao522mvy" ], - "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6" + "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34" ] }, - "implementation": "0xF2F9E0b0C8E557Ba796D8a129e3e8DD521A9FC76", + "implementation": "0xb24c71EFeA030ac79915fD41deF45b3B759cD802", "devdoc": { "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", "kind": "dev", diff --git a/packages/deploy/deployments/mumbai/Catalyst_Implementation.json b/packages/deploy/deployments/mumbai/Catalyst_Implementation.json index 4b7e86cc62..c458c099ec 100644 --- a/packages/deploy/deployments/mumbai/Catalyst_Implementation.json +++ b/packages/deploy/deployments/mumbai/Catalyst_Implementation.json @@ -1,5 +1,5 @@ { - "address": "0xF2F9E0b0C8E557Ba796D8a129e3e8DD521A9FC76", + "address": "0xb24c71EFeA030ac79915fD41deF45b3B759cD802", "abi": [ { "inputs": [], @@ -238,6 +238,31 @@ "name": "TrustedForwarderChanged", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldTrustedForwarder", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newTrustedForwarder", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "TrustedForwarderSet", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -493,7 +518,7 @@ "outputs": [ { "internalType": "address", - "name": "trustedForwarder", + "name": "", "type": "address" } ], @@ -700,6 +725,24 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "subscriptionOrRegistrantToCopy", + "type": "address" + }, + { + "internalType": "bool", + "name": "subscribe", + "type": "bool" + } + ], + "name": "registerAndSubscribe", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -893,6 +936,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "registry", + "type": "address" + } + ], + "name": "setOperatorRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -964,56 +1020,56 @@ "type": "function" } ], - "transactionHash": "0xe53491cf7aff2a6e14a6791f8b4481f91e089649bd4360f7228c7ef413fe030a", + "transactionHash": "0x5847e0e710a39646e7d2d1cd8772705de15fa47d504e7918238e20c1d701b7e8", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0xF2F9E0b0C8E557Ba796D8a129e3e8DD521A9FC76", - "transactionIndex": 8, - "gasUsed": "3770505", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000008000000000000000000000008000000000000000000000000000000000800000080000000000000100000000000000000000000000000000000000000000000000000000000080000000000000000000000000002000000000000000000000000000000080000000000000200000200000000000000000088000000400000000000000000000000000000000004000000000000000000001000000040100000000000000000000108000000000000000000000000000000000000000000000000000000000000000000000100000", - "blockHash": "0x852f6833bec8aab984d7037b7fbc3c8d2cbe13636ea891700866054e7b3812d9", - "transactionHash": "0xe53491cf7aff2a6e14a6791f8b4481f91e089649bd4360f7228c7ef413fe030a", + "contractAddress": "0xb24c71EFeA030ac79915fD41deF45b3B759cD802", + "transactionIndex": 5, + "gasUsed": "3965613", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000010000000000002000000000020000000000000000000008000000000000000000000004000000000000000000000000000000000800000000000000000000100000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000080000000000000200000200000000000000000000000000400000000000000000000000000000000004000000000000000000001000000040000000000000000000000108000001080000000000000004000000000000000000000000000000000000000000000100000", + "blockHash": "0x3441cc14a1e7afed9c4fcf6aead8d1ae3747a058848ae4e1c9e99d879630a9ee", + "transactionHash": "0x5847e0e710a39646e7d2d1cd8772705de15fa47d504e7918238e20c1d701b7e8", "logs": [ { - "transactionIndex": 8, - "blockNumber": 38493734, - "transactionHash": "0xe53491cf7aff2a6e14a6791f8b4481f91e089649bd4360f7228c7ef413fe030a", - "address": "0xF2F9E0b0C8E557Ba796D8a129e3e8DD521A9FC76", + "transactionIndex": 5, + "blockNumber": 38730667, + "transactionHash": "0x5847e0e710a39646e7d2d1cd8772705de15fa47d504e7918238e20c1d701b7e8", + "address": "0xb24c71EFeA030ac79915fD41deF45b3B759cD802", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", - "logIndex": 44, - "blockHash": "0x852f6833bec8aab984d7037b7fbc3c8d2cbe13636ea891700866054e7b3812d9" + "logIndex": 7, + "blockHash": "0x3441cc14a1e7afed9c4fcf6aead8d1ae3747a058848ae4e1c9e99d879630a9ee" }, { - "transactionIndex": 8, - "blockNumber": 38493734, - "transactionHash": "0xe53491cf7aff2a6e14a6791f8b4481f91e089649bd4360f7228c7ef413fe030a", + "transactionIndex": 5, + "blockNumber": 38730667, + "transactionHash": "0x5847e0e710a39646e7d2d1cd8772705de15fa47d504e7918238e20c1d701b7e8", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", - "0x0000000000000000000000003a22c8bc68e98b0faf40f349dd2b2890fae01484" + "0x000000000000000000000000f903ba9e006193c1527bfbe65fe2123704ea3f99" ], - "data": "0x000000000000000000000000000000000000000000000000001417e1a8b9270000000000000000000000000000000000000000000000001173beeaf03891f839000000000000000000000000000000000000000000000d1f62955ad780f8fd0400000000000000000000000000000000000000000000001173aad30e8fd8d139000000000000000000000000000000000000000000000d1f62a972b929b22404", - "logIndex": 45, - "blockHash": "0x852f6833bec8aab984d7037b7fbc3c8d2cbe13636ea891700866054e7b3812d9" + "data": "0x0000000000000000000000000000000000000000000000000015220e5745c300000000000000000000000000000000000000000000000011712f1b0bbd234863000000000000000000000000000000000000000000001043e21c51e2b1086c9e0000000000000000000000000000000000000000000000117119f8fd65dd8563000000000000000000000000000000000000000000001043e23173f1084e2f9e", + "logIndex": 8, + "blockHash": "0x3441cc14a1e7afed9c4fcf6aead8d1ae3747a058848ae4e1c9e99d879630a9ee" } ], - "blockNumber": 38493734, - "cumulativeGasUsed": "5106242", + "blockNumber": 38730667, + "cumulativeGasUsed": "4127973", "status": 1, "byzantium": true }, "args": [], "numDeployments": 1, - "solcInputHash": "101d55502dc3ddda4c84938ce7ac435e", - "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newDefaultRoyaltyRecipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newDefaultRoyaltyAmount\",\"type\":\"uint256\"}],\"name\":\"DefaultRoyaltyChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"catalystId\",\"type\":\"uint256\"}],\"name\":\"NewCatalystTypeAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"name\":\"TransferBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"TransferSingle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newTrustedForwarderAddress\",\"type\":\"address\"}],\"name\":\"TrustedForwarderChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"URI\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINTER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"ipfsCID\",\"type\":\"string\"}],\"name\":\"addNewCatalystType\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"balanceOfBatch\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"name\":\"burnBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"burnBatchFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burnFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"exists\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTrustedForwarder\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"highestTierIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_baseUri\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_trustedForwarder\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_subscription\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_defaultAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_defaultMinter\",\"type\":\"address\"},{\"internalType\":\"string[]\",\"name\":\"_catalystIpfsCID\",\"type\":\"string[]\"},{\"internalType\":\"address\",\"name\":\"_royaltyManager\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"}],\"name\":\"isTrustedForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"mintBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"operatorFilterRegistry\",\"outputs\":[{\"internalType\":\"contract IOperatorFilterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_salePrice\",\"type\":\"uint256\"}],\"name\":\"royaltyInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"royaltyAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"royaltyManager\",\"outputs\":[{\"internalType\":\"contract IRoyaltyManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeBatchTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"baseURI\",\"type\":\"string\"}],\"name\":\"setBaseURI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"metadataHash\",\"type\":\"string\"}],\"name\":\"setMetadataHash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"name\":\"setTrustedForwarder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"The Sandbox\",\"details\":\"An ERC1155 contract that manages catalysts, extends multiple OpenZeppelin contracts to provide a variety of features including, AccessControl, URIStorage, Burnable and more. The contract includes support for meta transactions.\",\"events\":{\"ApprovalForAll(address,address,bool)\":{\"details\":\"Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to `approved`.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"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._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"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`)\"},\"TransferBatch(address,address,address,uint256[],uint256[])\":{\"details\":\"Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all transfers.\"},\"TransferSingle(address,address,address,uint256,uint256)\":{\"details\":\"Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\"},\"URI(string,uint256)\":{\"details\":\"Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. If an {URI} event was emitted for `id`, the standard https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value returned by {IERC1155MetadataURI-uri}.\"}},\"kind\":\"dev\",\"methods\":{\"addNewCatalystType(string)\":{\"params\":{\"ipfsCID\":\"The royalty bps for the catalyst\"}},\"balanceOf(address,uint256)\":{\"details\":\"See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address.\"},\"balanceOfBatch(address[],uint256[])\":{\"details\":\"See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length.\"},\"burnBatchFrom(address,uint256[],uint256[])\":{\"params\":{\"account\":\"The address to burn from\",\"amounts\":\"The amounts to be burned\",\"ids\":\"The token ids to burn\"}},\"burnFrom(address,uint256,uint256)\":{\"params\":{\"account\":\"The address to burn from\",\"amount\":\"The amount to be burned\",\"id\":\"The token id to burn\"}},\"constructor\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"exists(uint256)\":{\"details\":\"Indicates whether any token exist with a given id, or not.\"},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"grantRole(bytes32,address)\":{\"details\":\"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.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"initialize(string,address,address,address,address,string[],address)\":{\"params\":{\"_baseUri\":\"The base URI for the token metadata, most likely set to ipfs://.\",\"_catalystIpfsCID\":\"The IPFS content identifiers for each catalyst.\",\"_defaultAdmin\":\"The default admin address.\",\"_defaultMinter\":\"The default minter address.\",\"_royaltyManager\":\", the address of the Manager contract for common royalty recipient\",\"_subscription\":\"The subscription address.\",\"_trustedForwarder\":\"The trusted forwarder for meta transactions.\"}},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC1155-isApprovedForAll}.\"},\"mint(address,uint256,uint256)\":{\"params\":{\"amount\":\"The amount to be minted\",\"id\":\"The token id to mint\",\"to\":\"The address that will own the minted token\"}},\"mintBatch(address,uint256[],uint256[])\":{\"params\":{\"amounts\":\"The amounts to be minted per token id\",\"ids\":\"The token ids to mint\",\"to\":\"The address that will own the minted tokens\"}},\"renounceRole(bytes32,address)\":{\"details\":\"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.\"},\"revokeRole(bytes32,address)\":{\"details\":\"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.\"},\"royaltyInfo(uint256,uint256)\":{\"details\":\"tokenId is one of the EIP2981 args for this function can't be removed\",\"params\":{\"_salePrice\":\"the price of token on which the royalty is calculated\"},\"returns\":{\"receiver\":\"the receiver of royalty\",\"royaltyAmount\":\"the amount of royalty\"}},\"safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)\":{\"details\":\"call data should be optimized to order ids so packedBalance can be used efficiently.\",\"params\":{\"data\":\"aditional data accompanying the transfer.\",\"from\":\"address from which tokens are transfered.\",\"ids\":\"ids of each token type transfered.\",\"to\":\"address to which the token will be transfered.\",\"values\":\"amount of each token type transfered.\"}},\"safeTransferFrom(address,address,uint256,uint256,bytes)\":{\"params\":{\"data\":\"aditional data accompanying the transfer.\",\"from\":\"address from which tokens are transfered.\",\"id\":\"the token type transfered.\",\"to\":\"address to which the token will be transfered.\",\"value\":\"amount of token transfered.\"}},\"setApprovalForAll(address,bool)\":{\"params\":{\"approved\":\"whether to approve or revoke\",\"operator\":\"address which will be granted rights to transfer all tokens of the caller.\"}},\"setBaseURI(string)\":{\"params\":{\"baseURI\":\"The new base URI\"}},\"setMetadataHash(uint256,string)\":{\"params\":{\"metadataHash\":\"The new URI\",\"tokenId\":\"The token id to set URI for\"}},\"setTrustedForwarder(address)\":{\"details\":\"Change the address of the trusted forwarder for meta-TX\",\"params\":{\"trustedForwarder\":\"The new trustedForwarder\"}},\"supportsInterface(bytes4)\":{\"params\":{\"interfaceId\":\"the interface identifier, as specified in ERC-165.\"},\"returns\":{\"_0\":\"`true` if the contract implements `interfaceId`.\"}},\"totalSupply(uint256)\":{\"details\":\"Total amount of tokens in with a given id.\"},\"uri(uint256)\":{\"params\":{\"tokenId\":\"The token id to get URI for\"},\"returns\":{\"_0\":\"tokenURI the URI of the token\"}}},\"title\":\"Catalyst\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"addNewCatalystType(string)\":{\"notice\":\"Add a new catalyst type, limited to DEFAULT_ADMIN_ROLE only\"},\"burnBatchFrom(address,uint256[],uint256[])\":{\"notice\":\"Burns a batch of tokens from a specific address\"},\"burnFrom(address,uint256,uint256)\":{\"notice\":\"Burns a specified amount of tokens from a specific address\"},\"initialize(string,address,address,address,address,string[],address)\":{\"notice\":\"Initialize the contract, setting up initial values for various features.\"},\"mint(address,uint256,uint256)\":{\"notice\":\"Mints a new token, limited to MINTER_ROLE only\"},\"mintBatch(address,uint256[],uint256[])\":{\"notice\":\"Mints a batch of tokens, limited to MINTER_ROLE only\"},\"royaltyInfo(uint256,uint256)\":{\"notice\":\"Returns how much royalty is owed and to whom based on ERC2981\"},\"safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)\":{\"notice\":\"Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\"},\"safeTransferFrom(address,address,uint256,uint256,bytes)\":{\"notice\":\"Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\"},\"setApprovalForAll(address,bool)\":{\"notice\":\"Enable or disable approval for `operator` to manage all of the caller's tokens.\"},\"setBaseURI(string)\":{\"notice\":\"Set a new base URI\"},\"setMetadataHash(uint256,string)\":{\"notice\":\"Set a new URI for specific tokenid\"},\"setTrustedForwarder(address)\":{\"notice\":\"Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\"},\"supportsInterface(bytes4)\":{\"notice\":\"Query if a contract implements interface `id`.\"},\"uri(uint256)\":{\"notice\":\"returns full token URI, including baseURI and token metadata URI\"}},\"notice\":\"THis contract manages catalysts which are used to mint new assets.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"@sandbox-smart-contracts/asset/contracts/Catalyst.sol\":\"Catalyst\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/// @author: manifold.xyz\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\nstruct Recipient {\\n address payable recipient;\\n uint16 bps;\\n}\\n\\ninterface IRoyaltySplitter is IERC165 {\\n /**\\n * @dev Set the splitter recipients. Total bps must total 10000.\\n */\\n function setRecipients(Recipient[] calldata recipients) external;\\n\\n /**\\n * @dev Get the splitter recipients;\\n */\\n function getRecipients() external view returns (Recipient[] memory);\\n}\\n\",\"keccak256\":\"0xc507963f66c4238d25e69d2d05ac5995c549aa89789e89e7a556403221547c6d\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlUpgradeable.sol\\\";\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\\n function __AccessControl_init() internal onlyInitializing {\\n }\\n\\n function __AccessControl_init_unchained() internal onlyInitializing {\\n }\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n StringsUpgradeable.toHexString(account),\\n \\\" is missing role \\\",\\n StringsUpgradeable.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xfeefb24d068524440e1ba885efdf105d91f83504af3c2d745ffacc4595396831\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControlUpgradeable {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0xb8f5302f12138c5561362e88a78d061573e6298b7a1a5afe84a1e2c8d4d5aeaa\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC2981.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Interface for the NFT Royalty Standard.\\n *\\n * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal\\n * support for royalty payments across all NFT marketplaces and ecosystem participants.\\n *\\n * _Available since v4.5._\\n */\\ninterface IERC2981Upgradeable is IERC165Upgradeable {\\n /**\\n * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\\n * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.\\n */\\n function royaltyInfo(\\n uint256 tokenId,\\n uint256 salePrice\\n ) external view returns (address receiver, uint256 royaltyAmount);\\n}\\n\",\"keccak256\":\"0x1a94069aa241fa1ebb4409d02a405c932d3ad7e875bdd5587c88244da210ccdf\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized != type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC1155Upgradeable.sol\\\";\\nimport \\\"./IERC1155ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC1155MetadataURIUpgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the basic standard multi-token.\\n * See https://eips.ethereum.org/EIPS/eip-1155\\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\\n *\\n * _Available since v3.1._\\n */\\ncontract ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155Upgradeable, IERC1155MetadataURIUpgradeable {\\n using AddressUpgradeable for address;\\n\\n // Mapping from token ID to account balances\\n mapping(uint256 => mapping(address => uint256)) private _balances;\\n\\n // Mapping from account to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json\\n string private _uri;\\n\\n /**\\n * @dev See {_setURI}.\\n */\\n function __ERC1155_init(string memory uri_) internal onlyInitializing {\\n __ERC1155_init_unchained(uri_);\\n }\\n\\n function __ERC1155_init_unchained(string memory uri_) internal onlyInitializing {\\n _setURI(uri_);\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return\\n interfaceId == type(IERC1155Upgradeable).interfaceId ||\\n interfaceId == type(IERC1155MetadataURIUpgradeable).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC1155MetadataURI-uri}.\\n *\\n * This implementation returns the same URI for *all* token types. It relies\\n * on the token type ID substitution mechanism\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\\n *\\n * Clients calling this function must replace the `\\\\{id\\\\}` substring with the\\n * actual token type ID.\\n */\\n function uri(uint256) public view virtual override returns (string memory) {\\n return _uri;\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {\\n require(account != address(0), \\\"ERC1155: address zero is not a valid owner\\\");\\n return _balances[id][account];\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOfBatch}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] memory accounts,\\n uint256[] memory ids\\n ) public view virtual override returns (uint256[] memory) {\\n require(accounts.length == ids.length, \\\"ERC1155: accounts and ids length mismatch\\\");\\n\\n uint256[] memory batchBalances = new uint256[](accounts.length);\\n\\n for (uint256 i = 0; i < accounts.length; ++i) {\\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\\n }\\n\\n return batchBalances;\\n }\\n\\n /**\\n * @dev See {IERC1155-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC1155-isApprovedForAll}.\\n */\\n function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[account][operator];\\n }\\n\\n /**\\n * @dev See {IERC1155-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) public virtual override {\\n require(\\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\\n \\\"ERC1155: caller is not token owner or approved\\\"\\n );\\n _safeTransferFrom(from, to, id, amount, data);\\n }\\n\\n /**\\n * @dev See {IERC1155-safeBatchTransferFrom}.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) public virtual override {\\n require(\\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\\n \\\"ERC1155: caller is not token owner or approved\\\"\\n );\\n _safeBatchTransferFrom(from, to, ids, amounts, data);\\n }\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function _safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) internal virtual {\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n\\n address operator = _msgSender();\\n uint256[] memory ids = _asSingletonArray(id);\\n uint256[] memory amounts = _asSingletonArray(amount);\\n\\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n uint256 fromBalance = _balances[id][from];\\n require(fromBalance >= amount, \\\"ERC1155: insufficient balance for transfer\\\");\\n unchecked {\\n _balances[id][from] = fromBalance - amount;\\n }\\n _balances[id][to] += amount;\\n\\n emit TransferSingle(operator, from, to, id, amount);\\n\\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);\\n }\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function _safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual {\\n require(ids.length == amounts.length, \\\"ERC1155: ids and amounts length mismatch\\\");\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n\\n address operator = _msgSender();\\n\\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n for (uint256 i = 0; i < ids.length; ++i) {\\n uint256 id = ids[i];\\n uint256 amount = amounts[i];\\n\\n uint256 fromBalance = _balances[id][from];\\n require(fromBalance >= amount, \\\"ERC1155: insufficient balance for transfer\\\");\\n unchecked {\\n _balances[id][from] = fromBalance - amount;\\n }\\n _balances[id][to] += amount;\\n }\\n\\n emit TransferBatch(operator, from, to, ids, amounts);\\n\\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);\\n }\\n\\n /**\\n * @dev Sets a new URI for all token types, by relying on the token type ID\\n * substitution mechanism\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\\n *\\n * By this mechanism, any occurrence of the `\\\\{id\\\\}` substring in either the\\n * URI or any of the amounts in the JSON file at said URI will be replaced by\\n * clients with the token type ID.\\n *\\n * For example, the `https://token-cdn-domain/\\\\{id\\\\}.json` URI would be\\n * interpreted by clients as\\n * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\\n * for token type ID 0x4cce0.\\n *\\n * See {uri}.\\n *\\n * Because these URIs cannot be meaningfully represented by the {URI} event,\\n * this function emits no events.\\n */\\n function _setURI(string memory newuri) internal virtual {\\n _uri = newuri;\\n }\\n\\n /**\\n * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\\n require(to != address(0), \\\"ERC1155: mint to the zero address\\\");\\n\\n address operator = _msgSender();\\n uint256[] memory ids = _asSingletonArray(id);\\n uint256[] memory amounts = _asSingletonArray(amount);\\n\\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\\n\\n _balances[id][to] += amount;\\n emit TransferSingle(operator, address(0), to, id, amount);\\n\\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\\n\\n _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);\\n }\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function _mintBatch(\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual {\\n require(to != address(0), \\\"ERC1155: mint to the zero address\\\");\\n require(ids.length == amounts.length, \\\"ERC1155: ids and amounts length mismatch\\\");\\n\\n address operator = _msgSender();\\n\\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\\n\\n for (uint256 i = 0; i < ids.length; i++) {\\n _balances[ids[i]][to] += amounts[i];\\n }\\n\\n emit TransferBatch(operator, address(0), to, ids, amounts);\\n\\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\\n\\n _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens of token type `id` from `from`\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `from` must have at least `amount` tokens of token type `id`.\\n */\\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\\n require(from != address(0), \\\"ERC1155: burn from the zero address\\\");\\n\\n address operator = _msgSender();\\n uint256[] memory ids = _asSingletonArray(id);\\n uint256[] memory amounts = _asSingletonArray(amount);\\n\\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \\\"\\\");\\n\\n uint256 fromBalance = _balances[id][from];\\n require(fromBalance >= amount, \\\"ERC1155: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[id][from] = fromBalance - amount;\\n }\\n\\n emit TransferSingle(operator, from, address(0), id, amount);\\n\\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \\\"\\\");\\n }\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n */\\n function _burnBatch(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual {\\n require(from != address(0), \\\"ERC1155: burn from the zero address\\\");\\n require(ids.length == amounts.length, \\\"ERC1155: ids and amounts length mismatch\\\");\\n\\n address operator = _msgSender();\\n\\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \\\"\\\");\\n\\n for (uint256 i = 0; i < ids.length; i++) {\\n uint256 id = ids[i];\\n uint256 amount = amounts[i];\\n\\n uint256 fromBalance = _balances[id][from];\\n require(fromBalance >= amount, \\\"ERC1155: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[id][from] = fromBalance - amount;\\n }\\n }\\n\\n emit TransferBatch(operator, from, address(0), ids, amounts);\\n\\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \\\"\\\");\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\\n require(owner != operator, \\\"ERC1155: setting approval status for self\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting\\n * and burning, as well as batched variants.\\n *\\n * The same hook is called on both single and batched variants. For single\\n * transfers, the length of the `ids` and `amounts` arrays will be 1.\\n *\\n * Calling conditions (for each `id` and `amount` pair):\\n *\\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * of token type `id` will be transferred to `to`.\\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\\n * for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\\n * will be burned.\\n * - `from` and `to` are never both zero.\\n * - `ids` and `amounts` have the same, non-zero length.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting\\n * and burning, as well as batched variants.\\n *\\n * The same hook is called on both single and batched variants. For single\\n * transfers, the length of the `id` and `amount` arrays will be 1.\\n *\\n * Calling conditions (for each `id` and `amount` pair):\\n *\\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * of token type `id` will be transferred to `to`.\\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\\n * for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\\n * will be burned.\\n * - `from` and `to` are never both zero.\\n * - `ids` and `amounts` have the same, non-zero length.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual {}\\n\\n function _doSafeTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try IERC1155ReceiverUpgradeable(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {\\n if (response != IERC1155ReceiverUpgradeable.onERC1155Received.selector) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non-ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n function _doSafeBatchTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (\\n bytes4 response\\n ) {\\n if (response != IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non-ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {\\n uint256[] memory array = new uint256[](1);\\n array[0] = element;\\n\\n return array;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[47] private __gap;\\n}\\n\",\"keccak256\":\"0xc3e465e1fdd0e491688ad75ef1b946e1680e7f9f78bf5beeefd6daed8693c856\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\ninterface IERC1155ReceiverUpgradeable is IERC165Upgradeable {\\n /**\\n * @dev Handles the receipt of a single ERC1155 token type. This function is\\n * called at the end of a `safeTransferFrom` after the balance has been updated.\\n *\\n * NOTE: To accept the transfer, this must return\\n * `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))`\\n * (i.e. 0xf23a6e61, or its own function selector).\\n *\\n * @param operator The address which initiated the transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param id The ID of the token being transferred\\n * @param value The amount of tokens being transferred\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155Received(\\n address operator,\\n address from,\\n uint256 id,\\n uint256 value,\\n bytes calldata data\\n ) external returns (bytes4);\\n\\n /**\\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\\n * is called at the end of a `safeBatchTransferFrom` after the balances have\\n * been updated.\\n *\\n * NOTE: To accept the transfer(s), this must return\\n * `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))`\\n * (i.e. 0xbc197c81, or its own function selector).\\n *\\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xffcb29612efb57efc8f0d4897deb5abaeac830022c59a3aa17446d698dbc856b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155Upgradeable is IERC165Upgradeable {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xf51f292659a77777c0ed7375a39683d8bee53b86a6e7bd0c76f34ce7aa37a3a8\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/extensions/ERC1155Burnable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1155Upgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Extension of {ERC1155} that allows token holders to destroy both their\\n * own tokens and those that they have been approved to use.\\n *\\n * _Available since v3.1._\\n */\\nabstract contract ERC1155BurnableUpgradeable is Initializable, ERC1155Upgradeable {\\n function __ERC1155Burnable_init() internal onlyInitializing {\\n }\\n\\n function __ERC1155Burnable_init_unchained() internal onlyInitializing {\\n }\\n function burn(address account, uint256 id, uint256 value) public virtual {\\n require(\\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\\n \\\"ERC1155: caller is not token owner or approved\\\"\\n );\\n\\n _burn(account, id, value);\\n }\\n\\n function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {\\n require(\\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\\n \\\"ERC1155: caller is not token owner or approved\\\"\\n );\\n\\n _burnBatch(account, ids, values);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x048a492eee88c80ecc0354486e8e0ab99490b44a6fb28833b3cfb45d573f18d7\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1155Upgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Extension of ERC1155 that adds tracking of total supply per id.\\n *\\n * Useful for scenarios where Fungible and Non-fungible tokens have to be\\n * clearly identified. Note: While a totalSupply of 1 might mean the\\n * corresponding is an NFT, there is no guarantees that no other token with the\\n * same id are not going to be minted.\\n */\\nabstract contract ERC1155SupplyUpgradeable is Initializable, ERC1155Upgradeable {\\n function __ERC1155Supply_init() internal onlyInitializing {\\n }\\n\\n function __ERC1155Supply_init_unchained() internal onlyInitializing {\\n }\\n mapping(uint256 => uint256) private _totalSupply;\\n\\n /**\\n * @dev Total amount of tokens in with a given id.\\n */\\n function totalSupply(uint256 id) public view virtual returns (uint256) {\\n return _totalSupply[id];\\n }\\n\\n /**\\n * @dev Indicates whether any token exist with a given id, or not.\\n */\\n function exists(uint256 id) public view virtual returns (bool) {\\n return ERC1155SupplyUpgradeable.totalSupply(id) > 0;\\n }\\n\\n /**\\n * @dev See {ERC1155-_beforeTokenTransfer}.\\n */\\n function _beforeTokenTransfer(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual override {\\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n if (from == address(0)) {\\n for (uint256 i = 0; i < ids.length; ++i) {\\n _totalSupply[ids[i]] += amounts[i];\\n }\\n }\\n\\n if (to == address(0)) {\\n for (uint256 i = 0; i < ids.length; ++i) {\\n uint256 id = ids[i];\\n uint256 amount = amounts[i];\\n uint256 supply = _totalSupply[id];\\n require(supply >= amount, \\\"ERC1155: burn amount exceeds totalSupply\\\");\\n unchecked {\\n _totalSupply[id] = supply - amount;\\n }\\n }\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xf7bdbcbb9fcf42997f280db8c02070e9c561406e6971ff680c6c43f92065ac9e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155URIStorage.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../ERC1155Upgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev ERC1155 token with storage based token URI management.\\n * Inspired by the ERC721URIStorage extension\\n *\\n * _Available since v4.6._\\n */\\nabstract contract ERC1155URIStorageUpgradeable is Initializable, ERC1155Upgradeable {\\n function __ERC1155URIStorage_init() internal onlyInitializing {\\n __ERC1155URIStorage_init_unchained();\\n }\\n\\n function __ERC1155URIStorage_init_unchained() internal onlyInitializing {\\n _baseURI = \\\"\\\";\\n }\\n using StringsUpgradeable for uint256;\\n\\n // Optional base URI\\n string private _baseURI;\\n\\n // Optional mapping for token URIs\\n mapping(uint256 => string) private _tokenURIs;\\n\\n /**\\n * @dev See {IERC1155MetadataURI-uri}.\\n *\\n * This implementation returns the concatenation of the `_baseURI`\\n * and the token-specific uri if the latter is set\\n *\\n * This enables the following behaviors:\\n *\\n * - if `_tokenURIs[tokenId]` is set, then the result is the concatenation\\n * of `_baseURI` and `_tokenURIs[tokenId]` (keep in mind that `_baseURI`\\n * is empty per default);\\n *\\n * - if `_tokenURIs[tokenId]` is NOT set then we fallback to `super.uri()`\\n * which in most cases will contain `ERC1155._uri`;\\n *\\n * - if `_tokenURIs[tokenId]` is NOT set, and if the parents do not have a\\n * uri value set, then the result is empty.\\n */\\n function uri(uint256 tokenId) public view virtual override returns (string memory) {\\n string memory tokenURI = _tokenURIs[tokenId];\\n\\n // If token URI is set, concatenate base URI and tokenURI (via abi.encodePacked).\\n return bytes(tokenURI).length > 0 ? string(abi.encodePacked(_baseURI, tokenURI)) : super.uri(tokenId);\\n }\\n\\n /**\\n * @dev Sets `tokenURI` as the tokenURI of `tokenId`.\\n */\\n function _setURI(uint256 tokenId, string memory tokenURI) internal virtual {\\n _tokenURIs[tokenId] = tokenURI;\\n emit URI(uri(tokenId), tokenId);\\n }\\n\\n /**\\n * @dev Sets `baseURI` as the `_baseURI` for all tokens\\n */\\n function _setBaseURI(string memory baseURI) internal virtual {\\n _baseURI = baseURI;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[48] private __gap;\\n}\\n\",\"keccak256\":\"0x9a1218747a17239e2fcab2efc14099379387f114c7ad22c69a23b7d67ec0eaa2\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/IERC1155MetadataURIUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC1155Upgradeable.sol\\\";\\n\\n/**\\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155MetadataURIUpgradeable is IERC1155Upgradeable {\\n /**\\n * @dev Returns the URI for token type `id`.\\n *\\n * If the `\\\\{id\\\\}` substring is present in the URI, it must be replaced by\\n * clients with the actual token type ID.\\n */\\n function uri(uint256 id) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xa350df12a8c10e821af05e0863f44e8317a0efa44df27bfd5dc1d63fdfa3c448\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/common/ERC2981.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../interfaces/IERC2981Upgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.\\n *\\n * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for\\n * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.\\n *\\n * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the\\n * fee is specified in basis points by default.\\n *\\n * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See\\n * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to\\n * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.\\n *\\n * _Available since v4.5._\\n */\\nabstract contract ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable {\\n function __ERC2981_init() internal onlyInitializing {\\n }\\n\\n function __ERC2981_init_unchained() internal onlyInitializing {\\n }\\n struct RoyaltyInfo {\\n address receiver;\\n uint96 royaltyFraction;\\n }\\n\\n RoyaltyInfo private _defaultRoyaltyInfo;\\n mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC165Upgradeable) returns (bool) {\\n return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @inheritdoc IERC2981Upgradeable\\n */\\n function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual override returns (address, uint256) {\\n RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId];\\n\\n if (royalty.receiver == address(0)) {\\n royalty = _defaultRoyaltyInfo;\\n }\\n\\n uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator();\\n\\n return (royalty.receiver, royaltyAmount);\\n }\\n\\n /**\\n * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a\\n * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an\\n * override.\\n */\\n function _feeDenominator() internal pure virtual returns (uint96) {\\n return 10000;\\n }\\n\\n /**\\n * @dev Sets the royalty information that all ids in this contract will default to.\\n *\\n * Requirements:\\n *\\n * - `receiver` cannot be the zero address.\\n * - `feeNumerator` cannot be greater than the fee denominator.\\n */\\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\\n require(feeNumerator <= _feeDenominator(), \\\"ERC2981: royalty fee will exceed salePrice\\\");\\n require(receiver != address(0), \\\"ERC2981: invalid receiver\\\");\\n\\n _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);\\n }\\n\\n /**\\n * @dev Removes default royalty information.\\n */\\n function _deleteDefaultRoyalty() internal virtual {\\n delete _defaultRoyaltyInfo;\\n }\\n\\n /**\\n * @dev Sets the royalty information for a specific token id, overriding the global default.\\n *\\n * Requirements:\\n *\\n * - `receiver` cannot be the zero address.\\n * - `feeNumerator` cannot be greater than the fee denominator.\\n */\\n function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {\\n require(feeNumerator <= _feeDenominator(), \\\"ERC2981: royalty fee will exceed salePrice\\\");\\n require(receiver != address(0), \\\"ERC2981: Invalid parameters\\\");\\n\\n _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);\\n }\\n\\n /**\\n * @dev Resets royalty information for the token id back to the global default.\\n */\\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\\n delete _tokenRoyaltyInfo[tokenId];\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[48] private __gap;\\n}\\n\",\"keccak256\":\"0xaffa1f1de8169c3915df40f96e6fe67628aed4d496c6a835e55763dbd0c28f6f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary MathUpgradeable {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/Catalyst.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport {ERC1155Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol\\\";\\nimport {\\n AccessControlUpgradeable,\\n ContextUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\\\";\\nimport {\\n ERC1155BurnableUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol\\\";\\nimport {\\n ERC1155SupplyUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol\\\";\\nimport {\\n ERC1155URIStorageUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol\\\";\\nimport {\\n IERC165Upgradeable,\\n ERC2981Upgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {\\n OperatorFiltererUpgradeable,\\n IOperatorFilterRegistry\\n} from \\\"@sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol\\\";\\nimport {\\n RoyaltyDistributor\\n} from \\\"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyDistributor.sol\\\";\\nimport {\\n IRoyaltyManager\\n} from \\\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyManager.sol\\\";\\nimport {IERC2981Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\\\";\\nimport {ERC2771Handler} from \\\"./ERC2771Handler.sol\\\";\\nimport {ICatalyst} from \\\"./interfaces/ICatalyst.sol\\\";\\n\\n/// @title Catalyst\\n/// @author The Sandbox\\n/// @notice THis contract manages catalysts which are used to mint new assets.\\n/// @dev An ERC1155 contract that manages catalysts, extends multiple OpenZeppelin contracts to\\n/// provide a variety of features including, AccessControl, URIStorage, Burnable and more.\\n/// The contract includes support for meta transactions.\\ncontract Catalyst is\\n ICatalyst,\\n Initializable,\\n ERC1155Upgradeable,\\n ERC1155BurnableUpgradeable,\\n ERC1155SupplyUpgradeable,\\n ERC1155URIStorageUpgradeable,\\n ERC2771Handler,\\n AccessControlUpgradeable,\\n OperatorFiltererUpgradeable,\\n RoyaltyDistributor\\n{\\n bytes32 public constant MINTER_ROLE = keccak256(\\\"MINTER_ROLE\\\");\\n bytes32 public constant BURNER_ROLE = keccak256(\\\"BURNER_ROLE\\\");\\n\\n uint256 public highestTierIndex;\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor() {\\n _disableInitializers();\\n }\\n\\n modifier onlyValidId(uint256 tokenId) {\\n require(tokenId > 0 && tokenId <= highestTierIndex, \\\"Catalyst: invalid catalyst id\\\");\\n _;\\n }\\n\\n /// @notice Initialize the contract, setting up initial values for various features.\\n /// @param _baseUri The base URI for the token metadata, most likely set to ipfs://.\\n /// @param _trustedForwarder The trusted forwarder for meta transactions.\\n /// @param _subscription The subscription address.\\n /// @param _defaultAdmin The default admin address.\\n /// @param _defaultMinter The default minter address.\\n /// @param _catalystIpfsCID The IPFS content identifiers for each catalyst.\\n /// @param _royaltyManager, the address of the Manager contract for common royalty recipient\\n function initialize(\\n string memory _baseUri,\\n address _trustedForwarder,\\n address _subscription,\\n address _defaultAdmin,\\n address _defaultMinter,\\n string[] memory _catalystIpfsCID,\\n address _royaltyManager\\n ) public initializer {\\n require(bytes(_baseUri).length != 0, \\\"Catalyst: base uri can't be empty\\\");\\n require(_trustedForwarder != address(0), \\\"Catalyst: trusted forwarder can't be zero\\\");\\n require(_subscription != address(0), \\\"Catalyst: subscription can't be zero\\\");\\n require(_defaultAdmin != address(0), \\\"Catalyst: admin can't be zero\\\");\\n require(_defaultMinter != address(0), \\\"Catalyst: minter can't be zero\\\");\\n require(_royaltyManager != address(0), \\\"Catalyst: royalty manager can't be zero\\\");\\n __ERC1155_init(_baseUri);\\n __AccessControl_init();\\n __ERC1155Burnable_init();\\n __ERC1155Supply_init();\\n __ERC1155URIStorage_init();\\n __ERC2771Handler_initialize(_trustedForwarder);\\n __OperatorFilterer_init(_subscription, true);\\n _setBaseURI(_baseUri);\\n _grantRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);\\n _grantRole(MINTER_ROLE, _defaultMinter);\\n __RoyaltyDistributor_init(_royaltyManager);\\n for (uint256 i = 0; i < _catalystIpfsCID.length; i++) {\\n require(bytes(_catalystIpfsCID[i]).length != 0, \\\"Catalyst: CID can't be empty\\\");\\n _setURI(i, _catalystIpfsCID[i]);\\n highestTierIndex = i;\\n }\\n }\\n\\n /// @notice Mints a new token, limited to MINTER_ROLE only\\n /// @param to The address that will own the minted token\\n /// @param id The token id to mint\\n /// @param amount The amount to be minted\\n function mint(\\n address to,\\n uint256 id,\\n uint256 amount\\n ) external onlyRole(MINTER_ROLE) onlyValidId(id) {\\n _mint(to, id, amount, \\\"\\\");\\n }\\n\\n /// @notice Mints a batch of tokens, limited to MINTER_ROLE only\\n /// @param to The address that will own the minted tokens\\n /// @param ids The token ids to mint\\n /// @param amounts The amounts to be minted per token id\\n function mintBatch(\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external onlyRole(MINTER_ROLE) {\\n for (uint256 i = 0; i < ids.length; i++) {\\n require(ids[i] > 0 && ids[i] <= highestTierIndex, \\\"Catalyst: invalid catalyst id\\\");\\n }\\n _mintBatch(to, ids, amounts, \\\"\\\");\\n }\\n\\n /// @notice Burns a specified amount of tokens from a specific address\\n /// @param account The address to burn from\\n /// @param id The token id to burn\\n /// @param amount The amount to be burned\\n function burnFrom(\\n address account,\\n uint256 id,\\n uint256 amount\\n ) external onlyRole(BURNER_ROLE) {\\n _burn(account, id, amount);\\n }\\n\\n /// @notice Burns a batch of tokens from a specific address\\n /// @param account The address to burn from\\n /// @param ids The token ids to burn\\n /// @param amounts The amounts to be burned\\n function burnBatchFrom(\\n address account,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external onlyRole(BURNER_ROLE) {\\n _burnBatch(account, ids, amounts);\\n }\\n\\n /// @notice Add a new catalyst type, limited to DEFAULT_ADMIN_ROLE only\\n /// @param ipfsCID The royalty bps for the catalyst\\n function addNewCatalystType(string memory ipfsCID) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n require(bytes(ipfsCID).length != 0, \\\"Catalyst: CID can't be empty\\\");\\n uint256 newCatId = ++highestTierIndex;\\n ERC1155URIStorageUpgradeable._setURI(newCatId, ipfsCID);\\n emit NewCatalystTypeAdded(newCatId);\\n }\\n\\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\\n /// @dev Change the address of the trusted forwarder for meta-TX\\n /// @param trustedForwarder The new trustedForwarder\\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n require(trustedForwarder != address(0), \\\"Catalyst: trusted forwarder can't be zero address\\\");\\n _trustedForwarder = trustedForwarder;\\n emit TrustedForwarderChanged(trustedForwarder);\\n }\\n\\n /// @notice Set a new URI for specific tokenid\\n /// @param tokenId The token id to set URI for\\n /// @param metadataHash The new URI\\n function setMetadataHash(uint256 tokenId, string memory metadataHash)\\n external\\n onlyRole(DEFAULT_ADMIN_ROLE)\\n onlyValidId(tokenId)\\n {\\n require(bytes(metadataHash).length != 0, \\\"Catalyst: metadataHash can't be empty\\\");\\n _setURI(tokenId, metadataHash);\\n }\\n\\n /// @notice Set a new base URI\\n /// @param baseURI The new base URI\\n function setBaseURI(string memory baseURI) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n require(bytes(baseURI).length != 0, \\\"Catalyst: base uri can't be empty\\\");\\n _setBaseURI(baseURI);\\n }\\n\\n /// @notice returns full token URI, including baseURI and token metadata URI\\n /// @param tokenId The token id to get URI for\\n /// @return tokenURI the URI of the token\\n function uri(uint256 tokenId)\\n public\\n view\\n override(ERC1155Upgradeable, ERC1155URIStorageUpgradeable)\\n returns (string memory)\\n {\\n return ERC1155URIStorageUpgradeable.uri(tokenId);\\n }\\n\\n /// @dev Needed for meta transactions (see EIP-2771)\\n function _msgSender() internal view virtual override(ContextUpgradeable, ERC2771Handler) returns (address) {\\n return ERC2771Handler._msgSender();\\n }\\n\\n /// @dev Needed for meta transactions (see EIP-2771)\\n function _msgData() internal view virtual override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {\\n return ERC2771Handler._msgData();\\n }\\n\\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\\n /// @param from address from which tokens are transfered.\\n /// @param to address to which the token will be transfered.\\n /// @param id the token type transfered.\\n /// @param value amount of token transfered.\\n /// @param data aditional data accompanying the transfer.\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 value,\\n bytes memory data\\n ) public override onlyAllowedOperator(from) {\\n super._safeTransferFrom(from, to, id, value, data);\\n }\\n\\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\\n /// @dev call data should be optimized to order ids so packedBalance can be used efficiently.\\n /// @param from address from which tokens are transfered.\\n /// @param to address to which the token will be transfered.\\n /// @param ids ids of each token type transfered.\\n /// @param values amount of each token type transfered.\\n /// @param data aditional data accompanying the transfer.\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory values,\\n bytes memory data\\n ) public override onlyAllowedOperator(from) {\\n super._safeBatchTransferFrom(from, to, ids, values, data);\\n }\\n\\n /// @notice Enable or disable approval for `operator` to manage all of the caller's tokens.\\n /// @param operator address which will be granted rights to transfer all tokens of the caller.\\n /// @param approved whether to approve or revoke\\n function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {\\n super._setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n function _beforeTokenTransfer(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) {\\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\\n }\\n\\n /// @notice Query if a contract implements interface `id`.\\n /// @param interfaceId the interface identifier, as specified in ERC-165.\\n /// @return `true` if the contract implements `interfaceId`.\\n function supportsInterface(bytes4 interfaceId)\\n public\\n view\\n override(ERC1155Upgradeable, AccessControlUpgradeable, RoyaltyDistributor)\\n returns (bool)\\n {\\n return\\n interfaceId == 0x572b6c05 || // ERC2771\\n super.supportsInterface(interfaceId);\\n }\\n}\\n\",\"keccak256\":\"0x460e96642870db34ecb5958d3a234a82dc200d51530df90deb91e3a473789ade\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/ERC2771Handler.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\n/// @dev minimal ERC2771 handler to keep bytecode-size down\\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.6.0/contracts/metatx/ERC2771Context.sol\\n/// with an initializer for proxies and a mutable forwarder\\n\\nabstract contract ERC2771Handler {\\n address internal _trustedForwarder;\\n\\n function __ERC2771Handler_initialize(address forwarder) internal {\\n _trustedForwarder = forwarder;\\n }\\n\\n function isTrustedForwarder(address forwarder) public view returns (bool) {\\n return forwarder == _trustedForwarder;\\n }\\n\\n function getTrustedForwarder() external view returns (address trustedForwarder) {\\n return _trustedForwarder;\\n }\\n\\n function _msgSender() internal view virtual returns (address sender) {\\n if (isTrustedForwarder(msg.sender)) {\\n // The assembly code is more direct than the Solidity version using `abi.decode`.\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\\n }\\n } else {\\n return msg.sender;\\n }\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n if (isTrustedForwarder(msg.sender)) {\\n return msg.data[:msg.data.length - 20];\\n } else {\\n return msg.data;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb14f384116bdc60b5fc789de2280bccee214c967416cee1b30fb03e0ce4442d5\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/interfaces/ICatalyst.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface ICatalyst {\\n enum CatalystType {TSB_EXCLUSIVE, COMMON, UNCOMMON, RARE, EPIC, LEGENDARY, MYTHIC}\\n\\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\\n event NewCatalystTypeAdded(uint256 catalystId);\\n event DefaultRoyaltyChanged(address indexed newDefaultRoyaltyRecipient, uint256 newDefaultRoyaltyAmount);\\n\\n /// @notice Mints a new token, limited to MINTER_ROLE only\\n /// @param to The address that will own the minted token\\n /// @param id The token id to mint\\n /// @param amount The amount to be minted\\n function mint(\\n address to,\\n uint256 id,\\n uint256 amount\\n ) external;\\n\\n /// @notice Mints a batch of tokens, limited to MINTER_ROLE only\\n /// @param to The address that will own the minted tokens\\n /// @param ids The token ids to mint\\n /// @param amounts The amounts to be minted per token id\\n function mintBatch(\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external;\\n\\n /// @notice Burns a specified amount of tokens from a specific address\\n /// @param account The address to burn from\\n /// @param id The token id to burn\\n /// @param amount The amount to be burned\\n function burnFrom(\\n address account,\\n uint256 id,\\n uint256 amount\\n ) external;\\n\\n /// @notice Burns a batch of tokens from a specific address\\n /// @param account The address to burn from\\n /// @param ids The token ids to burn\\n /// @param amounts The amounts to be burned\\n function burnBatchFrom(\\n address account,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external;\\n\\n /// @notice Add a new catalyst type, limited to DEFAULT_ADMIN_ROLE only\\n /// @param ipfsCID The royalty bps for the catalyst\\n function addNewCatalystType(string memory ipfsCID) external;\\n\\n /// @notice Set a new URI for specific tokenid\\n /// @param tokenId The token id to set URI for\\n /// @param metadataHash The new URI\\n function setMetadataHash(uint256 tokenId, string memory metadataHash) external;\\n\\n /// @notice Set a new base URI\\n /// @param baseURI The new base URI\\n function setBaseURI(string memory baseURI) external;\\n}\\n\",\"keccak256\":\"0x5490f773ea2894927b789486457e4a25cb19508931846469927eb22e22a6a5f8\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {IOperatorFilterRegistry} from \\\"./interfaces/IOperatorFilterRegistry.sol\\\";\\n\\n///@title OperatorFiltererUpgradeable\\n///@author The SandBox\\n///@notice This contract would subscibe or copy or just to the subscription provided or just register to default subscription list. The operator filter registry's addess could be set using a setter which could be implemented in inherting contract\\nabstract contract OperatorFiltererUpgradeable is Initializable {\\n IOperatorFilterRegistry public operatorFilterRegistry;\\n\\n function __OperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe) internal onlyInitializing {\\n operatorFilterRegistry = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); // Address of the operator filterer registry\\n // If an inheriting token contract is deployed to a network without the registry deployed, the modifier\\n // will not revert, but the contract will need to be registered with the registry once it is deployed in\\n // order for the modifier to filter addresses.\\n if (address(operatorFilterRegistry).code.length > 0) {\\n if (!operatorFilterRegistry.isRegistered(address(this))) {\\n if (subscribe) {\\n operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);\\n } else {\\n if (subscriptionOrRegistrantToCopy != address(0)) {\\n operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);\\n } else {\\n operatorFilterRegistry.register(address(this));\\n }\\n }\\n }\\n }\\n }\\n\\n modifier onlyAllowedOperator(address from) virtual {\\n // Check registry code length to facilitate testing in environments without a deployed registry.\\n if (address(operatorFilterRegistry).code.length > 0) {\\n // Allow spending tokens from addresses with balance\\n // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred\\n // from an EOA.\\n if (from == msg.sender) {\\n _;\\n return;\\n }\\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), msg.sender)) {\\n revert(\\\"Operator Not Allowed\\\");\\n }\\n }\\n _;\\n }\\n\\n modifier onlyAllowedOperatorApproval(address operator) virtual {\\n // Check registry code length to facilitate testing in environments without a deployed registry.\\n if (address(operatorFilterRegistry).code.length > 0) {\\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), operator)) {\\n revert(\\\"Operator Not Allowed\\\");\\n }\\n }\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x388dcb899fb3e49bddb5c9fc07db9bdb54584bee4dcf06bf0a6f71bce6f8ea91\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-operator-filter/contracts/interfaces/IOperatorFilterRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IOperatorFilterRegistry {\\n /**\\n * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns\\n * true if supplied registrant address is not registered.\\n */\\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\\n\\n /**\\n * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.\\n */\\n function register(address registrant) external;\\n\\n /**\\n * @notice Registers an address with the registry and \\\"subscribes\\\" to another address's filtered operators and codeHashes.\\n */\\n function registerAndSubscribe(address registrant, address subscription) external;\\n\\n /**\\n * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another\\n * address without subscribing.\\n */\\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\\n\\n /**\\n * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.\\n * Note that this does not remove any filtered addresses or codeHashes.\\n * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.\\n */\\n function unregister(address addr) external;\\n\\n /**\\n * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered.\\n */\\n function updateOperator(\\n address registrant,\\n address operator,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.\\n */\\n function updateOperators(\\n address registrant,\\n address[] calldata operators,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.\\n */\\n function updateCodeHash(\\n address registrant,\\n bytes32 codehash,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.\\n */\\n function updateCodeHashes(\\n address registrant,\\n bytes32[] calldata codeHashes,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous\\n * subscription if present.\\n * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,\\n * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be\\n * used.\\n */\\n function subscribe(address registrant, address registrantToSubscribe) external;\\n\\n /**\\n * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.\\n */\\n function unsubscribe(address registrant, bool copyExistingEntries) external;\\n\\n /**\\n * @notice Get the subscription address of a given registrant, if any.\\n */\\n function subscriptionOf(address addr) external returns (address registrant);\\n\\n /**\\n * @notice Get the set of addresses subscribed to a given registrant.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function subscribers(address registrant) external returns (address[] memory);\\n\\n /**\\n * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function subscriberAt(address registrant, uint256 index) external returns (address);\\n\\n /**\\n * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.\\n */\\n function copyEntriesOf(address registrant, address registrantToCopy) external;\\n\\n /**\\n * @notice Returns true if operator is filtered by a given address or its subscription.\\n */\\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\\n\\n /**\\n * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription.\\n */\\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\\n\\n /**\\n * @notice Returns true if a codeHash is filtered by a given address or its subscription.\\n */\\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\\n\\n /**\\n * @notice Returns a list of filtered operators for a given address or its subscription.\\n */\\n function filteredOperators(address addr) external returns (address[] memory);\\n\\n /**\\n * @notice Returns the set of filtered codeHashes for a given address or its subscription.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\\n\\n /**\\n * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or\\n * its subscription.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\\n\\n /**\\n * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or\\n * its subscription.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\\n\\n /**\\n * @notice Returns true if an address has registered\\n */\\n function isRegistered(address addr) external returns (bool);\\n\\n /**\\n * @dev Convenience method to compute the code hash of an arbitrary contract\\n */\\n function codeHashOf(address addr) external returns (bytes32);\\n}\\n\",\"keccak256\":\"0xbb4f80a4688ec5c4057fcf1e93d1683cee27bbc2eb9ba45fe02664057a4a14c6\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {IERC2981Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\\\";\\nimport {IRoyaltyManager} from \\\"./interfaces/IRoyaltyManager.sol\\\";\\n\\ncontract RoyaltyDistributor is IERC2981Upgradeable {\\n uint16 internal constant TOTAL_BASIS_POINTS = 10000;\\n IRoyaltyManager public royaltyManager;\\n\\n function __RoyaltyDistributor_init(address _royaltyManager) internal {\\n royaltyManager = IRoyaltyManager(_royaltyManager);\\n }\\n\\n /// @notice Returns how much royalty is owed and to whom based on ERC2981\\n /// @dev tokenId is one of the EIP2981 args for this function can't be removed\\n /// @param _salePrice the price of token on which the royalty is calculated\\n /// @return receiver the receiver of royalty\\n /// @return royaltyAmount the amount of royalty\\n function royaltyInfo(\\n uint256, /*_tokenId */\\n uint256 _salePrice\\n ) external view returns (address receiver, uint256 royaltyAmount) {\\n uint16 royaltyBps;\\n (receiver, royaltyBps) = royaltyManager.getRoyaltyInfo();\\n royaltyAmount = (_salePrice * royaltyBps) / TOTAL_BASIS_POINTS;\\n return (receiver, royaltyAmount);\\n }\\n\\n /// @notice Query if a contract implements interface `id`.\\n /// @param interfaceId the interface identifier, as specified in ERC-165.\\n /// @return `true` if the contract implements `id`.\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC2981Upgradeable).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xb9704440b2f9d4ff07efd69bf924e4bed7ac7e6ea3b803b11beef3911b95ad5a\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {Recipient} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\n\\ninterface IRoyaltyManager {\\n event RecipientSet(address commonRecipient);\\n\\n event SplitSet(uint16 commonSplit);\\n\\n event RoyaltySet(uint16 royaltyBps, address contractAddress);\\n\\n function setRecipient(address payable _commonRecipient) external;\\n\\n function setSplit(uint16 commonSplit) external;\\n\\n function getCommonRecipient() external view returns (Recipient memory recipient);\\n\\n function getCreatorSplit() external view returns (uint16);\\n\\n function getRoyaltyInfo() external view returns (address, uint16);\\n\\n function deploySplitter(address creator, address payable recipient) external returns (address payable);\\n\\n function getCreatorRoyaltySplitter(address creator) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x095c8e09d23bdffd2ca759f153cfc7a5e8d20dc099f41acac67357e933455646\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e3565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61430280620000f36000396000f3fe608060405234801561001057600080fd5b50600436106102405760003560e01c8063572b6c0511610145578063d5391393116100bd578063e985e9c51161008c578063f242432a11610071578063f242432a146105bd578063f3bdecc1146105d0578063f5298aca146105e357600080fd5b8063e985e9c51461056d578063ee295d62146105a957600080fd5b8063d53913931461050d578063d547741f14610534578063d81d0a1514610547578063da7422281461055a57600080fd5b8063a217fddf11610114578063b0ccc31e116100f9578063b0ccc31e146104af578063bd85b039146104db578063ce1b815f146104fb57600080fd5b8063a217fddf14610494578063a22cb4651461049c57600080fd5b8063572b6c051461041a5780636b20c4541461043d57806371e0276c1461045057806391d148541461045a57600080fd5b8063282c51f3116101d857806336568abe116101a75780634f558e791161018c5780634f558e79146103d2578063512c97e9146103f457806355f804b31461040757600080fd5b806336568abe1461039f5780634e1273f4146103b257600080fd5b8063282c51f3146103205780632a55205a146103475780632eb2c2d6146103795780632f2ff15d1461038c57600080fd5b8063156e29f611610214578063156e29f6146102c35780631a87b277146102d657806320820ec3146102e9578063248a9ca3146102fc57600080fd5b8062fdd58e1461024557806301ffc9a71461026b5780630e89341c1461028e578063124d91e5146102ae575b600080fd5b610258610253366004613638565b6105f6565b6040519081526020015b60405180910390f35b61027e610279366004613692565b6106a4565b6040519015158152602001610262565b6102a161029c3660046136af565b61073b565b6040516102629190613718565b6102c16102bc36600461372b565b610746565b005b6102c16102d136600461372b565b610781565b6102c16102e4366004613817565b61082d565b6102c16102f73660046138e9565b6108e4565b61025861030a3660046136af565b600090815261012e602052604090206001015490565b6102587f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84881565b61035a61035536600461395f565b610919565b604080516001600160a01b039093168352602083019190915201610262565b6102c1610387366004613981565b6109bf565b6102c161039a366004613a2f565b610aca565b6102c16103ad366004613a2f565b610af5565b6103c56103c0366004613a5f565b610b91565b6040516102629190613b5d565b61027e6103e03660046136af565b600090815260c96020526040902054151590565b6102c1610402366004613b70565b610ccf565b6102c1610415366004613817565b610dbb565b61027e610428366004613bad565b61012d546001600160a01b0391821691161490565b6102c161044b3660046138e9565b610e46565b6102586101625481565b61027e610468366004613a2f565b600091825261012e602090815260408084206001600160a01b0393909316845291905290205460ff1690565b610258600081565b6102c16104aa366004613bd8565b610ef1565b610160546104c3906001600160a01b031681565b6040516001600160a01b039091168152602001610262565b6102586104e93660046136af565b600090815260c9602052604090205490565b61012d546001600160a01b03166104c3565b6102587f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6102c1610542366004613a2f565b610fd9565b6102c16105553660046138e9565b610fff565b6102c1610568366004613bad565b6110f4565b61027e61057b366004613c06565b6001600160a01b03918216600090815260666020908152604080832093909416825291909152205460ff1690565b610161546104c3906001600160a01b031681565b6102c16105cb366004613c34565b6111d4565b6102c16105de366004613c9d565b6112d2565b6102c16105f136600461372b565b6117fd565b60006001600160a01b0383166106795760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201527f616c6964206f776e65720000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b5060008181526065602090815260408083206001600160a01b03861684529091529020545b92915050565b60007f572b6c05000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316148061069e57507f2a55205a000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461069e565b606061069e826118a8565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84861077081611988565b61077b84848461199c565b50505050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a66107ab81611988565b826000811180156107bf5750610162548111155b61080b5760405162461bcd60e51b815260206004820152601d60248201527f436174616c7973743a20696e76616c696420636174616c7973742069640000006044820152606401610670565b61082685858560405180602001604052806000815250611b73565b5050505050565b600061083881611988565b81516000036108895760405162461bcd60e51b815260206004820152601c60248201527f436174616c7973743a204349442063616e277420626520656d707479000000006044820152606401610670565b60006101626000815461089b90613def565b918290555090506108ac8184611cb6565b6040518181527f0fc221b41b73e1c4f9d65566cf090e650d0246fb5c0434a32e9b313a39636d169060200160405180910390a1505050565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84861090e81611988565b61077b848484611d13565b600080600061016160009054906101000a90046001600160a01b03166001600160a01b031663a86a28d16040518163ffffffff1660e01b81526004016040805180830381865afa158015610971573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109959190613e09565b90935090506127106109ab61ffff831686613e3f565b6109b59190613e56565b9150509250929050565b6101605485906001600160a01b03163b15610ab557336001600160a01b038216036109f6576109f18686868686611fa5565b610ac2565b61016054604051633185c44d60e21b81523060048201523360248201526001600160a01b039091169063c617113490604401602060405180830381865afa158015610a45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a699190613e78565b610ab55760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f7765640000000000000000000000006044820152606401610670565b610ac28686868686611fa5565b505050505050565b600082815261012e6020526040902060010154610ae681611988565b610af08383612242565b505050565b610afd6122e7565b6001600160a01b0316816001600160a01b031614610b835760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610670565b610b8d82826122f6565b5050565b60608151835114610c0a5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d6174636800000000000000000000000000000000000000000000006064820152608401610670565b6000835167ffffffffffffffff811115610c2657610c26613760565b604051908082528060200260200182016040528015610c4f578160200160208202803683370190505b50905060005b8451811015610cc757610c9a858281518110610c7357610c73613e95565b6020026020010151858381518110610c8d57610c8d613e95565b60200260200101516105f6565b828281518110610cac57610cac613e95565b6020908102919091010152610cc081613def565b9050610c55565b509392505050565b6000610cda81611988565b82600081118015610cee5750610162548111155b610d3a5760405162461bcd60e51b815260206004820152601d60248201527f436174616c7973743a20696e76616c696420636174616c7973742069640000006044820152606401610670565b8251600003610db15760405162461bcd60e51b815260206004820152602560248201527f436174616c7973743a206d65746164617461486173682063616e27742062652060448201527f656d7074790000000000000000000000000000000000000000000000000000006064820152608401610670565b61077b8484611cb6565b6000610dc681611988565b8151600003610e3d5760405162461bcd60e51b815260206004820152602160248201527f436174616c7973743a2062617365207572692063616e277420626520656d707460448201527f79000000000000000000000000000000000000000000000000000000000000006064820152608401610670565b610b8d82612399565b610e4e6122e7565b6001600160a01b0316836001600160a01b03161480610e745750610e748361057b6122e7565b610ee65760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206f7220617070726f7665640000000000000000000000000000000000006064820152608401610670565b610af0838383611d13565b6101605482906001600160a01b03163b15610fc75761016054604051633185c44d60e21b81523060048201526001600160a01b0383811660248301529091169063c617113490604401602060405180830381865afa158015610f57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7b9190613e78565b610fc75760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f7765640000000000000000000000006044820152606401610670565b610af0610fd26122e7565b84846123a5565b600082815261012e6020526040902060010154610ff581611988565b610af083836122f6565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661102981611988565b60005b83518110156110d857600084828151811061104957611049613e95565b602002602001015111801561107a57506101625484828151811061106f5761106f613e95565b602002602001015111155b6110c65760405162461bcd60e51b815260206004820152601d60248201527f436174616c7973743a20696e76616c696420636174616c7973742069640000006044820152606401610670565b806110d081613def565b91505061102c565b5061077b84848460405180602001604052806000815250612499565b60006110ff81611988565b6001600160a01b03821661117b5760405162461bcd60e51b815260206004820152603160248201527f436174616c7973743a207472757374656420666f727761726465722063616e2760448201527f74206265207a65726f20616464726573730000000000000000000000000000006064820152608401610670565b61012d805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091556040517f871264f4293af7d2865ae7eae628b228f4991c57cb45b39c99f0b774ebe2901890600090a25050565b6101605485906001600160a01b03163b156112c557336001600160a01b03821603611206576109f18686868686612696565b61016054604051633185c44d60e21b81523060048201523360248201526001600160a01b039091169063c617113490604401602060405180830381865afa158015611255573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112799190613e78565b6112c55760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f7765640000000000000000000000006044820152606401610670565b610ac28686868686612696565b600054610100900460ff16158080156112f25750600054600160ff909116105b8061130c5750303b15801561130c575060005460ff166001145b61137e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610670565b6000805460ff1916600117905580156113a1576000805461ff0019166101001790555b87516000036114185760405162461bcd60e51b815260206004820152602160248201527f436174616c7973743a2062617365207572692063616e277420626520656d707460448201527f79000000000000000000000000000000000000000000000000000000000000006064820152608401610670565b6001600160a01b0387166114945760405162461bcd60e51b815260206004820152602960248201527f436174616c7973743a207472757374656420666f727761726465722063616e2760448201527f74206265207a65726f00000000000000000000000000000000000000000000006064820152608401610670565b6001600160a01b03861661150f5760405162461bcd60e51b8152602060048201526024808201527f436174616c7973743a20737562736372697074696f6e2063616e27742062652060448201527f7a65726f000000000000000000000000000000000000000000000000000000006064820152608401610670565b6001600160a01b0385166115655760405162461bcd60e51b815260206004820152601d60248201527f436174616c7973743a2061646d696e2063616e2774206265207a65726f0000006044820152606401610670565b6001600160a01b0384166115bb5760405162461bcd60e51b815260206004820152601e60248201527f436174616c7973743a206d696e7465722063616e2774206265207a65726f00006044820152606401610670565b6001600160a01b0382166116375760405162461bcd60e51b815260206004820152602760248201527f436174616c7973743a20726f79616c7479206d616e616765722063616e27742060448201527f6265207a65726f000000000000000000000000000000000000000000000000006064820152608401610670565b61164088612889565b6116486128fd565b6116506128fd565b6116586128fd565b61166061296a565b61012d805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0389161790556116948660016129dd565b61169d88612399565b6116a8600086612242565b6116d27f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a685612242565b610161805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03841617905560005b83518110156117ac5783818151811061171957611719613e95565b6020026020010151516000036117715760405162461bcd60e51b815260206004820152601c60248201527f436174616c7973743a204349442063616e277420626520656d707479000000006044820152606401610670565b6117948185838151811061178757611787613e95565b6020026020010151611cb6565b610162819055806117a481613def565b9150506116fe565b5080156117f3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b6118056122e7565b6001600160a01b0316836001600160a01b0316148061182b575061182b8361057b6122e7565b61189d5760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206f7220617070726f7665640000000000000000000000000000000000006064820152608401610670565b610af083838361199c565b600081815260fc60205260408120805460609291906118c690613eab565b80601f01602080910402602001604051908101604052809291908181526020018280546118f290613eab565b801561193f5780601f106119145761010080835404028352916020019161193f565b820191906000526020600020905b81548152906001019060200180831161192257829003601f168201915b50505050509050600081511161195d5761195883612c38565b611981565b60fb81604051602001611971929190613ee5565b6040516020818303038152906040525b9392505050565b611999816119946122e7565b612ccc565b50565b6001600160a01b038316611a185760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610670565b6000611a226122e7565b90506000611a2f84612d42565b90506000611a3c84612d42565b9050611a5c83876000858560405180602001604052806000815250612d8d565b60008581526065602090815260408083206001600160a01b038a16845290915290205484811015611af45760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e6365000000000000000000000000000000000000000000000000000000006064820152608401610670565b60008681526065602090815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46040805160208101909152600090525b50505050505050565b6001600160a01b038416611bef5760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610670565b6000611bf96122e7565b90506000611c0685612d42565b90506000611c1385612d42565b9050611c2483600089858589612d8d565b60008681526065602090815260408083206001600160a01b038b16845290915281208054879290611c56908490613f6c565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611b6a83600089898989612d9b565b600082815260fc60205260409020611cce8282613fc5565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b611cfa8461073b565b604051611d079190613718565b60405180910390a25050565b6001600160a01b038316611d8f5760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610670565b8051825114611df15760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608401610670565b6000611dfb6122e7565b9050611e1b81856000868660405180602001604052806000815250612d8d565b60005b8351811015611f38576000848281518110611e3b57611e3b613e95565b602002602001015190506000848381518110611e5957611e59613e95565b60209081029190910181015160008481526065835260408082206001600160a01b038c168352909352919091205490915081811015611eff5760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e6365000000000000000000000000000000000000000000000000000000006064820152608401610670565b60009283526065602090815260408085206001600160a01b038b1686529091529092209103905580611f3081613def565b915050611e1e565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051611f89929190614085565b60405180910390a460408051602081019091526000905261077b565b81518351146120075760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608401610670565b6001600160a01b0384166120835760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610670565b600061208d6122e7565b905061209d818787878787612d8d565b60005b84518110156121dc5760008582815181106120bd576120bd613e95565b6020026020010151905060008583815181106120db576120db613e95565b60209081029190910181015160008481526065835260408082206001600160a01b038e1683529093529190912054909150818110156121825760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e73666572000000000000000000000000000000000000000000006064820152608401610670565b60008381526065602090815260408083206001600160a01b038e8116855292528083208585039055908b168252812080548492906121c1908490613f6c565b92505081905550505050806121d590613def565b90506120a0565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161222c929190614085565b60405180910390a4610ac2818787878787612f9f565b600082815261012e602090815260408083206001600160a01b038516845290915290205460ff16610b8d57600082815261012e602090815260408083206001600160a01b03851684529091529020805460ff191660011790556122a36122e7565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006122f16130fa565b905090565b600082815261012e602090815260408083206001600160a01b038516845290915290205460ff1615610b8d57600082815261012e602090815260408083206001600160a01b03851684529091529020805460ff191690556123556122e7565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b60fb610b8d8282613fc5565b816001600160a01b0316836001600160a01b03160361242c5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c6600000000000000000000000000000000000000000000006064820152608401610670565b6001600160a01b03838116600081815260666020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0384166125155760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610670565b81518351146125775760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608401610670565b60006125816122e7565b905061259281600087878787612d8d565b60005b845181101561262e578381815181106125b0576125b0613e95565b6020026020010151606560008784815181106125ce576125ce613e95565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b0316815260200190815260200160002060008282546126169190613f6c565b9091555081905061262681613def565b915050612595565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161267f929190614085565b60405180910390a461082681600087878787612f9f565b6001600160a01b0384166127125760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610670565b600061271c6122e7565b9050600061272985612d42565b9050600061273685612d42565b9050612746838989858589612d8d565b60008681526065602090815260408083206001600160a01b038c168452909152902054858110156127df5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e73666572000000000000000000000000000000000000000000006064820152608401610670565b60008781526065602090815260408083206001600160a01b038d8116855292528083208985039055908a1682528120805488929061281e908490613f6c565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461287e848a8a8a8a8a612d9b565b505050505050505050565b600054610100900460ff166128f45760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610670565b61199981613143565b600054610100900460ff166129685760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610670565b565b600054610100900460ff166129d55760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610670565b6129686131b7565b600054610100900460ff16612a485760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610670565b610160805473ffffffffffffffffffffffffffffffffffffffff19166daaeb6d7670e522a718067333cd4e9081179091553b15610b8d57610160546040517fc3c5a5470000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b039091169063c3c5a547906024016020604051808303816000875af1158015612ae3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b079190613e78565b610b8d578015612b8d57610160546040517f7d3e3dbe0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03848116602483015290911690637d3e3dbe906044015b600060405180830381600087803b158015612b7957600080fd5b505af1158015610ac2573d6000803e3d6000fd5b6001600160a01b03821615612bee57610160546040517fa0af29030000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0384811660248301529091169063a0af290390604401612b5f565b610160546040517f4420e4860000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0390911690634420e48690602401612b5f565b606060678054612c4790613eab565b80601f0160208091040260200160405190810160405280929190818152602001828054612c7390613eab565b8015612cc05780601f10612c9557610100808354040283529160200191612cc0565b820191906000526020600020905b815481529060010190602001808311612ca357829003601f168201915b50505050509050919050565b600082815261012e602090815260408083206001600160a01b038516845290915290205460ff16610b8d57612d008161323e565b612d0b836020613250565b604051602001612d1c9291906140b3565b60408051601f198184030181529082905262461bcd60e51b825261067091600401613718565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110612d7c57612d7c613e95565b602090810291909101015292915050565b610ac2868686868686613479565b6001600160a01b0384163b15610ac2576040517ff23a6e610000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063f23a6e6190612df89089908990889088908890600401614134565b6020604051808303816000875af1925050508015612e33575060408051601f3d908101601f19168201909252612e3091810190614177565b60015b612ee857612e3f614194565b806308c379a003612e785750612e536141af565b80612e5e5750612e7a565b8060405162461bcd60e51b81526004016106709190613718565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d4552433131353560448201527f526563656976657220696d706c656d656e7465720000000000000000000000006064820152608401610670565b7fffffffff0000000000000000000000000000000000000000000000000000000081167ff23a6e610000000000000000000000000000000000000000000000000000000014611b6a5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e730000000000000000000000000000000000000000000000006064820152608401610670565b6001600160a01b0384163b15610ac2576040517fbc197c810000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063bc197c8190612ffc9089908990889088908890600401614257565b6020604051808303816000875af1925050508015613037575060408051601f3d908101601f1916820190925261303491810190614177565b60015b61304357612e3f614194565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fbc197c810000000000000000000000000000000000000000000000000000000014611b6a5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e730000000000000000000000000000000000000000000000006064820152608401610670565b61012d546000906001600160a01b0316330361313b57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b503390565b90565b600054610100900460ff166131ae5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610670565b61199981613607565b600054610100900460ff166132225760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610670565b60408051602081019091526000815260fb906119999082613fc5565b606061069e6001600160a01b03831660145b6060600061325f836002613e3f565b61326a906002613f6c565b67ffffffffffffffff81111561328257613282613760565b6040519080825280601f01601f1916602001820160405280156132ac576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106132e3576132e3613e95565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061334657613346613e95565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000613382846002613e3f565b61338d906001613f6c565b90505b600181111561342a577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106133ce576133ce613e95565b1a60f81b8282815181106133e4576133e4613e95565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93613423816142b5565b9050613390565b5083156119815760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610670565b6001600160a01b0385166135005760005b83518110156134fe578281815181106134a5576134a5613e95565b602002602001015160c960008684815181106134c3576134c3613e95565b6020026020010151815260200190815260200160002060008282546134e89190613f6c565b909155506134f7905081613def565b905061348a565b505b6001600160a01b038416610ac25760005b8351811015611b6a57600084828151811061352e5761352e613e95565b60200260200101519050600084838151811061354c5761354c613e95565b60200260200101519050600060c96000848152602001908152602001600020549050818110156135e45760405162461bcd60e51b815260206004820152602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f7460448201527f616c537570706c790000000000000000000000000000000000000000000000006064820152608401610670565b600092835260c960205260409092209103905561360081613def565b9050613511565b6067610b8d8282613fc5565b6001600160a01b038116811461199957600080fd5b803561363381613613565b919050565b6000806040838503121561364b57600080fd5b823561365681613613565b946020939093013593505050565b7fffffffff000000000000000000000000000000000000000000000000000000008116811461199957600080fd5b6000602082840312156136a457600080fd5b813561198181613664565b6000602082840312156136c157600080fd5b5035919050565b60005b838110156136e35781810151838201526020016136cb565b50506000910152565b600081518084526137048160208601602086016136c8565b601f01601f19169290920160200192915050565b60208152600061198160208301846136ec565b60008060006060848603121561374057600080fd5b833561374b81613613565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff8211171561379c5761379c613760565b6040525050565b600082601f8301126137b457600080fd5b813567ffffffffffffffff8111156137ce576137ce613760565b6040516137e56020601f19601f8501160182613776565b8181528460208386010111156137fa57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561382957600080fd5b813567ffffffffffffffff81111561384057600080fd5b61384c848285016137a3565b949350505050565b600067ffffffffffffffff82111561386e5761386e613760565b5060051b60200190565b600082601f83011261388957600080fd5b8135602061389682613854565b6040516138a38282613776565b83815260059390931b85018201928281019150868411156138c357600080fd5b8286015b848110156138de57803583529183019183016138c7565b509695505050505050565b6000806000606084860312156138fe57600080fd5b833561390981613613565b9250602084013567ffffffffffffffff8082111561392657600080fd5b61393287838801613878565b9350604086013591508082111561394857600080fd5b5061395586828701613878565b9150509250925092565b6000806040838503121561397257600080fd5b50508035926020909101359150565b600080600080600060a0868803121561399957600080fd5b85356139a481613613565b945060208601356139b481613613565b9350604086013567ffffffffffffffff808211156139d157600080fd5b6139dd89838a01613878565b945060608801359150808211156139f357600080fd5b6139ff89838a01613878565b93506080880135915080821115613a1557600080fd5b50613a22888289016137a3565b9150509295509295909350565b60008060408385031215613a4257600080fd5b823591506020830135613a5481613613565b809150509250929050565b60008060408385031215613a7257600080fd5b823567ffffffffffffffff80821115613a8a57600080fd5b818501915085601f830112613a9e57600080fd5b81356020613aab82613854565b604051613ab88282613776565b83815260059390931b8501820192828101915089841115613ad857600080fd5b948201945b83861015613aff578535613af081613613565b82529482019490820190613add565b96505086013592505080821115613b1557600080fd5b506109b585828601613878565b600081518084526020808501945080840160005b83811015613b5257815187529582019590820190600101613b36565b509495945050505050565b6020815260006119816020830184613b22565b60008060408385031215613b8357600080fd5b82359150602083013567ffffffffffffffff811115613ba157600080fd5b6109b5858286016137a3565b600060208284031215613bbf57600080fd5b813561198181613613565b801515811461199957600080fd5b60008060408385031215613beb57600080fd5b8235613bf681613613565b91506020830135613a5481613bca565b60008060408385031215613c1957600080fd5b8235613c2481613613565b91506020830135613a5481613613565b600080600080600060a08688031215613c4c57600080fd5b8535613c5781613613565b94506020860135613c6781613613565b93506040860135925060608601359150608086013567ffffffffffffffff811115613c9157600080fd5b613a22888289016137a3565b600080600080600080600060e0888a031215613cb857600080fd5b67ffffffffffffffff8089351115613ccf57600080fd5b613cdc8a8a358b016137a3565b97506020890135613cec81613613565b96506040890135613cfc81613613565b95506060890135613d0c81613613565b94506080890135613d1c81613613565b935060a089013581811115613d3057600080fd5b8901601f81018b13613d4157600080fd5b8035613d4c81613854565b604051613d598282613776565b80915082815260208101915060208360051b85010192508d831115613d7d57600080fd5b602084015b83811015613db6578581351115613d9857600080fd5b613da88f602083358801016137a3565b835260209283019201613d82565b508096505050505050613dcb60c08901613628565b905092959891949750929550565b634e487b7160e01b600052601160045260246000fd5b60006000198203613e0257613e02613dd9565b5060010190565b60008060408385031215613e1c57600080fd5b8251613e2781613613565b602084015190925061ffff81168114613a5457600080fd5b808202811582820484141761069e5761069e613dd9565b600082613e7357634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215613e8a57600080fd5b815161198181613bca565b634e487b7160e01b600052603260045260246000fd5b600181811c90821680613ebf57607f821691505b602082108103613edf57634e487b7160e01b600052602260045260246000fd5b50919050565b6000808454613ef381613eab565b60018281168015613f0b5760018114613f2057613f4f565b60ff1984168752821515830287019450613f4f565b8860005260208060002060005b85811015613f465781548a820152908401908201613f2d565b50505082870194505b505050508351613f638183602088016136c8565b01949350505050565b8082018082111561069e5761069e613dd9565b601f821115610af057600081815260208120601f850160051c81016020861015613fa65750805b601f850160051c820191505b81811015610ac257828155600101613fb2565b815167ffffffffffffffff811115613fdf57613fdf613760565b613ff381613fed8454613eab565b84613f7f565b602080601f83116001811461402857600084156140105750858301515b600019600386901b1c1916600185901b178555610ac2565b600085815260208120601f198616915b8281101561405757888601518255948401946001909101908401614038565b50858210156140755787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6040815260006140986040830185613b22565b82810360208401526140aa8185613b22565b95945050505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516140eb8160178501602088016136c8565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516141288160288401602088016136c8565b01602801949350505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a0608083015261416c60a08301846136ec565b979650505050505050565b60006020828403121561418957600080fd5b815161198181613664565b600060033d11156131405760046000803e5060005160e01c90565b600060443d10156141bd5790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff816024840111818411171561420b57505050505090565b82850191508151818111156142235750505050505090565b843d870101602082850101111561423d5750505050505090565b61424c60208286010187613776565b509095945050505050565b60006001600160a01b03808816835280871660208401525060a0604083015261428360a0830186613b22565b82810360608401526142958186613b22565b905082810360808401526142a981856136ec565b98975050505050505050565b6000816142c4576142c4613dd9565b50600019019056fea264697066735822122048de47edf27628ccba060a90be3919a39767a18b9f5b5a1311efaa3dfe7fc39564736f6c63430008120033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102405760003560e01c8063572b6c0511610145578063d5391393116100bd578063e985e9c51161008c578063f242432a11610071578063f242432a146105bd578063f3bdecc1146105d0578063f5298aca146105e357600080fd5b8063e985e9c51461056d578063ee295d62146105a957600080fd5b8063d53913931461050d578063d547741f14610534578063d81d0a1514610547578063da7422281461055a57600080fd5b8063a217fddf11610114578063b0ccc31e116100f9578063b0ccc31e146104af578063bd85b039146104db578063ce1b815f146104fb57600080fd5b8063a217fddf14610494578063a22cb4651461049c57600080fd5b8063572b6c051461041a5780636b20c4541461043d57806371e0276c1461045057806391d148541461045a57600080fd5b8063282c51f3116101d857806336568abe116101a75780634f558e791161018c5780634f558e79146103d2578063512c97e9146103f457806355f804b31461040757600080fd5b806336568abe1461039f5780634e1273f4146103b257600080fd5b8063282c51f3146103205780632a55205a146103475780632eb2c2d6146103795780632f2ff15d1461038c57600080fd5b8063156e29f611610214578063156e29f6146102c35780631a87b277146102d657806320820ec3146102e9578063248a9ca3146102fc57600080fd5b8062fdd58e1461024557806301ffc9a71461026b5780630e89341c1461028e578063124d91e5146102ae575b600080fd5b610258610253366004613638565b6105f6565b6040519081526020015b60405180910390f35b61027e610279366004613692565b6106a4565b6040519015158152602001610262565b6102a161029c3660046136af565b61073b565b6040516102629190613718565b6102c16102bc36600461372b565b610746565b005b6102c16102d136600461372b565b610781565b6102c16102e4366004613817565b61082d565b6102c16102f73660046138e9565b6108e4565b61025861030a3660046136af565b600090815261012e602052604090206001015490565b6102587f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84881565b61035a61035536600461395f565b610919565b604080516001600160a01b039093168352602083019190915201610262565b6102c1610387366004613981565b6109bf565b6102c161039a366004613a2f565b610aca565b6102c16103ad366004613a2f565b610af5565b6103c56103c0366004613a5f565b610b91565b6040516102629190613b5d565b61027e6103e03660046136af565b600090815260c96020526040902054151590565b6102c1610402366004613b70565b610ccf565b6102c1610415366004613817565b610dbb565b61027e610428366004613bad565b61012d546001600160a01b0391821691161490565b6102c161044b3660046138e9565b610e46565b6102586101625481565b61027e610468366004613a2f565b600091825261012e602090815260408084206001600160a01b0393909316845291905290205460ff1690565b610258600081565b6102c16104aa366004613bd8565b610ef1565b610160546104c3906001600160a01b031681565b6040516001600160a01b039091168152602001610262565b6102586104e93660046136af565b600090815260c9602052604090205490565b61012d546001600160a01b03166104c3565b6102587f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6102c1610542366004613a2f565b610fd9565b6102c16105553660046138e9565b610fff565b6102c1610568366004613bad565b6110f4565b61027e61057b366004613c06565b6001600160a01b03918216600090815260666020908152604080832093909416825291909152205460ff1690565b610161546104c3906001600160a01b031681565b6102c16105cb366004613c34565b6111d4565b6102c16105de366004613c9d565b6112d2565b6102c16105f136600461372b565b6117fd565b60006001600160a01b0383166106795760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201527f616c6964206f776e65720000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b5060008181526065602090815260408083206001600160a01b03861684529091529020545b92915050565b60007f572b6c05000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316148061069e57507f2a55205a000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461069e565b606061069e826118a8565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84861077081611988565b61077b84848461199c565b50505050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a66107ab81611988565b826000811180156107bf5750610162548111155b61080b5760405162461bcd60e51b815260206004820152601d60248201527f436174616c7973743a20696e76616c696420636174616c7973742069640000006044820152606401610670565b61082685858560405180602001604052806000815250611b73565b5050505050565b600061083881611988565b81516000036108895760405162461bcd60e51b815260206004820152601c60248201527f436174616c7973743a204349442063616e277420626520656d707479000000006044820152606401610670565b60006101626000815461089b90613def565b918290555090506108ac8184611cb6565b6040518181527f0fc221b41b73e1c4f9d65566cf090e650d0246fb5c0434a32e9b313a39636d169060200160405180910390a1505050565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84861090e81611988565b61077b848484611d13565b600080600061016160009054906101000a90046001600160a01b03166001600160a01b031663a86a28d16040518163ffffffff1660e01b81526004016040805180830381865afa158015610971573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109959190613e09565b90935090506127106109ab61ffff831686613e3f565b6109b59190613e56565b9150509250929050565b6101605485906001600160a01b03163b15610ab557336001600160a01b038216036109f6576109f18686868686611fa5565b610ac2565b61016054604051633185c44d60e21b81523060048201523360248201526001600160a01b039091169063c617113490604401602060405180830381865afa158015610a45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a699190613e78565b610ab55760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f7765640000000000000000000000006044820152606401610670565b610ac28686868686611fa5565b505050505050565b600082815261012e6020526040902060010154610ae681611988565b610af08383612242565b505050565b610afd6122e7565b6001600160a01b0316816001600160a01b031614610b835760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610670565b610b8d82826122f6565b5050565b60608151835114610c0a5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d6174636800000000000000000000000000000000000000000000006064820152608401610670565b6000835167ffffffffffffffff811115610c2657610c26613760565b604051908082528060200260200182016040528015610c4f578160200160208202803683370190505b50905060005b8451811015610cc757610c9a858281518110610c7357610c73613e95565b6020026020010151858381518110610c8d57610c8d613e95565b60200260200101516105f6565b828281518110610cac57610cac613e95565b6020908102919091010152610cc081613def565b9050610c55565b509392505050565b6000610cda81611988565b82600081118015610cee5750610162548111155b610d3a5760405162461bcd60e51b815260206004820152601d60248201527f436174616c7973743a20696e76616c696420636174616c7973742069640000006044820152606401610670565b8251600003610db15760405162461bcd60e51b815260206004820152602560248201527f436174616c7973743a206d65746164617461486173682063616e27742062652060448201527f656d7074790000000000000000000000000000000000000000000000000000006064820152608401610670565b61077b8484611cb6565b6000610dc681611988565b8151600003610e3d5760405162461bcd60e51b815260206004820152602160248201527f436174616c7973743a2062617365207572692063616e277420626520656d707460448201527f79000000000000000000000000000000000000000000000000000000000000006064820152608401610670565b610b8d82612399565b610e4e6122e7565b6001600160a01b0316836001600160a01b03161480610e745750610e748361057b6122e7565b610ee65760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206f7220617070726f7665640000000000000000000000000000000000006064820152608401610670565b610af0838383611d13565b6101605482906001600160a01b03163b15610fc75761016054604051633185c44d60e21b81523060048201526001600160a01b0383811660248301529091169063c617113490604401602060405180830381865afa158015610f57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7b9190613e78565b610fc75760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f7765640000000000000000000000006044820152606401610670565b610af0610fd26122e7565b84846123a5565b600082815261012e6020526040902060010154610ff581611988565b610af083836122f6565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661102981611988565b60005b83518110156110d857600084828151811061104957611049613e95565b602002602001015111801561107a57506101625484828151811061106f5761106f613e95565b602002602001015111155b6110c65760405162461bcd60e51b815260206004820152601d60248201527f436174616c7973743a20696e76616c696420636174616c7973742069640000006044820152606401610670565b806110d081613def565b91505061102c565b5061077b84848460405180602001604052806000815250612499565b60006110ff81611988565b6001600160a01b03821661117b5760405162461bcd60e51b815260206004820152603160248201527f436174616c7973743a207472757374656420666f727761726465722063616e2760448201527f74206265207a65726f20616464726573730000000000000000000000000000006064820152608401610670565b61012d805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091556040517f871264f4293af7d2865ae7eae628b228f4991c57cb45b39c99f0b774ebe2901890600090a25050565b6101605485906001600160a01b03163b156112c557336001600160a01b03821603611206576109f18686868686612696565b61016054604051633185c44d60e21b81523060048201523360248201526001600160a01b039091169063c617113490604401602060405180830381865afa158015611255573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112799190613e78565b6112c55760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f7765640000000000000000000000006044820152606401610670565b610ac28686868686612696565b600054610100900460ff16158080156112f25750600054600160ff909116105b8061130c5750303b15801561130c575060005460ff166001145b61137e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610670565b6000805460ff1916600117905580156113a1576000805461ff0019166101001790555b87516000036114185760405162461bcd60e51b815260206004820152602160248201527f436174616c7973743a2062617365207572692063616e277420626520656d707460448201527f79000000000000000000000000000000000000000000000000000000000000006064820152608401610670565b6001600160a01b0387166114945760405162461bcd60e51b815260206004820152602960248201527f436174616c7973743a207472757374656420666f727761726465722063616e2760448201527f74206265207a65726f00000000000000000000000000000000000000000000006064820152608401610670565b6001600160a01b03861661150f5760405162461bcd60e51b8152602060048201526024808201527f436174616c7973743a20737562736372697074696f6e2063616e27742062652060448201527f7a65726f000000000000000000000000000000000000000000000000000000006064820152608401610670565b6001600160a01b0385166115655760405162461bcd60e51b815260206004820152601d60248201527f436174616c7973743a2061646d696e2063616e2774206265207a65726f0000006044820152606401610670565b6001600160a01b0384166115bb5760405162461bcd60e51b815260206004820152601e60248201527f436174616c7973743a206d696e7465722063616e2774206265207a65726f00006044820152606401610670565b6001600160a01b0382166116375760405162461bcd60e51b815260206004820152602760248201527f436174616c7973743a20726f79616c7479206d616e616765722063616e27742060448201527f6265207a65726f000000000000000000000000000000000000000000000000006064820152608401610670565b61164088612889565b6116486128fd565b6116506128fd565b6116586128fd565b61166061296a565b61012d805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0389161790556116948660016129dd565b61169d88612399565b6116a8600086612242565b6116d27f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a685612242565b610161805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03841617905560005b83518110156117ac5783818151811061171957611719613e95565b6020026020010151516000036117715760405162461bcd60e51b815260206004820152601c60248201527f436174616c7973743a204349442063616e277420626520656d707479000000006044820152606401610670565b6117948185838151811061178757611787613e95565b6020026020010151611cb6565b610162819055806117a481613def565b9150506116fe565b5080156117f3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b6118056122e7565b6001600160a01b0316836001600160a01b0316148061182b575061182b8361057b6122e7565b61189d5760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206f7220617070726f7665640000000000000000000000000000000000006064820152608401610670565b610af083838361199c565b600081815260fc60205260408120805460609291906118c690613eab565b80601f01602080910402602001604051908101604052809291908181526020018280546118f290613eab565b801561193f5780601f106119145761010080835404028352916020019161193f565b820191906000526020600020905b81548152906001019060200180831161192257829003601f168201915b50505050509050600081511161195d5761195883612c38565b611981565b60fb81604051602001611971929190613ee5565b6040516020818303038152906040525b9392505050565b611999816119946122e7565b612ccc565b50565b6001600160a01b038316611a185760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610670565b6000611a226122e7565b90506000611a2f84612d42565b90506000611a3c84612d42565b9050611a5c83876000858560405180602001604052806000815250612d8d565b60008581526065602090815260408083206001600160a01b038a16845290915290205484811015611af45760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e6365000000000000000000000000000000000000000000000000000000006064820152608401610670565b60008681526065602090815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46040805160208101909152600090525b50505050505050565b6001600160a01b038416611bef5760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610670565b6000611bf96122e7565b90506000611c0685612d42565b90506000611c1385612d42565b9050611c2483600089858589612d8d565b60008681526065602090815260408083206001600160a01b038b16845290915281208054879290611c56908490613f6c565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611b6a83600089898989612d9b565b600082815260fc60205260409020611cce8282613fc5565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b611cfa8461073b565b604051611d079190613718565b60405180910390a25050565b6001600160a01b038316611d8f5760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610670565b8051825114611df15760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608401610670565b6000611dfb6122e7565b9050611e1b81856000868660405180602001604052806000815250612d8d565b60005b8351811015611f38576000848281518110611e3b57611e3b613e95565b602002602001015190506000848381518110611e5957611e59613e95565b60209081029190910181015160008481526065835260408082206001600160a01b038c168352909352919091205490915081811015611eff5760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e6365000000000000000000000000000000000000000000000000000000006064820152608401610670565b60009283526065602090815260408085206001600160a01b038b1686529091529092209103905580611f3081613def565b915050611e1e565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051611f89929190614085565b60405180910390a460408051602081019091526000905261077b565b81518351146120075760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608401610670565b6001600160a01b0384166120835760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610670565b600061208d6122e7565b905061209d818787878787612d8d565b60005b84518110156121dc5760008582815181106120bd576120bd613e95565b6020026020010151905060008583815181106120db576120db613e95565b60209081029190910181015160008481526065835260408082206001600160a01b038e1683529093529190912054909150818110156121825760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e73666572000000000000000000000000000000000000000000006064820152608401610670565b60008381526065602090815260408083206001600160a01b038e8116855292528083208585039055908b168252812080548492906121c1908490613f6c565b92505081905550505050806121d590613def565b90506120a0565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161222c929190614085565b60405180910390a4610ac2818787878787612f9f565b600082815261012e602090815260408083206001600160a01b038516845290915290205460ff16610b8d57600082815261012e602090815260408083206001600160a01b03851684529091529020805460ff191660011790556122a36122e7565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006122f16130fa565b905090565b600082815261012e602090815260408083206001600160a01b038516845290915290205460ff1615610b8d57600082815261012e602090815260408083206001600160a01b03851684529091529020805460ff191690556123556122e7565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b60fb610b8d8282613fc5565b816001600160a01b0316836001600160a01b03160361242c5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c6600000000000000000000000000000000000000000000006064820152608401610670565b6001600160a01b03838116600081815260666020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0384166125155760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610670565b81518351146125775760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608401610670565b60006125816122e7565b905061259281600087878787612d8d565b60005b845181101561262e578381815181106125b0576125b0613e95565b6020026020010151606560008784815181106125ce576125ce613e95565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b0316815260200190815260200160002060008282546126169190613f6c565b9091555081905061262681613def565b915050612595565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161267f929190614085565b60405180910390a461082681600087878787612f9f565b6001600160a01b0384166127125760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610670565b600061271c6122e7565b9050600061272985612d42565b9050600061273685612d42565b9050612746838989858589612d8d565b60008681526065602090815260408083206001600160a01b038c168452909152902054858110156127df5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e73666572000000000000000000000000000000000000000000006064820152608401610670565b60008781526065602090815260408083206001600160a01b038d8116855292528083208985039055908a1682528120805488929061281e908490613f6c565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461287e848a8a8a8a8a612d9b565b505050505050505050565b600054610100900460ff166128f45760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610670565b61199981613143565b600054610100900460ff166129685760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610670565b565b600054610100900460ff166129d55760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610670565b6129686131b7565b600054610100900460ff16612a485760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610670565b610160805473ffffffffffffffffffffffffffffffffffffffff19166daaeb6d7670e522a718067333cd4e9081179091553b15610b8d57610160546040517fc3c5a5470000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b039091169063c3c5a547906024016020604051808303816000875af1158015612ae3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b079190613e78565b610b8d578015612b8d57610160546040517f7d3e3dbe0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03848116602483015290911690637d3e3dbe906044015b600060405180830381600087803b158015612b7957600080fd5b505af1158015610ac2573d6000803e3d6000fd5b6001600160a01b03821615612bee57610160546040517fa0af29030000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0384811660248301529091169063a0af290390604401612b5f565b610160546040517f4420e4860000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0390911690634420e48690602401612b5f565b606060678054612c4790613eab565b80601f0160208091040260200160405190810160405280929190818152602001828054612c7390613eab565b8015612cc05780601f10612c9557610100808354040283529160200191612cc0565b820191906000526020600020905b815481529060010190602001808311612ca357829003601f168201915b50505050509050919050565b600082815261012e602090815260408083206001600160a01b038516845290915290205460ff16610b8d57612d008161323e565b612d0b836020613250565b604051602001612d1c9291906140b3565b60408051601f198184030181529082905262461bcd60e51b825261067091600401613718565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110612d7c57612d7c613e95565b602090810291909101015292915050565b610ac2868686868686613479565b6001600160a01b0384163b15610ac2576040517ff23a6e610000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063f23a6e6190612df89089908990889088908890600401614134565b6020604051808303816000875af1925050508015612e33575060408051601f3d908101601f19168201909252612e3091810190614177565b60015b612ee857612e3f614194565b806308c379a003612e785750612e536141af565b80612e5e5750612e7a565b8060405162461bcd60e51b81526004016106709190613718565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d4552433131353560448201527f526563656976657220696d706c656d656e7465720000000000000000000000006064820152608401610670565b7fffffffff0000000000000000000000000000000000000000000000000000000081167ff23a6e610000000000000000000000000000000000000000000000000000000014611b6a5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e730000000000000000000000000000000000000000000000006064820152608401610670565b6001600160a01b0384163b15610ac2576040517fbc197c810000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063bc197c8190612ffc9089908990889088908890600401614257565b6020604051808303816000875af1925050508015613037575060408051601f3d908101601f1916820190925261303491810190614177565b60015b61304357612e3f614194565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fbc197c810000000000000000000000000000000000000000000000000000000014611b6a5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e730000000000000000000000000000000000000000000000006064820152608401610670565b61012d546000906001600160a01b0316330361313b57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b503390565b90565b600054610100900460ff166131ae5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610670565b61199981613607565b600054610100900460ff166132225760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610670565b60408051602081019091526000815260fb906119999082613fc5565b606061069e6001600160a01b03831660145b6060600061325f836002613e3f565b61326a906002613f6c565b67ffffffffffffffff81111561328257613282613760565b6040519080825280601f01601f1916602001820160405280156132ac576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106132e3576132e3613e95565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061334657613346613e95565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000613382846002613e3f565b61338d906001613f6c565b90505b600181111561342a577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106133ce576133ce613e95565b1a60f81b8282815181106133e4576133e4613e95565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93613423816142b5565b9050613390565b5083156119815760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610670565b6001600160a01b0385166135005760005b83518110156134fe578281815181106134a5576134a5613e95565b602002602001015160c960008684815181106134c3576134c3613e95565b6020026020010151815260200190815260200160002060008282546134e89190613f6c565b909155506134f7905081613def565b905061348a565b505b6001600160a01b038416610ac25760005b8351811015611b6a57600084828151811061352e5761352e613e95565b60200260200101519050600084838151811061354c5761354c613e95565b60200260200101519050600060c96000848152602001908152602001600020549050818110156135e45760405162461bcd60e51b815260206004820152602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f7460448201527f616c537570706c790000000000000000000000000000000000000000000000006064820152608401610670565b600092835260c960205260409092209103905561360081613def565b9050613511565b6067610b8d8282613fc5565b6001600160a01b038116811461199957600080fd5b803561363381613613565b919050565b6000806040838503121561364b57600080fd5b823561365681613613565b946020939093013593505050565b7fffffffff000000000000000000000000000000000000000000000000000000008116811461199957600080fd5b6000602082840312156136a457600080fd5b813561198181613664565b6000602082840312156136c157600080fd5b5035919050565b60005b838110156136e35781810151838201526020016136cb565b50506000910152565b600081518084526137048160208601602086016136c8565b601f01601f19169290920160200192915050565b60208152600061198160208301846136ec565b60008060006060848603121561374057600080fd5b833561374b81613613565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff8211171561379c5761379c613760565b6040525050565b600082601f8301126137b457600080fd5b813567ffffffffffffffff8111156137ce576137ce613760565b6040516137e56020601f19601f8501160182613776565b8181528460208386010111156137fa57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561382957600080fd5b813567ffffffffffffffff81111561384057600080fd5b61384c848285016137a3565b949350505050565b600067ffffffffffffffff82111561386e5761386e613760565b5060051b60200190565b600082601f83011261388957600080fd5b8135602061389682613854565b6040516138a38282613776565b83815260059390931b85018201928281019150868411156138c357600080fd5b8286015b848110156138de57803583529183019183016138c7565b509695505050505050565b6000806000606084860312156138fe57600080fd5b833561390981613613565b9250602084013567ffffffffffffffff8082111561392657600080fd5b61393287838801613878565b9350604086013591508082111561394857600080fd5b5061395586828701613878565b9150509250925092565b6000806040838503121561397257600080fd5b50508035926020909101359150565b600080600080600060a0868803121561399957600080fd5b85356139a481613613565b945060208601356139b481613613565b9350604086013567ffffffffffffffff808211156139d157600080fd5b6139dd89838a01613878565b945060608801359150808211156139f357600080fd5b6139ff89838a01613878565b93506080880135915080821115613a1557600080fd5b50613a22888289016137a3565b9150509295509295909350565b60008060408385031215613a4257600080fd5b823591506020830135613a5481613613565b809150509250929050565b60008060408385031215613a7257600080fd5b823567ffffffffffffffff80821115613a8a57600080fd5b818501915085601f830112613a9e57600080fd5b81356020613aab82613854565b604051613ab88282613776565b83815260059390931b8501820192828101915089841115613ad857600080fd5b948201945b83861015613aff578535613af081613613565b82529482019490820190613add565b96505086013592505080821115613b1557600080fd5b506109b585828601613878565b600081518084526020808501945080840160005b83811015613b5257815187529582019590820190600101613b36565b509495945050505050565b6020815260006119816020830184613b22565b60008060408385031215613b8357600080fd5b82359150602083013567ffffffffffffffff811115613ba157600080fd5b6109b5858286016137a3565b600060208284031215613bbf57600080fd5b813561198181613613565b801515811461199957600080fd5b60008060408385031215613beb57600080fd5b8235613bf681613613565b91506020830135613a5481613bca565b60008060408385031215613c1957600080fd5b8235613c2481613613565b91506020830135613a5481613613565b600080600080600060a08688031215613c4c57600080fd5b8535613c5781613613565b94506020860135613c6781613613565b93506040860135925060608601359150608086013567ffffffffffffffff811115613c9157600080fd5b613a22888289016137a3565b600080600080600080600060e0888a031215613cb857600080fd5b67ffffffffffffffff8089351115613ccf57600080fd5b613cdc8a8a358b016137a3565b97506020890135613cec81613613565b96506040890135613cfc81613613565b95506060890135613d0c81613613565b94506080890135613d1c81613613565b935060a089013581811115613d3057600080fd5b8901601f81018b13613d4157600080fd5b8035613d4c81613854565b604051613d598282613776565b80915082815260208101915060208360051b85010192508d831115613d7d57600080fd5b602084015b83811015613db6578581351115613d9857600080fd5b613da88f602083358801016137a3565b835260209283019201613d82565b508096505050505050613dcb60c08901613628565b905092959891949750929550565b634e487b7160e01b600052601160045260246000fd5b60006000198203613e0257613e02613dd9565b5060010190565b60008060408385031215613e1c57600080fd5b8251613e2781613613565b602084015190925061ffff81168114613a5457600080fd5b808202811582820484141761069e5761069e613dd9565b600082613e7357634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215613e8a57600080fd5b815161198181613bca565b634e487b7160e01b600052603260045260246000fd5b600181811c90821680613ebf57607f821691505b602082108103613edf57634e487b7160e01b600052602260045260246000fd5b50919050565b6000808454613ef381613eab565b60018281168015613f0b5760018114613f2057613f4f565b60ff1984168752821515830287019450613f4f565b8860005260208060002060005b85811015613f465781548a820152908401908201613f2d565b50505082870194505b505050508351613f638183602088016136c8565b01949350505050565b8082018082111561069e5761069e613dd9565b601f821115610af057600081815260208120601f850160051c81016020861015613fa65750805b601f850160051c820191505b81811015610ac257828155600101613fb2565b815167ffffffffffffffff811115613fdf57613fdf613760565b613ff381613fed8454613eab565b84613f7f565b602080601f83116001811461402857600084156140105750858301515b600019600386901b1c1916600185901b178555610ac2565b600085815260208120601f198616915b8281101561405757888601518255948401946001909101908401614038565b50858210156140755787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6040815260006140986040830185613b22565b82810360208401526140aa8185613b22565b95945050505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516140eb8160178501602088016136c8565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516141288160288401602088016136c8565b01602801949350505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a0608083015261416c60a08301846136ec565b979650505050505050565b60006020828403121561418957600080fd5b815161198181613664565b600060033d11156131405760046000803e5060005160e01c90565b600060443d10156141bd5790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff816024840111818411171561420b57505050505090565b82850191508151818111156142235750505050505090565b843d870101602082850101111561423d5750505050505090565b61424c60208286010187613776565b509095945050505050565b60006001600160a01b03808816835280871660208401525060a0604083015261428360a0830186613b22565b82810360608401526142958186613b22565b905082810360808401526142a981856136ec565b98975050505050505050565b6000816142c4576142c4613dd9565b50600019019056fea264697066735822122048de47edf27628ccba060a90be3919a39767a18b9f5b5a1311efaa3dfe7fc39564736f6c63430008120033", + "solcInputHash": "f945dbcb44c3ca52caf6c6145c517ab2", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newDefaultRoyaltyRecipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newDefaultRoyaltyAmount\",\"type\":\"uint256\"}],\"name\":\"DefaultRoyaltyChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"catalystId\",\"type\":\"uint256\"}],\"name\":\"NewCatalystTypeAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"name\":\"TransferBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"TransferSingle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newTrustedForwarderAddress\",\"type\":\"address\"}],\"name\":\"TrustedForwarderChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldTrustedForwarder\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newTrustedForwarder\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"TrustedForwarderSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"URI\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINTER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"ipfsCID\",\"type\":\"string\"}],\"name\":\"addNewCatalystType\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"balanceOfBatch\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"name\":\"burnBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"burnBatchFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burnFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"exists\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTrustedForwarder\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"highestTierIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_baseUri\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_trustedForwarder\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_subscription\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_defaultAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_defaultMinter\",\"type\":\"address\"},{\"internalType\":\"string[]\",\"name\":\"_catalystIpfsCID\",\"type\":\"string[]\"},{\"internalType\":\"address\",\"name\":\"_royaltyManager\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"}],\"name\":\"isTrustedForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"mintBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"operatorFilterRegistry\",\"outputs\":[{\"internalType\":\"contract IOperatorFilterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"subscriptionOrRegistrantToCopy\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"subscribe\",\"type\":\"bool\"}],\"name\":\"registerAndSubscribe\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_salePrice\",\"type\":\"uint256\"}],\"name\":\"royaltyInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"royaltyAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"royaltyManager\",\"outputs\":[{\"internalType\":\"contract IRoyaltyManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeBatchTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"baseURI\",\"type\":\"string\"}],\"name\":\"setBaseURI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"metadataHash\",\"type\":\"string\"}],\"name\":\"setMetadataHash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"registry\",\"type\":\"address\"}],\"name\":\"setOperatorRegistry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"name\":\"setTrustedForwarder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"The Sandbox\",\"details\":\"An ERC1155 contract that manages catalysts, extends multiple OpenZeppelin contracts to provide a variety of features including, AccessControl, URIStorage, Burnable and more. The contract includes support for meta transactions.\",\"events\":{\"ApprovalForAll(address,address,bool)\":{\"details\":\"Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to `approved`.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"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._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"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`)\"},\"TransferBatch(address,address,address,uint256[],uint256[])\":{\"details\":\"Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all transfers.\"},\"TransferSingle(address,address,address,uint256,uint256)\":{\"details\":\"Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\"},\"TrustedForwarderSet(address,address,address)\":{\"params\":{\"newTrustedForwarder\":\"new trusted forwarder\",\"oldTrustedForwarder\":\"old trusted forwarder\",\"operator\":\"the sender of the transaction\"}},\"URI(string,uint256)\":{\"details\":\"Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. If an {URI} event was emitted for `id`, the standard https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value returned by {IERC1155MetadataURI-uri}.\"}},\"kind\":\"dev\",\"methods\":{\"addNewCatalystType(string)\":{\"params\":{\"ipfsCID\":\"The royalty bps for the catalyst\"}},\"balanceOf(address,uint256)\":{\"details\":\"See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address.\"},\"balanceOfBatch(address[],uint256[])\":{\"details\":\"See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length.\"},\"burnBatchFrom(address,uint256[],uint256[])\":{\"params\":{\"account\":\"The address to burn from\",\"amounts\":\"The amounts to be burned\",\"ids\":\"The token ids to burn\"}},\"burnFrom(address,uint256,uint256)\":{\"params\":{\"account\":\"The address to burn from\",\"amount\":\"The amount to be burned\",\"id\":\"The token id to burn\"}},\"constructor\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"exists(uint256)\":{\"details\":\"Indicates whether any token exist with a given id, or not.\"},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getTrustedForwarder()\":{\"returns\":{\"_0\":\"return the address of the trusted forwarder\"}},\"grantRole(bytes32,address)\":{\"details\":\"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.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"initialize(string,address,address,address,address,string[],address)\":{\"params\":{\"_baseUri\":\"The base URI for the token metadata, most likely set to ipfs://.\",\"_catalystIpfsCID\":\"The IPFS content identifiers for each catalyst.\",\"_defaultAdmin\":\"The default admin address.\",\"_defaultMinter\":\"The default minter address.\",\"_royaltyManager\":\", the address of the Manager contract for common royalty recipient\",\"_subscription\":\"The subscription address.\",\"_trustedForwarder\":\"The trusted forwarder for meta transactions.\"}},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC1155-isApprovedForAll}.\"},\"isTrustedForwarder(address)\":{\"params\":{\"forwarder\":\"trusted forwarder address to check\"},\"returns\":{\"_0\":\"true if the address is the same as the trusted forwarder\"}},\"mint(address,uint256,uint256)\":{\"params\":{\"amount\":\"The amount to be minted\",\"id\":\"The token id to mint\",\"to\":\"The address that will own the minted token\"}},\"mintBatch(address,uint256[],uint256[])\":{\"params\":{\"amounts\":\"The amounts to be minted per token id\",\"ids\":\"The token ids to mint\",\"to\":\"The address that will own the minted tokens\"}},\"registerAndSubscribe(address,bool)\":{\"details\":\"used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.\",\"params\":{\"subscribe\":\"bool to signify subscription \\\"true\\\"\\\" or to copy the list \\\"false\\\".\",\"subscriptionOrRegistrantToCopy\":\"registration address of the list to subscribe.\"}},\"renounceRole(bytes32,address)\":{\"details\":\"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.\"},\"revokeRole(bytes32,address)\":{\"details\":\"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.\"},\"royaltyInfo(uint256,uint256)\":{\"details\":\"tokenId is one of the EIP2981 args for this function can't be removed\",\"params\":{\"_salePrice\":\"the price of token on which the royalty is calculated\"},\"returns\":{\"receiver\":\"the receiver of royalty\",\"royaltyAmount\":\"the amount of royalty\"}},\"safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)\":{\"details\":\"call data should be optimized to order ids so packedBalance can be used efficiently.\",\"params\":{\"data\":\"aditional data accompanying the transfer.\",\"from\":\"address from which tokens are transfered.\",\"ids\":\"ids of each token type transfered.\",\"to\":\"address to which the token will be transfered.\",\"values\":\"amount of each token type transfered.\"}},\"safeTransferFrom(address,address,uint256,uint256,bytes)\":{\"params\":{\"data\":\"aditional data accompanying the transfer.\",\"from\":\"address from which tokens are transfered.\",\"id\":\"the token type transfered.\",\"to\":\"address to which the token will be transfered.\",\"value\":\"amount of token transfered.\"}},\"setApprovalForAll(address,bool)\":{\"params\":{\"approved\":\"whether to approve or revoke\",\"operator\":\"address which will be granted rights to transfer all tokens of the caller.\"}},\"setBaseURI(string)\":{\"params\":{\"baseURI\":\"The new base URI\"}},\"setMetadataHash(uint256,string)\":{\"params\":{\"metadataHash\":\"The new URI\",\"tokenId\":\"The token id to set URI for\"}},\"setOperatorRegistry(address)\":{\"params\":{\"registry\":\"the address of the registry\"}},\"setTrustedForwarder(address)\":{\"details\":\"Change the address of the trusted forwarder for meta-TX\",\"params\":{\"trustedForwarder\":\"The new trustedForwarder\"}},\"supportsInterface(bytes4)\":{\"params\":{\"interfaceId\":\"the interface identifier, as specified in ERC-165.\"},\"returns\":{\"_0\":\"`true` if the contract implements `interfaceId`.\"}},\"totalSupply(uint256)\":{\"details\":\"Total amount of tokens in with a given id.\"},\"uri(uint256)\":{\"params\":{\"tokenId\":\"The token id to get URI for\"},\"returns\":{\"_0\":\"tokenURI the URI of the token\"}}},\"title\":\"Catalyst\",\"version\":1},\"userdoc\":{\"events\":{\"TrustedForwarderSet(address,address,address)\":{\"notice\":\"Emitted when a `newTrustedForwarder` is set, replacing the `oldTrustedForwarder`\"}},\"kind\":\"user\",\"methods\":{\"addNewCatalystType(string)\":{\"notice\":\"Add a new catalyst type, limited to DEFAULT_ADMIN_ROLE only\"},\"burnBatchFrom(address,uint256[],uint256[])\":{\"notice\":\"Burns a batch of tokens from a specific address\"},\"burnFrom(address,uint256,uint256)\":{\"notice\":\"Burns a specified amount of tokens from a specific address\"},\"getTrustedForwarder()\":{\"notice\":\"return the address of the trusted forwarder\"},\"initialize(string,address,address,address,address,string[],address)\":{\"notice\":\"Initialize the contract, setting up initial values for various features.\"},\"isTrustedForwarder(address)\":{\"notice\":\"return true if the forwarder is the trusted forwarder\"},\"mint(address,uint256,uint256)\":{\"notice\":\"Mints a new token, limited to MINTER_ROLE only\"},\"mintBatch(address,uint256[],uint256[])\":{\"notice\":\"Mints a batch of tokens, limited to MINTER_ROLE only\"},\"registerAndSubscribe(address,bool)\":{\"notice\":\"This function is used to register Catalyst contract on the Operator Filterer Registry of Opensea.can only be called by admin.\"},\"royaltyInfo(uint256,uint256)\":{\"notice\":\"Returns how much royalty is owed and to whom based on ERC2981\"},\"safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)\":{\"notice\":\"Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\"},\"safeTransferFrom(address,address,uint256,uint256,bytes)\":{\"notice\":\"Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\"},\"setApprovalForAll(address,bool)\":{\"notice\":\"Enable or disable approval for `operator` to manage all of the caller's tokens.\"},\"setBaseURI(string)\":{\"notice\":\"Set a new base URI\"},\"setMetadataHash(uint256,string)\":{\"notice\":\"Set a new URI for specific tokenid\"},\"setOperatorRegistry(address)\":{\"notice\":\"sets filter registry address deployed in test\"},\"setTrustedForwarder(address)\":{\"notice\":\"Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\"},\"supportsInterface(bytes4)\":{\"notice\":\"Query if a contract implements interface `id`.\"},\"uri(uint256)\":{\"notice\":\"returns full token URI, including baseURI and token metadata URI\"}},\"notice\":\"THis contract manages catalysts which are used to mint new assets.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"@sandbox-smart-contracts/asset/contracts/Catalyst.sol\":\"Catalyst\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/// @author: manifold.xyz\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\nstruct Recipient {\\n address payable recipient;\\n uint16 bps;\\n}\\n\\ninterface IRoyaltySplitter is IERC165 {\\n /**\\n * @dev Set the splitter recipients. Total bps must total 10000.\\n */\\n function setRecipients(Recipient[] calldata recipients) external;\\n\\n /**\\n * @dev Get the splitter recipients;\\n */\\n function getRecipients() external view returns (Recipient[] memory);\\n}\\n\",\"keccak256\":\"0xc507963f66c4238d25e69d2d05ac5995c549aa89789e89e7a556403221547c6d\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlUpgradeable.sol\\\";\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\\n function __AccessControl_init() internal onlyInitializing {\\n }\\n\\n function __AccessControl_init_unchained() internal onlyInitializing {\\n }\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n StringsUpgradeable.toHexString(account),\\n \\\" is missing role \\\",\\n StringsUpgradeable.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xfeefb24d068524440e1ba885efdf105d91f83504af3c2d745ffacc4595396831\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControlUpgradeable {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0xb8f5302f12138c5561362e88a78d061573e6298b7a1a5afe84a1e2c8d4d5aeaa\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC2981.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Interface for the NFT Royalty Standard.\\n *\\n * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal\\n * support for royalty payments across all NFT marketplaces and ecosystem participants.\\n *\\n * _Available since v4.5._\\n */\\ninterface IERC2981Upgradeable is IERC165Upgradeable {\\n /**\\n * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\\n * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.\\n */\\n function royaltyInfo(\\n uint256 tokenId,\\n uint256 salePrice\\n ) external view returns (address receiver, uint256 royaltyAmount);\\n}\\n\",\"keccak256\":\"0x1a94069aa241fa1ebb4409d02a405c932d3ad7e875bdd5587c88244da210ccdf\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized != type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC1155Upgradeable.sol\\\";\\nimport \\\"./IERC1155ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC1155MetadataURIUpgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the basic standard multi-token.\\n * See https://eips.ethereum.org/EIPS/eip-1155\\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\\n *\\n * _Available since v3.1._\\n */\\ncontract ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155Upgradeable, IERC1155MetadataURIUpgradeable {\\n using AddressUpgradeable for address;\\n\\n // Mapping from token ID to account balances\\n mapping(uint256 => mapping(address => uint256)) private _balances;\\n\\n // Mapping from account to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json\\n string private _uri;\\n\\n /**\\n * @dev See {_setURI}.\\n */\\n function __ERC1155_init(string memory uri_) internal onlyInitializing {\\n __ERC1155_init_unchained(uri_);\\n }\\n\\n function __ERC1155_init_unchained(string memory uri_) internal onlyInitializing {\\n _setURI(uri_);\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return\\n interfaceId == type(IERC1155Upgradeable).interfaceId ||\\n interfaceId == type(IERC1155MetadataURIUpgradeable).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC1155MetadataURI-uri}.\\n *\\n * This implementation returns the same URI for *all* token types. It relies\\n * on the token type ID substitution mechanism\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\\n *\\n * Clients calling this function must replace the `\\\\{id\\\\}` substring with the\\n * actual token type ID.\\n */\\n function uri(uint256) public view virtual override returns (string memory) {\\n return _uri;\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {\\n require(account != address(0), \\\"ERC1155: address zero is not a valid owner\\\");\\n return _balances[id][account];\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOfBatch}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] memory accounts,\\n uint256[] memory ids\\n ) public view virtual override returns (uint256[] memory) {\\n require(accounts.length == ids.length, \\\"ERC1155: accounts and ids length mismatch\\\");\\n\\n uint256[] memory batchBalances = new uint256[](accounts.length);\\n\\n for (uint256 i = 0; i < accounts.length; ++i) {\\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\\n }\\n\\n return batchBalances;\\n }\\n\\n /**\\n * @dev See {IERC1155-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC1155-isApprovedForAll}.\\n */\\n function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[account][operator];\\n }\\n\\n /**\\n * @dev See {IERC1155-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) public virtual override {\\n require(\\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\\n \\\"ERC1155: caller is not token owner or approved\\\"\\n );\\n _safeTransferFrom(from, to, id, amount, data);\\n }\\n\\n /**\\n * @dev See {IERC1155-safeBatchTransferFrom}.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) public virtual override {\\n require(\\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\\n \\\"ERC1155: caller is not token owner or approved\\\"\\n );\\n _safeBatchTransferFrom(from, to, ids, amounts, data);\\n }\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function _safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) internal virtual {\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n\\n address operator = _msgSender();\\n uint256[] memory ids = _asSingletonArray(id);\\n uint256[] memory amounts = _asSingletonArray(amount);\\n\\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n uint256 fromBalance = _balances[id][from];\\n require(fromBalance >= amount, \\\"ERC1155: insufficient balance for transfer\\\");\\n unchecked {\\n _balances[id][from] = fromBalance - amount;\\n }\\n _balances[id][to] += amount;\\n\\n emit TransferSingle(operator, from, to, id, amount);\\n\\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);\\n }\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function _safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual {\\n require(ids.length == amounts.length, \\\"ERC1155: ids and amounts length mismatch\\\");\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n\\n address operator = _msgSender();\\n\\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n for (uint256 i = 0; i < ids.length; ++i) {\\n uint256 id = ids[i];\\n uint256 amount = amounts[i];\\n\\n uint256 fromBalance = _balances[id][from];\\n require(fromBalance >= amount, \\\"ERC1155: insufficient balance for transfer\\\");\\n unchecked {\\n _balances[id][from] = fromBalance - amount;\\n }\\n _balances[id][to] += amount;\\n }\\n\\n emit TransferBatch(operator, from, to, ids, amounts);\\n\\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);\\n }\\n\\n /**\\n * @dev Sets a new URI for all token types, by relying on the token type ID\\n * substitution mechanism\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\\n *\\n * By this mechanism, any occurrence of the `\\\\{id\\\\}` substring in either the\\n * URI or any of the amounts in the JSON file at said URI will be replaced by\\n * clients with the token type ID.\\n *\\n * For example, the `https://token-cdn-domain/\\\\{id\\\\}.json` URI would be\\n * interpreted by clients as\\n * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\\n * for token type ID 0x4cce0.\\n *\\n * See {uri}.\\n *\\n * Because these URIs cannot be meaningfully represented by the {URI} event,\\n * this function emits no events.\\n */\\n function _setURI(string memory newuri) internal virtual {\\n _uri = newuri;\\n }\\n\\n /**\\n * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\\n require(to != address(0), \\\"ERC1155: mint to the zero address\\\");\\n\\n address operator = _msgSender();\\n uint256[] memory ids = _asSingletonArray(id);\\n uint256[] memory amounts = _asSingletonArray(amount);\\n\\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\\n\\n _balances[id][to] += amount;\\n emit TransferSingle(operator, address(0), to, id, amount);\\n\\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\\n\\n _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);\\n }\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function _mintBatch(\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual {\\n require(to != address(0), \\\"ERC1155: mint to the zero address\\\");\\n require(ids.length == amounts.length, \\\"ERC1155: ids and amounts length mismatch\\\");\\n\\n address operator = _msgSender();\\n\\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\\n\\n for (uint256 i = 0; i < ids.length; i++) {\\n _balances[ids[i]][to] += amounts[i];\\n }\\n\\n emit TransferBatch(operator, address(0), to, ids, amounts);\\n\\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\\n\\n _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens of token type `id` from `from`\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `from` must have at least `amount` tokens of token type `id`.\\n */\\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\\n require(from != address(0), \\\"ERC1155: burn from the zero address\\\");\\n\\n address operator = _msgSender();\\n uint256[] memory ids = _asSingletonArray(id);\\n uint256[] memory amounts = _asSingletonArray(amount);\\n\\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \\\"\\\");\\n\\n uint256 fromBalance = _balances[id][from];\\n require(fromBalance >= amount, \\\"ERC1155: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[id][from] = fromBalance - amount;\\n }\\n\\n emit TransferSingle(operator, from, address(0), id, amount);\\n\\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \\\"\\\");\\n }\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n */\\n function _burnBatch(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual {\\n require(from != address(0), \\\"ERC1155: burn from the zero address\\\");\\n require(ids.length == amounts.length, \\\"ERC1155: ids and amounts length mismatch\\\");\\n\\n address operator = _msgSender();\\n\\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \\\"\\\");\\n\\n for (uint256 i = 0; i < ids.length; i++) {\\n uint256 id = ids[i];\\n uint256 amount = amounts[i];\\n\\n uint256 fromBalance = _balances[id][from];\\n require(fromBalance >= amount, \\\"ERC1155: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[id][from] = fromBalance - amount;\\n }\\n }\\n\\n emit TransferBatch(operator, from, address(0), ids, amounts);\\n\\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \\\"\\\");\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\\n require(owner != operator, \\\"ERC1155: setting approval status for self\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting\\n * and burning, as well as batched variants.\\n *\\n * The same hook is called on both single and batched variants. For single\\n * transfers, the length of the `ids` and `amounts` arrays will be 1.\\n *\\n * Calling conditions (for each `id` and `amount` pair):\\n *\\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * of token type `id` will be transferred to `to`.\\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\\n * for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\\n * will be burned.\\n * - `from` and `to` are never both zero.\\n * - `ids` and `amounts` have the same, non-zero length.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting\\n * and burning, as well as batched variants.\\n *\\n * The same hook is called on both single and batched variants. For single\\n * transfers, the length of the `id` and `amount` arrays will be 1.\\n *\\n * Calling conditions (for each `id` and `amount` pair):\\n *\\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * of token type `id` will be transferred to `to`.\\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\\n * for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\\n * will be burned.\\n * - `from` and `to` are never both zero.\\n * - `ids` and `amounts` have the same, non-zero length.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual {}\\n\\n function _doSafeTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try IERC1155ReceiverUpgradeable(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {\\n if (response != IERC1155ReceiverUpgradeable.onERC1155Received.selector) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non-ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n function _doSafeBatchTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (\\n bytes4 response\\n ) {\\n if (response != IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non-ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {\\n uint256[] memory array = new uint256[](1);\\n array[0] = element;\\n\\n return array;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[47] private __gap;\\n}\\n\",\"keccak256\":\"0xc3e465e1fdd0e491688ad75ef1b946e1680e7f9f78bf5beeefd6daed8693c856\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\ninterface IERC1155ReceiverUpgradeable is IERC165Upgradeable {\\n /**\\n * @dev Handles the receipt of a single ERC1155 token type. This function is\\n * called at the end of a `safeTransferFrom` after the balance has been updated.\\n *\\n * NOTE: To accept the transfer, this must return\\n * `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))`\\n * (i.e. 0xf23a6e61, or its own function selector).\\n *\\n * @param operator The address which initiated the transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param id The ID of the token being transferred\\n * @param value The amount of tokens being transferred\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155Received(\\n address operator,\\n address from,\\n uint256 id,\\n uint256 value,\\n bytes calldata data\\n ) external returns (bytes4);\\n\\n /**\\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\\n * is called at the end of a `safeBatchTransferFrom` after the balances have\\n * been updated.\\n *\\n * NOTE: To accept the transfer(s), this must return\\n * `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))`\\n * (i.e. 0xbc197c81, or its own function selector).\\n *\\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xffcb29612efb57efc8f0d4897deb5abaeac830022c59a3aa17446d698dbc856b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155Upgradeable is IERC165Upgradeable {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xf51f292659a77777c0ed7375a39683d8bee53b86a6e7bd0c76f34ce7aa37a3a8\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/extensions/ERC1155Burnable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1155Upgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Extension of {ERC1155} that allows token holders to destroy both their\\n * own tokens and those that they have been approved to use.\\n *\\n * _Available since v3.1._\\n */\\nabstract contract ERC1155BurnableUpgradeable is Initializable, ERC1155Upgradeable {\\n function __ERC1155Burnable_init() internal onlyInitializing {\\n }\\n\\n function __ERC1155Burnable_init_unchained() internal onlyInitializing {\\n }\\n function burn(address account, uint256 id, uint256 value) public virtual {\\n require(\\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\\n \\\"ERC1155: caller is not token owner or approved\\\"\\n );\\n\\n _burn(account, id, value);\\n }\\n\\n function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {\\n require(\\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\\n \\\"ERC1155: caller is not token owner or approved\\\"\\n );\\n\\n _burnBatch(account, ids, values);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x048a492eee88c80ecc0354486e8e0ab99490b44a6fb28833b3cfb45d573f18d7\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1155Upgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Extension of ERC1155 that adds tracking of total supply per id.\\n *\\n * Useful for scenarios where Fungible and Non-fungible tokens have to be\\n * clearly identified. Note: While a totalSupply of 1 might mean the\\n * corresponding is an NFT, there is no guarantees that no other token with the\\n * same id are not going to be minted.\\n */\\nabstract contract ERC1155SupplyUpgradeable is Initializable, ERC1155Upgradeable {\\n function __ERC1155Supply_init() internal onlyInitializing {\\n }\\n\\n function __ERC1155Supply_init_unchained() internal onlyInitializing {\\n }\\n mapping(uint256 => uint256) private _totalSupply;\\n\\n /**\\n * @dev Total amount of tokens in with a given id.\\n */\\n function totalSupply(uint256 id) public view virtual returns (uint256) {\\n return _totalSupply[id];\\n }\\n\\n /**\\n * @dev Indicates whether any token exist with a given id, or not.\\n */\\n function exists(uint256 id) public view virtual returns (bool) {\\n return ERC1155SupplyUpgradeable.totalSupply(id) > 0;\\n }\\n\\n /**\\n * @dev See {ERC1155-_beforeTokenTransfer}.\\n */\\n function _beforeTokenTransfer(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal virtual override {\\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\\n\\n if (from == address(0)) {\\n for (uint256 i = 0; i < ids.length; ++i) {\\n _totalSupply[ids[i]] += amounts[i];\\n }\\n }\\n\\n if (to == address(0)) {\\n for (uint256 i = 0; i < ids.length; ++i) {\\n uint256 id = ids[i];\\n uint256 amount = amounts[i];\\n uint256 supply = _totalSupply[id];\\n require(supply >= amount, \\\"ERC1155: burn amount exceeds totalSupply\\\");\\n unchecked {\\n _totalSupply[id] = supply - amount;\\n }\\n }\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xf7bdbcbb9fcf42997f280db8c02070e9c561406e6971ff680c6c43f92065ac9e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155URIStorage.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../ERC1155Upgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev ERC1155 token with storage based token URI management.\\n * Inspired by the ERC721URIStorage extension\\n *\\n * _Available since v4.6._\\n */\\nabstract contract ERC1155URIStorageUpgradeable is Initializable, ERC1155Upgradeable {\\n function __ERC1155URIStorage_init() internal onlyInitializing {\\n __ERC1155URIStorage_init_unchained();\\n }\\n\\n function __ERC1155URIStorage_init_unchained() internal onlyInitializing {\\n _baseURI = \\\"\\\";\\n }\\n using StringsUpgradeable for uint256;\\n\\n // Optional base URI\\n string private _baseURI;\\n\\n // Optional mapping for token URIs\\n mapping(uint256 => string) private _tokenURIs;\\n\\n /**\\n * @dev See {IERC1155MetadataURI-uri}.\\n *\\n * This implementation returns the concatenation of the `_baseURI`\\n * and the token-specific uri if the latter is set\\n *\\n * This enables the following behaviors:\\n *\\n * - if `_tokenURIs[tokenId]` is set, then the result is the concatenation\\n * of `_baseURI` and `_tokenURIs[tokenId]` (keep in mind that `_baseURI`\\n * is empty per default);\\n *\\n * - if `_tokenURIs[tokenId]` is NOT set then we fallback to `super.uri()`\\n * which in most cases will contain `ERC1155._uri`;\\n *\\n * - if `_tokenURIs[tokenId]` is NOT set, and if the parents do not have a\\n * uri value set, then the result is empty.\\n */\\n function uri(uint256 tokenId) public view virtual override returns (string memory) {\\n string memory tokenURI = _tokenURIs[tokenId];\\n\\n // If token URI is set, concatenate base URI and tokenURI (via abi.encodePacked).\\n return bytes(tokenURI).length > 0 ? string(abi.encodePacked(_baseURI, tokenURI)) : super.uri(tokenId);\\n }\\n\\n /**\\n * @dev Sets `tokenURI` as the tokenURI of `tokenId`.\\n */\\n function _setURI(uint256 tokenId, string memory tokenURI) internal virtual {\\n _tokenURIs[tokenId] = tokenURI;\\n emit URI(uri(tokenId), tokenId);\\n }\\n\\n /**\\n * @dev Sets `baseURI` as the `_baseURI` for all tokens\\n */\\n function _setBaseURI(string memory baseURI) internal virtual {\\n _baseURI = baseURI;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[48] private __gap;\\n}\\n\",\"keccak256\":\"0x9a1218747a17239e2fcab2efc14099379387f114c7ad22c69a23b7d67ec0eaa2\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/IERC1155MetadataURIUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC1155Upgradeable.sol\\\";\\n\\n/**\\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155MetadataURIUpgradeable is IERC1155Upgradeable {\\n /**\\n * @dev Returns the URI for token type `id`.\\n *\\n * If the `\\\\{id\\\\}` substring is present in the URI, it must be replaced by\\n * clients with the actual token type ID.\\n */\\n function uri(uint256 id) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xa350df12a8c10e821af05e0863f44e8317a0efa44df27bfd5dc1d63fdfa3c448\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/common/ERC2981.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../interfaces/IERC2981Upgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.\\n *\\n * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for\\n * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.\\n *\\n * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the\\n * fee is specified in basis points by default.\\n *\\n * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See\\n * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to\\n * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.\\n *\\n * _Available since v4.5._\\n */\\nabstract contract ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable {\\n function __ERC2981_init() internal onlyInitializing {\\n }\\n\\n function __ERC2981_init_unchained() internal onlyInitializing {\\n }\\n struct RoyaltyInfo {\\n address receiver;\\n uint96 royaltyFraction;\\n }\\n\\n RoyaltyInfo private _defaultRoyaltyInfo;\\n mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC165Upgradeable) returns (bool) {\\n return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @inheritdoc IERC2981Upgradeable\\n */\\n function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual override returns (address, uint256) {\\n RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId];\\n\\n if (royalty.receiver == address(0)) {\\n royalty = _defaultRoyaltyInfo;\\n }\\n\\n uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator();\\n\\n return (royalty.receiver, royaltyAmount);\\n }\\n\\n /**\\n * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a\\n * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an\\n * override.\\n */\\n function _feeDenominator() internal pure virtual returns (uint96) {\\n return 10000;\\n }\\n\\n /**\\n * @dev Sets the royalty information that all ids in this contract will default to.\\n *\\n * Requirements:\\n *\\n * - `receiver` cannot be the zero address.\\n * - `feeNumerator` cannot be greater than the fee denominator.\\n */\\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\\n require(feeNumerator <= _feeDenominator(), \\\"ERC2981: royalty fee will exceed salePrice\\\");\\n require(receiver != address(0), \\\"ERC2981: invalid receiver\\\");\\n\\n _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);\\n }\\n\\n /**\\n * @dev Removes default royalty information.\\n */\\n function _deleteDefaultRoyalty() internal virtual {\\n delete _defaultRoyaltyInfo;\\n }\\n\\n /**\\n * @dev Sets the royalty information for a specific token id, overriding the global default.\\n *\\n * Requirements:\\n *\\n * - `receiver` cannot be the zero address.\\n * - `feeNumerator` cannot be greater than the fee denominator.\\n */\\n function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {\\n require(feeNumerator <= _feeDenominator(), \\\"ERC2981: royalty fee will exceed salePrice\\\");\\n require(receiver != address(0), \\\"ERC2981: Invalid parameters\\\");\\n\\n _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);\\n }\\n\\n /**\\n * @dev Resets royalty information for the token id back to the global default.\\n */\\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\\n delete _tokenRoyaltyInfo[tokenId];\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[48] private __gap;\\n}\\n\",\"keccak256\":\"0xaffa1f1de8169c3915df40f96e6fe67628aed4d496c6a835e55763dbd0c28f6f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary MathUpgradeable {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/Catalyst.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport {ERC1155Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol\\\";\\nimport {\\n AccessControlUpgradeable,\\n ContextUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\\\";\\nimport {\\n ERC1155BurnableUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol\\\";\\nimport {\\n ERC1155SupplyUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol\\\";\\nimport {\\n ERC1155URIStorageUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol\\\";\\nimport {\\n IERC165Upgradeable,\\n ERC2981Upgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {\\n OperatorFiltererUpgradeable,\\n IOperatorFilterRegistry\\n} from \\\"@sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol\\\";\\nimport {\\n RoyaltyDistributor\\n} from \\\"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyDistributor.sol\\\";\\nimport {\\n IRoyaltyManager\\n} from \\\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyManager.sol\\\";\\nimport {IERC2981Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\\\";\\nimport {\\n ERC2771HandlerUpgradeable,\\n ERC2771HandlerAbstract\\n} from \\\"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\\\";\\nimport {ICatalyst} from \\\"./interfaces/ICatalyst.sol\\\";\\n\\n/// @title Catalyst\\n/// @author The Sandbox\\n/// @notice THis contract manages catalysts which are used to mint new assets.\\n/// @dev An ERC1155 contract that manages catalysts, extends multiple OpenZeppelin contracts to\\n/// provide a variety of features including, AccessControl, URIStorage, Burnable and more.\\n/// The contract includes support for meta transactions.\\ncontract Catalyst is\\n ICatalyst,\\n Initializable,\\n ERC1155Upgradeable,\\n ERC1155BurnableUpgradeable,\\n ERC1155SupplyUpgradeable,\\n ERC1155URIStorageUpgradeable,\\n ERC2771HandlerUpgradeable,\\n AccessControlUpgradeable,\\n OperatorFiltererUpgradeable,\\n RoyaltyDistributor\\n{\\n bytes32 public constant MINTER_ROLE = keccak256(\\\"MINTER_ROLE\\\");\\n bytes32 public constant BURNER_ROLE = keccak256(\\\"BURNER_ROLE\\\");\\n\\n uint256 public highestTierIndex;\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor() {\\n _disableInitializers();\\n }\\n\\n modifier onlyValidId(uint256 tokenId) {\\n require(tokenId > 0 && tokenId <= highestTierIndex, \\\"Catalyst: invalid catalyst id\\\");\\n _;\\n }\\n\\n /// @notice Initialize the contract, setting up initial values for various features.\\n /// @param _baseUri The base URI for the token metadata, most likely set to ipfs://.\\n /// @param _trustedForwarder The trusted forwarder for meta transactions.\\n /// @param _subscription The subscription address.\\n /// @param _defaultAdmin The default admin address.\\n /// @param _defaultMinter The default minter address.\\n /// @param _catalystIpfsCID The IPFS content identifiers for each catalyst.\\n /// @param _royaltyManager, the address of the Manager contract for common royalty recipient\\n function initialize(\\n string memory _baseUri,\\n address _trustedForwarder,\\n address _subscription,\\n address _defaultAdmin,\\n address _defaultMinter,\\n string[] memory _catalystIpfsCID,\\n address _royaltyManager\\n ) public initializer {\\n require(bytes(_baseUri).length != 0, \\\"Catalyst: base uri can't be empty\\\");\\n require(_trustedForwarder != address(0), \\\"Catalyst: trusted forwarder can't be zero\\\");\\n require(_subscription != address(0), \\\"Catalyst: subscription can't be zero\\\");\\n require(_defaultAdmin != address(0), \\\"Catalyst: admin can't be zero\\\");\\n require(_defaultMinter != address(0), \\\"Catalyst: minter can't be zero\\\");\\n require(_royaltyManager != address(0), \\\"Catalyst: royalty manager can't be zero\\\");\\n __ERC1155_init(_baseUri);\\n __AccessControl_init();\\n __ERC1155Burnable_init();\\n __ERC1155Supply_init();\\n __ERC1155URIStorage_init();\\n __ERC2771Handler_init(_trustedForwarder);\\n __OperatorFilterer_init(_subscription, true);\\n _setBaseURI(_baseUri);\\n _grantRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);\\n _grantRole(MINTER_ROLE, _defaultMinter);\\n __RoyaltyDistributor_init(_royaltyManager);\\n for (uint256 i = 0; i < _catalystIpfsCID.length; i++) {\\n require(bytes(_catalystIpfsCID[i]).length != 0, \\\"Catalyst: CID can't be empty\\\");\\n _setURI(i, _catalystIpfsCID[i]);\\n highestTierIndex = i;\\n }\\n }\\n\\n /// @notice Mints a new token, limited to MINTER_ROLE only\\n /// @param to The address that will own the minted token\\n /// @param id The token id to mint\\n /// @param amount The amount to be minted\\n function mint(\\n address to,\\n uint256 id,\\n uint256 amount\\n ) external onlyRole(MINTER_ROLE) onlyValidId(id) {\\n _mint(to, id, amount, \\\"\\\");\\n }\\n\\n /// @notice Mints a batch of tokens, limited to MINTER_ROLE only\\n /// @param to The address that will own the minted tokens\\n /// @param ids The token ids to mint\\n /// @param amounts The amounts to be minted per token id\\n function mintBatch(\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external onlyRole(MINTER_ROLE) {\\n for (uint256 i = 0; i < ids.length; i++) {\\n require(ids[i] > 0 && ids[i] <= highestTierIndex, \\\"Catalyst: invalid catalyst id\\\");\\n }\\n _mintBatch(to, ids, amounts, \\\"\\\");\\n }\\n\\n /// @notice Burns a specified amount of tokens from a specific address\\n /// @param account The address to burn from\\n /// @param id The token id to burn\\n /// @param amount The amount to be burned\\n function burnFrom(\\n address account,\\n uint256 id,\\n uint256 amount\\n ) external onlyRole(BURNER_ROLE) {\\n _burn(account, id, amount);\\n }\\n\\n /// @notice Burns a batch of tokens from a specific address\\n /// @param account The address to burn from\\n /// @param ids The token ids to burn\\n /// @param amounts The amounts to be burned\\n function burnBatchFrom(\\n address account,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external onlyRole(BURNER_ROLE) {\\n _burnBatch(account, ids, amounts);\\n }\\n\\n /// @notice Add a new catalyst type, limited to DEFAULT_ADMIN_ROLE only\\n /// @param ipfsCID The royalty bps for the catalyst\\n function addNewCatalystType(string memory ipfsCID) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n require(bytes(ipfsCID).length != 0, \\\"Catalyst: CID can't be empty\\\");\\n uint256 newCatId = ++highestTierIndex;\\n ERC1155URIStorageUpgradeable._setURI(newCatId, ipfsCID);\\n emit NewCatalystTypeAdded(newCatId);\\n }\\n\\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\\n /// @dev Change the address of the trusted forwarder for meta-TX\\n /// @param trustedForwarder The new trustedForwarder\\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n require(trustedForwarder != address(0), \\\"Catalyst: trusted forwarder can't be zero address\\\");\\n _setTrustedForwarder(trustedForwarder);\\n }\\n\\n /// @notice Set a new URI for specific tokenid\\n /// @param tokenId The token id to set URI for\\n /// @param metadataHash The new URI\\n function setMetadataHash(uint256 tokenId, string memory metadataHash)\\n external\\n onlyRole(DEFAULT_ADMIN_ROLE)\\n onlyValidId(tokenId)\\n {\\n require(bytes(metadataHash).length != 0, \\\"Catalyst: metadataHash can't be empty\\\");\\n _setURI(tokenId, metadataHash);\\n }\\n\\n /// @notice Set a new base URI\\n /// @param baseURI The new base URI\\n function setBaseURI(string memory baseURI) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n require(bytes(baseURI).length != 0, \\\"Catalyst: base uri can't be empty\\\");\\n _setBaseURI(baseURI);\\n }\\n\\n /// @notice returns full token URI, including baseURI and token metadata URI\\n /// @param tokenId The token id to get URI for\\n /// @return tokenURI the URI of the token\\n function uri(uint256 tokenId)\\n public\\n view\\n override(ERC1155Upgradeable, ERC1155URIStorageUpgradeable)\\n returns (string memory)\\n {\\n return ERC1155URIStorageUpgradeable.uri(tokenId);\\n }\\n\\n /// @dev Needed for meta transactions (see EIP-2771)\\n function _msgSender() internal view virtual override(ContextUpgradeable, ERC2771HandlerAbstract) returns (address) {\\n return ERC2771HandlerAbstract._msgSender();\\n }\\n\\n /// @dev Needed for meta transactions (see EIP-2771)\\n function _msgData()\\n internal\\n view\\n virtual\\n override(ContextUpgradeable, ERC2771HandlerAbstract)\\n returns (bytes calldata)\\n {\\n return ERC2771HandlerAbstract._msgData();\\n }\\n\\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\\n /// @param from address from which tokens are transfered.\\n /// @param to address to which the token will be transfered.\\n /// @param id the token type transfered.\\n /// @param value amount of token transfered.\\n /// @param data aditional data accompanying the transfer.\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 value,\\n bytes memory data\\n ) public override onlyAllowedOperator(from) {\\n super._safeTransferFrom(from, to, id, value, data);\\n }\\n\\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\\n /// @dev call data should be optimized to order ids so packedBalance can be used efficiently.\\n /// @param from address from which tokens are transfered.\\n /// @param to address to which the token will be transfered.\\n /// @param ids ids of each token type transfered.\\n /// @param values amount of each token type transfered.\\n /// @param data aditional data accompanying the transfer.\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory values,\\n bytes memory data\\n ) public override onlyAllowedOperator(from) {\\n super._safeBatchTransferFrom(from, to, ids, values, data);\\n }\\n\\n /// @notice Enable or disable approval for `operator` to manage all of the caller's tokens.\\n /// @param operator address which will be granted rights to transfer all tokens of the caller.\\n /// @param approved whether to approve or revoke\\n function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {\\n super._setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n function _beforeTokenTransfer(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) internal override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) {\\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\\n }\\n\\n /// @notice Query if a contract implements interface `id`.\\n /// @param interfaceId the interface identifier, as specified in ERC-165.\\n /// @return `true` if the contract implements `interfaceId`.\\n function supportsInterface(bytes4 interfaceId)\\n public\\n view\\n override(ERC1155Upgradeable, AccessControlUpgradeable, RoyaltyDistributor)\\n returns (bool)\\n {\\n return super.supportsInterface(interfaceId);\\n }\\n\\n /// @notice This function is used to register Catalyst contract on the Operator Filterer Registry of Opensea.can only be called by admin.\\n /// @dev used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.\\n /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe.\\n /// @param subscribe bool to signify subscription \\\"true\\\"\\\" or to copy the list \\\"false\\\".\\n function registerAndSubscribe(address subscriptionOrRegistrantToCopy, bool subscribe)\\n external\\n onlyRole(DEFAULT_ADMIN_ROLE)\\n {\\n require(subscriptionOrRegistrantToCopy != address(0), \\\"Catalyst: subscription can't be zero address\\\");\\n _registerAndSubscribe(subscriptionOrRegistrantToCopy, subscribe);\\n }\\n\\n /// @notice sets filter registry address deployed in test\\n /// @param registry the address of the registry\\n function setOperatorRegistry(address registry) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n require(registry != address(0), \\\"Catalyst: registry can't be zero address\\\");\\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\\n }\\n}\\n\",\"keccak256\":\"0x0876da7c1b30cb89e4ca0972bf42cf4756bacbac87ef4d2e54dc58caebe462e2\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/asset/contracts/interfaces/ICatalyst.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface ICatalyst {\\n enum CatalystType {TSB_EXCLUSIVE, COMMON, UNCOMMON, RARE, EPIC, LEGENDARY, MYTHIC}\\n\\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\\n event NewCatalystTypeAdded(uint256 catalystId);\\n event DefaultRoyaltyChanged(address indexed newDefaultRoyaltyRecipient, uint256 newDefaultRoyaltyAmount);\\n\\n /// @notice Mints a new token, limited to MINTER_ROLE only\\n /// @param to The address that will own the minted token\\n /// @param id The token id to mint\\n /// @param amount The amount to be minted\\n function mint(\\n address to,\\n uint256 id,\\n uint256 amount\\n ) external;\\n\\n /// @notice Mints a batch of tokens, limited to MINTER_ROLE only\\n /// @param to The address that will own the minted tokens\\n /// @param ids The token ids to mint\\n /// @param amounts The amounts to be minted per token id\\n function mintBatch(\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external;\\n\\n /// @notice Burns a specified amount of tokens from a specific address\\n /// @param account The address to burn from\\n /// @param id The token id to burn\\n /// @param amount The amount to be burned\\n function burnFrom(\\n address account,\\n uint256 id,\\n uint256 amount\\n ) external;\\n\\n /// @notice Burns a batch of tokens from a specific address\\n /// @param account The address to burn from\\n /// @param ids The token ids to burn\\n /// @param amounts The amounts to be burned\\n function burnBatchFrom(\\n address account,\\n uint256[] memory ids,\\n uint256[] memory amounts\\n ) external;\\n\\n /// @notice Add a new catalyst type, limited to DEFAULT_ADMIN_ROLE only\\n /// @param ipfsCID The royalty bps for the catalyst\\n function addNewCatalystType(string memory ipfsCID) external;\\n\\n /// @notice Set a new URI for specific tokenid\\n /// @param tokenId The token id to set URI for\\n /// @param metadataHash The new URI\\n function setMetadataHash(uint256 tokenId, string memory metadataHash) external;\\n\\n /// @notice Set a new base URI\\n /// @param baseURI The new base URI\\n function setBaseURI(string memory baseURI) external;\\n}\\n\",\"keccak256\":\"0x5490f773ea2894927b789486457e4a25cb19508931846469927eb22e22a6a5f8\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerAbstract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\n/// @dev minimal ERC2771 handler to keep bytecode-size down\\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\\nabstract contract ERC2771HandlerAbstract {\\n /// @notice return true if the forwarder is the trusted forwarder\\n /// @param forwarder trusted forwarder address to check\\n /// @return true if the address is the same as the trusted forwarder\\n function isTrustedForwarder(address forwarder) external view returns (bool) {\\n return _isTrustedForwarder(forwarder);\\n }\\n\\n /// @notice if the call is from the trusted forwarder the sender is extracted from calldata, msg.sender otherwise\\n /// @return sender the calculated address of the sender\\n function _msgSender() internal view virtual returns (address sender) {\\n if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\\n // The assembly code is more direct than the Solidity version using `abi.decode`.\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\\n }\\n } else {\\n sender = msg.sender;\\n }\\n }\\n\\n /// @notice if the call is from the trusted forwarder the sender is removed from calldata\\n /// @return the calldata without the sender\\n function _msgData() internal view virtual returns (bytes calldata) {\\n if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\\n return msg.data[:msg.data.length - 20];\\n } else {\\n return msg.data;\\n }\\n }\\n\\n /// @notice return true if the forwarder is the trusted forwarder\\n /// @param forwarder trusted forwarder address to check\\n /// @return true if the address is the same as the trusted forwarder\\n /// @dev this function must be IMPLEMENTED\\n function _isTrustedForwarder(address forwarder) internal view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xc4f349865ea7146f51b69f1edacdef60e0a2a7cf4dab538a5ae53ee9a0036231\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ERC2771HandlerAbstract} from \\\"./ERC2771HandlerAbstract.sol\\\";\\n\\n/// @dev minimal ERC2771 handler to keep bytecode-size down\\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\\ncontract ERC2771HandlerUpgradeable is Initializable, ERC2771HandlerAbstract {\\n address private _trustedForwarder;\\n\\n /// @notice Emitted when a `newTrustedForwarder` is set, replacing the `oldTrustedForwarder`\\n /// @param oldTrustedForwarder old trusted forwarder\\n /// @param newTrustedForwarder new trusted forwarder\\n /// @param operator the sender of the transaction\\n event TrustedForwarderSet(\\n address indexed oldTrustedForwarder,\\n address indexed newTrustedForwarder,\\n address indexed operator\\n );\\n\\n /// @notice initialize the trusted forwarder address\\n /// @param forwarder trusted forwarder address or zero to disable it\\n function __ERC2771Handler_init(address forwarder) internal onlyInitializing {\\n __ERC2771Handler_init_unchained(forwarder);\\n }\\n\\n /// @notice initialize the trusted forwarder address\\n /// @param forwarder trusted forwarder address or zero to disable it\\n function __ERC2771Handler_init_unchained(address forwarder) internal onlyInitializing {\\n _setTrustedForwarder(forwarder);\\n }\\n\\n /// @notice return the address of the trusted forwarder\\n /// @return return the address of the trusted forwarder\\n function getTrustedForwarder() external view returns (address) {\\n return _trustedForwarder;\\n }\\n\\n /// @notice set the address of the trusted forwarder\\n /// @param newForwarder the address of the new forwarder.\\n function _setTrustedForwarder(address newForwarder) internal virtual {\\n require(newForwarder != _trustedForwarder, \\\"ERC2771HandlerUpgradeable: forwarder already set\\\");\\n emit TrustedForwarderSet(_trustedForwarder, newForwarder, _msgSender());\\n _trustedForwarder = newForwarder;\\n }\\n\\n /// @notice return true if the forwarder is the trusted forwarder\\n /// @param forwarder trusted forwarder address to check\\n /// @return true if the address is the same as the trusted forwarder\\n function _isTrustedForwarder(address forwarder) internal view virtual override returns (bool) {\\n return forwarder == _trustedForwarder;\\n }\\n\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x63e53ca5ec229e51d866b0b8e3c8f36056598d9fbf960bb57b4b9731917af16f\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {IOperatorFilterRegistry} from \\\"./interfaces/IOperatorFilterRegistry.sol\\\";\\n\\n///@title OperatorFiltererUpgradeable\\n///@author The SandBox\\n///@notice This contract would subscibe or copy or just to the subscription provided or just register to default subscription list. The operator filter registry's addess could be set using a setter which could be implemented in inherting contract\\nabstract contract OperatorFiltererUpgradeable is Initializable {\\n IOperatorFilterRegistry public operatorFilterRegistry;\\n\\n function __OperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe) internal onlyInitializing {\\n operatorFilterRegistry = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); // Address of the operator filterer registry\\n // If an inheriting token contract is deployed to a network without the registry deployed, the modifier\\n // will not revert, but the contract will need to be registered with the registry once it is deployed in\\n // order for the modifier to filter addresses.\\n _registerAndSubscribe(subscriptionOrRegistrantToCopy, subscribe);\\n }\\n\\n function _registerAndSubscribe(address subscriptionOrRegistrantToCopy, bool subscribe) internal {\\n if (address(operatorFilterRegistry).code.length > 0) {\\n if (!operatorFilterRegistry.isRegistered(address(this))) {\\n if (subscribe) {\\n operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);\\n } else {\\n if (subscriptionOrRegistrantToCopy != address(0)) {\\n operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);\\n } else {\\n operatorFilterRegistry.register(address(this));\\n }\\n }\\n }\\n }\\n }\\n\\n modifier onlyAllowedOperator(address from) virtual {\\n // Check registry code length to facilitate testing in environments without a deployed registry.\\n if (address(operatorFilterRegistry).code.length > 0) {\\n // Allow spending tokens from addresses with balance\\n // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred\\n // from an EOA.\\n if (from == msg.sender) {\\n _;\\n return;\\n }\\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), msg.sender)) {\\n revert(\\\"Operator Not Allowed\\\");\\n }\\n }\\n _;\\n }\\n\\n modifier onlyAllowedOperatorApproval(address operator) virtual {\\n // Check registry code length to facilitate testing in environments without a deployed registry.\\n if (address(operatorFilterRegistry).code.length > 0) {\\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), operator)) {\\n revert(\\\"Operator Not Allowed\\\");\\n }\\n }\\n _;\\n }\\n}\\n\",\"keccak256\":\"0xf6ef88f614515540138818e5a41c4765445b8f4650713476b2f0435af61e70eb\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-operator-filter/contracts/interfaces/IOperatorFilterRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IOperatorFilterRegistry {\\n /**\\n * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns\\n * true if supplied registrant address is not registered.\\n */\\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\\n\\n /**\\n * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.\\n */\\n function register(address registrant) external;\\n\\n /**\\n * @notice Registers an address with the registry and \\\"subscribes\\\" to another address's filtered operators and codeHashes.\\n */\\n function registerAndSubscribe(address registrant, address subscription) external;\\n\\n /**\\n * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another\\n * address without subscribing.\\n */\\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\\n\\n /**\\n * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.\\n * Note that this does not remove any filtered addresses or codeHashes.\\n * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.\\n */\\n function unregister(address addr) external;\\n\\n /**\\n * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered.\\n */\\n function updateOperator(\\n address registrant,\\n address operator,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.\\n */\\n function updateOperators(\\n address registrant,\\n address[] calldata operators,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.\\n */\\n function updateCodeHash(\\n address registrant,\\n bytes32 codehash,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.\\n */\\n function updateCodeHashes(\\n address registrant,\\n bytes32[] calldata codeHashes,\\n bool filtered\\n ) external;\\n\\n /**\\n * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous\\n * subscription if present.\\n * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,\\n * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be\\n * used.\\n */\\n function subscribe(address registrant, address registrantToSubscribe) external;\\n\\n /**\\n * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.\\n */\\n function unsubscribe(address registrant, bool copyExistingEntries) external;\\n\\n /**\\n * @notice Get the subscription address of a given registrant, if any.\\n */\\n function subscriptionOf(address addr) external returns (address registrant);\\n\\n /**\\n * @notice Get the set of addresses subscribed to a given registrant.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function subscribers(address registrant) external returns (address[] memory);\\n\\n /**\\n * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function subscriberAt(address registrant, uint256 index) external returns (address);\\n\\n /**\\n * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.\\n */\\n function copyEntriesOf(address registrant, address registrantToCopy) external;\\n\\n /**\\n * @notice Returns true if operator is filtered by a given address or its subscription.\\n */\\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\\n\\n /**\\n * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription.\\n */\\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\\n\\n /**\\n * @notice Returns true if a codeHash is filtered by a given address or its subscription.\\n */\\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\\n\\n /**\\n * @notice Returns a list of filtered operators for a given address or its subscription.\\n */\\n function filteredOperators(address addr) external returns (address[] memory);\\n\\n /**\\n * @notice Returns the set of filtered codeHashes for a given address or its subscription.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\\n\\n /**\\n * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or\\n * its subscription.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\\n\\n /**\\n * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or\\n * its subscription.\\n * Note that order is not guaranteed as updates are made.\\n */\\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\\n\\n /**\\n * @notice Returns true if an address has registered\\n */\\n function isRegistered(address addr) external returns (bool);\\n\\n /**\\n * @dev Convenience method to compute the code hash of an arbitrary contract\\n */\\n function codeHashOf(address addr) external returns (bytes32);\\n}\\n\",\"keccak256\":\"0xbb4f80a4688ec5c4057fcf1e93d1683cee27bbc2eb9ba45fe02664057a4a14c6\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {IERC2981Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\\\";\\nimport {IRoyaltyManager} from \\\"./interfaces/IRoyaltyManager.sol\\\";\\nimport {\\n ERC165Upgradeable,\\n IERC165Upgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\\\";\\n\\ncontract RoyaltyDistributor is IERC2981Upgradeable, ERC165Upgradeable {\\n uint16 internal constant TOTAL_BASIS_POINTS = 10000;\\n IRoyaltyManager public royaltyManager;\\n\\n function __RoyaltyDistributor_init(address _royaltyManager) internal {\\n royaltyManager = IRoyaltyManager(_royaltyManager);\\n }\\n\\n /// @notice Returns how much royalty is owed and to whom based on ERC2981\\n /// @dev tokenId is one of the EIP2981 args for this function can't be removed\\n /// @param _salePrice the price of token on which the royalty is calculated\\n /// @return receiver the receiver of royalty\\n /// @return royaltyAmount the amount of royalty\\n function royaltyInfo(\\n uint256, /*_tokenId */\\n uint256 _salePrice\\n ) external view returns (address receiver, uint256 royaltyAmount) {\\n uint16 royaltyBps;\\n (receiver, royaltyBps) = royaltyManager.getRoyaltyInfo();\\n royaltyAmount = (_salePrice * royaltyBps) / TOTAL_BASIS_POINTS;\\n return (receiver, royaltyAmount);\\n }\\n\\n /// @notice Query if a contract implements interface `id`.\\n /// @param interfaceId the interface identifier, as specified in ERC-165.\\n /// @return `true` if the contract implements `id`.\\n function supportsInterface(bytes4 interfaceId)\\n public\\n view\\n virtual\\n override(ERC165Upgradeable, IERC165Upgradeable)\\n returns (bool)\\n {\\n return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n}\\n\",\"keccak256\":\"0x087a11a2dbe4658c10d9f334b365f6815568d77bd954241d0218dc0622e1e7d5\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {Recipient} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\n\\ninterface IRoyaltyManager {\\n event RecipientSet(address commonRecipient);\\n\\n event SplitSet(uint16 commonSplit);\\n\\n event RoyaltySet(uint16 royaltyBps, address contractAddress);\\n\\n function setRecipient(address payable _commonRecipient) external;\\n\\n function setSplit(uint16 commonSplit) external;\\n\\n function getCommonRecipient() external view returns (Recipient memory recipient);\\n\\n function getCreatorSplit() external view returns (uint16);\\n\\n function getRoyaltyInfo() external view returns (address payable, uint16);\\n\\n function deploySplitter(address creator, address payable recipient) external returns (address payable);\\n\\n function getCreatorRoyaltySplitter(address creator) external view returns (address payable);\\n\\n function getContractRoyalty(address _contractAddress) external view returns (uint16 royaltyBps);\\n\\n function setTrustedForwarder(address _newForwarder) external;\\n\\n function getTrustedForwarder() external view returns (address);\\n}\\n\",\"keccak256\":\"0x5193f7ce9bce4ac3facefdaa6172e0a0b8868356ca232d33cfb70a24e7b84cc2\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e3565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61468980620000f36000396000f3fe608060405234801561001057600080fd5b50600436106102765760003560e01c80636b20c45411610160578063ce1b815f116100d8578063e985e9c51161008c578063f242432a11610071578063f242432a14610609578063f3bdecc11461061c578063f5298aca1461062f57600080fd5b8063e985e9c5146105b9578063ee295d62146105f557600080fd5b8063d547741f116100bd578063d547741f14610580578063d81d0a1514610593578063da742228146105a657600080fd5b8063ce1b815f14610547578063d53913931461055957600080fd5b80639d28fb861161012f578063a22cb46511610114578063a22cb465146104e8578063b0ccc31e146104fb578063bd85b0391461052757600080fd5b80639d28fb86146104cd578063a217fddf146104e057600080fd5b80636b20c4541461046357806371e0276c14610476578063791459ea1461048057806391d148541461049357600080fd5b80632a55205a116101f35780634e1273f4116101c2578063512c97e9116101a7578063512c97e91461042a57806355f804b31461043d578063572b6c051461045057600080fd5b80634e1273f4146103e85780634f558e791461040857600080fd5b80632a55205a1461037d5780632eb2c2d6146103af5780632f2ff15d146103c257806336568abe146103d557600080fd5b8063156e29f61161024a57806320820ec31161022f57806320820ec31461031f578063248a9ca314610332578063282c51f31461035657600080fd5b8063156e29f6146102f95780631a87b2771461030c57600080fd5b8062fdd58e1461027b57806301ffc9a7146102a15780630e89341c146102c4578063124d91e5146102e4575b600080fd5b61028e6102893660046139d7565b610642565b6040519081526020015b60405180910390f35b6102b46102af366004613a19565b6106f0565b6040519015158152602001610298565b6102d76102d2366004613a36565b6106fb565b6040516102989190613a9f565b6102f76102f2366004613ab2565b610706565b005b6102f7610307366004613ab2565b610741565b6102f761031a366004613b9e565b6107ed565b6102f761032d366004613c70565b6108a4565b61028e610340366004613a36565b600090815261015f602052604090206001015490565b61028e7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84881565b61039061038b366004613ce6565b6108d9565b604080516001600160a01b039093168352602083019190915201610298565b6102f76103bd366004613d08565b61097f565b6102f76103d0366004613db6565b610a8a565b6102f76103e3366004613db6565b610ab5565b6103fb6103f6366004613de6565b610b51565b6040516102989190613ee4565b6102b4610416366004613a36565b600090815260c96020526040902054151590565b6102f7610438366004613ef7565b610c8f565b6102f761044b366004613b9e565b610d7b565b6102b461045e366004613f34565b610e06565b6102f7610471366004613c70565b610e21565b61028e6101935481565b6102f761048e366004613f5f565b610ecc565b6102b46104a1366004613db6565b600091825261015f602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6102f76104db366004613f34565b610f5d565b61028e600081565b6102f76104f6366004613f5f565b611015565b6101915461050f906001600160a01b031681565b6040516001600160a01b039091168152602001610298565b61028e610535366004613a36565b600090815260c9602052604090205490565b61012d546001600160a01b031661050f565b61028e7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6102f761058e366004613db6565b6110fd565b6102f76105a1366004613c70565b611123565b6102f76105b4366004613f34565b611218565b6102b46105c7366004613f8d565b6001600160a01b03918216600090815260666020908152604080832093909416825291909152205460ff1690565b6101925461050f906001600160a01b031681565b6102f7610617366004613fbb565b6112a8565b6102f761062a366004614024565b6113a6565b6102f761063d366004613ab2565b6118b1565b60006001600160a01b0383166106c55760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201527f616c6964206f776e65720000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b5060008181526065602090815260408083206001600160a01b03861684529091529020545b92915050565b60006106ea8261195c565b60606106ea8261199a565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84861073081611a7a565b61073b848484611a8e565b50505050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661076b81611a7a565b8260008111801561077f5750610193548111155b6107cb5760405162461bcd60e51b815260206004820152601d60248201527f436174616c7973743a20696e76616c696420636174616c79737420696400000060448201526064016106bc565b6107e685858560405180602001604052806000815250611c65565b5050505050565b60006107f881611a7a565b81516000036108495760405162461bcd60e51b815260206004820152601c60248201527f436174616c7973743a204349442063616e277420626520656d7074790000000060448201526064016106bc565b60006101936000815461085b90614176565b9182905550905061086c8184611da8565b6040518181527f0fc221b41b73e1c4f9d65566cf090e650d0246fb5c0434a32e9b313a39636d169060200160405180910390a1505050565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a8486108ce81611a7a565b61073b848484611e05565b600080600061019260009054906101000a90046001600160a01b03166001600160a01b031663a86a28d16040518163ffffffff1660e01b81526004016040805180830381865afa158015610931573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109559190614190565b909350905061271061096b61ffff8316866141c6565b61097591906141dd565b9150509250929050565b6101915485906001600160a01b03163b15610a7557336001600160a01b038216036109b6576109b18686868686612097565b610a82565b61019154604051633185c44d60e21b81523060048201523360248201526001600160a01b039091169063c617113490604401602060405180830381865afa158015610a05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a2991906141ff565b610a755760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f77656400000000000000000000000060448201526064016106bc565b610a828686868686612097565b505050505050565b600082815261015f6020526040902060010154610aa681611a7a565b610ab08383612334565b505050565b610abd6123d9565b6001600160a01b0316816001600160a01b031614610b435760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016106bc565b610b4d82826123e8565b5050565b60608151835114610bca5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d61746368000000000000000000000000000000000000000000000060648201526084016106bc565b6000835167ffffffffffffffff811115610be657610be6613ae7565b604051908082528060200260200182016040528015610c0f578160200160208202803683370190505b50905060005b8451811015610c8757610c5a858281518110610c3357610c3361421c565b6020026020010151858381518110610c4d57610c4d61421c565b6020026020010151610642565b828281518110610c6c57610c6c61421c565b6020908102919091010152610c8081614176565b9050610c15565b509392505050565b6000610c9a81611a7a565b82600081118015610cae5750610193548111155b610cfa5760405162461bcd60e51b815260206004820152601d60248201527f436174616c7973743a20696e76616c696420636174616c79737420696400000060448201526064016106bc565b8251600003610d715760405162461bcd60e51b815260206004820152602560248201527f436174616c7973743a206d65746164617461486173682063616e27742062652060448201527f656d70747900000000000000000000000000000000000000000000000000000060648201526084016106bc565b61073b8484611da8565b6000610d8681611a7a565b8151600003610dfd5760405162461bcd60e51b815260206004820152602160248201527f436174616c7973743a2062617365207572692063616e277420626520656d707460448201527f790000000000000000000000000000000000000000000000000000000000000060648201526084016106bc565b610b4d8261248b565b60006106ea8261012d546001600160a01b0391821691161490565b610e296123d9565b6001600160a01b0316836001600160a01b03161480610e4f5750610e4f836105c76123d9565b610ec15760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206f7220617070726f76656400000000000000000000000000000000000060648201526084016106bc565b610ab0838383611e05565b6000610ed781611a7a565b6001600160a01b038316610f535760405162461bcd60e51b815260206004820152602c60248201527f436174616c7973743a20737562736372697074696f6e2063616e27742062652060448201527f7a65726f2061646472657373000000000000000000000000000000000000000060648201526084016106bc565b610ab08383612497565b6000610f6881611a7a565b6001600160a01b038216610fe45760405162461bcd60e51b815260206004820152602860248201527f436174616c7973743a2072656769737472792063616e2774206265207a65726f60448201527f206164647265737300000000000000000000000000000000000000000000000060648201526084016106bc565b50610191805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6101915482906001600160a01b03163b156110eb5761019154604051633185c44d60e21b81523060048201526001600160a01b0383811660248301529091169063c617113490604401602060405180830381865afa15801561107b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109f91906141ff565b6110eb5760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f77656400000000000000000000000060448201526064016106bc565b610ab06110f66123d9565b8484612663565b600082815261015f602052604090206001015461111981611a7a565b610ab083836123e8565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661114d81611a7a565b60005b83518110156111fc57600084828151811061116d5761116d61421c565b602002602001015111801561119e5750610193548482815181106111935761119361421c565b602002602001015111155b6111ea5760405162461bcd60e51b815260206004820152601d60248201527f436174616c7973743a20696e76616c696420636174616c79737420696400000060448201526064016106bc565b806111f481614176565b915050611150565b5061073b84848460405180602001604052806000815250612757565b600061122381611a7a565b6001600160a01b03821661129f5760405162461bcd60e51b815260206004820152603160248201527f436174616c7973743a207472757374656420666f727761726465722063616e2760448201527f74206265207a65726f206164647265737300000000000000000000000000000060648201526084016106bc565b610b4d82612954565b6101915485906001600160a01b03163b1561139957336001600160a01b038216036112da576109b18686868686612a50565b61019154604051633185c44d60e21b81523060048201523360248201526001600160a01b039091169063c617113490604401602060405180830381865afa158015611329573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134d91906141ff565b6113995760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f77656400000000000000000000000060448201526064016106bc565b610a828686868686612a50565b600054610100900460ff16158080156113c65750600054600160ff909116105b806113e05750303b1580156113e0575060005460ff166001145b6114525760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016106bc565b6000805460ff191660011790558015611475576000805461ff0019166101001790555b87516000036114ec5760405162461bcd60e51b815260206004820152602160248201527f436174616c7973743a2062617365207572692063616e277420626520656d707460448201527f790000000000000000000000000000000000000000000000000000000000000060648201526084016106bc565b6001600160a01b0387166115685760405162461bcd60e51b815260206004820152602960248201527f436174616c7973743a207472757374656420666f727761726465722063616e2760448201527f74206265207a65726f000000000000000000000000000000000000000000000060648201526084016106bc565b6001600160a01b0386166115e35760405162461bcd60e51b8152602060048201526024808201527f436174616c7973743a20737562736372697074696f6e2063616e27742062652060448201527f7a65726f0000000000000000000000000000000000000000000000000000000060648201526084016106bc565b6001600160a01b0385166116395760405162461bcd60e51b815260206004820152601d60248201527f436174616c7973743a2061646d696e2063616e2774206265207a65726f00000060448201526064016106bc565b6001600160a01b03841661168f5760405162461bcd60e51b815260206004820152601e60248201527f436174616c7973743a206d696e7465722063616e2774206265207a65726f000060448201526064016106bc565b6001600160a01b03821661170b5760405162461bcd60e51b815260206004820152602760248201527f436174616c7973743a20726f79616c7479206d616e616765722063616e27742060448201527f6265207a65726f0000000000000000000000000000000000000000000000000060648201526084016106bc565b61171488612c43565b61171c612cb7565b611724612cb7565b61172c612cb7565b611734612d24565b61173d87612d97565b611748866001612e0b565b6117518861248b565b61175c600086612334565b6117867f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a685612334565b610192805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03841617905560005b8351811015611860578381815181106117cd576117cd61421c565b6020026020010151516000036118255760405162461bcd60e51b815260206004820152601c60248201527f436174616c7973743a204349442063616e277420626520656d7074790000000060448201526064016106bc565b6118488185838151811061183b5761183b61421c565b6020026020010151611da8565b6101938190558061185881614176565b9150506117b2565b5080156118a7576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b6118b96123d9565b6001600160a01b0316836001600160a01b031614806118df57506118df836105c76123d9565b6119515760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206f7220617070726f76656400000000000000000000000000000000000060648201526084016106bc565b610ab0838383611a8e565b60006001600160e01b031982167f2a55205a0000000000000000000000000000000000000000000000000000000014806106ea57506106ea82612eae565b600081815260fc60205260408120805460609291906119b890614232565b80601f01602080910402602001604051908101604052809291908181526020018280546119e490614232565b8015611a315780601f10611a0657610100808354040283529160200191611a31565b820191906000526020600020905b815481529060010190602001808311611a1457829003601f168201915b505050505090506000815111611a4f57611a4a83612eec565b611a73565b60fb81604051602001611a6392919061426c565b6040516020818303038152906040525b9392505050565b611a8b81611a866123d9565b612f80565b50565b6001600160a01b038316611b0a5760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016106bc565b6000611b146123d9565b90506000611b2184612ff6565b90506000611b2e84612ff6565b9050611b4e83876000858560405180602001604052806000815250613041565b60008581526065602090815260408083206001600160a01b038a16845290915290205484811015611be65760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e63650000000000000000000000000000000000000000000000000000000060648201526084016106bc565b60008681526065602090815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46040805160208101909152600090525b50505050505050565b6001600160a01b038416611ce15760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016106bc565b6000611ceb6123d9565b90506000611cf885612ff6565b90506000611d0585612ff6565b9050611d1683600089858589613041565b60008681526065602090815260408083206001600160a01b038b16845290915281208054879290611d489084906142f3565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611c5c8360008989898961304f565b600082815260fc60205260409020611dc0828261434c565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b611dec846106fb565b604051611df99190613a9f565b60405180910390a25050565b6001600160a01b038316611e815760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016106bc565b8051825114611ee35760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016106bc565b6000611eed6123d9565b9050611f0d81856000868660405180602001604052806000815250613041565b60005b835181101561202a576000848281518110611f2d57611f2d61421c565b602002602001015190506000848381518110611f4b57611f4b61421c565b60209081029190910181015160008481526065835260408082206001600160a01b038c168352909352919091205490915081811015611ff15760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e63650000000000000000000000000000000000000000000000000000000060648201526084016106bc565b60009283526065602090815260408085206001600160a01b038b168652909152909220910390558061202281614176565b915050611f10565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb868660405161207b92919061440c565b60405180910390a460408051602081019091526000905261073b565b81518351146120f95760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016106bc565b6001600160a01b0384166121755760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016106bc565b600061217f6123d9565b905061218f818787878787613041565b60005b84518110156122ce5760008582815181106121af576121af61421c565b6020026020010151905060008583815181106121cd576121cd61421c565b60209081029190910181015160008481526065835260408082206001600160a01b038e1683529093529190912054909150818110156122745760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016106bc565b60008381526065602090815260408083206001600160a01b038e8116855292528083208585039055908b168252812080548492906122b39084906142f3565b92505081905550505050806122c790614176565b9050612192565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161231e92919061440c565b60405180910390a4610a8281878787878761323b565b600082815261015f602090815260408083206001600160a01b038516845290915290205460ff16610b4d57600082815261015f602090815260408083206001600160a01b03851684529091529020805460ff191660011790556123956123d9565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006123e361337e565b905090565b600082815261015f602090815260408083206001600160a01b038516845290915290205460ff1615610b4d57600082815261015f602090815260408083206001600160a01b03851684529091529020805460ff191690556124476123d9565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b60fb610b4d828261434c565b610191546001600160a01b03163b15610b4d57610191546040517fc3c5a5470000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b039091169063c3c5a547906024016020604051808303816000875af115801561250e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061253291906141ff565b610b4d5780156125b857610191546040517f7d3e3dbe0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03848116602483015290911690637d3e3dbe906044015b600060405180830381600087803b1580156125a457600080fd5b505af1158015610a82573d6000803e3d6000fd5b6001600160a01b0382161561261957610191546040517fa0af29030000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0384811660248301529091169063a0af29039060440161258a565b610191546040517f4420e4860000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0390911690634420e4869060240161258a565b816001600160a01b0316836001600160a01b0316036126ea5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084016106bc565b6001600160a01b03838116600081815260666020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0384166127d35760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016106bc565b81518351146128355760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016106bc565b600061283f6123d9565b905061285081600087878787613041565b60005b84518110156128ec5783818151811061286e5761286e61421c565b60200260200101516065600087848151811061288c5761288c61421c565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b0316815260200190815260200160002060008282546128d491906142f3565b909155508190506128e481614176565b915050612853565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161293d92919061440c565b60405180910390a46107e68160008787878761323b565b61012d546001600160a01b03908116908216036129d95760405162461bcd60e51b815260206004820152603060248201527f4552433237373148616e646c65725570677261646561626c653a20666f72776160448201527f7264657220616c7265616479207365740000000000000000000000000000000060648201526084016106bc565b6129e16123d9565b61012d546040516001600160a01b03928316928481169216907f8ca022029d8ff7ad974913f8970aeed6c5e0e7eaf494a0c5b262249f6b5759e590600090a461012d805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001600160a01b038416612acc5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016106bc565b6000612ad66123d9565b90506000612ae385612ff6565b90506000612af085612ff6565b9050612b00838989858589613041565b60008681526065602090815260408083206001600160a01b038c16845290915290205485811015612b995760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016106bc565b60008781526065602090815260408083206001600160a01b038d8116855292528083208985039055908a16825281208054889290612bd89084906142f3565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4612c38848a8a8a8a8a61304f565b505050505050505050565b600054610100900460ff16612cae5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016106bc565b611a8b816133d3565b600054610100900460ff16612d225760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016106bc565b565b600054610100900460ff16612d8f5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016106bc565b612d22613447565b600054610100900460ff16612e025760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016106bc565b611a8b816134ce565b600054610100900460ff16612e765760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016106bc565b610191805473ffffffffffffffffffffffffffffffffffffffff19166daaeb6d7670e522a718067333cd4e179055610b4d8282612497565b60006001600160e01b031982167f7965db0b0000000000000000000000000000000000000000000000000000000014806106ea57506106ea82613542565b606060678054612efb90614232565b80601f0160208091040260200160405190810160405280929190818152602001828054612f2790614232565b8015612f745780601f10612f4957610100808354040283529160200191612f74565b820191906000526020600020905b815481529060010190602001808311612f5757829003601f168201915b50505050509050919050565b600082815261015f602090815260408083206001600160a01b038516845290915290205460ff16610b4d57612fb4816135dd565b612fbf8360206135ef565b604051602001612fd092919061443a565b60408051601f198184030181529082905262461bcd60e51b82526106bc91600401613a9f565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106130305761303061421c565b602090810291909101015292915050565b610a82868686868686613818565b6001600160a01b0384163b15610a82576040517ff23a6e610000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063f23a6e61906130ac90899089908890889088906004016144bb565b6020604051808303816000875af19250505080156130e7575060408051601f3d908101601f191682019092526130e4918101906144fe565b60015b61319c576130f361451b565b806308c379a00361312c5750613107614536565b80613112575061312e565b8060405162461bcd60e51b81526004016106bc9190613a9f565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d4552433131353560448201527f526563656976657220696d706c656d656e74657200000000000000000000000060648201526084016106bc565b6001600160e01b031981167ff23a6e610000000000000000000000000000000000000000000000000000000014611c5c5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016106bc565b6001600160a01b0384163b15610a82576040517fbc197c810000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063bc197c819061329890899089908890889088906004016145de565b6020604051808303816000875af19250505080156132d3575060408051601f3d908101601f191682019092526132d0918101906144fe565b60015b6132df576130f361451b565b6001600160e01b031981167fbc197c810000000000000000000000000000000000000000000000000000000014611c5c5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016106bc565b61012d546000906001600160a01b03163314801561339d575060143610155b156133cd57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b50335b90565b600054610100900460ff1661343e5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016106bc565b611a8b816139a6565b600054610100900460ff166134b25760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016106bc565b60408051602081019091526000815260fb90611a8b908261434c565b600054610100900460ff166135395760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016106bc565b611a8b81612954565b60006001600160e01b031982167fd9b67a260000000000000000000000000000000000000000000000000000000014806135a557506001600160e01b031982167f0e89341c00000000000000000000000000000000000000000000000000000000145b806106ea57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146106ea565b60606106ea6001600160a01b03831660145b606060006135fe8360026141c6565b6136099060026142f3565b67ffffffffffffffff81111561362157613621613ae7565b6040519080825280601f01601f19166020018201604052801561364b576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106136825761368261421c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106136e5576136e561421c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006137218460026141c6565b61372c9060016142f3565b90505b60018111156137c9577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061376d5761376d61421c565b1a60f81b8282815181106137835761378361421c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936137c28161463c565b905061372f565b508315611a735760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016106bc565b6001600160a01b03851661389f5760005b835181101561389d578281815181106138445761384461421c565b602002602001015160c960008684815181106138625761386261421c565b60200260200101518152602001908152602001600020600082825461388791906142f3565b90915550613896905081614176565b9050613829565b505b6001600160a01b038416610a825760005b8351811015611c5c5760008482815181106138cd576138cd61421c565b6020026020010151905060008483815181106138eb576138eb61421c565b60200260200101519050600060c96000848152602001908152602001600020549050818110156139835760405162461bcd60e51b815260206004820152602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f7460448201527f616c537570706c7900000000000000000000000000000000000000000000000060648201526084016106bc565b600092835260c960205260409092209103905561399f81614176565b90506138b0565b6067610b4d828261434c565b6001600160a01b0381168114611a8b57600080fd5b80356139d2816139b2565b919050565b600080604083850312156139ea57600080fd5b82356139f5816139b2565b946020939093013593505050565b6001600160e01b031981168114611a8b57600080fd5b600060208284031215613a2b57600080fd5b8135611a7381613a03565b600060208284031215613a4857600080fd5b5035919050565b60005b83811015613a6a578181015183820152602001613a52565b50506000910152565b60008151808452613a8b816020860160208601613a4f565b601f01601f19169290920160200192915050565b602081526000611a736020830184613a73565b600080600060608486031215613ac757600080fd5b8335613ad2816139b2565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff82111715613b2357613b23613ae7565b6040525050565b600082601f830112613b3b57600080fd5b813567ffffffffffffffff811115613b5557613b55613ae7565b604051613b6c6020601f19601f8501160182613afd565b818152846020838601011115613b8157600080fd5b816020850160208301376000918101602001919091529392505050565b600060208284031215613bb057600080fd5b813567ffffffffffffffff811115613bc757600080fd5b613bd384828501613b2a565b949350505050565b600067ffffffffffffffff821115613bf557613bf5613ae7565b5060051b60200190565b600082601f830112613c1057600080fd5b81356020613c1d82613bdb565b604051613c2a8282613afd565b83815260059390931b8501820192828101915086841115613c4a57600080fd5b8286015b84811015613c655780358352918301918301613c4e565b509695505050505050565b600080600060608486031215613c8557600080fd5b8335613c90816139b2565b9250602084013567ffffffffffffffff80821115613cad57600080fd5b613cb987838801613bff565b93506040860135915080821115613ccf57600080fd5b50613cdc86828701613bff565b9150509250925092565b60008060408385031215613cf957600080fd5b50508035926020909101359150565b600080600080600060a08688031215613d2057600080fd5b8535613d2b816139b2565b94506020860135613d3b816139b2565b9350604086013567ffffffffffffffff80821115613d5857600080fd5b613d6489838a01613bff565b94506060880135915080821115613d7a57600080fd5b613d8689838a01613bff565b93506080880135915080821115613d9c57600080fd5b50613da988828901613b2a565b9150509295509295909350565b60008060408385031215613dc957600080fd5b823591506020830135613ddb816139b2565b809150509250929050565b60008060408385031215613df957600080fd5b823567ffffffffffffffff80821115613e1157600080fd5b818501915085601f830112613e2557600080fd5b81356020613e3282613bdb565b604051613e3f8282613afd565b83815260059390931b8501820192828101915089841115613e5f57600080fd5b948201945b83861015613e86578535613e77816139b2565b82529482019490820190613e64565b96505086013592505080821115613e9c57600080fd5b5061097585828601613bff565b600081518084526020808501945080840160005b83811015613ed957815187529582019590820190600101613ebd565b509495945050505050565b602081526000611a736020830184613ea9565b60008060408385031215613f0a57600080fd5b82359150602083013567ffffffffffffffff811115613f2857600080fd5b61097585828601613b2a565b600060208284031215613f4657600080fd5b8135611a73816139b2565b8015158114611a8b57600080fd5b60008060408385031215613f7257600080fd5b8235613f7d816139b2565b91506020830135613ddb81613f51565b60008060408385031215613fa057600080fd5b8235613fab816139b2565b91506020830135613ddb816139b2565b600080600080600060a08688031215613fd357600080fd5b8535613fde816139b2565b94506020860135613fee816139b2565b93506040860135925060608601359150608086013567ffffffffffffffff81111561401857600080fd5b613da988828901613b2a565b600080600080600080600060e0888a03121561403f57600080fd5b67ffffffffffffffff808935111561405657600080fd5b6140638a8a358b01613b2a565b97506020890135614073816139b2565b96506040890135614083816139b2565b95506060890135614093816139b2565b945060808901356140a3816139b2565b935060a0890135818111156140b757600080fd5b8901601f81018b136140c857600080fd5b80356140d381613bdb565b6040516140e08282613afd565b80915082815260208101915060208360051b85010192508d83111561410457600080fd5b602084015b8381101561413d57858135111561411f57600080fd5b61412f8f60208335880101613b2a565b835260209283019201614109565b50809650505050505061415260c089016139c7565b905092959891949750929550565b634e487b7160e01b600052601160045260246000fd5b6000600019820361418957614189614160565b5060010190565b600080604083850312156141a357600080fd5b82516141ae816139b2565b602084015190925061ffff81168114613ddb57600080fd5b80820281158282048414176106ea576106ea614160565b6000826141fa57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561421157600080fd5b8151611a7381613f51565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061424657607f821691505b60208210810361426657634e487b7160e01b600052602260045260246000fd5b50919050565b600080845461427a81614232565b6001828116801561429257600181146142a7576142d6565b60ff19841687528215158302870194506142d6565b8860005260208060002060005b858110156142cd5781548a8201529084019082016142b4565b50505082870194505b5050505083516142ea818360208801613a4f565b01949350505050565b808201808211156106ea576106ea614160565b601f821115610ab057600081815260208120601f850160051c8101602086101561432d5750805b601f850160051c820191505b81811015610a8257828155600101614339565b815167ffffffffffffffff81111561436657614366613ae7565b61437a816143748454614232565b84614306565b602080601f8311600181146143af57600084156143975750858301515b600019600386901b1c1916600185901b178555610a82565b600085815260208120601f198616915b828110156143de578886015182559484019460019091019084016143bf565b50858210156143fc5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60408152600061441f6040830185613ea9565b82810360208401526144318185613ea9565b95945050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614472816017850160208801613a4f565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516144af816028840160208801613a4f565b01602801949350505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a060808301526144f360a0830184613a73565b979650505050505050565b60006020828403121561451057600080fd5b8151611a7381613a03565b600060033d11156133d05760046000803e5060005160e01c90565b600060443d10156145445790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff816024840111818411171561459257505050505090565b82850191508151818111156145aa5750505050505090565b843d87010160208285010111156145c45750505050505090565b6145d360208286010187613afd565b509095945050505050565b60006001600160a01b03808816835280871660208401525060a0604083015261460a60a0830186613ea9565b828103606084015261461c8186613ea9565b905082810360808401526146308185613a73565b98975050505050505050565b60008161464b5761464b614160565b50600019019056fea2646970667358221220530526f6a876f380b79cae4b59969012e959ff9004f3d0f8dfbf6d220fa3cf2c64736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102765760003560e01c80636b20c45411610160578063ce1b815f116100d8578063e985e9c51161008c578063f242432a11610071578063f242432a14610609578063f3bdecc11461061c578063f5298aca1461062f57600080fd5b8063e985e9c5146105b9578063ee295d62146105f557600080fd5b8063d547741f116100bd578063d547741f14610580578063d81d0a1514610593578063da742228146105a657600080fd5b8063ce1b815f14610547578063d53913931461055957600080fd5b80639d28fb861161012f578063a22cb46511610114578063a22cb465146104e8578063b0ccc31e146104fb578063bd85b0391461052757600080fd5b80639d28fb86146104cd578063a217fddf146104e057600080fd5b80636b20c4541461046357806371e0276c14610476578063791459ea1461048057806391d148541461049357600080fd5b80632a55205a116101f35780634e1273f4116101c2578063512c97e9116101a7578063512c97e91461042a57806355f804b31461043d578063572b6c051461045057600080fd5b80634e1273f4146103e85780634f558e791461040857600080fd5b80632a55205a1461037d5780632eb2c2d6146103af5780632f2ff15d146103c257806336568abe146103d557600080fd5b8063156e29f61161024a57806320820ec31161022f57806320820ec31461031f578063248a9ca314610332578063282c51f31461035657600080fd5b8063156e29f6146102f95780631a87b2771461030c57600080fd5b8062fdd58e1461027b57806301ffc9a7146102a15780630e89341c146102c4578063124d91e5146102e4575b600080fd5b61028e6102893660046139d7565b610642565b6040519081526020015b60405180910390f35b6102b46102af366004613a19565b6106f0565b6040519015158152602001610298565b6102d76102d2366004613a36565b6106fb565b6040516102989190613a9f565b6102f76102f2366004613ab2565b610706565b005b6102f7610307366004613ab2565b610741565b6102f761031a366004613b9e565b6107ed565b6102f761032d366004613c70565b6108a4565b61028e610340366004613a36565b600090815261015f602052604090206001015490565b61028e7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84881565b61039061038b366004613ce6565b6108d9565b604080516001600160a01b039093168352602083019190915201610298565b6102f76103bd366004613d08565b61097f565b6102f76103d0366004613db6565b610a8a565b6102f76103e3366004613db6565b610ab5565b6103fb6103f6366004613de6565b610b51565b6040516102989190613ee4565b6102b4610416366004613a36565b600090815260c96020526040902054151590565b6102f7610438366004613ef7565b610c8f565b6102f761044b366004613b9e565b610d7b565b6102b461045e366004613f34565b610e06565b6102f7610471366004613c70565b610e21565b61028e6101935481565b6102f761048e366004613f5f565b610ecc565b6102b46104a1366004613db6565b600091825261015f602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6102f76104db366004613f34565b610f5d565b61028e600081565b6102f76104f6366004613f5f565b611015565b6101915461050f906001600160a01b031681565b6040516001600160a01b039091168152602001610298565b61028e610535366004613a36565b600090815260c9602052604090205490565b61012d546001600160a01b031661050f565b61028e7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6102f761058e366004613db6565b6110fd565b6102f76105a1366004613c70565b611123565b6102f76105b4366004613f34565b611218565b6102b46105c7366004613f8d565b6001600160a01b03918216600090815260666020908152604080832093909416825291909152205460ff1690565b6101925461050f906001600160a01b031681565b6102f7610617366004613fbb565b6112a8565b6102f761062a366004614024565b6113a6565b6102f761063d366004613ab2565b6118b1565b60006001600160a01b0383166106c55760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201527f616c6964206f776e65720000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b5060008181526065602090815260408083206001600160a01b03861684529091529020545b92915050565b60006106ea8261195c565b60606106ea8261199a565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84861073081611a7a565b61073b848484611a8e565b50505050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661076b81611a7a565b8260008111801561077f5750610193548111155b6107cb5760405162461bcd60e51b815260206004820152601d60248201527f436174616c7973743a20696e76616c696420636174616c79737420696400000060448201526064016106bc565b6107e685858560405180602001604052806000815250611c65565b5050505050565b60006107f881611a7a565b81516000036108495760405162461bcd60e51b815260206004820152601c60248201527f436174616c7973743a204349442063616e277420626520656d7074790000000060448201526064016106bc565b60006101936000815461085b90614176565b9182905550905061086c8184611da8565b6040518181527f0fc221b41b73e1c4f9d65566cf090e650d0246fb5c0434a32e9b313a39636d169060200160405180910390a1505050565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a8486108ce81611a7a565b61073b848484611e05565b600080600061019260009054906101000a90046001600160a01b03166001600160a01b031663a86a28d16040518163ffffffff1660e01b81526004016040805180830381865afa158015610931573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109559190614190565b909350905061271061096b61ffff8316866141c6565b61097591906141dd565b9150509250929050565b6101915485906001600160a01b03163b15610a7557336001600160a01b038216036109b6576109b18686868686612097565b610a82565b61019154604051633185c44d60e21b81523060048201523360248201526001600160a01b039091169063c617113490604401602060405180830381865afa158015610a05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a2991906141ff565b610a755760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f77656400000000000000000000000060448201526064016106bc565b610a828686868686612097565b505050505050565b600082815261015f6020526040902060010154610aa681611a7a565b610ab08383612334565b505050565b610abd6123d9565b6001600160a01b0316816001600160a01b031614610b435760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016106bc565b610b4d82826123e8565b5050565b60608151835114610bca5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d61746368000000000000000000000000000000000000000000000060648201526084016106bc565b6000835167ffffffffffffffff811115610be657610be6613ae7565b604051908082528060200260200182016040528015610c0f578160200160208202803683370190505b50905060005b8451811015610c8757610c5a858281518110610c3357610c3361421c565b6020026020010151858381518110610c4d57610c4d61421c565b6020026020010151610642565b828281518110610c6c57610c6c61421c565b6020908102919091010152610c8081614176565b9050610c15565b509392505050565b6000610c9a81611a7a565b82600081118015610cae5750610193548111155b610cfa5760405162461bcd60e51b815260206004820152601d60248201527f436174616c7973743a20696e76616c696420636174616c79737420696400000060448201526064016106bc565b8251600003610d715760405162461bcd60e51b815260206004820152602560248201527f436174616c7973743a206d65746164617461486173682063616e27742062652060448201527f656d70747900000000000000000000000000000000000000000000000000000060648201526084016106bc565b61073b8484611da8565b6000610d8681611a7a565b8151600003610dfd5760405162461bcd60e51b815260206004820152602160248201527f436174616c7973743a2062617365207572692063616e277420626520656d707460448201527f790000000000000000000000000000000000000000000000000000000000000060648201526084016106bc565b610b4d8261248b565b60006106ea8261012d546001600160a01b0391821691161490565b610e296123d9565b6001600160a01b0316836001600160a01b03161480610e4f5750610e4f836105c76123d9565b610ec15760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206f7220617070726f76656400000000000000000000000000000000000060648201526084016106bc565b610ab0838383611e05565b6000610ed781611a7a565b6001600160a01b038316610f535760405162461bcd60e51b815260206004820152602c60248201527f436174616c7973743a20737562736372697074696f6e2063616e27742062652060448201527f7a65726f2061646472657373000000000000000000000000000000000000000060648201526084016106bc565b610ab08383612497565b6000610f6881611a7a565b6001600160a01b038216610fe45760405162461bcd60e51b815260206004820152602860248201527f436174616c7973743a2072656769737472792063616e2774206265207a65726f60448201527f206164647265737300000000000000000000000000000000000000000000000060648201526084016106bc565b50610191805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6101915482906001600160a01b03163b156110eb5761019154604051633185c44d60e21b81523060048201526001600160a01b0383811660248301529091169063c617113490604401602060405180830381865afa15801561107b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109f91906141ff565b6110eb5760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f77656400000000000000000000000060448201526064016106bc565b610ab06110f66123d9565b8484612663565b600082815261015f602052604090206001015461111981611a7a565b610ab083836123e8565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661114d81611a7a565b60005b83518110156111fc57600084828151811061116d5761116d61421c565b602002602001015111801561119e5750610193548482815181106111935761119361421c565b602002602001015111155b6111ea5760405162461bcd60e51b815260206004820152601d60248201527f436174616c7973743a20696e76616c696420636174616c79737420696400000060448201526064016106bc565b806111f481614176565b915050611150565b5061073b84848460405180602001604052806000815250612757565b600061122381611a7a565b6001600160a01b03821661129f5760405162461bcd60e51b815260206004820152603160248201527f436174616c7973743a207472757374656420666f727761726465722063616e2760448201527f74206265207a65726f206164647265737300000000000000000000000000000060648201526084016106bc565b610b4d82612954565b6101915485906001600160a01b03163b1561139957336001600160a01b038216036112da576109b18686868686612a50565b61019154604051633185c44d60e21b81523060048201523360248201526001600160a01b039091169063c617113490604401602060405180830381865afa158015611329573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134d91906141ff565b6113995760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f77656400000000000000000000000060448201526064016106bc565b610a828686868686612a50565b600054610100900460ff16158080156113c65750600054600160ff909116105b806113e05750303b1580156113e0575060005460ff166001145b6114525760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016106bc565b6000805460ff191660011790558015611475576000805461ff0019166101001790555b87516000036114ec5760405162461bcd60e51b815260206004820152602160248201527f436174616c7973743a2062617365207572692063616e277420626520656d707460448201527f790000000000000000000000000000000000000000000000000000000000000060648201526084016106bc565b6001600160a01b0387166115685760405162461bcd60e51b815260206004820152602960248201527f436174616c7973743a207472757374656420666f727761726465722063616e2760448201527f74206265207a65726f000000000000000000000000000000000000000000000060648201526084016106bc565b6001600160a01b0386166115e35760405162461bcd60e51b8152602060048201526024808201527f436174616c7973743a20737562736372697074696f6e2063616e27742062652060448201527f7a65726f0000000000000000000000000000000000000000000000000000000060648201526084016106bc565b6001600160a01b0385166116395760405162461bcd60e51b815260206004820152601d60248201527f436174616c7973743a2061646d696e2063616e2774206265207a65726f00000060448201526064016106bc565b6001600160a01b03841661168f5760405162461bcd60e51b815260206004820152601e60248201527f436174616c7973743a206d696e7465722063616e2774206265207a65726f000060448201526064016106bc565b6001600160a01b03821661170b5760405162461bcd60e51b815260206004820152602760248201527f436174616c7973743a20726f79616c7479206d616e616765722063616e27742060448201527f6265207a65726f0000000000000000000000000000000000000000000000000060648201526084016106bc565b61171488612c43565b61171c612cb7565b611724612cb7565b61172c612cb7565b611734612d24565b61173d87612d97565b611748866001612e0b565b6117518861248b565b61175c600086612334565b6117867f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a685612334565b610192805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03841617905560005b8351811015611860578381815181106117cd576117cd61421c565b6020026020010151516000036118255760405162461bcd60e51b815260206004820152601c60248201527f436174616c7973743a204349442063616e277420626520656d7074790000000060448201526064016106bc565b6118488185838151811061183b5761183b61421c565b6020026020010151611da8565b6101938190558061185881614176565b9150506117b2565b5080156118a7576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b6118b96123d9565b6001600160a01b0316836001600160a01b031614806118df57506118df836105c76123d9565b6119515760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206f7220617070726f76656400000000000000000000000000000000000060648201526084016106bc565b610ab0838383611a8e565b60006001600160e01b031982167f2a55205a0000000000000000000000000000000000000000000000000000000014806106ea57506106ea82612eae565b600081815260fc60205260408120805460609291906119b890614232565b80601f01602080910402602001604051908101604052809291908181526020018280546119e490614232565b8015611a315780601f10611a0657610100808354040283529160200191611a31565b820191906000526020600020905b815481529060010190602001808311611a1457829003601f168201915b505050505090506000815111611a4f57611a4a83612eec565b611a73565b60fb81604051602001611a6392919061426c565b6040516020818303038152906040525b9392505050565b611a8b81611a866123d9565b612f80565b50565b6001600160a01b038316611b0a5760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016106bc565b6000611b146123d9565b90506000611b2184612ff6565b90506000611b2e84612ff6565b9050611b4e83876000858560405180602001604052806000815250613041565b60008581526065602090815260408083206001600160a01b038a16845290915290205484811015611be65760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e63650000000000000000000000000000000000000000000000000000000060648201526084016106bc565b60008681526065602090815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46040805160208101909152600090525b50505050505050565b6001600160a01b038416611ce15760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016106bc565b6000611ceb6123d9565b90506000611cf885612ff6565b90506000611d0585612ff6565b9050611d1683600089858589613041565b60008681526065602090815260408083206001600160a01b038b16845290915281208054879290611d489084906142f3565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611c5c8360008989898961304f565b600082815260fc60205260409020611dc0828261434c565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b611dec846106fb565b604051611df99190613a9f565b60405180910390a25050565b6001600160a01b038316611e815760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016106bc565b8051825114611ee35760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016106bc565b6000611eed6123d9565b9050611f0d81856000868660405180602001604052806000815250613041565b60005b835181101561202a576000848281518110611f2d57611f2d61421c565b602002602001015190506000848381518110611f4b57611f4b61421c565b60209081029190910181015160008481526065835260408082206001600160a01b038c168352909352919091205490915081811015611ff15760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e63650000000000000000000000000000000000000000000000000000000060648201526084016106bc565b60009283526065602090815260408085206001600160a01b038b168652909152909220910390558061202281614176565b915050611f10565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb868660405161207b92919061440c565b60405180910390a460408051602081019091526000905261073b565b81518351146120f95760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016106bc565b6001600160a01b0384166121755760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016106bc565b600061217f6123d9565b905061218f818787878787613041565b60005b84518110156122ce5760008582815181106121af576121af61421c565b6020026020010151905060008583815181106121cd576121cd61421c565b60209081029190910181015160008481526065835260408082206001600160a01b038e1683529093529190912054909150818110156122745760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016106bc565b60008381526065602090815260408083206001600160a01b038e8116855292528083208585039055908b168252812080548492906122b39084906142f3565b92505081905550505050806122c790614176565b9050612192565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161231e92919061440c565b60405180910390a4610a8281878787878761323b565b600082815261015f602090815260408083206001600160a01b038516845290915290205460ff16610b4d57600082815261015f602090815260408083206001600160a01b03851684529091529020805460ff191660011790556123956123d9565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006123e361337e565b905090565b600082815261015f602090815260408083206001600160a01b038516845290915290205460ff1615610b4d57600082815261015f602090815260408083206001600160a01b03851684529091529020805460ff191690556124476123d9565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b60fb610b4d828261434c565b610191546001600160a01b03163b15610b4d57610191546040517fc3c5a5470000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b039091169063c3c5a547906024016020604051808303816000875af115801561250e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061253291906141ff565b610b4d5780156125b857610191546040517f7d3e3dbe0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03848116602483015290911690637d3e3dbe906044015b600060405180830381600087803b1580156125a457600080fd5b505af1158015610a82573d6000803e3d6000fd5b6001600160a01b0382161561261957610191546040517fa0af29030000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0384811660248301529091169063a0af29039060440161258a565b610191546040517f4420e4860000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0390911690634420e4869060240161258a565b816001600160a01b0316836001600160a01b0316036126ea5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084016106bc565b6001600160a01b03838116600081815260666020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0384166127d35760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016106bc565b81518351146128355760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016106bc565b600061283f6123d9565b905061285081600087878787613041565b60005b84518110156128ec5783818151811061286e5761286e61421c565b60200260200101516065600087848151811061288c5761288c61421c565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b0316815260200190815260200160002060008282546128d491906142f3565b909155508190506128e481614176565b915050612853565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161293d92919061440c565b60405180910390a46107e68160008787878761323b565b61012d546001600160a01b03908116908216036129d95760405162461bcd60e51b815260206004820152603060248201527f4552433237373148616e646c65725570677261646561626c653a20666f72776160448201527f7264657220616c7265616479207365740000000000000000000000000000000060648201526084016106bc565b6129e16123d9565b61012d546040516001600160a01b03928316928481169216907f8ca022029d8ff7ad974913f8970aeed6c5e0e7eaf494a0c5b262249f6b5759e590600090a461012d805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001600160a01b038416612acc5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016106bc565b6000612ad66123d9565b90506000612ae385612ff6565b90506000612af085612ff6565b9050612b00838989858589613041565b60008681526065602090815260408083206001600160a01b038c16845290915290205485811015612b995760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016106bc565b60008781526065602090815260408083206001600160a01b038d8116855292528083208985039055908a16825281208054889290612bd89084906142f3565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4612c38848a8a8a8a8a61304f565b505050505050505050565b600054610100900460ff16612cae5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016106bc565b611a8b816133d3565b600054610100900460ff16612d225760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016106bc565b565b600054610100900460ff16612d8f5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016106bc565b612d22613447565b600054610100900460ff16612e025760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016106bc565b611a8b816134ce565b600054610100900460ff16612e765760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016106bc565b610191805473ffffffffffffffffffffffffffffffffffffffff19166daaeb6d7670e522a718067333cd4e179055610b4d8282612497565b60006001600160e01b031982167f7965db0b0000000000000000000000000000000000000000000000000000000014806106ea57506106ea82613542565b606060678054612efb90614232565b80601f0160208091040260200160405190810160405280929190818152602001828054612f2790614232565b8015612f745780601f10612f4957610100808354040283529160200191612f74565b820191906000526020600020905b815481529060010190602001808311612f5757829003601f168201915b50505050509050919050565b600082815261015f602090815260408083206001600160a01b038516845290915290205460ff16610b4d57612fb4816135dd565b612fbf8360206135ef565b604051602001612fd092919061443a565b60408051601f198184030181529082905262461bcd60e51b82526106bc91600401613a9f565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106130305761303061421c565b602090810291909101015292915050565b610a82868686868686613818565b6001600160a01b0384163b15610a82576040517ff23a6e610000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063f23a6e61906130ac90899089908890889088906004016144bb565b6020604051808303816000875af19250505080156130e7575060408051601f3d908101601f191682019092526130e4918101906144fe565b60015b61319c576130f361451b565b806308c379a00361312c5750613107614536565b80613112575061312e565b8060405162461bcd60e51b81526004016106bc9190613a9f565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d4552433131353560448201527f526563656976657220696d706c656d656e74657200000000000000000000000060648201526084016106bc565b6001600160e01b031981167ff23a6e610000000000000000000000000000000000000000000000000000000014611c5c5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016106bc565b6001600160a01b0384163b15610a82576040517fbc197c810000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063bc197c819061329890899089908890889088906004016145de565b6020604051808303816000875af19250505080156132d3575060408051601f3d908101601f191682019092526132d0918101906144fe565b60015b6132df576130f361451b565b6001600160e01b031981167fbc197c810000000000000000000000000000000000000000000000000000000014611c5c5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016106bc565b61012d546000906001600160a01b03163314801561339d575060143610155b156133cd57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b50335b90565b600054610100900460ff1661343e5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016106bc565b611a8b816139a6565b600054610100900460ff166134b25760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016106bc565b60408051602081019091526000815260fb90611a8b908261434c565b600054610100900460ff166135395760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016106bc565b611a8b81612954565b60006001600160e01b031982167fd9b67a260000000000000000000000000000000000000000000000000000000014806135a557506001600160e01b031982167f0e89341c00000000000000000000000000000000000000000000000000000000145b806106ea57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146106ea565b60606106ea6001600160a01b03831660145b606060006135fe8360026141c6565b6136099060026142f3565b67ffffffffffffffff81111561362157613621613ae7565b6040519080825280601f01601f19166020018201604052801561364b576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106136825761368261421c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106136e5576136e561421c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006137218460026141c6565b61372c9060016142f3565b90505b60018111156137c9577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061376d5761376d61421c565b1a60f81b8282815181106137835761378361421c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936137c28161463c565b905061372f565b508315611a735760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016106bc565b6001600160a01b03851661389f5760005b835181101561389d578281815181106138445761384461421c565b602002602001015160c960008684815181106138625761386261421c565b60200260200101518152602001908152602001600020600082825461388791906142f3565b90915550613896905081614176565b9050613829565b505b6001600160a01b038416610a825760005b8351811015611c5c5760008482815181106138cd576138cd61421c565b6020026020010151905060008483815181106138eb576138eb61421c565b60200260200101519050600060c96000848152602001908152602001600020549050818110156139835760405162461bcd60e51b815260206004820152602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f7460448201527f616c537570706c7900000000000000000000000000000000000000000000000060648201526084016106bc565b600092835260c960205260409092209103905561399f81614176565b90506138b0565b6067610b4d828261434c565b6001600160a01b0381168114611a8b57600080fd5b80356139d2816139b2565b919050565b600080604083850312156139ea57600080fd5b82356139f5816139b2565b946020939093013593505050565b6001600160e01b031981168114611a8b57600080fd5b600060208284031215613a2b57600080fd5b8135611a7381613a03565b600060208284031215613a4857600080fd5b5035919050565b60005b83811015613a6a578181015183820152602001613a52565b50506000910152565b60008151808452613a8b816020860160208601613a4f565b601f01601f19169290920160200192915050565b602081526000611a736020830184613a73565b600080600060608486031215613ac757600080fd5b8335613ad2816139b2565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff82111715613b2357613b23613ae7565b6040525050565b600082601f830112613b3b57600080fd5b813567ffffffffffffffff811115613b5557613b55613ae7565b604051613b6c6020601f19601f8501160182613afd565b818152846020838601011115613b8157600080fd5b816020850160208301376000918101602001919091529392505050565b600060208284031215613bb057600080fd5b813567ffffffffffffffff811115613bc757600080fd5b613bd384828501613b2a565b949350505050565b600067ffffffffffffffff821115613bf557613bf5613ae7565b5060051b60200190565b600082601f830112613c1057600080fd5b81356020613c1d82613bdb565b604051613c2a8282613afd565b83815260059390931b8501820192828101915086841115613c4a57600080fd5b8286015b84811015613c655780358352918301918301613c4e565b509695505050505050565b600080600060608486031215613c8557600080fd5b8335613c90816139b2565b9250602084013567ffffffffffffffff80821115613cad57600080fd5b613cb987838801613bff565b93506040860135915080821115613ccf57600080fd5b50613cdc86828701613bff565b9150509250925092565b60008060408385031215613cf957600080fd5b50508035926020909101359150565b600080600080600060a08688031215613d2057600080fd5b8535613d2b816139b2565b94506020860135613d3b816139b2565b9350604086013567ffffffffffffffff80821115613d5857600080fd5b613d6489838a01613bff565b94506060880135915080821115613d7a57600080fd5b613d8689838a01613bff565b93506080880135915080821115613d9c57600080fd5b50613da988828901613b2a565b9150509295509295909350565b60008060408385031215613dc957600080fd5b823591506020830135613ddb816139b2565b809150509250929050565b60008060408385031215613df957600080fd5b823567ffffffffffffffff80821115613e1157600080fd5b818501915085601f830112613e2557600080fd5b81356020613e3282613bdb565b604051613e3f8282613afd565b83815260059390931b8501820192828101915089841115613e5f57600080fd5b948201945b83861015613e86578535613e77816139b2565b82529482019490820190613e64565b96505086013592505080821115613e9c57600080fd5b5061097585828601613bff565b600081518084526020808501945080840160005b83811015613ed957815187529582019590820190600101613ebd565b509495945050505050565b602081526000611a736020830184613ea9565b60008060408385031215613f0a57600080fd5b82359150602083013567ffffffffffffffff811115613f2857600080fd5b61097585828601613b2a565b600060208284031215613f4657600080fd5b8135611a73816139b2565b8015158114611a8b57600080fd5b60008060408385031215613f7257600080fd5b8235613f7d816139b2565b91506020830135613ddb81613f51565b60008060408385031215613fa057600080fd5b8235613fab816139b2565b91506020830135613ddb816139b2565b600080600080600060a08688031215613fd357600080fd5b8535613fde816139b2565b94506020860135613fee816139b2565b93506040860135925060608601359150608086013567ffffffffffffffff81111561401857600080fd5b613da988828901613b2a565b600080600080600080600060e0888a03121561403f57600080fd5b67ffffffffffffffff808935111561405657600080fd5b6140638a8a358b01613b2a565b97506020890135614073816139b2565b96506040890135614083816139b2565b95506060890135614093816139b2565b945060808901356140a3816139b2565b935060a0890135818111156140b757600080fd5b8901601f81018b136140c857600080fd5b80356140d381613bdb565b6040516140e08282613afd565b80915082815260208101915060208360051b85010192508d83111561410457600080fd5b602084015b8381101561413d57858135111561411f57600080fd5b61412f8f60208335880101613b2a565b835260209283019201614109565b50809650505050505061415260c089016139c7565b905092959891949750929550565b634e487b7160e01b600052601160045260246000fd5b6000600019820361418957614189614160565b5060010190565b600080604083850312156141a357600080fd5b82516141ae816139b2565b602084015190925061ffff81168114613ddb57600080fd5b80820281158282048414176106ea576106ea614160565b6000826141fa57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561421157600080fd5b8151611a7381613f51565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061424657607f821691505b60208210810361426657634e487b7160e01b600052602260045260246000fd5b50919050565b600080845461427a81614232565b6001828116801561429257600181146142a7576142d6565b60ff19841687528215158302870194506142d6565b8860005260208060002060005b858110156142cd5781548a8201529084019082016142b4565b50505082870194505b5050505083516142ea818360208801613a4f565b01949350505050565b808201808211156106ea576106ea614160565b601f821115610ab057600081815260208120601f850160051c8101602086101561432d5750805b601f850160051c820191505b81811015610a8257828155600101614339565b815167ffffffffffffffff81111561436657614366613ae7565b61437a816143748454614232565b84614306565b602080601f8311600181146143af57600084156143975750858301515b600019600386901b1c1916600185901b178555610a82565b600085815260208120601f198616915b828110156143de578886015182559484019460019091019084016143bf565b50858210156143fc5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60408152600061441f6040830185613ea9565b82810360208401526144318185613ea9565b95945050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614472816017850160208801613a4f565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516144af816028840160208801613a4f565b01602801949350505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a060808301526144f360a0830184613a73565b979650505050505050565b60006020828403121561451057600080fd5b8151611a7381613a03565b600060033d11156133d05760046000803e5060005160e01c90565b600060443d10156145445790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff816024840111818411171561459257505050505090565b82850191508151818111156145aa5750505050505090565b843d87010160208285010111156145c45750505050505090565b6145d360208286010187613afd565b509095945050505050565b60006001600160a01b03808816835280871660208401525060a0604083015261460a60a0830186613ea9565b828103606084015261461c8186613ea9565b905082810360808401526146308185613a73565b98975050505050505050565b60008161464b5761464b614160565b50600019019056fea2646970667358221220530526f6a876f380b79cae4b59969012e959ff9004f3d0f8dfbf6d220fa3cf2c64736f6c63430008120033", "devdoc": { "author": "The Sandbox", "details": "An ERC1155 contract that manages catalysts, extends multiple OpenZeppelin contracts to provide a variety of features including, AccessControl, URIStorage, Burnable and more. The contract includes support for meta transactions.", @@ -1039,6 +1095,13 @@ "TransferSingle(address,address,address,uint256,uint256)": { "details": "Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`." }, + "TrustedForwarderSet(address,address,address)": { + "params": { + "newTrustedForwarder": "new trusted forwarder", + "oldTrustedForwarder": "old trusted forwarder", + "operator": "the sender of the transaction" + } + }, "URI(string,uint256)": { "details": "Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. If an {URI} event was emitted for `id`, the standard https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value returned by {IERC1155MetadataURI-uri}." } @@ -1079,6 +1142,11 @@ "getRoleAdmin(bytes32)": { "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}." }, + "getTrustedForwarder()": { + "returns": { + "_0": "return the address of the trusted forwarder" + } + }, "grantRole(bytes32,address)": { "details": "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." }, @@ -1099,6 +1167,14 @@ "isApprovedForAll(address,address)": { "details": "See {IERC1155-isApprovedForAll}." }, + "isTrustedForwarder(address)": { + "params": { + "forwarder": "trusted forwarder address to check" + }, + "returns": { + "_0": "true if the address is the same as the trusted forwarder" + } + }, "mint(address,uint256,uint256)": { "params": { "amount": "The amount to be minted", @@ -1113,6 +1189,13 @@ "to": "The address that will own the minted tokens" } }, + "registerAndSubscribe(address,bool)": { + "details": "used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.", + "params": { + "subscribe": "bool to signify subscription \"true\"\" or to copy the list \"false\".", + "subscriptionOrRegistrantToCopy": "registration address of the list to subscribe." + } + }, "renounceRole(bytes32,address)": { "details": "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." }, @@ -1165,6 +1248,11 @@ "tokenId": "The token id to set URI for" } }, + "setOperatorRegistry(address)": { + "params": { + "registry": "the address of the registry" + } + }, "setTrustedForwarder(address)": { "details": "Change the address of the trusted forwarder for meta-TX", "params": { @@ -1195,6 +1283,11 @@ "version": 1 }, "userdoc": { + "events": { + "TrustedForwarderSet(address,address,address)": { + "notice": "Emitted when a `newTrustedForwarder` is set, replacing the `oldTrustedForwarder`" + } + }, "kind": "user", "methods": { "addNewCatalystType(string)": { @@ -1206,15 +1299,24 @@ "burnFrom(address,uint256,uint256)": { "notice": "Burns a specified amount of tokens from a specific address" }, + "getTrustedForwarder()": { + "notice": "return the address of the trusted forwarder" + }, "initialize(string,address,address,address,address,string[],address)": { "notice": "Initialize the contract, setting up initial values for various features." }, + "isTrustedForwarder(address)": { + "notice": "return true if the forwarder is the trusted forwarder" + }, "mint(address,uint256,uint256)": { "notice": "Mints a new token, limited to MINTER_ROLE only" }, "mintBatch(address,uint256[],uint256[])": { "notice": "Mints a batch of tokens, limited to MINTER_ROLE only" }, + "registerAndSubscribe(address,bool)": { + "notice": "This function is used to register Catalyst contract on the Operator Filterer Registry of Opensea.can only be called by admin." + }, "royaltyInfo(uint256,uint256)": { "notice": "Returns how much royalty is owed and to whom based on ERC2981" }, @@ -1233,6 +1335,9 @@ "setMetadataHash(uint256,string)": { "notice": "Set a new URI for specific tokenid" }, + "setOperatorRegistry(address)": { + "notice": "sets filter registry address deployed in test" + }, "setTrustedForwarder(address)": { "notice": "Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only" }, @@ -1249,7 +1354,7 @@ "storageLayout": { "storage": [ { - "astId": 803, + "astId": 461, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "_initialized", "offset": 0, @@ -1257,7 +1362,7 @@ "type": "t_uint8" }, { - "astId": 806, + "astId": 464, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "_initializing", "offset": 1, @@ -1265,7 +1370,7 @@ "type": "t_bool" }, { - "astId": 3357, + "astId": 3015, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "__gap", "offset": 0, @@ -1273,7 +1378,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 3630, + "astId": 3288, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "__gap", "offset": 0, @@ -1281,7 +1386,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 994, + "astId": 652, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "_balances", "offset": 0, @@ -1289,7 +1394,7 @@ "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" }, { - "astId": 1000, + "astId": 658, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "_operatorApprovals", "offset": 0, @@ -1297,7 +1402,7 @@ "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" }, { - "astId": 1002, + "astId": 660, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "_uri", "offset": 0, @@ -1305,7 +1410,7 @@ "type": "t_string_storage" }, { - "astId": 2209, + "astId": 1867, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "__gap", "offset": 0, @@ -1313,7 +1418,7 @@ "type": "t_array(t_uint256)47_storage" }, { - "astId": 2461, + "astId": 2119, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "__gap", "offset": 0, @@ -1321,7 +1426,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 2487, + "astId": 2145, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "_totalSupply", "offset": 0, @@ -1329,7 +1434,7 @@ "type": "t_mapping(t_uint256,t_uint256)" }, { - "astId": 2638, + "astId": 2296, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "__gap", "offset": 0, @@ -1337,7 +1442,7 @@ "type": "t_array(t_uint256)49_storage" }, { - "astId": 2673, + "astId": 2331, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "_baseURI", "offset": 0, @@ -1345,7 +1450,7 @@ "type": "t_string_storage" }, { - "astId": 2677, + "astId": 2335, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "_tokenURIs", "offset": 0, @@ -1353,7 +1458,7 @@ "type": "t_mapping(t_uint256,t_string_storage)" }, { - "astId": 2752, + "astId": 2410, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "__gap", "offset": 0, @@ -1361,7 +1466,7 @@ "type": "t_array(t_uint256)48_storage" }, { - "astId": 7269, + "astId": 5258, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "_trustedForwarder", "offset": 0, @@ -1369,43 +1474,51 @@ "type": "t_address" }, { - "astId": 276, + "astId": 5345, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", - "label": "_roles", + "label": "__gap", "offset": 0, "slot": "302", - "type": "t_mapping(t_bytes32,t_struct(RoleData)271_storage)" + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 66, + "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", + "label": "_roles", + "offset": 0, + "slot": "351", + "type": "t_mapping(t_bytes32,t_struct(RoleData)61_storage)" }, { - "astId": 571, + "astId": 361, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "__gap", "offset": 0, - "slot": "303", + "slot": "352", "type": "t_array(t_uint256)49_storage" }, { - "astId": 8000, + "astId": 5418, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "operatorFilterRegistry", "offset": 0, - "slot": "352", - "type": "t_contract(IOperatorFilterRegistry)8368" + "slot": "401", + "type": "t_contract(IOperatorFilterRegistry)5799" }, { - "astId": 8884, + "astId": 5818, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "royaltyManager", "offset": 0, - "slot": "353", - "type": "t_contract(IRoyaltyManager)10163" + "slot": "402", + "type": "t_contract(IRoyaltyManager)5972" }, { - "astId": 6656, + "astId": 4349, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "highestTierIndex", "offset": 0, - "slot": "354", + "slot": "403", "type": "t_uint256" } ], @@ -1449,12 +1562,12 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(IOperatorFilterRegistry)8368": { + "t_contract(IOperatorFilterRegistry)5799": { "encoding": "inplace", "label": "contract IOperatorFilterRegistry", "numberOfBytes": "20" }, - "t_contract(IRoyaltyManager)10163": { + "t_contract(IRoyaltyManager)5972": { "encoding": "inplace", "label": "contract IRoyaltyManager", "numberOfBytes": "20" @@ -1480,12 +1593,12 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_mapping(t_bytes32,t_struct(RoleData)271_storage)": { + "t_mapping(t_bytes32,t_struct(RoleData)61_storage)": { "encoding": "mapping", "key": "t_bytes32", "label": "mapping(bytes32 => struct AccessControlUpgradeable.RoleData)", "numberOfBytes": "32", - "value": "t_struct(RoleData)271_storage" + "value": "t_struct(RoleData)61_storage" }, "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { "encoding": "mapping", @@ -1513,12 +1626,12 @@ "label": "string", "numberOfBytes": "32" }, - "t_struct(RoleData)271_storage": { + "t_struct(RoleData)61_storage": { "encoding": "inplace", "label": "struct AccessControlUpgradeable.RoleData", "members": [ { - "astId": 268, + "astId": 58, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "members", "offset": 0, @@ -1526,7 +1639,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 270, + "astId": 60, "contract": "@sandbox-smart-contracts/asset/contracts/Catalyst.sol:Catalyst", "label": "adminRole", "offset": 0, diff --git a/packages/deploy/deployments/mumbai/Catalyst_Proxy.json b/packages/deploy/deployments/mumbai/Catalyst_Proxy.json index 30af904969..16735a3ee1 100644 --- a/packages/deploy/deployments/mumbai/Catalyst_Proxy.json +++ b/packages/deploy/deployments/mumbai/Catalyst_Proxy.json @@ -1,5 +1,5 @@ { - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "abi": [ { "inputs": [ @@ -146,64 +146,79 @@ "type": "receive" } ], - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", - "transactionIndex": 12, - "gasUsed": "1555981", - "logsBloom": "0x04000004000000000000001000040000400000000800000000000000100000000002000000008400000000000000004000008000020400000000000000048000000090000000010000000020000002820000000000040000000100000000000008000000020000000000020000000800000000800200000080000000001000000000000400000000000000010000001000000800000080000000000000a00002200000000000000000080100000400000000000000800000003000080400404000000020004000000001040000040300001000008400000100108020000060004000180000000800040000200000000000000000008000000000000000100000", - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f", - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", + "contractAddress": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", + "transactionIndex": 18, + "gasUsed": "1558973", + "logsBloom": "0x04000004000000000000000000000020400000000800000000000090100000000002000000008420000000000001004000008000024400000000000000040000000090000000010100000020000002800000000000040000000100000000000008100000020000000000020000000800080000800000000180000000001000080000011440000000000000000000001000000800000080000000000000a00000200000000000000000000100000400000000000000800040003000080400404000000020104000000001000000040200001000048400000100108000001060002000080000000000000000200001000004000000008000000000000000100000", + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb", + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", "logs": [ { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", - "0x000000000000000000000000f2f9e0b0c8e557ba796d8a129e3e8dd521a9fc76" + "0x000000000000000000000000b24c71efea030ac79915fd41def45b3b759cd802" ], "data": "0x", - "logIndex": 117, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 37, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", + "topics": [ + "0x8ca022029d8ff7ad974913f8970aeed6c5e0e7eaf494a0c5b262249f6b5759e5", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f7", + "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" + ], + "data": "0x", + "logIndex": 38, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" + }, + { + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", "address": "0x000000000000AAeB6D7670E522A718067333cd4E", "topics": [ "0x86d03f430c7616021073d7a71766f632f1ce19f289aa989534d9f4732253eb59", - "0x000000000000000000000000284b028af7cead623c2f99ebe7edc9e1a02eef5e", + "0x000000000000000000000000d4d1e504be6d12829c3ddfa59778d35203cc358c", "0x0000000000000000000000000000000000000000000000000000000000000001" ], "data": "0x", - "logIndex": 118, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 39, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", "address": "0x000000000000AAeB6D7670E522A718067333cd4E", "topics": [ "0x0038c54977604f1a5c0a3604cbbecd0153c81e3131799ead95755e8bb5d5b9e8", - "0x000000000000000000000000284b028af7cead623c2f99ebe7edc9e1a02eef5e", - "0x000000000000000000000000d7e1d0670359324e9ed9aacb7ee7c1ef7636268e", + "0x000000000000000000000000d4d1e504be6d12829c3ddfa59778d35203cc358c", + "0x00000000000000000000000028ef45183e30200b216456f995ad8ff00eba402f", "0x0000000000000000000000000000000000000000000000000000000000000001" ], "data": "0x", - "logIndex": 119, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 40, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "0x0000000000000000000000000000000000000000000000000000000000000000", @@ -211,14 +226,14 @@ "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 120, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 41, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "0x9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6", @@ -226,149 +241,149 @@ "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 121, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 42, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b", "0x0000000000000000000000000000000000000000000000000000000000000000" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261667962656965636e7a37736e7837363374637877627369746275636c74637870376d6135736971626764613335626c3374736665657469346d000000000000000000000000000000000000000000000000000000000000", - "logIndex": 122, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 43, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b", "0x0000000000000000000000000000000000000000000000000000000000000001" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b7265696235746b793364677363377a793633376466756e62347a77776e707a6f33773369357465706266656534326571337372776e7771000000000000000000000000000000000000000000000000000000000000", - "logIndex": 123, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 44, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b", "0x0000000000000000000000000000000000000000000000000000000000000002" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b7265696567657676696d357133617469346874736e63787773656a6663336c626b7a6237776e326132667a7468633674736f663776376d000000000000000000000000000000000000000000000000000000000000", - "logIndex": 124, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 45, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b", "0x0000000000000000000000000000000000000000000000000000000000000003" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b7265696668746b6f75356133327872746b746476667172766768346d70326f68766c79716473696835786b346b67636679777478656669000000000000000000000000000000000000000000000000000000000000", - "logIndex": 125, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 46, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b", "0x0000000000000000000000000000000000000000000000000000000000000004" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b7265696771706237716f3369716b61343234336f6168336e6b6136616778336e6d76777a6175787a65326a7a6e6f7478337a776f7a7165000000000000000000000000000000000000000000000000000000000000", - "logIndex": 126, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 47, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b", "0x0000000000000000000000000000000000000000000000000000000000000005" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b726569683369747369776b6e3275727a66766732366d627933737367667368766472367a6661627236727878726c7a68656471696c3465000000000000000000000000000000000000000000000000000000000000", - "logIndex": 127, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 48, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b", "0x0000000000000000000000000000000000000000000000000000000000000006" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b726569626d6e6761756f7a7a69647a3265657679796233756d66326577377a6578696e673367687570366c37696f32616f3532326d7679000000000000000000000000000000000000000000000000000000000000", - "logIndex": 128, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 49, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x0000000000000000000000000000000000000000000000000000000000000001", - "logIndex": 129, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "logIndex": 50, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", - "address": "0x284B028AF7cEAd623C2f99ebE7edc9E1a02Eef5E", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", + "address": "0xD4D1e504bE6D12829c3DDfA59778d35203cc358c", "topics": [ "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" ], - "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c3c6b8feee55636e949920aa90f093f6f5faf448", - "logIndex": 130, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c26b12025e378c570fb46249093ba387a2e927bc", + "logIndex": 51, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" }, { - "transactionIndex": 12, - "blockNumber": 38493737, - "transactionHash": "0xc127eefcfea5a621398a0b92e2e0343b70b5c289e131cfdd2fddc6aa339e5e36", + "transactionIndex": 18, + "blockNumber": 38730669, + "transactionHash": "0xaabe36dd75fc9912b104bd4570973eca1b4a09bd0f04bc3c7b49ceda5f910413", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", - "0x0000000000000000000000003a22c8bc68e98b0faf40f349dd2b2890fae01484" + "0x000000000000000000000000f903ba9e006193c1527bfbe65fe2123704ea3f99" ], - "data": "0x00000000000000000000000000000000000000000000000000084abc162c630000000000000000000000000000000000000000000000001173aad30e8b93af0e000000000000000000000000000000000000000000000d1f6344cbfa78f10afe00000000000000000000000000000000000000000000001173a2885275674c0e000000000000000000000000000000000000000000000d1f634d16b68f1d6dfe", - "logIndex": 131, - "blockHash": "0xfebaa0cbce7d440aded01207a81ec5e8ae5fa809cb9f39b87046426368c1192f" + "data": "0x00000000000000000000000000000000000000000000000000084ed107d1b3000000000000000000000000000000000000000000000000117119f8fd62155a93000000000000000000000000000000000000000000001043e257271476ed79ad0000000000000000000000000000000000000000000000117111aa2c5a43a793000000000000000000000000000000000000000000001043e25f75e57ebf2cad", + "logIndex": 52, + "blockHash": "0xabf3015eaee63ee073b5ab0f5f43ebfd9f31598c11340312fef7596960bf26fb" } ], - "blockNumber": 38493737, - "cumulativeGasUsed": "5816390", + "blockNumber": 38730669, + "cumulativeGasUsed": "2763286", "status": 1, "byzantium": true }, "args": [ - "0xF2F9E0b0C8E557Ba796D8a129e3e8DD521A9FC76", - "0xc3C6B8feeE55636e949920Aa90f093f6f5Faf448", - "0xf3bdecc100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f7000000000000000000000000d7e1d0670359324e9ed9aacb7ee7c1ef7636268e00000000000000000000000049c4d4c94829b9c44052c5f5cb164fc61218116500000000000000000000000049c4d4c94829b9c44052c5f5cb164fc612181165000000000000000000000000000000000000000000000000000000000000012000000000000000000000000042017fd22fd371cb717e4895e8a45d17dcde89e60000000000000000000000000000000000000000000000000000000000000007697066733a2f2f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000003b6261667962656965636e7a37736e7837363374637877627369746275636c74637870376d6135736971626764613335626c3374736665657469346d0000000000000000000000000000000000000000000000000000000000000000000000003b6261666b7265696235746b793364677363377a793633376466756e62347a77776e707a6f33773369357465706266656534326571337372776e77710000000000000000000000000000000000000000000000000000000000000000000000003b6261666b7265696567657676696d357133617469346874736e63787773656a6663336c626b7a6237776e326132667a7468633674736f663776376d0000000000000000000000000000000000000000000000000000000000000000000000003b6261666b7265696668746b6f75356133327872746b746476667172766768346d70326f68766c79716473696835786b346b676366797774786566690000000000000000000000000000000000000000000000000000000000000000000000003b6261666b7265696771706237716f3369716b61343234336f6168336e6b6136616778336e6d76777a6175787a65326a7a6e6f7478337a776f7a71650000000000000000000000000000000000000000000000000000000000000000000000003b6261666b726569683369747369776b6e3275727a66766732366d627933737367667368766472367a6661627236727878726c7a68656471696c34650000000000000000000000000000000000000000000000000000000000000000000000003b6261666b726569626d6e6761756f7a7a69647a3265657679796233756d66326577377a6578696e673367687570366c37696f32616f3532326d76790000000000" + "0xb24c71EFeA030ac79915fD41deF45b3B759cD802", + "0xc26B12025e378c570Fb46249093Ba387A2e927bc", + "0xf3bdecc100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f700000000000000000000000028ef45183e30200b216456f995ad8ff00eba402f00000000000000000000000049c4d4c94829b9c44052c5f5cb164fc61218116500000000000000000000000049c4d4c94829b9c44052c5f5cb164fc61218116500000000000000000000000000000000000000000000000000000000000001200000000000000000000000004ae9a95ec193fc1b38c246b701de49b8e3f5ef340000000000000000000000000000000000000000000000000000000000000007697066733a2f2f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000003b6261667962656965636e7a37736e7837363374637877627369746275636c74637870376d6135736971626764613335626c3374736665657469346d0000000000000000000000000000000000000000000000000000000000000000000000003b6261666b7265696235746b793364677363377a793633376466756e62347a77776e707a6f33773369357465706266656534326571337372776e77710000000000000000000000000000000000000000000000000000000000000000000000003b6261666b7265696567657676696d357133617469346874736e63787773656a6663336c626b7a6237776e326132667a7468633674736f663776376d0000000000000000000000000000000000000000000000000000000000000000000000003b6261666b7265696668746b6f75356133327872746b746476667172766768346d70326f68766c79716473696835786b346b676366797774786566690000000000000000000000000000000000000000000000000000000000000000000000003b6261666b7265696771706237716f3369716b61343234336f6168336e6b6136616778336e6d76777a6175787a65326a7a6e6f7478337a776f7a71650000000000000000000000000000000000000000000000000000000000000000000000003b6261666b726569683369747369776b6e3275727a66766732366d627933737367667368766472367a6661627236727878726c7a68656471696c34650000000000000000000000000000000000000000000000000000000000000000000000003b6261666b726569626d6e6761756f7a7a69647a3265657679796233756d66326577377a6578696e673367687570366c37696f32616f3532326d76790000000000" ], "numDeployments": 1, "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", diff --git a/packages/deploy/deployments/mumbai/DefaultProxyAdmin.json b/packages/deploy/deployments/mumbai/DefaultProxyAdmin.json index 547a63dc55..3e8ba84788 100644 --- a/packages/deploy/deployments/mumbai/DefaultProxyAdmin.json +++ b/packages/deploy/deployments/mumbai/DefaultProxyAdmin.json @@ -1,5 +1,5 @@ { - "address": "0xc3C6B8feeE55636e949920Aa90f093f6f5Faf448", + "address": "0xc26B12025e378c570Fb46249093Ba387A2e927bc", "abi": [ { "inputs": [ @@ -162,35 +162,35 @@ "type": "function" } ], - "transactionHash": "0x108422236979b41c94bf65c251cfad5b767d979c212f1b5108cacb7e971b0b9a", + "transactionHash": "0xabad6276bd2bf3e3eaa23c625bee2b695689cb72c62b03f89210d1351db50c9d", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0xc3C6B8feeE55636e949920Aa90f093f6f5Faf448", - "transactionIndex": 8, + "contractAddress": "0xc26B12025e378c570Fb46249093Ba387A2e927bc", + "transactionIndex": 1, "gasUsed": "643983", - "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000002000000008400000000000000000000008000000000000000000000000000000000008000000000000000000000800001000000000000000100000000004000000000020000000000020000000800000000000000000080000000000000400000000000000000000000020000000000000000000080000000000000200000200000000000000000000000000000000000000010000000000000000000004000000000000000000001000000000000000000000000000000108040000020000000000000000000000000000000000000000000000000000000000000100000", - "blockHash": "0x7e6ad0dc435e502ff98255f9ac5ddd45a9b786839971560d4e0040997d3562bc", - "transactionHash": "0x108422236979b41c94bf65c251cfad5b767d979c212f1b5108cacb7e971b0b9a", + "logsBloom": "0x000000000002000000000000000000000000000000000000008000000000000000020000000084000000000000000000000080000000000000000000000000000000000000000000000000000000008000010000000000000001000000000040000000000200000000000a0000000800000000000000000080000000000000400000000000000000000000000000000000000000000080000004000000200000200000000000000000000000000000000000000000000000000000000000004000000000000000000001000000000000000000000000000000108040000020000000000000000000000000000000000000000000000000000000000000100000", + "blockHash": "0xc18a06cf54477cc8e55585145a99ca5cb85ad005624dae6b13388f1ae3f2a619", + "transactionHash": "0xabad6276bd2bf3e3eaa23c625bee2b695689cb72c62b03f89210d1351db50c9d", "logs": [ { - "transactionIndex": 8, - "blockNumber": 38493715, - "transactionHash": "0x108422236979b41c94bf65c251cfad5b767d979c212f1b5108cacb7e971b0b9a", - "address": "0xc3C6B8feeE55636e949920Aa90f093f6f5Faf448", + "transactionIndex": 1, + "blockNumber": 38730650, + "transactionHash": "0xabad6276bd2bf3e3eaa23c625bee2b695689cb72c62b03f89210d1351db50c9d", + "address": "0xc26B12025e378c570Fb46249093Ba387A2e927bc", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x00000000000000000000000049c4d4c94829b9c44052c5f5cb164fc612181165" ], "data": "0x", - "logIndex": 45, - "blockHash": "0x7e6ad0dc435e502ff98255f9ac5ddd45a9b786839971560d4e0040997d3562bc" + "logIndex": 1, + "blockHash": "0xc18a06cf54477cc8e55585145a99ca5cb85ad005624dae6b13388f1ae3f2a619" }, { - "transactionIndex": 8, - "blockNumber": 38493715, - "transactionHash": "0x108422236979b41c94bf65c251cfad5b767d979c212f1b5108cacb7e971b0b9a", + "transactionIndex": 1, + "blockNumber": 38730650, + "transactionHash": "0xabad6276bd2bf3e3eaa23c625bee2b695689cb72c62b03f89210d1351db50c9d", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", @@ -198,13 +198,13 @@ "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", "0x000000000000000000000000be188d6641e8b680743a4815dfa0f6208038960f" ], - "data": "0x000000000000000000000000000000000000000000000000000443be40207a6a00000000000000000000000000000000000000000000001173f2e63fdd416d75000000000000000000000000000000000000000000003386bf26e8ff03463e2d00000000000000000000000000000000000000000000001173eea2819d20f30b000000000000000000000000000000000000000000003386bf2b2cbd4366b897", - "logIndex": 46, - "blockHash": "0x7e6ad0dc435e502ff98255f9ac5ddd45a9b786839971560d4e0040997d3562bc" + "data": "0x0000000000000000000000000000000000000000000000000005d95552e9880d0000000000000000000000000000000000000000000000117160167666bafd120000000000000000000000000000000000000000000033a6d2fe275867269283000000000000000000000000000000000000000000000011715a3d2113d175050000000000000000000000000000000000000000000033a6d30400adba101a90", + "logIndex": 2, + "blockHash": "0xc18a06cf54477cc8e55585145a99ca5cb85ad005624dae6b13388f1ae3f2a619" } ], - "blockNumber": 38493715, - "cumulativeGasUsed": "1625681", + "blockNumber": 38730650, + "cumulativeGasUsed": "694494", "status": 1, "byzantium": true }, diff --git a/packages/deploy/deployments/mumbai/OperatorFilterSubscription.json b/packages/deploy/deployments/mumbai/OperatorFilterSubscription.json index d6902d64c2..48b3268b39 100644 --- a/packages/deploy/deployments/mumbai/OperatorFilterSubscription.json +++ b/packages/deploy/deployments/mumbai/OperatorFilterSubscription.json @@ -1,5 +1,5 @@ { - "address": "0xd7e1D0670359324E9Ed9AAcB7ee7c1EF7636268e", + "address": "0x28EF45183E30200B216456f995Ad8FF00Eba402F", "abi": [ { "inputs": [], @@ -85,63 +85,63 @@ "type": "function" } ], - "transactionHash": "0x8d225e4378486e37e9c0fd7ae58081a9a0c11e214649b894c1cd5c279121c208", + "transactionHash": "0xd216bf32b724b0f63aec964fda0aed33b0ccdba05e6f421caf4aa710debd20db", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0xd7e1D0670359324E9Ed9AAcB7ee7c1EF7636268e", - "transactionIndex": 12, + "contractAddress": "0x28EF45183E30200B216456f995Ad8FF00Eba402F", + "transactionIndex": 16, "gasUsed": "291040", - "logsBloom": "0x00000000000000000000000000040000000000000800000000800000100000000002000000000000020000000000000000008000000000000000000000048000000080000000400000000000000000800001000000040000000100000000000000400000020000000000000000000800000000000000000080000000000000400000000000000000000000000000000000000000000000000000000000200000200000000000000000080000000000000000000000000000000000000000004000000000004000000001040000000300000000000000000000108000000060000000080000000000040000000000000000000000000000000000000000100000", - "blockHash": "0x8ed2652ff784aad1cc88a3b5b14bbbdff8cbb7b7d052050611d0a26ebfb996ce", - "transactionHash": "0x8d225e4378486e37e9c0fd7ae58081a9a0c11e214649b894c1cd5c279121c208", + "logsBloom": "0x00000000000000000000000000000000000000000800000000800010100000004002000000000020000000000000000000008000000000000000000000040000010080000000000000000000000000800001000000040000000100000000000000100000020000000000000000000800000000000000000080000000000000400000000000000000000000000000000000000000000000000000000000200000200000000000000000000000000000000000000000000040000000000000004200000000004000000001000000000200000000040000000000108000001060000000080000000000000000000000000000000000000000000000000000100000", + "blockHash": "0x312403b622345f7b7d4405114d4222531546ef18a334609a024f1eb61a7bd293", + "transactionHash": "0xd216bf32b724b0f63aec964fda0aed33b0ccdba05e6f421caf4aa710debd20db", "logs": [ { - "transactionIndex": 12, - "blockNumber": 38493730, - "transactionHash": "0x8d225e4378486e37e9c0fd7ae58081a9a0c11e214649b894c1cd5c279121c208", - "address": "0xd7e1D0670359324E9Ed9AAcB7ee7c1EF7636268e", + "transactionIndex": 16, + "blockNumber": 38730664, + "transactionHash": "0xd216bf32b724b0f63aec964fda0aed33b0ccdba05e6f421caf4aa710debd20db", + "address": "0x28EF45183E30200B216456f995Ad8FF00Eba402F", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 47, - "blockHash": "0x8ed2652ff784aad1cc88a3b5b14bbbdff8cbb7b7d052050611d0a26ebfb996ce" + "logIndex": 51, + "blockHash": "0x312403b622345f7b7d4405114d4222531546ef18a334609a024f1eb61a7bd293" }, { - "transactionIndex": 12, - "blockNumber": 38493730, - "transactionHash": "0x8d225e4378486e37e9c0fd7ae58081a9a0c11e214649b894c1cd5c279121c208", + "transactionIndex": 16, + "blockNumber": 38730664, + "transactionHash": "0xd216bf32b724b0f63aec964fda0aed33b0ccdba05e6f421caf4aa710debd20db", "address": "0x000000000000AAeB6D7670E522A718067333cd4E", "topics": [ "0x86d03f430c7616021073d7a71766f632f1ce19f289aa989534d9f4732253eb59", - "0x000000000000000000000000d7e1d0670359324e9ed9aacb7ee7c1ef7636268e", + "0x00000000000000000000000028ef45183e30200b216456f995ad8ff00eba402f", "0x0000000000000000000000000000000000000000000000000000000000000001" ], "data": "0x", - "logIndex": 48, - "blockHash": "0x8ed2652ff784aad1cc88a3b5b14bbbdff8cbb7b7d052050611d0a26ebfb996ce" + "logIndex": 52, + "blockHash": "0x312403b622345f7b7d4405114d4222531546ef18a334609a024f1eb61a7bd293" }, { - "transactionIndex": 12, - "blockNumber": 38493730, - "transactionHash": "0x8d225e4378486e37e9c0fd7ae58081a9a0c11e214649b894c1cd5c279121c208", + "transactionIndex": 16, + "blockNumber": 38730664, + "transactionHash": "0xd216bf32b724b0f63aec964fda0aed33b0ccdba05e6f421caf4aa710debd20db", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", - "0x0000000000000000000000003a22c8bc68e98b0faf40f349dd2b2890fae01484" + "0x000000000000000000000000f903ba9e006193c1527bfbe65fe2123704ea3f99" ], - "data": "0x00000000000000000000000000000000000000000000000000018d0c8bb9200000000000000000000000000000000000000000000000001173c077fcc4a3e9b9000000000000000000000000000000000000000000000d1f61e438de7695f9e600000000000000000000000000000000000000000000001173beeaf038eac9b9000000000000000000000000000000000000000000000d1f61e5c5eb024f19e6", - "logIndex": 49, - "blockHash": "0x8ed2652ff784aad1cc88a3b5b14bbbdff8cbb7b7d052050611d0a26ebfb996ce" + "data": "0x00000000000000000000000000000000000000000000000000018d0c8bb920000000000000000000000000000000000000000000000000117130a81849237663000000000000000000000000000000000000000000001043e1f560e38e73960f000000000000000000000000000000000000000000000011712f1b0bbd6a5663000000000000000000000000000000000000000000001043e1f6edf01a2cb60f", + "logIndex": 53, + "blockHash": "0x312403b622345f7b7d4405114d4222531546ef18a334609a024f1eb61a7bd293" } ], - "blockNumber": 38493730, - "cumulativeGasUsed": "1654290", + "blockNumber": 38730664, + "cumulativeGasUsed": "2153090", "status": 1, "byzantium": true }, diff --git a/packages/deploy/deployments/mumbai/RoyaltyManager.json b/packages/deploy/deployments/mumbai/RoyaltyManager.json index 6cbf4aee48..e72277579b 100644 --- a/packages/deploy/deployments/mumbai/RoyaltyManager.json +++ b/packages/deploy/deployments/mumbai/RoyaltyManager.json @@ -1,5 +1,5 @@ { - "address": "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6", + "address": "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34", "abi": [ { "anonymous": false, @@ -396,6 +396,25 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + } + ], + "name": "getContractRoyalty", + "outputs": [ + { + "internalType": "uint16", + "name": "royaltyBps", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -452,7 +471,7 @@ "name": "getRoyaltyInfo", "outputs": [ { - "internalType": "address", + "internalType": "address payable", "name": "", "type": "address" }, @@ -465,6 +484,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getTrustedForwarder", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -533,6 +565,11 @@ "internalType": "address", "name": "contractRoyaltySetter", "type": "address" + }, + { + "internalType": "address", + "name": "trustedForwarder", + "type": "address" } ], "name": "initialize", @@ -633,6 +670,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newForwarder", + "type": "address" + } + ], + "name": "setTrustedForwarder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -674,59 +724,59 @@ "type": "constructor" } ], - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6", + "contractAddress": "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34", "transactionIndex": 8, - "gasUsed": "844425", - "logsBloom": "0x00002004000000000000000004000000400000000000000000000000000000000002200000008400000000000000000000008000000000001000000800000000000000000000000000000000000802800000000000000000000100400000004000000000020000000000020000000800000000800000000080000000010000000000000000000000000000000000000000000800000090000000800000a00000200000000000000000000000000400000000000000000000001000000000404000000020000000001001000000060000000400000400000100128040000020000000000000000000000000000001000000000000000000000000000000100200", - "blockHash": "0x88767e469c63ae385ffe6fae39dd49e8588e3497d1d1e643b04812f5257ff77e", - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", + "gasUsed": "867203", + "logsBloom": "0x00002004000000000000000004000000400000000000000000000010000000000002000000008420000000000000000000008000000000001000000000000000000000000020000000000000000802800000000000000000000100000000000000000000020000000000020000000800000000800000100080000000010000800000000000000000000002000000000000080800000080000000800000a00000200000000000000000000000000400000000000000000000001000000000004000000020000000000001000000060000000000000400000100108000001020000000000000000000000000000000000000000000000000000008000000100200", + "blockHash": "0xb37c6d3d2105a8c8d83679151b08a9455ed4040efe37441bfd5b4dde130f6ecf", + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", "logs": [ { "transactionIndex": 8, - "blockNumber": 38493722, - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", - "address": "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6", + "blockNumber": 38730657, + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", + "address": "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34", "topics": [ "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", - "0x0000000000000000000000005df8ca6aecb7950f15df87f35838149d379e094f" + "0x000000000000000000000000c7b2cfe80a27282fe51248f0ad0cfce6b8531b0d" ], "data": "0x", - "logIndex": 57, - "blockHash": "0x88767e469c63ae385ffe6fae39dd49e8588e3497d1d1e643b04812f5257ff77e" + "logIndex": 19, + "blockHash": "0xb37c6d3d2105a8c8d83679151b08a9455ed4040efe37441bfd5b4dde130f6ecf" }, { "transactionIndex": 8, - "blockNumber": 38493722, - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", - "address": "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6", + "blockNumber": 38730657, + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", + "address": "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34", "topics": [ "0x9d900d71c28433348acb1bec780a061608a96b149370abce77fd54ba2d479401" ], - "data": "0x00000000000000000000000049c4d4c94829b9c44052c5f5cb164fc612181165", - "logIndex": 58, - "blockHash": "0x88767e469c63ae385ffe6fae39dd49e8588e3497d1d1e643b04812f5257ff77e" + "data": "0x000000000000000000000000a5eb9c9eb4f4c35b9be8cfaaa7909f9ebe6cb609", + "logIndex": 20, + "blockHash": "0xb37c6d3d2105a8c8d83679151b08a9455ed4040efe37441bfd5b4dde130f6ecf" }, { "transactionIndex": 8, - "blockNumber": 38493722, - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", - "address": "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6", + "blockNumber": 38730657, + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", + "address": "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34", "topics": [ "0xb8dc7db64fd987e5b05af4eb247387c388b40222e3ecb8c029b8a62227d4d28b" ], "data": "0x0000000000000000000000000000000000000000000000000000000000001388", - "logIndex": 59, - "blockHash": "0x88767e469c63ae385ffe6fae39dd49e8588e3497d1d1e643b04812f5257ff77e" + "logIndex": 21, + "blockHash": "0xb37c6d3d2105a8c8d83679151b08a9455ed4040efe37441bfd5b4dde130f6ecf" }, { "transactionIndex": 8, - "blockNumber": 38493722, - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", - "address": "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6", + "blockNumber": 38730657, + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", + "address": "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34", "topics": [ "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "0x0000000000000000000000000000000000000000000000000000000000000000", @@ -734,73 +784,73 @@ "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 60, - "blockHash": "0x88767e469c63ae385ffe6fae39dd49e8588e3497d1d1e643b04812f5257ff77e" + "logIndex": 22, + "blockHash": "0xb37c6d3d2105a8c8d83679151b08a9455ed4040efe37441bfd5b4dde130f6ecf" }, { "transactionIndex": 8, - "blockNumber": 38493722, - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", - "address": "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6", + "blockNumber": 38730657, + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", + "address": "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34", "topics": [ "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "0x35ee06f2b11054b099ebf059488ad39add9bda510bd8c8709f3b502faeb3ace6", - "0x0000000000000000000000006f1bbc084a2d35c2aba8f1b702b6a30bda2189ba", + "0x00000000000000000000000049c4d4c94829b9c44052c5f5cb164fc612181165", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 61, - "blockHash": "0x88767e469c63ae385ffe6fae39dd49e8588e3497d1d1e643b04812f5257ff77e" + "logIndex": 23, + "blockHash": "0xb37c6d3d2105a8c8d83679151b08a9455ed4040efe37441bfd5b4dde130f6ecf" }, { "transactionIndex": 8, - "blockNumber": 38493722, - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", - "address": "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6", + "blockNumber": 38730657, + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", + "address": "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x0000000000000000000000000000000000000000000000000000000000000001", - "logIndex": 62, - "blockHash": "0x88767e469c63ae385ffe6fae39dd49e8588e3497d1d1e643b04812f5257ff77e" + "logIndex": 24, + "blockHash": "0xb37c6d3d2105a8c8d83679151b08a9455ed4040efe37441bfd5b4dde130f6ecf" }, { "transactionIndex": 8, - "blockNumber": 38493722, - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", - "address": "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6", + "blockNumber": 38730657, + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", + "address": "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34", "topics": [ "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" ], - "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c3c6b8feee55636e949920aa90f093f6f5faf448", - "logIndex": 63, - "blockHash": "0x88767e469c63ae385ffe6fae39dd49e8588e3497d1d1e643b04812f5257ff77e" + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c26b12025e378c570fb46249093ba387a2e927bc", + "logIndex": 25, + "blockHash": "0xb37c6d3d2105a8c8d83679151b08a9455ed4040efe37441bfd5b4dde130f6ecf" }, { "transactionIndex": 8, - "blockNumber": 38493722, - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", + "blockNumber": 38730657, + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", - "0x000000000000000000000000be188d6641e8b680743a4815dfa0f6208038960f" + "0x000000000000000000000000f903ba9e006193c1527bfbe65fe2123704ea3f99" ], - "data": "0x00000000000000000000000000000000000000000000000000048000063f270000000000000000000000000000000000000000000000001173e1fd28f7b455fd000000000000000000000000000000000000000000003386c078d978e58864e700000000000000000000000000000000000000000000001173dd7d28f1752efd000000000000000000000000000000000000000000003386c07d5978ebc78be7", - "logIndex": 64, - "blockHash": "0x88767e469c63ae385ffe6fae39dd49e8588e3497d1d1e643b04812f5257ff77e" + "data": "0x00000000000000000000000000000000000000000000000000058bb09461640c00000000000000000000000000000000000000000000001171532b37c8084bbf000000000000000000000000000000000000000000001043e0185dd805622904000000000000000000000000000000000000000000000011714d9f8733a6e7b3000000000000000000000000000000000000000000001043e01de98899c38d10", + "logIndex": 26, + "blockHash": "0xb37c6d3d2105a8c8d83679151b08a9455ed4040efe37441bfd5b4dde130f6ecf" } ], - "blockNumber": 38493722, - "cumulativeGasUsed": "3610775", + "blockNumber": 38730657, + "cumulativeGasUsed": "1311626", "status": 1, "byzantium": true }, "args": [ - "0x5dF8cA6AECb7950f15dF87f35838149d379E094F", - "0xc3C6B8feeE55636e949920Aa90f093f6f5Faf448", - "0xb0c5b7d800000000000000000000000049c4d4c94829b9c44052c5f5cb164fc61218116500000000000000000000000000000000000000000000000000000000000013880000000000000000000000001b7bb8db9ca2bb098576b64bbcbe4087370c189100000000000000000000000049c4d4c94829b9c44052c5f5cb164fc6121811650000000000000000000000006f1bbc084a2d35c2aba8f1b702b6a30bda2189ba" + "0xc7B2CFe80A27282fe51248F0AD0CfCe6b8531B0d", + "0xc26B12025e378c570Fb46249093Ba387A2e927bc", + "0x0e902f9d000000000000000000000000a5eb9c9eb4f4c35b9be8cfaaa7909f9ebe6cb60900000000000000000000000000000000000000000000000000000000000013880000000000000000000000004022efd364ab869e06284012be5d60eb71490c4e00000000000000000000000049c4d4c94829b9c44052c5f5cb164fc61218116500000000000000000000000049c4d4c94829b9c44052c5f5cb164fc61218116500000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f7" ], "numDeployments": 1, "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", @@ -810,14 +860,15 @@ "execute": { "methodName": "initialize", "args": [ - "0x49c4D4C94829B9c44052C5f5Cb164Fc612181165", + "0xa5Eb9C9Eb4F4c35B9Be8cFaAA7909F9ebe6Cb609", 5000, - "0x1B7bB8DB9CA2bb098576B64bbCbE4087370C1891", + "0x4022EfD364AB869E06284012be5d60EB71490c4E", + "0x49c4D4C94829B9c44052C5f5Cb164Fc612181165", "0x49c4D4C94829B9c44052C5f5Cb164Fc612181165", - "0x6f1Bbc084A2d35C2abA8f1B702b6a30BDa2189ba" + "0x69015912aa33720b842dcd6ac059ed623f28d9f7" ] }, - "implementation": "0x5dF8cA6AECb7950f15dF87f35838149d379E094F", + "implementation": "0xc7B2CFe80A27282fe51248F0AD0CfCe6b8531B0d", "devdoc": { "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", "kind": "dev", diff --git a/packages/deploy/deployments/mumbai/RoyaltyManager_Implementation.json b/packages/deploy/deployments/mumbai/RoyaltyManager_Implementation.json index 1a6b68ba5c..6d89d72f9f 100644 --- a/packages/deploy/deployments/mumbai/RoyaltyManager_Implementation.json +++ b/packages/deploy/deployments/mumbai/RoyaltyManager_Implementation.json @@ -1,5 +1,5 @@ { - "address": "0x5dF8cA6AECb7950f15dF87f35838149d379E094F", + "address": "0xc7B2CFe80A27282fe51248F0AD0CfCe6b8531B0d", "abi": [ { "anonymous": false, @@ -273,6 +273,25 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + } + ], + "name": "getContractRoyalty", + "outputs": [ + { + "internalType": "uint16", + "name": "royaltyBps", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -329,7 +348,7 @@ "name": "getRoyaltyInfo", "outputs": [ { - "internalType": "address", + "internalType": "address payable", "name": "", "type": "address" }, @@ -342,6 +361,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getTrustedForwarder", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -410,6 +442,11 @@ "internalType": "address", "name": "contractRoyaltySetter", "type": "address" + }, + { + "internalType": "address", + "name": "trustedForwarder", + "type": "address" } ], "name": "initialize", @@ -510,6 +547,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newForwarder", + "type": "address" + } + ], + "name": "setTrustedForwarder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -530,21 +580,21 @@ "type": "function" } ], - "transactionHash": "0x23265de83aa7d32fc771b51d906ff862df0b6ad96b624fd47e5afc7e0b4b2952", + "transactionHash": "0x970d7e1d9a95dc9c94464518f7a328da4060231a3606772b64402bad4c95609f", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0x5dF8cA6AECb7950f15dF87f35838149d379E094F", - "transactionIndex": 5, - "gasUsed": "1285018", + "contractAddress": "0xc7B2CFe80A27282fe51248F0AD0CfCe6b8531B0d", + "transactionIndex": 12, + "gasUsed": "1326679", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100000000004000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000080000000000000200000200000000000000000000000000000000000000000000000000000000000004000000000000000000001000000000000000000000000000000108040000000000000000000000000000000000000000000000000000000000000000000100000", - "blockHash": "0xae410058be31e87fb0d1206d3b79960ac23ac9d881c9141b8b58f61b7616409c", - "transactionHash": "0x23265de83aa7d32fc771b51d906ff862df0b6ad96b624fd47e5afc7e0b4b2952", + "blockHash": "0x49cddee7dea5526ccbc4426fad21b4b8068d8486bcfc43346ff2b06f3393a4c9", + "transactionHash": "0x970d7e1d9a95dc9c94464518f7a328da4060231a3606772b64402bad4c95609f", "logs": [ { - "transactionIndex": 5, - "blockNumber": 38493718, - "transactionHash": "0x23265de83aa7d32fc771b51d906ff862df0b6ad96b624fd47e5afc7e0b4b2952", + "transactionIndex": 12, + "blockNumber": 38730653, + "transactionHash": "0x970d7e1d9a95dc9c94464518f7a328da4060231a3606772b64402bad4c95609f", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", @@ -552,22 +602,22 @@ "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", "0x000000000000000000000000be188d6641e8b680743a4815dfa0f6208038960f" ], - "data": "0x000000000000000000000000000000000000000000000000000ca558a35acc2c00000000000000000000000000000000000000000000001173eea2819c7012fd000000000000000000000000000000000000000000003386bfa9cb865545050a00000000000000000000000000000000000000000000001173e1fd28f91546d1000000000000000000000000000000000000000000003386bfb670def89fd136", - "logIndex": 21, - "blockHash": "0xae410058be31e87fb0d1206d3b79960ac23ac9d881c9141b8b58f61b7616409c" + "data": "0x000000000000000000000000000000000000000000000000000711e949c9f900000000000000000000000000000000000000000000000011715a3d21132a68860000000000000000000000000000000000000000000033a6d39c1355613bc48700000000000000000000000000000000000000000000001171532b37c9606f860000000000000000000000000000000000000000000033a6d3a3253eab05bd87", + "logIndex": 62, + "blockHash": "0x49cddee7dea5526ccbc4426fad21b4b8068d8486bcfc43346ff2b06f3393a4c9" } ], - "blockNumber": 38493718, - "cumulativeGasUsed": "2269707", + "blockNumber": 38730653, + "cumulativeGasUsed": "4649131", "status": 1, "byzantium": true }, "args": [], "numDeployments": 1, - "solcInputHash": "101d55502dc3ddda4c84938ce7ac435e", - "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"commonRecipient\",\"type\":\"address\"}],\"name\":\"RecipientSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"royaltyBps\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"}],\"name\":\"RoyaltySet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"commonSplit\",\"type\":\"uint16\"}],\"name\":\"SplitSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"CONTRACT_ROYALTY_SETTER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"_creatorRoyaltiesSplitter\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"commonRecipient\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"commonSplit\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"contractRoyalty\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"deploySplitter\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCommonRecipient\",\"outputs\":[{\"components\":[{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"bps\",\"type\":\"uint16\"}],\"internalType\":\"struct Recipient\",\"name\":\"recipient\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"}],\"name\":\"getCreatorRoyaltySplitter\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCreatorSplit\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRoyaltyInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"_commonRecipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"_commonSplit\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"royaltySplitterCloneable\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"managerAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"contractRoyaltySetter\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"_royaltyBps\",\"type\":\"uint16\"}],\"name\":\"setContractRoyalty\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"_commonRecipient\",\"type\":\"address\"}],\"name\":\"setRecipient\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setRoyaltyRecipient\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_commonSplit\",\"type\":\"uint16\"}],\"name\":\"setSplit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"The Sandbox\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"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._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"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`)\"}},\"kind\":\"dev\",\"methods\":{\"deploySplitter(address,address)\":{\"details\":\"should only called once per creator\",\"params\":{\"creator\":\"the address of the creator\",\"recipient\":\"the wallet of the recipient where they would receive their royalty\"},\"returns\":{\"_0\":\"creatorSplitterAddress deployed for a creator\"}},\"getCommonRecipient()\":{\"returns\":{\"recipient\":\"which has the common recipient and split\"}},\"getCreatorRoyaltySplitter(address)\":{\"params\":{\"creator\":\"the address of the creator\"},\"returns\":{\"_0\":\"creatorSplitterAddress deployed for a creator\"}},\"getCreatorSplit()\":{\"returns\":{\"_0\":\"creatorSplit which is 10000 - commonSplit\"}},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getRoyaltyInfo()\":{\"returns\":{\"_0\":\"commonRecipient\",\"_1\":\"royaltySplit\"}},\"grantRole(bytes32,address)\":{\"details\":\"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.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"initialize(address,uint16,address,address,address)\":{\"details\":\"called during the deployment via the proxy.\",\"params\":{\"_commonRecipient\":\"the != address(0)common recipient for all the splitters\",\"_commonSplit\":\"split for the common recipient's and creator split would be 10000 - commonSplit\",\"contractRoyaltySetter\":\"the address of royalty setter of contract.\",\"managerAdmin\":\"address of RoyaltyManager contract.\",\"royaltySplitterCloneable\":\"address of cloneable splitter contract for royalties distribution\"}},\"renounceRole(bytes32,address)\":{\"details\":\"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.\"},\"revokeRole(bytes32,address)\":{\"details\":\"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.\"},\"setContractRoyalty(address,uint16)\":{\"details\":\"can only be called by contract royalty setter.\",\"params\":{\"_royaltyBps\":\"the royalty split for the EIP 2981\"}},\"setRecipient(address)\":{\"details\":\"can only be called by the admin.\",\"params\":{\"_commonRecipient\":\"is the common recipient for all the splitters\"}},\"setRoyaltyRecipient(address)\":{\"details\":\"should be called by the creator. The bps is not set on the splitter as it is set here on manager contract.\",\"params\":{\"recipient\":\"new recipient wallet.\"}},\"setSplit(uint16)\":{\"details\":\"can only be called by the admin.\",\"params\":{\"_commonSplit\":\"split for the common recipient and creators split would be 10000 - commonSplit\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"title\":\"RoyaltyManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"deploySplitter(address,address)\":{\"notice\":\"deploys splitter for creator\"},\"getCommonRecipient()\":{\"notice\":\"to be called by the splitters to get the common recipient and split\"},\"getCreatorRoyaltySplitter(address)\":{\"notice\":\"returns the address of splitter of a creator.\"},\"getCreatorSplit()\":{\"notice\":\"to be called by the splitters to get the common recipient and split\"},\"getRoyaltyInfo()\":{\"notice\":\"returns the commonRecipient and EIP2981 royalty split\"},\"initialize(address,uint16,address,address,address)\":{\"notice\":\"initialization function for the deployment of contract\"},\"setContractRoyalty(address,uint16)\":{\"notice\":\"called to set the EIP 2981 royalty split\"},\"setRecipient(address)\":{\"notice\":\"sets the common recipient and common split\"},\"setRoyaltyRecipient(address)\":{\"notice\":\"sets royalty recipient wallet\"},\"setSplit(uint16)\":{\"notice\":\"sets the common recipient and common split\"}},\"notice\":\"Registry contract to set the common Recipient and Split for the RoyaltySplitter. Also, to set the royalty info for contracts that don't use the RoyaltySplitter.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol\":\"RoyaltyManager\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@manifoldxyz/royalty-registry-solidity/contracts/libraries/BytesLibrary.sol\":{\"content\":\"// SPDX-License-Identifier: MIT OR Apache-2.0\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice A library for manipulation of byte arrays.\\n */\\nlibrary BytesLibrary {\\n /**\\n * @dev Replace the address at the given location in a byte array if the contents at that location\\n * match the expected address.\\n */\\n function replaceAtIf(bytes memory data, uint256 startLocation, address expectedAddress, address newAddress)\\n internal\\n pure\\n {\\n bytes memory expectedData = abi.encodePacked(expectedAddress);\\n bytes memory newData = abi.encodePacked(newAddress);\\n // An address is 20 bytes long\\n for (uint256 i = 0; i < 20; i++) {\\n uint256 dataLocation = startLocation + i;\\n require(data[dataLocation] == expectedData[i], \\\"Bytes: Data provided does not include the expectedAddress\\\");\\n data[dataLocation] = newData[i];\\n }\\n }\\n\\n /**\\n * @dev Checks if the call data starts with the given function signature.\\n */\\n function startsWith(bytes memory callData, bytes4 functionSig) internal pure returns (bool) {\\n // A signature is 4 bytes long\\n if (callData.length < 4) {\\n return false;\\n }\\n for (uint256 i = 0; i < 4; i++) {\\n if (callData[i] != functionSig[i]) {\\n return false;\\n }\\n }\\n\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x73fd074a57bd5d185ffb79dd98bb8db2e97c2d7df064d83f3f42da15ab9da8a1\",\"license\":\"MIT OR Apache-2.0\"},\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/// @author: manifold.xyz\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\nstruct Recipient {\\n address payable recipient;\\n uint16 bps;\\n}\\n\\ninterface IRoyaltySplitter is IERC165 {\\n /**\\n * @dev Set the splitter recipients. Total bps must total 10000.\\n */\\n function setRecipients(Recipient[] calldata recipients) external;\\n\\n /**\\n * @dev Get the splitter recipients;\\n */\\n function getRecipients() external view returns (Recipient[] memory);\\n}\\n\",\"keccak256\":\"0xc507963f66c4238d25e69d2d05ac5995c549aa89789e89e7a556403221547c6d\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlUpgradeable.sol\\\";\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\\n function __AccessControl_init() internal onlyInitializing {\\n }\\n\\n function __AccessControl_init_unchained() internal onlyInitializing {\\n }\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n StringsUpgradeable.toHexString(account),\\n \\\" is missing role \\\",\\n StringsUpgradeable.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xfeefb24d068524440e1ba885efdf105d91f83504af3c2d745ffacc4595396831\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControlUpgradeable {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0xb8f5302f12138c5561362e88a78d061573e6298b7a1a5afe84a1e2c8d4d5aeaa\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized != type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary MathUpgradeable {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Clones.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\\n * deploying minimal proxy contracts, also known as \\\"clones\\\".\\n *\\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\\n *\\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\\n * deterministic method.\\n *\\n * _Available since v3.4._\\n */\\nlibrary Clones {\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create opcode, which should never revert.\\n */\\n function clone(address implementation) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create(0, 0x09, 0x37)\\n }\\n require(instance != address(0), \\\"ERC1167: create failed\\\");\\n }\\n\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create2 opcode and a `salt` to deterministically deploy\\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\\n * the clones cannot be deployed twice at the same address.\\n */\\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create2(0, 0x09, 0x37, salt)\\n }\\n require(instance != address(0), \\\"ERC1167: create2 failed\\\");\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt,\\n address deployer\\n ) internal pure returns (address predicted) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(add(ptr, 0x38), deployer)\\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\\n mstore(add(ptr, 0x14), implementation)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\\n mstore(add(ptr, 0x58), salt)\\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\\n predicted := keccak256(add(ptr, 0x43), 0x55)\\n }\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt\\n ) internal view returns (address predicted) {\\n return predictDeterministicAddress(implementation, salt, address(this));\\n }\\n}\\n\",\"keccak256\":\"0x01f055f5c26ba25d7f83e9aa9ba877fbea4d0bf22227de046ea67494bc932999\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n// CAUTION\\n// This version of SafeMath should only be used with Solidity 0.8 or later,\\n// because it relies on the compiler's built in overflow checks.\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations.\\n *\\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\\n * now has built in overflow checking.\\n */\\nlibrary SafeMath {\\n /**\\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n uint256 c = a + b;\\n if (c < a) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b == 0) return (false, 0);\\n return (true, a / b);\\n }\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\n }\\n\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a + b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a * b;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator.\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a % b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {trySub}.\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n unchecked {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting with custom message when dividing by zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryMod}.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a % b;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x58b21219689909c4f8339af00813760337f7e2e7f169a97fe49e2896dcfb3b9a\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT OR Apache-2.0\\npragma solidity ^0.8.0;\\n\\nimport {AccessControlUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {IRoyaltyManager} from \\\"./interfaces/IRoyaltyManager.sol\\\";\\nimport {\\n IRoyaltySplitter,\\n Recipient\\n} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\nimport {RoyaltySplitter} from \\\"./RoyaltySplitter.sol\\\";\\nimport {Clones} from \\\"@openzeppelin/contracts/proxy/Clones.sol\\\";\\n\\n/// @title RoyaltyManager\\n/// @author The Sandbox\\n/// @notice Registry contract to set the common Recipient and Split for the RoyaltySplitter. Also, to set the royalty info\\n/// for contracts that don't use the RoyaltySplitter.\\ncontract RoyaltyManager is AccessControlUpgradeable, IRoyaltyManager {\\n bytes32 public constant CONTRACT_ROYALTY_SETTER_ROLE = keccak256(\\\"CONTRACT_ROYALTY_SETTER\\\");\\n\\n uint16 internal constant TOTAL_BASIS_POINTS = 10000;\\n uint16 public commonSplit;\\n address payable public commonRecipient;\\n mapping(address => uint16) public contractRoyalty;\\n mapping(address => address payable) public _creatorRoyaltiesSplitter;\\n address internal _royaltySplitterCloneable;\\n\\n /// @notice initialization function for the deployment of contract\\n /// @dev called during the deployment via the proxy.\\n /// @param _commonRecipient the != address(0)common recipient for all the splitters\\n /// @param _commonSplit split for the common recipient's and creator split would be 10000 - commonSplit\\n /// @param royaltySplitterCloneable address of cloneable splitter contract for royalties distribution\\n /// @param managerAdmin address of RoyaltyManager contract.\\n /// @param contractRoyaltySetter the address of royalty setter of contract.\\n function initialize(\\n address payable _commonRecipient,\\n uint16 _commonSplit,\\n address royaltySplitterCloneable,\\n address managerAdmin,\\n address contractRoyaltySetter\\n ) external initializer {\\n _setRecipient(_commonRecipient);\\n _setSplit(_commonSplit);\\n _grantRole(DEFAULT_ADMIN_ROLE, managerAdmin);\\n _grantRole(CONTRACT_ROYALTY_SETTER_ROLE, contractRoyaltySetter);\\n _royaltySplitterCloneable = royaltySplitterCloneable;\\n }\\n\\n /// @notice sets royalty recipient wallet\\n /// @dev should be called by the creator. The bps is not set on the splitter as it is set here on manager contract.\\n /// @param recipient new recipient wallet.\\n function setRoyaltyRecipient(address payable recipient) external {\\n address payable creatorSplitterAddress = _creatorRoyaltiesSplitter[msg.sender];\\n require(creatorSplitterAddress != address(0), \\\"Manager: No splitter deployed for the creator\\\");\\n address _recipient = RoyaltySplitter(creatorSplitterAddress)._recipient();\\n require(_recipient != recipient, \\\"Recipient already set\\\");\\n Recipient[] memory newRecipient = new Recipient[](1);\\n newRecipient[0] = Recipient({recipient: recipient, bps: 0});\\n RoyaltySplitter(creatorSplitterAddress).setRecipients(newRecipient);\\n }\\n\\n /// @notice sets the common recipient and common split\\n /// @dev can only be called by the admin.\\n /// @param _commonRecipient is the common recipient for all the splitters\\n function setRecipient(address payable _commonRecipient) external override onlyRole(DEFAULT_ADMIN_ROLE) {\\n _setRecipient(_commonRecipient);\\n }\\n\\n /// @notice sets the common recipient and common split\\n /// @dev can only be called by the admin.\\n /// @param _commonSplit split for the common recipient and creators split would be 10000 - commonSplit\\n function setSplit(uint16 _commonSplit) external override onlyRole(DEFAULT_ADMIN_ROLE) {\\n _setSplit(_commonSplit);\\n }\\n\\n function _setRecipient(address payable _commonRecipient) internal {\\n require(_commonRecipient != address(0), \\\"Manager: Can't set common recipient to zero address\\\");\\n commonRecipient = _commonRecipient;\\n emit RecipientSet(_commonRecipient);\\n }\\n\\n function _setSplit(uint16 _commonSplit) internal {\\n require(_commonSplit < TOTAL_BASIS_POINTS, \\\"Manager: Can't set common recipient to zero address\\\");\\n commonSplit = _commonSplit;\\n emit SplitSet(_commonSplit);\\n }\\n\\n /// @notice called to set the EIP 2981 royalty split\\n /// @dev can only be called by contract royalty setter.\\n /// @param _royaltyBps the royalty split for the EIP 2981\\n function setContractRoyalty(address contractAddress, uint16 _royaltyBps)\\n external\\n onlyRole(CONTRACT_ROYALTY_SETTER_ROLE)\\n {\\n require(_royaltyBps < TOTAL_BASIS_POINTS, \\\"Manager: Royalty can't be greater than Total base points\\\");\\n contractRoyalty[contractAddress] = _royaltyBps;\\n emit RoyaltySet(_royaltyBps, contractAddress);\\n }\\n\\n /// @notice to be called by the splitters to get the common recipient and split\\n /// @return recipient which has the common recipient and split\\n function getCommonRecipient() external view override returns (Recipient memory recipient) {\\n recipient = Recipient({recipient: commonRecipient, bps: commonSplit});\\n return recipient;\\n }\\n\\n /// @notice deploys splitter for creator\\n /// @dev should only called once per creator\\n /// @param creator the address of the creator\\n /// @param recipient the wallet of the recipient where they would receive their royalty\\n /// @return creatorSplitterAddress deployed for a creator\\n function deploySplitter(address creator, address payable recipient) external returns (address payable) {\\n address payable creatorSplitterAddress = _creatorRoyaltiesSplitter[creator];\\n if (creatorSplitterAddress == address(0)) {\\n creatorSplitterAddress = payable(Clones.clone(_royaltySplitterCloneable));\\n RoyaltySplitter(creatorSplitterAddress).initialize(recipient, address(this));\\n _creatorRoyaltiesSplitter[creator] = creatorSplitterAddress;\\n }\\n return creatorSplitterAddress;\\n }\\n\\n /// @notice returns the address of splitter of a creator.\\n /// @param creator the address of the creator\\n /// @return creatorSplitterAddress deployed for a creator\\n function getCreatorRoyaltySplitter(address creator) external view returns (address payable) {\\n return _creatorRoyaltiesSplitter[creator];\\n }\\n\\n /// @notice to be called by the splitters to get the common recipient and split\\n /// @return creatorSplit which is 10000 - commonSplit\\n function getCreatorSplit() external view returns (uint16) {\\n return TOTAL_BASIS_POINTS - commonSplit;\\n }\\n\\n /// @notice returns the commonRecipient and EIP2981 royalty split\\n /// @return commonRecipient\\n /// @return royaltySplit\\n function getRoyaltyInfo() external view returns (address, uint16) {\\n return (commonRecipient, contractRoyalty[msg.sender]);\\n }\\n}\\n\",\"keccak256\":\"0x8d1363a7edce6f7d3318ade536a19f316d53cec1aab3558fdca4e4350fb906ee\",\"license\":\"MIT OR Apache-2.0\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT OR Apache-2.0\\npragma solidity ^0.8.0;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {AddressUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\\\";\\nimport {ERC165Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\\\";\\nimport {SafeMath} from \\\"@openzeppelin/contracts/utils/math/SafeMath.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {BytesLibrary} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/libraries/BytesLibrary.sol\\\";\\nimport {\\n IRoyaltySplitter,\\n IERC165,\\n Recipient\\n} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\nimport {IRoyaltyManager} from \\\"./interfaces/IRoyaltyManager.sol\\\";\\nimport {IERC20Approve} from \\\"./interfaces/IERC20Approve.sol\\\";\\n\\n/// @title RoyaltySplitter\\n/// @author The Sandbox\\n/// @notice RoyaltySplitter contract is deployed by the RoyaltyManager contract for a creator to get his royalty's share.\\ncontract RoyaltySplitter is Initializable, OwnableUpgradeable, IRoyaltySplitter, ERC165Upgradeable {\\n using BytesLibrary for bytes;\\n using AddressUpgradeable for address payable;\\n using AddressUpgradeable for address;\\n using SafeMath for uint256;\\n\\n uint256 internal constant TOTAL_BASIS_POINTS = 10000;\\n uint256 internal constant IERC20_APPROVE_SELECTOR =\\n 0x095ea7b300000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant SELECTOR_MASK = 0xffffffff00000000000000000000000000000000000000000000000000000000;\\n\\n address payable public _recipient;\\n IRoyaltyManager public _royaltyManager;\\n\\n event ETHTransferred(address indexed account, uint256 amount);\\n event ERC20Transferred(address indexed erc20Contract, address indexed account, uint256 amount);\\n\\n function supportsInterface(bytes4 interfaceId)\\n public\\n view\\n virtual\\n override(IERC165, ERC165Upgradeable)\\n returns (bool)\\n {\\n return interfaceId == type(IRoyaltySplitter).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /// @notice initialize the contract\\n /// @dev can only be run once.\\n /// @param recipient the wallet of the creator when the contract is deployed\\n /// @param royaltyManager the address of the royalty manager contract.\\n function initialize(address payable recipient, address royaltyManager) public initializer {\\n __Ownable_init();\\n _royaltyManager = IRoyaltyManager(royaltyManager);\\n _recipient = recipient;\\n }\\n\\n /// @notice sets recipient for the splitter\\n /// @dev only the owner can call this.\\n /// @param recipients the array of recipients which should only have one recipient.\\n function setRecipients(Recipient[] calldata recipients) external override onlyOwner {\\n _setRecipients(recipients);\\n }\\n\\n function _setRecipients(Recipient[] calldata recipients) private {\\n delete _recipient;\\n require(recipients.length == 1, \\\"Invalid recipents length\\\");\\n _recipient = recipients[0].recipient;\\n }\\n\\n /// @notice to get recipients of royalty through this splitter and their splits of royalty.\\n /// @return recipients of royalty through this splitter and their splits of royalty.\\n function getRecipients() external view override returns (Recipient[] memory) {\\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\\n uint16 creatorSplit = _royaltyManager.getCreatorSplit();\\n Recipient[] memory recipients = new Recipient[](2);\\n recipients[0].recipient = _recipient;\\n recipients[0].bps = creatorSplit;\\n recipients[1] = commonRecipient;\\n return recipients;\\n }\\n\\n /// @notice Splits and forwards ETH to the royalty receivers\\n /// @dev splits ETH every time it is sent to this contract as royalty.\\n receive() external payable {\\n _splitETH(msg.value);\\n }\\n\\n /// @notice Splits and forwards ETH to the royalty receivers\\n /// @dev normally ETH should be split automatically by receive function.\\n function splitETH() public {\\n _splitETH(address(this).balance);\\n }\\n\\n function _splitETH(uint256 value) internal {\\n if (value > 0) {\\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\\n uint16 creatorSplit = _royaltyManager.getCreatorSplit();\\n Recipient[] memory _recipients = new Recipient[](2);\\n _recipients[0].recipient = _recipient;\\n _recipients[0].bps = creatorSplit;\\n _recipients[1] = commonRecipient;\\n uint256 totalSent;\\n uint256 amountToSend;\\n unchecked {\\n for (uint256 i = _recipients.length - 1; i > 0; i--) {\\n Recipient memory recipient = _recipients[i];\\n amountToSend = (value * recipient.bps) / TOTAL_BASIS_POINTS;\\n totalSent += amountToSend;\\n recipient.recipient.sendValue(amountToSend);\\n emit ETHTransferred(recipient.recipient, amountToSend);\\n }\\n // Favor the 1st recipient if there are any rounding issues\\n amountToSend = value - totalSent;\\n }\\n _recipients[0].recipient.sendValue(amountToSend);\\n emit ETHTransferred(_recipients[0].recipient, amountToSend);\\n }\\n }\\n\\n /// @notice split ERC20 Tokens owned by this contract.\\n /// @dev can only be called by one of the recipients\\n /// @param erc20Contract the address of the tokens to be split.\\n function splitERC20Tokens(IERC20 erc20Contract) public {\\n require(_splitERC20Tokens(erc20Contract), \\\"Split: ERC20 split failed\\\");\\n }\\n\\n function _splitERC20Tokens(IERC20 erc20Contract) internal returns (bool) {\\n try erc20Contract.balanceOf(address(this)) returns (uint256 balance) {\\n if (balance == 0) {\\n return false;\\n }\\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\\n uint16 creatorSplit = _royaltyManager.getCreatorSplit();\\n require(\\n commonRecipient.recipient == msg.sender || _recipient == msg.sender,\\n \\\"Split: Can only be called by one of the recipients\\\"\\n );\\n Recipient[] memory _recipients = new Recipient[](2);\\n _recipients[0].recipient = _recipient;\\n _recipients[0].bps = creatorSplit;\\n _recipients[1] = commonRecipient;\\n uint256 amountToSend;\\n uint256 totalSent;\\n unchecked {\\n for (uint256 i = _recipients.length - 1; i > 0; i--) {\\n Recipient memory recipient = _recipients[i];\\n bool success;\\n (success, amountToSend) = balance.tryMul(recipient.bps);\\n\\n amountToSend /= TOTAL_BASIS_POINTS;\\n totalSent += amountToSend;\\n try erc20Contract.transfer(recipient.recipient, amountToSend) {\\n emit ERC20Transferred(address(erc20Contract), recipient.recipient, amountToSend);\\n } catch {\\n return false;\\n }\\n }\\n // Favor the 1st recipient if there are any rounding issues\\n amountToSend = balance - totalSent;\\n }\\n try erc20Contract.transfer(_recipients[0].recipient, amountToSend) {\\n emit ERC20Transferred(address(erc20Contract), _recipients[0].recipient, amountToSend);\\n } catch {\\n return false;\\n }\\n return true;\\n } catch {\\n return false;\\n }\\n }\\n\\n /// @notice made for unexpected scenarios when assets are sent to this contact such that they could be recovered.\\n /// @dev first attempts to split ERC20 tokens.\\n /// @param target target of the call\\n /// @param callData for the call.\\n function proxyCall(address payable target, bytes calldata callData) external {\\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\\n require(\\n commonRecipient.recipient == msg.sender || _recipient == msg.sender,\\n \\\"Split: Can only be called by one of the recipients\\\"\\n );\\n require(\\n !callData.startsWith(IERC20Approve.approve.selector) &&\\n !callData.startsWith(IERC20Approve.increaseAllowance.selector),\\n \\\"Split: ERC20 tokens must be split\\\"\\n );\\n /* solhint-disable-next-line no-empty-blocks*/\\n try this.splitERC20Tokens(IERC20(target)) {} catch {}\\n target.functionCall(callData);\\n }\\n}\\n\",\"keccak256\":\"0xd52e3efec844be663b42f3da10327139c77b852c5633cd5465c40e72f046c422\",\"license\":\"MIT OR Apache-2.0\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IERC20Approve.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\ninterface IERC20Approve {\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n function increaseAllowance(address spender, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x1f1e86109f5d15e996f94a30a4b4760b9c6b0f17bfff9e88e37714bd65b02f12\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {Recipient} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\n\\ninterface IRoyaltyManager {\\n event RecipientSet(address commonRecipient);\\n\\n event SplitSet(uint16 commonSplit);\\n\\n event RoyaltySet(uint16 royaltyBps, address contractAddress);\\n\\n function setRecipient(address payable _commonRecipient) external;\\n\\n function setSplit(uint16 commonSplit) external;\\n\\n function getCommonRecipient() external view returns (Recipient memory recipient);\\n\\n function getCreatorSplit() external view returns (uint16);\\n\\n function getRoyaltyInfo() external view returns (address, uint16);\\n\\n function deploySplitter(address creator, address payable recipient) external returns (address payable);\\n\\n function getCreatorRoyaltySplitter(address creator) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x095c8e09d23bdffd2ca759f153cfc7a5e8d20dc099f41acac67357e933455646\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50611661806100206000396000f3fe608060405234801561001057600080fd5b50600436106101825760003560e01c80638b49fde7116100d8578063b0c5b7d81161008c578063d547741f11610066578063d547741f146103f4578063db06fff514610407578063f06040b41461043357600080fd5b8063b0c5b7d8146103aa578063c0bd4cdd146103bd578063d0b72b93146103e157600080fd5b8063a217fddf116100bd578063a217fddf14610340578063a582f20714610348578063a86a28d11461037157600080fd5b80638b49fde7146102c257806391d148541461030757600080fd5b806336568abe1161013a57806366cb20631161011457806366cb206314610280578063706ec2fe146102a7578063733fc03d146102af57600080fd5b806336568abe146102475780633bbed4a01461025a57806341e42f301461026d57600080fd5b806315a86f5e1161016b57806315a86f5e146101d0578063248a9ca3146102015780632f2ff15d1461023257600080fd5b806301ffc9a71461018757806311edb735146101af575b600080fd5b61019a61019536600461122f565b610446565b60405190151581526020015b60405180910390f35b6097546101bd9061ffff1681565b60405161ffff90911681526020016101a6565b6097546101e9906201000090046001600160a01b031681565b6040516001600160a01b0390911681526020016101a6565b61022461020f366004611271565b60009081526065602052604090206001015490565b6040519081526020016101a6565b61024561024036600461129f565b6104df565b005b61024561025536600461129f565b610509565b6102456102683660046112cf565b61059a565b61024561027b3660046112cf565b6105ae565b6102247f35ee06f2b11054b099ebf059488ad39add9bda510bd8c8709f3b502faeb3ace681565b6101bd6107ff565b6102456102bd3660046112fe565b61081a565b604080518082018252600080825260209182015281518083019092526097546001600160a01b0362010000820416835261ffff16908201526040516101a69190611319565b61019a61031536600461129f565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b610224600081565b6101e96103563660046112cf565b6099602052600090815260409020546001600160a01b031681565b60975433600090815260986020908152604091829020548251620100009094046001600160a01b0316845261ffff1690830152016101a6565b6102456103b836600461133d565b61082e565b6101bd6103cb3660046112cf565b60986020526000908152604090205461ffff1681565b6102456103ef3660046113ac565b6109c5565b61024561040236600461129f565b610ad4565b6101e96104153660046112cf565b6001600160a01b039081166000908152609960205260409020541690565b6101e96104413660046113e1565b610af9565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806104d957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6000828152606560205260409020600101546104fa81610bfc565b6105048383610c09565b505050565b6001600160a01b038116331461058c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6105968282610cab565b5050565b60006105a581610bfc565b61059682610d2e565b336000908152609960205260409020546001600160a01b03168061063a5760405162461bcd60e51b815260206004820152602d60248201527f4d616e616765723a204e6f2073706c6974746572206465706c6f79656420666f60448201527f72207468652063726561746f72000000000000000000000000000000000000006064820152608401610583565b6000816001600160a01b031663d4cca5f16040518163ffffffff1660e01b8152600401602060405180830381865afa15801561067a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069e919061140f565b9050826001600160a01b0316816001600160a01b0316036107015760405162461bcd60e51b815260206004820152601560248201527f526563697069656e7420616c72656164792073657400000000000000000000006044820152606401610583565b604080516001808252818301909252600091816020015b60408051808201909152600080825260208201528152602001906001900390816107185790505090506040518060400160405280856001600160a01b03168152602001600061ffff168152508160008151811061077757610777611442565b60209081029190910101526040517fc1426d0e0000000000000000000000000000000000000000000000000000000081526001600160a01b0384169063c1426d0e906107c7908490600401611458565b600060405180830381600087803b1580156107e157600080fd5b505af11580156107f5573d6000803e3d6000fd5b5050505050505050565b6097546000906108159061ffff166127106114d2565b905090565b600061082581610bfc565b61059682610e1f565b600054610100900460ff161580801561084e5750600054600160ff909116105b806108685750303b158015610868575060005460ff166001145b6108da5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610583565b6000805460ff1916600117905580156108fd576000805461ff0019166101001790555b61090686610d2e565b61090f85610e1f565b61091a600084610c09565b6109447f35ee06f2b11054b099ebf059488ad39add9bda510bd8c8709f3b502faeb3ace683610c09565b609a80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03861617905580156109bd576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b7f35ee06f2b11054b099ebf059488ad39add9bda510bd8c8709f3b502faeb3ace66109ef81610bfc565b61271061ffff831610610a6a5760405162461bcd60e51b815260206004820152603860248201527f4d616e616765723a20526f79616c74792063616e27742062652067726561746560448201527f72207468616e20546f74616c206261736520706f696e747300000000000000006064820152608401610583565b6001600160a01b038316600081815260986020908152604091829020805461ffff191661ffff87169081179091558251908152908101929092527f7f9762123fb25c27c3aa0ecf56eeed3e1518bc8ee29086c7ff5dd6238a37c264910160405180910390a1505050565b600082815260656020526040902060010154610aef81610bfc565b6105048383610cab565b6001600160a01b0380831660009081526099602052604081205490911680610bf557609a54610b30906001600160a01b0316610ede565b6040517f485cc9550000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301523060248301529192509082169063485cc95590604401600060405180830381600087803b158015610b9657600080fd5b505af1158015610baa573d6000803e3d6000fd5b505050506001600160a01b03848116600090815260996020526040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169183169190911790555b9392505050565b610c068133610f7f565b50565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166105965760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610c673390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16156105965760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b038116610daa5760405162461bcd60e51b815260206004820152603360248201527f4d616e616765723a2043616e27742073657420636f6d6d6f6e2072656369706960448201527f656e7420746f207a65726f2061646472657373000000000000000000000000006064820152608401610583565b609780547fffffffffffffffffffff0000000000000000000000000000000000000000ffff16620100006001600160a01b038416908102919091179091556040519081527f9d900d71c28433348acb1bec780a061608a96b149370abce77fd54ba2d479401906020015b60405180910390a150565b61271061ffff821610610e9a5760405162461bcd60e51b815260206004820152603360248201527f4d616e616765723a2043616e27742073657420636f6d6d6f6e2072656369706960448201527f656e7420746f207a65726f2061646472657373000000000000000000000000006064820152608401610583565b6097805461ffff191661ffff83169081179091556040519081527fb8dc7db64fd987e5b05af4eb247387c388b40222e3ecb8c029b8a62227d4d28b90602001610e14565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f090506001600160a01b038116610f7a5760405162461bcd60e51b815260206004820152601660248201527f455243313136373a20637265617465206661696c6564000000000000000000006044820152606401610583565b919050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff1661059657610fb281610ff4565b610fbd836020611006565b604051602001610fce929190611518565b60408051601f198184030181529082905262461bcd60e51b825261058391600401611599565b60606104d96001600160a01b03831660145b606060006110158360026115cc565b6110209060026115e3565b67ffffffffffffffff8111156110385761103861142c565b6040519080825280601f01601f191660200182016040528015611062576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061109957611099611442565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106110fc576110fc611442565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006111388460026115cc565b6111439060016115e3565b90505b60018111156111e0577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061118457611184611442565b1a60f81b82828151811061119a5761119a611442565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936111d9816115f6565b9050611146565b508315610bf55760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610583565b60006020828403121561124157600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610bf557600080fd5b60006020828403121561128357600080fd5b5035919050565b6001600160a01b0381168114610c0657600080fd5b600080604083850312156112b257600080fd5b8235915060208301356112c48161128a565b809150509250929050565b6000602082840312156112e157600080fd5b8135610bf58161128a565b803561ffff81168114610f7a57600080fd5b60006020828403121561131057600080fd5b610bf5826112ec565b81516001600160a01b0316815260208083015161ffff1690820152604081016104d9565b600080600080600060a0868803121561135557600080fd5b85356113608161128a565b945061136e602087016112ec565b9350604086013561137e8161128a565b9250606086013561138e8161128a565b9150608086013561139e8161128a565b809150509295509295909350565b600080604083850312156113bf57600080fd5b82356113ca8161128a565b91506113d8602084016112ec565b90509250929050565b600080604083850312156113f457600080fd5b82356113ff8161128a565b915060208301356112c48161128a565b60006020828403121561142157600080fd5b8151610bf58161128a565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b602080825282518282018190526000919060409081850190868401855b828110156114af5761149f84835180516001600160a01b0316825260209081015161ffff16910152565b9284019290850190600101611475565b5091979650505050505050565b634e487b7160e01b600052601160045260246000fd5b61ffff8281168282160390808211156114ed576114ed6114bc565b5092915050565b60005b8381101561150f5781810151838201526020016114f7565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516115508160178501602088016114f4565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161158d8160288401602088016114f4565b01602801949350505050565b60208152600082518060208401526115b88160408501602087016114f4565b601f01601f19169190910160400192915050565b80820281158282048414176104d9576104d96114bc565b808201808211156104d9576104d96114bc565b600081611605576116056114bc565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea2646970667358221220d13117f7d683f65a7fb4705157d2fafd59af3bd92f08801547a4470e1aa439f064736f6c63430008120033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101825760003560e01c80638b49fde7116100d8578063b0c5b7d81161008c578063d547741f11610066578063d547741f146103f4578063db06fff514610407578063f06040b41461043357600080fd5b8063b0c5b7d8146103aa578063c0bd4cdd146103bd578063d0b72b93146103e157600080fd5b8063a217fddf116100bd578063a217fddf14610340578063a582f20714610348578063a86a28d11461037157600080fd5b80638b49fde7146102c257806391d148541461030757600080fd5b806336568abe1161013a57806366cb20631161011457806366cb206314610280578063706ec2fe146102a7578063733fc03d146102af57600080fd5b806336568abe146102475780633bbed4a01461025a57806341e42f301461026d57600080fd5b806315a86f5e1161016b57806315a86f5e146101d0578063248a9ca3146102015780632f2ff15d1461023257600080fd5b806301ffc9a71461018757806311edb735146101af575b600080fd5b61019a61019536600461122f565b610446565b60405190151581526020015b60405180910390f35b6097546101bd9061ffff1681565b60405161ffff90911681526020016101a6565b6097546101e9906201000090046001600160a01b031681565b6040516001600160a01b0390911681526020016101a6565b61022461020f366004611271565b60009081526065602052604090206001015490565b6040519081526020016101a6565b61024561024036600461129f565b6104df565b005b61024561025536600461129f565b610509565b6102456102683660046112cf565b61059a565b61024561027b3660046112cf565b6105ae565b6102247f35ee06f2b11054b099ebf059488ad39add9bda510bd8c8709f3b502faeb3ace681565b6101bd6107ff565b6102456102bd3660046112fe565b61081a565b604080518082018252600080825260209182015281518083019092526097546001600160a01b0362010000820416835261ffff16908201526040516101a69190611319565b61019a61031536600461129f565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b610224600081565b6101e96103563660046112cf565b6099602052600090815260409020546001600160a01b031681565b60975433600090815260986020908152604091829020548251620100009094046001600160a01b0316845261ffff1690830152016101a6565b6102456103b836600461133d565b61082e565b6101bd6103cb3660046112cf565b60986020526000908152604090205461ffff1681565b6102456103ef3660046113ac565b6109c5565b61024561040236600461129f565b610ad4565b6101e96104153660046112cf565b6001600160a01b039081166000908152609960205260409020541690565b6101e96104413660046113e1565b610af9565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806104d957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6000828152606560205260409020600101546104fa81610bfc565b6105048383610c09565b505050565b6001600160a01b038116331461058c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6105968282610cab565b5050565b60006105a581610bfc565b61059682610d2e565b336000908152609960205260409020546001600160a01b03168061063a5760405162461bcd60e51b815260206004820152602d60248201527f4d616e616765723a204e6f2073706c6974746572206465706c6f79656420666f60448201527f72207468652063726561746f72000000000000000000000000000000000000006064820152608401610583565b6000816001600160a01b031663d4cca5f16040518163ffffffff1660e01b8152600401602060405180830381865afa15801561067a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069e919061140f565b9050826001600160a01b0316816001600160a01b0316036107015760405162461bcd60e51b815260206004820152601560248201527f526563697069656e7420616c72656164792073657400000000000000000000006044820152606401610583565b604080516001808252818301909252600091816020015b60408051808201909152600080825260208201528152602001906001900390816107185790505090506040518060400160405280856001600160a01b03168152602001600061ffff168152508160008151811061077757610777611442565b60209081029190910101526040517fc1426d0e0000000000000000000000000000000000000000000000000000000081526001600160a01b0384169063c1426d0e906107c7908490600401611458565b600060405180830381600087803b1580156107e157600080fd5b505af11580156107f5573d6000803e3d6000fd5b5050505050505050565b6097546000906108159061ffff166127106114d2565b905090565b600061082581610bfc565b61059682610e1f565b600054610100900460ff161580801561084e5750600054600160ff909116105b806108685750303b158015610868575060005460ff166001145b6108da5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610583565b6000805460ff1916600117905580156108fd576000805461ff0019166101001790555b61090686610d2e565b61090f85610e1f565b61091a600084610c09565b6109447f35ee06f2b11054b099ebf059488ad39add9bda510bd8c8709f3b502faeb3ace683610c09565b609a80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03861617905580156109bd576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b7f35ee06f2b11054b099ebf059488ad39add9bda510bd8c8709f3b502faeb3ace66109ef81610bfc565b61271061ffff831610610a6a5760405162461bcd60e51b815260206004820152603860248201527f4d616e616765723a20526f79616c74792063616e27742062652067726561746560448201527f72207468616e20546f74616c206261736520706f696e747300000000000000006064820152608401610583565b6001600160a01b038316600081815260986020908152604091829020805461ffff191661ffff87169081179091558251908152908101929092527f7f9762123fb25c27c3aa0ecf56eeed3e1518bc8ee29086c7ff5dd6238a37c264910160405180910390a1505050565b600082815260656020526040902060010154610aef81610bfc565b6105048383610cab565b6001600160a01b0380831660009081526099602052604081205490911680610bf557609a54610b30906001600160a01b0316610ede565b6040517f485cc9550000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301523060248301529192509082169063485cc95590604401600060405180830381600087803b158015610b9657600080fd5b505af1158015610baa573d6000803e3d6000fd5b505050506001600160a01b03848116600090815260996020526040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169183169190911790555b9392505050565b610c068133610f7f565b50565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166105965760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610c673390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16156105965760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b038116610daa5760405162461bcd60e51b815260206004820152603360248201527f4d616e616765723a2043616e27742073657420636f6d6d6f6e2072656369706960448201527f656e7420746f207a65726f2061646472657373000000000000000000000000006064820152608401610583565b609780547fffffffffffffffffffff0000000000000000000000000000000000000000ffff16620100006001600160a01b038416908102919091179091556040519081527f9d900d71c28433348acb1bec780a061608a96b149370abce77fd54ba2d479401906020015b60405180910390a150565b61271061ffff821610610e9a5760405162461bcd60e51b815260206004820152603360248201527f4d616e616765723a2043616e27742073657420636f6d6d6f6e2072656369706960448201527f656e7420746f207a65726f2061646472657373000000000000000000000000006064820152608401610583565b6097805461ffff191661ffff83169081179091556040519081527fb8dc7db64fd987e5b05af4eb247387c388b40222e3ecb8c029b8a62227d4d28b90602001610e14565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f090506001600160a01b038116610f7a5760405162461bcd60e51b815260206004820152601660248201527f455243313136373a20637265617465206661696c6564000000000000000000006044820152606401610583565b919050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff1661059657610fb281610ff4565b610fbd836020611006565b604051602001610fce929190611518565b60408051601f198184030181529082905262461bcd60e51b825261058391600401611599565b60606104d96001600160a01b03831660145b606060006110158360026115cc565b6110209060026115e3565b67ffffffffffffffff8111156110385761103861142c565b6040519080825280601f01601f191660200182016040528015611062576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061109957611099611442565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106110fc576110fc611442565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006111388460026115cc565b6111439060016115e3565b90505b60018111156111e0577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061118457611184611442565b1a60f81b82828151811061119a5761119a611442565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936111d9816115f6565b9050611146565b508315610bf55760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610583565b60006020828403121561124157600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610bf557600080fd5b60006020828403121561128357600080fd5b5035919050565b6001600160a01b0381168114610c0657600080fd5b600080604083850312156112b257600080fd5b8235915060208301356112c48161128a565b809150509250929050565b6000602082840312156112e157600080fd5b8135610bf58161128a565b803561ffff81168114610f7a57600080fd5b60006020828403121561131057600080fd5b610bf5826112ec565b81516001600160a01b0316815260208083015161ffff1690820152604081016104d9565b600080600080600060a0868803121561135557600080fd5b85356113608161128a565b945061136e602087016112ec565b9350604086013561137e8161128a565b9250606086013561138e8161128a565b9150608086013561139e8161128a565b809150509295509295909350565b600080604083850312156113bf57600080fd5b82356113ca8161128a565b91506113d8602084016112ec565b90509250929050565b600080604083850312156113f457600080fd5b82356113ff8161128a565b915060208301356112c48161128a565b60006020828403121561142157600080fd5b8151610bf58161128a565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b602080825282518282018190526000919060409081850190868401855b828110156114af5761149f84835180516001600160a01b0316825260209081015161ffff16910152565b9284019290850190600101611475565b5091979650505050505050565b634e487b7160e01b600052601160045260246000fd5b61ffff8281168282160390808211156114ed576114ed6114bc565b5092915050565b60005b8381101561150f5781810151838201526020016114f7565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516115508160178501602088016114f4565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161158d8160288401602088016114f4565b01602801949350505050565b60208152600082518060208401526115b88160408501602087016114f4565b601f01601f19169190910160400192915050565b80820281158282048414176104d9576104d96114bc565b808201808211156104d9576104d96114bc565b600081611605576116056114bc565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea2646970667358221220d13117f7d683f65a7fb4705157d2fafd59af3bd92f08801547a4470e1aa439f064736f6c63430008120033", + "solcInputHash": "e64fd56b3bfae7f817a31de5cae19a1b", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"commonRecipient\",\"type\":\"address\"}],\"name\":\"RecipientSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"royaltyBps\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"}],\"name\":\"RoyaltySet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"commonSplit\",\"type\":\"uint16\"}],\"name\":\"SplitSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"CONTRACT_ROYALTY_SETTER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"_creatorRoyaltiesSplitter\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"commonRecipient\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"commonSplit\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"contractRoyalty\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"deploySplitter\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCommonRecipient\",\"outputs\":[{\"components\":[{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"bps\",\"type\":\"uint16\"}],\"internalType\":\"struct Recipient\",\"name\":\"recipient\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_contractAddress\",\"type\":\"address\"}],\"name\":\"getContractRoyalty\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"royaltyBps\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"}],\"name\":\"getCreatorRoyaltySplitter\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCreatorSplit\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRoyaltyInfo\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTrustedForwarder\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"_commonRecipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"_commonSplit\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"royaltySplitterCloneable\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"managerAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"contractRoyaltySetter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"trustedForwarder\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"_royaltyBps\",\"type\":\"uint16\"}],\"name\":\"setContractRoyalty\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"_commonRecipient\",\"type\":\"address\"}],\"name\":\"setRecipient\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setRoyaltyRecipient\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_commonSplit\",\"type\":\"uint16\"}],\"name\":\"setSplit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newForwarder\",\"type\":\"address\"}],\"name\":\"setTrustedForwarder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"The Sandbox\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"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._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"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`)\"}},\"kind\":\"dev\",\"methods\":{\"deploySplitter(address,address)\":{\"details\":\"should only called once per creator\",\"params\":{\"creator\":\"the address of the creator\",\"recipient\":\"the wallet of the recipient where they would receive their royalty\"},\"returns\":{\"_0\":\"creatorSplitterAddress deployed for a creator\"}},\"getCommonRecipient()\":{\"returns\":{\"recipient\":\"which has the common recipient and split\"}},\"getContractRoyalty(address)\":{\"params\":{\"_contractAddress\":\"the address of the contract for which the royalty is required.\"},\"returns\":{\"royaltyBps\":\"royalty bps of the contarct\"}},\"getCreatorRoyaltySplitter(address)\":{\"params\":{\"creator\":\"the address of the creator\"},\"returns\":{\"_0\":\"creatorSplitterAddress deployed for a creator\"}},\"getCreatorSplit()\":{\"returns\":{\"_0\":\"creatorSplit which is 10000 - commonSplit\"}},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getRoyaltyInfo()\":{\"returns\":{\"_0\":\"commonRecipient\",\"_1\":\"royaltySplit\"}},\"grantRole(bytes32,address)\":{\"details\":\"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.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"initialize(address,uint16,address,address,address,address)\":{\"details\":\"called during the deployment via the proxy.\",\"params\":{\"_commonRecipient\":\"the != address(0)common recipient for all the splitters\",\"_commonSplit\":\"split for the common recipient's and creator split would be 10000 - commonSplit\",\"contractRoyaltySetter\":\"the address of royalty setter of contract.\",\"managerAdmin\":\"address of RoyaltyManager contract.\",\"royaltySplitterCloneable\":\"address of cloneable splitter contract for royalties distribution\",\"trustedForwarder\":\"the trustedForwarder address for royalty splitters to use.\"}},\"renounceRole(bytes32,address)\":{\"details\":\"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.\"},\"revokeRole(bytes32,address)\":{\"details\":\"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.\"},\"setContractRoyalty(address,uint16)\":{\"details\":\"can only be called by contract royalty setter.\",\"params\":{\"_royaltyBps\":\"the royalty split for the EIP 2981\"}},\"setRecipient(address)\":{\"details\":\"can only be called by the admin\",\"params\":{\"_commonRecipient\":\"is the common recipient for all the splitters\"}},\"setRoyaltyRecipient(address)\":{\"details\":\"should be called by the creator. The bps is not set on the splitter as it is set here on manager contract.\",\"params\":{\"recipient\":\"new recipient wallet.\"}},\"setSplit(uint16)\":{\"details\":\"can only be called by the admin.\",\"params\":{\"_commonSplit\":\"split for the common recipient and creators split would be 10000 - commonSplit\"}},\"setTrustedForwarder(address)\":{\"details\":\"can only be called by the adminnew splitters will be deployed with this setting; existing splitters will have to apply it\",\"params\":{\"_newForwarder\":\"is the new trusted forwarder address\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"title\":\"RoyaltyManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"deploySplitter(address,address)\":{\"notice\":\"deploys splitter for creator\"},\"getCommonRecipient()\":{\"notice\":\"to be called by the splitters to get the common recipient and split\"},\"getContractRoyalty(address)\":{\"notice\":\"returns the commonRecipient and EIP2981 royalty split\"},\"getCreatorRoyaltySplitter(address)\":{\"notice\":\"returns the address of splitter of a creator.\"},\"getCreatorSplit()\":{\"notice\":\"to be called by the splitters to get the common recipient and split\"},\"getRoyaltyInfo()\":{\"notice\":\"returns the commonRecipient and EIP2981 royalty split\"},\"getTrustedForwarder()\":{\"notice\":\"get the current trustedForwarder address\"},\"initialize(address,uint16,address,address,address,address)\":{\"notice\":\"initialization function for the deployment of contract\"},\"setContractRoyalty(address,uint16)\":{\"notice\":\"called to set the EIP 2981 royalty split\"},\"setRecipient(address)\":{\"notice\":\"sets the common recipient and common split\"},\"setRoyaltyRecipient(address)\":{\"notice\":\"sets royalty recipient wallet\"},\"setSplit(uint16)\":{\"notice\":\"sets the common recipient and common split\"},\"setTrustedForwarder(address)\":{\"notice\":\"sets the trustedForwarder address to be used by the splitters\"}},\"notice\":\"Registry contract to set the common Recipient and Split for the RoyaltySplitter. Also, to set the royalty info for contracts that don't use the RoyaltySplitter.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol\":\"RoyaltyManager\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@manifoldxyz/royalty-registry-solidity/contracts/libraries/BytesLibrary.sol\":{\"content\":\"// SPDX-License-Identifier: MIT OR Apache-2.0\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice A library for manipulation of byte arrays.\\n */\\nlibrary BytesLibrary {\\n /**\\n * @dev Replace the address at the given location in a byte array if the contents at that location\\n * match the expected address.\\n */\\n function replaceAtIf(bytes memory data, uint256 startLocation, address expectedAddress, address newAddress)\\n internal\\n pure\\n {\\n bytes memory expectedData = abi.encodePacked(expectedAddress);\\n bytes memory newData = abi.encodePacked(newAddress);\\n // An address is 20 bytes long\\n for (uint256 i = 0; i < 20; i++) {\\n uint256 dataLocation = startLocation + i;\\n require(data[dataLocation] == expectedData[i], \\\"Bytes: Data provided does not include the expectedAddress\\\");\\n data[dataLocation] = newData[i];\\n }\\n }\\n\\n /**\\n * @dev Checks if the call data starts with the given function signature.\\n */\\n function startsWith(bytes memory callData, bytes4 functionSig) internal pure returns (bool) {\\n // A signature is 4 bytes long\\n if (callData.length < 4) {\\n return false;\\n }\\n for (uint256 i = 0; i < 4; i++) {\\n if (callData[i] != functionSig[i]) {\\n return false;\\n }\\n }\\n\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x73fd074a57bd5d185ffb79dd98bb8db2e97c2d7df064d83f3f42da15ab9da8a1\",\"license\":\"MIT OR Apache-2.0\"},\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/// @author: manifold.xyz\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\nstruct Recipient {\\n address payable recipient;\\n uint16 bps;\\n}\\n\\ninterface IRoyaltySplitter is IERC165 {\\n /**\\n * @dev Set the splitter recipients. Total bps must total 10000.\\n */\\n function setRecipients(Recipient[] calldata recipients) external;\\n\\n /**\\n * @dev Get the splitter recipients;\\n */\\n function getRecipients() external view returns (Recipient[] memory);\\n}\\n\",\"keccak256\":\"0xc507963f66c4238d25e69d2d05ac5995c549aa89789e89e7a556403221547c6d\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlUpgradeable.sol\\\";\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\\n function __AccessControl_init() internal onlyInitializing {\\n }\\n\\n function __AccessControl_init_unchained() internal onlyInitializing {\\n }\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n StringsUpgradeable.toHexString(account),\\n \\\" is missing role \\\",\\n StringsUpgradeable.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xfeefb24d068524440e1ba885efdf105d91f83504af3c2d745ffacc4595396831\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControlUpgradeable {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0xb8f5302f12138c5561362e88a78d061573e6298b7a1a5afe84a1e2c8d4d5aeaa\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized != type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary MathUpgradeable {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Clones.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\\n * deploying minimal proxy contracts, also known as \\\"clones\\\".\\n *\\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\\n *\\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\\n * deterministic method.\\n *\\n * _Available since v3.4._\\n */\\nlibrary Clones {\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create opcode, which should never revert.\\n */\\n function clone(address implementation) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create(0, 0x09, 0x37)\\n }\\n require(instance != address(0), \\\"ERC1167: create failed\\\");\\n }\\n\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create2 opcode and a `salt` to deterministically deploy\\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\\n * the clones cannot be deployed twice at the same address.\\n */\\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create2(0, 0x09, 0x37, salt)\\n }\\n require(instance != address(0), \\\"ERC1167: create2 failed\\\");\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt,\\n address deployer\\n ) internal pure returns (address predicted) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(add(ptr, 0x38), deployer)\\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\\n mstore(add(ptr, 0x14), implementation)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\\n mstore(add(ptr, 0x58), salt)\\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\\n predicted := keccak256(add(ptr, 0x43), 0x55)\\n }\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt\\n ) internal view returns (address predicted) {\\n return predictDeterministicAddress(implementation, salt, address(this));\\n }\\n}\\n\",\"keccak256\":\"0x01f055f5c26ba25d7f83e9aa9ba877fbea4d0bf22227de046ea67494bc932999\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n// CAUTION\\n// This version of SafeMath should only be used with Solidity 0.8 or later,\\n// because it relies on the compiler's built in overflow checks.\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations.\\n *\\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\\n * now has built in overflow checking.\\n */\\nlibrary SafeMath {\\n /**\\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n uint256 c = a + b;\\n if (c < a) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b == 0) return (false, 0);\\n return (true, a / b);\\n }\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\n }\\n\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a + b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a * b;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator.\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a % b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {trySub}.\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n unchecked {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting with custom message when dividing by zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryMod}.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a % b;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x58b21219689909c4f8339af00813760337f7e2e7f169a97fe49e2896dcfb3b9a\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerAbstract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\n/// @dev minimal ERC2771 handler to keep bytecode-size down\\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\\nabstract contract ERC2771HandlerAbstract {\\n /// @notice return true if the forwarder is the trusted forwarder\\n /// @param forwarder trusted forwarder address to check\\n /// @return true if the address is the same as the trusted forwarder\\n function isTrustedForwarder(address forwarder) external view returns (bool) {\\n return _isTrustedForwarder(forwarder);\\n }\\n\\n /// @notice if the call is from the trusted forwarder the sender is extracted from calldata, msg.sender otherwise\\n /// @return sender the calculated address of the sender\\n function _msgSender() internal view virtual returns (address sender) {\\n if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\\n // The assembly code is more direct than the Solidity version using `abi.decode`.\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\\n }\\n } else {\\n sender = msg.sender;\\n }\\n }\\n\\n /// @notice if the call is from the trusted forwarder the sender is removed from calldata\\n /// @return the calldata without the sender\\n function _msgData() internal view virtual returns (bytes calldata) {\\n if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\\n return msg.data[:msg.data.length - 20];\\n } else {\\n return msg.data;\\n }\\n }\\n\\n /// @notice return true if the forwarder is the trusted forwarder\\n /// @param forwarder trusted forwarder address to check\\n /// @return true if the address is the same as the trusted forwarder\\n /// @dev this function must be IMPLEMENTED\\n function _isTrustedForwarder(address forwarder) internal view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xc4f349865ea7146f51b69f1edacdef60e0a2a7cf4dab538a5ae53ee9a0036231\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ERC2771HandlerAbstract} from \\\"./ERC2771HandlerAbstract.sol\\\";\\n\\n/// @dev minimal ERC2771 handler to keep bytecode-size down\\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\\ncontract ERC2771HandlerUpgradeable is Initializable, ERC2771HandlerAbstract {\\n address private _trustedForwarder;\\n\\n /// @notice Emitted when a `newTrustedForwarder` is set, replacing the `oldTrustedForwarder`\\n /// @param oldTrustedForwarder old trusted forwarder\\n /// @param newTrustedForwarder new trusted forwarder\\n /// @param operator the sender of the transaction\\n event TrustedForwarderSet(\\n address indexed oldTrustedForwarder,\\n address indexed newTrustedForwarder,\\n address indexed operator\\n );\\n\\n /// @notice initialize the trusted forwarder address\\n /// @param forwarder trusted forwarder address or zero to disable it\\n function __ERC2771Handler_init(address forwarder) internal onlyInitializing {\\n __ERC2771Handler_init_unchained(forwarder);\\n }\\n\\n /// @notice initialize the trusted forwarder address\\n /// @param forwarder trusted forwarder address or zero to disable it\\n function __ERC2771Handler_init_unchained(address forwarder) internal onlyInitializing {\\n _setTrustedForwarder(forwarder);\\n }\\n\\n /// @notice return the address of the trusted forwarder\\n /// @return return the address of the trusted forwarder\\n function getTrustedForwarder() external view returns (address) {\\n return _trustedForwarder;\\n }\\n\\n /// @notice set the address of the trusted forwarder\\n /// @param newForwarder the address of the new forwarder.\\n function _setTrustedForwarder(address newForwarder) internal virtual {\\n require(newForwarder != _trustedForwarder, \\\"ERC2771HandlerUpgradeable: forwarder already set\\\");\\n emit TrustedForwarderSet(_trustedForwarder, newForwarder, _msgSender());\\n _trustedForwarder = newForwarder;\\n }\\n\\n /// @notice return true if the forwarder is the trusted forwarder\\n /// @param forwarder trusted forwarder address to check\\n /// @return true if the address is the same as the trusted forwarder\\n function _isTrustedForwarder(address forwarder) internal view virtual override returns (bool) {\\n return forwarder == _trustedForwarder;\\n }\\n\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x63e53ca5ec229e51d866b0b8e3c8f36056598d9fbf960bb57b4b9731917af16f\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT OR Apache-2.0\\npragma solidity ^0.8.0;\\n\\nimport {AccessControlUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {IRoyaltyManager} from \\\"./interfaces/IRoyaltyManager.sol\\\";\\nimport {\\n IRoyaltySplitter,\\n Recipient\\n} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\nimport {RoyaltySplitter} from \\\"./RoyaltySplitter.sol\\\";\\nimport {Clones} from \\\"@openzeppelin/contracts/proxy/Clones.sol\\\";\\n\\n/// @title RoyaltyManager\\n/// @author The Sandbox\\n/// @notice Registry contract to set the common Recipient and Split for the RoyaltySplitter. Also, to set the royalty info\\n/// for contracts that don't use the RoyaltySplitter.\\ncontract RoyaltyManager is AccessControlUpgradeable, IRoyaltyManager {\\n bytes32 public constant CONTRACT_ROYALTY_SETTER_ROLE = keccak256(\\\"CONTRACT_ROYALTY_SETTER\\\");\\n\\n uint16 internal constant TOTAL_BASIS_POINTS = 10000;\\n uint16 public commonSplit;\\n address payable public commonRecipient;\\n mapping(address => uint16) public contractRoyalty;\\n mapping(address => address payable) public _creatorRoyaltiesSplitter;\\n address internal _royaltySplitterCloneable;\\n address internal _trustedForwarder;\\n\\n /// @notice initialization function for the deployment of contract\\n /// @dev called during the deployment via the proxy.\\n /// @param _commonRecipient the != address(0)common recipient for all the splitters\\n /// @param _commonSplit split for the common recipient's and creator split would be 10000 - commonSplit\\n /// @param royaltySplitterCloneable address of cloneable splitter contract for royalties distribution\\n /// @param managerAdmin address of RoyaltyManager contract.\\n /// @param contractRoyaltySetter the address of royalty setter of contract.\\n /// @param trustedForwarder the trustedForwarder address for royalty splitters to use.\\n function initialize(\\n address payable _commonRecipient,\\n uint16 _commonSplit,\\n address royaltySplitterCloneable,\\n address managerAdmin,\\n address contractRoyaltySetter,\\n address trustedForwarder\\n ) external initializer {\\n _setRecipient(_commonRecipient);\\n _setSplit(_commonSplit);\\n _grantRole(DEFAULT_ADMIN_ROLE, managerAdmin);\\n _grantRole(CONTRACT_ROYALTY_SETTER_ROLE, contractRoyaltySetter);\\n _royaltySplitterCloneable = royaltySplitterCloneable;\\n _trustedForwarder = trustedForwarder;\\n }\\n\\n /// @notice sets royalty recipient wallet\\n /// @dev should be called by the creator. The bps is not set on the splitter as it is set here on manager contract.\\n /// @param recipient new recipient wallet.\\n function setRoyaltyRecipient(address payable recipient) external {\\n address payable creatorSplitterAddress = _creatorRoyaltiesSplitter[msg.sender];\\n require(creatorSplitterAddress != address(0), \\\"Manager: No splitter deployed for the creator\\\");\\n address _recipient = RoyaltySplitter(creatorSplitterAddress)._recipient();\\n require(_recipient != recipient, \\\"Manager: Recipient already set\\\");\\n Recipient[] memory newRecipient = new Recipient[](1);\\n newRecipient[0] = Recipient({recipient: recipient, bps: 0});\\n RoyaltySplitter(creatorSplitterAddress).setRecipients(newRecipient);\\n }\\n\\n /// @notice sets the common recipient and common split\\n /// @dev can only be called by the admin\\n /// @param _commonRecipient is the common recipient for all the splitters\\n function setRecipient(address payable _commonRecipient) external override onlyRole(DEFAULT_ADMIN_ROLE) {\\n _setRecipient(_commonRecipient);\\n }\\n\\n /// @notice sets the trustedForwarder address to be used by the splitters\\n /// @dev can only be called by the admin\\n /// @param _newForwarder is the new trusted forwarder address\\n /// @dev new splitters will be deployed with this setting; existing splitters will have to apply it\\n function setTrustedForwarder(address _newForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n _trustedForwarder = _newForwarder;\\n }\\n\\n /// @notice sets the common recipient and common split\\n /// @dev can only be called by the admin.\\n /// @param _commonSplit split for the common recipient and creators split would be 10000 - commonSplit\\n function setSplit(uint16 _commonSplit) external override onlyRole(DEFAULT_ADMIN_ROLE) {\\n _setSplit(_commonSplit);\\n }\\n\\n /// @notice get the current trustedForwarder address\\n function getTrustedForwarder() public view returns (address) {\\n return _trustedForwarder;\\n }\\n\\n function _setRecipient(address payable _commonRecipient) internal {\\n require(_commonRecipient != address(0), \\\"Manager: Can't set common recipient to zero address\\\");\\n commonRecipient = _commonRecipient;\\n emit RecipientSet(_commonRecipient);\\n }\\n\\n function _setSplit(uint16 _commonSplit) internal {\\n require(_commonSplit < TOTAL_BASIS_POINTS, \\\"Manager: Can't set split greater than the total basis point\\\");\\n commonSplit = _commonSplit;\\n emit SplitSet(_commonSplit);\\n }\\n\\n /// @notice called to set the EIP 2981 royalty split\\n /// @dev can only be called by contract royalty setter.\\n /// @param _royaltyBps the royalty split for the EIP 2981\\n function setContractRoyalty(address contractAddress, uint16 _royaltyBps)\\n external\\n onlyRole(CONTRACT_ROYALTY_SETTER_ROLE)\\n {\\n require(_royaltyBps < TOTAL_BASIS_POINTS, \\\"Manager: Royalty can't be greater than Total base points\\\");\\n contractRoyalty[contractAddress] = _royaltyBps;\\n emit RoyaltySet(_royaltyBps, contractAddress);\\n }\\n\\n /// @notice to be called by the splitters to get the common recipient and split\\n /// @return recipient which has the common recipient and split\\n function getCommonRecipient() external view override returns (Recipient memory recipient) {\\n recipient = Recipient({recipient: commonRecipient, bps: commonSplit});\\n return recipient;\\n }\\n\\n /// @notice deploys splitter for creator\\n /// @dev should only called once per creator\\n /// @param creator the address of the creator\\n /// @param recipient the wallet of the recipient where they would receive their royalty\\n /// @return creatorSplitterAddress deployed for a creator\\n function deploySplitter(address creator, address payable recipient) external returns (address payable) {\\n address payable creatorSplitterAddress = _creatorRoyaltiesSplitter[creator];\\n if (creatorSplitterAddress == address(0)) {\\n creatorSplitterAddress = payable(Clones.clone(_royaltySplitterCloneable));\\n RoyaltySplitter(creatorSplitterAddress).initialize(recipient, address(this));\\n _creatorRoyaltiesSplitter[creator] = creatorSplitterAddress;\\n }\\n return creatorSplitterAddress;\\n }\\n\\n /// @notice returns the address of splitter of a creator.\\n /// @param creator the address of the creator\\n /// @return creatorSplitterAddress deployed for a creator\\n function getCreatorRoyaltySplitter(address creator) external view returns (address payable) {\\n return _creatorRoyaltiesSplitter[creator];\\n }\\n\\n /// @notice to be called by the splitters to get the common recipient and split\\n /// @return creatorSplit which is 10000 - commonSplit\\n function getCreatorSplit() external view returns (uint16) {\\n return TOTAL_BASIS_POINTS - commonSplit;\\n }\\n\\n /// @notice returns the commonRecipient and EIP2981 royalty split\\n /// @return commonRecipient\\n /// @return royaltySplit\\n function getRoyaltyInfo() external view returns (address payable, uint16) {\\n return (commonRecipient, contractRoyalty[msg.sender]);\\n }\\n\\n /// @notice returns the commonRecipient and EIP2981 royalty split\\n /// @param _contractAddress the address of the contract for which the royalty is required.\\n /// @return royaltyBps royalty bps of the contarct\\n function getContractRoyalty(address _contractAddress) external view returns (uint16 royaltyBps) {\\n return contractRoyalty[_contractAddress];\\n }\\n}\\n\",\"keccak256\":\"0x5b028381060243e0f3b3aad0149a7f4d9046229084b48d0703be9597c77df262\",\"license\":\"MIT OR Apache-2.0\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT OR Apache-2.0\\npragma solidity ^0.8.0;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {\\n OwnableUpgradeable,\\n ContextUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {AddressUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\\\";\\nimport {ERC165Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\\\";\\nimport {SafeMath} from \\\"@openzeppelin/contracts/utils/math/SafeMath.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {BytesLibrary} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/libraries/BytesLibrary.sol\\\";\\nimport {\\n IRoyaltySplitter,\\n IERC165,\\n Recipient\\n} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\nimport {\\n ERC2771HandlerAbstract\\n} from \\\"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\\\";\\nimport {IRoyaltyManager} from \\\"./interfaces/IRoyaltyManager.sol\\\";\\nimport {IERC20Approve} from \\\"./interfaces/IERC20Approve.sol\\\";\\n\\n/// @title RoyaltySplitter\\n/// @author The Sandbox\\n/// @notice RoyaltySplitter contract is deployed by the RoyaltyManager contract for a creator to get his royalty's share.\\ncontract RoyaltySplitter is\\n Initializable,\\n OwnableUpgradeable,\\n IRoyaltySplitter,\\n ERC165Upgradeable,\\n ERC2771HandlerAbstract\\n{\\n using BytesLibrary for bytes;\\n using AddressUpgradeable for address payable;\\n using AddressUpgradeable for address;\\n using SafeMath for uint256;\\n\\n uint256 internal constant TOTAL_BASIS_POINTS = 10000;\\n uint256 internal constant IERC20_APPROVE_SELECTOR =\\n 0x095ea7b300000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant SELECTOR_MASK = 0xffffffff00000000000000000000000000000000000000000000000000000000;\\n\\n address payable public _recipient;\\n IRoyaltyManager public _royaltyManager;\\n\\n event ETHTransferred(address indexed account, uint256 amount);\\n event ERC20Transferred(address indexed erc20Contract, address indexed account, uint256 amount);\\n\\n function supportsInterface(bytes4 interfaceId)\\n public\\n view\\n virtual\\n override(IERC165, ERC165Upgradeable)\\n returns (bool)\\n {\\n return interfaceId == type(IRoyaltySplitter).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /// @notice initialize the contract\\n /// @dev can only be run once.\\n /// @param recipient the wallet of the creator when the contract is deployed\\n /// @param royaltyManager the address of the royalty manager contract\\n function initialize(address payable recipient, address royaltyManager) public initializer {\\n _royaltyManager = IRoyaltyManager(royaltyManager); // set manager before Ownable_init for _isTrustedForwarder\\n _recipient = recipient;\\n __Ownable_init();\\n }\\n\\n /// @notice sets recipient for the splitter\\n /// @dev only the owner can call this.\\n /// @param recipients the array of recipients which should only have one recipient.\\n function setRecipients(Recipient[] calldata recipients) external override onlyOwner {\\n _setRecipients(recipients);\\n }\\n\\n function _setRecipients(Recipient[] calldata recipients) private {\\n delete _recipient;\\n require(recipients.length == 1, \\\"Invalid recipents length\\\");\\n _recipient = recipients[0].recipient;\\n }\\n\\n /// @notice to get recipients of royalty through this splitter and their splits of royalty.\\n /// @return recipients of royalty through this splitter and their splits of royalty.\\n function getRecipients() external view override returns (Recipient[] memory) {\\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\\n uint16 creatorSplit = _royaltyManager.getCreatorSplit();\\n Recipient[] memory recipients = new Recipient[](2);\\n recipients[0].recipient = _recipient;\\n recipients[0].bps = creatorSplit;\\n recipients[1] = commonRecipient;\\n return recipients;\\n }\\n\\n /// @notice Splits and forwards ETH to the royalty receivers\\n /// @dev splits ETH every time it is sent to this contract as royalty.\\n receive() external payable {\\n _splitETH(msg.value);\\n }\\n\\n /// @notice Splits and forwards ETH to the royalty receivers\\n /// @dev normally ETH should be split automatically by receive function.\\n function splitETH() public payable {\\n _splitETH(address(this).balance);\\n }\\n\\n function _splitETH(uint256 value) internal {\\n if (value > 0) {\\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\\n uint16 creatorSplit = _royaltyManager.getCreatorSplit();\\n Recipient[] memory _recipients = new Recipient[](2);\\n _recipients[0].recipient = _recipient;\\n _recipients[0].bps = creatorSplit;\\n _recipients[1] = commonRecipient;\\n uint256 totalSent;\\n uint256 amountToSend;\\n unchecked {\\n for (uint256 i = _recipients.length - 1; i > 0; i--) {\\n Recipient memory recipient = _recipients[i];\\n amountToSend = (value * recipient.bps) / TOTAL_BASIS_POINTS;\\n totalSent += amountToSend;\\n recipient.recipient.sendValue(amountToSend);\\n emit ETHTransferred(recipient.recipient, amountToSend);\\n }\\n // Favor the 1st recipient if there are any rounding issues\\n amountToSend = value - totalSent;\\n }\\n _recipients[0].recipient.sendValue(amountToSend);\\n emit ETHTransferred(_recipients[0].recipient, amountToSend);\\n }\\n }\\n\\n /// @notice split ERC20 Tokens owned by this contract.\\n /// @dev can only be called by one of the recipients\\n /// @param erc20Contract the address of the tokens to be split.\\n function splitERC20Tokens(IERC20 erc20Contract) public {\\n require(_splitERC20Tokens(erc20Contract), \\\"Split: ERC20 split failed\\\");\\n }\\n\\n function _splitERC20Tokens(IERC20 erc20Contract) internal returns (bool) {\\n try erc20Contract.balanceOf(address(this)) returns (uint256 balance) {\\n if (balance == 0) {\\n return false;\\n }\\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\\n uint16 creatorSplit = _royaltyManager.getCreatorSplit();\\n require(\\n commonRecipient.recipient == _msgSender() || _recipient == _msgSender(),\\n \\\"Split: Can only be called by one of the recipients\\\"\\n );\\n Recipient[] memory _recipients = new Recipient[](2);\\n _recipients[0].recipient = _recipient;\\n _recipients[0].bps = creatorSplit;\\n _recipients[1] = commonRecipient;\\n uint256 amountToSend;\\n uint256 totalSent;\\n unchecked {\\n for (uint256 i = _recipients.length - 1; i > 0; i--) {\\n Recipient memory recipient = _recipients[i];\\n bool success;\\n (success, amountToSend) = balance.tryMul(recipient.bps);\\n\\n amountToSend /= TOTAL_BASIS_POINTS;\\n totalSent += amountToSend;\\n try erc20Contract.transfer(recipient.recipient, amountToSend) {\\n emit ERC20Transferred(address(erc20Contract), recipient.recipient, amountToSend);\\n } catch {\\n return false;\\n }\\n }\\n // Favor the 1st recipient if there are any rounding issues\\n amountToSend = balance - totalSent;\\n }\\n try erc20Contract.transfer(_recipients[0].recipient, amountToSend) {\\n emit ERC20Transferred(address(erc20Contract), _recipients[0].recipient, amountToSend);\\n } catch {\\n return false;\\n }\\n return true;\\n } catch {\\n return false;\\n }\\n }\\n\\n /// @notice made for unexpected scenarios when assets are sent to this contact such that they could be recovered.\\n /// @dev first attempts to split ERC20 tokens.\\n /// @param target target of the call\\n /// @param callData for the call.\\n function proxyCall(address payable target, bytes calldata callData) external {\\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\\n require(\\n commonRecipient.recipient == _msgSender() || _recipient == _msgSender(),\\n \\\"Split: Can only be called by one of the recipients\\\"\\n );\\n require(\\n !callData.startsWith(IERC20Approve.approve.selector) &&\\n !callData.startsWith(IERC20Approve.increaseAllowance.selector),\\n \\\"Split: ERC20 tokens must be split\\\"\\n );\\n /* solhint-disable-next-line no-empty-blocks*/\\n try this.splitERC20Tokens(IERC20(target)) {} catch {}\\n target.functionCall(callData);\\n }\\n\\n /// @notice verify whether a forwarder address is the trustedForwarder address, using the manager setting\\n /// @dev this function is used to avoid having a trustedForwarder variable inside the splitter\\n /// @return bool whether the forwarder is the trusted address\\n function _isTrustedForwarder(address forwarder) internal view override(ERC2771HandlerAbstract) returns (bool) {\\n return forwarder == _royaltyManager.getTrustedForwarder();\\n }\\n\\n function _msgSender()\\n internal\\n view\\n virtual\\n override(ContextUpgradeable, ERC2771HandlerAbstract)\\n returns (address sender)\\n {\\n return ERC2771HandlerAbstract._msgSender();\\n }\\n\\n function _msgData()\\n internal\\n view\\n virtual\\n override(ContextUpgradeable, ERC2771HandlerAbstract)\\n returns (bytes calldata)\\n {\\n return ERC2771HandlerAbstract._msgData();\\n }\\n}\\n\",\"keccak256\":\"0x1e61d48e87a5c4f598837545a0899a9a280e449f96d4b1d7d6ca4109f93c613a\",\"license\":\"MIT OR Apache-2.0\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IERC20Approve.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\ninterface IERC20Approve {\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n function increaseAllowance(address spender, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x1f1e86109f5d15e996f94a30a4b4760b9c6b0f17bfff9e88e37714bd65b02f12\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {Recipient} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\n\\ninterface IRoyaltyManager {\\n event RecipientSet(address commonRecipient);\\n\\n event SplitSet(uint16 commonSplit);\\n\\n event RoyaltySet(uint16 royaltyBps, address contractAddress);\\n\\n function setRecipient(address payable _commonRecipient) external;\\n\\n function setSplit(uint16 commonSplit) external;\\n\\n function getCommonRecipient() external view returns (Recipient memory recipient);\\n\\n function getCreatorSplit() external view returns (uint16);\\n\\n function getRoyaltyInfo() external view returns (address payable, uint16);\\n\\n function deploySplitter(address creator, address payable recipient) external returns (address payable);\\n\\n function getCreatorRoyaltySplitter(address creator) external view returns (address payable);\\n\\n function getContractRoyalty(address _contractAddress) external view returns (uint16 royaltyBps);\\n\\n function setTrustedForwarder(address _newForwarder) external;\\n\\n function getTrustedForwarder() external view returns (address);\\n}\\n\",\"keccak256\":\"0x5193f7ce9bce4ac3facefdaa6172e0a0b8868356ca232d33cfb70a24e7b84cc2\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061171f806100206000396000f3fe608060405234801561001057600080fd5b50600436106101a35760003560e01c8063733fc03d116100ee578063c0bd4cdd11610097578063d547741f11610071578063d547741f14610453578063da74222814610466578063db06fff514610479578063f06040b4146104a557600080fd5b8063c0bd4cdd1461040b578063ce1b815f1461042f578063d0b72b931461044057600080fd5b8063a217fddf116100c8578063a217fddf146103a1578063a582f207146103a9578063a86a28d1146103d257600080fd5b8063733fc03d146103105780638b49fde71461032357806391d148541461036857600080fd5b80632f2ff15d1161015057806341e42f301161012a57806341e42f30146102ce57806366cb2063146102e1578063706ec2fe1461030857600080fd5b80632f2ff15d1461029557806336568abe146102a85780633bbed4a0146102bb57600080fd5b806315a86f5e1161018157806315a86f5e14610206578063248a9ca3146102375780632b8d5d771461026857600080fd5b806301ffc9a7146101a85780630e902f9d146101d057806311edb735146101e5575b600080fd5b6101bb6101b63660046112dc565b6104b8565b60405190151581526020015b60405180910390f35b6101e36101de366004611345565b610551565b005b6097546101f39061ffff1681565b60405161ffff90911681526020016101c7565b60975461021f906201000090046001600160a01b031681565b6040516001600160a01b0390911681526020016101c7565b61025a6102453660046113c5565b60009081526065602052604090206001015490565b6040519081526020016101c7565b6101f36102763660046113de565b6001600160a01b031660009081526098602052604090205461ffff1690565b6101e36102a33660046113fb565b6106f8565b6101e36102b63660046113fb565b610722565b6101e36102c93660046113de565b6107ae565b6101e36102dc3660046113de565b6107c2565b61025a7f35ee06f2b11054b099ebf059488ad39add9bda510bd8c8709f3b502faeb3ace681565b6101f3610a13565b6101e361031e36600461142b565b610a2e565b604080518082018252600080825260209182015281518083019092526097546001600160a01b0362010000820416835261ffff16908201526040516101c79190611446565b6101bb6103763660046113fb565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b61025a600081565b61021f6103b73660046113de565b6099602052600090815260409020546001600160a01b031681565b60975433600090815260986020908152604091829020548251620100009094046001600160a01b0316845261ffff1690830152016101c7565b6101f36104193660046113de565b60986020526000908152604090205461ffff1681565b609b546001600160a01b031661021f565b6101e361044e36600461146a565b610a42565b6101e36104613660046113fb565b610b51565b6101e36104743660046113de565b610b76565b61021f6104873660046113de565b6001600160a01b039081166000908152609960205260409020541690565b61021f6104b336600461149f565b610bb1565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061054b57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b600054610100900460ff16158080156105715750600054600160ff909116105b8061058b5750303b15801561058b575060005460ff166001145b6106025760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b6000805460ff191660011790558015610625576000805461ff0019166101001790555b61062e87610ca9565b61063786610d9a565b610642600085610e59565b61066c7f35ee06f2b11054b099ebf059488ad39add9bda510bd8c8709f3b502faeb3ace684610e59565b609a80546001600160a01b0380881673ffffffffffffffffffffffffffffffffffffffff1992831617909255609b80549285169290911691909117905580156106ef576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b60008281526065602052604090206001015461071381610efb565b61071d8383610e59565b505050565b6001600160a01b03811633146107a05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016105f9565b6107aa8282610f08565b5050565b60006107b981610efb565b6107aa82610ca9565b336000908152609960205260409020546001600160a01b03168061084e5760405162461bcd60e51b815260206004820152602d60248201527f4d616e616765723a204e6f2073706c6974746572206465706c6f79656420666f60448201527f72207468652063726561746f720000000000000000000000000000000000000060648201526084016105f9565b6000816001600160a01b031663d4cca5f16040518163ffffffff1660e01b8152600401602060405180830381865afa15801561088e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b291906114cd565b9050826001600160a01b0316816001600160a01b0316036109155760405162461bcd60e51b815260206004820152601e60248201527f4d616e616765723a20526563697069656e7420616c726561647920736574000060448201526064016105f9565b604080516001808252818301909252600091816020015b604080518082019091526000808252602082015281526020019060019003908161092c5790505090506040518060400160405280856001600160a01b03168152602001600061ffff168152508160008151811061098b5761098b611500565b60209081029190910101526040517fc1426d0e0000000000000000000000000000000000000000000000000000000081526001600160a01b0384169063c1426d0e906109db908490600401611516565b600060405180830381600087803b1580156109f557600080fd5b505af1158015610a09573d6000803e3d6000fd5b5050505050505050565b609754600090610a299061ffff16612710611590565b905090565b6000610a3981610efb565b6107aa82610d9a565b7f35ee06f2b11054b099ebf059488ad39add9bda510bd8c8709f3b502faeb3ace6610a6c81610efb565b61271061ffff831610610ae75760405162461bcd60e51b815260206004820152603860248201527f4d616e616765723a20526f79616c74792063616e27742062652067726561746560448201527f72207468616e20546f74616c206261736520706f696e7473000000000000000060648201526084016105f9565b6001600160a01b038316600081815260986020908152604091829020805461ffff191661ffff87169081179091558251908152908101929092527f7f9762123fb25c27c3aa0ecf56eeed3e1518bc8ee29086c7ff5dd6238a37c264910160405180910390a1505050565b600082815260656020526040902060010154610b6c81610efb565b61071d8383610f08565b6000610b8181610efb565b50609b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001600160a01b0380831660009081526099602052604081205490911680610ca257609a54610be8906001600160a01b0316610f8b565b6040517f485cc9550000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301523060248301529192509082169063485cc95590604401600060405180830381600087803b158015610c4e57600080fd5b505af1158015610c62573d6000803e3d6000fd5b505050506001600160a01b038481166000908152609960205260409020805473ffffffffffffffffffffffffffffffffffffffff19169183169190911790555b9392505050565b6001600160a01b038116610d255760405162461bcd60e51b815260206004820152603360248201527f4d616e616765723a2043616e27742073657420636f6d6d6f6e2072656369706960448201527f656e7420746f207a65726f20616464726573730000000000000000000000000060648201526084016105f9565b609780547fffffffffffffffffffff0000000000000000000000000000000000000000ffff16620100006001600160a01b038416908102919091179091556040519081527f9d900d71c28433348acb1bec780a061608a96b149370abce77fd54ba2d479401906020015b60405180910390a150565b61271061ffff821610610e155760405162461bcd60e51b815260206004820152603b60248201527f4d616e616765723a2043616e2774207365742073706c6974206772656174657260448201527f207468616e2074686520746f74616c20626173697320706f696e74000000000060648201526084016105f9565b6097805461ffff191661ffff83169081179091556040519081527fb8dc7db64fd987e5b05af4eb247387c388b40222e3ecb8c029b8a62227d4d28b90602001610d8f565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166107aa5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610eb73390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610f05813361102c565b50565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16156107aa5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f090506001600160a01b0381166110275760405162461bcd60e51b815260206004820152601660248201527f455243313136373a20637265617465206661696c65640000000000000000000060448201526064016105f9565b919050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166107aa5761105f816110a1565b61106a8360206110b3565b60405160200161107b9291906115d6565b60408051601f198184030181529082905262461bcd60e51b82526105f991600401611657565b606061054b6001600160a01b03831660145b606060006110c283600261168a565b6110cd9060026116a1565b67ffffffffffffffff8111156110e5576110e56114ea565b6040519080825280601f01601f19166020018201604052801561110f576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061114657611146611500565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106111a9576111a9611500565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006111e584600261168a565b6111f09060016116a1565b90505b600181111561128d577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061123157611231611500565b1a60f81b82828151811061124757611247611500565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611286816116b4565b90506111f3565b508315610ca25760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105f9565b6000602082840312156112ee57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610ca257600080fd5b6001600160a01b0381168114610f0557600080fd5b803561ffff8116811461102757600080fd5b60008060008060008060c0878903121561135e57600080fd5b86356113698161131e565b955061137760208801611333565b945060408701356113878161131e565b935060608701356113978161131e565b925060808701356113a78161131e565b915060a08701356113b78161131e565b809150509295509295509295565b6000602082840312156113d757600080fd5b5035919050565b6000602082840312156113f057600080fd5b8135610ca28161131e565b6000806040838503121561140e57600080fd5b8235915060208301356114208161131e565b809150509250929050565b60006020828403121561143d57600080fd5b610ca282611333565b81516001600160a01b0316815260208083015161ffff16908201526040810161054b565b6000806040838503121561147d57600080fd5b82356114888161131e565b915061149660208401611333565b90509250929050565b600080604083850312156114b257600080fd5b82356114bd8161131e565b915060208301356114208161131e565b6000602082840312156114df57600080fd5b8151610ca28161131e565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b602080825282518282018190526000919060409081850190868401855b8281101561156d5761155d84835180516001600160a01b0316825260209081015161ffff16910152565b9284019290850190600101611533565b5091979650505050505050565b634e487b7160e01b600052601160045260246000fd5b61ffff8281168282160390808211156115ab576115ab61157a565b5092915050565b60005b838110156115cd5781810151838201526020016115b5565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161160e8160178501602088016115b2565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161164b8160288401602088016115b2565b01602801949350505050565b60208152600082518060208401526116768160408501602087016115b2565b601f01601f19169190910160400192915050565b808202811582820484141761054b5761054b61157a565b8082018082111561054b5761054b61157a565b6000816116c3576116c361157a565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea2646970667358221220831d83ec12b4a50e1176c45263522b22d90bb26d2a93f05294bbb969000ab7c764736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101a35760003560e01c8063733fc03d116100ee578063c0bd4cdd11610097578063d547741f11610071578063d547741f14610453578063da74222814610466578063db06fff514610479578063f06040b4146104a557600080fd5b8063c0bd4cdd1461040b578063ce1b815f1461042f578063d0b72b931461044057600080fd5b8063a217fddf116100c8578063a217fddf146103a1578063a582f207146103a9578063a86a28d1146103d257600080fd5b8063733fc03d146103105780638b49fde71461032357806391d148541461036857600080fd5b80632f2ff15d1161015057806341e42f301161012a57806341e42f30146102ce57806366cb2063146102e1578063706ec2fe1461030857600080fd5b80632f2ff15d1461029557806336568abe146102a85780633bbed4a0146102bb57600080fd5b806315a86f5e1161018157806315a86f5e14610206578063248a9ca3146102375780632b8d5d771461026857600080fd5b806301ffc9a7146101a85780630e902f9d146101d057806311edb735146101e5575b600080fd5b6101bb6101b63660046112dc565b6104b8565b60405190151581526020015b60405180910390f35b6101e36101de366004611345565b610551565b005b6097546101f39061ffff1681565b60405161ffff90911681526020016101c7565b60975461021f906201000090046001600160a01b031681565b6040516001600160a01b0390911681526020016101c7565b61025a6102453660046113c5565b60009081526065602052604090206001015490565b6040519081526020016101c7565b6101f36102763660046113de565b6001600160a01b031660009081526098602052604090205461ffff1690565b6101e36102a33660046113fb565b6106f8565b6101e36102b63660046113fb565b610722565b6101e36102c93660046113de565b6107ae565b6101e36102dc3660046113de565b6107c2565b61025a7f35ee06f2b11054b099ebf059488ad39add9bda510bd8c8709f3b502faeb3ace681565b6101f3610a13565b6101e361031e36600461142b565b610a2e565b604080518082018252600080825260209182015281518083019092526097546001600160a01b0362010000820416835261ffff16908201526040516101c79190611446565b6101bb6103763660046113fb565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b61025a600081565b61021f6103b73660046113de565b6099602052600090815260409020546001600160a01b031681565b60975433600090815260986020908152604091829020548251620100009094046001600160a01b0316845261ffff1690830152016101c7565b6101f36104193660046113de565b60986020526000908152604090205461ffff1681565b609b546001600160a01b031661021f565b6101e361044e36600461146a565b610a42565b6101e36104613660046113fb565b610b51565b6101e36104743660046113de565b610b76565b61021f6104873660046113de565b6001600160a01b039081166000908152609960205260409020541690565b61021f6104b336600461149f565b610bb1565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061054b57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b600054610100900460ff16158080156105715750600054600160ff909116105b8061058b5750303b15801561058b575060005460ff166001145b6106025760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b6000805460ff191660011790558015610625576000805461ff0019166101001790555b61062e87610ca9565b61063786610d9a565b610642600085610e59565b61066c7f35ee06f2b11054b099ebf059488ad39add9bda510bd8c8709f3b502faeb3ace684610e59565b609a80546001600160a01b0380881673ffffffffffffffffffffffffffffffffffffffff1992831617909255609b80549285169290911691909117905580156106ef576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b60008281526065602052604090206001015461071381610efb565b61071d8383610e59565b505050565b6001600160a01b03811633146107a05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016105f9565b6107aa8282610f08565b5050565b60006107b981610efb565b6107aa82610ca9565b336000908152609960205260409020546001600160a01b03168061084e5760405162461bcd60e51b815260206004820152602d60248201527f4d616e616765723a204e6f2073706c6974746572206465706c6f79656420666f60448201527f72207468652063726561746f720000000000000000000000000000000000000060648201526084016105f9565b6000816001600160a01b031663d4cca5f16040518163ffffffff1660e01b8152600401602060405180830381865afa15801561088e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b291906114cd565b9050826001600160a01b0316816001600160a01b0316036109155760405162461bcd60e51b815260206004820152601e60248201527f4d616e616765723a20526563697069656e7420616c726561647920736574000060448201526064016105f9565b604080516001808252818301909252600091816020015b604080518082019091526000808252602082015281526020019060019003908161092c5790505090506040518060400160405280856001600160a01b03168152602001600061ffff168152508160008151811061098b5761098b611500565b60209081029190910101526040517fc1426d0e0000000000000000000000000000000000000000000000000000000081526001600160a01b0384169063c1426d0e906109db908490600401611516565b600060405180830381600087803b1580156109f557600080fd5b505af1158015610a09573d6000803e3d6000fd5b5050505050505050565b609754600090610a299061ffff16612710611590565b905090565b6000610a3981610efb565b6107aa82610d9a565b7f35ee06f2b11054b099ebf059488ad39add9bda510bd8c8709f3b502faeb3ace6610a6c81610efb565b61271061ffff831610610ae75760405162461bcd60e51b815260206004820152603860248201527f4d616e616765723a20526f79616c74792063616e27742062652067726561746560448201527f72207468616e20546f74616c206261736520706f696e7473000000000000000060648201526084016105f9565b6001600160a01b038316600081815260986020908152604091829020805461ffff191661ffff87169081179091558251908152908101929092527f7f9762123fb25c27c3aa0ecf56eeed3e1518bc8ee29086c7ff5dd6238a37c264910160405180910390a1505050565b600082815260656020526040902060010154610b6c81610efb565b61071d8383610f08565b6000610b8181610efb565b50609b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001600160a01b0380831660009081526099602052604081205490911680610ca257609a54610be8906001600160a01b0316610f8b565b6040517f485cc9550000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301523060248301529192509082169063485cc95590604401600060405180830381600087803b158015610c4e57600080fd5b505af1158015610c62573d6000803e3d6000fd5b505050506001600160a01b038481166000908152609960205260409020805473ffffffffffffffffffffffffffffffffffffffff19169183169190911790555b9392505050565b6001600160a01b038116610d255760405162461bcd60e51b815260206004820152603360248201527f4d616e616765723a2043616e27742073657420636f6d6d6f6e2072656369706960448201527f656e7420746f207a65726f20616464726573730000000000000000000000000060648201526084016105f9565b609780547fffffffffffffffffffff0000000000000000000000000000000000000000ffff16620100006001600160a01b038416908102919091179091556040519081527f9d900d71c28433348acb1bec780a061608a96b149370abce77fd54ba2d479401906020015b60405180910390a150565b61271061ffff821610610e155760405162461bcd60e51b815260206004820152603b60248201527f4d616e616765723a2043616e2774207365742073706c6974206772656174657260448201527f207468616e2074686520746f74616c20626173697320706f696e74000000000060648201526084016105f9565b6097805461ffff191661ffff83169081179091556040519081527fb8dc7db64fd987e5b05af4eb247387c388b40222e3ecb8c029b8a62227d4d28b90602001610d8f565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166107aa5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610eb73390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610f05813361102c565b50565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16156107aa5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f090506001600160a01b0381166110275760405162461bcd60e51b815260206004820152601660248201527f455243313136373a20637265617465206661696c65640000000000000000000060448201526064016105f9565b919050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166107aa5761105f816110a1565b61106a8360206110b3565b60405160200161107b9291906115d6565b60408051601f198184030181529082905262461bcd60e51b82526105f991600401611657565b606061054b6001600160a01b03831660145b606060006110c283600261168a565b6110cd9060026116a1565b67ffffffffffffffff8111156110e5576110e56114ea565b6040519080825280601f01601f19166020018201604052801561110f576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061114657611146611500565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106111a9576111a9611500565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006111e584600261168a565b6111f09060016116a1565b90505b600181111561128d577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061123157611231611500565b1a60f81b82828151811061124757611247611500565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611286816116b4565b90506111f3565b508315610ca25760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105f9565b6000602082840312156112ee57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610ca257600080fd5b6001600160a01b0381168114610f0557600080fd5b803561ffff8116811461102757600080fd5b60008060008060008060c0878903121561135e57600080fd5b86356113698161131e565b955061137760208801611333565b945060408701356113878161131e565b935060608701356113978161131e565b925060808701356113a78161131e565b915060a08701356113b78161131e565b809150509295509295509295565b6000602082840312156113d757600080fd5b5035919050565b6000602082840312156113f057600080fd5b8135610ca28161131e565b6000806040838503121561140e57600080fd5b8235915060208301356114208161131e565b809150509250929050565b60006020828403121561143d57600080fd5b610ca282611333565b81516001600160a01b0316815260208083015161ffff16908201526040810161054b565b6000806040838503121561147d57600080fd5b82356114888161131e565b915061149660208401611333565b90509250929050565b600080604083850312156114b257600080fd5b82356114bd8161131e565b915060208301356114208161131e565b6000602082840312156114df57600080fd5b8151610ca28161131e565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b602080825282518282018190526000919060409081850190868401855b8281101561156d5761155d84835180516001600160a01b0316825260209081015161ffff16910152565b9284019290850190600101611533565b5091979650505050505050565b634e487b7160e01b600052601160045260246000fd5b61ffff8281168282160390808211156115ab576115ab61157a565b5092915050565b60005b838110156115cd5781810151838201526020016115b5565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161160e8160178501602088016115b2565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161164b8160288401602088016115b2565b01602801949350505050565b60208152600082518060208401526116768160408501602087016115b2565b601f01601f19169190910160400192915050565b808202811582820484141761054b5761054b61157a565b8082018082111561054b5761054b61157a565b6000816116c3576116c361157a565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea2646970667358221220831d83ec12b4a50e1176c45263522b22d90bb26d2a93f05294bbb969000ab7c764736f6c63430008120033", "devdoc": { "author": "The Sandbox", "events": { @@ -601,6 +651,14 @@ "recipient": "which has the common recipient and split" } }, + "getContractRoyalty(address)": { + "params": { + "_contractAddress": "the address of the contract for which the royalty is required." + }, + "returns": { + "royaltyBps": "royalty bps of the contarct" + } + }, "getCreatorRoyaltySplitter(address)": { "params": { "creator": "the address of the creator" @@ -629,14 +687,15 @@ "hasRole(bytes32,address)": { "details": "Returns `true` if `account` has been granted `role`." }, - "initialize(address,uint16,address,address,address)": { + "initialize(address,uint16,address,address,address,address)": { "details": "called during the deployment via the proxy.", "params": { "_commonRecipient": "the != address(0)common recipient for all the splitters", "_commonSplit": "split for the common recipient's and creator split would be 10000 - commonSplit", "contractRoyaltySetter": "the address of royalty setter of contract.", "managerAdmin": "address of RoyaltyManager contract.", - "royaltySplitterCloneable": "address of cloneable splitter contract for royalties distribution" + "royaltySplitterCloneable": "address of cloneable splitter contract for royalties distribution", + "trustedForwarder": "the trustedForwarder address for royalty splitters to use." } }, "renounceRole(bytes32,address)": { @@ -652,7 +711,7 @@ } }, "setRecipient(address)": { - "details": "can only be called by the admin.", + "details": "can only be called by the admin", "params": { "_commonRecipient": "is the common recipient for all the splitters" } @@ -669,6 +728,12 @@ "_commonSplit": "split for the common recipient and creators split would be 10000 - commonSplit" } }, + "setTrustedForwarder(address)": { + "details": "can only be called by the adminnew splitters will be deployed with this setting; existing splitters will have to apply it", + "params": { + "_newForwarder": "is the new trusted forwarder address" + } + }, "supportsInterface(bytes4)": { "details": "See {IERC165-supportsInterface}." } @@ -685,6 +750,9 @@ "getCommonRecipient()": { "notice": "to be called by the splitters to get the common recipient and split" }, + "getContractRoyalty(address)": { + "notice": "returns the commonRecipient and EIP2981 royalty split" + }, "getCreatorRoyaltySplitter(address)": { "notice": "returns the address of splitter of a creator." }, @@ -694,7 +762,10 @@ "getRoyaltyInfo()": { "notice": "returns the commonRecipient and EIP2981 royalty split" }, - "initialize(address,uint16,address,address,address)": { + "getTrustedForwarder()": { + "notice": "get the current trustedForwarder address" + }, + "initialize(address,uint16,address,address,address,address)": { "notice": "initialization function for the deployment of contract" }, "setContractRoyalty(address,uint16)": { @@ -708,6 +779,9 @@ }, "setSplit(uint16)": { "notice": "sets the common recipient and common split" + }, + "setTrustedForwarder(address)": { + "notice": "sets the trustedForwarder address to be used by the splitters" } }, "notice": "Registry contract to set the common Recipient and Split for the RoyaltySplitter. Also, to set the royalty info for contracts that don't use the RoyaltySplitter.", @@ -716,7 +790,7 @@ "storageLayout": { "storage": [ { - "astId": 803, + "astId": 746, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol:RoyaltyManager", "label": "_initialized", "offset": 0, @@ -724,7 +798,7 @@ "type": "t_uint8" }, { - "astId": 806, + "astId": 749, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol:RoyaltyManager", "label": "_initializing", "offset": 1, @@ -732,7 +806,7 @@ "type": "t_bool" }, { - "astId": 3357, + "astId": 3300, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol:RoyaltyManager", "label": "__gap", "offset": 0, @@ -740,7 +814,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 3630, + "astId": 4223, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol:RoyaltyManager", "label": "__gap", "offset": 0, @@ -748,15 +822,15 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 276, + "astId": 194, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol:RoyaltyManager", "label": "_roles", "offset": 0, "slot": "101", - "type": "t_mapping(t_bytes32,t_struct(RoleData)271_storage)" + "type": "t_mapping(t_bytes32,t_struct(RoleData)189_storage)" }, { - "astId": 571, + "astId": 489, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol:RoyaltyManager", "label": "__gap", "offset": 0, @@ -764,7 +838,7 @@ "type": "t_array(t_uint256)49_storage" }, { - "astId": 8981, + "astId": 13792, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol:RoyaltyManager", "label": "commonSplit", "offset": 0, @@ -772,7 +846,7 @@ "type": "t_uint16" }, { - "astId": 8983, + "astId": 13794, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol:RoyaltyManager", "label": "commonRecipient", "offset": 2, @@ -780,7 +854,7 @@ "type": "t_address_payable" }, { - "astId": 8987, + "astId": 13798, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol:RoyaltyManager", "label": "contractRoyalty", "offset": 0, @@ -788,7 +862,7 @@ "type": "t_mapping(t_address,t_uint16)" }, { - "astId": 8991, + "astId": 13802, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol:RoyaltyManager", "label": "_creatorRoyaltiesSplitter", "offset": 0, @@ -796,12 +870,20 @@ "type": "t_mapping(t_address,t_address_payable)" }, { - "astId": 8993, + "astId": 13804, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol:RoyaltyManager", "label": "_royaltySplitterCloneable", "offset": 0, "slot": "154", "type": "t_address" + }, + { + "astId": 13806, + "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol:RoyaltyManager", + "label": "_trustedForwarder", + "offset": 0, + "slot": "155", + "type": "t_address" } ], "types": { @@ -858,19 +940,19 @@ "numberOfBytes": "32", "value": "t_uint16" }, - "t_mapping(t_bytes32,t_struct(RoleData)271_storage)": { + "t_mapping(t_bytes32,t_struct(RoleData)189_storage)": { "encoding": "mapping", "key": "t_bytes32", "label": "mapping(bytes32 => struct AccessControlUpgradeable.RoleData)", "numberOfBytes": "32", - "value": "t_struct(RoleData)271_storage" + "value": "t_struct(RoleData)189_storage" }, - "t_struct(RoleData)271_storage": { + "t_struct(RoleData)189_storage": { "encoding": "inplace", "label": "struct AccessControlUpgradeable.RoleData", "members": [ { - "astId": 268, + "astId": 186, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol:RoyaltyManager", "label": "members", "offset": 0, @@ -878,7 +960,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 270, + "astId": 188, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol:RoyaltyManager", "label": "adminRole", "offset": 0, diff --git a/packages/deploy/deployments/mumbai/RoyaltyManager_Proxy.json b/packages/deploy/deployments/mumbai/RoyaltyManager_Proxy.json index fb49bafdbd..bf16ac3e32 100644 --- a/packages/deploy/deployments/mumbai/RoyaltyManager_Proxy.json +++ b/packages/deploy/deployments/mumbai/RoyaltyManager_Proxy.json @@ -1,5 +1,5 @@ { - "address": "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6", + "address": "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34", "abi": [ { "inputs": [ @@ -146,59 +146,59 @@ "type": "receive" } ], - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6", + "contractAddress": "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34", "transactionIndex": 8, - "gasUsed": "844425", - "logsBloom": "0x00002004000000000000000004000000400000000000000000000000000000000002200000008400000000000000000000008000000000001000000800000000000000000000000000000000000802800000000000000000000100400000004000000000020000000000020000000800000000800000000080000000010000000000000000000000000000000000000000000800000090000000800000a00000200000000000000000000000000400000000000000000000001000000000404000000020000000001001000000060000000400000400000100128040000020000000000000000000000000000001000000000000000000000000000000100200", - "blockHash": "0x88767e469c63ae385ffe6fae39dd49e8588e3497d1d1e643b04812f5257ff77e", - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", + "gasUsed": "867203", + "logsBloom": "0x00002004000000000000000004000000400000000000000000000010000000000002000000008420000000000000000000008000000000001000000000000000000000000020000000000000000802800000000000000000000100000000000000000000020000000000020000000800000000800000100080000000010000800000000000000000000002000000000000080800000080000000800000a00000200000000000000000000000000400000000000000000000001000000000004000000020000000000001000000060000000000000400000100108000001020000000000000000000000000000000000000000000000000000008000000100200", + "blockHash": "0xb37c6d3d2105a8c8d83679151b08a9455ed4040efe37441bfd5b4dde130f6ecf", + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", "logs": [ { "transactionIndex": 8, - "blockNumber": 38493722, - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", - "address": "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6", + "blockNumber": 38730657, + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", + "address": "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34", "topics": [ "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", - "0x0000000000000000000000005df8ca6aecb7950f15df87f35838149d379e094f" + "0x000000000000000000000000c7b2cfe80a27282fe51248f0ad0cfce6b8531b0d" ], "data": "0x", - "logIndex": 57, - "blockHash": "0x88767e469c63ae385ffe6fae39dd49e8588e3497d1d1e643b04812f5257ff77e" + "logIndex": 19, + "blockHash": "0xb37c6d3d2105a8c8d83679151b08a9455ed4040efe37441bfd5b4dde130f6ecf" }, { "transactionIndex": 8, - "blockNumber": 38493722, - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", - "address": "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6", + "blockNumber": 38730657, + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", + "address": "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34", "topics": [ "0x9d900d71c28433348acb1bec780a061608a96b149370abce77fd54ba2d479401" ], - "data": "0x00000000000000000000000049c4d4c94829b9c44052c5f5cb164fc612181165", - "logIndex": 58, - "blockHash": "0x88767e469c63ae385ffe6fae39dd49e8588e3497d1d1e643b04812f5257ff77e" + "data": "0x000000000000000000000000a5eb9c9eb4f4c35b9be8cfaaa7909f9ebe6cb609", + "logIndex": 20, + "blockHash": "0xb37c6d3d2105a8c8d83679151b08a9455ed4040efe37441bfd5b4dde130f6ecf" }, { "transactionIndex": 8, - "blockNumber": 38493722, - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", - "address": "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6", + "blockNumber": 38730657, + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", + "address": "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34", "topics": [ "0xb8dc7db64fd987e5b05af4eb247387c388b40222e3ecb8c029b8a62227d4d28b" ], "data": "0x0000000000000000000000000000000000000000000000000000000000001388", - "logIndex": 59, - "blockHash": "0x88767e469c63ae385ffe6fae39dd49e8588e3497d1d1e643b04812f5257ff77e" + "logIndex": 21, + "blockHash": "0xb37c6d3d2105a8c8d83679151b08a9455ed4040efe37441bfd5b4dde130f6ecf" }, { "transactionIndex": 8, - "blockNumber": 38493722, - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", - "address": "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6", + "blockNumber": 38730657, + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", + "address": "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34", "topics": [ "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "0x0000000000000000000000000000000000000000000000000000000000000000", @@ -206,73 +206,73 @@ "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 60, - "blockHash": "0x88767e469c63ae385ffe6fae39dd49e8588e3497d1d1e643b04812f5257ff77e" + "logIndex": 22, + "blockHash": "0xb37c6d3d2105a8c8d83679151b08a9455ed4040efe37441bfd5b4dde130f6ecf" }, { "transactionIndex": 8, - "blockNumber": 38493722, - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", - "address": "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6", + "blockNumber": 38730657, + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", + "address": "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34", "topics": [ "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "0x35ee06f2b11054b099ebf059488ad39add9bda510bd8c8709f3b502faeb3ace6", - "0x0000000000000000000000006f1bbc084a2d35c2aba8f1b702b6a30bda2189ba", + "0x00000000000000000000000049c4d4c94829b9c44052c5f5cb164fc612181165", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02" ], "data": "0x", - "logIndex": 61, - "blockHash": "0x88767e469c63ae385ffe6fae39dd49e8588e3497d1d1e643b04812f5257ff77e" + "logIndex": 23, + "blockHash": "0xb37c6d3d2105a8c8d83679151b08a9455ed4040efe37441bfd5b4dde130f6ecf" }, { "transactionIndex": 8, - "blockNumber": 38493722, - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", - "address": "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6", + "blockNumber": 38730657, + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", + "address": "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x0000000000000000000000000000000000000000000000000000000000000001", - "logIndex": 62, - "blockHash": "0x88767e469c63ae385ffe6fae39dd49e8588e3497d1d1e643b04812f5257ff77e" + "logIndex": 24, + "blockHash": "0xb37c6d3d2105a8c8d83679151b08a9455ed4040efe37441bfd5b4dde130f6ecf" }, { "transactionIndex": 8, - "blockNumber": 38493722, - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", - "address": "0x42017FD22Fd371cb717e4895e8A45d17DcdE89E6", + "blockNumber": 38730657, + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", + "address": "0x4ae9A95ec193fC1B38c246b701dE49B8e3F5EF34", "topics": [ "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" ], - "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c3c6b8feee55636e949920aa90f093f6f5faf448", - "logIndex": 63, - "blockHash": "0x88767e469c63ae385ffe6fae39dd49e8588e3497d1d1e643b04812f5257ff77e" + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c26b12025e378c570fb46249093ba387a2e927bc", + "logIndex": 25, + "blockHash": "0xb37c6d3d2105a8c8d83679151b08a9455ed4040efe37441bfd5b4dde130f6ecf" }, { "transactionIndex": 8, - "blockNumber": 38493722, - "transactionHash": "0xd3de53963138b636e4a1cf2b4a019acf34670566300bebb43a59920e50e1703d", + "blockNumber": 38730657, + "transactionHash": "0xdee32d6246b3d6ae27f53120f6a594402f41b9149d0ec3d6538258d1885927b0", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", - "0x000000000000000000000000be188d6641e8b680743a4815dfa0f6208038960f" + "0x000000000000000000000000f903ba9e006193c1527bfbe65fe2123704ea3f99" ], - "data": "0x00000000000000000000000000000000000000000000000000048000063f270000000000000000000000000000000000000000000000001173e1fd28f7b455fd000000000000000000000000000000000000000000003386c078d978e58864e700000000000000000000000000000000000000000000001173dd7d28f1752efd000000000000000000000000000000000000000000003386c07d5978ebc78be7", - "logIndex": 64, - "blockHash": "0x88767e469c63ae385ffe6fae39dd49e8588e3497d1d1e643b04812f5257ff77e" + "data": "0x00000000000000000000000000000000000000000000000000058bb09461640c00000000000000000000000000000000000000000000001171532b37c8084bbf000000000000000000000000000000000000000000001043e0185dd805622904000000000000000000000000000000000000000000000011714d9f8733a6e7b3000000000000000000000000000000000000000000001043e01de98899c38d10", + "logIndex": 26, + "blockHash": "0xb37c6d3d2105a8c8d83679151b08a9455ed4040efe37441bfd5b4dde130f6ecf" } ], - "blockNumber": 38493722, - "cumulativeGasUsed": "3610775", + "blockNumber": 38730657, + "cumulativeGasUsed": "1311626", "status": 1, "byzantium": true }, "args": [ - "0x5dF8cA6AECb7950f15dF87f35838149d379E094F", - "0xc3C6B8feeE55636e949920Aa90f093f6f5Faf448", - "0xb0c5b7d800000000000000000000000049c4d4c94829b9c44052c5f5cb164fc61218116500000000000000000000000000000000000000000000000000000000000013880000000000000000000000001b7bb8db9ca2bb098576b64bbcbe4087370c189100000000000000000000000049c4d4c94829b9c44052c5f5cb164fc6121811650000000000000000000000006f1bbc084a2d35c2aba8f1b702b6a30bda2189ba" + "0xc7B2CFe80A27282fe51248F0AD0CfCe6b8531B0d", + "0xc26B12025e378c570Fb46249093Ba387A2e927bc", + "0x0e902f9d000000000000000000000000a5eb9c9eb4f4c35b9be8cfaaa7909f9ebe6cb60900000000000000000000000000000000000000000000000000000000000013880000000000000000000000004022efd364ab869e06284012be5d60eb71490c4e00000000000000000000000049c4d4c94829b9c44052c5f5cb164fc61218116500000000000000000000000049c4d4c94829b9c44052c5f5cb164fc61218116500000000000000000000000069015912aa33720b842dcd6ac059ed623f28d9f7" ], "numDeployments": 1, "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", diff --git a/packages/deploy/deployments/mumbai/RoyaltySplitter.json b/packages/deploy/deployments/mumbai/RoyaltySplitter.json index 4f848f0721..393e4018cc 100644 --- a/packages/deploy/deployments/mumbai/RoyaltySplitter.json +++ b/packages/deploy/deployments/mumbai/RoyaltySplitter.json @@ -1,5 +1,5 @@ { - "address": "0x1B7bB8DB9CA2bb098576B64bbCbE4087370C1891", + "address": "0x4022EfD364AB869E06284012be5d60EB71490c4E", "abi": [ { "anonymous": false, @@ -146,6 +146,25 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "forwarder", + "type": "address" + } + ], + "name": "isTrustedForwarder", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "owner", @@ -226,7 +245,7 @@ "inputs": [], "name": "splitETH", "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "payable", "type": "function" }, { @@ -266,44 +285,44 @@ "type": "receive" } ], - "transactionHash": "0x43243967052cc0816f3726eb02456201081c7b8662c0d8d53b598fdd39124317", + "transactionHash": "0xdf92baf657e9c40315d74f4b722158fe22fff1f15624f3b65eb9179deac0a7a7", "receipt": { "to": null, "from": "0x5F890c9522dCE5670d741D4277BFCC2d9cA8Af02", - "contractAddress": "0x1B7bB8DB9CA2bb098576B64bbCbE4087370C1891", - "transactionIndex": 15, - "gasUsed": "1664273", - "logsBloom": "0x00000000010000000000000000000000000000000000000000000000000000000002000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000020100000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000200000200000000000000000000000000000000000000000000000000000000000004000000000000000000001000000000000000000000000000000108000000000000000000000000000000000000000000000000000000000000000040000100000", - "blockHash": "0xd9fccf6ce71525fc31275e73ae1232b8986a6d8f0f46bfdbd1289309a3f6058d", - "transactionHash": "0x43243967052cc0816f3726eb02456201081c7b8662c0d8d53b598fdd39124317", + "contractAddress": "0x4022EfD364AB869E06284012be5d60EB71490c4E", + "transactionIndex": 0, + "gasUsed": "1754659", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100000000004000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000080000000000000200000200000000000000000000000000000000000000000000000000000000000004000000000000000000001000000000000000000000000000000108040000000000000000000000000000000000000000000000000000000000000000000100000", + "blockHash": "0xaf6ef1cbf92280cc76ec8d9129c797cb2ae5261b8e5e71ec306b8f97554d18e7", + "transactionHash": "0xdf92baf657e9c40315d74f4b722158fe22fff1f15624f3b65eb9179deac0a7a7", "logs": [ { - "transactionIndex": 15, - "blockNumber": 38493710, - "transactionHash": "0x43243967052cc0816f3726eb02456201081c7b8662c0d8d53b598fdd39124317", + "transactionIndex": 0, + "blockNumber": 38730647, + "transactionHash": "0xdf92baf657e9c40315d74f4b722158fe22fff1f15624f3b65eb9179deac0a7a7", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x0000000000000000000000005f890c9522dce5670d741d4277bfcc2d9ca8af02", - "0x000000000000000000000000cfef2a3dc244ef7d0fb93c45e762d671445c4569" + "0x000000000000000000000000be188d6641e8b680743a4815dfa0f6208038960f" ], - "data": "0x0000000000000000000000000000000000000000000000000008de78a1761f0000000000000000000000000000000000000000000000001173fbc4b880674296000000000000000000000000000000000000000000000057eb9ba3c334c08d6e00000000000000000000000000000000000000000000001173f2e63fdef12396000000000000000000000000000000000000000000000057eba4823bd636ac6e", - "logIndex": 44, - "blockHash": "0xd9fccf6ce71525fc31275e73ae1232b8986a6d8f0f46bfdbd1289309a3f6058d" + "data": "0x0000000000000000000000000000000000000000000000000012b38f28f802530000000000000000000000000000000000000000000000117172ca05917a27b80000000000000000000000000000000000000000000033a6d2621f1e4077f38600000000000000000000000000000000000000000000001171601676688225650000000000000000000000000000000000000000000033a6d274d2ad696ff5d9", + "logIndex": 0, + "blockHash": "0xaf6ef1cbf92280cc76ec8d9129c797cb2ae5261b8e5e71ec306b8f97554d18e7" } ], - "blockNumber": 38493710, - "cumulativeGasUsed": "3699982", + "blockNumber": 38730647, + "cumulativeGasUsed": "1754659", "status": 1, "byzantium": true }, "args": [], "numDeployments": 1, - "solcInputHash": "101d55502dc3ddda4c84938ce7ac435e", - "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"erc20Contract\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ERC20Transferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ETHTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"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\":\"_recipient\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_royaltyManager\",\"outputs\":[{\"internalType\":\"contract IRoyaltyManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRecipients\",\"outputs\":[{\"components\":[{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"bps\",\"type\":\"uint16\"}],\"internalType\":\"struct Recipient[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"royaltyManager\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"}],\"name\":\"proxyCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"bps\",\"type\":\"uint16\"}],\"internalType\":\"struct Recipient[]\",\"name\":\"recipients\",\"type\":\"tuple[]\"}],\"name\":\"setRecipients\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"erc20Contract\",\"type\":\"address\"}],\"name\":\"splitERC20Tokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"splitETH\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"The Sandbox\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"getRecipients()\":{\"returns\":{\"_0\":\"recipients of royalty through this splitter and their splits of royalty.\"}},\"initialize(address,address)\":{\"details\":\"can only be run once.\",\"params\":{\"recipient\":\"the wallet of the creator when the contract is deployed\",\"royaltyManager\":\"the address of the royalty manager contract.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"proxyCall(address,bytes)\":{\"details\":\"first attempts to split ERC20 tokens.\",\"params\":{\"callData\":\"for the call.\",\"target\":\"target of the call\"}},\"renounceOwnership()\":{\"details\":\"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.\"},\"setRecipients((address,uint16)[])\":{\"details\":\"only the owner can call this.\",\"params\":{\"recipients\":\"the array of recipients which should only have one recipient.\"}},\"splitERC20Tokens(address)\":{\"details\":\"can only be called by one of the recipients\",\"params\":{\"erc20Contract\":\"the address of the tokens to be split.\"}},\"splitETH()\":{\"details\":\"normally ETH should be split automatically by receive function.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"RoyaltySplitter\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getRecipients()\":{\"notice\":\"to get recipients of royalty through this splitter and their splits of royalty.\"},\"initialize(address,address)\":{\"notice\":\"initialize the contract\"},\"proxyCall(address,bytes)\":{\"notice\":\"made for unexpected scenarios when assets are sent to this contact such that they could be recovered.\"},\"setRecipients((address,uint16)[])\":{\"notice\":\"sets recipient for the splitter\"},\"splitERC20Tokens(address)\":{\"notice\":\"split ERC20 Tokens owned by this contract.\"},\"splitETH()\":{\"notice\":\"Splits and forwards ETH to the royalty receivers\"}},\"notice\":\"RoyaltySplitter contract is deployed by the RoyaltyManager contract for a creator to get his royalty's share.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol\":\"RoyaltySplitter\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@manifoldxyz/royalty-registry-solidity/contracts/libraries/BytesLibrary.sol\":{\"content\":\"// SPDX-License-Identifier: MIT OR Apache-2.0\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice A library for manipulation of byte arrays.\\n */\\nlibrary BytesLibrary {\\n /**\\n * @dev Replace the address at the given location in a byte array if the contents at that location\\n * match the expected address.\\n */\\n function replaceAtIf(bytes memory data, uint256 startLocation, address expectedAddress, address newAddress)\\n internal\\n pure\\n {\\n bytes memory expectedData = abi.encodePacked(expectedAddress);\\n bytes memory newData = abi.encodePacked(newAddress);\\n // An address is 20 bytes long\\n for (uint256 i = 0; i < 20; i++) {\\n uint256 dataLocation = startLocation + i;\\n require(data[dataLocation] == expectedData[i], \\\"Bytes: Data provided does not include the expectedAddress\\\");\\n data[dataLocation] = newData[i];\\n }\\n }\\n\\n /**\\n * @dev Checks if the call data starts with the given function signature.\\n */\\n function startsWith(bytes memory callData, bytes4 functionSig) internal pure returns (bool) {\\n // A signature is 4 bytes long\\n if (callData.length < 4) {\\n return false;\\n }\\n for (uint256 i = 0; i < 4; i++) {\\n if (callData[i] != functionSig[i]) {\\n return false;\\n }\\n }\\n\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x73fd074a57bd5d185ffb79dd98bb8db2e97c2d7df064d83f3f42da15ab9da8a1\",\"license\":\"MIT OR Apache-2.0\"},\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/// @author: manifold.xyz\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\nstruct Recipient {\\n address payable recipient;\\n uint16 bps;\\n}\\n\\ninterface IRoyaltySplitter is IERC165 {\\n /**\\n * @dev Set the splitter recipients. Total bps must total 10000.\\n */\\n function setRecipients(Recipient[] calldata recipients) external;\\n\\n /**\\n * @dev Get the splitter recipients;\\n */\\n function getRecipients() external view returns (Recipient[] memory);\\n}\\n\",\"keccak256\":\"0xc507963f66c4238d25e69d2d05ac5995c549aa89789e89e7a556403221547c6d\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized != type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n// CAUTION\\n// This version of SafeMath should only be used with Solidity 0.8 or later,\\n// because it relies on the compiler's built in overflow checks.\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations.\\n *\\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\\n * now has built in overflow checking.\\n */\\nlibrary SafeMath {\\n /**\\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n uint256 c = a + b;\\n if (c < a) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b == 0) return (false, 0);\\n return (true, a / b);\\n }\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\n }\\n\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a + b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a * b;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator.\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a % b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {trySub}.\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n unchecked {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting with custom message when dividing by zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryMod}.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a % b;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x58b21219689909c4f8339af00813760337f7e2e7f169a97fe49e2896dcfb3b9a\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT OR Apache-2.0\\npragma solidity ^0.8.0;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {AddressUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\\\";\\nimport {ERC165Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\\\";\\nimport {SafeMath} from \\\"@openzeppelin/contracts/utils/math/SafeMath.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {BytesLibrary} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/libraries/BytesLibrary.sol\\\";\\nimport {\\n IRoyaltySplitter,\\n IERC165,\\n Recipient\\n} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\nimport {IRoyaltyManager} from \\\"./interfaces/IRoyaltyManager.sol\\\";\\nimport {IERC20Approve} from \\\"./interfaces/IERC20Approve.sol\\\";\\n\\n/// @title RoyaltySplitter\\n/// @author The Sandbox\\n/// @notice RoyaltySplitter contract is deployed by the RoyaltyManager contract for a creator to get his royalty's share.\\ncontract RoyaltySplitter is Initializable, OwnableUpgradeable, IRoyaltySplitter, ERC165Upgradeable {\\n using BytesLibrary for bytes;\\n using AddressUpgradeable for address payable;\\n using AddressUpgradeable for address;\\n using SafeMath for uint256;\\n\\n uint256 internal constant TOTAL_BASIS_POINTS = 10000;\\n uint256 internal constant IERC20_APPROVE_SELECTOR =\\n 0x095ea7b300000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant SELECTOR_MASK = 0xffffffff00000000000000000000000000000000000000000000000000000000;\\n\\n address payable public _recipient;\\n IRoyaltyManager public _royaltyManager;\\n\\n event ETHTransferred(address indexed account, uint256 amount);\\n event ERC20Transferred(address indexed erc20Contract, address indexed account, uint256 amount);\\n\\n function supportsInterface(bytes4 interfaceId)\\n public\\n view\\n virtual\\n override(IERC165, ERC165Upgradeable)\\n returns (bool)\\n {\\n return interfaceId == type(IRoyaltySplitter).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /// @notice initialize the contract\\n /// @dev can only be run once.\\n /// @param recipient the wallet of the creator when the contract is deployed\\n /// @param royaltyManager the address of the royalty manager contract.\\n function initialize(address payable recipient, address royaltyManager) public initializer {\\n __Ownable_init();\\n _royaltyManager = IRoyaltyManager(royaltyManager);\\n _recipient = recipient;\\n }\\n\\n /// @notice sets recipient for the splitter\\n /// @dev only the owner can call this.\\n /// @param recipients the array of recipients which should only have one recipient.\\n function setRecipients(Recipient[] calldata recipients) external override onlyOwner {\\n _setRecipients(recipients);\\n }\\n\\n function _setRecipients(Recipient[] calldata recipients) private {\\n delete _recipient;\\n require(recipients.length == 1, \\\"Invalid recipents length\\\");\\n _recipient = recipients[0].recipient;\\n }\\n\\n /// @notice to get recipients of royalty through this splitter and their splits of royalty.\\n /// @return recipients of royalty through this splitter and their splits of royalty.\\n function getRecipients() external view override returns (Recipient[] memory) {\\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\\n uint16 creatorSplit = _royaltyManager.getCreatorSplit();\\n Recipient[] memory recipients = new Recipient[](2);\\n recipients[0].recipient = _recipient;\\n recipients[0].bps = creatorSplit;\\n recipients[1] = commonRecipient;\\n return recipients;\\n }\\n\\n /// @notice Splits and forwards ETH to the royalty receivers\\n /// @dev splits ETH every time it is sent to this contract as royalty.\\n receive() external payable {\\n _splitETH(msg.value);\\n }\\n\\n /// @notice Splits and forwards ETH to the royalty receivers\\n /// @dev normally ETH should be split automatically by receive function.\\n function splitETH() public {\\n _splitETH(address(this).balance);\\n }\\n\\n function _splitETH(uint256 value) internal {\\n if (value > 0) {\\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\\n uint16 creatorSplit = _royaltyManager.getCreatorSplit();\\n Recipient[] memory _recipients = new Recipient[](2);\\n _recipients[0].recipient = _recipient;\\n _recipients[0].bps = creatorSplit;\\n _recipients[1] = commonRecipient;\\n uint256 totalSent;\\n uint256 amountToSend;\\n unchecked {\\n for (uint256 i = _recipients.length - 1; i > 0; i--) {\\n Recipient memory recipient = _recipients[i];\\n amountToSend = (value * recipient.bps) / TOTAL_BASIS_POINTS;\\n totalSent += amountToSend;\\n recipient.recipient.sendValue(amountToSend);\\n emit ETHTransferred(recipient.recipient, amountToSend);\\n }\\n // Favor the 1st recipient if there are any rounding issues\\n amountToSend = value - totalSent;\\n }\\n _recipients[0].recipient.sendValue(amountToSend);\\n emit ETHTransferred(_recipients[0].recipient, amountToSend);\\n }\\n }\\n\\n /// @notice split ERC20 Tokens owned by this contract.\\n /// @dev can only be called by one of the recipients\\n /// @param erc20Contract the address of the tokens to be split.\\n function splitERC20Tokens(IERC20 erc20Contract) public {\\n require(_splitERC20Tokens(erc20Contract), \\\"Split: ERC20 split failed\\\");\\n }\\n\\n function _splitERC20Tokens(IERC20 erc20Contract) internal returns (bool) {\\n try erc20Contract.balanceOf(address(this)) returns (uint256 balance) {\\n if (balance == 0) {\\n return false;\\n }\\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\\n uint16 creatorSplit = _royaltyManager.getCreatorSplit();\\n require(\\n commonRecipient.recipient == msg.sender || _recipient == msg.sender,\\n \\\"Split: Can only be called by one of the recipients\\\"\\n );\\n Recipient[] memory _recipients = new Recipient[](2);\\n _recipients[0].recipient = _recipient;\\n _recipients[0].bps = creatorSplit;\\n _recipients[1] = commonRecipient;\\n uint256 amountToSend;\\n uint256 totalSent;\\n unchecked {\\n for (uint256 i = _recipients.length - 1; i > 0; i--) {\\n Recipient memory recipient = _recipients[i];\\n bool success;\\n (success, amountToSend) = balance.tryMul(recipient.bps);\\n\\n amountToSend /= TOTAL_BASIS_POINTS;\\n totalSent += amountToSend;\\n try erc20Contract.transfer(recipient.recipient, amountToSend) {\\n emit ERC20Transferred(address(erc20Contract), recipient.recipient, amountToSend);\\n } catch {\\n return false;\\n }\\n }\\n // Favor the 1st recipient if there are any rounding issues\\n amountToSend = balance - totalSent;\\n }\\n try erc20Contract.transfer(_recipients[0].recipient, amountToSend) {\\n emit ERC20Transferred(address(erc20Contract), _recipients[0].recipient, amountToSend);\\n } catch {\\n return false;\\n }\\n return true;\\n } catch {\\n return false;\\n }\\n }\\n\\n /// @notice made for unexpected scenarios when assets are sent to this contact such that they could be recovered.\\n /// @dev first attempts to split ERC20 tokens.\\n /// @param target target of the call\\n /// @param callData for the call.\\n function proxyCall(address payable target, bytes calldata callData) external {\\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\\n require(\\n commonRecipient.recipient == msg.sender || _recipient == msg.sender,\\n \\\"Split: Can only be called by one of the recipients\\\"\\n );\\n require(\\n !callData.startsWith(IERC20Approve.approve.selector) &&\\n !callData.startsWith(IERC20Approve.increaseAllowance.selector),\\n \\\"Split: ERC20 tokens must be split\\\"\\n );\\n /* solhint-disable-next-line no-empty-blocks*/\\n try this.splitERC20Tokens(IERC20(target)) {} catch {}\\n target.functionCall(callData);\\n }\\n}\\n\",\"keccak256\":\"0xd52e3efec844be663b42f3da10327139c77b852c5633cd5465c40e72f046c422\",\"license\":\"MIT OR Apache-2.0\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IERC20Approve.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\ninterface IERC20Approve {\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n function increaseAllowance(address spender, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x1f1e86109f5d15e996f94a30a4b4760b9c6b0f17bfff9e88e37714bd65b02f12\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {Recipient} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\n\\ninterface IRoyaltyManager {\\n event RecipientSet(address commonRecipient);\\n\\n event SplitSet(uint16 commonSplit);\\n\\n event RoyaltySet(uint16 royaltyBps, address contractAddress);\\n\\n function setRecipient(address payable _commonRecipient) external;\\n\\n function setSplit(uint16 commonSplit) external;\\n\\n function getCommonRecipient() external view returns (Recipient memory recipient);\\n\\n function getCreatorSplit() external view returns (uint16);\\n\\n function getRoyaltyInfo() external view returns (address, uint16);\\n\\n function deploySplitter(address creator, address payable recipient) external returns (address payable);\\n\\n function getCreatorRoyaltySplitter(address creator) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x095c8e09d23bdffd2ca759f153cfc7a5e8d20dc099f41acac67357e933455646\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50611d40806100206000396000f3fe6080604052600436106100cb5760003560e01c80638da5cb5b11610074578063d4cca5f11161004e578063d4cca5f114610215578063d78d610b14610235578063f2fde38b1461025757600080fd5b80638da5cb5b146101c2578063c1426d0e146101e0578063d1aa25d01461020057600080fd5b8063485cc955116100a5578063485cc95514610155578063663cb1bb14610175578063715018a6146101ad57600080fd5b806301ffc9a7146100e057806320dc8ff7146101155780632a31f6b41461013557600080fd5b366100db576100d934610277565b005b600080fd5b3480156100ec57600080fd5b506101006100fb36600461196d565b61059d565b60405190151581526020015b60405180910390f35b34801561012157600080fd5b506100d96101303660046119c4565b610636565b34801561014157600080fd5b506100d96101503660046119e1565b610690565b34801561016157600080fd5b506100d9610170366004611a66565b61095e565b34801561018157600080fd5b50609854610195906001600160a01b031681565b6040516001600160a01b03909116815260200161010c565b3480156101b957600080fd5b506100d9610adb565b3480156101ce57600080fd5b506033546001600160a01b0316610195565b3480156101ec57600080fd5b506100d96101fb366004611a9f565b610aef565b34801561020c57600080fd5b506100d9610b05565b34801561022157600080fd5b50609754610195906001600160a01b031681565b34801561024157600080fd5b5061024a610b0e565b60405161010c9190611b14565b34801561026357600080fd5b506100d96102723660046119c4565b610cd5565b801561059a5760985460408051638b49fde760e01b815281516000936001600160a01b031692638b49fde792600480820193918290030181865afa1580156102c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e79190611b82565b90506000609860009054906101000a90046001600160a01b03166001600160a01b031663706ec2fe6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561033e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103629190611bed565b6040805160028082526060820190925291925060009190816020015b604080518082019091526000808252602082015281526020019060019003908161037e57505060975481519192506001600160a01b03169082906000906103c7576103c7611c08565b6020026020010151600001906001600160a01b031690816001600160a01b03168152505081816000815181106103ff576103ff611c08565b60200260200101516020019061ffff16908161ffff1681525050828160018151811061042d5761042d611c08565b60200260200101819052506000806000600184510390505b80156104f357600084828151811061045f5761045f611c08565b60200260200101519050612710816020015161ffff1689028161048457610484611c1e565b82519190049485019493506104a2906001600160a01b031684610d62565b80600001516001600160a01b03167f1445764fe3fdfc2a9812ff42e9b65c2e7896d5162851f78f7d4a5578f7346ff1846040516104e191815260200190565b60405180910390a25060001901610445565b508186039050610533818460008151811061051057610510611c08565b6020026020010151600001516001600160a01b0316610d6290919063ffffffff16565b8260008151811061054657610546611c08565b6020026020010151600001516001600160a01b03167f1445764fe3fdfc2a9812ff42e9b65c2e7896d5162851f78f7d4a5578f7346ff18260405161058c91815260200190565b60405180910390a250505050505b50565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f16cf0c0500000000000000000000000000000000000000000000000000000000148061063057507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b61063f81610e7b565b61059a5760405162461bcd60e51b815260206004820152601960248201527f53706c69743a2045524332302073706c6974206661696c65640000000000000060448201526064015b60405180910390fd5b60985460408051638b49fde760e01b815281516000936001600160a01b031692638b49fde792600480820193918290030181865afa1580156106d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fa9190611b82565b80519091506001600160a01b031633148061071f57506097546001600160a01b031633145b6107915760405162461bcd60e51b815260206004820152603260248201527f53706c69743a2043616e206f6e6c792062652063616c6c6564206279206f6e6560448201527f206f662074686520726563697069656e747300000000000000000000000000006064820152608401610687565b6107db63095ea7b360e01b84848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506113fe9050565b15801561082f575061082d633950935160e01b84848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506113fe9050565b155b6108a15760405162461bcd60e51b815260206004820152602160248201527f53706c69743a20455243323020746f6b656e73206d7573742062652073706c6960448201527f74000000000000000000000000000000000000000000000000000000000000006064820152608401610687565b6040517f20dc8ff70000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015230906320dc8ff790602401600060405180830381600087803b1580156108fb57600080fd5b505af192505050801561090c575060015b5061095783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506001600160a01b038816929150506114ba565b5050505050565b600054610100900460ff161580801561097e5750600054600160ff909116105b806109985750303b158015610998575060005460ff166001145b610a0a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610687565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610a4b576000805461ff0019166101001790555b610a53611505565b609880546001600160a01b0380851673ffffffffffffffffffffffffffffffffffffffff199283161790925560978054928616929091169190911790558015610ad6576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b610ae361158a565b610aed60006115e4565b565b610af761158a565b610b018282611643565b5050565b610aed47610277565b60985460408051638b49fde760e01b815281516060936000936001600160a01b0390911692638b49fde792600480830193928290030181865afa158015610b59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7d9190611b82565b90506000609860009054906101000a90046001600160a01b03166001600160a01b031663706ec2fe6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf89190611bed565b6040805160028082526060820190925291925060009190816020015b6040805180820190915260008082526020820152815260200190600190039081610c1457505060975481519192506001600160a01b0316908290600090610c5d57610c5d611c08565b6020026020010151600001906001600160a01b031690816001600160a01b0316815250508181600081518110610c9557610c95611c08565b60200260200101516020019061ffff16908161ffff16815250508281600181518110610cc357610cc3611c08565b60209081029190910101529392505050565b610cdd61158a565b6001600160a01b038116610d595760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610687565b61059a816115e4565b80471015610db25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610687565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610dff576040519150601f19603f3d011682016040523d82523d6000602084013e610e04565b606091505b5050905080610ad65760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610687565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa925050508015610ef7575060408051601f3d908101601f19168201909252610ef491810190611c34565b60015b610f0357506000919050565b80600003610f145750600092915050565b60985460408051638b49fde760e01b815281516000936001600160a01b031692638b49fde792600480820193918290030181865afa158015610f5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7e9190611b82565b90506000609860009054906101000a90046001600160a01b03166001600160a01b031663706ec2fe6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff99190611bed565b82519091506001600160a01b031633148061101e57506097546001600160a01b031633145b6110905760405162461bcd60e51b815260206004820152603260248201527f53706c69743a2043616e206f6e6c792062652063616c6c6564206279206f6e6560448201527f206f662074686520726563697069656e747300000000000000000000000000006064820152608401610687565b60408051600280825260608201909252600091816020015b60408051808201909152600080825260208201528152602001906001900390816110a857505060975481519192506001600160a01b03169082906000906110f1576110f1611c08565b6020026020010151600001906001600160a01b031690816001600160a01b031681525050818160008151811061112957611129611c08565b60200260200101516020019061ffff16908161ffff1681525050828160018151811061115757611157611c08565b60200260200101819052506000806000600184510390505b80156112b857600084828151811061118957611189611c08565b6020026020010151905060006111b0826020015161ffff168a61170a90919063ffffffff16565b83516040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b03918216600482015261271090920460248301819052975095870195919250908c169063a9059cbb906044016020604051808303816000875af1925050508015611246575060408051601f3d908101601f1916820190925261124391810190611c4d565b60015b61125b575060009a9950505050505050505050565b5081600001516001600160a01b03168b6001600160a01b03167fe8de91d538b06154a2c48315768c5046f47e127d7fd3f726fd85cc723f29b052876040516112a591815260200190565b60405180910390a350506000190161116f565b508086039150876001600160a01b031663a9059cbb846000815181106112e0576112e0611c08565b6020908102919091010151516040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af192505050801561136d575060408051601f3d908101601f1916820190925261136a91810190611c4d565b60015b61137f57506000979650505050505050565b508260008151811061139357611393611c08565b6020026020010151600001516001600160a01b0316886001600160a01b03167fe8de91d538b06154a2c48315768c5046f47e127d7fd3f726fd85cc723f29b052846040516113e391815260200190565b60405180910390a3506001979650505050505050565b919050565b600060048351101561141257506000610630565b60005b60048110156114b05782816004811061143057611430611c08565b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191684828151811061146857611468611c08565b01602001517fff00000000000000000000000000000000000000000000000000000000000000161461149e576000915050610630565b806114a881611c6f565b915050611415565b5060019392505050565b60606114fe838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c65640000815250611755565b9392505050565b600054610100900460ff166115825760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610687565b610aed611849565b6033546001600160a01b03163314610aed5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610687565b603380546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6097805473ffffffffffffffffffffffffffffffffffffffff19169055600181146116b05760405162461bcd60e51b815260206004820152601860248201527f496e76616c6964207265636970656e7473206c656e67746800000000000000006044820152606401610687565b818160008181106116c3576116c3611c08565b6116d992602060409092020190810191506119c4565b6097805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03929092169190911790555050565b60008083600003611721575060019050600061174e565b8383028385828161173457611734611c1e565b041461174757600080925092505061174e565b6001925090505b9250929050565b6060824710156117cd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610687565b600080866001600160a01b031685876040516117e99190611cbb565b60006040518083038185875af1925050503d8060008114611826576040519150601f19603f3d011682016040523d82523d6000602084013e61182b565b606091505b509150915061183c878383876118cf565b925050505b949350505050565b600054610100900460ff166118c65760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610687565b610aed336115e4565b6060831561193e578251600003611937576001600160a01b0385163b6119375760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610687565b5081611841565b61184183838151156119535781518083602001fd5b8060405162461bcd60e51b81526004016106879190611cd7565b60006020828403121561197f57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146114fe57600080fd5b6001600160a01b038116811461059a57600080fd5b6000602082840312156119d657600080fd5b81356114fe816119af565b6000806000604084860312156119f657600080fd5b8335611a01816119af565b9250602084013567ffffffffffffffff80821115611a1e57600080fd5b818601915086601f830112611a3257600080fd5b813581811115611a4157600080fd5b876020828501011115611a5357600080fd5b6020830194508093505050509250925092565b60008060408385031215611a7957600080fd5b8235611a84816119af565b91506020830135611a94816119af565b809150509250929050565b60008060208385031215611ab257600080fd5b823567ffffffffffffffff80821115611aca57600080fd5b818501915085601f830112611ade57600080fd5b813581811115611aed57600080fd5b8660208260061b8501011115611b0257600080fd5b60209290920196919550909350505050565b602080825282518282018190526000919060409081850190868401855b82811015611b6357815180516001600160a01b0316855286015161ffff16868501529284019290850190600101611b31565b5091979650505050505050565b805161ffff811681146113f957600080fd5b600060408284031215611b9457600080fd5b6040516040810181811067ffffffffffffffff82111715611bc557634e487b7160e01b600052604160045260246000fd5b6040528251611bd3816119af565b8152611be160208401611b70565b60208201529392505050565b600060208284031215611bff57600080fd5b6114fe82611b70565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b600060208284031215611c4657600080fd5b5051919050565b600060208284031215611c5f57600080fd5b815180151581146114fe57600080fd5b60006000198203611c9057634e487b7160e01b600052601160045260246000fd5b5060010190565b60005b83811015611cb2578181015183820152602001611c9a565b50506000910152565b60008251611ccd818460208701611c97565b9190910192915050565b6020815260008251806020840152611cf6816040850160208701611c97565b601f01601f1916919091016040019291505056fea26469706673582212208f9a5df952782c5e454a23d5bbfb3def017a3499ba3f7310be49e68a9ae4cccf64736f6c63430008120033", - "deployedBytecode": "0x6080604052600436106100cb5760003560e01c80638da5cb5b11610074578063d4cca5f11161004e578063d4cca5f114610215578063d78d610b14610235578063f2fde38b1461025757600080fd5b80638da5cb5b146101c2578063c1426d0e146101e0578063d1aa25d01461020057600080fd5b8063485cc955116100a5578063485cc95514610155578063663cb1bb14610175578063715018a6146101ad57600080fd5b806301ffc9a7146100e057806320dc8ff7146101155780632a31f6b41461013557600080fd5b366100db576100d934610277565b005b600080fd5b3480156100ec57600080fd5b506101006100fb36600461196d565b61059d565b60405190151581526020015b60405180910390f35b34801561012157600080fd5b506100d96101303660046119c4565b610636565b34801561014157600080fd5b506100d96101503660046119e1565b610690565b34801561016157600080fd5b506100d9610170366004611a66565b61095e565b34801561018157600080fd5b50609854610195906001600160a01b031681565b6040516001600160a01b03909116815260200161010c565b3480156101b957600080fd5b506100d9610adb565b3480156101ce57600080fd5b506033546001600160a01b0316610195565b3480156101ec57600080fd5b506100d96101fb366004611a9f565b610aef565b34801561020c57600080fd5b506100d9610b05565b34801561022157600080fd5b50609754610195906001600160a01b031681565b34801561024157600080fd5b5061024a610b0e565b60405161010c9190611b14565b34801561026357600080fd5b506100d96102723660046119c4565b610cd5565b801561059a5760985460408051638b49fde760e01b815281516000936001600160a01b031692638b49fde792600480820193918290030181865afa1580156102c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e79190611b82565b90506000609860009054906101000a90046001600160a01b03166001600160a01b031663706ec2fe6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561033e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103629190611bed565b6040805160028082526060820190925291925060009190816020015b604080518082019091526000808252602082015281526020019060019003908161037e57505060975481519192506001600160a01b03169082906000906103c7576103c7611c08565b6020026020010151600001906001600160a01b031690816001600160a01b03168152505081816000815181106103ff576103ff611c08565b60200260200101516020019061ffff16908161ffff1681525050828160018151811061042d5761042d611c08565b60200260200101819052506000806000600184510390505b80156104f357600084828151811061045f5761045f611c08565b60200260200101519050612710816020015161ffff1689028161048457610484611c1e565b82519190049485019493506104a2906001600160a01b031684610d62565b80600001516001600160a01b03167f1445764fe3fdfc2a9812ff42e9b65c2e7896d5162851f78f7d4a5578f7346ff1846040516104e191815260200190565b60405180910390a25060001901610445565b508186039050610533818460008151811061051057610510611c08565b6020026020010151600001516001600160a01b0316610d6290919063ffffffff16565b8260008151811061054657610546611c08565b6020026020010151600001516001600160a01b03167f1445764fe3fdfc2a9812ff42e9b65c2e7896d5162851f78f7d4a5578f7346ff18260405161058c91815260200190565b60405180910390a250505050505b50565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f16cf0c0500000000000000000000000000000000000000000000000000000000148061063057507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b61063f81610e7b565b61059a5760405162461bcd60e51b815260206004820152601960248201527f53706c69743a2045524332302073706c6974206661696c65640000000000000060448201526064015b60405180910390fd5b60985460408051638b49fde760e01b815281516000936001600160a01b031692638b49fde792600480820193918290030181865afa1580156106d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fa9190611b82565b80519091506001600160a01b031633148061071f57506097546001600160a01b031633145b6107915760405162461bcd60e51b815260206004820152603260248201527f53706c69743a2043616e206f6e6c792062652063616c6c6564206279206f6e6560448201527f206f662074686520726563697069656e747300000000000000000000000000006064820152608401610687565b6107db63095ea7b360e01b84848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506113fe9050565b15801561082f575061082d633950935160e01b84848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506113fe9050565b155b6108a15760405162461bcd60e51b815260206004820152602160248201527f53706c69743a20455243323020746f6b656e73206d7573742062652073706c6960448201527f74000000000000000000000000000000000000000000000000000000000000006064820152608401610687565b6040517f20dc8ff70000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015230906320dc8ff790602401600060405180830381600087803b1580156108fb57600080fd5b505af192505050801561090c575060015b5061095783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506001600160a01b038816929150506114ba565b5050505050565b600054610100900460ff161580801561097e5750600054600160ff909116105b806109985750303b158015610998575060005460ff166001145b610a0a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610687565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610a4b576000805461ff0019166101001790555b610a53611505565b609880546001600160a01b0380851673ffffffffffffffffffffffffffffffffffffffff199283161790925560978054928616929091169190911790558015610ad6576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b610ae361158a565b610aed60006115e4565b565b610af761158a565b610b018282611643565b5050565b610aed47610277565b60985460408051638b49fde760e01b815281516060936000936001600160a01b0390911692638b49fde792600480830193928290030181865afa158015610b59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7d9190611b82565b90506000609860009054906101000a90046001600160a01b03166001600160a01b031663706ec2fe6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf89190611bed565b6040805160028082526060820190925291925060009190816020015b6040805180820190915260008082526020820152815260200190600190039081610c1457505060975481519192506001600160a01b0316908290600090610c5d57610c5d611c08565b6020026020010151600001906001600160a01b031690816001600160a01b0316815250508181600081518110610c9557610c95611c08565b60200260200101516020019061ffff16908161ffff16815250508281600181518110610cc357610cc3611c08565b60209081029190910101529392505050565b610cdd61158a565b6001600160a01b038116610d595760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610687565b61059a816115e4565b80471015610db25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610687565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610dff576040519150601f19603f3d011682016040523d82523d6000602084013e610e04565b606091505b5050905080610ad65760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610687565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa925050508015610ef7575060408051601f3d908101601f19168201909252610ef491810190611c34565b60015b610f0357506000919050565b80600003610f145750600092915050565b60985460408051638b49fde760e01b815281516000936001600160a01b031692638b49fde792600480820193918290030181865afa158015610f5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7e9190611b82565b90506000609860009054906101000a90046001600160a01b03166001600160a01b031663706ec2fe6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff99190611bed565b82519091506001600160a01b031633148061101e57506097546001600160a01b031633145b6110905760405162461bcd60e51b815260206004820152603260248201527f53706c69743a2043616e206f6e6c792062652063616c6c6564206279206f6e6560448201527f206f662074686520726563697069656e747300000000000000000000000000006064820152608401610687565b60408051600280825260608201909252600091816020015b60408051808201909152600080825260208201528152602001906001900390816110a857505060975481519192506001600160a01b03169082906000906110f1576110f1611c08565b6020026020010151600001906001600160a01b031690816001600160a01b031681525050818160008151811061112957611129611c08565b60200260200101516020019061ffff16908161ffff1681525050828160018151811061115757611157611c08565b60200260200101819052506000806000600184510390505b80156112b857600084828151811061118957611189611c08565b6020026020010151905060006111b0826020015161ffff168a61170a90919063ffffffff16565b83516040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b03918216600482015261271090920460248301819052975095870195919250908c169063a9059cbb906044016020604051808303816000875af1925050508015611246575060408051601f3d908101601f1916820190925261124391810190611c4d565b60015b61125b575060009a9950505050505050505050565b5081600001516001600160a01b03168b6001600160a01b03167fe8de91d538b06154a2c48315768c5046f47e127d7fd3f726fd85cc723f29b052876040516112a591815260200190565b60405180910390a350506000190161116f565b508086039150876001600160a01b031663a9059cbb846000815181106112e0576112e0611c08565b6020908102919091010151516040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af192505050801561136d575060408051601f3d908101601f1916820190925261136a91810190611c4d565b60015b61137f57506000979650505050505050565b508260008151811061139357611393611c08565b6020026020010151600001516001600160a01b0316886001600160a01b03167fe8de91d538b06154a2c48315768c5046f47e127d7fd3f726fd85cc723f29b052846040516113e391815260200190565b60405180910390a3506001979650505050505050565b919050565b600060048351101561141257506000610630565b60005b60048110156114b05782816004811061143057611430611c08565b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191684828151811061146857611468611c08565b01602001517fff00000000000000000000000000000000000000000000000000000000000000161461149e576000915050610630565b806114a881611c6f565b915050611415565b5060019392505050565b60606114fe838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c65640000815250611755565b9392505050565b600054610100900460ff166115825760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610687565b610aed611849565b6033546001600160a01b03163314610aed5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610687565b603380546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6097805473ffffffffffffffffffffffffffffffffffffffff19169055600181146116b05760405162461bcd60e51b815260206004820152601860248201527f496e76616c6964207265636970656e7473206c656e67746800000000000000006044820152606401610687565b818160008181106116c3576116c3611c08565b6116d992602060409092020190810191506119c4565b6097805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03929092169190911790555050565b60008083600003611721575060019050600061174e565b8383028385828161173457611734611c1e565b041461174757600080925092505061174e565b6001925090505b9250929050565b6060824710156117cd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610687565b600080866001600160a01b031685876040516117e99190611cbb565b60006040518083038185875af1925050503d8060008114611826576040519150601f19603f3d011682016040523d82523d6000602084013e61182b565b606091505b509150915061183c878383876118cf565b925050505b949350505050565b600054610100900460ff166118c65760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610687565b610aed336115e4565b6060831561193e578251600003611937576001600160a01b0385163b6119375760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610687565b5081611841565b61184183838151156119535781518083602001fd5b8060405162461bcd60e51b81526004016106879190611cd7565b60006020828403121561197f57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146114fe57600080fd5b6001600160a01b038116811461059a57600080fd5b6000602082840312156119d657600080fd5b81356114fe816119af565b6000806000604084860312156119f657600080fd5b8335611a01816119af565b9250602084013567ffffffffffffffff80821115611a1e57600080fd5b818601915086601f830112611a3257600080fd5b813581811115611a4157600080fd5b876020828501011115611a5357600080fd5b6020830194508093505050509250925092565b60008060408385031215611a7957600080fd5b8235611a84816119af565b91506020830135611a94816119af565b809150509250929050565b60008060208385031215611ab257600080fd5b823567ffffffffffffffff80821115611aca57600080fd5b818501915085601f830112611ade57600080fd5b813581811115611aed57600080fd5b8660208260061b8501011115611b0257600080fd5b60209290920196919550909350505050565b602080825282518282018190526000919060409081850190868401855b82811015611b6357815180516001600160a01b0316855286015161ffff16868501529284019290850190600101611b31565b5091979650505050505050565b805161ffff811681146113f957600080fd5b600060408284031215611b9457600080fd5b6040516040810181811067ffffffffffffffff82111715611bc557634e487b7160e01b600052604160045260246000fd5b6040528251611bd3816119af565b8152611be160208401611b70565b60208201529392505050565b600060208284031215611bff57600080fd5b6114fe82611b70565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b600060208284031215611c4657600080fd5b5051919050565b600060208284031215611c5f57600080fd5b815180151581146114fe57600080fd5b60006000198203611c9057634e487b7160e01b600052601160045260246000fd5b5060010190565b60005b83811015611cb2578181015183820152602001611c9a565b50506000910152565b60008251611ccd818460208701611c97565b9190910192915050565b6020815260008251806020840152611cf6816040850160208701611c97565b601f01601f1916919091016040019291505056fea26469706673582212208f9a5df952782c5e454a23d5bbfb3def017a3499ba3f7310be49e68a9ae4cccf64736f6c63430008120033", + "solcInputHash": "e64fd56b3bfae7f817a31de5cae19a1b", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"erc20Contract\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ERC20Transferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ETHTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"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\":\"_recipient\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_royaltyManager\",\"outputs\":[{\"internalType\":\"contract IRoyaltyManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRecipients\",\"outputs\":[{\"components\":[{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"bps\",\"type\":\"uint16\"}],\"internalType\":\"struct Recipient[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"royaltyManager\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"}],\"name\":\"isTrustedForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"}],\"name\":\"proxyCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"bps\",\"type\":\"uint16\"}],\"internalType\":\"struct Recipient[]\",\"name\":\"recipients\",\"type\":\"tuple[]\"}],\"name\":\"setRecipients\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"erc20Contract\",\"type\":\"address\"}],\"name\":\"splitERC20Tokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"splitETH\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"The Sandbox\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"getRecipients()\":{\"returns\":{\"_0\":\"recipients of royalty through this splitter and their splits of royalty.\"}},\"initialize(address,address)\":{\"details\":\"can only be run once.\",\"params\":{\"recipient\":\"the wallet of the creator when the contract is deployed\",\"royaltyManager\":\"the address of the royalty manager contract\"}},\"isTrustedForwarder(address)\":{\"params\":{\"forwarder\":\"trusted forwarder address to check\"},\"returns\":{\"_0\":\"true if the address is the same as the trusted forwarder\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"proxyCall(address,bytes)\":{\"details\":\"first attempts to split ERC20 tokens.\",\"params\":{\"callData\":\"for the call.\",\"target\":\"target of the call\"}},\"renounceOwnership()\":{\"details\":\"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.\"},\"setRecipients((address,uint16)[])\":{\"details\":\"only the owner can call this.\",\"params\":{\"recipients\":\"the array of recipients which should only have one recipient.\"}},\"splitERC20Tokens(address)\":{\"details\":\"can only be called by one of the recipients\",\"params\":{\"erc20Contract\":\"the address of the tokens to be split.\"}},\"splitETH()\":{\"details\":\"normally ETH should be split automatically by receive function.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"RoyaltySplitter\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getRecipients()\":{\"notice\":\"to get recipients of royalty through this splitter and their splits of royalty.\"},\"initialize(address,address)\":{\"notice\":\"initialize the contract\"},\"isTrustedForwarder(address)\":{\"notice\":\"return true if the forwarder is the trusted forwarder\"},\"proxyCall(address,bytes)\":{\"notice\":\"made for unexpected scenarios when assets are sent to this contact such that they could be recovered.\"},\"setRecipients((address,uint16)[])\":{\"notice\":\"sets recipient for the splitter\"},\"splitERC20Tokens(address)\":{\"notice\":\"split ERC20 Tokens owned by this contract.\"},\"splitETH()\":{\"notice\":\"Splits and forwards ETH to the royalty receivers\"}},\"notice\":\"RoyaltySplitter contract is deployed by the RoyaltyManager contract for a creator to get his royalty's share.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol\":\"RoyaltySplitter\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@manifoldxyz/royalty-registry-solidity/contracts/libraries/BytesLibrary.sol\":{\"content\":\"// SPDX-License-Identifier: MIT OR Apache-2.0\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice A library for manipulation of byte arrays.\\n */\\nlibrary BytesLibrary {\\n /**\\n * @dev Replace the address at the given location in a byte array if the contents at that location\\n * match the expected address.\\n */\\n function replaceAtIf(bytes memory data, uint256 startLocation, address expectedAddress, address newAddress)\\n internal\\n pure\\n {\\n bytes memory expectedData = abi.encodePacked(expectedAddress);\\n bytes memory newData = abi.encodePacked(newAddress);\\n // An address is 20 bytes long\\n for (uint256 i = 0; i < 20; i++) {\\n uint256 dataLocation = startLocation + i;\\n require(data[dataLocation] == expectedData[i], \\\"Bytes: Data provided does not include the expectedAddress\\\");\\n data[dataLocation] = newData[i];\\n }\\n }\\n\\n /**\\n * @dev Checks if the call data starts with the given function signature.\\n */\\n function startsWith(bytes memory callData, bytes4 functionSig) internal pure returns (bool) {\\n // A signature is 4 bytes long\\n if (callData.length < 4) {\\n return false;\\n }\\n for (uint256 i = 0; i < 4; i++) {\\n if (callData[i] != functionSig[i]) {\\n return false;\\n }\\n }\\n\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x73fd074a57bd5d185ffb79dd98bb8db2e97c2d7df064d83f3f42da15ab9da8a1\",\"license\":\"MIT OR Apache-2.0\"},\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/// @author: manifold.xyz\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\nstruct Recipient {\\n address payable recipient;\\n uint16 bps;\\n}\\n\\ninterface IRoyaltySplitter is IERC165 {\\n /**\\n * @dev Set the splitter recipients. Total bps must total 10000.\\n */\\n function setRecipients(Recipient[] calldata recipients) external;\\n\\n /**\\n * @dev Get the splitter recipients;\\n */\\n function getRecipients() external view returns (Recipient[] memory);\\n}\\n\",\"keccak256\":\"0xc507963f66c4238d25e69d2d05ac5995c549aa89789e89e7a556403221547c6d\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized != type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n// CAUTION\\n// This version of SafeMath should only be used with Solidity 0.8 or later,\\n// because it relies on the compiler's built in overflow checks.\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations.\\n *\\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\\n * now has built in overflow checking.\\n */\\nlibrary SafeMath {\\n /**\\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n uint256 c = a + b;\\n if (c < a) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b == 0) return (false, 0);\\n return (true, a / b);\\n }\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\n }\\n\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a + b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a * b;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator.\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a % b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {trySub}.\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n unchecked {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting with custom message when dividing by zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryMod}.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a % b;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x58b21219689909c4f8339af00813760337f7e2e7f169a97fe49e2896dcfb3b9a\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerAbstract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\n/// @dev minimal ERC2771 handler to keep bytecode-size down\\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\\nabstract contract ERC2771HandlerAbstract {\\n /// @notice return true if the forwarder is the trusted forwarder\\n /// @param forwarder trusted forwarder address to check\\n /// @return true if the address is the same as the trusted forwarder\\n function isTrustedForwarder(address forwarder) external view returns (bool) {\\n return _isTrustedForwarder(forwarder);\\n }\\n\\n /// @notice if the call is from the trusted forwarder the sender is extracted from calldata, msg.sender otherwise\\n /// @return sender the calculated address of the sender\\n function _msgSender() internal view virtual returns (address sender) {\\n if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\\n // The assembly code is more direct than the Solidity version using `abi.decode`.\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\\n }\\n } else {\\n sender = msg.sender;\\n }\\n }\\n\\n /// @notice if the call is from the trusted forwarder the sender is removed from calldata\\n /// @return the calldata without the sender\\n function _msgData() internal view virtual returns (bytes calldata) {\\n if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\\n return msg.data[:msg.data.length - 20];\\n } else {\\n return msg.data;\\n }\\n }\\n\\n /// @notice return true if the forwarder is the trusted forwarder\\n /// @param forwarder trusted forwarder address to check\\n /// @return true if the address is the same as the trusted forwarder\\n /// @dev this function must be IMPLEMENTED\\n function _isTrustedForwarder(address forwarder) internal view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xc4f349865ea7146f51b69f1edacdef60e0a2a7cf4dab538a5ae53ee9a0036231\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ERC2771HandlerAbstract} from \\\"./ERC2771HandlerAbstract.sol\\\";\\n\\n/// @dev minimal ERC2771 handler to keep bytecode-size down\\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\\ncontract ERC2771HandlerUpgradeable is Initializable, ERC2771HandlerAbstract {\\n address private _trustedForwarder;\\n\\n /// @notice Emitted when a `newTrustedForwarder` is set, replacing the `oldTrustedForwarder`\\n /// @param oldTrustedForwarder old trusted forwarder\\n /// @param newTrustedForwarder new trusted forwarder\\n /// @param operator the sender of the transaction\\n event TrustedForwarderSet(\\n address indexed oldTrustedForwarder,\\n address indexed newTrustedForwarder,\\n address indexed operator\\n );\\n\\n /// @notice initialize the trusted forwarder address\\n /// @param forwarder trusted forwarder address or zero to disable it\\n function __ERC2771Handler_init(address forwarder) internal onlyInitializing {\\n __ERC2771Handler_init_unchained(forwarder);\\n }\\n\\n /// @notice initialize the trusted forwarder address\\n /// @param forwarder trusted forwarder address or zero to disable it\\n function __ERC2771Handler_init_unchained(address forwarder) internal onlyInitializing {\\n _setTrustedForwarder(forwarder);\\n }\\n\\n /// @notice return the address of the trusted forwarder\\n /// @return return the address of the trusted forwarder\\n function getTrustedForwarder() external view returns (address) {\\n return _trustedForwarder;\\n }\\n\\n /// @notice set the address of the trusted forwarder\\n /// @param newForwarder the address of the new forwarder.\\n function _setTrustedForwarder(address newForwarder) internal virtual {\\n require(newForwarder != _trustedForwarder, \\\"ERC2771HandlerUpgradeable: forwarder already set\\\");\\n emit TrustedForwarderSet(_trustedForwarder, newForwarder, _msgSender());\\n _trustedForwarder = newForwarder;\\n }\\n\\n /// @notice return true if the forwarder is the trusted forwarder\\n /// @param forwarder trusted forwarder address to check\\n /// @return true if the address is the same as the trusted forwarder\\n function _isTrustedForwarder(address forwarder) internal view virtual override returns (bool) {\\n return forwarder == _trustedForwarder;\\n }\\n\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x63e53ca5ec229e51d866b0b8e3c8f36056598d9fbf960bb57b4b9731917af16f\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT OR Apache-2.0\\npragma solidity ^0.8.0;\\n\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {\\n OwnableUpgradeable,\\n ContextUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {AddressUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\\\";\\nimport {ERC165Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\\\";\\nimport {SafeMath} from \\\"@openzeppelin/contracts/utils/math/SafeMath.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {BytesLibrary} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/libraries/BytesLibrary.sol\\\";\\nimport {\\n IRoyaltySplitter,\\n IERC165,\\n Recipient\\n} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\nimport {\\n ERC2771HandlerAbstract\\n} from \\\"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\\\";\\nimport {IRoyaltyManager} from \\\"./interfaces/IRoyaltyManager.sol\\\";\\nimport {IERC20Approve} from \\\"./interfaces/IERC20Approve.sol\\\";\\n\\n/// @title RoyaltySplitter\\n/// @author The Sandbox\\n/// @notice RoyaltySplitter contract is deployed by the RoyaltyManager contract for a creator to get his royalty's share.\\ncontract RoyaltySplitter is\\n Initializable,\\n OwnableUpgradeable,\\n IRoyaltySplitter,\\n ERC165Upgradeable,\\n ERC2771HandlerAbstract\\n{\\n using BytesLibrary for bytes;\\n using AddressUpgradeable for address payable;\\n using AddressUpgradeable for address;\\n using SafeMath for uint256;\\n\\n uint256 internal constant TOTAL_BASIS_POINTS = 10000;\\n uint256 internal constant IERC20_APPROVE_SELECTOR =\\n 0x095ea7b300000000000000000000000000000000000000000000000000000000;\\n uint256 internal constant SELECTOR_MASK = 0xffffffff00000000000000000000000000000000000000000000000000000000;\\n\\n address payable public _recipient;\\n IRoyaltyManager public _royaltyManager;\\n\\n event ETHTransferred(address indexed account, uint256 amount);\\n event ERC20Transferred(address indexed erc20Contract, address indexed account, uint256 amount);\\n\\n function supportsInterface(bytes4 interfaceId)\\n public\\n view\\n virtual\\n override(IERC165, ERC165Upgradeable)\\n returns (bool)\\n {\\n return interfaceId == type(IRoyaltySplitter).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /// @notice initialize the contract\\n /// @dev can only be run once.\\n /// @param recipient the wallet of the creator when the contract is deployed\\n /// @param royaltyManager the address of the royalty manager contract\\n function initialize(address payable recipient, address royaltyManager) public initializer {\\n _royaltyManager = IRoyaltyManager(royaltyManager); // set manager before Ownable_init for _isTrustedForwarder\\n _recipient = recipient;\\n __Ownable_init();\\n }\\n\\n /// @notice sets recipient for the splitter\\n /// @dev only the owner can call this.\\n /// @param recipients the array of recipients which should only have one recipient.\\n function setRecipients(Recipient[] calldata recipients) external override onlyOwner {\\n _setRecipients(recipients);\\n }\\n\\n function _setRecipients(Recipient[] calldata recipients) private {\\n delete _recipient;\\n require(recipients.length == 1, \\\"Invalid recipents length\\\");\\n _recipient = recipients[0].recipient;\\n }\\n\\n /// @notice to get recipients of royalty through this splitter and their splits of royalty.\\n /// @return recipients of royalty through this splitter and their splits of royalty.\\n function getRecipients() external view override returns (Recipient[] memory) {\\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\\n uint16 creatorSplit = _royaltyManager.getCreatorSplit();\\n Recipient[] memory recipients = new Recipient[](2);\\n recipients[0].recipient = _recipient;\\n recipients[0].bps = creatorSplit;\\n recipients[1] = commonRecipient;\\n return recipients;\\n }\\n\\n /// @notice Splits and forwards ETH to the royalty receivers\\n /// @dev splits ETH every time it is sent to this contract as royalty.\\n receive() external payable {\\n _splitETH(msg.value);\\n }\\n\\n /// @notice Splits and forwards ETH to the royalty receivers\\n /// @dev normally ETH should be split automatically by receive function.\\n function splitETH() public payable {\\n _splitETH(address(this).balance);\\n }\\n\\n function _splitETH(uint256 value) internal {\\n if (value > 0) {\\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\\n uint16 creatorSplit = _royaltyManager.getCreatorSplit();\\n Recipient[] memory _recipients = new Recipient[](2);\\n _recipients[0].recipient = _recipient;\\n _recipients[0].bps = creatorSplit;\\n _recipients[1] = commonRecipient;\\n uint256 totalSent;\\n uint256 amountToSend;\\n unchecked {\\n for (uint256 i = _recipients.length - 1; i > 0; i--) {\\n Recipient memory recipient = _recipients[i];\\n amountToSend = (value * recipient.bps) / TOTAL_BASIS_POINTS;\\n totalSent += amountToSend;\\n recipient.recipient.sendValue(amountToSend);\\n emit ETHTransferred(recipient.recipient, amountToSend);\\n }\\n // Favor the 1st recipient if there are any rounding issues\\n amountToSend = value - totalSent;\\n }\\n _recipients[0].recipient.sendValue(amountToSend);\\n emit ETHTransferred(_recipients[0].recipient, amountToSend);\\n }\\n }\\n\\n /// @notice split ERC20 Tokens owned by this contract.\\n /// @dev can only be called by one of the recipients\\n /// @param erc20Contract the address of the tokens to be split.\\n function splitERC20Tokens(IERC20 erc20Contract) public {\\n require(_splitERC20Tokens(erc20Contract), \\\"Split: ERC20 split failed\\\");\\n }\\n\\n function _splitERC20Tokens(IERC20 erc20Contract) internal returns (bool) {\\n try erc20Contract.balanceOf(address(this)) returns (uint256 balance) {\\n if (balance == 0) {\\n return false;\\n }\\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\\n uint16 creatorSplit = _royaltyManager.getCreatorSplit();\\n require(\\n commonRecipient.recipient == _msgSender() || _recipient == _msgSender(),\\n \\\"Split: Can only be called by one of the recipients\\\"\\n );\\n Recipient[] memory _recipients = new Recipient[](2);\\n _recipients[0].recipient = _recipient;\\n _recipients[0].bps = creatorSplit;\\n _recipients[1] = commonRecipient;\\n uint256 amountToSend;\\n uint256 totalSent;\\n unchecked {\\n for (uint256 i = _recipients.length - 1; i > 0; i--) {\\n Recipient memory recipient = _recipients[i];\\n bool success;\\n (success, amountToSend) = balance.tryMul(recipient.bps);\\n\\n amountToSend /= TOTAL_BASIS_POINTS;\\n totalSent += amountToSend;\\n try erc20Contract.transfer(recipient.recipient, amountToSend) {\\n emit ERC20Transferred(address(erc20Contract), recipient.recipient, amountToSend);\\n } catch {\\n return false;\\n }\\n }\\n // Favor the 1st recipient if there are any rounding issues\\n amountToSend = balance - totalSent;\\n }\\n try erc20Contract.transfer(_recipients[0].recipient, amountToSend) {\\n emit ERC20Transferred(address(erc20Contract), _recipients[0].recipient, amountToSend);\\n } catch {\\n return false;\\n }\\n return true;\\n } catch {\\n return false;\\n }\\n }\\n\\n /// @notice made for unexpected scenarios when assets are sent to this contact such that they could be recovered.\\n /// @dev first attempts to split ERC20 tokens.\\n /// @param target target of the call\\n /// @param callData for the call.\\n function proxyCall(address payable target, bytes calldata callData) external {\\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\\n require(\\n commonRecipient.recipient == _msgSender() || _recipient == _msgSender(),\\n \\\"Split: Can only be called by one of the recipients\\\"\\n );\\n require(\\n !callData.startsWith(IERC20Approve.approve.selector) &&\\n !callData.startsWith(IERC20Approve.increaseAllowance.selector),\\n \\\"Split: ERC20 tokens must be split\\\"\\n );\\n /* solhint-disable-next-line no-empty-blocks*/\\n try this.splitERC20Tokens(IERC20(target)) {} catch {}\\n target.functionCall(callData);\\n }\\n\\n /// @notice verify whether a forwarder address is the trustedForwarder address, using the manager setting\\n /// @dev this function is used to avoid having a trustedForwarder variable inside the splitter\\n /// @return bool whether the forwarder is the trusted address\\n function _isTrustedForwarder(address forwarder) internal view override(ERC2771HandlerAbstract) returns (bool) {\\n return forwarder == _royaltyManager.getTrustedForwarder();\\n }\\n\\n function _msgSender()\\n internal\\n view\\n virtual\\n override(ContextUpgradeable, ERC2771HandlerAbstract)\\n returns (address sender)\\n {\\n return ERC2771HandlerAbstract._msgSender();\\n }\\n\\n function _msgData()\\n internal\\n view\\n virtual\\n override(ContextUpgradeable, ERC2771HandlerAbstract)\\n returns (bytes calldata)\\n {\\n return ERC2771HandlerAbstract._msgData();\\n }\\n}\\n\",\"keccak256\":\"0x1e61d48e87a5c4f598837545a0899a9a280e449f96d4b1d7d6ca4109f93c613a\",\"license\":\"MIT OR Apache-2.0\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IERC20Approve.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\ninterface IERC20Approve {\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n function increaseAllowance(address spender, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x1f1e86109f5d15e996f94a30a4b4760b9c6b0f17bfff9e88e37714bd65b02f12\",\"license\":\"MIT\"},\"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport {Recipient} from \\\"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\\\";\\n\\ninterface IRoyaltyManager {\\n event RecipientSet(address commonRecipient);\\n\\n event SplitSet(uint16 commonSplit);\\n\\n event RoyaltySet(uint16 royaltyBps, address contractAddress);\\n\\n function setRecipient(address payable _commonRecipient) external;\\n\\n function setSplit(uint16 commonSplit) external;\\n\\n function getCommonRecipient() external view returns (Recipient memory recipient);\\n\\n function getCreatorSplit() external view returns (uint16);\\n\\n function getRoyaltyInfo() external view returns (address payable, uint16);\\n\\n function deploySplitter(address creator, address payable recipient) external returns (address payable);\\n\\n function getCreatorRoyaltySplitter(address creator) external view returns (address payable);\\n\\n function getContractRoyalty(address _contractAddress) external view returns (uint16 royaltyBps);\\n\\n function setTrustedForwarder(address _newForwarder) external;\\n\\n function getTrustedForwarder() external view returns (address);\\n}\\n\",\"keccak256\":\"0x5193f7ce9bce4ac3facefdaa6172e0a0b8868356ca232d33cfb70a24e7b84cc2\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50611ee4806100206000396000f3fe6080604052600436106100d65760003560e01c8063715018a61161007f578063d1aa25d011610059578063d1aa25d01461022b578063d4cca5f114610233578063d78d610b14610253578063f2fde38b1461027557600080fd5b8063715018a6146101d85780638da5cb5b146101ed578063c1426d0e1461020b57600080fd5b8063485cc955116100b0578063485cc95514610160578063572b6c0514610180578063663cb1bb146101a057600080fd5b806301ffc9a7146100eb57806320dc8ff7146101205780632a31f6b41461014057600080fd5b366100e6576100e434610295565b005b600080fd5b3480156100f757600080fd5b5061010b610106366004611af4565b6105bb565b60405190151581526020015b60405180910390f35b34801561012c57600080fd5b506100e461013b366004611b4b565b610654565b34801561014c57600080fd5b506100e461015b366004611b68565b6106ae565b34801561016c57600080fd5b506100e461017b366004611bed565b610999565b34801561018c57600080fd5b5061010b61019b366004611b4b565b610b16565b3480156101ac57600080fd5b506098546101c0906001600160a01b031681565b6040516001600160a01b039091168152602001610117565b3480156101e457600080fd5b506100e4610b21565b3480156101f957600080fd5b506033546001600160a01b03166101c0565b34801561021757600080fd5b506100e4610226366004611c26565b610b35565b6100e4610b4b565b34801561023f57600080fd5b506097546101c0906001600160a01b031681565b34801561025f57600080fd5b50610268610b54565b6040516101179190611c9b565b34801561028157600080fd5b506100e4610290366004611b4b565b610d1b565b80156105b85760985460408051638b49fde760e01b815281516000936001600160a01b031692638b49fde792600480820193918290030181865afa1580156102e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103059190611d09565b90506000609860009054906101000a90046001600160a01b03166001600160a01b031663706ec2fe6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561035c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103809190611d74565b6040805160028082526060820190925291925060009190816020015b604080518082019091526000808252602082015281526020019060019003908161039c57505060975481519192506001600160a01b03169082906000906103e5576103e5611d8f565b6020026020010151600001906001600160a01b031690816001600160a01b031681525050818160008151811061041d5761041d611d8f565b60200260200101516020019061ffff16908161ffff1681525050828160018151811061044b5761044b611d8f565b60200260200101819052506000806000600184510390505b801561051157600084828151811061047d5761047d611d8f565b60200260200101519050612710816020015161ffff168902816104a2576104a2611da5565b82519190049485019493506104c0906001600160a01b031684610da8565b80600001516001600160a01b03167f1445764fe3fdfc2a9812ff42e9b65c2e7896d5162851f78f7d4a5578f7346ff1846040516104ff91815260200190565b60405180910390a25060001901610463565b508186039050610551818460008151811061052e5761052e611d8f565b6020026020010151600001516001600160a01b0316610da890919063ffffffff16565b8260008151811061056457610564611d8f565b6020026020010151600001516001600160a01b03167f1445764fe3fdfc2a9812ff42e9b65c2e7896d5162851f78f7d4a5578f7346ff1826040516105aa91815260200190565b60405180910390a250505050505b50565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f16cf0c0500000000000000000000000000000000000000000000000000000000148061064e57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b61065d81610ec1565b6105b85760405162461bcd60e51b815260206004820152601960248201527f53706c69743a2045524332302073706c6974206661696c65640000000000000060448201526064015b60405180910390fd5b60985460408051638b49fde760e01b815281516000936001600160a01b031692638b49fde792600480820193918290030181865afa1580156106f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107189190611d09565b9050610722611461565b6001600160a01b031681600001516001600160a01b0316148061075a5750610748611461565b6097546001600160a01b039081169116145b6107cc5760405162461bcd60e51b815260206004820152603260248201527f53706c69743a2043616e206f6e6c792062652063616c6c6564206279206f6e6560448201527f206f662074686520726563697069656e7473000000000000000000000000000060648201526084016106a5565b61081663095ea7b360e01b84848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506114709050565b15801561086a5750610868633950935160e01b84848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506114709050565b155b6108dc5760405162461bcd60e51b815260206004820152602160248201527f53706c69743a20455243323020746f6b656e73206d7573742062652073706c6960448201527f740000000000000000000000000000000000000000000000000000000000000060648201526084016106a5565b6040517f20dc8ff70000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015230906320dc8ff790602401600060405180830381600087803b15801561093657600080fd5b505af1925050508015610947575060015b5061099283838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506001600160a01b0388169291505061152c565b5050505050565b600054610100900460ff16158080156109b95750600054600160ff909116105b806109d35750303b1580156109d3575060005460ff166001145b610a455760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016106a5565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610a86576000805461ff0019166101001790555b609880546001600160a01b0380851673ffffffffffffffffffffffffffffffffffffffff19928316179092556097805492861692909116919091179055610acb611577565b8015610b11576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b600061064e826115fc565b610b2961169e565b610b336000611717565b565b610b3d61169e565b610b478282611776565b5050565b610b3347610295565b60985460408051638b49fde760e01b815281516060936000936001600160a01b0390911692638b49fde792600480830193928290030181865afa158015610b9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc39190611d09565b90506000609860009054906101000a90046001600160a01b03166001600160a01b031663706ec2fe6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3e9190611d74565b6040805160028082526060820190925291925060009190816020015b6040805180820190915260008082526020820152815260200190600190039081610c5a57505060975481519192506001600160a01b0316908290600090610ca357610ca3611d8f565b6020026020010151600001906001600160a01b031690816001600160a01b0316815250508181600081518110610cdb57610cdb611d8f565b60200260200101516020019061ffff16908161ffff16815250508281600181518110610d0957610d09611d8f565b60209081029190910101529392505050565b610d2361169e565b6001600160a01b038116610d9f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016106a5565b6105b881611717565b80471015610df85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016106a5565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610e45576040519150601f19603f3d011682016040523d82523d6000602084013e610e4a565b606091505b5050905080610b115760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016106a5565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa925050508015610f3d575060408051601f3d908101601f19168201909252610f3a91810190611dbb565b60015b610f4957506000919050565b80600003610f5a5750600092915050565b60985460408051638b49fde760e01b815281516000936001600160a01b031692638b49fde792600480820193918290030181865afa158015610fa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc49190611d09565b90506000609860009054906101000a90046001600160a01b03166001600160a01b031663706ec2fe6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561101b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103f9190611d74565b9050611049611461565b6001600160a01b031682600001516001600160a01b03161480611081575061106f611461565b6097546001600160a01b039081169116145b6110f35760405162461bcd60e51b815260206004820152603260248201527f53706c69743a2043616e206f6e6c792062652063616c6c6564206279206f6e6560448201527f206f662074686520726563697069656e7473000000000000000000000000000060648201526084016106a5565b60408051600280825260608201909252600091816020015b604080518082019091526000808252602082015281526020019060019003908161110b57505060975481519192506001600160a01b031690829060009061115457611154611d8f565b6020026020010151600001906001600160a01b031690816001600160a01b031681525050818160008151811061118c5761118c611d8f565b60200260200101516020019061ffff16908161ffff168152505082816001815181106111ba576111ba611d8f565b60200260200101819052506000806000600184510390505b801561131b5760008482815181106111ec576111ec611d8f565b602002602001015190506000611213826020015161ffff168a61183d90919063ffffffff16565b83516040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b03918216600482015261271090920460248301819052975095870195919250908c169063a9059cbb906044016020604051808303816000875af19250505080156112a9575060408051601f3d908101601f191682019092526112a691810190611dd4565b60015b6112be575060009a9950505050505050505050565b5081600001516001600160a01b03168b6001600160a01b03167fe8de91d538b06154a2c48315768c5046f47e127d7fd3f726fd85cc723f29b0528760405161130891815260200190565b60405180910390a35050600019016111d2565b508086039150876001600160a01b031663a9059cbb8460008151811061134357611343611d8f565b6020908102919091010151516040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af19250505080156113d0575060408051601f3d908101601f191682019092526113cd91810190611dd4565b60015b6113e257506000979650505050505050565b50826000815181106113f6576113f6611d8f565b6020026020010151600001516001600160a01b0316886001600160a01b03167fe8de91d538b06154a2c48315768c5046f47e127d7fd3f726fd85cc723f29b0528460405161144691815260200190565b60405180910390a3506001979650505050505050565b919050565b600061146b611888565b905090565b60006004835110156114845750600061064e565b60005b6004811015611522578281600481106114a2576114a2611d8f565b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168482815181106114da576114da611d8f565b01602001517fff00000000000000000000000000000000000000000000000000000000000000161461151057600091505061064e565b8061151a81611df6565b915050611487565b5060019392505050565b6060611570838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c656400008152506118d5565b9392505050565b600054610100900460ff166115f45760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016106a5565b610b336119c9565b609854604080517fce1b815f00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163ce1b815f9160048083019260209291908290030181865afa15801561165f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116839190611e1e565b6001600160a01b0316826001600160a01b0316149050919050565b6116a6611461565b6001600160a01b03166116c16033546001600160a01b031690565b6001600160a01b031614610b335760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106a5565b603380546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6097805473ffffffffffffffffffffffffffffffffffffffff19169055600181146117e35760405162461bcd60e51b815260206004820152601860248201527f496e76616c6964207265636970656e7473206c656e677468000000000000000060448201526064016106a5565b818160008181106117f6576117f6611d8f565b61180c9260206040909202019081019150611b4b565b6097805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03929092169190911790555050565b600080836000036118545750600190506000611881565b8383028385828161186757611867611da5565b041461187a576000809250925050611881565b6001925090505b9250929050565b6000611893336115fc565b80156118a0575060143610155b156118d057507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b503390565b60608247101561194d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016106a5565b600080866001600160a01b031685876040516119699190611e5f565b60006040518083038185875af1925050503d80600081146119a6576040519150601f19603f3d011682016040523d82523d6000602084013e6119ab565b606091505b50915091506119bc87838387611a56565b925050505b949350505050565b600054610100900460ff16611a465760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016106a5565b610b33611a51611461565b611717565b60608315611ac5578251600003611abe576001600160a01b0385163b611abe5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106a5565b50816119c1565b6119c18383815115611ada5781518083602001fd5b8060405162461bcd60e51b81526004016106a59190611e7b565b600060208284031215611b0657600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461157057600080fd5b6001600160a01b03811681146105b857600080fd5b600060208284031215611b5d57600080fd5b813561157081611b36565b600080600060408486031215611b7d57600080fd5b8335611b8881611b36565b9250602084013567ffffffffffffffff80821115611ba557600080fd5b818601915086601f830112611bb957600080fd5b813581811115611bc857600080fd5b876020828501011115611bda57600080fd5b6020830194508093505050509250925092565b60008060408385031215611c0057600080fd5b8235611c0b81611b36565b91506020830135611c1b81611b36565b809150509250929050565b60008060208385031215611c3957600080fd5b823567ffffffffffffffff80821115611c5157600080fd5b818501915085601f830112611c6557600080fd5b813581811115611c7457600080fd5b8660208260061b8501011115611c8957600080fd5b60209290920196919550909350505050565b602080825282518282018190526000919060409081850190868401855b82811015611cea57815180516001600160a01b0316855286015161ffff16868501529284019290850190600101611cb8565b5091979650505050505050565b805161ffff8116811461145c57600080fd5b600060408284031215611d1b57600080fd5b6040516040810181811067ffffffffffffffff82111715611d4c57634e487b7160e01b600052604160045260246000fd5b6040528251611d5a81611b36565b8152611d6860208401611cf7565b60208201529392505050565b600060208284031215611d8657600080fd5b61157082611cf7565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b600060208284031215611dcd57600080fd5b5051919050565b600060208284031215611de657600080fd5b8151801515811461157057600080fd5b60006000198203611e1757634e487b7160e01b600052601160045260246000fd5b5060010190565b600060208284031215611e3057600080fd5b815161157081611b36565b60005b83811015611e56578181015183820152602001611e3e565b50506000910152565b60008251611e71818460208701611e3b565b9190910192915050565b6020815260008251806020840152611e9a816040850160208701611e3b565b601f01601f1916919091016040019291505056fea2646970667358221220e0a6d5b5165e5a2ce9111658444a4f8e39022faa7c3f91cbe6ae0a9f3ef50e1164736f6c63430008120033", + "deployedBytecode": "0x6080604052600436106100d65760003560e01c8063715018a61161007f578063d1aa25d011610059578063d1aa25d01461022b578063d4cca5f114610233578063d78d610b14610253578063f2fde38b1461027557600080fd5b8063715018a6146101d85780638da5cb5b146101ed578063c1426d0e1461020b57600080fd5b8063485cc955116100b0578063485cc95514610160578063572b6c0514610180578063663cb1bb146101a057600080fd5b806301ffc9a7146100eb57806320dc8ff7146101205780632a31f6b41461014057600080fd5b366100e6576100e434610295565b005b600080fd5b3480156100f757600080fd5b5061010b610106366004611af4565b6105bb565b60405190151581526020015b60405180910390f35b34801561012c57600080fd5b506100e461013b366004611b4b565b610654565b34801561014c57600080fd5b506100e461015b366004611b68565b6106ae565b34801561016c57600080fd5b506100e461017b366004611bed565b610999565b34801561018c57600080fd5b5061010b61019b366004611b4b565b610b16565b3480156101ac57600080fd5b506098546101c0906001600160a01b031681565b6040516001600160a01b039091168152602001610117565b3480156101e457600080fd5b506100e4610b21565b3480156101f957600080fd5b506033546001600160a01b03166101c0565b34801561021757600080fd5b506100e4610226366004611c26565b610b35565b6100e4610b4b565b34801561023f57600080fd5b506097546101c0906001600160a01b031681565b34801561025f57600080fd5b50610268610b54565b6040516101179190611c9b565b34801561028157600080fd5b506100e4610290366004611b4b565b610d1b565b80156105b85760985460408051638b49fde760e01b815281516000936001600160a01b031692638b49fde792600480820193918290030181865afa1580156102e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103059190611d09565b90506000609860009054906101000a90046001600160a01b03166001600160a01b031663706ec2fe6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561035c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103809190611d74565b6040805160028082526060820190925291925060009190816020015b604080518082019091526000808252602082015281526020019060019003908161039c57505060975481519192506001600160a01b03169082906000906103e5576103e5611d8f565b6020026020010151600001906001600160a01b031690816001600160a01b031681525050818160008151811061041d5761041d611d8f565b60200260200101516020019061ffff16908161ffff1681525050828160018151811061044b5761044b611d8f565b60200260200101819052506000806000600184510390505b801561051157600084828151811061047d5761047d611d8f565b60200260200101519050612710816020015161ffff168902816104a2576104a2611da5565b82519190049485019493506104c0906001600160a01b031684610da8565b80600001516001600160a01b03167f1445764fe3fdfc2a9812ff42e9b65c2e7896d5162851f78f7d4a5578f7346ff1846040516104ff91815260200190565b60405180910390a25060001901610463565b508186039050610551818460008151811061052e5761052e611d8f565b6020026020010151600001516001600160a01b0316610da890919063ffffffff16565b8260008151811061056457610564611d8f565b6020026020010151600001516001600160a01b03167f1445764fe3fdfc2a9812ff42e9b65c2e7896d5162851f78f7d4a5578f7346ff1826040516105aa91815260200190565b60405180910390a250505050505b50565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f16cf0c0500000000000000000000000000000000000000000000000000000000148061064e57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b61065d81610ec1565b6105b85760405162461bcd60e51b815260206004820152601960248201527f53706c69743a2045524332302073706c6974206661696c65640000000000000060448201526064015b60405180910390fd5b60985460408051638b49fde760e01b815281516000936001600160a01b031692638b49fde792600480820193918290030181865afa1580156106f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107189190611d09565b9050610722611461565b6001600160a01b031681600001516001600160a01b0316148061075a5750610748611461565b6097546001600160a01b039081169116145b6107cc5760405162461bcd60e51b815260206004820152603260248201527f53706c69743a2043616e206f6e6c792062652063616c6c6564206279206f6e6560448201527f206f662074686520726563697069656e7473000000000000000000000000000060648201526084016106a5565b61081663095ea7b360e01b84848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506114709050565b15801561086a5750610868633950935160e01b84848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506114709050565b155b6108dc5760405162461bcd60e51b815260206004820152602160248201527f53706c69743a20455243323020746f6b656e73206d7573742062652073706c6960448201527f740000000000000000000000000000000000000000000000000000000000000060648201526084016106a5565b6040517f20dc8ff70000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015230906320dc8ff790602401600060405180830381600087803b15801561093657600080fd5b505af1925050508015610947575060015b5061099283838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506001600160a01b0388169291505061152c565b5050505050565b600054610100900460ff16158080156109b95750600054600160ff909116105b806109d35750303b1580156109d3575060005460ff166001145b610a455760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016106a5565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610a86576000805461ff0019166101001790555b609880546001600160a01b0380851673ffffffffffffffffffffffffffffffffffffffff19928316179092556097805492861692909116919091179055610acb611577565b8015610b11576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b600061064e826115fc565b610b2961169e565b610b336000611717565b565b610b3d61169e565b610b478282611776565b5050565b610b3347610295565b60985460408051638b49fde760e01b815281516060936000936001600160a01b0390911692638b49fde792600480830193928290030181865afa158015610b9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc39190611d09565b90506000609860009054906101000a90046001600160a01b03166001600160a01b031663706ec2fe6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3e9190611d74565b6040805160028082526060820190925291925060009190816020015b6040805180820190915260008082526020820152815260200190600190039081610c5a57505060975481519192506001600160a01b0316908290600090610ca357610ca3611d8f565b6020026020010151600001906001600160a01b031690816001600160a01b0316815250508181600081518110610cdb57610cdb611d8f565b60200260200101516020019061ffff16908161ffff16815250508281600181518110610d0957610d09611d8f565b60209081029190910101529392505050565b610d2361169e565b6001600160a01b038116610d9f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016106a5565b6105b881611717565b80471015610df85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016106a5565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610e45576040519150601f19603f3d011682016040523d82523d6000602084013e610e4a565b606091505b5050905080610b115760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016106a5565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa925050508015610f3d575060408051601f3d908101601f19168201909252610f3a91810190611dbb565b60015b610f4957506000919050565b80600003610f5a5750600092915050565b60985460408051638b49fde760e01b815281516000936001600160a01b031692638b49fde792600480820193918290030181865afa158015610fa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc49190611d09565b90506000609860009054906101000a90046001600160a01b03166001600160a01b031663706ec2fe6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561101b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103f9190611d74565b9050611049611461565b6001600160a01b031682600001516001600160a01b03161480611081575061106f611461565b6097546001600160a01b039081169116145b6110f35760405162461bcd60e51b815260206004820152603260248201527f53706c69743a2043616e206f6e6c792062652063616c6c6564206279206f6e6560448201527f206f662074686520726563697069656e7473000000000000000000000000000060648201526084016106a5565b60408051600280825260608201909252600091816020015b604080518082019091526000808252602082015281526020019060019003908161110b57505060975481519192506001600160a01b031690829060009061115457611154611d8f565b6020026020010151600001906001600160a01b031690816001600160a01b031681525050818160008151811061118c5761118c611d8f565b60200260200101516020019061ffff16908161ffff168152505082816001815181106111ba576111ba611d8f565b60200260200101819052506000806000600184510390505b801561131b5760008482815181106111ec576111ec611d8f565b602002602001015190506000611213826020015161ffff168a61183d90919063ffffffff16565b83516040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b03918216600482015261271090920460248301819052975095870195919250908c169063a9059cbb906044016020604051808303816000875af19250505080156112a9575060408051601f3d908101601f191682019092526112a691810190611dd4565b60015b6112be575060009a9950505050505050505050565b5081600001516001600160a01b03168b6001600160a01b03167fe8de91d538b06154a2c48315768c5046f47e127d7fd3f726fd85cc723f29b0528760405161130891815260200190565b60405180910390a35050600019016111d2565b508086039150876001600160a01b031663a9059cbb8460008151811061134357611343611d8f565b6020908102919091010151516040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af19250505080156113d0575060408051601f3d908101601f191682019092526113cd91810190611dd4565b60015b6113e257506000979650505050505050565b50826000815181106113f6576113f6611d8f565b6020026020010151600001516001600160a01b0316886001600160a01b03167fe8de91d538b06154a2c48315768c5046f47e127d7fd3f726fd85cc723f29b0528460405161144691815260200190565b60405180910390a3506001979650505050505050565b919050565b600061146b611888565b905090565b60006004835110156114845750600061064e565b60005b6004811015611522578281600481106114a2576114a2611d8f565b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168482815181106114da576114da611d8f565b01602001517fff00000000000000000000000000000000000000000000000000000000000000161461151057600091505061064e565b8061151a81611df6565b915050611487565b5060019392505050565b6060611570838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c656400008152506118d5565b9392505050565b600054610100900460ff166115f45760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016106a5565b610b336119c9565b609854604080517fce1b815f00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163ce1b815f9160048083019260209291908290030181865afa15801561165f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116839190611e1e565b6001600160a01b0316826001600160a01b0316149050919050565b6116a6611461565b6001600160a01b03166116c16033546001600160a01b031690565b6001600160a01b031614610b335760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106a5565b603380546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6097805473ffffffffffffffffffffffffffffffffffffffff19169055600181146117e35760405162461bcd60e51b815260206004820152601860248201527f496e76616c6964207265636970656e7473206c656e677468000000000000000060448201526064016106a5565b818160008181106117f6576117f6611d8f565b61180c9260206040909202019081019150611b4b565b6097805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03929092169190911790555050565b600080836000036118545750600190506000611881565b8383028385828161186757611867611da5565b041461187a576000809250925050611881565b6001925090505b9250929050565b6000611893336115fc565b80156118a0575060143610155b156118d057507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b503390565b60608247101561194d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016106a5565b600080866001600160a01b031685876040516119699190611e5f565b60006040518083038185875af1925050503d80600081146119a6576040519150601f19603f3d011682016040523d82523d6000602084013e6119ab565b606091505b50915091506119bc87838387611a56565b925050505b949350505050565b600054610100900460ff16611a465760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016106a5565b610b33611a51611461565b611717565b60608315611ac5578251600003611abe576001600160a01b0385163b611abe5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106a5565b50816119c1565b6119c18383815115611ada5781518083602001fd5b8060405162461bcd60e51b81526004016106a59190611e7b565b600060208284031215611b0657600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461157057600080fd5b6001600160a01b03811681146105b857600080fd5b600060208284031215611b5d57600080fd5b813561157081611b36565b600080600060408486031215611b7d57600080fd5b8335611b8881611b36565b9250602084013567ffffffffffffffff80821115611ba557600080fd5b818601915086601f830112611bb957600080fd5b813581811115611bc857600080fd5b876020828501011115611bda57600080fd5b6020830194508093505050509250925092565b60008060408385031215611c0057600080fd5b8235611c0b81611b36565b91506020830135611c1b81611b36565b809150509250929050565b60008060208385031215611c3957600080fd5b823567ffffffffffffffff80821115611c5157600080fd5b818501915085601f830112611c6557600080fd5b813581811115611c7457600080fd5b8660208260061b8501011115611c8957600080fd5b60209290920196919550909350505050565b602080825282518282018190526000919060409081850190868401855b82811015611cea57815180516001600160a01b0316855286015161ffff16868501529284019290850190600101611cb8565b5091979650505050505050565b805161ffff8116811461145c57600080fd5b600060408284031215611d1b57600080fd5b6040516040810181811067ffffffffffffffff82111715611d4c57634e487b7160e01b600052604160045260246000fd5b6040528251611d5a81611b36565b8152611d6860208401611cf7565b60208201529392505050565b600060208284031215611d8657600080fd5b61157082611cf7565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b600060208284031215611dcd57600080fd5b5051919050565b600060208284031215611de657600080fd5b8151801515811461157057600080fd5b60006000198203611e1757634e487b7160e01b600052601160045260246000fd5b5060010190565b600060208284031215611e3057600080fd5b815161157081611b36565b60005b83811015611e56578181015183820152602001611e3e565b50506000910152565b60008251611e71818460208701611e3b565b9190910192915050565b6020815260008251806020840152611e9a816040850160208701611e3b565b601f01601f1916919091016040019291505056fea2646970667358221220e0a6d5b5165e5a2ce9111658444a4f8e39022faa7c3f91cbe6ae0a9f3ef50e1164736f6c63430008120033", "devdoc": { "author": "The Sandbox", "events": { @@ -322,7 +341,15 @@ "details": "can only be run once.", "params": { "recipient": "the wallet of the creator when the contract is deployed", - "royaltyManager": "the address of the royalty manager contract." + "royaltyManager": "the address of the royalty manager contract" + } + }, + "isTrustedForwarder(address)": { + "params": { + "forwarder": "trusted forwarder address to check" + }, + "returns": { + "_0": "true if the address is the same as the trusted forwarder" } }, "owner()": { @@ -369,6 +396,9 @@ "initialize(address,address)": { "notice": "initialize the contract" }, + "isTrustedForwarder(address)": { + "notice": "return true if the forwarder is the trusted forwarder" + }, "proxyCall(address,bytes)": { "notice": "made for unexpected scenarios when assets are sent to this contact such that they could be recovered." }, @@ -388,7 +418,7 @@ "storageLayout": { "storage": [ { - "astId": 803, + "astId": 746, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol:RoyaltySplitter", "label": "_initialized", "offset": 0, @@ -396,7 +426,7 @@ "type": "t_uint8" }, { - "astId": 806, + "astId": 749, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol:RoyaltySplitter", "label": "_initializing", "offset": 1, @@ -404,7 +434,7 @@ "type": "t_bool" }, { - "astId": 3357, + "astId": 3300, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol:RoyaltySplitter", "label": "__gap", "offset": 0, @@ -412,7 +442,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 656, + "astId": 574, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol:RoyaltySplitter", "label": "_owner", "offset": 0, @@ -420,7 +450,7 @@ "type": "t_address" }, { - "astId": 776, + "astId": 694, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol:RoyaltySplitter", "label": "__gap", "offset": 0, @@ -428,7 +458,7 @@ "type": "t_array(t_uint256)49_storage" }, { - "astId": 3630, + "astId": 4223, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol:RoyaltySplitter", "label": "__gap", "offset": 0, @@ -436,7 +466,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 9373, + "astId": 14233, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol:RoyaltySplitter", "label": "_recipient", "offset": 0, @@ -444,12 +474,12 @@ "type": "t_address_payable" }, { - "astId": 9376, + "astId": 14236, "contract": "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol:RoyaltySplitter", "label": "_royaltyManager", "offset": 0, "slot": "152", - "type": "t_contract(IRoyaltyManager)10163" + "type": "t_contract(IRoyaltyManager)15073" } ], "types": { @@ -480,7 +510,7 @@ "label": "bool", "numberOfBytes": "1" }, - "t_contract(IRoyaltyManager)10163": { + "t_contract(IRoyaltyManager)15073": { "encoding": "inplace", "label": "contract IRoyaltyManager", "numberOfBytes": "20" diff --git a/packages/deploy/deployments/mumbai/solcInputs/6f473f7e77d584cdbb9fe0c91f28e82a.json b/packages/deploy/deployments/mumbai/solcInputs/6f473f7e77d584cdbb9fe0c91f28e82a.json new file mode 100644 index 0000000000..3862116d29 --- /dev/null +++ b/packages/deploy/deployments/mumbai/solcInputs/6f473f7e77d584cdbb9fe0c91f28e82a.json @@ -0,0 +1,425 @@ +{ + "language": "Solidity", + "sources": { + "@manifoldxyz/libraries-solidity/contracts/access/IAdminControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface for admin control\n */\ninterface IAdminControl is IERC165 {\n\n event AdminApproved(address indexed account, address indexed sender);\n event AdminRevoked(address indexed account, address indexed sender);\n\n /**\n * @dev gets address of all admins\n */\n function getAdmins() external view returns (address[] memory);\n\n /**\n * @dev add an admin. Can only be called by contract owner.\n */\n function approveAdmin(address admin) external;\n\n /**\n * @dev remove an admin. Can only be called by contract owner.\n */\n function revokeAdmin(address admin) external;\n\n /**\n * @dev checks whether or not given address is an admin\n * Returns True if they are\n */\n function isAdmin(address admin) external view returns (bool);\n\n}" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/FallbackRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { Recipient } from \"./overrides/IRoyaltySplitter.sol\";\nimport { Ownable2Step } from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\nimport { IFallbackRegistry } from \"./overrides/IFallbackRegistry.sol\";\n\ncontract FallbackRegistry is IFallbackRegistry, Ownable2Step {\n struct TokenFallback {\n address tokenAddress;\n Recipient[] recipients;\n }\n\n mapping(address => Recipient[]) fallbacks;\n\n constructor(address initialOwner) {\n _transferOwnership(initialOwner);\n }\n\n function setFallback(address tokenAddress, Recipient[] calldata _recipients) public onlyOwner {\n Recipient[] storage recipients = fallbacks[tokenAddress];\n uint256 recipientsLength = _recipients.length;\n ///@solidity memory-safe-assembly\n assembly {\n // overwrite length directly rather than deleting and then updating it each time we push new values\n // this means if the new array is shorter than the old ones, those slots will stay dirty, but they\n // should not be able to be accessed due to the new length\n sstore(recipients.slot, recipientsLength)\n }\n for (uint256 i; i < recipientsLength;) {\n recipients[i] = _recipients[i];\n unchecked {\n ++i;\n }\n }\n }\n\n function setFallbacks(TokenFallback[] calldata bundle) external onlyOwner {\n uint256 bundleLength = bundle.length;\n for (uint256 i = 0; i < bundleLength;) {\n TokenFallback calldata tokenFallback = bundle[i];\n setFallback(tokenFallback.tokenAddress, tokenFallback.recipients);\n unchecked {\n ++i;\n }\n }\n }\n\n function getRecipients(address tokenAddress) external view returns (Recipient[] memory) {\n return fallbacks[tokenAddress];\n }\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/IRoyaltyEngineV1.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Lookup engine interface\n */\ninterface IRoyaltyEngineV1 is IERC165 {\n /**\n * Get the royalty for a given token (address, id) and value amount. Does not cache the bps/amounts. Caches the spec for a given token address\n *\n * @param tokenAddress - The address of the token\n * @param tokenId - The id of the token\n * @param value - The value you wish to get the royalty of\n *\n * returns Two arrays of equal length, royalty recipients and the corresponding amount each recipient should get\n */\n function getRoyalty(address tokenAddress, uint256 tokenId, uint256 value)\n external\n returns (address payable[] memory recipients, uint256[] memory amounts);\n\n /**\n * View only version of getRoyalty\n *\n * @param tokenAddress - The address of the token\n * @param tokenId - The id of the token\n * @param value - The value you wish to get the royalty of\n *\n * returns Two arrays of equal length, royalty recipients and the corresponding amount each recipient should get\n */\n function getRoyaltyView(address tokenAddress, uint256 tokenId, uint256 value)\n external\n view\n returns (address payable[] memory recipients, uint256[] memory amounts);\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/IRoyaltyRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Royalty registry interface\n */\ninterface IRoyaltyRegistry is IERC165 {\n event RoyaltyOverride(address owner, address tokenAddress, address royaltyAddress);\n\n /**\n * Override the location of where to look up royalty information for a given token contract.\n * Allows for backwards compatibility and implementation of royalty logic for contracts that did not previously support them.\n *\n * @param tokenAddress - The token address you wish to override\n * @param royaltyAddress - The royalty override address\n */\n function setRoyaltyLookupAddress(address tokenAddress, address royaltyAddress) external returns (bool);\n\n /**\n * Returns royalty address location. Returns the tokenAddress by default, or the override if it exists\n *\n * @param tokenAddress - The token address you are looking up the royalty for\n */\n function getRoyaltyLookupAddress(address tokenAddress) external view returns (address);\n\n /**\n * Returns the token address that an overrideAddress is set for.\n * Note: will not be accurate if the override was created before this function was added.\n *\n * @param overrideAddress - The override address you are looking up the token for\n */\n function getOverrideLookupTokenAddress(address overrideAddress) external view returns (address);\n\n /**\n * Whether or not the message sender can override the royalty address for the given token address\n *\n * @param tokenAddress - The token address you are looking up the royalty for\n */\n function overrideAllowed(address tokenAddress) external view returns (bool);\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/libraries/BytesLibrary.sol": { + "content": "// SPDX-License-Identifier: MIT OR Apache-2.0\n\npragma solidity ^0.8.0;\n\n/**\n * @notice A library for manipulation of byte arrays.\n */\nlibrary BytesLibrary {\n /**\n * @dev Replace the address at the given location in a byte array if the contents at that location\n * match the expected address.\n */\n function replaceAtIf(bytes memory data, uint256 startLocation, address expectedAddress, address newAddress)\n internal\n pure\n {\n bytes memory expectedData = abi.encodePacked(expectedAddress);\n bytes memory newData = abi.encodePacked(newAddress);\n // An address is 20 bytes long\n for (uint256 i = 0; i < 20; i++) {\n uint256 dataLocation = startLocation + i;\n require(data[dataLocation] == expectedData[i], \"Bytes: Data provided does not include the expectedAddress\");\n data[dataLocation] = newData[i];\n }\n }\n\n /**\n * @dev Checks if the call data starts with the given function signature.\n */\n function startsWith(bytes memory callData, bytes4 functionSig) internal pure returns (bool) {\n // A signature is 4 bytes long\n if (callData.length < 4) {\n return false;\n }\n for (uint256 i = 0; i < 4; i++) {\n if (callData[i] != functionSig[i]) {\n return false;\n }\n }\n\n return true;\n }\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/libraries/SuperRareContracts.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nlibrary SuperRareContracts {\n address public constant SUPERRARE_REGISTRY = 0x17B0C8564E53f22364A6C8de6F7ca5CE9BEa4e5D;\n address public constant SUPERRARE_V1 = 0x41A322b28D0fF354040e2CbC676F0320d8c8850d;\n address public constant SUPERRARE_V2 = 0xb932a70A57673d89f4acfFBE830E8ed7f75Fb9e0;\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/overrides/IFallbackRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { Recipient } from \"./IRoyaltySplitter.sol\";\n\ninterface IFallbackRegistry {\n /**\n * @dev Get total recipients for token fees. Note that recipient bps is of gross amount, not share of fee amount,\n * ie, recipients' BPS will not sum to 10_000, but to the total fee BPS for an order.\n */\n function getRecipients(address tokenAddress) external view returns (Recipient[] memory);\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\nstruct Recipient {\n address payable recipient;\n uint16 bps;\n}\n\ninterface IRoyaltySplitter is IERC165 {\n /**\n * @dev Set the splitter recipients. Total bps must total 10000.\n */\n function setRecipients(Recipient[] calldata recipients) external;\n\n /**\n * @dev Get the splitter recipients;\n */\n function getRecipients() external view returns (Recipient[] memory);\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/RoyaltyEngineV1.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport { ERC165, IERC165 } from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport { ERC165Checker } from \"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol\";\nimport { OwnableUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport { AddressUpgradeable } from \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\n\nimport { SuperRareContracts } from \"./libraries/SuperRareContracts.sol\";\n\nimport { IManifold } from \"./specs/IManifold.sol\";\nimport { IRaribleV1, IRaribleV2 } from \"./specs/IRarible.sol\";\nimport { IFoundation } from \"./specs/IFoundation.sol\";\nimport { ISuperRareRegistry } from \"./specs/ISuperRare.sol\";\nimport { IEIP2981 } from \"./specs/IEIP2981.sol\";\nimport { IZoraOverride } from \"./specs/IZoraOverride.sol\";\nimport { IArtBlocksOverride } from \"./specs/IArtBlocksOverride.sol\";\nimport { IKODAV2Override } from \"./specs/IKODAV2Override.sol\";\nimport { IRoyaltyEngineV1 } from \"./IRoyaltyEngineV1.sol\";\nimport { IRoyaltyRegistry } from \"./IRoyaltyRegistry.sol\";\nimport { IRoyaltySplitter, Recipient } from \"./overrides/IRoyaltySplitter.sol\";\nimport { IFallbackRegistry } from \"./overrides/IFallbackRegistry.sol\";\n/**\n * @dev Engine to lookup royalty configurations\n */\n\ncontract RoyaltyEngineV1 is ERC165, OwnableUpgradeable, IRoyaltyEngineV1 {\n using AddressUpgradeable for address;\n\n // Use int16 for specs to support future spec additions\n // When we add a spec, we also decrement the NONE value\n // Anything > NONE and <= NOT_CONFIGURED is considered not configured\n int16 private constant NONE = -1;\n int16 private constant NOT_CONFIGURED = 0;\n int16 private constant MANIFOLD = 1;\n int16 private constant RARIBLEV1 = 2;\n int16 private constant RARIBLEV2 = 3;\n int16 private constant FOUNDATION = 4;\n int16 private constant EIP2981 = 5;\n int16 private constant SUPERRARE = 6;\n int16 private constant ZORA = 7;\n int16 private constant ARTBLOCKS = 8;\n int16 private constant KNOWNORIGINV2 = 9;\n int16 private constant ROYALTY_SPLITTER = 10;\n int16 private constant FALLBACK = type(int16).max;\n\n mapping(address => int16) _specCache;\n\n address public royaltyRegistry;\n IFallbackRegistry public immutable FALLBACK_REGISTRY;\n\n constructor(address fallbackRegistry) {\n FALLBACK_REGISTRY = IFallbackRegistry(fallbackRegistry);\n }\n\n function initialize(address _initialOwner, address royaltyRegistry_) public initializer {\n _transferOwnership(_initialOwner);\n require(ERC165Checker.supportsInterface(royaltyRegistry_, type(IRoyaltyRegistry).interfaceId));\n royaltyRegistry = royaltyRegistry_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override (ERC165, IERC165) returns (bool) {\n return interfaceId == type(IRoyaltyEngineV1).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Invalidate the cached spec (useful for situations where tooken royalty implementation changes to a different spec)\n */\n function invalidateCachedRoyaltySpec(address tokenAddress) public {\n address royaltyAddress = IRoyaltyRegistry(royaltyRegistry).getRoyaltyLookupAddress(tokenAddress);\n delete _specCache[royaltyAddress];\n }\n\n /**\n * @dev View function to get the cached spec of a token\n */\n function getCachedRoyaltySpec(address tokenAddress) public view returns (int16) {\n address royaltyAddress = IRoyaltyRegistry(royaltyRegistry).getRoyaltyLookupAddress(tokenAddress);\n return _specCache[royaltyAddress];\n }\n\n /**\n * @dev See {IRoyaltyEngineV1-getRoyalty}\n */\n function getRoyalty(address tokenAddress, uint256 tokenId, uint256 value)\n public\n override\n returns (address payable[] memory recipients, uint256[] memory amounts)\n {\n // External call to limit gas\n try this._getRoyaltyAndSpec{gas: 100000}(tokenAddress, tokenId, value) returns (\n address payable[] memory _recipients,\n uint256[] memory _amounts,\n int16 spec,\n address royaltyAddress,\n bool addToCache\n ) {\n if (addToCache) _specCache[royaltyAddress] = spec;\n return (_recipients, _amounts);\n } catch {\n revert(\"Invalid royalty amount\");\n }\n }\n\n /**\n * @dev See {IRoyaltyEngineV1-getRoyaltyView}.\n */\n function getRoyaltyView(address tokenAddress, uint256 tokenId, uint256 value)\n public\n view\n override\n returns (address payable[] memory recipients, uint256[] memory amounts)\n {\n // External call to limit gas\n try this._getRoyaltyAndSpec{gas: 100000}(tokenAddress, tokenId, value) returns (\n address payable[] memory _recipients, uint256[] memory _amounts, int16, address, bool\n ) {\n return (_recipients, _amounts);\n } catch {\n revert(\"Invalid royalty amount\");\n }\n }\n\n /**\n * @dev Get the royalty and royalty spec for a given token\n *\n * returns recipients array, amounts array, royalty spec, royalty address, whether or not to add to cache\n */\n function _getRoyaltyAndSpec(address tokenAddress, uint256 tokenId, uint256 value)\n external\n view\n returns (\n address payable[] memory recipients,\n uint256[] memory amounts,\n int16 spec,\n address royaltyAddress,\n bool addToCache\n )\n {\n require(msg.sender == address(this), \"Only Engine\");\n\n royaltyAddress = IRoyaltyRegistry(royaltyRegistry).getRoyaltyLookupAddress(tokenAddress);\n spec = _specCache[royaltyAddress];\n\n if (spec <= NOT_CONFIGURED && spec > NONE) {\n // No spec configured yet, so we need to detect the spec\n addToCache = true;\n\n // SuperRare handling\n if (tokenAddress == SuperRareContracts.SUPERRARE_V1 || tokenAddress == SuperRareContracts.SUPERRARE_V2) {\n try ISuperRareRegistry(SuperRareContracts.SUPERRARE_REGISTRY).tokenCreator(tokenAddress, tokenId)\n returns (address payable creator) {\n try ISuperRareRegistry(SuperRareContracts.SUPERRARE_REGISTRY).calculateRoyaltyFee(\n tokenAddress, tokenId, value\n ) returns (uint256 amount) {\n recipients = new address payable[](1);\n amounts = new uint256[](1);\n recipients[0] = creator;\n amounts[0] = amount;\n return (recipients, amounts, SUPERRARE, royaltyAddress, addToCache);\n } catch { }\n } catch { }\n }\n try IEIP2981(royaltyAddress).royaltyInfo(tokenId, value) returns (address recipient, uint256 amount) {\n require(amount < value, \"Invalid royalty amount\");\n uint32 recipientSize;\n assembly {\n recipientSize := extcodesize(recipient)\n }\n if (recipientSize > 0) {\n try IRoyaltySplitter(recipient).getRecipients() returns (Recipient[] memory splitRecipients) {\n recipients = new address payable[](splitRecipients.length);\n amounts = new uint256[](splitRecipients.length);\n uint256 sum = 0;\n uint256 splitRecipientsLength = splitRecipients.length;\n for (uint256 i = 0; i < splitRecipientsLength;) {\n Recipient memory splitRecipient = splitRecipients[i];\n recipients[i] = payable(splitRecipient.recipient);\n uint256 splitAmount = splitRecipient.bps * amount / 10000;\n amounts[i] = splitAmount;\n sum += splitAmount;\n unchecked {\n ++i;\n }\n }\n // sum can be less than amount, otherwise small-value listings can break\n require(sum <= amount, \"Invalid split\");\n\n return (recipients, amounts, ROYALTY_SPLITTER, royaltyAddress, addToCache);\n } catch { }\n }\n // Supports EIP2981. Return amounts\n recipients = new address payable[](1);\n amounts = new uint256[](1);\n recipients[0] = payable(recipient);\n amounts[0] = amount;\n return (recipients, amounts, EIP2981, royaltyAddress, addToCache);\n } catch { }\n try IManifold(royaltyAddress).getRoyalties(tokenId) returns (\n address payable[] memory recipients_, uint256[] memory bps\n ) {\n // Supports manifold interface. Compute amounts\n require(recipients_.length == bps.length);\n return (recipients_, _computeAmounts(value, bps), MANIFOLD, royaltyAddress, addToCache);\n } catch { }\n try IRaribleV2(royaltyAddress).getRaribleV2Royalties(tokenId) returns (IRaribleV2.Part[] memory royalties) {\n // Supports rarible v2 interface. Compute amounts\n recipients = new address payable[](royalties.length);\n amounts = new uint256[](royalties.length);\n uint256 totalAmount;\n for (uint256 i = 0; i < royalties.length; i++) {\n recipients[i] = royalties[i].account;\n amounts[i] = value * royalties[i].value / 10000;\n totalAmount += amounts[i];\n }\n require(totalAmount < value, \"Invalid royalty amount\");\n return (recipients, amounts, RARIBLEV2, royaltyAddress, addToCache);\n } catch { }\n try IRaribleV1(royaltyAddress).getFeeRecipients(tokenId) returns (address payable[] memory recipients_) {\n // Supports rarible v1 interface. Compute amounts\n recipients_ = IRaribleV1(royaltyAddress).getFeeRecipients(tokenId);\n try IRaribleV1(royaltyAddress).getFeeBps(tokenId) returns (uint256[] memory bps) {\n require(recipients_.length == bps.length);\n return (recipients_, _computeAmounts(value, bps), RARIBLEV1, royaltyAddress, addToCache);\n } catch { }\n } catch { }\n try IFoundation(royaltyAddress).getFees(tokenId) returns (\n address payable[] memory recipients_, uint256[] memory bps\n ) {\n // Supports foundation interface. Compute amounts\n require(recipients_.length == bps.length);\n return (recipients_, _computeAmounts(value, bps), FOUNDATION, royaltyAddress, addToCache);\n } catch { }\n try IZoraOverride(royaltyAddress).convertBidShares(tokenAddress, tokenId) returns (\n address payable[] memory recipients_, uint256[] memory bps\n ) {\n // Support Zora override\n require(recipients_.length == bps.length);\n return (recipients_, _computeAmounts(value, bps), ZORA, royaltyAddress, addToCache);\n } catch { }\n try IArtBlocksOverride(royaltyAddress).getRoyalties(tokenAddress, tokenId) returns (\n address payable[] memory recipients_, uint256[] memory bps\n ) {\n // Support Art Blocks override\n require(recipients_.length == bps.length);\n return (recipients_, _computeAmounts(value, bps), ARTBLOCKS, royaltyAddress, addToCache);\n } catch { }\n try IKODAV2Override(royaltyAddress).getKODAV2RoyaltyInfo(tokenAddress, tokenId, value) returns (\n address payable[] memory _recipients, uint256[] memory _amounts\n ) {\n // Support KODA V2 override\n require(_recipients.length == _amounts.length);\n return (_recipients, _amounts, KNOWNORIGINV2, royaltyAddress, addToCache);\n } catch { }\n\n try FALLBACK_REGISTRY.getRecipients(tokenAddress) returns (Recipient[] memory _recipients) {\n uint256 recipientsLength = _recipients.length;\n if (recipientsLength > 0) {\n return _calculateFallback(_recipients, recipientsLength, value, royaltyAddress, addToCache);\n }\n } catch { }\n\n // No supported royalties configured\n return (recipients, amounts, NONE, royaltyAddress, addToCache);\n } else {\n // Spec exists, just execute the appropriate one\n addToCache = false;\n if (spec == NONE) {\n return (recipients, amounts, spec, royaltyAddress, addToCache);\n } else if (spec == FALLBACK) {\n Recipient[] memory _recipients = FALLBACK_REGISTRY.getRecipients(tokenAddress);\n return _calculateFallback(_recipients, _recipients.length, value, royaltyAddress, addToCache);\n } else if (spec == MANIFOLD) {\n // Manifold spec\n uint256[] memory bps;\n (recipients, bps) = IManifold(royaltyAddress).getRoyalties(tokenId);\n require(recipients.length == bps.length);\n return (recipients, _computeAmounts(value, bps), spec, royaltyAddress, addToCache);\n } else if (spec == RARIBLEV2) {\n // Rarible v2 spec\n IRaribleV2.Part[] memory royalties;\n royalties = IRaribleV2(royaltyAddress).getRaribleV2Royalties(tokenId);\n recipients = new address payable[](royalties.length);\n amounts = new uint256[](royalties.length);\n uint256 totalAmount;\n for (uint256 i = 0; i < royalties.length; i++) {\n recipients[i] = royalties[i].account;\n amounts[i] = value * royalties[i].value / 10000;\n totalAmount += amounts[i];\n }\n require(totalAmount < value, \"Invalid royalty amount\");\n return (recipients, amounts, spec, royaltyAddress, addToCache);\n } else if (spec == RARIBLEV1) {\n // Rarible v1 spec\n uint256[] memory bps;\n recipients = IRaribleV1(royaltyAddress).getFeeRecipients(tokenId);\n bps = IRaribleV1(royaltyAddress).getFeeBps(tokenId);\n require(recipients.length == bps.length);\n return (recipients, _computeAmounts(value, bps), spec, royaltyAddress, addToCache);\n } else if (spec == FOUNDATION) {\n // Foundation spec\n uint256[] memory bps;\n (recipients, bps) = IFoundation(royaltyAddress).getFees(tokenId);\n require(recipients.length == bps.length);\n return (recipients, _computeAmounts(value, bps), spec, royaltyAddress, addToCache);\n } else if (spec == EIP2981 || spec == ROYALTY_SPLITTER) {\n // EIP2981 spec\n (address recipient, uint256 amount) = IEIP2981(royaltyAddress).royaltyInfo(tokenId, value);\n require(amount < value, \"Invalid royalty amount\");\n if (spec == ROYALTY_SPLITTER) {\n Recipient[] memory splitRecipients = IRoyaltySplitter(recipient).getRecipients();\n recipients = new address payable[](splitRecipients.length);\n amounts = new uint256[](splitRecipients.length);\n uint256 sum = 0;\n uint256 splitRecipientsLength = splitRecipients.length;\n for (uint256 i = 0; i < splitRecipientsLength;) {\n Recipient memory splitRecipient = splitRecipients[i];\n recipients[i] = payable(splitRecipient.recipient);\n uint256 splitAmount = splitRecipient.bps * amount / 10000;\n amounts[i] = splitAmount;\n sum += splitAmount;\n unchecked {\n ++i;\n }\n }\n // sum can be less than amount, otherwise small-value listings can break\n require(sum <= value, \"Invalid split\");\n\n return (recipients, amounts, spec, royaltyAddress, addToCache);\n }\n recipients = new address payable[](1);\n amounts = new uint256[](1);\n recipients[0] = payable(recipient);\n amounts[0] = amount;\n return (recipients, amounts, spec, royaltyAddress, addToCache);\n } else if (spec == SUPERRARE) {\n // SUPERRARE spec\n address payable creator =\n ISuperRareRegistry(SuperRareContracts.SUPERRARE_REGISTRY).tokenCreator(tokenAddress, tokenId);\n uint256 amount = ISuperRareRegistry(SuperRareContracts.SUPERRARE_REGISTRY).calculateRoyaltyFee(\n tokenAddress, tokenId, value\n );\n recipients = new address payable[](1);\n amounts = new uint256[](1);\n recipients[0] = creator;\n amounts[0] = amount;\n return (recipients, amounts, spec, royaltyAddress, addToCache);\n } else if (spec == ZORA) {\n // Zora spec\n uint256[] memory bps;\n (recipients, bps) = IZoraOverride(royaltyAddress).convertBidShares(tokenAddress, tokenId);\n require(recipients.length == bps.length);\n return (recipients, _computeAmounts(value, bps), spec, royaltyAddress, addToCache);\n } else if (spec == ARTBLOCKS) {\n // Art Blocks spec\n uint256[] memory bps;\n (recipients, bps) = IArtBlocksOverride(royaltyAddress).getRoyalties(tokenAddress, tokenId);\n require(recipients.length == bps.length);\n return (recipients, _computeAmounts(value, bps), spec, royaltyAddress, addToCache);\n } else if (spec == KNOWNORIGINV2) {\n // KnownOrigin.io V2 spec (V3 falls under EIP2981)\n (recipients, amounts) =\n IKODAV2Override(royaltyAddress).getKODAV2RoyaltyInfo(tokenAddress, tokenId, value);\n require(recipients.length == amounts.length);\n return (recipients, amounts, spec, royaltyAddress, addToCache);\n }\n }\n }\n\n function _calculateFallback(\n Recipient[] memory _recipients,\n uint256 recipientsLength,\n uint256 value,\n address royaltyAddress,\n bool addToCache\n )\n internal\n pure\n returns (\n address payable[] memory recipients,\n uint256[] memory amounts,\n int16 spec,\n address _royaltyAddress,\n bool _addToCache\n )\n {\n recipients = new address payable[](recipientsLength);\n amounts = new uint256[](recipientsLength);\n uint256 totalAmount;\n for (uint256 i = 0; i < recipientsLength;) {\n Recipient memory recipient = _recipients[i];\n recipients[i] = payable(recipient.recipient);\n uint256 amount = value * recipient.bps / 10_000;\n amounts[i] = amount;\n totalAmount += amount;\n unchecked {\n ++i;\n }\n }\n require(totalAmount < value, \"Invalid royalty amount\");\n return (recipients, amounts, FALLBACK, royaltyAddress, addToCache);\n }\n\n /**\n * Compute royalty amounts\n */\n function _computeAmounts(uint256 value, uint256[] memory bps) private pure returns (uint256[] memory amounts) {\n amounts = new uint256[](bps.length);\n uint256 totalAmount;\n for (uint256 i = 0; i < bps.length; i++) {\n amounts[i] = value * bps[i] / 10000;\n totalAmount += amounts[i];\n }\n require(totalAmount < value, \"Invalid royalty amount\");\n return amounts;\n }\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/RoyaltyRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\"; \nimport \"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport \"@manifoldxyz/libraries-solidity/contracts/access/IAdminControl.sol\";\n\nimport \"./IRoyaltyRegistry.sol\";\nimport \"./specs/INiftyGateway.sol\";\nimport \"./specs/IFoundation.sol\";\nimport \"./specs/IDigitalax.sol\";\nimport \"./specs/IArtBlocks.sol\";\n\n/**\n * @dev Registry to lookup royalty configurations\n */\ncontract RoyaltyRegistry is ERC165, OwnableUpgradeable, IRoyaltyRegistry {\n using AddressUpgradeable for address;\n\n address public immutable OVERRIDE_FACTORY;\n\n /**\n * @notice Constructor arg allows efficient lookup of override factory for single-tx overrides.\n * However, this means the RoyaltyRegistry will need to be upgraded if the override factory is changed.\n */\n constructor(address overrideFactory) {\n OVERRIDE_FACTORY = overrideFactory;\n }\n\n // Override addresses\n mapping(address => address) private _overrides;\n mapping(address => address) private _overrideLookupToTokenContract;\n\n function initialize(address _initialOwner) public initializer {\n _transferOwnership(_initialOwner);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override (ERC165, IERC165) returns (bool) {\n return interfaceId == type(IRoyaltyRegistry).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IRegistry-getRoyaltyLookupAddress}.\n */\n function getRoyaltyLookupAddress(address tokenAddress) external view override returns (address) {\n address override_ = _overrides[tokenAddress];\n if (override_ != address(0)) {\n return override_;\n }\n return tokenAddress;\n }\n\n /**\n * @dev See {IRegistry-getOverrideTokenAddress}.\n */\n function getOverrideLookupTokenAddress(address overrideAddress) external view override returns (address) {\n return _overrideLookupToTokenContract[overrideAddress];\n }\n\n /**\n * @dev See {IRegistry-setRoyaltyLookupAddress}.\n */\n function setRoyaltyLookupAddress(address tokenAddress, address royaltyLookupAddress)\n public\n override\n returns (bool)\n {\n require(\n tokenAddress.isContract() && (royaltyLookupAddress.isContract() || royaltyLookupAddress == address(0)),\n \"Invalid input\"\n );\n require(overrideAllowed(tokenAddress), \"Permission denied\");\n // look up existing override, if any\n address existingOverride = _overrides[tokenAddress];\n if (existingOverride != address(0)) {\n // delete existing override reverse-lookup\n _overrideLookupToTokenContract[existingOverride] = address(0);\n }\n _overrideLookupToTokenContract[royaltyLookupAddress] = tokenAddress;\n // set new override and reverse-lookup\n _overrides[tokenAddress] = royaltyLookupAddress;\n\n emit RoyaltyOverride(_msgSender(), tokenAddress, royaltyLookupAddress);\n return true;\n }\n\n /**\n * @dev See {IRegistry-overrideAllowed}.\n */\n function overrideAllowed(address tokenAddress) public view override returns (bool) {\n if (owner() == _msgSender()) return true;\n\n if (\n ERC165Checker.supportsInterface(tokenAddress, type(IAdminControl).interfaceId)\n && IAdminControl(tokenAddress).isAdmin(_msgSender())\n ) {\n return true;\n }\n\n try OwnableUpgradeable(tokenAddress).owner() returns (address owner) {\n if (owner == _msgSender()) return true;\n\n if (owner.isContract()) {\n try OwnableUpgradeable(owner).owner() returns (address passThroughOwner) {\n if (passThroughOwner == _msgSender()) return true;\n } catch { }\n }\n } catch { }\n\n try IAccessControlUpgradeable(tokenAddress).hasRole(0x00, _msgSender()) returns (bool hasRole) {\n if (hasRole) return true;\n } catch { }\n\n // Nifty Gateway overrides\n try INiftyBuilderInstance(tokenAddress).niftyRegistryContract() returns (address niftyRegistry) {\n try INiftyRegistry(niftyRegistry).isValidNiftySender(_msgSender()) returns (bool valid) {\n return valid;\n } catch { }\n } catch { }\n\n // OpenSea overrides\n // Tokens already support Ownable\n\n // Foundation overrides\n try IFoundationTreasuryNode(tokenAddress).getFoundationTreasury() returns (address payable foundationTreasury) {\n try IFoundationTreasury(foundationTreasury).isAdmin(_msgSender()) returns (bool isAdmin) {\n return isAdmin;\n } catch { }\n } catch { }\n\n // DIGITALAX overrides\n try IDigitalax(tokenAddress).accessControls() returns (address externalAccessControls) {\n try IDigitalaxAccessControls(externalAccessControls).hasAdminRole(_msgSender()) returns (bool hasRole) {\n if (hasRole) return true;\n } catch { }\n } catch { }\n\n // Art Blocks overrides\n try IArtBlocks(tokenAddress).admin() returns (address admin) {\n if (admin == _msgSender()) return true;\n } catch { }\n\n // Superrare overrides\n // Tokens and registry already support Ownable\n\n // Rarible overrides\n // Tokens already support Ownable\n\n return false;\n }\n\n function _msgSender() internal view virtual override (ContextUpgradeable) returns (address) {\n if (msg.sender == OVERRIDE_FACTORY) {\n address relayedSender;\n ///@solidity memory-safe-assembly\n assembly {\n // the factory appends the original msg.sender as last the word of calldata, which we can read using\n // calldataload\n relayedSender := calldataload(sub(calldatasize(), 0x20))\n }\n return relayedSender;\n }\n // otherwise return msg.sender as normal\n return msg.sender;\n }\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/specs/IArtBlocks.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Art Blocks nfts\n */\ninterface IArtBlocks {\n // document getter function of public variable\n function admin() external view returns (address);\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/specs/IArtBlocksOverride.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * Interface for an Art Blocks override\n */\ninterface IArtBlocksOverride {\n /**\n * @dev Get royalites of a token at a given tokenAddress.\n * Returns array of receivers and basisPoints.\n *\n * bytes4(keccak256('getRoyalties(address,uint256)')) == 0x9ca7dc7a\n *\n * => 0x9ca7dc7a = 0x9ca7dc7a\n */\n function getRoyalties(address tokenAddress, uint256 tokenId)\n external\n view\n returns (address payable[] memory, uint256[] memory);\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/specs/IDigitalax.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Digitalax nfts\n */\ninterface IDigitalax {\n function accessControls() external view returns (address);\n}\n\n/**\n * @dev Digitalax Access Controls Simple\n */\ninterface IDigitalaxAccessControls {\n function hasAdminRole(address _account) external view returns (bool);\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/specs/IEIP2981.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * EIP-2981\n */\ninterface IEIP2981 {\n /**\n * bytes4(keccak256(\"royaltyInfo(uint256,uint256)\")) == 0x2a55205a\n *\n * => 0x2a55205a = 0x2a55205a\n */\n function royaltyInfo(uint256 tokenId, uint256 value) external view returns (address, uint256);\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/specs/IFoundation.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFoundation {\n /*\n * bytes4(keccak256('getFees(uint256)')) == 0xd5a06d4c\n *\n * => 0xd5a06d4c = 0xd5a06d4c\n */\n function getFees(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);\n}\n\ninterface IFoundationTreasuryNode {\n function getFoundationTreasury() external view returns (address payable);\n}\n\ninterface IFoundationTreasury {\n function isAdmin(address account) external view returns (bool);\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/specs/IKODAV2Override.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n/// @author: knownorigin.io\n\npragma solidity ^0.8.0;\n\ninterface IKODAV2 {\n function editionOfTokenId(uint256 _tokenId) external view returns (uint256 _editionNumber);\n\n function artistCommission(uint256 _editionNumber)\n external\n view\n returns (address _artistAccount, uint256 _artistCommission);\n\n function editionOptionalCommission(uint256 _editionNumber)\n external\n view\n returns (uint256 _rate, address _recipient);\n}\n\ninterface IKODAV2Override {\n /// @notice Emitted when the royalties fee changes\n event CreatorRoyaltiesFeeUpdated(uint256 _oldCreatorRoyaltiesFee, uint256 _newCreatorRoyaltiesFee);\n\n /// @notice For the given KO NFT and token ID, return the addresses and the amounts to pay\n function getKODAV2RoyaltyInfo(address _tokenAddress, uint256 _id, uint256 _amount)\n external\n view\n returns (address payable[] memory, uint256[] memory);\n\n /// @notice Allows the owner() to update the creator royalties\n function updateCreatorRoyalties(uint256 _creatorRoyaltiesFee) external;\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/specs/IManifold.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\n/**\n * @dev Royalty interface for creator core classes\n */\ninterface IManifold {\n /**\n * @dev Get royalites of a token. Returns list of receivers and basisPoints\n *\n * bytes4(keccak256('getRoyalties(uint256)')) == 0xbb3bafd6\n *\n * => 0xbb3bafd6 = 0xbb3bafd6\n */\n function getRoyalties(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/specs/INiftyGateway.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Nifty builder instance\n */\ninterface INiftyBuilderInstance {\n function niftyRegistryContract() external view returns (address);\n}\n\n/**\n * @dev Nifty registry\n */\ninterface INiftyRegistry {\n /**\n * @dev function to see if sending key is valid\n */\n function isValidNiftySender(address sending_key) external view returns (bool);\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/specs/IRarible.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IRaribleV1 {\n /*\n * bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f\n * bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb\n *\n * => 0x0ebd4c7f ^ 0xb9c4d9fb == 0xb7799584\n */\n function getFeeBps(uint256 id) external view returns (uint256[] memory);\n function getFeeRecipients(uint256 id) external view returns (address payable[] memory);\n}\n\ninterface IRaribleV2 {\n /*\n * bytes4(keccak256('getRaribleV2Royalties(uint256)')) == 0xcad96cca\n */\n struct Part {\n address payable account;\n uint96 value;\n }\n\n function getRaribleV2Royalties(uint256 id) external view returns (Part[] memory);\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/specs/ISuperRare.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface ISuperRareRegistry {\n /**\n * @dev Get the royalty fee percentage for a specific ERC721 contract.\n * @param _contractAddress address ERC721Contract address.\n * @param _tokenId uint256 token ID.\n * @return uint8 wei royalty fee.\n */\n function getERC721TokenRoyaltyPercentage(address _contractAddress, uint256 _tokenId)\n external\n view\n returns (uint8);\n\n /**\n * @dev Utililty function to calculate the royalty fee for a token.\n * @param _contractAddress address ERC721Contract address.\n * @param _tokenId uint256 token ID.\n * @param _amount uint256 wei amount.\n * @return uint256 wei fee.\n */\n function calculateRoyaltyFee(address _contractAddress, uint256 _tokenId, uint256 _amount)\n external\n view\n returns (uint256);\n\n /**\n * @dev Get the token creator which will receive royalties of the given token\n * @param _contractAddress address ERC721Contract address.\n * @param _tokenId uint256 token ID.\n */\n function tokenCreator(address _contractAddress, uint256 _tokenId) external view returns (address payable);\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/specs/IZoraOverride.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * Paired down version of the Zora Market interface\n */\ninterface IZoraMarket {\n struct ZoraDecimal {\n uint256 value;\n }\n\n struct ZoraBidShares {\n // % of sale value that goes to the _previous_ owner of the nft\n ZoraDecimal prevOwner;\n // % of sale value that goes to the original creator of the nft\n ZoraDecimal creator;\n // % of sale value that goes to the seller (current owner) of the nft\n ZoraDecimal owner;\n }\n\n function bidSharesForToken(uint256 tokenId) external view returns (ZoraBidShares memory);\n}\n\n/**\n * Paired down version of the Zora Media interface\n */\ninterface IZoraMedia {\n /**\n * Auto-generated accessors of public variables\n */\n function marketContract() external view returns (address);\n function previousTokenOwners(uint256 tokenId) external view returns (address);\n function tokenCreators(uint256 tokenId) external view returns (address);\n\n /**\n * ERC721 function\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n}\n\n/**\n * Interface for a Zora media override\n */\ninterface IZoraOverride {\n /**\n * @dev Convert bid share configuration of a Zora Media token into an array of receivers and bps values\n * Does not support prevOwner and sell-on amounts as that is specific to Zora marketplace implementation\n * and requires updates on the Zora Media and Marketplace to update the sell-on amounts/previous owner values.\n * An off-Zora marketplace sale will break the sell-on functionality.\n */\n function convertBidShares(address media, uint256 tokenId)\n external\n view\n returns (address payable[] memory, uint256[] memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n function __AccessControl_init() internal onlyInitializing {\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\n }\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(account),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC1155/IERC1155Upgradeable.sol\";\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Interface for the NFT Royalty Standard.\n *\n * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal\n * support for royalty payments across all NFT marketplaces and ecosystem participants.\n *\n * _Available since v4.5._\n */\ninterface IERC2981Upgradeable is IERC165Upgradeable {\n /**\n * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\n * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.\n */\n function royaltyInfo(\n uint256 tokenId,\n uint256 salePrice\n ) external view returns (address receiver, uint256 royaltyAmount);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC5267Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\n\npragma solidity ^0.8.0;\n\ninterface IERC5267Upgradeable {\n /**\n * @dev MAY be emitted to signal that the domain could have changed.\n */\n event EIP712DomainChanged();\n\n /**\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n * signature.\n */\n function eip712Domain()\n external\n view\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n );\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/common/ERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/IERC2981Upgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.\n *\n * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for\n * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.\n *\n * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the\n * fee is specified in basis points by default.\n *\n * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See\n * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to\n * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.\n *\n * _Available since v4.5._\n */\nabstract contract ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable {\n function __ERC2981_init() internal onlyInitializing {\n }\n\n function __ERC2981_init_unchained() internal onlyInitializing {\n }\n struct RoyaltyInfo {\n address receiver;\n uint96 royaltyFraction;\n }\n\n RoyaltyInfo private _defaultRoyaltyInfo;\n mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC165Upgradeable) returns (bool) {\n return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @inheritdoc IERC2981Upgradeable\n */\n function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual override returns (address, uint256) {\n RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId];\n\n if (royalty.receiver == address(0)) {\n royalty = _defaultRoyaltyInfo;\n }\n\n uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator();\n\n return (royalty.receiver, royaltyAmount);\n }\n\n /**\n * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a\n * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an\n * override.\n */\n function _feeDenominator() internal pure virtual returns (uint96) {\n return 10000;\n }\n\n /**\n * @dev Sets the royalty information that all ids in this contract will default to.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator.\n */\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\n require(feeNumerator <= _feeDenominator(), \"ERC2981: royalty fee will exceed salePrice\");\n require(receiver != address(0), \"ERC2981: invalid receiver\");\n\n _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);\n }\n\n /**\n * @dev Removes default royalty information.\n */\n function _deleteDefaultRoyalty() internal virtual {\n delete _defaultRoyaltyInfo;\n }\n\n /**\n * @dev Sets the royalty information for a specific token id, overriding the global default.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator.\n */\n function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {\n require(feeNumerator <= _feeDenominator(), \"ERC2981: royalty fee will exceed salePrice\");\n require(receiver != address(0), \"ERC2981: Invalid parameters\");\n\n _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);\n }\n\n /**\n * @dev Resets royalty information for the token id back to the global default.\n */\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\n delete _tokenRoyaltyInfo[tokenId];\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[48] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC1155Upgradeable.sol\";\nimport \"./IERC1155ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC1155MetadataURIUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the basic standard multi-token.\n * See https://eips.ethereum.org/EIPS/eip-1155\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\n *\n * _Available since v3.1._\n */\ncontract ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155Upgradeable, IERC1155MetadataURIUpgradeable {\n using AddressUpgradeable for address;\n\n // Mapping from token ID to account balances\n mapping(uint256 => mapping(address => uint256)) private _balances;\n\n // Mapping from account to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json\n string private _uri;\n\n /**\n * @dev See {_setURI}.\n */\n function __ERC1155_init(string memory uri_) internal onlyInitializing {\n __ERC1155_init_unchained(uri_);\n }\n\n function __ERC1155_init_unchained(string memory uri_) internal onlyInitializing {\n _setURI(uri_);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC1155Upgradeable).interfaceId ||\n interfaceId == type(IERC1155MetadataURIUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155MetadataURI-uri}.\n *\n * This implementation returns the same URI for *all* token types. It relies\n * on the token type ID substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * Clients calling this function must replace the `\\{id\\}` substring with the\n * actual token type ID.\n */\n function uri(uint256) public view virtual override returns (string memory) {\n return _uri;\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {\n require(account != address(0), \"ERC1155: address zero is not a valid owner\");\n return _balances[id][account];\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(accounts.length == ids.length, \"ERC1155: accounts and ids length mismatch\");\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeTransferFrom(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n\n emit TransferSingle(operator, from, to, id, amount);\n\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n }\n\n emit TransferBatch(operator, from, to, ids, amounts);\n\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);\n }\n\n /**\n * @dev Sets a new URI for all token types, by relying on the token type ID\n * substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * By this mechanism, any occurrence of the `\\{id\\}` substring in either the\n * URI or any of the amounts in the JSON file at said URI will be replaced by\n * clients with the token type ID.\n *\n * For example, the `https://token-cdn-domain/\\{id\\}.json` URI would be\n * interpreted by clients as\n * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\n * for token type ID 0x4cce0.\n *\n * See {uri}.\n *\n * Because these URIs cannot be meaningfully represented by the {URI} event,\n * this function emits no events.\n */\n function _setURI(string memory newuri) internal virtual {\n _uri = newuri;\n }\n\n /**\n * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _balances[id][to] += amount;\n emit TransferSingle(operator, address(0), to, id, amount);\n\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; i++) {\n _balances[ids[i]][to] += amounts[i];\n }\n\n emit TransferBatch(operator, address(0), to, ids, amounts);\n\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);\n }\n\n /**\n * @dev Destroys `amount` tokens of token type `id` from `from`\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `from` must have at least `amount` tokens of token type `id`.\n */\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n\n emit TransferSingle(operator, from, address(0), id, amount);\n\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n */\n function _burnBatch(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n for (uint256 i = 0; i < ids.length; i++) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n }\n\n emit TransferBatch(operator, from, address(0), ids, amounts);\n\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC1155: setting approval status for self\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `ids` and `amounts` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `id` and `amount` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155ReceiverUpgradeable(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {\n if (response != IERC1155ReceiverUpgradeable.onERC1155Received.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (\n bytes4 response\n ) {\n if (response != IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n }\n }\n }\n\n function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {\n uint256[] memory array = new uint256[](1);\n array[0] = element;\n\n return array;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[47] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/extensions/ERC1155Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of {ERC1155} that allows token holders to destroy both their\n * own tokens and those that they have been approved to use.\n *\n * _Available since v3.1._\n */\nabstract contract ERC1155BurnableUpgradeable is Initializable, ERC1155Upgradeable {\n function __ERC1155Burnable_init() internal onlyInitializing {\n }\n\n function __ERC1155Burnable_init_unchained() internal onlyInitializing {\n }\n function burn(address account, uint256 id, uint256 value) public virtual {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n\n _burn(account, id, value);\n }\n\n function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n\n _burnBatch(account, ids, values);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of ERC1155 that adds tracking of total supply per id.\n *\n * Useful for scenarios where Fungible and Non-fungible tokens have to be\n * clearly identified. Note: While a totalSupply of 1 might mean the\n * corresponding is an NFT, there is no guarantees that no other token with the\n * same id are not going to be minted.\n */\nabstract contract ERC1155SupplyUpgradeable is Initializable, ERC1155Upgradeable {\n function __ERC1155Supply_init() internal onlyInitializing {\n }\n\n function __ERC1155Supply_init_unchained() internal onlyInitializing {\n }\n mapping(uint256 => uint256) private _totalSupply;\n\n /**\n * @dev Total amount of tokens in with a given id.\n */\n function totalSupply(uint256 id) public view virtual returns (uint256) {\n return _totalSupply[id];\n }\n\n /**\n * @dev Indicates whether any token exist with a given id, or not.\n */\n function exists(uint256 id) public view virtual returns (bool) {\n return ERC1155SupplyUpgradeable.totalSupply(id) > 0;\n }\n\n /**\n * @dev See {ERC1155-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n if (from == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n _totalSupply[ids[i]] += amounts[i];\n }\n }\n\n if (to == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n uint256 supply = _totalSupply[id];\n require(supply >= amount, \"ERC1155: burn amount exceeds totalSupply\");\n unchecked {\n _totalSupply[id] = supply - amount;\n }\n }\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155URIStorage.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../../utils/StringsUpgradeable.sol\";\nimport \"../ERC1155Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev ERC1155 token with storage based token URI management.\n * Inspired by the ERC721URIStorage extension\n *\n * _Available since v4.6._\n */\nabstract contract ERC1155URIStorageUpgradeable is Initializable, ERC1155Upgradeable {\n function __ERC1155URIStorage_init() internal onlyInitializing {\n __ERC1155URIStorage_init_unchained();\n }\n\n function __ERC1155URIStorage_init_unchained() internal onlyInitializing {\n _baseURI = \"\";\n }\n using StringsUpgradeable for uint256;\n\n // Optional base URI\n string private _baseURI;\n\n // Optional mapping for token URIs\n mapping(uint256 => string) private _tokenURIs;\n\n /**\n * @dev See {IERC1155MetadataURI-uri}.\n *\n * This implementation returns the concatenation of the `_baseURI`\n * and the token-specific uri if the latter is set\n *\n * This enables the following behaviors:\n *\n * - if `_tokenURIs[tokenId]` is set, then the result is the concatenation\n * of `_baseURI` and `_tokenURIs[tokenId]` (keep in mind that `_baseURI`\n * is empty per default);\n *\n * - if `_tokenURIs[tokenId]` is NOT set then we fallback to `super.uri()`\n * which in most cases will contain `ERC1155._uri`;\n *\n * - if `_tokenURIs[tokenId]` is NOT set, and if the parents do not have a\n * uri value set, then the result is empty.\n */\n function uri(uint256 tokenId) public view virtual override returns (string memory) {\n string memory tokenURI = _tokenURIs[tokenId];\n\n // If token URI is set, concatenate base URI and tokenURI (via abi.encodePacked).\n return bytes(tokenURI).length > 0 ? string(abi.encodePacked(_baseURI, tokenURI)) : super.uri(tokenId);\n }\n\n /**\n * @dev Sets `tokenURI` as the tokenURI of `tokenId`.\n */\n function _setURI(uint256 tokenId, string memory tokenURI) internal virtual {\n _tokenURIs[tokenId] = tokenURI;\n emit URI(uri(tokenId), tokenId);\n }\n\n /**\n * @dev Sets `baseURI` as the `_baseURI` for all tokens\n */\n function _setBaseURI(string memory baseURI) internal virtual {\n _baseURI = baseURI;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[48] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/IERC1155MetadataURIUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Upgradeable.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURIUpgradeable is IERC1155Upgradeable {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155ReceiverUpgradeable is IERC165Upgradeable {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n mstore(0x1c, hash)\n message := keccak256(0x00, 0x3c)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, \"\\x19\\x01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n data := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\n * `validator` and `data` according to the version 0 of EIP-191.\n *\n * See {recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.8;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../interfaces/IERC5267Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 52\n */\nabstract contract EIP712Upgradeable is Initializable, IERC5267Upgradeable {\n bytes32 private constant _TYPE_HASH =\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /// @custom:oz-renamed-from _HASHED_NAME\n bytes32 private _hashedName;\n /// @custom:oz-renamed-from _HASHED_VERSION\n bytes32 private _hashedVersion;\n\n string private _name;\n string private _version;\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n _name = name;\n _version = version;\n\n // Reset prior values in storage if upgrading\n _hashedName = 0;\n _hashedVersion = 0;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator();\n }\n\n function _buildDomainSeparator() private view returns (bytes32) {\n return keccak256(abi.encode(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev See {EIP-5267}.\n *\n * _Available since v4.9._\n */\n function eip712Domain()\n public\n view\n virtual\n override\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n )\n {\n // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized\n // and the EIP712 domain is not reliable, as it will be missing name and version.\n require(_hashedName == 0 && _hashedVersion == 0, \"EIP712: Uninitialized\");\n\n return (\n hex\"0f\", // 01111\n _EIP712Name(),\n _EIP712Version(),\n block.chainid,\n address(this),\n bytes32(0),\n new uint256[](0)\n );\n }\n\n /**\n * @dev The name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712Name() internal virtual view returns (string memory) {\n return _name;\n }\n\n /**\n * @dev The version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712Version() internal virtual view returns (string memory) {\n return _version;\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.\n */\n function _EIP712NameHash() internal view returns (bytes32) {\n string memory name = _EIP712Name();\n if (bytes(name).length > 0) {\n return keccak256(bytes(name));\n } else {\n // If the name is empty, the contract may have been upgraded without initializing the new storage.\n // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.\n bytes32 hashedName = _hashedName;\n if (hashedName != 0) {\n return hashedName;\n } else {\n return keccak256(\"\");\n }\n }\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.\n */\n function _EIP712VersionHash() internal view returns (bytes32) {\n string memory version = _EIP712Version();\n if (bytes(version).length > 0) {\n return keccak256(bytes(version));\n } else {\n // If the version is empty, the contract may have been upgraded without initializing the new storage.\n // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.\n bytes32 hashedVersion = _hashedVersion;\n if (hashedVersion != 0) {\n return hashedVersion;\n } else {\n return keccak256(\"\");\n }\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[48] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "@openzeppelin/contracts/access/AccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(account),\n \" is missing role \",\n Strings.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/IAccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable2Step.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./Ownable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2Step is Ownable {\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() public virtual {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC1155/IERC1155.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC2981.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface for the NFT Royalty Standard.\n *\n * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal\n * support for royalty payments across all NFT marketplaces and ecosystem participants.\n *\n * _Available since v4.5._\n */\ninterface IERC2981 is IERC165 {\n /**\n * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\n * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.\n */\n function royaltyInfo(\n uint256 tokenId,\n uint256 salePrice\n ) external view returns (address receiver, uint256 royaltyAmount);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC721/IERC721.sol\";\n" + }, + "@openzeppelin/contracts/proxy/Clones.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary Clones {\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create opcode, which should never revert.\n */\n function clone(address implementation) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create(0, 0x09, 0x37)\n }\n require(instance != address(0), \"ERC1167: create failed\");\n }\n\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create2 opcode and a `salt` to deterministically deploy\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n * the clones cannot be deployed twice at the same address.\n */\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create2(0, 0x09, 0x37, salt)\n }\n require(instance != address(0), \"ERC1167: create2 failed\");\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt,\n address deployer\n ) internal pure returns (address predicted) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(add(ptr, 0x38), deployer)\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n mstore(add(ptr, 0x14), implementation)\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n mstore(add(ptr, 0x58), salt)\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n predicted := keccak256(add(ptr, 0x43), 0x55)\n }\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt\n ) internal view returns (address predicted) {\n return predictDeterministicAddress(implementation, salt, address(this));\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Receiver.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Receiver.sol\";\n\n/**\n * @dev Implementation of the {IERC721Receiver} interface.\n *\n * Accepts all token transfers.\n * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.\n */\ncontract ERC721Holder is IERC721Receiver {\n /**\n * @dev See {IERC721Receiver-onERC721Received}.\n *\n * Always returns `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) {\n return this.onERC721Received.selector;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n mstore(0x1c, hash)\n message := keccak256(0x00, 0x3c)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, \"\\x19\\x01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n data := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\n * `validator` and `data` according to the version 0 of EIP-191.\n *\n * See {recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/ERC165Checker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Library used to query support of an interface declared via {IERC165}.\n *\n * Note that these functions return the actual result of the query: they do not\n * `revert` if an interface is not supported. It is up to the caller to decide\n * what to do in these cases.\n */\nlibrary ERC165Checker {\n // As per the EIP-165 spec, no interface should ever match 0xffffffff\n bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;\n\n /**\n * @dev Returns true if `account` supports the {IERC165} interface.\n */\n function supportsERC165(address account) internal view returns (bool) {\n // Any contract that implements ERC165 must explicitly indicate support of\n // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid\n return\n supportsERC165InterfaceUnchecked(account, type(IERC165).interfaceId) &&\n !supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID);\n }\n\n /**\n * @dev Returns true if `account` supports the interface defined by\n * `interfaceId`. Support for {IERC165} itself is queried automatically.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {\n // query support of both ERC165 as per the spec and support of _interfaceId\n return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);\n }\n\n /**\n * @dev Returns a boolean array where each value corresponds to the\n * interfaces passed in and whether they're supported or not. This allows\n * you to batch check interfaces for a contract where your expectation\n * is that some interfaces may not be supported.\n *\n * See {IERC165-supportsInterface}.\n *\n * _Available since v3.4._\n */\n function getSupportedInterfaces(\n address account,\n bytes4[] memory interfaceIds\n ) internal view returns (bool[] memory) {\n // an array of booleans corresponding to interfaceIds and whether they're supported or not\n bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);\n\n // query support of ERC165 itself\n if (supportsERC165(account)) {\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);\n }\n }\n\n return interfaceIdsSupported;\n }\n\n /**\n * @dev Returns true if `account` supports all the interfaces defined in\n * `interfaceIds`. Support for {IERC165} itself is queried automatically.\n *\n * Batch-querying can lead to gas savings by skipping repeated checks for\n * {IERC165} support.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {\n // query support of ERC165 itself\n if (!supportsERC165(account)) {\n return false;\n }\n\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {\n return false;\n }\n }\n\n // all interfaces supported\n return true;\n }\n\n /**\n * @notice Query if a contract implements an interface, does not check ERC165 support\n * @param account The address of the contract to query for support of an interface\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @return true if the contract at account indicates support of the interface with\n * identifier interfaceId, false otherwise\n * @dev Assumes that account contains a contract that supports ERC165, otherwise\n * the behavior of this method is undefined. This precondition can be checked\n * with {supportsERC165}.\n *\n * Some precompiled contracts will falsely indicate support for a given interface, so caution\n * should be exercised when using this function.\n *\n * Interface identification is specified in ERC-165.\n */\n function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {\n // prepare call\n bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);\n\n // perform static call\n bool success;\n uint256 returnSize;\n uint256 returnValue;\n assembly {\n success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)\n returnSize := returndatasize()\n returnValue := mload(0x00)\n }\n\n return success && returnSize >= 0x20 && returnValue > 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/Asset.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\nimport {\n AccessControlUpgradeable,\n ContextUpgradeable,\n IAccessControlUpgradeable,\n IERC165Upgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {\n ERC1155BurnableUpgradeable,\n ERC1155Upgradeable,\n IERC1155Upgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol\";\nimport {\n ERC1155SupplyUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol\";\nimport {\n ERC1155URIStorageUpgradeable,\n IERC1155MetadataURIUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {IERC1155} from \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {\n ERC2771HandlerUpgradeable,\n ERC2771HandlerAbstract\n} from \"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\";\nimport {\n MultiRoyaltyDistributor\n} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/MultiRoyaltyDistributor.sol\";\nimport {\n OperatorFiltererUpgradeable,\n IOperatorFilterRegistry\n} from \"@sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol\";\nimport {TokenIdUtils} from \"./libraries/TokenIdUtils.sol\";\nimport {IAsset} from \"./interfaces/IAsset.sol\";\nimport {ITokenUtils, IRoyaltyUGC} from \"./interfaces/ITokenUtils.sol\";\n\ncontract Asset is\n IAsset,\n Initializable,\n ERC2771HandlerUpgradeable,\n ERC1155BurnableUpgradeable,\n AccessControlUpgradeable,\n ERC1155SupplyUpgradeable,\n ERC1155URIStorageUpgradeable,\n OperatorFiltererUpgradeable,\n MultiRoyaltyDistributor,\n ITokenUtils\n{\n using TokenIdUtils for uint256;\n\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant BURNER_ROLE = keccak256(\"BURNER_ROLE\");\n bytes32 public constant MODERATOR_ROLE = keccak256(\"MODERATOR_ROLE\");\n\n // mapping of ipfs metadata token hash to token id\n mapping(string => uint256) public hashUsed;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(\n address forwarder,\n address assetAdmin,\n string memory baseUri,\n address commonSubscription,\n address _manager\n ) external initializer {\n _setBaseURI(baseUri);\n __AccessControl_init();\n __ERC1155Supply_init();\n __ERC2771Handler_init(forwarder);\n __ERC1155Burnable_init();\n _grantRole(DEFAULT_ADMIN_ROLE, assetAdmin);\n __OperatorFilterer_init(commonSubscription, true);\n __MultiRoyaltyDistributor_init(_manager);\n }\n\n /// @notice Mint new tokens\n /// @dev Only callable by the minter role\n /// @param to The address of the recipient\n /// @param id The id of the token to mint\n /// @param amount The amount of the token to mint\n function mint(\n address to,\n uint256 id,\n uint256 amount,\n string memory metadataHash\n ) external onlyRole(MINTER_ROLE) {\n _setMetadataHash(id, metadataHash);\n _mint(to, id, amount, \"\");\n address creator = id.getCreatorAddress();\n _setTokenRoyalties(id, payable(creator), creator);\n }\n\n /// @notice Mint new tokens with catalyst tier chosen by the creator\n /// @dev Only callable by the minter role\n /// @param to The address of the recipient\n /// @param ids The ids of the tokens to mint\n /// @param amounts The amounts of the tokens to mint\n function mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n string[] memory metadataHashes\n ) external onlyRole(MINTER_ROLE) {\n require(ids.length == metadataHashes.length, \"Asset: ids and metadataHash length mismatch\");\n require(ids.length == amounts.length, \"Asset: ids and amounts length mismatch\");\n for (uint256 i = 0; i < ids.length; i++) {\n _setMetadataHash(ids[i], metadataHashes[i]);\n }\n _mintBatch(to, ids, amounts, \"\");\n for (uint256 i; i < ids.length; i++) {\n address creator = ids[i].getCreatorAddress();\n _setTokenRoyalties(ids[i], payable(creator), creator);\n }\n }\n\n /// @notice Burn a token from a given account\n /// @dev Only the minter role can burn tokens\n /// @dev This function was added with token recycling and bridging in mind but may have other use cases\n /// @param account The account to burn tokens from\n /// @param id The token id to burn\n /// @param amount The amount of tokens to burn\n function burnFrom(\n address account,\n uint256 id,\n uint256 amount\n ) external onlyRole(BURNER_ROLE) {\n _burn(account, id, amount);\n }\n\n /// @notice Burn a batch of tokens from a given account\n /// @dev Only the minter role can burn tokens\n /// @dev This function was added with token recycling and bridging in mind but may have other use cases\n /// @dev The length of the ids and amounts arrays must be the same\n /// @param account The account to burn tokens from\n /// @param ids An array of token ids to burn\n /// @param amounts An array of amounts of tokens to burn\n function burnBatchFrom(\n address account,\n uint256[] memory ids,\n uint256[] memory amounts\n ) external onlyRole(BURNER_ROLE) {\n _burnBatch(account, ids, amounts);\n }\n\n /// @notice Set a new URI for specific tokenid\n /// @dev The metadata hash should be the IPFS CIDv1 base32 encoded hash\n /// @param tokenId The token id to set URI for\n /// @param metadata The new URI for asset's metadata\n function setTokenURI(uint256 tokenId, string memory metadata) external onlyRole(MODERATOR_ROLE) {\n _setURI(tokenId, metadata);\n }\n\n /// @notice Set a new base URI\n /// @param baseURI The new base URI\n function setBaseURI(string memory baseURI) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _setBaseURI(baseURI);\n }\n\n /// @notice returns full token URI, including baseURI and token metadata URI\n /// @param tokenId The token id to get URI for\n /// @return tokenURI the URI of the token\n function uri(uint256 tokenId)\n public\n view\n override(ERC1155Upgradeable, ERC1155URIStorageUpgradeable)\n returns (string memory)\n {\n return ERC1155URIStorageUpgradeable.uri(tokenId);\n }\n\n function getTokenIdByMetadataHash(string memory metadataHash) public view returns (uint256) {\n return hashUsed[metadataHash];\n }\n\n function _setMetadataHash(uint256 tokenId, string memory metadataHash) internal {\n if (hashUsed[metadataHash] != 0) {\n require(hashUsed[metadataHash] == tokenId, \"Asset: not allowed to reuse metadata hash\");\n } else {\n hashUsed[metadataHash] = tokenId;\n _setURI(tokenId, metadataHash);\n }\n }\n\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(trustedForwarder != address(0), \"Asset: trusted forwarder can't be zero address\");\n _setTrustedForwarder(trustedForwarder);\n }\n\n /// @notice Query if a contract implements interface `id`.\n /// @param id the interface identifier, as specified in ERC-165.\n /// @return `true` if the contract implements `id`.\n function supportsInterface(bytes4 id)\n public\n view\n virtual\n override(ERC1155Upgradeable, AccessControlUpgradeable, MultiRoyaltyDistributor)\n returns (bool)\n {\n return id == type(IRoyaltyUGC).interfaceId || super.supportsInterface(id);\n }\n\n function _msgSender()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (address sender)\n {\n return ERC2771HandlerAbstract._msgSender();\n }\n\n function _msgData()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (bytes calldata)\n {\n return ERC2771HandlerAbstract._msgData();\n }\n\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @dev call data should be optimized to order ids so packedBalance can be used efficiently.\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param amounts amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override onlyAllowedOperator(from) {\n super.safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /// @notice Enable or disable approval for `operator` to manage all of the caller's tokens.\n /// @param operator address which will be granted rights to transfer all tokens of the caller.\n /// @param approved whether to approve or revoke\n function setApprovalForAll(address operator, bool approved)\n public\n virtual\n override\n onlyAllowedOperatorApproval(operator)\n {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param amount amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override onlyAllowedOperator(from) {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeTransferFrom(from, to, id, amount, data);\n }\n\n /// @notice could be used to deploy splitter and set tokens royalties\n /// @param tokenId the id of the token for which the EIP2981 royalty is set for.\n /// @param recipient the royalty recipient for the splitter of the creator.\n /// @param creator the creactor of the tokens.\n function setTokenRoyalties(\n uint256 tokenId,\n address payable recipient,\n address creator\n ) external override onlyRole(DEFAULT_ADMIN_ROLE) {\n _setTokenRoyalties(tokenId, recipient, creator);\n }\n\n /// @notice Extracts the creator address from a given token id\n /// @param tokenId The token id to extract the creator address from\n /// @return creator The asset creator address\n function getCreatorAddress(uint256 tokenId) external pure returns (address creator) {\n return TokenIdUtils.getCreatorAddress(tokenId);\n }\n\n /// @notice Extracts the tier from a given token id\n /// @param tokenId The token id to extract the tier from\n /// @return tier The asset tier, determined by the catalyst used to create it\n function getTier(uint256 tokenId) external pure returns (uint8 tier) {\n return TokenIdUtils.getTier(tokenId);\n }\n\n /// @notice Extracts the revealed flag from a given token id\n /// @param tokenId The token id to extract the revealed flag from\n /// @return isRevealed Whether the asset is revealed or not\n function isRevealed(uint256 tokenId) external pure returns (bool) {\n return TokenIdUtils.isRevealed(tokenId);\n }\n\n /// @notice Extracts the asset nonce from a given token id\n /// @param tokenId The token id to extract the asset nonce from\n /// @return creatorNonce The asset creator nonce\n function getCreatorNonce(uint256 tokenId) external pure returns (uint16) {\n return TokenIdUtils.getCreatorNonce(tokenId);\n }\n\n /// @notice Extracts the abilities and enhancements hash from a given token id\n /// @param tokenId The token id to extract reveal nonce from\n /// @return revealNonce The reveal nonce of the asset\n function getRevealNonce(uint256 tokenId) external pure returns (uint16) {\n return TokenIdUtils.getRevealNonce(tokenId);\n }\n\n /// @notice Extracts the bridged flag from a given token id\n /// @param tokenId The token id to extract the bridged flag from\n /// @return bridged Whether the asset is bridged or not\n function isBridged(uint256 tokenId) external pure returns (bool) {\n return TokenIdUtils.isBridged(tokenId);\n }\n\n /// @notice This function is used to register Asset contract on the Operator Filterer Registry of Opensea.can only be called by admin.\n /// @dev used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.\n /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe.\n /// @param subscribe bool to signify subscription \"true\"\" or to copy the list \"false\".\n function registerAndSubscribe(address subscriptionOrRegistrantToCopy, bool subscribe)\n external\n onlyRole(DEFAULT_ADMIN_ROLE)\n {\n require(subscriptionOrRegistrantToCopy != address(0), \"Asset: subscription can't be zero address\");\n _registerAndSubscribe(subscriptionOrRegistrantToCopy, subscribe);\n }\n\n /// @notice sets filter registry address deployed in test\n /// @param registry the address of the registry\n function setOperatorRegistry(address registry) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(registry != address(0), \"Asset: registry can't be zero address\");\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {EIP712Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\";\nimport {\n AccessControlUpgradeable,\n ContextUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {TokenIdUtils} from \"./libraries/TokenIdUtils.sol\";\nimport {AuthSuperValidator} from \"./AuthSuperValidator.sol\";\nimport {\n ERC2771HandlerUpgradeable,\n ERC2771HandlerAbstract\n} from \"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\";\nimport {IAsset} from \"./interfaces/IAsset.sol\";\nimport {ICatalyst} from \"./interfaces/ICatalyst.sol\";\nimport {IAssetCreate} from \"./interfaces/IAssetCreate.sol\";\n\n/// @title AssetCreate\n/// @author The Sandbox\n/// @notice User-facing contract for creating new assets\ncontract AssetCreate is\n IAssetCreate,\n Initializable,\n ERC2771HandlerUpgradeable,\n EIP712Upgradeable,\n AccessControlUpgradeable\n{\n using TokenIdUtils for uint256;\n\n IAsset private assetContract;\n ICatalyst private catalystContract;\n AuthSuperValidator private authValidator;\n\n // mapping of creator address to creator nonce, a nonce is incremented every time a creator mints a new token\n mapping(address => uint16) public creatorNonces;\n mapping(address => uint16) public signatureNonces;\n\n bytes32 public constant SPECIAL_MINTER_ROLE = keccak256(\"SPECIAL_MINTER_ROLE\");\n bytes32 public constant MINT_TYPEHASH =\n keccak256(\"Mint(address creator,uint16 nonce,uint8 tier,uint256 amount,bool revealed,string metadataHash)\");\n bytes32 public constant MINT_BATCH_TYPEHASH =\n keccak256(\n \"MintBatch(address creator,uint16 nonce,uint8[] tiers,uint256[] amounts,bool[] revealed,string[] metadataHashes)\"\n );\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n /// @notice Initialize the contract\n /// @param _assetContract The address of the asset contract\n /// @param _authValidator The address of the AuthSuperValidator contract\n /// @param _forwarder The address of the forwarder contract\n function initialize(\n string memory _name,\n string memory _version,\n address _assetContract,\n address _catalystContract,\n address _authValidator,\n address _forwarder,\n address _defaultAdmin\n ) public initializer {\n assetContract = IAsset(_assetContract);\n catalystContract = ICatalyst(_catalystContract);\n authValidator = AuthSuperValidator(_authValidator);\n __ERC2771Handler_init(_forwarder);\n __EIP712_init(_name, _version);\n __AccessControl_init();\n _grantRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);\n }\n\n /// @notice Create a new asset\n /// @param signature A signature generated by TSB\n /// @param tier The tier of the asset to mint\n /// @param amount The amount of the asset to mint\n /// @param metadataHash The metadata hash of the asset to mint\n function createAsset(\n bytes memory signature,\n uint8 tier,\n uint256 amount,\n bool revealed,\n string calldata metadataHash,\n address creator\n ) external {\n require(\n authValidator.verify(\n signature,\n _hashMint(creator, signatureNonces[_msgSender()]++, tier, amount, revealed, metadataHash)\n ),\n \"Invalid signature\"\n );\n\n uint256 tokenId =\n TokenIdUtils.generateTokenId(creator, tier, ++creatorNonces[creator], revealed ? 1 : 0, false);\n\n // burn catalyst of a given tier\n catalystContract.burnFrom(creator, tier, amount);\n assetContract.mint(creator, tokenId, amount, metadataHash);\n emit AssetMinted(creator, tokenId, tier, amount, metadataHash, revealed);\n }\n\n /// @notice Create multiple assets at once\n /// @param signature A signature generated by TSB\n /// @param tiers The tiers of the assets to mint\n /// @param amounts The amounts of the assets to mint\n /// @param metadataHashes The metadata hashes of the assets to mint\n function createMultipleAssets(\n bytes memory signature,\n uint8[] calldata tiers,\n uint256[] calldata amounts,\n bool[] calldata revealed,\n string[] calldata metadataHashes,\n address creator\n ) external {\n require(\n authValidator.verify(\n signature,\n _hashBatchMint(creator, signatureNonces[_msgSender()]++, tiers, amounts, revealed, metadataHashes)\n ),\n \"Invalid signature\"\n );\n\n require(tiers.length == amounts.length, \"Arrays must be same length\");\n require(amounts.length == metadataHashes.length, \"Arrays must be same length\");\n require(metadataHashes.length == revealed.length, \"Arrays must be same length\");\n\n uint256[] memory tokenIds = new uint256[](tiers.length);\n uint256[] memory tiersToBurn = new uint256[](tiers.length);\n for (uint256 i = 0; i < tiers.length; i++) {\n tiersToBurn[i] = tiers[i];\n tokenIds[i] = TokenIdUtils.generateTokenId(\n creator,\n tiers[i],\n ++creatorNonces[creator],\n revealed[i] ? 1 : 0,\n false\n );\n }\n\n catalystContract.burnBatchFrom(creator, tiersToBurn, amounts);\n\n assetContract.mintBatch(creator, tokenIds, amounts, metadataHashes);\n emit AssetBatchMinted(creator, tokenIds, tiers, amounts, metadataHashes, revealed);\n }\n\n /// @notice Create special assets, like TSB exclusive tokens\n /// @dev Only callable by the special minter\n /// @param signature A signature generated by TSB\n /// @param amount The amount of the asset to mint\n /// @param metadataHash The metadata hash of the asset to mint,\n /// @param creator The address of the creator\n function createSpecialAsset(\n bytes memory signature,\n uint256 amount,\n string calldata metadataHash,\n address creator\n ) external onlyRole(SPECIAL_MINTER_ROLE) {\n require(\n authValidator.verify(\n signature,\n _hashMint(creator, signatureNonces[_msgSender()]++, 0, amount, true, metadataHash)\n ),\n \"Invalid signature\"\n );\n\n uint256 tokenId = TokenIdUtils.generateTokenId(creator, 0, ++creatorNonces[creator], 1, false);\n\n assetContract.mint(creator, tokenId, amount, metadataHash);\n emit SpecialAssetMinted(creator, tokenId, 0, amount, metadataHash, true);\n }\n\n /// @notice Get the asset contract address\n /// @return The asset contract address\n function getAssetContract() external view returns (address) {\n return address(assetContract);\n }\n\n /// @notice Get the catalyst contract address\n /// @return The catalyst contract address\n function getCatalystContract() external view returns (address) {\n return address(catalystContract);\n }\n\n /// @notice Get the auth validator address\n /// @return The auth validator address\n function getAuthValidator() external view returns (address) {\n return address(authValidator);\n }\n\n /// @notice Creates a hash of the mint data\n /// @param creator The address of the creator\n /// @param tier The tier of the asset\n /// @param amount The amount of copies to mint\n /// @param metadataHash The metadata hash of the asset\n /// @return digest The hash of the mint data\n function _hashMint(\n address creator,\n uint16 nonce,\n uint8 tier,\n uint256 amount,\n bool revealed,\n string calldata metadataHash\n ) internal view returns (bytes32 digest) {\n digest = _hashTypedDataV4(\n keccak256(\n abi.encode(\n MINT_TYPEHASH,\n creator,\n nonce,\n tier,\n amount,\n revealed,\n keccak256((abi.encodePacked(metadataHash)))\n )\n )\n );\n }\n\n /// @notice Creates a hash of the mint batch data\n /// @param creator The address of the creator\n /// @param tiers The tiers of the assets\n /// @param amounts The amounts of copies to mint\n /// @param metadataHashes The metadata hashes of the assets\n /// @return digest The hash of the mint batch data\n function _hashBatchMint(\n address creator,\n uint16 nonce,\n uint8[] calldata tiers,\n uint256[] calldata amounts,\n bool[] calldata revealed,\n string[] calldata metadataHashes\n ) internal view returns (bytes32 digest) {\n digest = _hashTypedDataV4(\n keccak256(\n abi.encode(\n MINT_BATCH_TYPEHASH,\n creator,\n nonce,\n keccak256(abi.encodePacked(tiers)),\n keccak256(abi.encodePacked(amounts)),\n keccak256(abi.encodePacked(revealed)),\n _encodeHashes(metadataHashes)\n )\n )\n );\n }\n\n /// @notice Encodes the hashes of the metadata for signature verification\n /// @param metadataHashes The hashes of the metadata\n /// @return encodedHashes The encoded hashes of the metadata\n function _encodeHashes(string[] memory metadataHashes) internal pure returns (bytes32) {\n bytes32[] memory encodedHashes = new bytes32[](metadataHashes.length);\n for (uint256 i = 0; i < metadataHashes.length; i++) {\n encodedHashes[i] = keccak256((abi.encodePacked(metadataHashes[i])));\n }\n\n return keccak256(abi.encodePacked(encodedHashes));\n }\n\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(trustedForwarder != address(0), \"AssetCreate: trusted forwarder can't be zero address\");\n _setTrustedForwarder(trustedForwarder);\n }\n\n function _msgSender()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (address sender)\n {\n return ERC2771HandlerAbstract._msgSender();\n }\n\n function _msgData()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (bytes calldata)\n {\n return ERC2771HandlerAbstract._msgData();\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {EIP712Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\";\nimport {\n AccessControlUpgradeable,\n ContextUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {TokenIdUtils} from \"./libraries/TokenIdUtils.sol\";\nimport {AuthSuperValidator} from \"./AuthSuperValidator.sol\";\nimport {\n ERC2771HandlerUpgradeable,\n ERC2771HandlerAbstract\n} from \"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\";\nimport {IAsset} from \"./interfaces/IAsset.sol\";\nimport {IAssetReveal} from \"./interfaces/IAssetReveal.sol\";\n\n/// @title AssetReveal\n/// @author The Sandbox\n/// @notice Contract for burning and revealing assets\ncontract AssetReveal is\n IAssetReveal,\n Initializable,\n AccessControlUpgradeable,\n ERC2771HandlerUpgradeable,\n EIP712Upgradeable\n{\n using TokenIdUtils for uint256;\n IAsset private assetContract;\n AuthSuperValidator private authValidator;\n\n // mapping of creator to asset id to asset's reveal nonce\n mapping(address => mapping(uint256 => uint16)) internal revealIds;\n\n // mapping for showing whether a revealHash has been used\n // revealHashes are generated by the TSB backend from reveal burn events and are used for reveal minting\n mapping(bytes32 => bool) internal revealHashesUsed;\n\n bytes32 public constant REVEAL_TYPEHASH =\n keccak256(\n \"Reveal(address recipient,uint256 prevTokenId,uint256[] amounts,string[] metadataHashes,bytes32[] revealHashes)\"\n );\n bytes32 public constant BATCH_REVEAL_TYPEHASH =\n keccak256(\n \"BatchReveal(address recipient,uint256[] prevTokenIds,uint256[][] amounts,string[][] metadataHashes,bytes32[][] revealHashes)\"\n );\n bytes32 public constant INSTANT_REVEAL_TYPEHASH =\n keccak256(\n \"InstantReveal(address recipient,uint256 prevTokenId,uint256[] amounts,string[] metadataHashes,bytes32[] revealHashes)\"\n );\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n /// @notice Initialize the contract\n /// @param _assetContract The address of the asset contract\n /// @param _authValidator The address of the AuthSuperValidator contract\n /// @param _forwarder The address of the forwarder contract\n function initialize(\n string memory _name,\n string memory _version,\n address _assetContract,\n address _authValidator,\n address _forwarder,\n address _defaultAdmin\n ) public initializer {\n assetContract = IAsset(_assetContract);\n authValidator = AuthSuperValidator(_authValidator);\n __ERC2771Handler_init(_forwarder);\n __EIP712_init(_name, _version);\n _grantRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);\n }\n\n /// @notice Reveal an asset to view its abilities and enhancements\n /// @dev the reveal mechanism works through burning the asset and minting a new one with updated tokenId\n /// @param tokenId the tokenId of id idasset to reveal\n /// @param amount the amount of tokens to reveal\n function revealBurn(uint256 tokenId, uint256 amount) external {\n _burnAsset(tokenId, amount);\n emit AssetRevealBurn(_msgSender(), tokenId, amount);\n }\n\n /// @notice Burn multiple assets to be able to reveal them later\n /// @dev Can be used to burn multiple copies of the same token id, each copy will be revealed separately\n /// @param tokenIds the tokenIds of the assets to burn\n /// @param amounts the amounts of the assets to burn\n function revealBatchBurn(uint256[] calldata tokenIds, uint256[] calldata amounts) external {\n _burnAssetBatch(tokenIds, amounts);\n emit AssetRevealBatchBurn(_msgSender(), tokenIds, amounts);\n }\n\n /// @notice Reveal assets to view their abilities and enhancements\n /// @dev Can be used to reveal multiple copies of the same token id\n /// @param signature Signature created on the TSB backend containing REVEAL_TYPEHASH and associated data, must be signed by authorized signer\n /// @param prevTokenId The tokenId of the unrevealed asset\n /// @param amounts The amount of assets to reveal (length reflects the number of types of reveal tokens and must be equal to the length of revealHashes)\n /// @param metadataHashes The array of hashes for revealed asset metadata\n /// @param revealHashes A revealHash array providing a random bytes32 generated by the TSB backend for each new tokenId\n function revealMint(\n bytes memory signature,\n uint256 prevTokenId,\n uint256[] calldata amounts,\n string[] calldata metadataHashes,\n bytes32[] calldata revealHashes\n ) external {\n require(amounts.length == metadataHashes.length, \"AssetReveal: Invalid amounts length\");\n require(amounts.length == revealHashes.length, \"AssetReveal: Invalid revealHashes length\");\n require(\n authValidator.verify(\n signature,\n _hashReveal(_msgSender(), prevTokenId, amounts, metadataHashes, revealHashes)\n ),\n \"AssetReveal: Invalid revealMint signature\"\n );\n uint256[] memory newTokenIds = _revealAsset(prevTokenId, metadataHashes, amounts, revealHashes);\n emit AssetRevealMint(_msgSender(), prevTokenId, amounts, newTokenIds, revealHashes);\n }\n\n /// @notice Mint multiple assets with revealed abilities and enhancements\n /// @dev Can be used to reveal multiple copies of the same token id\n /// @param signature Signatures created on the TSB backend containing REVEAL_TYPEHASH and associated data, must be signed by authorized signer\n /// @param prevTokenIds The tokenId of the unrevealed asset\n /// @param amounts The amount of assets to reveal (must be equal to the length of revealHashes)\n /// @param metadataHashes The array of hashes for asset metadata\n /// @param revealHashes Array of revealHash arrays providing random bytes32 generated by the TSB backend for each new tokenId\n function revealBatchMint(\n bytes calldata signature,\n uint256[] calldata prevTokenIds,\n uint256[][] calldata amounts,\n string[][] calldata metadataHashes,\n bytes32[][] calldata revealHashes\n ) external {\n require(prevTokenIds.length == amounts.length, \"AssetReveal: Invalid amounts length\");\n require(amounts.length == metadataHashes.length, \"AssetReveal: Invalid metadataHashes length\");\n require(prevTokenIds.length == revealHashes.length, \"AssetReveal: Invalid revealHashes length\");\n require(\n authValidator.verify(\n signature,\n _hashBatchReveal(_msgSender(), prevTokenIds, amounts, metadataHashes, revealHashes)\n ),\n \"AssetReveal: Invalid revealBatchMint signature\"\n );\n uint256[][] memory newTokenIds = new uint256[][](prevTokenIds.length);\n for (uint256 i = 0; i < prevTokenIds.length; i++) {\n newTokenIds[i] = _revealAsset(prevTokenIds[i], metadataHashes[i], amounts[i], revealHashes[i]);\n }\n emit AssetRevealBatchMint(_msgSender(), prevTokenIds, amounts, newTokenIds, revealHashes);\n }\n\n /// @notice Reveal assets to view their abilities and enhancements and mint them in a single transaction\n /// @dev Should be used where it is not required to keep the metadata secret, e.g. mythical assets where users select their desired abilities and enhancements\n /// @param signature Signature created on the TSB backend containing INSTANT_REVEAL_TYPEHASH and associated data, must be signed by authorized signer\n /// @param prevTokenId The tokenId of the unrevealed asset\n /// @param burnAmount The amount of assets to burn\n /// @param amounts The amount of assets to reveal (sum must be equal to the burnAmount)\n /// @param metadataHashes The array of hashes for asset metadata\n /// @param revealHashes A revealHash array providing a random bytes32 generated by the TSB backend for each new tokenId\n function burnAndReveal(\n bytes memory signature,\n uint256 prevTokenId,\n uint256 burnAmount,\n uint256[] calldata amounts,\n string[] calldata metadataHashes,\n bytes32[] calldata revealHashes\n ) external {\n require(amounts.length == metadataHashes.length, \"AssetReveal: Invalid amounts length\");\n require(amounts.length == revealHashes.length, \"AssetReveal: Invalid revealHashes length\");\n require(\n authValidator.verify(\n signature,\n _hashInstantReveal(_msgSender(), prevTokenId, amounts, metadataHashes, revealHashes)\n ),\n \"AssetReveal: Invalid burnAndReveal signature\"\n );\n _burnAsset(prevTokenId, burnAmount);\n uint256[] memory newTokenIds = _revealAsset(prevTokenId, metadataHashes, amounts, revealHashes);\n emit AssetRevealMint(_msgSender(), prevTokenId, amounts, newTokenIds, revealHashes);\n }\n\n /// @notice Generate new tokenIds for revealed assets and mint them\n /// @param prevTokenId The tokenId of the unrevealed asset\n /// @param metadataHashes The array of hashes for asset metadata\n /// @param amounts The array of amounts to mint\n function _revealAsset(\n uint256 prevTokenId,\n string[] calldata metadataHashes,\n uint256[] calldata amounts,\n bytes32[] calldata revealHashes\n ) internal returns (uint256[] memory) {\n uint256[] memory newTokenIds = getRevealedTokenIds(metadataHashes, prevTokenId);\n for (uint256 i = 0; i < revealHashes.length; i++) {\n require(revealHashesUsed[revealHashes[i]] == false, \"AssetReveal: RevealHash already used\");\n revealHashesUsed[revealHashes[i]] = true;\n }\n if (newTokenIds.length == 1) {\n assetContract.mint(_msgSender(), newTokenIds[0], amounts[0], metadataHashes[0]);\n } else {\n assetContract.mintBatch(_msgSender(), newTokenIds, amounts, metadataHashes);\n }\n return newTokenIds;\n }\n\n /// @notice Burns an asset to be able to reveal it later\n /// @param tokenId the tokenId of the asset to burn\n /// @param amount the amount of the asset to burn\n function _burnAsset(uint256 tokenId, uint256 amount) internal {\n _verifyBurnData(tokenId, amount);\n assetContract.burnFrom(_msgSender(), tokenId, amount);\n }\n\n function _burnAssetBatch(uint256[] calldata tokenIds, uint256[] calldata amounts) internal {\n require(tokenIds.length == amounts.length, \"AssetReveal: Invalid input\");\n for (uint256 i = 0; i < tokenIds.length; i++) {\n _verifyBurnData(tokenIds[i], amounts[i]);\n }\n assetContract.burnBatchFrom(_msgSender(), tokenIds, amounts);\n }\n\n function _verifyBurnData(uint256 tokenId, uint256 amount) internal pure {\n IAsset.AssetData memory data = tokenId.getData();\n require(!data.revealed, \"AssetReveal: Asset is already revealed\");\n require(amount > 0, \"AssetReveal: Burn amount should be greater than 0\");\n }\n\n /// @notice Creates a hash of the reveal data\n /// @param recipient The address of the recipient\n /// @param prevTokenId The unrevealed token id\n /// @param amounts The amount of tokens to mint\n /// @param metadataHashes The array of hashes for new asset metadata\n /// @param revealHashes The revealHashes used for revealing this particular prevTokenId (length corresponds to the new tokenIds)\n /// @return digest The hash of the reveal data\n function _hashInstantReveal(\n address recipient,\n uint256 prevTokenId,\n uint256[] calldata amounts,\n string[] calldata metadataHashes,\n bytes32[] calldata revealHashes\n ) internal view returns (bytes32 digest) {\n digest = _hashTypedDataV4(\n keccak256(\n abi.encode(\n INSTANT_REVEAL_TYPEHASH,\n recipient,\n prevTokenId,\n keccak256(abi.encodePacked(amounts)),\n _encodeHashes(metadataHashes),\n keccak256(abi.encodePacked(revealHashes))\n )\n )\n );\n }\n\n /// @notice Creates a hash of the reveal data\n /// @param recipient The intended recipient of the revealed token\n /// @param prevTokenId The previous token id\n /// @param amounts The amount of tokens to mint\n /// @param metadataHashes The array of hashes for new asset metadata\n /// @param revealHashes The revealHashes used for revealing this particular prevTokenId (length corresponds to the new tokenIds)\n /// @return digest The hash of the reveal data\n function _hashReveal(\n address recipient,\n uint256 prevTokenId,\n uint256[] calldata amounts,\n string[] calldata metadataHashes,\n bytes32[] calldata revealHashes\n ) internal view returns (bytes32 digest) {\n digest = _hashTypedDataV4(\n keccak256(\n abi.encode(\n REVEAL_TYPEHASH,\n recipient,\n prevTokenId,\n keccak256(abi.encodePacked(amounts)),\n _encodeHashes(metadataHashes),\n keccak256(abi.encodePacked(revealHashes))\n )\n )\n );\n }\n\n /// @notice Creates a hash of the reveal data\n /// @param recipient The intended recipient of the revealed tokens\n /// @param prevTokenIds The previous token id\n /// @param amounts The amounts of tokens to mint\n /// @param metadataHashes The arrays of hashes for new asset metadata\n /// @param revealHashes The revealHashes used for these prevTokenIds, (lengths corresponds to the new tokenIds)\n /// @return digest The hash of the reveal data\n function _hashBatchReveal(\n address recipient,\n uint256[] calldata prevTokenIds,\n uint256[][] calldata amounts,\n string[][] calldata metadataHashes,\n bytes32[][] calldata revealHashes\n ) internal view returns (bytes32 digest) {\n digest = _hashTypedDataV4(\n keccak256(\n abi.encode(\n BATCH_REVEAL_TYPEHASH,\n recipient,\n keccak256(abi.encodePacked(prevTokenIds)),\n _encodeBatchAmounts(amounts),\n _encodeBatchHashes(metadataHashes),\n _encodeBatchRevealHashes(revealHashes)\n )\n )\n );\n }\n\n /// @notice Encodes the hashes of the metadata for signature verification\n /// @param metadataHashes The hashes of the metadata\n /// @return encodedHashes The encoded hashes of the metadata\n function _encodeHashes(string[] memory metadataHashes) internal pure returns (bytes32) {\n bytes32[] memory encodedHashes = new bytes32[](metadataHashes.length);\n for (uint256 i = 0; i < metadataHashes.length; i++) {\n encodedHashes[i] = keccak256((abi.encodePacked(metadataHashes[i])));\n }\n return keccak256(abi.encodePacked(encodedHashes));\n }\n\n /// @notice Encodes the hashes of the metadata for signature verification\n /// @param metadataHashes The hashes of the metadata\n /// @return encodedHashes The encoded hashes of the metadata\n function _encodeBatchHashes(string[][] memory metadataHashes) internal pure returns (bytes32) {\n bytes32[] memory encodedHashes = new bytes32[](metadataHashes.length);\n for (uint256 i = 0; i < metadataHashes.length; i++) {\n encodedHashes[i] = _encodeHashes(metadataHashes[i]);\n }\n return keccak256(abi.encodePacked(encodedHashes));\n }\n\n /// @notice Encodes the hashes of the metadata for signature verification\n /// @param revealHashes The revealHashes\n /// @return encodedRevealHashes The encoded hashes of the metadata\n function _encodeBatchRevealHashes(bytes32[][] memory revealHashes) internal pure returns (bytes32) {\n bytes32[] memory encodedHashes = new bytes32[](revealHashes.length);\n for (uint256 i = 0; i < revealHashes.length; i++) {\n encodedHashes[i] = keccak256(abi.encodePacked(revealHashes[i]));\n }\n return keccak256(abi.encodePacked(encodedHashes));\n }\n\n /// @notice Encodes the amounts of the tokens for signature verification\n /// @param amounts The amounts of the tokens\n /// @return encodedAmounts The encoded amounts of the tokens\n function _encodeBatchAmounts(uint256[][] memory amounts) internal pure returns (bytes32) {\n bytes32[] memory encodedAmounts = new bytes32[](amounts.length);\n for (uint256 i = 0; i < amounts.length; i++) {\n encodedAmounts[i] = keccak256(abi.encodePacked(amounts[i]));\n }\n return keccak256(abi.encodePacked(encodedAmounts));\n }\n\n /// @notice Checks if each metadatahash has been used before to either get the tokenId that was already created for it or generate a new one if it hasn't\n /// @dev This function also validates that we're not trying to reveal a tokenId that has already been revealed\n /// @param metadataHashes The hashes of the metadata\n /// @param prevTokenId The previous token id from which the assets are revealed\n /// @return tokenIdArray The array of tokenIds to mint\n function getRevealedTokenIds(string[] calldata metadataHashes, uint256 prevTokenId)\n internal\n returns (uint256[] memory)\n {\n IAsset.AssetData memory data = prevTokenId.getData();\n require(!data.revealed, \"AssetReveal: already revealed\");\n uint256[] memory tokenIdArray = new uint256[](metadataHashes.length);\n for (uint256 i = 0; i < metadataHashes.length; i++) {\n uint256 tokenId = assetContract.getTokenIdByMetadataHash(metadataHashes[i]);\n if (tokenId == 0) {\n uint16 revealNonce = ++revealIds[data.creator][prevTokenId];\n tokenId = TokenIdUtils.generateTokenId(\n data.creator,\n data.tier,\n data.creatorNonce,\n revealNonce,\n data.bridged\n );\n }\n tokenIdArray[i] = tokenId;\n }\n return tokenIdArray;\n }\n\n /// @notice Get the status of a revealHash\n /// @return Whether it has been used\n function revealHashUsed(bytes32 revealHash) external view returns (bool) {\n return revealHashesUsed[revealHash];\n }\n\n /// @notice Get the asset contract address\n /// @return The asset contract address\n function getAssetContract() external view returns (address) {\n return address(assetContract);\n }\n\n /// @notice Get the auth validator address\n /// @return The auth validator address\n function getAuthValidator() external view returns (address) {\n return address(authValidator);\n }\n\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(trustedForwarder != address(0), \"AssetReveal: trusted forwarder can't be zero address\");\n _setTrustedForwarder(trustedForwarder);\n }\n\n function _msgSender()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (address sender)\n {\n return ERC2771HandlerAbstract._msgSender();\n }\n\n function _msgData()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (bytes calldata)\n {\n return ERC2771HandlerAbstract._msgData();\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/AuthSuperValidator.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\nimport {AccessControl} from \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport {ECDSA} from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\n/// @title AuthSuperValidator\n/// @author The Sandbox\n/// @notice This contract is used to validate the signatures of the backend, each contract can have a separate signer assigned\ncontract AuthSuperValidator is AccessControl {\n mapping(address => address) private _signers;\n\n /// @dev Constructor\n /// @param admin Address of the admin that will be able to grant roles\n constructor(address admin) {\n _grantRole(DEFAULT_ADMIN_ROLE, admin);\n }\n\n /// @notice Sets the signer for a contract\n /// @dev Only the admin can call this function\n /// @param contractAddress Address of the contract to set the signer for\n /// @param signer Address of the signer\n function setSigner(address contractAddress, address signer) public onlyRole(DEFAULT_ADMIN_ROLE) {\n _signers[contractAddress] = signer;\n }\n\n /// @notice Gets the signer for a contract\n /// @param contractAddress Address of the contract to get the signer for\n /// @return address of the signer\n function getSigner(address contractAddress) public view returns (address) {\n return _signers[contractAddress];\n }\n\n /// @notice Takes the signature and the digest and returns if the signer has a backend signer role assigned\n /// @dev Multipurpose function that can be used to verify signatures with different digests\n /// @param signature Signature hash\n /// @param digest Digest hash\n /// @return bool\n function verify(bytes memory signature, bytes32 digest) public view returns (bool) {\n address signer = _signers[_msgSender()];\n require(signer != address(0), \"AuthSuperValidator: signer not set\");\n address recoveredSigner = ECDSA.recover(digest, signature);\n return recoveredSigner == signer;\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/Catalyst.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\nimport {ERC1155Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol\";\nimport {\n AccessControlUpgradeable,\n ContextUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {\n ERC1155BurnableUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol\";\nimport {\n ERC1155SupplyUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol\";\nimport {\n ERC1155URIStorageUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol\";\nimport {\n IERC165Upgradeable,\n ERC2981Upgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {\n OperatorFiltererUpgradeable,\n IOperatorFilterRegistry\n} from \"@sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol\";\nimport {\n RoyaltyDistributor\n} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyDistributor.sol\";\nimport {\n IRoyaltyManager\n} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyManager.sol\";\nimport {IERC2981Upgradeable} from \"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\";\nimport {\n ERC2771HandlerUpgradeable,\n ERC2771HandlerAbstract\n} from \"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\";\nimport {ICatalyst} from \"./interfaces/ICatalyst.sol\";\n\n/// @title Catalyst\n/// @author The Sandbox\n/// @notice THis contract manages catalysts which are used to mint new assets.\n/// @dev An ERC1155 contract that manages catalysts, extends multiple OpenZeppelin contracts to\n/// provide a variety of features including, AccessControl, URIStorage, Burnable and more.\n/// The contract includes support for meta transactions.\ncontract Catalyst is\n ICatalyst,\n Initializable,\n ERC1155Upgradeable,\n ERC1155BurnableUpgradeable,\n ERC1155SupplyUpgradeable,\n ERC1155URIStorageUpgradeable,\n ERC2771HandlerUpgradeable,\n AccessControlUpgradeable,\n OperatorFiltererUpgradeable,\n RoyaltyDistributor\n{\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant BURNER_ROLE = keccak256(\"BURNER_ROLE\");\n\n uint256 public highestTierIndex;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n modifier onlyValidId(uint256 tokenId) {\n require(tokenId > 0 && tokenId <= highestTierIndex, \"Catalyst: invalid catalyst id\");\n _;\n }\n\n /// @notice Initialize the contract, setting up initial values for various features.\n /// @param _baseUri The base URI for the token metadata, most likely set to ipfs://.\n /// @param _trustedForwarder The trusted forwarder for meta transactions.\n /// @param _subscription The subscription address.\n /// @param _defaultAdmin The default admin address.\n /// @param _defaultMinter The default minter address.\n /// @param _catalystIpfsCID The IPFS content identifiers for each catalyst.\n /// @param _royaltyManager, the address of the Manager contract for common royalty recipient\n function initialize(\n string memory _baseUri,\n address _trustedForwarder,\n address _subscription,\n address _defaultAdmin,\n address _defaultMinter,\n string[] memory _catalystIpfsCID,\n address _royaltyManager\n ) public initializer {\n require(bytes(_baseUri).length != 0, \"Catalyst: base uri can't be empty\");\n require(_trustedForwarder != address(0), \"Catalyst: trusted forwarder can't be zero\");\n require(_subscription != address(0), \"Catalyst: subscription can't be zero\");\n require(_defaultAdmin != address(0), \"Catalyst: admin can't be zero\");\n require(_defaultMinter != address(0), \"Catalyst: minter can't be zero\");\n require(_royaltyManager != address(0), \"Catalyst: royalty manager can't be zero\");\n __ERC1155_init(_baseUri);\n __AccessControl_init();\n __ERC1155Burnable_init();\n __ERC1155Supply_init();\n __ERC1155URIStorage_init();\n __ERC2771Handler_init(_trustedForwarder);\n __OperatorFilterer_init(_subscription, true);\n _setBaseURI(_baseUri);\n _grantRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);\n _grantRole(MINTER_ROLE, _defaultMinter);\n __RoyaltyDistributor_init(_royaltyManager);\n for (uint256 i = 0; i < _catalystIpfsCID.length; i++) {\n require(bytes(_catalystIpfsCID[i]).length != 0, \"Catalyst: CID can't be empty\");\n _setURI(i, _catalystIpfsCID[i]);\n highestTierIndex = i;\n }\n }\n\n /// @notice Mints a new token, limited to MINTER_ROLE only\n /// @param to The address that will own the minted token\n /// @param id The token id to mint\n /// @param amount The amount to be minted\n function mint(\n address to,\n uint256 id,\n uint256 amount\n ) external onlyRole(MINTER_ROLE) onlyValidId(id) {\n _mint(to, id, amount, \"\");\n }\n\n /// @notice Mints a batch of tokens, limited to MINTER_ROLE only\n /// @param to The address that will own the minted tokens\n /// @param ids The token ids to mint\n /// @param amounts The amounts to be minted per token id\n function mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts\n ) external onlyRole(MINTER_ROLE) {\n for (uint256 i = 0; i < ids.length; i++) {\n require(ids[i] > 0 && ids[i] <= highestTierIndex, \"Catalyst: invalid catalyst id\");\n }\n _mintBatch(to, ids, amounts, \"\");\n }\n\n /// @notice Burns a specified amount of tokens from a specific address\n /// @param account The address to burn from\n /// @param id The token id to burn\n /// @param amount The amount to be burned\n function burnFrom(\n address account,\n uint256 id,\n uint256 amount\n ) external onlyRole(BURNER_ROLE) {\n _burn(account, id, amount);\n }\n\n /// @notice Burns a batch of tokens from a specific address\n /// @param account The address to burn from\n /// @param ids The token ids to burn\n /// @param amounts The amounts to be burned\n function burnBatchFrom(\n address account,\n uint256[] memory ids,\n uint256[] memory amounts\n ) external onlyRole(BURNER_ROLE) {\n _burnBatch(account, ids, amounts);\n }\n\n /// @notice Add a new catalyst type, limited to DEFAULT_ADMIN_ROLE only\n /// @param ipfsCID The royalty bps for the catalyst\n function addNewCatalystType(string memory ipfsCID) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(bytes(ipfsCID).length != 0, \"Catalyst: CID can't be empty\");\n uint256 newCatId = ++highestTierIndex;\n ERC1155URIStorageUpgradeable._setURI(newCatId, ipfsCID);\n emit NewCatalystTypeAdded(newCatId);\n }\n\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(trustedForwarder != address(0), \"Catalyst: trusted forwarder can't be zero address\");\n _setTrustedForwarder(trustedForwarder);\n }\n\n /// @notice Set a new URI for specific tokenid\n /// @param tokenId The token id to set URI for\n /// @param metadataHash The new URI\n function setMetadataHash(uint256 tokenId, string memory metadataHash)\n external\n onlyRole(DEFAULT_ADMIN_ROLE)\n onlyValidId(tokenId)\n {\n require(bytes(metadataHash).length != 0, \"Catalyst: metadataHash can't be empty\");\n _setURI(tokenId, metadataHash);\n }\n\n /// @notice Set a new base URI\n /// @param baseURI The new base URI\n function setBaseURI(string memory baseURI) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(bytes(baseURI).length != 0, \"Catalyst: base uri can't be empty\");\n _setBaseURI(baseURI);\n }\n\n /// @notice returns full token URI, including baseURI and token metadata URI\n /// @param tokenId The token id to get URI for\n /// @return tokenURI the URI of the token\n function uri(uint256 tokenId)\n public\n view\n override(ERC1155Upgradeable, ERC1155URIStorageUpgradeable)\n returns (string memory)\n {\n return ERC1155URIStorageUpgradeable.uri(tokenId);\n }\n\n /// @dev Needed for meta transactions (see EIP-2771)\n function _msgSender() internal view virtual override(ContextUpgradeable, ERC2771HandlerAbstract) returns (address) {\n return ERC2771HandlerAbstract._msgSender();\n }\n\n /// @dev Needed for meta transactions (see EIP-2771)\n function _msgData()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (bytes calldata)\n {\n return ERC2771HandlerAbstract._msgData();\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param value amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes memory data\n ) public override onlyAllowedOperator(from) {\n super._safeTransferFrom(from, to, id, value, data);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @dev call data should be optimized to order ids so packedBalance can be used efficiently.\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param values amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory values,\n bytes memory data\n ) public override onlyAllowedOperator(from) {\n super._safeBatchTransferFrom(from, to, ids, values, data);\n }\n\n /// @notice Enable or disable approval for `operator` to manage all of the caller's tokens.\n /// @param operator address which will be granted rights to transfer all tokens of the caller.\n /// @param approved whether to approve or revoke\n function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {\n super._setApprovalForAll(_msgSender(), operator, approved);\n }\n\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n }\n\n /// @notice Query if a contract implements interface `id`.\n /// @param interfaceId the interface identifier, as specified in ERC-165.\n /// @return `true` if the contract implements `interfaceId`.\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(ERC1155Upgradeable, AccessControlUpgradeable, RoyaltyDistributor)\n returns (bool)\n {\n return super.supportsInterface(interfaceId);\n }\n\n /// @notice This function is used to register Catalyst contract on the Operator Filterer Registry of Opensea.can only be called by admin.\n /// @dev used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.\n /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe.\n /// @param subscribe bool to signify subscription \"true\"\" or to copy the list \"false\".\n function registerAndSubscribe(address subscriptionOrRegistrantToCopy, bool subscribe)\n external\n onlyRole(DEFAULT_ADMIN_ROLE)\n {\n require(subscriptionOrRegistrantToCopy != address(0), \"Catalyst: subscription can't be zero address\");\n _registerAndSubscribe(subscriptionOrRegistrantToCopy, subscribe);\n }\n\n /// @notice sets filter registry address deployed in test\n /// @param registry the address of the registry\n function setOperatorRegistry(address registry) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(registry != address(0), \"Catalyst: registry can't be zero address\");\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/interfaces/IAsset.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\ninterface IAsset {\n // AssetData reflects the asset tokenId structure\n // Refer to TokenIdUtils.sol\n struct AssetData {\n uint256 tokenId;\n address creator;\n uint256 amount;\n uint8 tier;\n uint16 creatorNonce;\n bool revealed;\n string metadataHash;\n bool bridged;\n }\n\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\n\n // Functions\n function mint(\n address to,\n uint256 id,\n uint256 amount,\n string memory metadataHash\n ) external;\n\n function mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n string[] memory metadataHashes\n ) external;\n\n function burnFrom(\n address account,\n uint256 id,\n uint256 amount\n ) external;\n\n function burnBatchFrom(\n address account,\n uint256[] memory ids,\n uint256[] memory amounts\n ) external;\n\n function getTokenIdByMetadataHash(string memory metadataHash) external view returns (uint256);\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/interfaces/IAssetCreate.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\ninterface IAssetCreate {\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\n event AssetMinted(\n address indexed creator,\n uint256 tokenId,\n uint16 tier,\n uint256 amount,\n string metadataHash,\n bool revealed\n );\n event SpecialAssetMinted(\n address indexed creator,\n uint256 tokenId,\n uint16 tier,\n uint256 amount,\n string metadataHash,\n bool revealed\n );\n event AssetBatchMinted(\n address indexed creator,\n uint256[] tokenIds,\n uint8[] tiers,\n uint256[] amounts,\n string[] metadataHashes,\n bool[] revealed\n );\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/interfaces/IAssetReveal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\ninterface IAssetReveal {\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\n event AssetRevealBurn(address revealer, uint256 unrevealedTokenId, uint256 amount);\n event AssetRevealBatchBurn(address revealer, uint256[] unrevealedTokenIds, uint256[] amounts);\n event AssetRevealMint(\n address recipient,\n uint256 unrevealedTokenId,\n uint256[] amounts,\n uint256[] newTokenIds,\n bytes32[] revealHashes\n );\n event AssetRevealBatchMint(\n address recipient,\n uint256[] unrevealedTokenIds,\n uint256[][] amounts,\n uint256[][] newTokenIds,\n bytes32[][] revealHashes\n );\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/interfaces/ICatalyst.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\ninterface ICatalyst {\n enum CatalystType {TSB_EXCLUSIVE, COMMON, UNCOMMON, RARE, EPIC, LEGENDARY, MYTHIC}\n\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\n event NewCatalystTypeAdded(uint256 catalystId);\n event DefaultRoyaltyChanged(address indexed newDefaultRoyaltyRecipient, uint256 newDefaultRoyaltyAmount);\n\n /// @notice Mints a new token, limited to MINTER_ROLE only\n /// @param to The address that will own the minted token\n /// @param id The token id to mint\n /// @param amount The amount to be minted\n function mint(\n address to,\n uint256 id,\n uint256 amount\n ) external;\n\n /// @notice Mints a batch of tokens, limited to MINTER_ROLE only\n /// @param to The address that will own the minted tokens\n /// @param ids The token ids to mint\n /// @param amounts The amounts to be minted per token id\n function mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts\n ) external;\n\n /// @notice Burns a specified amount of tokens from a specific address\n /// @param account The address to burn from\n /// @param id The token id to burn\n /// @param amount The amount to be burned\n function burnFrom(\n address account,\n uint256 id,\n uint256 amount\n ) external;\n\n /// @notice Burns a batch of tokens from a specific address\n /// @param account The address to burn from\n /// @param ids The token ids to burn\n /// @param amounts The amounts to be burned\n function burnBatchFrom(\n address account,\n uint256[] memory ids,\n uint256[] memory amounts\n ) external;\n\n /// @notice Add a new catalyst type, limited to DEFAULT_ADMIN_ROLE only\n /// @param ipfsCID The royalty bps for the catalyst\n function addNewCatalystType(string memory ipfsCID) external;\n\n /// @notice Set a new URI for specific tokenid\n /// @param tokenId The token id to set URI for\n /// @param metadataHash The new URI\n function setMetadataHash(uint256 tokenId, string memory metadataHash) external;\n\n /// @notice Set a new base URI\n /// @param baseURI The new base URI\n function setBaseURI(string memory baseURI) external;\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/interfaces/ITokenUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\nimport {IRoyaltyUGC} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyUGC.sol\";\n\ninterface ITokenUtils is IRoyaltyUGC {\n function getTier(uint256 tokenId) external pure returns (uint8 tier);\n\n function isRevealed(uint256 tokenId) external pure returns (bool);\n\n function getCreatorNonce(uint256 tokenId) external pure returns (uint16);\n\n function getRevealNonce(uint256 tokenId) external pure returns (uint16);\n\n function isBridged(uint256 tokenId) external pure returns (bool);\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/libraries/TokenIdUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IAsset} from \"../interfaces/IAsset.sol\";\n\nlibrary TokenIdUtils {\n // Layer masks\n uint256 public constant TIER_MASK = 0xFF;\n uint256 public constant NONCE_MASK = 0xFFFF;\n uint256 public constant REVEAL_NONCE_MASK = 0xFFFF;\n uint256 public constant BRIDGED_MASK = 0x1;\n\n // Bit shifts\n uint256 public constant CREATOR_SHIFT = 0;\n uint256 public constant TIER_SHIFT = 160;\n uint256 public constant NONCE_SHIFT = 168;\n uint256 public constant REVEAL_NONCE_SHIFT = 184;\n uint256 public constant BRIDGED_SHIFT = 200;\n\n /// @notice Generates a token id for a given asset\n /// @dev The token id is generated by concatenating the following fields:\n /// @dev creator address, chain index, tier, asset nonce, reveal nonce and bridged boolean\n /// @dev The first 160 bits are the creator address\n /// @dev The next 8 bits are the chain index\n /// @dev The next 8 bits are the tier\n /// @dev The next 16 bits are the asset nonce\n /// @dev The next 16 bits are assets reveal nonce.\n /// @param creator The address of the creator of the asset\n /// @param tier The tier of the asset determined by the catalyst used to create it\n /// @param creatorNonce The nonce of the asset creator\n /// @param revealNonce The reveal nonce of the asset\n /// @param bridged Whether the asset is bridged or not\n /// @return tokenId The generated token id\n function generateTokenId(\n address creator,\n uint8 tier,\n uint16 creatorNonce,\n uint16 revealNonce,\n bool bridged\n ) internal pure returns (uint256 tokenId) {\n uint160 creatorAddress = uint160(creator);\n\n tokenId = tokenId =\n uint256(creatorAddress) |\n (uint256(tier) << TIER_SHIFT) |\n (uint256(creatorNonce) << NONCE_SHIFT) |\n (uint256(revealNonce) << REVEAL_NONCE_SHIFT) |\n (uint256(bridged ? 1 : 0) << BRIDGED_SHIFT);\n\n return tokenId;\n }\n\n /// @notice Extracts the creator address from a given token id\n /// @param tokenId The token id to extract the creator address from\n /// @return creator The asset creator address\n function getCreatorAddress(uint256 tokenId) internal pure returns (address creator) {\n creator = address(uint160(tokenId));\n return creator;\n }\n\n /// @notice Extracts the tier from a given token id\n /// @param tokenId The token id to extract the tier from\n /// @return tier The asset tier, determined by the catalyst used to create it\n function getTier(uint256 tokenId) internal pure returns (uint8 tier) {\n tier = uint8((tokenId >> TIER_SHIFT) & TIER_MASK);\n return tier;\n }\n\n /// @notice Extracts the revealed flag from a given token id\n /// @param tokenId The token id to extract the revealed flag from\n /// @return isRevealed Whether the asset is revealed or not\n function isRevealed(uint256 tokenId) internal pure returns (bool) {\n uint16 revealNonce = getRevealNonce(tokenId);\n return revealNonce != 0;\n }\n\n /// @notice Extracts the asset nonce from a given token id\n /// @param tokenId The token id to extract the asset nonce from\n /// @return creatorNonce The asset creator nonce\n function getCreatorNonce(uint256 tokenId) internal pure returns (uint16) {\n uint16 creatorNonce = uint16((tokenId >> NONCE_SHIFT) & NONCE_MASK);\n return creatorNonce;\n }\n\n /// @notice Extracts the abilities and enhancements hash from a given token id\n /// @param tokenId The token id to extract reveal nonce from\n /// @return revealNonce The reveal nonce of the asset\n function getRevealNonce(uint256 tokenId) internal pure returns (uint16) {\n uint16 revealNonce = uint16((tokenId >> REVEAL_NONCE_SHIFT) & REVEAL_NONCE_MASK);\n return revealNonce;\n }\n\n /// @notice Extracts the bridged flag from a given token id\n /// @param tokenId The token id to extract the bridged flag from\n /// @return bridged Whether the asset is bridged or not\n function isBridged(uint256 tokenId) internal pure returns (bool) {\n bool bridged = ((tokenId >> BRIDGED_SHIFT) & BRIDGED_MASK) == 1;\n return bridged;\n }\n\n /// @notice Extracts the asset data from a given token id\n /// @dev Created to limit the number of functions that need to be called when revealing an asset\n /// @param tokenId The token id to extract the asset data from\n function getData(uint256 tokenId) internal pure returns (IAsset.AssetData memory data) {\n data.creator = getCreatorAddress(tokenId);\n data.tier = getTier(tokenId);\n data.revealed = isRevealed(tokenId);\n data.creatorNonce = getCreatorNonce(tokenId);\n data.bridged = isBridged(tokenId);\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/FallBackRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {\n FallbackRegistry\n} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/mock/FallbackRegistry.sol\";\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockAsset.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\n// mock the asset contract to test the _msgData() function\n\nimport {Asset} from \"../Asset.sol\";\nimport {\n IOperatorFilterRegistry\n} from \"@sandbox-smart-contracts/dependency-operator-filter/contracts/interfaces/IOperatorFilterRegistry.sol\";\n\ncontract MockAsset is Asset {\n /// @notice sets registry and subscribe to subscription\n /// @param registry address of registry\n /// @param subscription address to subscribe\n function setRegistryAndSubscribe(address registry, address subscription) external {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n operatorFilterRegistry.registerAndSubscribe(address(this), subscription);\n }\n\n /// @notice Mint new tokens with out minter role\n /// @param to The address of the recipient\n /// @param id The id of the token to mint\n /// @param amount The amount of the token to mint\n function mintWithoutMinterRole(\n address to,\n uint256 id,\n uint256 amount\n ) external {\n _mint(to, id, amount, \"\");\n }\n\n /// @notice set approval for asset transfer without filtering\n /// @param operator operator to be approved\n /// @param approved bool value for giving (true) and canceling (false) approval\n function setApprovalForAllWithoutFilter(address operator, bool approved) public virtual {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n function msgData() external view returns (bytes memory) {\n return _msgData();\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockAssetCreate.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\n// mock the asset contract to test the _msgData() function to satisfy the coverage\n\nimport {AssetCreate} from \"../AssetCreate.sol\";\n\ncontract MockAssetCreate is AssetCreate {\n function msgData() external view returns (bytes memory) {\n return _msgData();\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockAssetReveal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\n// mock the asset contract to test the _msgData() function to satisfy the coverage\n\nimport {AssetReveal} from \"../AssetReveal.sol\";\n\ncontract MockAssetReveal is AssetReveal {\n function msgData() external view returns (bytes memory) {\n return _msgData();\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockCatalyst.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.18;\n\nimport {Catalyst, IOperatorFilterRegistry} from \"../Catalyst.sol\";\n\ncontract MockCatalyst is Catalyst {\n /// @notice sets registry and subscribe to subscription\n /// @param registry address of registry\n /// @param subscription address to subscribe\n function setRegistryAndSubscribe(address registry, address subscription) external {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n operatorFilterRegistry.registerAndSubscribe(address(this), subscription);\n }\n\n /// @notice Mint new tokens with out minter role\n /// @param to The address of the recipient\n /// @param id The id of the token to mint\n /// @param amount The amount of the token to mint\n function mintWithoutMinterRole(\n address to,\n uint256 id,\n uint256 amount\n ) external {\n _mint(to, id, amount, \"\");\n }\n\n /// @notice set approval for asset transfer without filteration\n /// @param operator operator to be approved\n /// @param approved bool value for giving (true) and canceling (false) approval\n function setApprovalForAllWithoutFilter(address operator, bool approved) public virtual {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockMarketplace.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {\n MockMarketplace\n} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/mock/MockMarketplace.sol\";\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockMarketPlace1.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {\n MockERC1155MarketPlace1\n} from \"@sandbox-smart-contracts/dependency-operator-filter/contracts/mock/MockMarketPlace1.sol\";\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockMarketPlace2.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {\n MockERC1155MarketPlace2\n} from \"@sandbox-smart-contracts/dependency-operator-filter/contracts/mock/MockMarketPlace2.sol\";\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockMarketPlace3.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {\n MockERC1155MarketPlace3\n} from \"@sandbox-smart-contracts/dependency-operator-filter/contracts/mock/MockMarketPlace3.sol\";\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockMarketPlace4.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {\n MockERC1155MarketPlace4\n} from \"@sandbox-smart-contracts/dependency-operator-filter/contracts/mock/MockMarketPlace4.sol\";\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockMinter.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IAsset} from \"../interfaces/IAsset.sol\";\nimport {TokenIdUtils} from \"../libraries/TokenIdUtils.sol\";\n\ncontract MockMinter {\n using TokenIdUtils for uint256;\n\n IAsset public assetContract;\n\n mapping(address => uint16) public creatorNonces;\n\n event Minted(uint256 tokenId, uint256 amount);\n\n constructor(address _assetContract) {\n assetContract = IAsset(_assetContract);\n }\n\n /// @dev Mints a specified number of unrevealed copies of specific tier\n function mintAsset(\n address recipient,\n uint256 amount,\n uint8 tier,\n bool revealed,\n string calldata metadataHash\n ) public {\n // increment nonce\n unchecked {creatorNonces[msg.sender]++;}\n // get current creator nonce\n uint16 creatorNonce = creatorNonces[msg.sender];\n uint256 tokenId = TokenIdUtils.generateTokenId(msg.sender, tier, creatorNonce, revealed ? 1 : 0, false);\n\n assetContract.mint(recipient, tokenId, amount, metadataHash);\n emit Minted(tokenId, amount);\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockOperatorFilterRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {\n MockOperatorFilterRegistry\n} from \"@sandbox-smart-contracts/dependency-operator-filter/contracts/mock/MockOperatorFilterRegistry.sol\";\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockOperatorFilterSubscription.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {\n MockOperatorFilterSubscription\n} from \"@sandbox-smart-contracts/dependency-operator-filter/contracts/mock/MockOperatorFilterSubscription.sol\";\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockTrustedForwarder.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {MockTrustedForwarder} from \"@sandbox-smart-contracts/dependency-metatx/contracts/test/MockTrustedForwarder.sol\";\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/RoyaltyEngineV1.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {\n RoyaltyEngineV1\n} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/mock/RoyaltyEngineV1.sol\";\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/RoyaltyManager.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {RoyaltyManager} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol\";\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/RoyaltyRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {\n RoyaltyRegistry\n} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/mock/RoyaltyRegistry.sol\";\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/RoyaltySplitter.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {RoyaltySplitter} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol\";\n\n/* solhint-disable-next-line no-empty-blocks*/\ncontract MockSplitter is RoyaltySplitter {\n\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/TestERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {TestERC20} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/mock/TestERC20.sol\";\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/TokenIdUtilsWrapped.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {TokenIdUtils} from \"../libraries/TokenIdUtils.sol\";\nimport {IAsset} from \"../interfaces/IAsset.sol\";\n\ncontract TokenIdUtilsWrapped {\n function generateTokenId(\n address creator,\n uint8 tier,\n uint16 creatorNonce,\n uint16 revealNonce,\n bool bridged\n ) public pure returns (uint256 tokenId) {\n return TokenIdUtils.generateTokenId(creator, tier, creatorNonce, revealNonce, bridged);\n }\n\n function getCreatorAddress(uint256 tokenId) public pure returns (address creator) {\n return TokenIdUtils.getCreatorAddress(tokenId);\n }\n\n function getTier(uint256 tokenId) public pure returns (uint8 tier) {\n return TokenIdUtils.getTier(tokenId);\n }\n\n function getCreatorNonce(uint256 tokenId) public pure returns (uint16 creatorNonce) {\n return TokenIdUtils.getCreatorNonce(tokenId);\n }\n\n function isRevealed(uint256 tokenId) public pure returns (bool) {\n return TokenIdUtils.isRevealed(tokenId);\n }\n\n function getRevealNonce(uint256 tokenId) public pure returns (uint16) {\n return TokenIdUtils.getRevealNonce(tokenId);\n }\n\n function isBridged(uint256 tokenId) public pure returns (bool) {\n return TokenIdUtils.isBridged(tokenId);\n }\n\n function getData(uint256 tokenId) public pure returns (IAsset.AssetData memory data) {\n return TokenIdUtils.getData(tokenId);\n }\n\n function TIER_MASK() public pure returns (uint256) {\n return TokenIdUtils.TIER_MASK;\n }\n\n function NONCE_MASK() public pure returns (uint256) {\n return TokenIdUtils.NONCE_MASK;\n }\n\n function REVEAL_NONCE_MASK() public pure returns (uint256) {\n return TokenIdUtils.REVEAL_NONCE_MASK;\n }\n\n function BRIDGED_MASK() public pure returns (uint256) {\n return TokenIdUtils.BRIDGED_MASK;\n }\n\n function TIER_SHIFT() public pure returns (uint256) {\n return TokenIdUtils.TIER_SHIFT;\n }\n\n function NONCE_SHIFT() public pure returns (uint256) {\n return TokenIdUtils.NONCE_SHIFT;\n }\n\n function REVEAL_NONCE_SHIFT() public pure returns (uint256) {\n return TokenIdUtils.REVEAL_NONCE_SHIFT;\n }\n\n function BRIDGED_SHIFT() public pure returns (uint256) {\n return TokenIdUtils.BRIDGED_SHIFT;\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerAbstract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @dev minimal ERC2771 handler to keep bytecode-size down\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\nabstract contract ERC2771HandlerAbstract {\n /// @notice return true if the forwarder is the trusted forwarder\n /// @param forwarder trusted forwarder address to check\n /// @return true if the address is the same as the trusted forwarder\n function isTrustedForwarder(address forwarder) external view returns (bool) {\n return _isTrustedForwarder(forwarder);\n }\n\n /// @notice if the call is from the trusted forwarder the sender is extracted from calldata, msg.sender otherwise\n /// @return sender the calculated address of the sender\n function _msgSender() internal view virtual returns (address sender) {\n if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n sender = msg.sender;\n }\n }\n\n /// @notice if the call is from the trusted forwarder the sender is removed from calldata\n /// @return the calldata without the sender\n function _msgData() internal view virtual returns (bytes calldata) {\n if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\n return msg.data[:msg.data.length - 20];\n } else {\n return msg.data;\n }\n }\n\n /// @notice return true if the forwarder is the trusted forwarder\n /// @param forwarder trusted forwarder address to check\n /// @return true if the address is the same as the trusted forwarder\n /// @dev this function must be IMPLEMENTED\n function _isTrustedForwarder(address forwarder) internal view virtual returns (bool);\n}\n" + }, + "@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ERC2771HandlerAbstract} from \"./ERC2771HandlerAbstract.sol\";\n\n/// @dev minimal ERC2771 handler to keep bytecode-size down\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\ncontract ERC2771HandlerUpgradeable is Initializable, ERC2771HandlerAbstract {\n address private _trustedForwarder;\n\n /// @notice Emitted when a `newTrustedForwarder` is set, replacing the `oldTrustedForwarder`\n /// @param oldTrustedForwarder old trusted forwarder\n /// @param newTrustedForwarder new trusted forwarder\n /// @param operator the sender of the transaction\n event TrustedForwarderSet(\n address indexed oldTrustedForwarder,\n address indexed newTrustedForwarder,\n address indexed operator\n );\n\n /// @notice initialize the trusted forwarder address\n /// @param forwarder trusted forwarder address or zero to disable it\n function __ERC2771Handler_init(address forwarder) internal onlyInitializing {\n __ERC2771Handler_init_unchained(forwarder);\n }\n\n /// @notice initialize the trusted forwarder address\n /// @param forwarder trusted forwarder address or zero to disable it\n function __ERC2771Handler_init_unchained(address forwarder) internal onlyInitializing {\n _setTrustedForwarder(forwarder);\n }\n\n /// @notice return the address of the trusted forwarder\n /// @return return the address of the trusted forwarder\n function getTrustedForwarder() external view returns (address) {\n return _trustedForwarder;\n }\n\n /// @notice set the address of the trusted forwarder\n /// @param newForwarder the address of the new forwarder.\n function _setTrustedForwarder(address newForwarder) internal virtual {\n require(newForwarder != _trustedForwarder, \"ERC2771HandlerUpgradeable: forwarder already set\");\n emit TrustedForwarderSet(_trustedForwarder, newForwarder, _msgSender());\n _trustedForwarder = newForwarder;\n }\n\n /// @notice return true if the forwarder is the trusted forwarder\n /// @param forwarder trusted forwarder address to check\n /// @return true if the address is the same as the trusted forwarder\n function _isTrustedForwarder(address forwarder) internal view virtual override returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n uint256[49] private __gap;\n}\n" + }, + "@sandbox-smart-contracts/dependency-metatx/contracts/test/MockTrustedForwarder.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity ^0.8.2;\n\ncontract MockTrustedForwarder {\n struct ForwardRequest {\n address from;\n address to;\n uint256 value;\n uint256 gasLimit;\n bytes data;\n }\n\n function execute(ForwardRequest calldata req) public payable returns (bool, bytes memory) {\n (bool success, bytes memory returndata) = req.to.call{gas: req.gasLimit, value: req.value}(\n abi.encodePacked(req.data, req.from)\n );\n assert(gasleft() > req.gasLimit / 63);\n return (success, returndata);\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-operator-filter/contracts/interfaces/IOperatorFilterRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IOperatorFilterRegistry {\n /**\n * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns\n * true if supplied registrant address is not registered.\n */\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\n\n /**\n * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.\n */\n function register(address registrant) external;\n\n /**\n * @notice Registers an address with the registry and \"subscribes\" to another address's filtered operators and codeHashes.\n */\n function registerAndSubscribe(address registrant, address subscription) external;\n\n /**\n * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another\n * address without subscribing.\n */\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\n\n /**\n * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.\n * Note that this does not remove any filtered addresses or codeHashes.\n * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.\n */\n function unregister(address addr) external;\n\n /**\n * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered.\n */\n function updateOperator(\n address registrant,\n address operator,\n bool filtered\n ) external;\n\n /**\n * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.\n */\n function updateOperators(\n address registrant,\n address[] calldata operators,\n bool filtered\n ) external;\n\n /**\n * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.\n */\n function updateCodeHash(\n address registrant,\n bytes32 codehash,\n bool filtered\n ) external;\n\n /**\n * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.\n */\n function updateCodeHashes(\n address registrant,\n bytes32[] calldata codeHashes,\n bool filtered\n ) external;\n\n /**\n * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous\n * subscription if present.\n * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,\n * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be\n * used.\n */\n function subscribe(address registrant, address registrantToSubscribe) external;\n\n /**\n * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.\n */\n function unsubscribe(address registrant, bool copyExistingEntries) external;\n\n /**\n * @notice Get the subscription address of a given registrant, if any.\n */\n function subscriptionOf(address addr) external returns (address registrant);\n\n /**\n * @notice Get the set of addresses subscribed to a given registrant.\n * Note that order is not guaranteed as updates are made.\n */\n function subscribers(address registrant) external returns (address[] memory);\n\n /**\n * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.\n * Note that order is not guaranteed as updates are made.\n */\n function subscriberAt(address registrant, uint256 index) external returns (address);\n\n /**\n * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.\n */\n function copyEntriesOf(address registrant, address registrantToCopy) external;\n\n /**\n * @notice Returns true if operator is filtered by a given address or its subscription.\n */\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\n\n /**\n * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription.\n */\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\n\n /**\n * @notice Returns true if a codeHash is filtered by a given address or its subscription.\n */\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\n\n /**\n * @notice Returns a list of filtered operators for a given address or its subscription.\n */\n function filteredOperators(address addr) external returns (address[] memory);\n\n /**\n * @notice Returns the set of filtered codeHashes for a given address or its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\n\n /**\n * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or\n * its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\n\n /**\n * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or\n * its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\n\n /**\n * @notice Returns true if an address has registered\n */\n function isRegistered(address addr) external returns (bool);\n\n /**\n * @dev Convenience method to compute the code hash of an arbitrary contract\n */\n function codeHashOf(address addr) external returns (bytes32);\n}\n" + }, + "@sandbox-smart-contracts/dependency-operator-filter/contracts/mock/MockMarketPlace1.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {IERC1155Upgradeable} from \"@openzeppelin/contracts-upgradeable/interfaces/IERC1155Upgradeable.sol\";\nimport {ERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol\";\nimport {ERC721Holder} from \"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\";\n\ncontract MockERC1155MarketPlace1 is ERC1155Receiver, ERC721Holder {\n bytes4 private constant ERC1155_IS_RECEIVER = 0x4e2312e0;\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param amount amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function transferTokenForERC1155(\n address asset,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) external {\n IERC1155Upgradeable(asset).safeTransferFrom(from, to, id, amount, data);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param amounts amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function batchTransferTokenERC1155(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) external {\n IERC1155Upgradeable(asset).safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n\n function supportsInterface(bytes4 _interfaceId) public view override returns (bool interfaceId) {\n interfaceId = super.supportsInterface(_interfaceId);\n return interfaceId;\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-operator-filter/contracts/mock/MockMarketPlace2.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {IERC1155Upgradeable} from \"@openzeppelin/contracts-upgradeable/interfaces/IERC1155Upgradeable.sol\";\nimport {ERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol\";\nimport {ERC721Holder} from \"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\";\n\ncontract MockERC1155MarketPlace2 is ERC1155Receiver, ERC721Holder {\n bytes4 private constant ERC1155_IS_RECEIVER = 0x4e2312e0;\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param amount amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function transferTokenForERC1155(\n address asset,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) external {\n IERC1155Upgradeable(asset).safeTransferFrom(from, to, id, amount, data);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param amounts amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function batchTransferTokenERC1155(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) external {\n IERC1155Upgradeable(asset).safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n\n function supportsInterface(bytes4 _interfaceId) public view override returns (bool interfaceId) {\n interfaceId = super.supportsInterface(_interfaceId);\n return interfaceId;\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-operator-filter/contracts/mock/MockMarketPlace3.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {IERC1155Upgradeable} from \"@openzeppelin/contracts-upgradeable/interfaces/IERC1155Upgradeable.sol\";\nimport {ERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol\";\nimport {ERC721Holder} from \"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\";\n\ncontract MockERC1155MarketPlace3 is ERC1155Receiver, ERC721Holder {\n bytes4 private constant ERC1155_IS_RECEIVER = 0x4e2312e0;\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param amount amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function transferTokenForERC1155(\n address asset,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) external {\n IERC1155Upgradeable(asset).safeTransferFrom(from, to, id, amount, data);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param amounts amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function batchTransferTokenERC1155(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) external {\n IERC1155Upgradeable(asset).safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n\n function supportsInterface(bytes4 _interfaceId) public view override returns (bool interfaceId) {\n interfaceId = super.supportsInterface(_interfaceId);\n return interfaceId;\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-operator-filter/contracts/mock/MockMarketPlace4.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {IERC1155Upgradeable} from \"@openzeppelin/contracts-upgradeable/interfaces/IERC1155Upgradeable.sol\";\nimport {ERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol\";\nimport {ERC721Holder} from \"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\";\n\ncontract MockERC1155MarketPlace4 is ERC1155Receiver, ERC721Holder {\n bytes4 private constant ERC1155_IS_RECEIVER = 0x4e2312e0;\n bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;\n bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param amount amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function transferTokenForERC1155(\n address asset,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) external {\n IERC1155Upgradeable(asset).safeTransferFrom(from, to, id, amount, data);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @param asset the contract address on which the token transfer will take place\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param amounts amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function batchTransferTokenERC1155(\n address asset,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) external {\n IERC1155Upgradeable(asset).safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_RECEIVED;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external pure returns (bytes4) {\n return ERC1155_BATCH_RECEIVED;\n }\n\n function supportsInterface(bytes4 _interfaceId) public view override returns (bool interfaceId) {\n interfaceId = super.supportsInterface(_interfaceId);\n return interfaceId;\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-operator-filter/contracts/mock/MockOperatorFilterRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\n// solhint-disable code-complexity\npragma solidity ^0.8.0;\n\nimport {IOperatorFilterRegistry} from \"operator-filter-registry/src/IOperatorFilterRegistry.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {EnumerableSet} from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport {\n OperatorFilterRegistryErrorsAndEvents\n} from \"operator-filter-registry/src/OperatorFilterRegistryErrorsAndEvents.sol\";\n\n/**\n * @title MockOperatorFilterRegistry\n * @notice Made based on the OperatorFilterRegistry of openSea at https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/OperatorFilterRegistry.sol\n * @notice This contracts allows tokens or token owners to register specific addresses or codeHashes that may be\n * * restricted according to the isOperatorAllowed function.\n */\ncontract MockOperatorFilterRegistry is IOperatorFilterRegistry, OperatorFilterRegistryErrorsAndEvents {\n using EnumerableSet for EnumerableSet.AddressSet;\n using EnumerableSet for EnumerableSet.Bytes32Set;\n\n /// @dev initialized accounts have a nonzero codehash (see https://eips.ethereum.org/EIPS/eip-1052)\n /// Note that this will also be a smart contract's codehash when making calls from its constructor.\n bytes32 internal constant EOA_CODEHASH = keccak256(\"\");\n\n mapping(address => EnumerableSet.AddressSet) private _filteredOperators;\n mapping(address => EnumerableSet.Bytes32Set) private _filteredCodeHashes;\n mapping(address => address) private _registrations;\n mapping(address => EnumerableSet.AddressSet) private _subscribers;\n\n constructor(address _defaultSubscription, address[] memory _blacklistedAddresses) {\n _registrations[_defaultSubscription] = _defaultSubscription;\n EnumerableSet.AddressSet storage filteredOperatorsRef = _filteredOperators[_defaultSubscription];\n EnumerableSet.Bytes32Set storage filteredCodeHashesRef = _filteredCodeHashes[_defaultSubscription];\n for (uint256 i; i < _blacklistedAddresses.length; i++) {\n filteredOperatorsRef.add(_blacklistedAddresses[i]);\n bytes32 codeHash = _blacklistedAddresses[i].codehash;\n filteredCodeHashesRef.add(codeHash);\n }\n }\n\n /**\n * @notice Restricts method caller to the address or EIP-173 \"owner()\"\n */\n modifier onlyAddressOrOwner(address addr) {\n if (msg.sender != addr) {\n try Ownable(addr).owner() returns (address owner) {\n if (msg.sender != owner) {\n revert OnlyAddressOrOwner();\n }\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert NotOwnable();\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n }\n _;\n }\n\n /**\n * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns\n * true if supplied registrant address is not registered.\n * Note that this method will *revert* if an operator or its codehash is filtered with an error that is\n * more informational than a false boolean, so smart contracts that query this method for informational\n * purposes will need to wrap in a try/catch or perform a low-level staticcall in order to handle the case\n * that an operator is filtered.\n */\n function isOperatorAllowed(address registrant, address operator) external view returns (bool) {\n address registration = _registrations[registrant];\n if (registration != address(0)) {\n EnumerableSet.AddressSet storage filteredOperatorsRef;\n EnumerableSet.Bytes32Set storage filteredCodeHashesRef;\n\n filteredOperatorsRef = _filteredOperators[registration];\n filteredCodeHashesRef = _filteredCodeHashes[registration];\n\n if (filteredOperatorsRef.contains(operator)) {\n revert AddressFiltered(operator);\n }\n if (operator.code.length > 0) {\n bytes32 codeHash = operator.codehash;\n if (filteredCodeHashesRef.contains(codeHash)) {\n revert CodeHashFiltered(operator, codeHash);\n }\n }\n }\n return true;\n }\n\n //////////////////\n // AUTH METHODS //\n //////////////////\n\n /**\n * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.\n */\n function register(address registrant) external onlyAddressOrOwner(registrant) {\n if (_registrations[registrant] != address(0)) {\n revert AlreadyRegistered();\n }\n _registrations[registrant] = registrant;\n emit RegistrationUpdated(registrant, true);\n }\n\n /**\n * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.\n * Note that this does not remove any filtered addresses or codeHashes.\n * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.\n */\n function unregister(address registrant) external onlyAddressOrOwner(registrant) {\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert NotRegistered(registrant);\n }\n if (registration != registrant) {\n _subscribers[registration].remove(registrant);\n emit SubscriptionUpdated(registrant, registration, false);\n }\n _registrations[registrant] = address(0);\n emit RegistrationUpdated(registrant, false);\n }\n\n /**\n * @notice Registers an address with the registry and \"subscribes\" to another address's filtered operators and codeHashes.\n */\n function registerAndSubscribe(address registrant, address subscription) external onlyAddressOrOwner(registrant) {\n address registration = _registrations[registrant];\n if (registration != address(0)) {\n revert AlreadyRegistered();\n }\n if (registrant == subscription) {\n revert CannotSubscribeToSelf();\n }\n address subscriptionRegistration = _registrations[subscription];\n if (subscriptionRegistration == address(0)) {\n revert NotRegistered(subscription);\n }\n if (subscriptionRegistration != subscription) {\n revert CannotSubscribeToRegistrantWithSubscription(subscription);\n }\n\n _registrations[registrant] = subscription;\n _subscribers[subscription].add(registrant);\n emit RegistrationUpdated(registrant, true);\n emit SubscriptionUpdated(registrant, subscription, true);\n }\n\n /**\n * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another\n * address without subscribing.\n */\n function registerAndCopyEntries(address registrant, address registrantToCopy)\n external\n onlyAddressOrOwner(registrant)\n {\n if (registrantToCopy == registrant) {\n revert CannotCopyFromSelf();\n }\n address registration = _registrations[registrant];\n if (registration != address(0)) {\n revert AlreadyRegistered();\n }\n address registrantRegistration = _registrations[registrantToCopy];\n if (registrantRegistration == address(0)) {\n revert NotRegistered(registrantToCopy);\n }\n _registrations[registrant] = registrant;\n emit RegistrationUpdated(registrant, true);\n _copyEntries(registrant, registrantToCopy);\n }\n\n /**\n * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered.\n */\n function updateOperator(\n address registrant,\n address operator,\n bool filtered\n ) external onlyAddressOrOwner(registrant) {\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert NotRegistered(registrant);\n }\n if (registration != registrant) {\n revert CannotUpdateWhileSubscribed(registration);\n }\n EnumerableSet.AddressSet storage filteredOperatorsRef = _filteredOperators[registrant];\n\n if (!filtered) {\n bool removed = filteredOperatorsRef.remove(operator);\n if (!removed) {\n revert AddressNotFiltered(operator);\n }\n } else {\n bool added = filteredOperatorsRef.add(operator);\n if (!added) {\n revert AddressAlreadyFiltered(operator);\n }\n }\n emit OperatorUpdated(registrant, operator, filtered);\n }\n\n /**\n * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.\n * Note that this will allow adding the bytes32(0) codehash, which could result in unexpected behavior,\n * since calling `isCodeHashFiltered` will return true for bytes32(0), which is the codeHash of any\n * un-initialized account. Since un-initialized accounts have no code, the registry will not validate\n * that an un-initalized account's codeHash is not filtered. By the time an account is able to\n * act as an operator (an account is initialized or a smart contract exclusively in the context of its\n * constructor), it will have a codeHash of EOA_CODEHASH, which cannot be filtered.\n */\n function updateCodeHash(\n address registrant,\n bytes32 codeHash,\n bool filtered\n ) external onlyAddressOrOwner(registrant) {\n if (codeHash == EOA_CODEHASH) {\n revert CannotFilterEOAs();\n }\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert NotRegistered(registrant);\n }\n if (registration != registrant) {\n revert CannotUpdateWhileSubscribed(registration);\n }\n EnumerableSet.Bytes32Set storage filteredCodeHashesRef = _filteredCodeHashes[registrant];\n\n if (!filtered) {\n bool removed = filteredCodeHashesRef.remove(codeHash);\n if (!removed) {\n revert CodeHashNotFiltered(codeHash);\n }\n } else {\n bool added = filteredCodeHashesRef.add(codeHash);\n if (!added) {\n revert CodeHashAlreadyFiltered(codeHash);\n }\n }\n emit CodeHashUpdated(registrant, codeHash, filtered);\n }\n\n /**\n * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.\n */\n function updateOperators(\n address registrant,\n address[] calldata operators,\n bool filtered\n ) external onlyAddressOrOwner(registrant) {\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert NotRegistered(registrant);\n }\n if (registration != registrant) {\n revert CannotUpdateWhileSubscribed(registration);\n }\n EnumerableSet.AddressSet storage filteredOperatorsRef = _filteredOperators[registrant];\n uint256 operatorsLength = operators.length;\n if (!filtered) {\n for (uint256 i = 0; i < operatorsLength; ) {\n address operator = operators[i];\n bool removed = filteredOperatorsRef.remove(operator);\n if (!removed) {\n revert AddressNotFiltered(operator);\n }\n unchecked {++i;}\n }\n } else {\n for (uint256 i = 0; i < operatorsLength; ) {\n address operator = operators[i];\n bool added = filteredOperatorsRef.add(operator);\n if (!added) {\n revert AddressAlreadyFiltered(operator);\n }\n unchecked {++i;}\n }\n }\n emit OperatorsUpdated(registrant, operators, filtered);\n }\n\n /**\n * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.\n * Note that this will allow adding the bytes32(0) codehash, which could result in unexpected behavior,\n * since calling `isCodeHashFiltered` will return true for bytes32(0), which is the codeHash of any\n * un-initialized account. Since un-initialized accounts have no code, the registry will not validate\n * that an un-initalized account's codeHash is not filtered. By the time an account is able to\n * act as an operator (an account is initialized or a smart contract exclusively in the context of its\n * constructor), it will have a codeHash of EOA_CODEHASH, which cannot be filtered.\n */\n function updateCodeHashes(\n address registrant,\n bytes32[] calldata codeHashes,\n bool filtered\n ) external onlyAddressOrOwner(registrant) {\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert NotRegistered(registrant);\n }\n if (registration != registrant) {\n revert CannotUpdateWhileSubscribed(registration);\n }\n EnumerableSet.Bytes32Set storage filteredCodeHashesRef = _filteredCodeHashes[registrant];\n uint256 codeHashesLength = codeHashes.length;\n if (!filtered) {\n for (uint256 i = 0; i < codeHashesLength; ) {\n bytes32 codeHash = codeHashes[i];\n bool removed = filteredCodeHashesRef.remove(codeHash);\n if (!removed) {\n revert CodeHashNotFiltered(codeHash);\n }\n unchecked {++i;}\n }\n } else {\n for (uint256 i = 0; i < codeHashesLength; ) {\n bytes32 codeHash = codeHashes[i];\n if (codeHash == EOA_CODEHASH) {\n revert CannotFilterEOAs();\n }\n bool added = filteredCodeHashesRef.add(codeHash);\n if (!added) {\n revert CodeHashAlreadyFiltered(codeHash);\n }\n unchecked {++i;}\n }\n }\n emit CodeHashesUpdated(registrant, codeHashes, filtered);\n }\n\n /**\n * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous\n * subscription if present.\n * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,\n * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be\n * used.\n */\n function subscribe(address registrant, address newSubscription) external onlyAddressOrOwner(registrant) {\n if (registrant == newSubscription) {\n revert CannotSubscribeToSelf();\n }\n if (newSubscription == address(0)) {\n revert CannotSubscribeToZeroAddress();\n }\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert NotRegistered(registrant);\n }\n if (registration == newSubscription) {\n revert AlreadySubscribed(newSubscription);\n }\n address newSubscriptionRegistration = _registrations[newSubscription];\n if (newSubscriptionRegistration == address(0)) {\n revert NotRegistered(newSubscription);\n }\n if (newSubscriptionRegistration != newSubscription) {\n revert CannotSubscribeToRegistrantWithSubscription(newSubscription);\n }\n\n if (registration != registrant) {\n _subscribers[registration].remove(registrant);\n emit SubscriptionUpdated(registrant, registration, false);\n }\n _registrations[registrant] = newSubscription;\n _subscribers[newSubscription].add(registrant);\n emit SubscriptionUpdated(registrant, newSubscription, true);\n }\n\n /**\n * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.\n */\n function unsubscribe(address registrant, bool copyExistingEntries) external onlyAddressOrOwner(registrant) {\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert NotRegistered(registrant);\n }\n if (registration == registrant) {\n revert NotSubscribed();\n }\n _subscribers[registration].remove(registrant);\n _registrations[registrant] = registrant;\n emit SubscriptionUpdated(registrant, registration, false);\n if (copyExistingEntries) {\n _copyEntries(registrant, registration);\n }\n }\n\n /**\n * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.\n */\n function copyEntriesOf(address registrant, address registrantToCopy) external onlyAddressOrOwner(registrant) {\n if (registrant == registrantToCopy) {\n revert CannotCopyFromSelf();\n }\n address registration = _registrations[registrant];\n if (registration == address(0)) {\n revert NotRegistered(registrant);\n }\n if (registration != registrant) {\n revert CannotUpdateWhileSubscribed(registration);\n }\n address registrantRegistration = _registrations[registrantToCopy];\n if (registrantRegistration == address(0)) {\n revert NotRegistered(registrantToCopy);\n }\n _copyEntries(registrant, registrantToCopy);\n }\n\n /// @dev helper to copy entries from registrantToCopy to registrant and emit events\n function _copyEntries(address registrant, address registrantToCopy) private {\n EnumerableSet.AddressSet storage filteredOperatorsRef = _filteredOperators[registrantToCopy];\n EnumerableSet.Bytes32Set storage filteredCodeHashesRef = _filteredCodeHashes[registrantToCopy];\n uint256 filteredOperatorsLength = filteredOperatorsRef.length();\n uint256 filteredCodeHashesLength = filteredCodeHashesRef.length();\n for (uint256 i = 0; i < filteredOperatorsLength; ) {\n address operator = filteredOperatorsRef.at(i);\n bool added = _filteredOperators[registrant].add(operator);\n if (added) {\n emit OperatorUpdated(registrant, operator, true);\n }\n unchecked {++i;}\n }\n for (uint256 i = 0; i < filteredCodeHashesLength; ) {\n bytes32 codehash = filteredCodeHashesRef.at(i);\n bool added = _filteredCodeHashes[registrant].add(codehash);\n if (added) {\n emit CodeHashUpdated(registrant, codehash, true);\n }\n unchecked {++i;}\n }\n }\n\n //////////////////\n // VIEW METHODS //\n //////////////////\n\n /**\n * @notice Get the subscription address of a given registrant, if any.\n */\n function subscriptionOf(address registrant) external view returns (address subscription) {\n subscription = _registrations[registrant];\n if (subscription == address(0)) {\n revert NotRegistered(registrant);\n } else if (subscription == registrant) {\n subscription = address(0);\n }\n }\n\n /**\n * @notice Get the set of addresses subscribed to a given registrant.\n * Note that order is not guaranteed as updates are made.\n */\n function subscribers(address registrant) external view returns (address[] memory) {\n return _subscribers[registrant].values();\n }\n\n /**\n * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.\n * Note that order is not guaranteed as updates are made.\n */\n function subscriberAt(address registrant, uint256 index) external view returns (address) {\n return _subscribers[registrant].at(index);\n }\n\n /**\n * @notice Returns true if operator is filtered by a given address or its subscription.\n */\n function isOperatorFiltered(address registrant, address operator) external view returns (bool) {\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredOperators[registration].contains(operator);\n }\n return _filteredOperators[registrant].contains(operator);\n }\n\n /**\n * @notice Returns true if a codeHash is filtered by a given address or its subscription.\n */\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external view returns (bool) {\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredCodeHashes[registration].contains(codeHash);\n }\n return _filteredCodeHashes[registrant].contains(codeHash);\n }\n\n /**\n * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription.\n */\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external view returns (bool) {\n bytes32 codeHash = operatorWithCode.codehash;\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredCodeHashes[registration].contains(codeHash);\n }\n return _filteredCodeHashes[registrant].contains(codeHash);\n }\n\n /**\n * @notice Returns true if an address has registered\n */\n function isRegistered(address registrant) external view returns (bool) {\n return _registrations[registrant] != address(0);\n }\n\n /**\n * @notice Returns a list of filtered operators for a given address or its subscription.\n */\n function filteredOperators(address registrant) external view returns (address[] memory) {\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredOperators[registration].values();\n }\n return _filteredOperators[registrant].values();\n }\n\n /**\n * @notice Returns the set of filtered codeHashes for a given address or its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredCodeHashes(address registrant) external view returns (bytes32[] memory) {\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredCodeHashes[registration].values();\n }\n return _filteredCodeHashes[registrant].values();\n }\n\n /**\n * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or\n * its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredOperatorAt(address registrant, uint256 index) external view returns (address) {\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredOperators[registration].at(index);\n }\n return _filteredOperators[registrant].at(index);\n }\n\n /**\n * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or\n * its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredCodeHashAt(address registrant, uint256 index) external view returns (bytes32) {\n address registration = _registrations[registrant];\n if (registration != registrant) {\n return _filteredCodeHashes[registration].at(index);\n }\n return _filteredCodeHashes[registrant].at(index);\n }\n\n /**\n * @dev Convenience method to compute the code hash of an arbitrary contract\n */\n function codeHashOf(address a) external view returns (bytes32) {\n return a.codehash;\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-operator-filter/contracts/mock/MockOperatorFilterSubscription.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IOperatorFilterRegistry} from \"operator-filter-registry/src/IOperatorFilterRegistry.sol\";\nimport {Ownable2Step} from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\n\n/**\n * @title OwnedRegistrant\n * @notice Ownable contract that registers itself with the OperatorFilterRegistry and administers its own entries,\n * to facilitate a subscription whose ownership can be transferred.\n */\n\ncontract MockOperatorFilterSubscription is Ownable2Step {\n address public constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);\n\n /// @dev The constructor that is called when the contract is being deployed.\n /// @dev This contract is based on OpenSea's OwnedRegistrant.\n /// @dev The param _localRegistry has been added to the constructor to enable local testing.\n constructor(address _owner, address _localRegistry) {\n IOperatorFilterRegistry(_localRegistry).registerAndCopyEntries(address(this), DEFAULT_SUBSCRIPTION);\n transferOwnership(_owner);\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {IOperatorFilterRegistry} from \"./interfaces/IOperatorFilterRegistry.sol\";\n\n///@title OperatorFiltererUpgradeable\n///@author The SandBox\n///@notice This contract would subscibe or copy or just to the subscription provided or just register to default subscription list. The operator filter registry's addess could be set using a setter which could be implemented in inherting contract\nabstract contract OperatorFiltererUpgradeable is Initializable {\n IOperatorFilterRegistry public operatorFilterRegistry;\n\n function __OperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe) internal onlyInitializing {\n operatorFilterRegistry = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); // Address of the operator filterer registry\n // If an inheriting token contract is deployed to a network without the registry deployed, the modifier\n // will not revert, but the contract will need to be registered with the registry once it is deployed in\n // order for the modifier to filter addresses.\n _registerAndSubscribe(subscriptionOrRegistrantToCopy, subscribe);\n }\n\n function _registerAndSubscribe(address subscriptionOrRegistrantToCopy, bool subscribe) internal {\n if (address(operatorFilterRegistry).code.length > 0) {\n if (!operatorFilterRegistry.isRegistered(address(this))) {\n if (subscribe) {\n operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);\n } else {\n if (subscriptionOrRegistrantToCopy != address(0)) {\n operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);\n } else {\n operatorFilterRegistry.register(address(this));\n }\n }\n }\n }\n }\n\n modifier onlyAllowedOperator(address from) virtual {\n // Check registry code length to facilitate testing in environments without a deployed registry.\n if (address(operatorFilterRegistry).code.length > 0) {\n // Allow spending tokens from addresses with balance\n // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred\n // from an EOA.\n if (from == msg.sender) {\n _;\n return;\n }\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), msg.sender)) {\n revert(\"Operator Not Allowed\");\n }\n }\n _;\n }\n\n modifier onlyAllowedOperatorApproval(address operator) virtual {\n // Check registry code length to facilitate testing in environments without a deployed registry.\n if (address(operatorFilterRegistry).code.length > 0) {\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), operator)) {\n revert(\"Operator Not Allowed\");\n }\n }\n _;\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IERC20Approve.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IERC20Approve {\n function approve(address spender, uint256 amount) external returns (bool);\n\n function increaseAllowance(address spender, uint256 amount) external returns (bool);\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IMultiRoyaltyDistributor.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {IMultiRoyaltyRecipients} from \"./IMultiRoyaltyRecipients.sol\";\nimport {\n IRoyaltySplitter,\n Recipient\n} from \"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\";\n\n/**\n * Multi-receiver EIP2981 reference override implementation\n */\ninterface IMultiRoyaltyDistributor is IERC165, IMultiRoyaltyRecipients {\n event TokenRoyaltyRemoved(uint256 tokenId);\n event TokenRoyaltySet(uint256 tokenId, address recipient);\n event DefaultRoyaltyBpsSet(uint16 royaltyBPS);\n\n event DefaultRoyaltyReceiverSet(address recipient);\n\n event RoyaltyRecipientSet(address splitter, address recipient);\n\n struct TokenRoyaltyConfig {\n uint256 tokenId;\n uint16 royaltyBPS;\n Recipient[] recipients;\n }\n\n /**\n * @dev Set per token royalties. Passing a recipient of address(0) will delete any existing configuration\n */\n function setTokenRoyalties(\n uint256 tokenId,\n address payable recipient,\n address creator\n ) external;\n\n /**\n * @dev Get all token royalty configurations\n */\n function getTokenRoyalties() external view returns (TokenRoyaltyConfig[] memory);\n\n /**\n * @dev Helper function to get all splits contracts\n */\n function getAllSplits() external view returns (address payable[] memory);\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IMultiRoyaltyRecipients.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Recipient} from \"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\";\n\n/**\n * Multi-receiver EIP2981 reference override implementation\n */\ninterface IMultiRoyaltyRecipients is IERC165 {\n /**\n * @dev Helper function to get all recipients\n */\n function getRecipients(uint256 tokenId) external view returns (Recipient[] memory);\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {Recipient} from \"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\";\n\ninterface IRoyaltyManager {\n event RecipientSet(address commonRecipient);\n\n event SplitSet(uint16 commonSplit);\n\n event RoyaltySet(uint16 royaltyBps, address contractAddress);\n\n function setRecipient(address payable _commonRecipient) external;\n\n function setSplit(uint16 commonSplit) external;\n\n function getCommonRecipient() external view returns (Recipient memory recipient);\n\n function getCreatorSplit() external view returns (uint16);\n\n function getRoyaltyInfo() external view returns (address payable, uint16);\n\n function deploySplitter(address creator, address payable recipient) external returns (address payable);\n\n function getCreatorRoyaltySplitter(address creator) external view returns (address payable);\n\n function getContractRoyalty(address _contractAddress) external view returns (uint16 royaltyBps);\n\n function setTrustedForwarder(address _newForwarder) external;\n\n function getTrustedForwarder() external view returns (address);\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyUGC.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IRoyaltyUGC {\n function getCreatorAddress(uint256 tokenId) external pure returns (address creator);\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/mock/FallbackRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {FallbackRegistry} from \"@manifoldxyz/royalty-registry-solidity/contracts/FallbackRegistry.sol\";\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/mock/MockMarketplace.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC2981} from \"@openzeppelin/contracts/interfaces/IERC2981.sol\";\nimport {IERC1155} from \"@openzeppelin/contracts/interfaces/IERC1155.sol\";\nimport {IERC721} from \"@openzeppelin/contracts/interfaces/IERC721.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/interfaces/IERC20.sol\";\nimport {IRoyaltyEngineV1} from \"@manifoldxyz/royalty-registry-solidity/contracts/IRoyaltyEngineV1.sol\";\n\ncontract MockMarketplace {\n IRoyaltyEngineV1 public royaltyEngine;\n\n constructor(address _royaltyEngine) {\n royaltyEngine = IRoyaltyEngineV1(_royaltyEngine);\n }\n\n function distributeRoyaltyEIP2981(\n uint256 erc20TokenAmount,\n IERC20 erc20Contract,\n address nftContract,\n uint256 nftId,\n address nftBuyer,\n address nftSeller,\n bool is1155\n ) external payable {\n if (msg.value == 0) {\n require(erc20TokenAmount > 0, \"erc20 token ammount can't be zero\");\n (address royaltyReceiver, uint256 value) = IERC2981(nftContract).royaltyInfo(nftId, erc20TokenAmount);\n erc20Contract.transferFrom(nftBuyer, royaltyReceiver, value);\n erc20Contract.transferFrom(nftBuyer, nftSeller, (erc20TokenAmount - value));\n } else {\n (address royaltyReceiver, uint256 value) = IERC2981(nftContract).royaltyInfo(nftId, msg.value);\n (bool sent, ) = royaltyReceiver.call{value: value}(\"\");\n require(sent, \"Failed to send distributeRoyaltyEIP2981Ether\");\n (bool sentToSeller, ) = nftSeller.call{value: msg.value - value}(\"\");\n require(sentToSeller, \"Failed to send to seller\");\n }\n if (is1155) {\n IERC1155(nftContract).safeTransferFrom(nftSeller, nftBuyer, nftId, 1, \"0x\");\n } else {\n IERC721(nftContract).safeTransferFrom(nftSeller, nftBuyer, nftId, \"0x\");\n }\n }\n\n function distributeRoyaltyRoyaltyEngine(\n uint256 erc20TokenAmount,\n IERC20 erc20Contract,\n address nftContract,\n uint256 nftId,\n address nftBuyer,\n address nftSeller,\n bool is1155\n ) external payable {\n if (msg.value == 0) {\n require(erc20TokenAmount > 0, \"erc20 token ammount can't be zero\");\n uint256 TotalRoyalty;\n (address payable[] memory recipients, uint256[] memory amounts) =\n royaltyEngine.getRoyalty(address(nftContract), nftId, erc20TokenAmount);\n for (uint256 i; i < recipients.length; i++) {\n erc20Contract.transferFrom(nftBuyer, recipients[i], amounts[i]);\n TotalRoyalty += amounts[i];\n }\n erc20Contract.transferFrom(nftBuyer, nftSeller, (erc20TokenAmount - TotalRoyalty));\n } else {\n (address payable[] memory recipients, uint256[] memory amounts) =\n royaltyEngine.getRoyalty(address(nftContract), nftId, msg.value);\n uint256 TotalRoyalty;\n for (uint256 i; i < recipients.length; i++) {\n (bool sent, ) = recipients[i].call{value: amounts[i]}(\"\");\n require(sent, \"Failed to send Ether\");\n TotalRoyalty += amounts[i];\n }\n (bool sentToSeller, ) = nftSeller.call{value: msg.value - TotalRoyalty}(\"\");\n require(sentToSeller, \"Failed to send to seller\");\n }\n if (is1155) {\n IERC1155(nftContract).safeTransferFrom(nftSeller, nftBuyer, nftId, 1, \"0x\");\n } else {\n IERC721(nftContract).safeTransferFrom(nftSeller, nftBuyer, nftId, \"0x\");\n }\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/mock/RoyaltyEngineV1.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {RoyaltyEngineV1} from \"@manifoldxyz/royalty-registry-solidity/contracts/RoyaltyEngineV1.sol\";\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/mock/RoyaltyRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {RoyaltyRegistry} from \"@manifoldxyz/royalty-registry-solidity/contracts/RoyaltyRegistry.sol\";\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/mock/TestERC20.sol": { + "content": "// SPDX-License-Identifier: MIT OR Apache-2.0\n/* solhint-disable-next-line no-empty-blocks*/\n\npragma solidity ^0.8.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract TestERC20 is ERC20 {\n /* solhint-disable-next-line no-empty-blocks*/\n constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) {}\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/MultiRoyaltyDistributor.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {ERC165Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\nimport {EnumerableSet} from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport {Clones} from \"@openzeppelin/contracts/proxy/Clones.sol\";\nimport {IMultiRoyaltyDistributor, IMultiRoyaltyRecipients} from \"./interfaces/IMultiRoyaltyDistributor.sol\";\nimport {\n IRoyaltySplitter,\n IERC165\n} from \"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\";\nimport {IEIP2981} from \"@manifoldxyz/royalty-registry-solidity/contracts/specs/IEIP2981.sol\";\nimport {IRoyaltyManager, Recipient} from \"./interfaces/IRoyaltyManager.sol\";\n\n/// @title MultiRoyaltyDistributer\n/// @author The Sandbox\n/// @dev The MultiRoyaltyDistributer contract implements the ERC-2981 and ERC-165 interfaces for a royalty payment system. This payment system can be used to pay royalties to multiple recipients through splitters.\n/// @dev This contract calls to the Royalties manager contract to deploy RoyaltySplitter for a creator to slip its royalty between the creator and Sandbox and use it for every token minted by that creator.\nabstract contract MultiRoyaltyDistributor is IEIP2981, IMultiRoyaltyDistributor, ERC165Upgradeable {\n uint16 internal constant TOTAL_BASIS_POINTS = 10000;\n address public royaltyManager;\n\n mapping(uint256 => address payable) public _tokenRoyaltiesSplitter;\n uint256[] private _tokensWithRoyalties;\n\n function __MultiRoyaltyDistributor_init(address _royaltyManager) internal {\n royaltyManager = _royaltyManager;\n }\n\n /// @notice EIP 165 interface function\n /// @dev used to check the interface implemented\n /// @param interfaceId to be checked for implementation\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC165Upgradeable, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(IEIP2981).interfaceId ||\n interfaceId == type(IMultiRoyaltyDistributor).interfaceId ||\n interfaceId == type(IMultiRoyaltyRecipients).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /// @notice sets token royalty\n /// @dev deploys a splitter if a creator doesn't have one\n /// @param tokenId id of token\n /// @param creator of the token\n function _setTokenRoyalties(\n uint256 tokenId,\n address payable recipient,\n address creator\n ) internal {\n address payable creatorSplitterAddress = IRoyaltyManager(royaltyManager).deploySplitter(creator, recipient);\n _tokenRoyaltiesSplitter[tokenId] = creatorSplitterAddress;\n _tokensWithRoyalties.push(tokenId);\n emit TokenRoyaltySet(tokenId, recipient);\n }\n\n /// @notice Returns royalty receivers and their split of royalty for each token\n /// @return royaltyConfigs receivers and their split array as long as the number of tokens.\n function getTokenRoyalties() external view override returns (TokenRoyaltyConfig[] memory royaltyConfigs) {\n royaltyConfigs = new TokenRoyaltyConfig[](_tokensWithRoyalties.length);\n for (uint256 i; i < _tokensWithRoyalties.length; ++i) {\n TokenRoyaltyConfig memory royaltyConfig;\n uint256 tokenId = _tokensWithRoyalties[i];\n address splitterAddress = _tokenRoyaltiesSplitter[tokenId];\n if (splitterAddress != address(0)) {\n royaltyConfig.recipients = IRoyaltySplitter(splitterAddress).getRecipients();\n }\n royaltyConfig.tokenId = tokenId;\n royaltyConfigs[i] = royaltyConfig;\n }\n }\n\n /// @notice EIP 2981 royalty info function to return the royalty receiver and royalty amount\n /// @param tokenId of the token for which the royalty is needed to be distributed\n /// @param value the amount on which the royalty is calculated\n /// @return address the royalty receiver\n /// @return value the EIP2981 royalty\n function royaltyInfo(uint256 tokenId, uint256 value) public view override returns (address, uint256) {\n (address payable _defaultRoyaltyReceiver, uint16 _defaultRoyaltyBPS) =\n IRoyaltyManager(royaltyManager).getRoyaltyInfo();\n if (_tokenRoyaltiesSplitter[tokenId] != address(0)) {\n return (_tokenRoyaltiesSplitter[tokenId], (value * _defaultRoyaltyBPS) / TOTAL_BASIS_POINTS);\n }\n if (_defaultRoyaltyReceiver != address(0) && _defaultRoyaltyBPS != 0) {\n return (_defaultRoyaltyReceiver, (value * _defaultRoyaltyBPS) / TOTAL_BASIS_POINTS);\n }\n return (address(0), 0);\n }\n\n /// @notice returns the EIP-2981 royalty receiver for each token (i.e. splitters) including the default royalty receiver.\n /// @return splits the royalty receiver's array\n function getAllSplits() external view override returns (address payable[] memory splits) {\n uint256 startingIndex;\n uint256 endingIndex = _tokensWithRoyalties.length;\n (address payable _defaultRoyaltyReceiver, ) = IRoyaltyManager(royaltyManager).getRoyaltyInfo();\n if (_defaultRoyaltyReceiver != address(0)) {\n splits = new address payable[](1 + _tokensWithRoyalties.length);\n splits[0] = _defaultRoyaltyReceiver;\n startingIndex = 1;\n ++endingIndex;\n } else {\n // unreachable in practice\n splits = new address payable[](_tokensWithRoyalties.length);\n }\n for (uint256 i = startingIndex; i < endingIndex; ++i) {\n splits[i] = _tokenRoyaltiesSplitter[_tokensWithRoyalties[i - startingIndex]];\n }\n }\n\n /// @notice returns the royalty recipients for each tokenId.\n /// @dev returns the default address for tokens with no recipients.\n /// @param tokenId is the token id for which the recipient should be returned.\n /// @return addresses of royalty recipient of the token.\n function getRecipients(uint256 tokenId) public view returns (Recipient[] memory) {\n address payable splitterAddress = _tokenRoyaltiesSplitter[tokenId];\n (address payable _defaultRoyaltyReceiver, ) = IRoyaltyManager(royaltyManager).getRoyaltyInfo();\n if (splitterAddress != address(0)) {\n return IRoyaltySplitter(splitterAddress).getRecipients();\n }\n Recipient[] memory defaultRecipient = new Recipient[](1);\n defaultRecipient[0] = Recipient({recipient: _defaultRoyaltyReceiver, bps: TOTAL_BASIS_POINTS});\n return defaultRecipient;\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyDistributor.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC2981Upgradeable} from \"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\";\nimport {IRoyaltyManager} from \"./interfaces/IRoyaltyManager.sol\";\nimport {\n ERC165Upgradeable,\n IERC165Upgradeable\n} from \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\n\ncontract RoyaltyDistributor is IERC2981Upgradeable, ERC165Upgradeable {\n uint16 internal constant TOTAL_BASIS_POINTS = 10000;\n IRoyaltyManager public royaltyManager;\n\n function __RoyaltyDistributor_init(address _royaltyManager) internal {\n royaltyManager = IRoyaltyManager(_royaltyManager);\n }\n\n /// @notice Returns how much royalty is owed and to whom based on ERC2981\n /// @dev tokenId is one of the EIP2981 args for this function can't be removed\n /// @param _salePrice the price of token on which the royalty is calculated\n /// @return receiver the receiver of royalty\n /// @return royaltyAmount the amount of royalty\n function royaltyInfo(\n uint256, /*_tokenId */\n uint256 _salePrice\n ) external view returns (address receiver, uint256 royaltyAmount) {\n uint16 royaltyBps;\n (receiver, royaltyBps) = royaltyManager.getRoyaltyInfo();\n royaltyAmount = (_salePrice * royaltyBps) / TOTAL_BASIS_POINTS;\n return (receiver, royaltyAmount);\n }\n\n /// @notice Query if a contract implements interface `id`.\n /// @param interfaceId the interface identifier, as specified in ERC-165.\n /// @return `true` if the contract implements `id`.\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC165Upgradeable, IERC165Upgradeable)\n returns (bool)\n {\n return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol": { + "content": "// SPDX-License-Identifier: MIT OR Apache-2.0\npragma solidity ^0.8.0;\n\nimport {AccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {IRoyaltyManager} from \"./interfaces/IRoyaltyManager.sol\";\nimport {\n IRoyaltySplitter,\n Recipient\n} from \"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\";\nimport {RoyaltySplitter} from \"./RoyaltySplitter.sol\";\nimport {Clones} from \"@openzeppelin/contracts/proxy/Clones.sol\";\n\n/// @title RoyaltyManager\n/// @author The Sandbox\n/// @notice Registry contract to set the common Recipient and Split for the RoyaltySplitter. Also, to set the royalty info\n/// for contracts that don't use the RoyaltySplitter.\ncontract RoyaltyManager is AccessControlUpgradeable, IRoyaltyManager {\n bytes32 public constant CONTRACT_ROYALTY_SETTER_ROLE = keccak256(\"CONTRACT_ROYALTY_SETTER\");\n\n uint16 internal constant TOTAL_BASIS_POINTS = 10000;\n uint16 public commonSplit;\n address payable public commonRecipient;\n mapping(address => uint16) public contractRoyalty;\n mapping(address => address payable) public _creatorRoyaltiesSplitter;\n address internal _royaltySplitterCloneable;\n address internal _trustedForwarder;\n\n /// @notice initialization function for the deployment of contract\n /// @dev called during the deployment via the proxy.\n /// @param _commonRecipient the != address(0)common recipient for all the splitters\n /// @param _commonSplit split for the common recipient's and creator split would be 10000 - commonSplit\n /// @param royaltySplitterCloneable address of cloneable splitter contract for royalties distribution\n /// @param managerAdmin address of RoyaltyManager contract.\n /// @param contractRoyaltySetter the address of royalty setter of contract.\n /// @param trustedForwarder the trustedForwarder address for royalty splitters to use.\n function initialize(\n address payable _commonRecipient,\n uint16 _commonSplit,\n address royaltySplitterCloneable,\n address managerAdmin,\n address contractRoyaltySetter,\n address trustedForwarder\n ) external initializer {\n _setRecipient(_commonRecipient);\n _setSplit(_commonSplit);\n _grantRole(DEFAULT_ADMIN_ROLE, managerAdmin);\n _grantRole(CONTRACT_ROYALTY_SETTER_ROLE, contractRoyaltySetter);\n _royaltySplitterCloneable = royaltySplitterCloneable;\n _trustedForwarder = trustedForwarder;\n }\n\n /// @notice sets royalty recipient wallet\n /// @dev should be called by the creator. The bps is not set on the splitter as it is set here on manager contract.\n /// @param recipient new recipient wallet.\n function setRoyaltyRecipient(address payable recipient) external {\n address payable creatorSplitterAddress = _creatorRoyaltiesSplitter[msg.sender];\n require(creatorSplitterAddress != address(0), \"Manager: No splitter deployed for the creator\");\n address _recipient = RoyaltySplitter(creatorSplitterAddress)._recipient();\n require(_recipient != recipient, \"Manager: Recipient already set\");\n Recipient[] memory newRecipient = new Recipient[](1);\n newRecipient[0] = Recipient({recipient: recipient, bps: 0});\n RoyaltySplitter(creatorSplitterAddress).setRecipients(newRecipient);\n }\n\n /// @notice sets the common recipient and common split\n /// @dev can only be called by the admin\n /// @param _commonRecipient is the common recipient for all the splitters\n function setRecipient(address payable _commonRecipient) external override onlyRole(DEFAULT_ADMIN_ROLE) {\n _setRecipient(_commonRecipient);\n }\n\n /// @notice sets the trustedForwarder address to be used by the splitters\n /// @dev can only be called by the admin\n /// @param _newForwarder is the new trusted forwarder address\n /// @dev new splitters will be deployed with this setting; existing splitters will have to apply it\n function setTrustedForwarder(address _newForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _trustedForwarder = _newForwarder;\n }\n\n /// @notice sets the common recipient and common split\n /// @dev can only be called by the admin.\n /// @param _commonSplit split for the common recipient and creators split would be 10000 - commonSplit\n function setSplit(uint16 _commonSplit) external override onlyRole(DEFAULT_ADMIN_ROLE) {\n _setSplit(_commonSplit);\n }\n\n /// @notice get the current trustedForwarder address\n function getTrustedForwarder() public view returns (address) {\n return _trustedForwarder;\n }\n\n function _setRecipient(address payable _commonRecipient) internal {\n require(_commonRecipient != address(0), \"Manager: Can't set common recipient to zero address\");\n commonRecipient = _commonRecipient;\n emit RecipientSet(_commonRecipient);\n }\n\n function _setSplit(uint16 _commonSplit) internal {\n require(_commonSplit < TOTAL_BASIS_POINTS, \"Manager: Can't set split greater than the total basis point\");\n commonSplit = _commonSplit;\n emit SplitSet(_commonSplit);\n }\n\n /// @notice called to set the EIP 2981 royalty split\n /// @dev can only be called by contract royalty setter.\n /// @param _royaltyBps the royalty split for the EIP 2981\n function setContractRoyalty(address contractAddress, uint16 _royaltyBps)\n external\n onlyRole(CONTRACT_ROYALTY_SETTER_ROLE)\n {\n require(_royaltyBps < TOTAL_BASIS_POINTS, \"Manager: Royalty can't be greater than Total base points\");\n contractRoyalty[contractAddress] = _royaltyBps;\n emit RoyaltySet(_royaltyBps, contractAddress);\n }\n\n /// @notice to be called by the splitters to get the common recipient and split\n /// @return recipient which has the common recipient and split\n function getCommonRecipient() external view override returns (Recipient memory recipient) {\n recipient = Recipient({recipient: commonRecipient, bps: commonSplit});\n return recipient;\n }\n\n /// @notice deploys splitter for creator\n /// @dev should only called once per creator\n /// @param creator the address of the creator\n /// @param recipient the wallet of the recipient where they would receive their royalty\n /// @return creatorSplitterAddress deployed for a creator\n function deploySplitter(address creator, address payable recipient) external returns (address payable) {\n address payable creatorSplitterAddress = _creatorRoyaltiesSplitter[creator];\n if (creatorSplitterAddress == address(0)) {\n creatorSplitterAddress = payable(Clones.clone(_royaltySplitterCloneable));\n RoyaltySplitter(creatorSplitterAddress).initialize(recipient, address(this));\n _creatorRoyaltiesSplitter[creator] = creatorSplitterAddress;\n }\n return creatorSplitterAddress;\n }\n\n /// @notice returns the address of splitter of a creator.\n /// @param creator the address of the creator\n /// @return creatorSplitterAddress deployed for a creator\n function getCreatorRoyaltySplitter(address creator) external view returns (address payable) {\n return _creatorRoyaltiesSplitter[creator];\n }\n\n /// @notice to be called by the splitters to get the common recipient and split\n /// @return creatorSplit which is 10000 - commonSplit\n function getCreatorSplit() external view returns (uint16) {\n return TOTAL_BASIS_POINTS - commonSplit;\n }\n\n /// @notice returns the commonRecipient and EIP2981 royalty split\n /// @return commonRecipient\n /// @return royaltySplit\n function getRoyaltyInfo() external view returns (address payable, uint16) {\n return (commonRecipient, contractRoyalty[msg.sender]);\n }\n\n /// @notice returns the commonRecipient and EIP2981 royalty split\n /// @param _contractAddress the address of the contract for which the royalty is required.\n /// @return royaltyBps royalty bps of the contarct\n function getContractRoyalty(address _contractAddress) external view returns (uint16 royaltyBps) {\n return contractRoyalty[_contractAddress];\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol": { + "content": "// SPDX-License-Identifier: MIT OR Apache-2.0\npragma solidity ^0.8.0;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {\n OwnableUpgradeable,\n ContextUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {AddressUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport {ERC165Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\nimport {SafeMath} from \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {BytesLibrary} from \"@manifoldxyz/royalty-registry-solidity/contracts/libraries/BytesLibrary.sol\";\nimport {\n IRoyaltySplitter,\n IERC165,\n Recipient\n} from \"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\";\nimport {\n ERC2771HandlerAbstract\n} from \"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\";\nimport {IRoyaltyManager} from \"./interfaces/IRoyaltyManager.sol\";\nimport {IERC20Approve} from \"./interfaces/IERC20Approve.sol\";\n\n/// @title RoyaltySplitter\n/// @author The Sandbox\n/// @notice RoyaltySplitter contract is deployed by the RoyaltyManager contract for a creator to get his royalty's share.\ncontract RoyaltySplitter is\n Initializable,\n OwnableUpgradeable,\n IRoyaltySplitter,\n ERC165Upgradeable,\n ERC2771HandlerAbstract\n{\n using BytesLibrary for bytes;\n using AddressUpgradeable for address payable;\n using AddressUpgradeable for address;\n using SafeMath for uint256;\n\n uint256 internal constant TOTAL_BASIS_POINTS = 10000;\n uint256 internal constant IERC20_APPROVE_SELECTOR =\n 0x095ea7b300000000000000000000000000000000000000000000000000000000;\n uint256 internal constant SELECTOR_MASK = 0xffffffff00000000000000000000000000000000000000000000000000000000;\n\n address payable public _recipient;\n IRoyaltyManager public _royaltyManager;\n\n event ETHTransferred(address indexed account, uint256 amount);\n event ERC20Transferred(address indexed erc20Contract, address indexed account, uint256 amount);\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(IERC165, ERC165Upgradeable)\n returns (bool)\n {\n return interfaceId == type(IRoyaltySplitter).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /// @notice initialize the contract\n /// @dev can only be run once.\n /// @param recipient the wallet of the creator when the contract is deployed\n /// @param royaltyManager the address of the royalty manager contract\n function initialize(address payable recipient, address royaltyManager) public initializer {\n _royaltyManager = IRoyaltyManager(royaltyManager); // set manager before Ownable_init for _isTrustedForwarder\n _recipient = recipient;\n __Ownable_init();\n }\n\n /// @notice sets recipient for the splitter\n /// @dev only the owner can call this.\n /// @param recipients the array of recipients which should only have one recipient.\n function setRecipients(Recipient[] calldata recipients) external override onlyOwner {\n _setRecipients(recipients);\n }\n\n function _setRecipients(Recipient[] calldata recipients) private {\n delete _recipient;\n require(recipients.length == 1, \"Invalid recipents length\");\n _recipient = recipients[0].recipient;\n }\n\n /// @notice to get recipients of royalty through this splitter and their splits of royalty.\n /// @return recipients of royalty through this splitter and their splits of royalty.\n function getRecipients() external view override returns (Recipient[] memory) {\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\n uint16 creatorSplit = _royaltyManager.getCreatorSplit();\n Recipient[] memory recipients = new Recipient[](2);\n recipients[0].recipient = _recipient;\n recipients[0].bps = creatorSplit;\n recipients[1] = commonRecipient;\n return recipients;\n }\n\n /// @notice Splits and forwards ETH to the royalty receivers\n /// @dev splits ETH every time it is sent to this contract as royalty.\n receive() external payable {\n _splitETH(msg.value);\n }\n\n /// @notice Splits and forwards ETH to the royalty receivers\n /// @dev normally ETH should be split automatically by receive function.\n function splitETH() public payable {\n _splitETH(address(this).balance);\n }\n\n function _splitETH(uint256 value) internal {\n if (value > 0) {\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\n uint16 creatorSplit = _royaltyManager.getCreatorSplit();\n Recipient[] memory _recipients = new Recipient[](2);\n _recipients[0].recipient = _recipient;\n _recipients[0].bps = creatorSplit;\n _recipients[1] = commonRecipient;\n uint256 totalSent;\n uint256 amountToSend;\n unchecked {\n for (uint256 i = _recipients.length - 1; i > 0; i--) {\n Recipient memory recipient = _recipients[i];\n amountToSend = (value * recipient.bps) / TOTAL_BASIS_POINTS;\n totalSent += amountToSend;\n recipient.recipient.sendValue(amountToSend);\n emit ETHTransferred(recipient.recipient, amountToSend);\n }\n // Favor the 1st recipient if there are any rounding issues\n amountToSend = value - totalSent;\n }\n _recipients[0].recipient.sendValue(amountToSend);\n emit ETHTransferred(_recipients[0].recipient, amountToSend);\n }\n }\n\n /// @notice split ERC20 Tokens owned by this contract.\n /// @dev can only be called by one of the recipients\n /// @param erc20Contract the address of the tokens to be split.\n function splitERC20Tokens(IERC20 erc20Contract) public {\n require(_splitERC20Tokens(erc20Contract), \"Split: ERC20 split failed\");\n }\n\n function _splitERC20Tokens(IERC20 erc20Contract) internal returns (bool) {\n try erc20Contract.balanceOf(address(this)) returns (uint256 balance) {\n if (balance == 0) {\n return false;\n }\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\n uint16 creatorSplit = _royaltyManager.getCreatorSplit();\n require(\n commonRecipient.recipient == _msgSender() || _recipient == _msgSender(),\n \"Split: Can only be called by one of the recipients\"\n );\n Recipient[] memory _recipients = new Recipient[](2);\n _recipients[0].recipient = _recipient;\n _recipients[0].bps = creatorSplit;\n _recipients[1] = commonRecipient;\n uint256 amountToSend;\n uint256 totalSent;\n unchecked {\n for (uint256 i = _recipients.length - 1; i > 0; i--) {\n Recipient memory recipient = _recipients[i];\n bool success;\n (success, amountToSend) = balance.tryMul(recipient.bps);\n\n amountToSend /= TOTAL_BASIS_POINTS;\n totalSent += amountToSend;\n try erc20Contract.transfer(recipient.recipient, amountToSend) {\n emit ERC20Transferred(address(erc20Contract), recipient.recipient, amountToSend);\n } catch {\n return false;\n }\n }\n // Favor the 1st recipient if there are any rounding issues\n amountToSend = balance - totalSent;\n }\n try erc20Contract.transfer(_recipients[0].recipient, amountToSend) {\n emit ERC20Transferred(address(erc20Contract), _recipients[0].recipient, amountToSend);\n } catch {\n return false;\n }\n return true;\n } catch {\n return false;\n }\n }\n\n /// @notice made for unexpected scenarios when assets are sent to this contact such that they could be recovered.\n /// @dev first attempts to split ERC20 tokens.\n /// @param target target of the call\n /// @param callData for the call.\n function proxyCall(address payable target, bytes calldata callData) external {\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\n require(\n commonRecipient.recipient == _msgSender() || _recipient == _msgSender(),\n \"Split: Can only be called by one of the recipients\"\n );\n require(\n !callData.startsWith(IERC20Approve.approve.selector) &&\n !callData.startsWith(IERC20Approve.increaseAllowance.selector),\n \"Split: ERC20 tokens must be split\"\n );\n /* solhint-disable-next-line no-empty-blocks*/\n try this.splitERC20Tokens(IERC20(target)) {} catch {}\n target.functionCall(callData);\n }\n\n /// @notice verify whether a forwarder address is the trustedForwarder address, using the manager setting\n /// @dev this function is used to avoid having a trustedForwarder variable inside the splitter\n /// @return bool whether the forwarder is the trusted address\n function _isTrustedForwarder(address forwarder) internal view override(ERC2771HandlerAbstract) returns (bool) {\n return forwarder == _royaltyManager.getTrustedForwarder();\n }\n\n function _msgSender()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (address sender)\n {\n return ERC2771HandlerAbstract._msgSender();\n }\n\n function _msgData()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (bytes calldata)\n {\n return ERC2771HandlerAbstract._msgData();\n }\n}\n" + }, + "operator-filter-registry/src/IOperatorFilterRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\ninterface IOperatorFilterRegistry {\n /**\n * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns\n * true if supplied registrant address is not registered.\n */\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\n\n /**\n * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.\n */\n function register(address registrant) external;\n\n /**\n * @notice Registers an address with the registry and \"subscribes\" to another address's filtered operators and codeHashes.\n */\n function registerAndSubscribe(address registrant, address subscription) external;\n\n /**\n * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another\n * address without subscribing.\n */\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\n\n /**\n * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.\n * Note that this does not remove any filtered addresses or codeHashes.\n * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.\n */\n function unregister(address addr) external;\n\n /**\n * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered.\n */\n function updateOperator(address registrant, address operator, bool filtered) external;\n\n /**\n * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.\n */\n function updateOperators(address registrant, address[] calldata operators, bool filtered) external;\n\n /**\n * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.\n */\n function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;\n\n /**\n * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.\n */\n function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;\n\n /**\n * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous\n * subscription if present.\n * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,\n * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be\n * used.\n */\n function subscribe(address registrant, address registrantToSubscribe) external;\n\n /**\n * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.\n */\n function unsubscribe(address registrant, bool copyExistingEntries) external;\n\n /**\n * @notice Get the subscription address of a given registrant, if any.\n */\n function subscriptionOf(address addr) external returns (address registrant);\n\n /**\n * @notice Get the set of addresses subscribed to a given registrant.\n * Note that order is not guaranteed as updates are made.\n */\n function subscribers(address registrant) external returns (address[] memory);\n\n /**\n * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.\n * Note that order is not guaranteed as updates are made.\n */\n function subscriberAt(address registrant, uint256 index) external returns (address);\n\n /**\n * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.\n */\n function copyEntriesOf(address registrant, address registrantToCopy) external;\n\n /**\n * @notice Returns true if operator is filtered by a given address or its subscription.\n */\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\n\n /**\n * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription.\n */\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\n\n /**\n * @notice Returns true if a codeHash is filtered by a given address or its subscription.\n */\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\n\n /**\n * @notice Returns a list of filtered operators for a given address or its subscription.\n */\n function filteredOperators(address addr) external returns (address[] memory);\n\n /**\n * @notice Returns the set of filtered codeHashes for a given address or its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\n\n /**\n * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or\n * its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\n\n /**\n * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or\n * its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\n\n /**\n * @notice Returns true if an address has registered\n */\n function isRegistered(address addr) external returns (bool);\n\n /**\n * @dev Convenience method to compute the code hash of an arbitrary contract\n */\n function codeHashOf(address addr) external returns (bytes32);\n}\n" + }, + "operator-filter-registry/src/OperatorFilterRegistryErrorsAndEvents.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\ncontract OperatorFilterRegistryErrorsAndEvents {\n /// @notice Emitted when trying to register an address that has no code.\n error CannotFilterEOAs();\n\n /// @notice Emitted when trying to add an address that is already filtered.\n error AddressAlreadyFiltered(address operator);\n\n /// @notice Emitted when trying to remove an address that is not filtered.\n error AddressNotFiltered(address operator);\n\n /// @notice Emitted when trying to add a codehash that is already filtered.\n error CodeHashAlreadyFiltered(bytes32 codeHash);\n\n /// @notice Emitted when trying to remove a codehash that is not filtered.\n error CodeHashNotFiltered(bytes32 codeHash);\n\n /// @notice Emitted when the caller is not the address or EIP-173 \"owner()\"\n error OnlyAddressOrOwner();\n\n /// @notice Emitted when the registrant is not registered.\n error NotRegistered(address registrant);\n\n /// @notice Emitted when the registrant is already registered.\n error AlreadyRegistered();\n\n /// @notice Emitted when the registrant is already subscribed.\n error AlreadySubscribed(address subscription);\n\n /// @notice Emitted when the registrant is not subscribed.\n error NotSubscribed();\n\n /// @notice Emitted when trying to update a registration where the registrant is already subscribed.\n error CannotUpdateWhileSubscribed(address subscription);\n\n /// @notice Emitted when trying to subscribe to itself.\n error CannotSubscribeToSelf();\n\n /// @notice Emitted when trying to subscribe to the zero address.\n error CannotSubscribeToZeroAddress();\n\n /// @notice Emitted when trying to register and the contract is not ownable (EIP-173 \"owner()\")\n error NotOwnable();\n\n /// @notice Emitted when an address is filtered.\n error AddressFiltered(address filtered);\n\n /// @notice Emitted when a codeHash is filtered.\n error CodeHashFiltered(address account, bytes32 codeHash);\n\n /// @notice Emited when trying to register to a registrant with a subscription.\n error CannotSubscribeToRegistrantWithSubscription(address registrant);\n\n /// @notice Emitted when trying to copy a registration from itself.\n error CannotCopyFromSelf();\n\n /// @notice Emitted when a registration is updated.\n event RegistrationUpdated(address indexed registrant, bool indexed registered);\n\n /// @notice Emitted when an operator is updated.\n event OperatorUpdated(address indexed registrant, address indexed operator, bool indexed filtered);\n\n /// @notice Emitted when multiple operators are updated.\n event OperatorsUpdated(address indexed registrant, address[] operators, bool indexed filtered);\n\n /// @notice Emitted when a codeHash is updated.\n event CodeHashUpdated(address indexed registrant, bytes32 indexed codeHash, bool indexed filtered);\n\n /// @notice Emitted when multiple codeHashes are updated.\n event CodeHashesUpdated(address indexed registrant, bytes32[] codeHashes, bool indexed filtered);\n\n /// @notice Emitted when a subscription is updated.\n event SubscriptionUpdated(address indexed registrant, address indexed subscription, bool indexed subscribed);\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 2000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/deploy/deployments/mumbai/solcInputs/e64fd56b3bfae7f817a31de5cae19a1b.json b/packages/deploy/deployments/mumbai/solcInputs/e64fd56b3bfae7f817a31de5cae19a1b.json new file mode 100644 index 0000000000..b17d7d4a2e --- /dev/null +++ b/packages/deploy/deployments/mumbai/solcInputs/e64fd56b3bfae7f817a31de5cae19a1b.json @@ -0,0 +1,242 @@ +{ + "language": "Solidity", + "sources": { + "@manifoldxyz/royalty-registry-solidity/contracts/libraries/BytesLibrary.sol": { + "content": "// SPDX-License-Identifier: MIT OR Apache-2.0\n\npragma solidity ^0.8.0;\n\n/**\n * @notice A library for manipulation of byte arrays.\n */\nlibrary BytesLibrary {\n /**\n * @dev Replace the address at the given location in a byte array if the contents at that location\n * match the expected address.\n */\n function replaceAtIf(bytes memory data, uint256 startLocation, address expectedAddress, address newAddress)\n internal\n pure\n {\n bytes memory expectedData = abi.encodePacked(expectedAddress);\n bytes memory newData = abi.encodePacked(newAddress);\n // An address is 20 bytes long\n for (uint256 i = 0; i < 20; i++) {\n uint256 dataLocation = startLocation + i;\n require(data[dataLocation] == expectedData[i], \"Bytes: Data provided does not include the expectedAddress\");\n data[dataLocation] = newData[i];\n }\n }\n\n /**\n * @dev Checks if the call data starts with the given function signature.\n */\n function startsWith(bytes memory callData, bytes4 functionSig) internal pure returns (bool) {\n // A signature is 4 bytes long\n if (callData.length < 4) {\n return false;\n }\n for (uint256 i = 0; i < 4; i++) {\n if (callData[i] != functionSig[i]) {\n return false;\n }\n }\n\n return true;\n }\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\nstruct Recipient {\n address payable recipient;\n uint16 bps;\n}\n\ninterface IRoyaltySplitter is IERC165 {\n /**\n * @dev Set the splitter recipients. Total bps must total 10000.\n */\n function setRecipients(Recipient[] calldata recipients) external;\n\n /**\n * @dev Get the splitter recipients;\n */\n function getRecipients() external view returns (Recipient[] memory);\n}\n" + }, + "@manifoldxyz/royalty-registry-solidity/contracts/specs/IEIP2981.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * EIP-2981\n */\ninterface IEIP2981 {\n /**\n * bytes4(keccak256(\"royaltyInfo(uint256,uint256)\")) == 0x2a55205a\n *\n * => 0x2a55205a = 0x2a55205a\n */\n function royaltyInfo(uint256 tokenId, uint256 value) external view returns (address, uint256);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n function __AccessControl_init() internal onlyInitializing {\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\n }\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(account),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Interface for the NFT Royalty Standard.\n *\n * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal\n * support for royalty payments across all NFT marketplaces and ecosystem participants.\n *\n * _Available since v4.5._\n */\ninterface IERC2981Upgradeable is IERC165Upgradeable {\n /**\n * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\n * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.\n */\n function royaltyInfo(\n uint256 tokenId,\n uint256 salePrice\n ) external view returns (address receiver, uint256 royaltyAmount);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC5267Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\n\npragma solidity ^0.8.0;\n\ninterface IERC5267Upgradeable {\n /**\n * @dev MAY be emitted to signal that the domain could have changed.\n */\n event EIP712DomainChanged();\n\n /**\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n * signature.\n */\n function eip712Domain()\n external\n view\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n );\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/common/ERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/IERC2981Upgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.\n *\n * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for\n * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.\n *\n * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the\n * fee is specified in basis points by default.\n *\n * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See\n * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to\n * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.\n *\n * _Available since v4.5._\n */\nabstract contract ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable {\n function __ERC2981_init() internal onlyInitializing {\n }\n\n function __ERC2981_init_unchained() internal onlyInitializing {\n }\n struct RoyaltyInfo {\n address receiver;\n uint96 royaltyFraction;\n }\n\n RoyaltyInfo private _defaultRoyaltyInfo;\n mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC165Upgradeable) returns (bool) {\n return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @inheritdoc IERC2981Upgradeable\n */\n function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual override returns (address, uint256) {\n RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId];\n\n if (royalty.receiver == address(0)) {\n royalty = _defaultRoyaltyInfo;\n }\n\n uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator();\n\n return (royalty.receiver, royaltyAmount);\n }\n\n /**\n * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a\n * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an\n * override.\n */\n function _feeDenominator() internal pure virtual returns (uint96) {\n return 10000;\n }\n\n /**\n * @dev Sets the royalty information that all ids in this contract will default to.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator.\n */\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\n require(feeNumerator <= _feeDenominator(), \"ERC2981: royalty fee will exceed salePrice\");\n require(receiver != address(0), \"ERC2981: invalid receiver\");\n\n _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);\n }\n\n /**\n * @dev Removes default royalty information.\n */\n function _deleteDefaultRoyalty() internal virtual {\n delete _defaultRoyaltyInfo;\n }\n\n /**\n * @dev Sets the royalty information for a specific token id, overriding the global default.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator.\n */\n function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {\n require(feeNumerator <= _feeDenominator(), \"ERC2981: royalty fee will exceed salePrice\");\n require(receiver != address(0), \"ERC2981: Invalid parameters\");\n\n _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);\n }\n\n /**\n * @dev Resets royalty information for the token id back to the global default.\n */\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\n delete _tokenRoyaltyInfo[tokenId];\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[48] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC1155Upgradeable.sol\";\nimport \"./IERC1155ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC1155MetadataURIUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the basic standard multi-token.\n * See https://eips.ethereum.org/EIPS/eip-1155\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\n *\n * _Available since v3.1._\n */\ncontract ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155Upgradeable, IERC1155MetadataURIUpgradeable {\n using AddressUpgradeable for address;\n\n // Mapping from token ID to account balances\n mapping(uint256 => mapping(address => uint256)) private _balances;\n\n // Mapping from account to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json\n string private _uri;\n\n /**\n * @dev See {_setURI}.\n */\n function __ERC1155_init(string memory uri_) internal onlyInitializing {\n __ERC1155_init_unchained(uri_);\n }\n\n function __ERC1155_init_unchained(string memory uri_) internal onlyInitializing {\n _setURI(uri_);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC1155Upgradeable).interfaceId ||\n interfaceId == type(IERC1155MetadataURIUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155MetadataURI-uri}.\n *\n * This implementation returns the same URI for *all* token types. It relies\n * on the token type ID substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * Clients calling this function must replace the `\\{id\\}` substring with the\n * actual token type ID.\n */\n function uri(uint256) public view virtual override returns (string memory) {\n return _uri;\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {\n require(account != address(0), \"ERC1155: address zero is not a valid owner\");\n return _balances[id][account];\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(accounts.length == ids.length, \"ERC1155: accounts and ids length mismatch\");\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeTransferFrom(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n\n emit TransferSingle(operator, from, to, id, amount);\n\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n }\n\n emit TransferBatch(operator, from, to, ids, amounts);\n\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);\n }\n\n /**\n * @dev Sets a new URI for all token types, by relying on the token type ID\n * substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * By this mechanism, any occurrence of the `\\{id\\}` substring in either the\n * URI or any of the amounts in the JSON file at said URI will be replaced by\n * clients with the token type ID.\n *\n * For example, the `https://token-cdn-domain/\\{id\\}.json` URI would be\n * interpreted by clients as\n * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\n * for token type ID 0x4cce0.\n *\n * See {uri}.\n *\n * Because these URIs cannot be meaningfully represented by the {URI} event,\n * this function emits no events.\n */\n function _setURI(string memory newuri) internal virtual {\n _uri = newuri;\n }\n\n /**\n * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _balances[id][to] += amount;\n emit TransferSingle(operator, address(0), to, id, amount);\n\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; i++) {\n _balances[ids[i]][to] += amounts[i];\n }\n\n emit TransferBatch(operator, address(0), to, ids, amounts);\n\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);\n }\n\n /**\n * @dev Destroys `amount` tokens of token type `id` from `from`\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `from` must have at least `amount` tokens of token type `id`.\n */\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n\n emit TransferSingle(operator, from, address(0), id, amount);\n\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n */\n function _burnBatch(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n for (uint256 i = 0; i < ids.length; i++) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n }\n\n emit TransferBatch(operator, from, address(0), ids, amounts);\n\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC1155: setting approval status for self\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `ids` and `amounts` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `id` and `amount` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155ReceiverUpgradeable(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {\n if (response != IERC1155ReceiverUpgradeable.onERC1155Received.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (\n bytes4 response\n ) {\n if (response != IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n }\n }\n }\n\n function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {\n uint256[] memory array = new uint256[](1);\n array[0] = element;\n\n return array;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[47] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/extensions/ERC1155Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of {ERC1155} that allows token holders to destroy both their\n * own tokens and those that they have been approved to use.\n *\n * _Available since v3.1._\n */\nabstract contract ERC1155BurnableUpgradeable is Initializable, ERC1155Upgradeable {\n function __ERC1155Burnable_init() internal onlyInitializing {\n }\n\n function __ERC1155Burnable_init_unchained() internal onlyInitializing {\n }\n function burn(address account, uint256 id, uint256 value) public virtual {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n\n _burn(account, id, value);\n }\n\n function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n\n _burnBatch(account, ids, values);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of ERC1155 that adds tracking of total supply per id.\n *\n * Useful for scenarios where Fungible and Non-fungible tokens have to be\n * clearly identified. Note: While a totalSupply of 1 might mean the\n * corresponding is an NFT, there is no guarantees that no other token with the\n * same id are not going to be minted.\n */\nabstract contract ERC1155SupplyUpgradeable is Initializable, ERC1155Upgradeable {\n function __ERC1155Supply_init() internal onlyInitializing {\n }\n\n function __ERC1155Supply_init_unchained() internal onlyInitializing {\n }\n mapping(uint256 => uint256) private _totalSupply;\n\n /**\n * @dev Total amount of tokens in with a given id.\n */\n function totalSupply(uint256 id) public view virtual returns (uint256) {\n return _totalSupply[id];\n }\n\n /**\n * @dev Indicates whether any token exist with a given id, or not.\n */\n function exists(uint256 id) public view virtual returns (bool) {\n return ERC1155SupplyUpgradeable.totalSupply(id) > 0;\n }\n\n /**\n * @dev See {ERC1155-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n if (from == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n _totalSupply[ids[i]] += amounts[i];\n }\n }\n\n if (to == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n uint256 supply = _totalSupply[id];\n require(supply >= amount, \"ERC1155: burn amount exceeds totalSupply\");\n unchecked {\n _totalSupply[id] = supply - amount;\n }\n }\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155URIStorage.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../../utils/StringsUpgradeable.sol\";\nimport \"../ERC1155Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev ERC1155 token with storage based token URI management.\n * Inspired by the ERC721URIStorage extension\n *\n * _Available since v4.6._\n */\nabstract contract ERC1155URIStorageUpgradeable is Initializable, ERC1155Upgradeable {\n function __ERC1155URIStorage_init() internal onlyInitializing {\n __ERC1155URIStorage_init_unchained();\n }\n\n function __ERC1155URIStorage_init_unchained() internal onlyInitializing {\n _baseURI = \"\";\n }\n using StringsUpgradeable for uint256;\n\n // Optional base URI\n string private _baseURI;\n\n // Optional mapping for token URIs\n mapping(uint256 => string) private _tokenURIs;\n\n /**\n * @dev See {IERC1155MetadataURI-uri}.\n *\n * This implementation returns the concatenation of the `_baseURI`\n * and the token-specific uri if the latter is set\n *\n * This enables the following behaviors:\n *\n * - if `_tokenURIs[tokenId]` is set, then the result is the concatenation\n * of `_baseURI` and `_tokenURIs[tokenId]` (keep in mind that `_baseURI`\n * is empty per default);\n *\n * - if `_tokenURIs[tokenId]` is NOT set then we fallback to `super.uri()`\n * which in most cases will contain `ERC1155._uri`;\n *\n * - if `_tokenURIs[tokenId]` is NOT set, and if the parents do not have a\n * uri value set, then the result is empty.\n */\n function uri(uint256 tokenId) public view virtual override returns (string memory) {\n string memory tokenURI = _tokenURIs[tokenId];\n\n // If token URI is set, concatenate base URI and tokenURI (via abi.encodePacked).\n return bytes(tokenURI).length > 0 ? string(abi.encodePacked(_baseURI, tokenURI)) : super.uri(tokenId);\n }\n\n /**\n * @dev Sets `tokenURI` as the tokenURI of `tokenId`.\n */\n function _setURI(uint256 tokenId, string memory tokenURI) internal virtual {\n _tokenURIs[tokenId] = tokenURI;\n emit URI(uri(tokenId), tokenId);\n }\n\n /**\n * @dev Sets `baseURI` as the `_baseURI` for all tokens\n */\n function _setBaseURI(string memory baseURI) internal virtual {\n _baseURI = baseURI;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[48] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/IERC1155MetadataURIUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Upgradeable.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURIUpgradeable is IERC1155Upgradeable {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155ReceiverUpgradeable is IERC165Upgradeable {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n mstore(0x1c, hash)\n message := keccak256(0x00, 0x3c)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, \"\\x19\\x01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n data := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\n * `validator` and `data` according to the version 0 of EIP-191.\n *\n * See {recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.8;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../interfaces/IERC5267Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 52\n */\nabstract contract EIP712Upgradeable is Initializable, IERC5267Upgradeable {\n bytes32 private constant _TYPE_HASH =\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /// @custom:oz-renamed-from _HASHED_NAME\n bytes32 private _hashedName;\n /// @custom:oz-renamed-from _HASHED_VERSION\n bytes32 private _hashedVersion;\n\n string private _name;\n string private _version;\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n _name = name;\n _version = version;\n\n // Reset prior values in storage if upgrading\n _hashedName = 0;\n _hashedVersion = 0;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator();\n }\n\n function _buildDomainSeparator() private view returns (bytes32) {\n return keccak256(abi.encode(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev See {EIP-5267}.\n *\n * _Available since v4.9._\n */\n function eip712Domain()\n public\n view\n virtual\n override\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n )\n {\n // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized\n // and the EIP712 domain is not reliable, as it will be missing name and version.\n require(_hashedName == 0 && _hashedVersion == 0, \"EIP712: Uninitialized\");\n\n return (\n hex\"0f\", // 01111\n _EIP712Name(),\n _EIP712Version(),\n block.chainid,\n address(this),\n bytes32(0),\n new uint256[](0)\n );\n }\n\n /**\n * @dev The name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712Name() internal virtual view returns (string memory) {\n return _name;\n }\n\n /**\n * @dev The version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712Version() internal virtual view returns (string memory) {\n return _version;\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.\n */\n function _EIP712NameHash() internal view returns (bytes32) {\n string memory name = _EIP712Name();\n if (bytes(name).length > 0) {\n return keccak256(bytes(name));\n } else {\n // If the name is empty, the contract may have been upgraded without initializing the new storage.\n // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.\n bytes32 hashedName = _hashedName;\n if (hashedName != 0) {\n return hashedName;\n } else {\n return keccak256(\"\");\n }\n }\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.\n */\n function _EIP712VersionHash() internal view returns (bytes32) {\n string memory version = _EIP712Version();\n if (bytes(version).length > 0) {\n return keccak256(bytes(version));\n } else {\n // If the version is empty, the contract may have been upgraded without initializing the new storage.\n // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.\n bytes32 hashedVersion = _hashedVersion;\n if (hashedVersion != 0) {\n return hashedVersion;\n } else {\n return keccak256(\"\");\n }\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[48] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "@openzeppelin/contracts/access/AccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(account),\n \" is missing role \",\n Strings.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/IAccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts/proxy/Clones.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary Clones {\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create opcode, which should never revert.\n */\n function clone(address implementation) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create(0, 0x09, 0x37)\n }\n require(instance != address(0), \"ERC1167: create failed\");\n }\n\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create2 opcode and a `salt` to deterministically deploy\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n * the clones cannot be deployed twice at the same address.\n */\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create2(0, 0x09, 0x37, salt)\n }\n require(instance != address(0), \"ERC1167: create2 failed\");\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt,\n address deployer\n ) internal pure returns (address predicted) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(add(ptr, 0x38), deployer)\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n mstore(add(ptr, 0x14), implementation)\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n mstore(add(ptr, 0x58), salt)\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n predicted := keccak256(add(ptr, 0x43), 0x55)\n }\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt\n ) internal view returns (address predicted) {\n return predictDeterministicAddress(implementation, salt, address(this));\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n mstore(0x1c, hash)\n message := keccak256(0x00, 0x3c)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, \"\\x19\\x01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n data := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\n * `validator` and `data` according to the version 0 of EIP-191.\n *\n * See {recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/Asset.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\nimport {\n AccessControlUpgradeable,\n ContextUpgradeable,\n IAccessControlUpgradeable,\n IERC165Upgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {\n ERC1155BurnableUpgradeable,\n ERC1155Upgradeable,\n IERC1155Upgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol\";\nimport {\n ERC1155SupplyUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol\";\nimport {\n ERC1155URIStorageUpgradeable,\n IERC1155MetadataURIUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {IERC1155} from \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {\n ERC2771HandlerUpgradeable,\n ERC2771HandlerAbstract\n} from \"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\";\nimport {\n MultiRoyaltyDistributor\n} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/MultiRoyaltyDistributor.sol\";\nimport {\n OperatorFiltererUpgradeable,\n IOperatorFilterRegistry\n} from \"@sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol\";\nimport {TokenIdUtils} from \"./libraries/TokenIdUtils.sol\";\nimport {IAsset} from \"./interfaces/IAsset.sol\";\nimport {ITokenUtils, IRoyaltyUGC} from \"./interfaces/ITokenUtils.sol\";\n\ncontract Asset is\n IAsset,\n Initializable,\n ERC2771HandlerUpgradeable,\n ERC1155BurnableUpgradeable,\n AccessControlUpgradeable,\n ERC1155SupplyUpgradeable,\n ERC1155URIStorageUpgradeable,\n OperatorFiltererUpgradeable,\n MultiRoyaltyDistributor,\n ITokenUtils\n{\n using TokenIdUtils for uint256;\n\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant BURNER_ROLE = keccak256(\"BURNER_ROLE\");\n bytes32 public constant MODERATOR_ROLE = keccak256(\"MODERATOR_ROLE\");\n\n // mapping of ipfs metadata token hash to token id\n mapping(string => uint256) public hashUsed;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(\n address forwarder,\n address assetAdmin,\n string memory baseUri,\n address commonSubscription,\n address _manager\n ) external initializer {\n _setBaseURI(baseUri);\n __AccessControl_init();\n __ERC1155Supply_init();\n __ERC2771Handler_init(forwarder);\n __ERC1155Burnable_init();\n _grantRole(DEFAULT_ADMIN_ROLE, assetAdmin);\n __OperatorFilterer_init(commonSubscription, true);\n __MultiRoyaltyDistributor_init(_manager);\n }\n\n /// @notice Mint new tokens\n /// @dev Only callable by the minter role\n /// @param to The address of the recipient\n /// @param id The id of the token to mint\n /// @param amount The amount of the token to mint\n function mint(\n address to,\n uint256 id,\n uint256 amount,\n string memory metadataHash\n ) external onlyRole(MINTER_ROLE) {\n _setMetadataHash(id, metadataHash);\n _mint(to, id, amount, \"\");\n address creator = id.getCreatorAddress();\n _setTokenRoyalties(id, payable(creator), creator);\n }\n\n /// @notice Mint new tokens with catalyst tier chosen by the creator\n /// @dev Only callable by the minter role\n /// @param to The address of the recipient\n /// @param ids The ids of the tokens to mint\n /// @param amounts The amounts of the tokens to mint\n function mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n string[] memory metadataHashes\n ) external onlyRole(MINTER_ROLE) {\n require(ids.length == metadataHashes.length, \"Asset: ids and metadataHash length mismatch\");\n require(ids.length == amounts.length, \"Asset: ids and amounts length mismatch\");\n for (uint256 i = 0; i < ids.length; i++) {\n _setMetadataHash(ids[i], metadataHashes[i]);\n }\n _mintBatch(to, ids, amounts, \"\");\n for (uint256 i; i < ids.length; i++) {\n address creator = ids[i].getCreatorAddress();\n _setTokenRoyalties(ids[i], payable(creator), creator);\n }\n }\n\n /// @notice Burn a token from a given account\n /// @dev Only the minter role can burn tokens\n /// @dev This function was added with token recycling and bridging in mind but may have other use cases\n /// @param account The account to burn tokens from\n /// @param id The token id to burn\n /// @param amount The amount of tokens to burn\n function burnFrom(\n address account,\n uint256 id,\n uint256 amount\n ) external onlyRole(BURNER_ROLE) {\n _burn(account, id, amount);\n }\n\n /// @notice Burn a batch of tokens from a given account\n /// @dev Only the minter role can burn tokens\n /// @dev This function was added with token recycling and bridging in mind but may have other use cases\n /// @dev The length of the ids and amounts arrays must be the same\n /// @param account The account to burn tokens from\n /// @param ids An array of token ids to burn\n /// @param amounts An array of amounts of tokens to burn\n function burnBatchFrom(\n address account,\n uint256[] memory ids,\n uint256[] memory amounts\n ) external onlyRole(BURNER_ROLE) {\n _burnBatch(account, ids, amounts);\n }\n\n /// @notice Set a new URI for specific tokenid\n /// @dev The metadata hash should be the IPFS CIDv1 base32 encoded hash\n /// @param tokenId The token id to set URI for\n /// @param metadata The new URI for asset's metadata\n function setTokenURI(uint256 tokenId, string memory metadata) external onlyRole(MODERATOR_ROLE) {\n _setURI(tokenId, metadata);\n }\n\n /// @notice Set a new base URI\n /// @param baseURI The new base URI\n function setBaseURI(string memory baseURI) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _setBaseURI(baseURI);\n }\n\n /// @notice returns full token URI, including baseURI and token metadata URI\n /// @param tokenId The token id to get URI for\n /// @return tokenURI the URI of the token\n function uri(uint256 tokenId)\n public\n view\n override(ERC1155Upgradeable, ERC1155URIStorageUpgradeable)\n returns (string memory)\n {\n return ERC1155URIStorageUpgradeable.uri(tokenId);\n }\n\n function getTokenIdByMetadataHash(string memory metadataHash) public view returns (uint256) {\n return hashUsed[metadataHash];\n }\n\n function _setMetadataHash(uint256 tokenId, string memory metadataHash) internal {\n if (hashUsed[metadataHash] != 0) {\n require(hashUsed[metadataHash] == tokenId, \"Asset: not allowed to reuse metadata hash\");\n } else {\n hashUsed[metadataHash] = tokenId;\n _setURI(tokenId, metadataHash);\n }\n }\n\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(trustedForwarder != address(0), \"Asset: trusted forwarder can't be zero address\");\n _setTrustedForwarder(trustedForwarder);\n }\n\n /// @notice Query if a contract implements interface `id`.\n /// @param id the interface identifier, as specified in ERC-165.\n /// @return `true` if the contract implements `id`.\n function supportsInterface(bytes4 id)\n public\n view\n virtual\n override(ERC1155Upgradeable, AccessControlUpgradeable, MultiRoyaltyDistributor)\n returns (bool)\n {\n return id == type(IRoyaltyUGC).interfaceId || super.supportsInterface(id);\n }\n\n function _msgSender()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (address sender)\n {\n return ERC2771HandlerAbstract._msgSender();\n }\n\n function _msgData()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (bytes calldata)\n {\n return ERC2771HandlerAbstract._msgData();\n }\n\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @dev call data should be optimized to order ids so packedBalance can be used efficiently.\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param amounts amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override onlyAllowedOperator(from) {\n super.safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /// @notice Enable or disable approval for `operator` to manage all of the caller's tokens.\n /// @param operator address which will be granted rights to transfer all tokens of the caller.\n /// @param approved whether to approve or revoke\n function setApprovalForAll(address operator, bool approved)\n public\n virtual\n override\n onlyAllowedOperatorApproval(operator)\n {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param amount amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override onlyAllowedOperator(from) {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeTransferFrom(from, to, id, amount, data);\n }\n\n /// @notice could be used to deploy splitter and set tokens royalties\n /// @param tokenId the id of the token for which the EIP2981 royalty is set for.\n /// @param recipient the royalty recipient for the splitter of the creator.\n /// @param creator the creactor of the tokens.\n function setTokenRoyalties(\n uint256 tokenId,\n address payable recipient,\n address creator\n ) external override onlyRole(DEFAULT_ADMIN_ROLE) {\n _setTokenRoyalties(tokenId, recipient, creator);\n }\n\n /// @notice Extracts the creator address from a given token id\n /// @param tokenId The token id to extract the creator address from\n /// @return creator The asset creator address\n function getCreatorAddress(uint256 tokenId) external pure returns (address creator) {\n return TokenIdUtils.getCreatorAddress(tokenId);\n }\n\n /// @notice Extracts the tier from a given token id\n /// @param tokenId The token id to extract the tier from\n /// @return tier The asset tier, determined by the catalyst used to create it\n function getTier(uint256 tokenId) external pure returns (uint8 tier) {\n return TokenIdUtils.getTier(tokenId);\n }\n\n /// @notice Extracts the revealed flag from a given token id\n /// @param tokenId The token id to extract the revealed flag from\n /// @return isRevealed Whether the asset is revealed or not\n function isRevealed(uint256 tokenId) external pure returns (bool) {\n return TokenIdUtils.isRevealed(tokenId);\n }\n\n /// @notice Extracts the asset nonce from a given token id\n /// @param tokenId The token id to extract the asset nonce from\n /// @return creatorNonce The asset creator nonce\n function getCreatorNonce(uint256 tokenId) external pure returns (uint16) {\n return TokenIdUtils.getCreatorNonce(tokenId);\n }\n\n /// @notice Extracts the abilities and enhancements hash from a given token id\n /// @param tokenId The token id to extract reveal nonce from\n /// @return revealNonce The reveal nonce of the asset\n function getRevealNonce(uint256 tokenId) external pure returns (uint16) {\n return TokenIdUtils.getRevealNonce(tokenId);\n }\n\n /// @notice Extracts the bridged flag from a given token id\n /// @param tokenId The token id to extract the bridged flag from\n /// @return bridged Whether the asset is bridged or not\n function isBridged(uint256 tokenId) external pure returns (bool) {\n return TokenIdUtils.isBridged(tokenId);\n }\n\n /// @notice This function is used to register Asset contract on the Operator Filterer Registry of Opensea.can only be called by admin.\n /// @dev used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.\n /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe.\n /// @param subscribe bool to signify subscription \"true\"\" or to copy the list \"false\".\n function registerAndSubscribe(address subscriptionOrRegistrantToCopy, bool subscribe)\n external\n onlyRole(DEFAULT_ADMIN_ROLE)\n {\n require(subscriptionOrRegistrantToCopy != address(0), \"Asset: subscription can't be zero address\");\n _registerAndSubscribe(subscriptionOrRegistrantToCopy, subscribe);\n }\n\n /// @notice sets filter registry address deployed in test\n /// @param registry the address of the registry\n function setOperatorRegistry(address registry) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(registry != address(0), \"Asset: registry can't be zero address\");\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/AssetCreate.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {EIP712Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\";\nimport {\n AccessControlUpgradeable,\n ContextUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {TokenIdUtils} from \"./libraries/TokenIdUtils.sol\";\nimport {AuthSuperValidator} from \"./AuthSuperValidator.sol\";\nimport {\n ERC2771HandlerUpgradeable,\n ERC2771HandlerAbstract\n} from \"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\";\nimport {IAsset} from \"./interfaces/IAsset.sol\";\nimport {ICatalyst} from \"./interfaces/ICatalyst.sol\";\nimport {IAssetCreate} from \"./interfaces/IAssetCreate.sol\";\n\n/// @title AssetCreate\n/// @author The Sandbox\n/// @notice User-facing contract for creating new assets\ncontract AssetCreate is\n IAssetCreate,\n Initializable,\n ERC2771HandlerUpgradeable,\n EIP712Upgradeable,\n AccessControlUpgradeable\n{\n using TokenIdUtils for uint256;\n\n IAsset private assetContract;\n ICatalyst private catalystContract;\n AuthSuperValidator private authValidator;\n\n // mapping of creator address to creator nonce, a nonce is incremented every time a creator mints a new token\n mapping(address => uint16) public creatorNonces;\n mapping(address => uint16) public signatureNonces;\n\n bytes32 public constant SPECIAL_MINTER_ROLE = keccak256(\"SPECIAL_MINTER_ROLE\");\n bytes32 public constant MINT_TYPEHASH =\n keccak256(\"Mint(address creator,uint16 nonce,uint8 tier,uint256 amount,bool revealed,string metadataHash)\");\n bytes32 public constant MINT_BATCH_TYPEHASH =\n keccak256(\n \"MintBatch(address creator,uint16 nonce,uint8[] tiers,uint256[] amounts,bool[] revealed,string[] metadataHashes)\"\n );\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n /// @notice Initialize the contract\n /// @param _assetContract The address of the asset contract\n /// @param _authValidator The address of the AuthSuperValidator contract\n /// @param _forwarder The address of the forwarder contract\n function initialize(\n string memory _name,\n string memory _version,\n address _assetContract,\n address _catalystContract,\n address _authValidator,\n address _forwarder,\n address _defaultAdmin\n ) public initializer {\n assetContract = IAsset(_assetContract);\n catalystContract = ICatalyst(_catalystContract);\n authValidator = AuthSuperValidator(_authValidator);\n __ERC2771Handler_init(_forwarder);\n __EIP712_init(_name, _version);\n __AccessControl_init();\n _grantRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);\n }\n\n /// @notice Create a new asset\n /// @param signature A signature generated by TSB\n /// @param tier The tier of the asset to mint\n /// @param amount The amount of the asset to mint\n /// @param metadataHash The metadata hash of the asset to mint\n function createAsset(\n bytes memory signature,\n uint8 tier,\n uint256 amount,\n bool revealed,\n string calldata metadataHash,\n address creator\n ) external {\n require(\n authValidator.verify(\n signature,\n _hashMint(creator, signatureNonces[_msgSender()]++, tier, amount, revealed, metadataHash)\n ),\n \"Invalid signature\"\n );\n\n uint256 tokenId =\n TokenIdUtils.generateTokenId(creator, tier, ++creatorNonces[creator], revealed ? 1 : 0, false);\n\n // burn catalyst of a given tier\n catalystContract.burnFrom(creator, tier, amount);\n assetContract.mint(creator, tokenId, amount, metadataHash);\n emit AssetMinted(creator, tokenId, tier, amount, metadataHash, revealed);\n }\n\n /// @notice Create multiple assets at once\n /// @param signature A signature generated by TSB\n /// @param tiers The tiers of the assets to mint\n /// @param amounts The amounts of the assets to mint\n /// @param metadataHashes The metadata hashes of the assets to mint\n function createMultipleAssets(\n bytes memory signature,\n uint8[] calldata tiers,\n uint256[] calldata amounts,\n bool[] calldata revealed,\n string[] calldata metadataHashes,\n address creator\n ) external {\n require(\n authValidator.verify(\n signature,\n _hashBatchMint(creator, signatureNonces[_msgSender()]++, tiers, amounts, revealed, metadataHashes)\n ),\n \"Invalid signature\"\n );\n\n require(tiers.length == amounts.length, \"Arrays must be same length\");\n require(amounts.length == metadataHashes.length, \"Arrays must be same length\");\n require(metadataHashes.length == revealed.length, \"Arrays must be same length\");\n\n uint256[] memory tokenIds = new uint256[](tiers.length);\n uint256[] memory tiersToBurn = new uint256[](tiers.length);\n for (uint256 i = 0; i < tiers.length; i++) {\n tiersToBurn[i] = tiers[i];\n tokenIds[i] = TokenIdUtils.generateTokenId(\n creator,\n tiers[i],\n ++creatorNonces[creator],\n revealed[i] ? 1 : 0,\n false\n );\n }\n\n catalystContract.burnBatchFrom(creator, tiersToBurn, amounts);\n\n assetContract.mintBatch(creator, tokenIds, amounts, metadataHashes);\n emit AssetBatchMinted(creator, tokenIds, tiers, amounts, metadataHashes, revealed);\n }\n\n /// @notice Create special assets, like TSB exclusive tokens\n /// @dev Only callable by the special minter\n /// @param signature A signature generated by TSB\n /// @param amount The amount of the asset to mint\n /// @param metadataHash The metadata hash of the asset to mint,\n /// @param creator The address of the creator\n function createSpecialAsset(\n bytes memory signature,\n uint256 amount,\n string calldata metadataHash,\n address creator\n ) external onlyRole(SPECIAL_MINTER_ROLE) {\n require(\n authValidator.verify(\n signature,\n _hashMint(creator, signatureNonces[_msgSender()]++, 0, amount, true, metadataHash)\n ),\n \"Invalid signature\"\n );\n\n uint256 tokenId = TokenIdUtils.generateTokenId(creator, 0, ++creatorNonces[creator], 1, false);\n\n assetContract.mint(creator, tokenId, amount, metadataHash);\n emit SpecialAssetMinted(creator, tokenId, 0, amount, metadataHash, true);\n }\n\n /// @notice Get the asset contract address\n /// @return The asset contract address\n function getAssetContract() external view returns (address) {\n return address(assetContract);\n }\n\n /// @notice Get the catalyst contract address\n /// @return The catalyst contract address\n function getCatalystContract() external view returns (address) {\n return address(catalystContract);\n }\n\n /// @notice Get the auth validator address\n /// @return The auth validator address\n function getAuthValidator() external view returns (address) {\n return address(authValidator);\n }\n\n /// @notice Creates a hash of the mint data\n /// @param creator The address of the creator\n /// @param tier The tier of the asset\n /// @param amount The amount of copies to mint\n /// @param metadataHash The metadata hash of the asset\n /// @return digest The hash of the mint data\n function _hashMint(\n address creator,\n uint16 nonce,\n uint8 tier,\n uint256 amount,\n bool revealed,\n string calldata metadataHash\n ) internal view returns (bytes32 digest) {\n digest = _hashTypedDataV4(\n keccak256(\n abi.encode(\n MINT_TYPEHASH,\n creator,\n nonce,\n tier,\n amount,\n revealed,\n keccak256((abi.encodePacked(metadataHash)))\n )\n )\n );\n }\n\n /// @notice Creates a hash of the mint batch data\n /// @param creator The address of the creator\n /// @param tiers The tiers of the assets\n /// @param amounts The amounts of copies to mint\n /// @param metadataHashes The metadata hashes of the assets\n /// @return digest The hash of the mint batch data\n function _hashBatchMint(\n address creator,\n uint16 nonce,\n uint8[] calldata tiers,\n uint256[] calldata amounts,\n bool[] calldata revealed,\n string[] calldata metadataHashes\n ) internal view returns (bytes32 digest) {\n digest = _hashTypedDataV4(\n keccak256(\n abi.encode(\n MINT_BATCH_TYPEHASH,\n creator,\n nonce,\n keccak256(abi.encodePacked(tiers)),\n keccak256(abi.encodePacked(amounts)),\n keccak256(abi.encodePacked(revealed)),\n _encodeHashes(metadataHashes)\n )\n )\n );\n }\n\n /// @notice Encodes the hashes of the metadata for signature verification\n /// @param metadataHashes The hashes of the metadata\n /// @return encodedHashes The encoded hashes of the metadata\n function _encodeHashes(string[] memory metadataHashes) internal pure returns (bytes32) {\n bytes32[] memory encodedHashes = new bytes32[](metadataHashes.length);\n for (uint256 i = 0; i < metadataHashes.length; i++) {\n encodedHashes[i] = keccak256((abi.encodePacked(metadataHashes[i])));\n }\n\n return keccak256(abi.encodePacked(encodedHashes));\n }\n\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(trustedForwarder != address(0), \"AssetCreate: trusted forwarder can't be zero address\");\n _setTrustedForwarder(trustedForwarder);\n }\n\n function _msgSender()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (address sender)\n {\n return ERC2771HandlerAbstract._msgSender();\n }\n\n function _msgData()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (bytes calldata)\n {\n return ERC2771HandlerAbstract._msgData();\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/AssetReveal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {EIP712Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\";\nimport {\n AccessControlUpgradeable,\n ContextUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {TokenIdUtils} from \"./libraries/TokenIdUtils.sol\";\nimport {AuthSuperValidator} from \"./AuthSuperValidator.sol\";\nimport {\n ERC2771HandlerUpgradeable,\n ERC2771HandlerAbstract\n} from \"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\";\nimport {IAsset} from \"./interfaces/IAsset.sol\";\nimport {IAssetReveal} from \"./interfaces/IAssetReveal.sol\";\n\n/// @title AssetReveal\n/// @author The Sandbox\n/// @notice Contract for burning and revealing assets\ncontract AssetReveal is\n IAssetReveal,\n Initializable,\n AccessControlUpgradeable,\n ERC2771HandlerUpgradeable,\n EIP712Upgradeable\n{\n using TokenIdUtils for uint256;\n IAsset private assetContract;\n AuthSuperValidator private authValidator;\n\n // mapping of creator to asset id to asset's reveal nonce\n mapping(address => mapping(uint256 => uint16)) internal revealIds;\n\n // mapping for showing whether a revealHash has been used\n // revealHashes are generated by the TSB backend from reveal burn events and are used for reveal minting\n mapping(bytes32 => bool) internal revealHashesUsed;\n\n bytes32 public constant REVEAL_TYPEHASH =\n keccak256(\n \"Reveal(address recipient,uint256 prevTokenId,uint256[] amounts,string[] metadataHashes,bytes32[] revealHashes)\"\n );\n bytes32 public constant BATCH_REVEAL_TYPEHASH =\n keccak256(\n \"BatchReveal(address recipient,uint256[] prevTokenIds,uint256[][] amounts,string[][] metadataHashes,bytes32[][] revealHashes)\"\n );\n bytes32 public constant INSTANT_REVEAL_TYPEHASH =\n keccak256(\n \"InstantReveal(address recipient,uint256 prevTokenId,uint256[] amounts,string[] metadataHashes,bytes32[] revealHashes)\"\n );\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n /// @notice Initialize the contract\n /// @param _assetContract The address of the asset contract\n /// @param _authValidator The address of the AuthSuperValidator contract\n /// @param _forwarder The address of the forwarder contract\n function initialize(\n string memory _name,\n string memory _version,\n address _assetContract,\n address _authValidator,\n address _forwarder,\n address _defaultAdmin\n ) public initializer {\n assetContract = IAsset(_assetContract);\n authValidator = AuthSuperValidator(_authValidator);\n __ERC2771Handler_init(_forwarder);\n __EIP712_init(_name, _version);\n _grantRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);\n }\n\n /// @notice Reveal an asset to view its abilities and enhancements\n /// @dev the reveal mechanism works through burning the asset and minting a new one with updated tokenId\n /// @param tokenId the tokenId of id idasset to reveal\n /// @param amount the amount of tokens to reveal\n function revealBurn(uint256 tokenId, uint256 amount) external {\n _burnAsset(tokenId, amount);\n emit AssetRevealBurn(_msgSender(), tokenId, amount);\n }\n\n /// @notice Burn multiple assets to be able to reveal them later\n /// @dev Can be used to burn multiple copies of the same token id, each copy will be revealed separately\n /// @param tokenIds the tokenIds of the assets to burn\n /// @param amounts the amounts of the assets to burn\n function revealBatchBurn(uint256[] calldata tokenIds, uint256[] calldata amounts) external {\n _burnAssetBatch(tokenIds, amounts);\n emit AssetRevealBatchBurn(_msgSender(), tokenIds, amounts);\n }\n\n /// @notice Reveal assets to view their abilities and enhancements\n /// @dev Can be used to reveal multiple copies of the same token id\n /// @param signature Signature created on the TSB backend containing REVEAL_TYPEHASH and associated data, must be signed by authorized signer\n /// @param prevTokenId The tokenId of the unrevealed asset\n /// @param amounts The amount of assets to reveal (length reflects the number of types of reveal tokens and must be equal to the length of revealHashes)\n /// @param metadataHashes The array of hashes for revealed asset metadata\n /// @param revealHashes A revealHash array providing a random bytes32 generated by the TSB backend for each new tokenId\n function revealMint(\n bytes memory signature,\n uint256 prevTokenId,\n uint256[] calldata amounts,\n string[] calldata metadataHashes,\n bytes32[] calldata revealHashes\n ) external {\n require(amounts.length == metadataHashes.length, \"AssetReveal: Invalid amounts length\");\n require(amounts.length == revealHashes.length, \"AssetReveal: Invalid revealHashes length\");\n require(\n authValidator.verify(\n signature,\n _hashReveal(_msgSender(), prevTokenId, amounts, metadataHashes, revealHashes)\n ),\n \"AssetReveal: Invalid revealMint signature\"\n );\n uint256[] memory newTokenIds = _revealAsset(prevTokenId, metadataHashes, amounts, revealHashes);\n emit AssetRevealMint(_msgSender(), prevTokenId, amounts, newTokenIds, revealHashes);\n }\n\n /// @notice Mint multiple assets with revealed abilities and enhancements\n /// @dev Can be used to reveal multiple copies of the same token id\n /// @param signature Signatures created on the TSB backend containing REVEAL_TYPEHASH and associated data, must be signed by authorized signer\n /// @param prevTokenIds The tokenId of the unrevealed asset\n /// @param amounts The amount of assets to reveal (must be equal to the length of revealHashes)\n /// @param metadataHashes The array of hashes for asset metadata\n /// @param revealHashes Array of revealHash arrays providing random bytes32 generated by the TSB backend for each new tokenId\n function revealBatchMint(\n bytes calldata signature,\n uint256[] calldata prevTokenIds,\n uint256[][] calldata amounts,\n string[][] calldata metadataHashes,\n bytes32[][] calldata revealHashes\n ) external {\n require(prevTokenIds.length == amounts.length, \"AssetReveal: Invalid amounts length\");\n require(amounts.length == metadataHashes.length, \"AssetReveal: Invalid metadataHashes length\");\n require(prevTokenIds.length == revealHashes.length, \"AssetReveal: Invalid revealHashes length\");\n require(\n authValidator.verify(\n signature,\n _hashBatchReveal(_msgSender(), prevTokenIds, amounts, metadataHashes, revealHashes)\n ),\n \"AssetReveal: Invalid revealBatchMint signature\"\n );\n uint256[][] memory newTokenIds = new uint256[][](prevTokenIds.length);\n for (uint256 i = 0; i < prevTokenIds.length; i++) {\n newTokenIds[i] = _revealAsset(prevTokenIds[i], metadataHashes[i], amounts[i], revealHashes[i]);\n }\n emit AssetRevealBatchMint(_msgSender(), prevTokenIds, amounts, newTokenIds, revealHashes);\n }\n\n /// @notice Reveal assets to view their abilities and enhancements and mint them in a single transaction\n /// @dev Should be used where it is not required to keep the metadata secret, e.g. mythical assets where users select their desired abilities and enhancements\n /// @param signature Signature created on the TSB backend containing INSTANT_REVEAL_TYPEHASH and associated data, must be signed by authorized signer\n /// @param prevTokenId The tokenId of the unrevealed asset\n /// @param burnAmount The amount of assets to burn\n /// @param amounts The amount of assets to reveal (sum must be equal to the burnAmount)\n /// @param metadataHashes The array of hashes for asset metadata\n /// @param revealHashes A revealHash array providing a random bytes32 generated by the TSB backend for each new tokenId\n function burnAndReveal(\n bytes memory signature,\n uint256 prevTokenId,\n uint256 burnAmount,\n uint256[] calldata amounts,\n string[] calldata metadataHashes,\n bytes32[] calldata revealHashes\n ) external {\n require(amounts.length == metadataHashes.length, \"AssetReveal: Invalid amounts length\");\n require(amounts.length == revealHashes.length, \"AssetReveal: Invalid revealHashes length\");\n require(\n authValidator.verify(\n signature,\n _hashInstantReveal(_msgSender(), prevTokenId, amounts, metadataHashes, revealHashes)\n ),\n \"AssetReveal: Invalid burnAndReveal signature\"\n );\n _burnAsset(prevTokenId, burnAmount);\n uint256[] memory newTokenIds = _revealAsset(prevTokenId, metadataHashes, amounts, revealHashes);\n emit AssetRevealMint(_msgSender(), prevTokenId, amounts, newTokenIds, revealHashes);\n }\n\n /// @notice Generate new tokenIds for revealed assets and mint them\n /// @param prevTokenId The tokenId of the unrevealed asset\n /// @param metadataHashes The array of hashes for asset metadata\n /// @param amounts The array of amounts to mint\n function _revealAsset(\n uint256 prevTokenId,\n string[] calldata metadataHashes,\n uint256[] calldata amounts,\n bytes32[] calldata revealHashes\n ) internal returns (uint256[] memory) {\n uint256[] memory newTokenIds = getRevealedTokenIds(metadataHashes, prevTokenId);\n for (uint256 i = 0; i < revealHashes.length; i++) {\n require(revealHashesUsed[revealHashes[i]] == false, \"AssetReveal: RevealHash already used\");\n revealHashesUsed[revealHashes[i]] = true;\n }\n if (newTokenIds.length == 1) {\n assetContract.mint(_msgSender(), newTokenIds[0], amounts[0], metadataHashes[0]);\n } else {\n assetContract.mintBatch(_msgSender(), newTokenIds, amounts, metadataHashes);\n }\n return newTokenIds;\n }\n\n /// @notice Burns an asset to be able to reveal it later\n /// @param tokenId the tokenId of the asset to burn\n /// @param amount the amount of the asset to burn\n function _burnAsset(uint256 tokenId, uint256 amount) internal {\n _verifyBurnData(tokenId, amount);\n assetContract.burnFrom(_msgSender(), tokenId, amount);\n }\n\n function _burnAssetBatch(uint256[] calldata tokenIds, uint256[] calldata amounts) internal {\n require(tokenIds.length == amounts.length, \"AssetReveal: Invalid input\");\n for (uint256 i = 0; i < tokenIds.length; i++) {\n _verifyBurnData(tokenIds[i], amounts[i]);\n }\n assetContract.burnBatchFrom(_msgSender(), tokenIds, amounts);\n }\n\n function _verifyBurnData(uint256 tokenId, uint256 amount) internal pure {\n IAsset.AssetData memory data = tokenId.getData();\n require(!data.revealed, \"AssetReveal: Asset is already revealed\");\n require(amount > 0, \"AssetReveal: Burn amount should be greater than 0\");\n }\n\n /// @notice Creates a hash of the reveal data\n /// @param recipient The address of the recipient\n /// @param prevTokenId The unrevealed token id\n /// @param amounts The amount of tokens to mint\n /// @param metadataHashes The array of hashes for new asset metadata\n /// @param revealHashes The revealHashes used for revealing this particular prevTokenId (length corresponds to the new tokenIds)\n /// @return digest The hash of the reveal data\n function _hashInstantReveal(\n address recipient,\n uint256 prevTokenId,\n uint256[] calldata amounts,\n string[] calldata metadataHashes,\n bytes32[] calldata revealHashes\n ) internal view returns (bytes32 digest) {\n digest = _hashTypedDataV4(\n keccak256(\n abi.encode(\n INSTANT_REVEAL_TYPEHASH,\n recipient,\n prevTokenId,\n keccak256(abi.encodePacked(amounts)),\n _encodeHashes(metadataHashes),\n keccak256(abi.encodePacked(revealHashes))\n )\n )\n );\n }\n\n /// @notice Creates a hash of the reveal data\n /// @param recipient The intended recipient of the revealed token\n /// @param prevTokenId The previous token id\n /// @param amounts The amount of tokens to mint\n /// @param metadataHashes The array of hashes for new asset metadata\n /// @param revealHashes The revealHashes used for revealing this particular prevTokenId (length corresponds to the new tokenIds)\n /// @return digest The hash of the reveal data\n function _hashReveal(\n address recipient,\n uint256 prevTokenId,\n uint256[] calldata amounts,\n string[] calldata metadataHashes,\n bytes32[] calldata revealHashes\n ) internal view returns (bytes32 digest) {\n digest = _hashTypedDataV4(\n keccak256(\n abi.encode(\n REVEAL_TYPEHASH,\n recipient,\n prevTokenId,\n keccak256(abi.encodePacked(amounts)),\n _encodeHashes(metadataHashes),\n keccak256(abi.encodePacked(revealHashes))\n )\n )\n );\n }\n\n /// @notice Creates a hash of the reveal data\n /// @param recipient The intended recipient of the revealed tokens\n /// @param prevTokenIds The previous token id\n /// @param amounts The amounts of tokens to mint\n /// @param metadataHashes The arrays of hashes for new asset metadata\n /// @param revealHashes The revealHashes used for these prevTokenIds, (lengths corresponds to the new tokenIds)\n /// @return digest The hash of the reveal data\n function _hashBatchReveal(\n address recipient,\n uint256[] calldata prevTokenIds,\n uint256[][] calldata amounts,\n string[][] calldata metadataHashes,\n bytes32[][] calldata revealHashes\n ) internal view returns (bytes32 digest) {\n digest = _hashTypedDataV4(\n keccak256(\n abi.encode(\n BATCH_REVEAL_TYPEHASH,\n recipient,\n keccak256(abi.encodePacked(prevTokenIds)),\n _encodeBatchAmounts(amounts),\n _encodeBatchHashes(metadataHashes),\n _encodeBatchRevealHashes(revealHashes)\n )\n )\n );\n }\n\n /// @notice Encodes the hashes of the metadata for signature verification\n /// @param metadataHashes The hashes of the metadata\n /// @return encodedHashes The encoded hashes of the metadata\n function _encodeHashes(string[] memory metadataHashes) internal pure returns (bytes32) {\n bytes32[] memory encodedHashes = new bytes32[](metadataHashes.length);\n for (uint256 i = 0; i < metadataHashes.length; i++) {\n encodedHashes[i] = keccak256((abi.encodePacked(metadataHashes[i])));\n }\n return keccak256(abi.encodePacked(encodedHashes));\n }\n\n /// @notice Encodes the hashes of the metadata for signature verification\n /// @param metadataHashes The hashes of the metadata\n /// @return encodedHashes The encoded hashes of the metadata\n function _encodeBatchHashes(string[][] memory metadataHashes) internal pure returns (bytes32) {\n bytes32[] memory encodedHashes = new bytes32[](metadataHashes.length);\n for (uint256 i = 0; i < metadataHashes.length; i++) {\n encodedHashes[i] = _encodeHashes(metadataHashes[i]);\n }\n return keccak256(abi.encodePacked(encodedHashes));\n }\n\n /// @notice Encodes the hashes of the metadata for signature verification\n /// @param revealHashes The revealHashes\n /// @return encodedRevealHashes The encoded hashes of the metadata\n function _encodeBatchRevealHashes(bytes32[][] memory revealHashes) internal pure returns (bytes32) {\n bytes32[] memory encodedHashes = new bytes32[](revealHashes.length);\n for (uint256 i = 0; i < revealHashes.length; i++) {\n encodedHashes[i] = keccak256(abi.encodePacked(revealHashes[i]));\n }\n return keccak256(abi.encodePacked(encodedHashes));\n }\n\n /// @notice Encodes the amounts of the tokens for signature verification\n /// @param amounts The amounts of the tokens\n /// @return encodedAmounts The encoded amounts of the tokens\n function _encodeBatchAmounts(uint256[][] memory amounts) internal pure returns (bytes32) {\n bytes32[] memory encodedAmounts = new bytes32[](amounts.length);\n for (uint256 i = 0; i < amounts.length; i++) {\n encodedAmounts[i] = keccak256(abi.encodePacked(amounts[i]));\n }\n return keccak256(abi.encodePacked(encodedAmounts));\n }\n\n /// @notice Checks if each metadatahash has been used before to either get the tokenId that was already created for it or generate a new one if it hasn't\n /// @dev This function also validates that we're not trying to reveal a tokenId that has already been revealed\n /// @param metadataHashes The hashes of the metadata\n /// @param prevTokenId The previous token id from which the assets are revealed\n /// @return tokenIdArray The array of tokenIds to mint\n function getRevealedTokenIds(string[] calldata metadataHashes, uint256 prevTokenId)\n internal\n returns (uint256[] memory)\n {\n IAsset.AssetData memory data = prevTokenId.getData();\n require(!data.revealed, \"AssetReveal: already revealed\");\n uint256[] memory tokenIdArray = new uint256[](metadataHashes.length);\n for (uint256 i = 0; i < metadataHashes.length; i++) {\n uint256 tokenId = assetContract.getTokenIdByMetadataHash(metadataHashes[i]);\n if (tokenId == 0) {\n uint16 revealNonce = ++revealIds[data.creator][prevTokenId];\n tokenId = TokenIdUtils.generateTokenId(\n data.creator,\n data.tier,\n data.creatorNonce,\n revealNonce,\n data.bridged\n );\n }\n tokenIdArray[i] = tokenId;\n }\n return tokenIdArray;\n }\n\n /// @notice Get the status of a revealHash\n /// @return Whether it has been used\n function revealHashUsed(bytes32 revealHash) external view returns (bool) {\n return revealHashesUsed[revealHash];\n }\n\n /// @notice Get the asset contract address\n /// @return The asset contract address\n function getAssetContract() external view returns (address) {\n return address(assetContract);\n }\n\n /// @notice Get the auth validator address\n /// @return The auth validator address\n function getAuthValidator() external view returns (address) {\n return address(authValidator);\n }\n\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(trustedForwarder != address(0), \"AssetReveal: trusted forwarder can't be zero address\");\n _setTrustedForwarder(trustedForwarder);\n }\n\n function _msgSender()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (address sender)\n {\n return ERC2771HandlerAbstract._msgSender();\n }\n\n function _msgData()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (bytes calldata)\n {\n return ERC2771HandlerAbstract._msgData();\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/AuthSuperValidator.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\nimport {AccessControl} from \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport {ECDSA} from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\n/// @title AuthSuperValidator\n/// @author The Sandbox\n/// @notice This contract is used to validate the signatures of the backend, each contract can have a separate signer assigned\ncontract AuthSuperValidator is AccessControl {\n mapping(address => address) private _signers;\n\n /// @dev Constructor\n /// @param admin Address of the admin that will be able to grant roles\n constructor(address admin) {\n _grantRole(DEFAULT_ADMIN_ROLE, admin);\n }\n\n /// @notice Sets the signer for a contract\n /// @dev Only the admin can call this function\n /// @param contractAddress Address of the contract to set the signer for\n /// @param signer Address of the signer\n function setSigner(address contractAddress, address signer) public onlyRole(DEFAULT_ADMIN_ROLE) {\n _signers[contractAddress] = signer;\n }\n\n /// @notice Gets the signer for a contract\n /// @param contractAddress Address of the contract to get the signer for\n /// @return address of the signer\n function getSigner(address contractAddress) public view returns (address) {\n return _signers[contractAddress];\n }\n\n /// @notice Takes the signature and the digest and returns if the signer has a backend signer role assigned\n /// @dev Multipurpose function that can be used to verify signatures with different digests\n /// @param signature Signature hash\n /// @param digest Digest hash\n /// @return bool\n function verify(bytes memory signature, bytes32 digest) public view returns (bool) {\n address signer = _signers[_msgSender()];\n require(signer != address(0), \"AuthSuperValidator: signer not set\");\n address recoveredSigner = ECDSA.recover(digest, signature);\n return recoveredSigner == signer;\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/Catalyst.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\nimport {ERC1155Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol\";\nimport {\n AccessControlUpgradeable,\n ContextUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {\n ERC1155BurnableUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol\";\nimport {\n ERC1155SupplyUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol\";\nimport {\n ERC1155URIStorageUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol\";\nimport {\n IERC165Upgradeable,\n ERC2981Upgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {\n OperatorFiltererUpgradeable,\n IOperatorFilterRegistry\n} from \"@sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol\";\nimport {\n RoyaltyDistributor\n} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyDistributor.sol\";\nimport {\n IRoyaltyManager\n} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyManager.sol\";\nimport {IERC2981Upgradeable} from \"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\";\nimport {\n ERC2771HandlerUpgradeable,\n ERC2771HandlerAbstract\n} from \"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\";\nimport {ICatalyst} from \"./interfaces/ICatalyst.sol\";\n\n/// @title Catalyst\n/// @author The Sandbox\n/// @notice THis contract manages catalysts which are used to mint new assets.\n/// @dev An ERC1155 contract that manages catalysts, extends multiple OpenZeppelin contracts to\n/// provide a variety of features including, AccessControl, URIStorage, Burnable and more.\n/// The contract includes support for meta transactions.\ncontract Catalyst is\n ICatalyst,\n Initializable,\n ERC1155Upgradeable,\n ERC1155BurnableUpgradeable,\n ERC1155SupplyUpgradeable,\n ERC1155URIStorageUpgradeable,\n ERC2771HandlerUpgradeable,\n AccessControlUpgradeable,\n OperatorFiltererUpgradeable,\n RoyaltyDistributor\n{\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant BURNER_ROLE = keccak256(\"BURNER_ROLE\");\n\n uint256 public highestTierIndex;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n modifier onlyValidId(uint256 tokenId) {\n require(tokenId > 0 && tokenId <= highestTierIndex, \"Catalyst: invalid catalyst id\");\n _;\n }\n\n /// @notice Initialize the contract, setting up initial values for various features.\n /// @param _baseUri The base URI for the token metadata, most likely set to ipfs://.\n /// @param _trustedForwarder The trusted forwarder for meta transactions.\n /// @param _subscription The subscription address.\n /// @param _defaultAdmin The default admin address.\n /// @param _defaultMinter The default minter address.\n /// @param _catalystIpfsCID The IPFS content identifiers for each catalyst.\n /// @param _royaltyManager, the address of the Manager contract for common royalty recipient\n function initialize(\n string memory _baseUri,\n address _trustedForwarder,\n address _subscription,\n address _defaultAdmin,\n address _defaultMinter,\n string[] memory _catalystIpfsCID,\n address _royaltyManager\n ) public initializer {\n require(bytes(_baseUri).length != 0, \"Catalyst: base uri can't be empty\");\n require(_trustedForwarder != address(0), \"Catalyst: trusted forwarder can't be zero\");\n require(_subscription != address(0), \"Catalyst: subscription can't be zero\");\n require(_defaultAdmin != address(0), \"Catalyst: admin can't be zero\");\n require(_defaultMinter != address(0), \"Catalyst: minter can't be zero\");\n require(_royaltyManager != address(0), \"Catalyst: royalty manager can't be zero\");\n __ERC1155_init(_baseUri);\n __AccessControl_init();\n __ERC1155Burnable_init();\n __ERC1155Supply_init();\n __ERC1155URIStorage_init();\n __ERC2771Handler_init(_trustedForwarder);\n __OperatorFilterer_init(_subscription, true);\n _setBaseURI(_baseUri);\n _grantRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);\n _grantRole(MINTER_ROLE, _defaultMinter);\n __RoyaltyDistributor_init(_royaltyManager);\n for (uint256 i = 0; i < _catalystIpfsCID.length; i++) {\n require(bytes(_catalystIpfsCID[i]).length != 0, \"Catalyst: CID can't be empty\");\n _setURI(i, _catalystIpfsCID[i]);\n highestTierIndex = i;\n }\n }\n\n /// @notice Mints a new token, limited to MINTER_ROLE only\n /// @param to The address that will own the minted token\n /// @param id The token id to mint\n /// @param amount The amount to be minted\n function mint(\n address to,\n uint256 id,\n uint256 amount\n ) external onlyRole(MINTER_ROLE) onlyValidId(id) {\n _mint(to, id, amount, \"\");\n }\n\n /// @notice Mints a batch of tokens, limited to MINTER_ROLE only\n /// @param to The address that will own the minted tokens\n /// @param ids The token ids to mint\n /// @param amounts The amounts to be minted per token id\n function mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts\n ) external onlyRole(MINTER_ROLE) {\n for (uint256 i = 0; i < ids.length; i++) {\n require(ids[i] > 0 && ids[i] <= highestTierIndex, \"Catalyst: invalid catalyst id\");\n }\n _mintBatch(to, ids, amounts, \"\");\n }\n\n /// @notice Burns a specified amount of tokens from a specific address\n /// @param account The address to burn from\n /// @param id The token id to burn\n /// @param amount The amount to be burned\n function burnFrom(\n address account,\n uint256 id,\n uint256 amount\n ) external onlyRole(BURNER_ROLE) {\n _burn(account, id, amount);\n }\n\n /// @notice Burns a batch of tokens from a specific address\n /// @param account The address to burn from\n /// @param ids The token ids to burn\n /// @param amounts The amounts to be burned\n function burnBatchFrom(\n address account,\n uint256[] memory ids,\n uint256[] memory amounts\n ) external onlyRole(BURNER_ROLE) {\n _burnBatch(account, ids, amounts);\n }\n\n /// @notice Add a new catalyst type, limited to DEFAULT_ADMIN_ROLE only\n /// @param ipfsCID The royalty bps for the catalyst\n function addNewCatalystType(string memory ipfsCID) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(bytes(ipfsCID).length != 0, \"Catalyst: CID can't be empty\");\n uint256 newCatId = ++highestTierIndex;\n ERC1155URIStorageUpgradeable._setURI(newCatId, ipfsCID);\n emit NewCatalystTypeAdded(newCatId);\n }\n\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(trustedForwarder != address(0), \"Catalyst: trusted forwarder can't be zero address\");\n _setTrustedForwarder(trustedForwarder);\n }\n\n /// @notice Set a new URI for specific tokenid\n /// @param tokenId The token id to set URI for\n /// @param metadataHash The new URI\n function setMetadataHash(uint256 tokenId, string memory metadataHash)\n external\n onlyRole(DEFAULT_ADMIN_ROLE)\n onlyValidId(tokenId)\n {\n require(bytes(metadataHash).length != 0, \"Catalyst: metadataHash can't be empty\");\n _setURI(tokenId, metadataHash);\n }\n\n /// @notice Set a new base URI\n /// @param baseURI The new base URI\n function setBaseURI(string memory baseURI) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(bytes(baseURI).length != 0, \"Catalyst: base uri can't be empty\");\n _setBaseURI(baseURI);\n }\n\n /// @notice returns full token URI, including baseURI and token metadata URI\n /// @param tokenId The token id to get URI for\n /// @return tokenURI the URI of the token\n function uri(uint256 tokenId)\n public\n view\n override(ERC1155Upgradeable, ERC1155URIStorageUpgradeable)\n returns (string memory)\n {\n return ERC1155URIStorageUpgradeable.uri(tokenId);\n }\n\n /// @dev Needed for meta transactions (see EIP-2771)\n function _msgSender() internal view virtual override(ContextUpgradeable, ERC2771HandlerAbstract) returns (address) {\n return ERC2771HandlerAbstract._msgSender();\n }\n\n /// @dev Needed for meta transactions (see EIP-2771)\n function _msgData()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (bytes calldata)\n {\n return ERC2771HandlerAbstract._msgData();\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param value amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes memory data\n ) public override onlyAllowedOperator(from) {\n super._safeTransferFrom(from, to, id, value, data);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @dev call data should be optimized to order ids so packedBalance can be used efficiently.\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param values amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory values,\n bytes memory data\n ) public override onlyAllowedOperator(from) {\n super._safeBatchTransferFrom(from, to, ids, values, data);\n }\n\n /// @notice Enable or disable approval for `operator` to manage all of the caller's tokens.\n /// @param operator address which will be granted rights to transfer all tokens of the caller.\n /// @param approved whether to approve or revoke\n function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {\n super._setApprovalForAll(_msgSender(), operator, approved);\n }\n\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n }\n\n /// @notice Query if a contract implements interface `id`.\n /// @param interfaceId the interface identifier, as specified in ERC-165.\n /// @return `true` if the contract implements `interfaceId`.\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(ERC1155Upgradeable, AccessControlUpgradeable, RoyaltyDistributor)\n returns (bool)\n {\n return super.supportsInterface(interfaceId);\n }\n\n /// @notice This function is used to register Catalyst contract on the Operator Filterer Registry of Opensea.can only be called by admin.\n /// @dev used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.\n /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe.\n /// @param subscribe bool to signify subscription \"true\"\" or to copy the list \"false\".\n function registerAndSubscribe(address subscriptionOrRegistrantToCopy, bool subscribe)\n external\n onlyRole(DEFAULT_ADMIN_ROLE)\n {\n require(subscriptionOrRegistrantToCopy != address(0), \"Catalyst: subscription can't be zero address\");\n _registerAndSubscribe(subscriptionOrRegistrantToCopy, subscribe);\n }\n\n /// @notice sets filter registry address deployed in test\n /// @param registry the address of the registry\n function setOperatorRegistry(address registry) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(registry != address(0), \"Catalyst: registry can't be zero address\");\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/interfaces/IAsset.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\ninterface IAsset {\n // AssetData reflects the asset tokenId structure\n // Refer to TokenIdUtils.sol\n struct AssetData {\n uint256 tokenId;\n address creator;\n uint256 amount;\n uint8 tier;\n uint16 creatorNonce;\n bool revealed;\n string metadataHash;\n bool bridged;\n }\n\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\n\n // Functions\n function mint(\n address to,\n uint256 id,\n uint256 amount,\n string memory metadataHash\n ) external;\n\n function mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n string[] memory metadataHashes\n ) external;\n\n function burnFrom(\n address account,\n uint256 id,\n uint256 amount\n ) external;\n\n function burnBatchFrom(\n address account,\n uint256[] memory ids,\n uint256[] memory amounts\n ) external;\n\n function getTokenIdByMetadataHash(string memory metadataHash) external view returns (uint256);\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/interfaces/IAssetCreate.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\ninterface IAssetCreate {\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\n event AssetMinted(\n address indexed creator,\n uint256 tokenId,\n uint16 tier,\n uint256 amount,\n string metadataHash,\n bool revealed\n );\n event SpecialAssetMinted(\n address indexed creator,\n uint256 tokenId,\n uint16 tier,\n uint256 amount,\n string metadataHash,\n bool revealed\n );\n event AssetBatchMinted(\n address indexed creator,\n uint256[] tokenIds,\n uint8[] tiers,\n uint256[] amounts,\n string[] metadataHashes,\n bool[] revealed\n );\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/interfaces/IAssetReveal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\ninterface IAssetReveal {\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\n event AssetRevealBurn(address revealer, uint256 unrevealedTokenId, uint256 amount);\n event AssetRevealBatchBurn(address revealer, uint256[] unrevealedTokenIds, uint256[] amounts);\n event AssetRevealMint(\n address recipient,\n uint256 unrevealedTokenId,\n uint256[] amounts,\n uint256[] newTokenIds,\n bytes32[] revealHashes\n );\n event AssetRevealBatchMint(\n address recipient,\n uint256[] unrevealedTokenIds,\n uint256[][] amounts,\n uint256[][] newTokenIds,\n bytes32[][] revealHashes\n );\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/interfaces/ICatalyst.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\ninterface ICatalyst {\n enum CatalystType {TSB_EXCLUSIVE, COMMON, UNCOMMON, RARE, EPIC, LEGENDARY, MYTHIC}\n\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\n event NewCatalystTypeAdded(uint256 catalystId);\n event DefaultRoyaltyChanged(address indexed newDefaultRoyaltyRecipient, uint256 newDefaultRoyaltyAmount);\n\n /// @notice Mints a new token, limited to MINTER_ROLE only\n /// @param to The address that will own the minted token\n /// @param id The token id to mint\n /// @param amount The amount to be minted\n function mint(\n address to,\n uint256 id,\n uint256 amount\n ) external;\n\n /// @notice Mints a batch of tokens, limited to MINTER_ROLE only\n /// @param to The address that will own the minted tokens\n /// @param ids The token ids to mint\n /// @param amounts The amounts to be minted per token id\n function mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts\n ) external;\n\n /// @notice Burns a specified amount of tokens from a specific address\n /// @param account The address to burn from\n /// @param id The token id to burn\n /// @param amount The amount to be burned\n function burnFrom(\n address account,\n uint256 id,\n uint256 amount\n ) external;\n\n /// @notice Burns a batch of tokens from a specific address\n /// @param account The address to burn from\n /// @param ids The token ids to burn\n /// @param amounts The amounts to be burned\n function burnBatchFrom(\n address account,\n uint256[] memory ids,\n uint256[] memory amounts\n ) external;\n\n /// @notice Add a new catalyst type, limited to DEFAULT_ADMIN_ROLE only\n /// @param ipfsCID The royalty bps for the catalyst\n function addNewCatalystType(string memory ipfsCID) external;\n\n /// @notice Set a new URI for specific tokenid\n /// @param tokenId The token id to set URI for\n /// @param metadataHash The new URI\n function setMetadataHash(uint256 tokenId, string memory metadataHash) external;\n\n /// @notice Set a new base URI\n /// @param baseURI The new base URI\n function setBaseURI(string memory baseURI) external;\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/interfaces/ITokenUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\nimport {IRoyaltyUGC} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyUGC.sol\";\n\ninterface ITokenUtils is IRoyaltyUGC {\n function getTier(uint256 tokenId) external pure returns (uint8 tier);\n\n function isRevealed(uint256 tokenId) external pure returns (bool);\n\n function getCreatorNonce(uint256 tokenId) external pure returns (uint16);\n\n function getRevealNonce(uint256 tokenId) external pure returns (uint16);\n\n function isBridged(uint256 tokenId) external pure returns (bool);\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/libraries/TokenIdUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IAsset} from \"../interfaces/IAsset.sol\";\n\nlibrary TokenIdUtils {\n // Layer masks\n uint256 public constant TIER_MASK = 0xFF;\n uint256 public constant NONCE_MASK = 0xFFFF;\n uint256 public constant REVEAL_NONCE_MASK = 0xFFFF;\n uint256 public constant BRIDGED_MASK = 0x1;\n\n // Bit shifts\n uint256 public constant CREATOR_SHIFT = 0;\n uint256 public constant TIER_SHIFT = 160;\n uint256 public constant NONCE_SHIFT = 168;\n uint256 public constant REVEAL_NONCE_SHIFT = 184;\n uint256 public constant BRIDGED_SHIFT = 200;\n\n /// @notice Generates a token id for a given asset\n /// @dev The token id is generated by concatenating the following fields:\n /// @dev creator address, chain index, tier, asset nonce, reveal nonce and bridged boolean\n /// @dev The first 160 bits are the creator address\n /// @dev The next 8 bits are the chain index\n /// @dev The next 8 bits are the tier\n /// @dev The next 16 bits are the asset nonce\n /// @dev The next 16 bits are assets reveal nonce.\n /// @param creator The address of the creator of the asset\n /// @param tier The tier of the asset determined by the catalyst used to create it\n /// @param creatorNonce The nonce of the asset creator\n /// @param revealNonce The reveal nonce of the asset\n /// @param bridged Whether the asset is bridged or not\n /// @return tokenId The generated token id\n function generateTokenId(\n address creator,\n uint8 tier,\n uint16 creatorNonce,\n uint16 revealNonce,\n bool bridged\n ) internal pure returns (uint256 tokenId) {\n uint160 creatorAddress = uint160(creator);\n\n tokenId = tokenId =\n uint256(creatorAddress) |\n (uint256(tier) << TIER_SHIFT) |\n (uint256(creatorNonce) << NONCE_SHIFT) |\n (uint256(revealNonce) << REVEAL_NONCE_SHIFT) |\n (uint256(bridged ? 1 : 0) << BRIDGED_SHIFT);\n\n return tokenId;\n }\n\n /// @notice Extracts the creator address from a given token id\n /// @param tokenId The token id to extract the creator address from\n /// @return creator The asset creator address\n function getCreatorAddress(uint256 tokenId) internal pure returns (address creator) {\n creator = address(uint160(tokenId));\n return creator;\n }\n\n /// @notice Extracts the tier from a given token id\n /// @param tokenId The token id to extract the tier from\n /// @return tier The asset tier, determined by the catalyst used to create it\n function getTier(uint256 tokenId) internal pure returns (uint8 tier) {\n tier = uint8((tokenId >> TIER_SHIFT) & TIER_MASK);\n return tier;\n }\n\n /// @notice Extracts the revealed flag from a given token id\n /// @param tokenId The token id to extract the revealed flag from\n /// @return isRevealed Whether the asset is revealed or not\n function isRevealed(uint256 tokenId) internal pure returns (bool) {\n uint16 revealNonce = getRevealNonce(tokenId);\n return revealNonce != 0;\n }\n\n /// @notice Extracts the asset nonce from a given token id\n /// @param tokenId The token id to extract the asset nonce from\n /// @return creatorNonce The asset creator nonce\n function getCreatorNonce(uint256 tokenId) internal pure returns (uint16) {\n uint16 creatorNonce = uint16((tokenId >> NONCE_SHIFT) & NONCE_MASK);\n return creatorNonce;\n }\n\n /// @notice Extracts the abilities and enhancements hash from a given token id\n /// @param tokenId The token id to extract reveal nonce from\n /// @return revealNonce The reveal nonce of the asset\n function getRevealNonce(uint256 tokenId) internal pure returns (uint16) {\n uint16 revealNonce = uint16((tokenId >> REVEAL_NONCE_SHIFT) & REVEAL_NONCE_MASK);\n return revealNonce;\n }\n\n /// @notice Extracts the bridged flag from a given token id\n /// @param tokenId The token id to extract the bridged flag from\n /// @return bridged Whether the asset is bridged or not\n function isBridged(uint256 tokenId) internal pure returns (bool) {\n bool bridged = ((tokenId >> BRIDGED_SHIFT) & BRIDGED_MASK) == 1;\n return bridged;\n }\n\n /// @notice Extracts the asset data from a given token id\n /// @dev Created to limit the number of functions that need to be called when revealing an asset\n /// @param tokenId The token id to extract the asset data from\n function getData(uint256 tokenId) internal pure returns (IAsset.AssetData memory data) {\n data.creator = getCreatorAddress(tokenId);\n data.tier = getTier(tokenId);\n data.revealed = isRevealed(tokenId);\n data.creatorNonce = getCreatorNonce(tokenId);\n data.bridged = isBridged(tokenId);\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockAsset.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\n// mock the asset contract to test the _msgData() function\n\nimport {Asset} from \"../Asset.sol\";\nimport {\n IOperatorFilterRegistry\n} from \"@sandbox-smart-contracts/dependency-operator-filter/contracts/interfaces/IOperatorFilterRegistry.sol\";\n\ncontract MockAsset is Asset {\n /// @notice sets registry and subscribe to subscription\n /// @param registry address of registry\n /// @param subscription address to subscribe\n function setRegistryAndSubscribe(address registry, address subscription) external {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n operatorFilterRegistry.registerAndSubscribe(address(this), subscription);\n }\n\n /// @notice Mint new tokens with out minter role\n /// @param to The address of the recipient\n /// @param id The id of the token to mint\n /// @param amount The amount of the token to mint\n function mintWithoutMinterRole(\n address to,\n uint256 id,\n uint256 amount\n ) external {\n _mint(to, id, amount, \"\");\n }\n\n /// @notice set approval for asset transfer without filtering\n /// @param operator operator to be approved\n /// @param approved bool value for giving (true) and canceling (false) approval\n function setApprovalForAllWithoutFilter(address operator, bool approved) public virtual {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n function msgData() external view returns (bytes memory) {\n return _msgData();\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockAssetCreate.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\n// mock the asset contract to test the _msgData() function to satisfy the coverage\n\nimport {AssetCreate} from \"../AssetCreate.sol\";\n\ncontract MockAssetCreate is AssetCreate {\n function msgData() external view returns (bytes memory) {\n return _msgData();\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockAssetReveal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\n// mock the asset contract to test the _msgData() function to satisfy the coverage\n\nimport {AssetReveal} from \"../AssetReveal.sol\";\n\ncontract MockAssetReveal is AssetReveal {\n function msgData() external view returns (bytes memory) {\n return _msgData();\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockCatalyst.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.18;\n\nimport {Catalyst, IOperatorFilterRegistry} from \"../Catalyst.sol\";\n\ncontract MockCatalyst is Catalyst {\n /// @notice sets registry and subscribe to subscription\n /// @param registry address of registry\n /// @param subscription address to subscribe\n function setRegistryAndSubscribe(address registry, address subscription) external {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n operatorFilterRegistry.registerAndSubscribe(address(this), subscription);\n }\n\n /// @notice Mint new tokens with out minter role\n /// @param to The address of the recipient\n /// @param id The id of the token to mint\n /// @param amount The amount of the token to mint\n function mintWithoutMinterRole(\n address to,\n uint256 id,\n uint256 amount\n ) external {\n _mint(to, id, amount, \"\");\n }\n\n /// @notice set approval for asset transfer without filteration\n /// @param operator operator to be approved\n /// @param approved bool value for giving (true) and canceling (false) approval\n function setApprovalForAllWithoutFilter(address operator, bool approved) public virtual {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/RoyaltyManager.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {RoyaltyManager} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol\";\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/RoyaltySplitter.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\nimport {RoyaltySplitter} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol\";\n\n/* solhint-disable-next-line no-empty-blocks*/\ncontract MockSplitter is RoyaltySplitter {\n\n}\n" + }, + "@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerAbstract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @dev minimal ERC2771 handler to keep bytecode-size down\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\nabstract contract ERC2771HandlerAbstract {\n /// @notice return true if the forwarder is the trusted forwarder\n /// @param forwarder trusted forwarder address to check\n /// @return true if the address is the same as the trusted forwarder\n function isTrustedForwarder(address forwarder) external view returns (bool) {\n return _isTrustedForwarder(forwarder);\n }\n\n /// @notice if the call is from the trusted forwarder the sender is extracted from calldata, msg.sender otherwise\n /// @return sender the calculated address of the sender\n function _msgSender() internal view virtual returns (address sender) {\n if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n sender = msg.sender;\n }\n }\n\n /// @notice if the call is from the trusted forwarder the sender is removed from calldata\n /// @return the calldata without the sender\n function _msgData() internal view virtual returns (bytes calldata) {\n if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\n return msg.data[:msg.data.length - 20];\n } else {\n return msg.data;\n }\n }\n\n /// @notice return true if the forwarder is the trusted forwarder\n /// @param forwarder trusted forwarder address to check\n /// @return true if the address is the same as the trusted forwarder\n /// @dev this function must be IMPLEMENTED\n function _isTrustedForwarder(address forwarder) internal view virtual returns (bool);\n}\n" + }, + "@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ERC2771HandlerAbstract} from \"./ERC2771HandlerAbstract.sol\";\n\n/// @dev minimal ERC2771 handler to keep bytecode-size down\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\ncontract ERC2771HandlerUpgradeable is Initializable, ERC2771HandlerAbstract {\n address private _trustedForwarder;\n\n /// @notice Emitted when a `newTrustedForwarder` is set, replacing the `oldTrustedForwarder`\n /// @param oldTrustedForwarder old trusted forwarder\n /// @param newTrustedForwarder new trusted forwarder\n /// @param operator the sender of the transaction\n event TrustedForwarderSet(\n address indexed oldTrustedForwarder,\n address indexed newTrustedForwarder,\n address indexed operator\n );\n\n /// @notice initialize the trusted forwarder address\n /// @param forwarder trusted forwarder address or zero to disable it\n function __ERC2771Handler_init(address forwarder) internal onlyInitializing {\n __ERC2771Handler_init_unchained(forwarder);\n }\n\n /// @notice initialize the trusted forwarder address\n /// @param forwarder trusted forwarder address or zero to disable it\n function __ERC2771Handler_init_unchained(address forwarder) internal onlyInitializing {\n _setTrustedForwarder(forwarder);\n }\n\n /// @notice return the address of the trusted forwarder\n /// @return return the address of the trusted forwarder\n function getTrustedForwarder() external view returns (address) {\n return _trustedForwarder;\n }\n\n /// @notice set the address of the trusted forwarder\n /// @param newForwarder the address of the new forwarder.\n function _setTrustedForwarder(address newForwarder) internal virtual {\n require(newForwarder != _trustedForwarder, \"ERC2771HandlerUpgradeable: forwarder already set\");\n emit TrustedForwarderSet(_trustedForwarder, newForwarder, _msgSender());\n _trustedForwarder = newForwarder;\n }\n\n /// @notice return true if the forwarder is the trusted forwarder\n /// @param forwarder trusted forwarder address to check\n /// @return true if the address is the same as the trusted forwarder\n function _isTrustedForwarder(address forwarder) internal view virtual override returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n uint256[49] private __gap;\n}\n" + }, + "@sandbox-smart-contracts/dependency-operator-filter/contracts/interfaces/IOperatorFilterRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IOperatorFilterRegistry {\n /**\n * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns\n * true if supplied registrant address is not registered.\n */\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\n\n /**\n * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.\n */\n function register(address registrant) external;\n\n /**\n * @notice Registers an address with the registry and \"subscribes\" to another address's filtered operators and codeHashes.\n */\n function registerAndSubscribe(address registrant, address subscription) external;\n\n /**\n * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another\n * address without subscribing.\n */\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\n\n /**\n * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.\n * Note that this does not remove any filtered addresses or codeHashes.\n * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.\n */\n function unregister(address addr) external;\n\n /**\n * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered.\n */\n function updateOperator(\n address registrant,\n address operator,\n bool filtered\n ) external;\n\n /**\n * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.\n */\n function updateOperators(\n address registrant,\n address[] calldata operators,\n bool filtered\n ) external;\n\n /**\n * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.\n */\n function updateCodeHash(\n address registrant,\n bytes32 codehash,\n bool filtered\n ) external;\n\n /**\n * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.\n */\n function updateCodeHashes(\n address registrant,\n bytes32[] calldata codeHashes,\n bool filtered\n ) external;\n\n /**\n * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous\n * subscription if present.\n * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,\n * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be\n * used.\n */\n function subscribe(address registrant, address registrantToSubscribe) external;\n\n /**\n * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.\n */\n function unsubscribe(address registrant, bool copyExistingEntries) external;\n\n /**\n * @notice Get the subscription address of a given registrant, if any.\n */\n function subscriptionOf(address addr) external returns (address registrant);\n\n /**\n * @notice Get the set of addresses subscribed to a given registrant.\n * Note that order is not guaranteed as updates are made.\n */\n function subscribers(address registrant) external returns (address[] memory);\n\n /**\n * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.\n * Note that order is not guaranteed as updates are made.\n */\n function subscriberAt(address registrant, uint256 index) external returns (address);\n\n /**\n * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.\n */\n function copyEntriesOf(address registrant, address registrantToCopy) external;\n\n /**\n * @notice Returns true if operator is filtered by a given address or its subscription.\n */\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\n\n /**\n * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription.\n */\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\n\n /**\n * @notice Returns true if a codeHash is filtered by a given address or its subscription.\n */\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\n\n /**\n * @notice Returns a list of filtered operators for a given address or its subscription.\n */\n function filteredOperators(address addr) external returns (address[] memory);\n\n /**\n * @notice Returns the set of filtered codeHashes for a given address or its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\n\n /**\n * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or\n * its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\n\n /**\n * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or\n * its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\n\n /**\n * @notice Returns true if an address has registered\n */\n function isRegistered(address addr) external returns (bool);\n\n /**\n * @dev Convenience method to compute the code hash of an arbitrary contract\n */\n function codeHashOf(address addr) external returns (bytes32);\n}\n" + }, + "@sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {IOperatorFilterRegistry} from \"./interfaces/IOperatorFilterRegistry.sol\";\n\n///@title OperatorFiltererUpgradeable\n///@author The SandBox\n///@notice This contract would subscibe or copy or just to the subscription provided or just register to default subscription list. The operator filter registry's addess could be set using a setter which could be implemented in inherting contract\nabstract contract OperatorFiltererUpgradeable is Initializable {\n IOperatorFilterRegistry public operatorFilterRegistry;\n\n function __OperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe) internal onlyInitializing {\n operatorFilterRegistry = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); // Address of the operator filterer registry\n // If an inheriting token contract is deployed to a network without the registry deployed, the modifier\n // will not revert, but the contract will need to be registered with the registry once it is deployed in\n // order for the modifier to filter addresses.\n _registerAndSubscribe(subscriptionOrRegistrantToCopy, subscribe);\n }\n\n function _registerAndSubscribe(address subscriptionOrRegistrantToCopy, bool subscribe) internal {\n if (address(operatorFilterRegistry).code.length > 0) {\n if (!operatorFilterRegistry.isRegistered(address(this))) {\n if (subscribe) {\n operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);\n } else {\n if (subscriptionOrRegistrantToCopy != address(0)) {\n operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);\n } else {\n operatorFilterRegistry.register(address(this));\n }\n }\n }\n }\n }\n\n modifier onlyAllowedOperator(address from) virtual {\n // Check registry code length to facilitate testing in environments without a deployed registry.\n if (address(operatorFilterRegistry).code.length > 0) {\n // Allow spending tokens from addresses with balance\n // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred\n // from an EOA.\n if (from == msg.sender) {\n _;\n return;\n }\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), msg.sender)) {\n revert(\"Operator Not Allowed\");\n }\n }\n _;\n }\n\n modifier onlyAllowedOperatorApproval(address operator) virtual {\n // Check registry code length to facilitate testing in environments without a deployed registry.\n if (address(operatorFilterRegistry).code.length > 0) {\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), operator)) {\n revert(\"Operator Not Allowed\");\n }\n }\n _;\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IERC20Approve.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IERC20Approve {\n function approve(address spender, uint256 amount) external returns (bool);\n\n function increaseAllowance(address spender, uint256 amount) external returns (bool);\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IMultiRoyaltyDistributor.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {IMultiRoyaltyRecipients} from \"./IMultiRoyaltyRecipients.sol\";\nimport {\n IRoyaltySplitter,\n Recipient\n} from \"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\";\n\n/**\n * Multi-receiver EIP2981 reference override implementation\n */\ninterface IMultiRoyaltyDistributor is IERC165, IMultiRoyaltyRecipients {\n event TokenRoyaltyRemoved(uint256 tokenId);\n event TokenRoyaltySet(uint256 tokenId, address recipient);\n event DefaultRoyaltyBpsSet(uint16 royaltyBPS);\n\n event DefaultRoyaltyReceiverSet(address recipient);\n\n event RoyaltyRecipientSet(address splitter, address recipient);\n\n struct TokenRoyaltyConfig {\n uint256 tokenId;\n uint16 royaltyBPS;\n Recipient[] recipients;\n }\n\n /**\n * @dev Set per token royalties. Passing a recipient of address(0) will delete any existing configuration\n */\n function setTokenRoyalties(\n uint256 tokenId,\n address payable recipient,\n address creator\n ) external;\n\n /**\n * @dev Get all token royalty configurations\n */\n function getTokenRoyalties() external view returns (TokenRoyaltyConfig[] memory);\n\n /**\n * @dev Helper function to get all splits contracts\n */\n function getAllSplits() external view returns (address payable[] memory);\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IMultiRoyaltyRecipients.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Recipient} from \"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\";\n\n/**\n * Multi-receiver EIP2981 reference override implementation\n */\ninterface IMultiRoyaltyRecipients is IERC165 {\n /**\n * @dev Helper function to get all recipients\n */\n function getRecipients(uint256 tokenId) external view returns (Recipient[] memory);\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {Recipient} from \"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\";\n\ninterface IRoyaltyManager {\n event RecipientSet(address commonRecipient);\n\n event SplitSet(uint16 commonSplit);\n\n event RoyaltySet(uint16 royaltyBps, address contractAddress);\n\n function setRecipient(address payable _commonRecipient) external;\n\n function setSplit(uint16 commonSplit) external;\n\n function getCommonRecipient() external view returns (Recipient memory recipient);\n\n function getCreatorSplit() external view returns (uint16);\n\n function getRoyaltyInfo() external view returns (address payable, uint16);\n\n function deploySplitter(address creator, address payable recipient) external returns (address payable);\n\n function getCreatorRoyaltySplitter(address creator) external view returns (address payable);\n\n function getContractRoyalty(address _contractAddress) external view returns (uint16 royaltyBps);\n\n function setTrustedForwarder(address _newForwarder) external;\n\n function getTrustedForwarder() external view returns (address);\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyUGC.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IRoyaltyUGC {\n function getCreatorAddress(uint256 tokenId) external pure returns (address creator);\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/MultiRoyaltyDistributor.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {ERC165Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\nimport {EnumerableSet} from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport {Clones} from \"@openzeppelin/contracts/proxy/Clones.sol\";\nimport {IMultiRoyaltyDistributor, IMultiRoyaltyRecipients} from \"./interfaces/IMultiRoyaltyDistributor.sol\";\nimport {\n IRoyaltySplitter,\n IERC165\n} from \"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\";\nimport {IEIP2981} from \"@manifoldxyz/royalty-registry-solidity/contracts/specs/IEIP2981.sol\";\nimport {IRoyaltyManager, Recipient} from \"./interfaces/IRoyaltyManager.sol\";\n\n/// @title MultiRoyaltyDistributer\n/// @author The Sandbox\n/// @dev The MultiRoyaltyDistributer contract implements the ERC-2981 and ERC-165 interfaces for a royalty payment system. This payment system can be used to pay royalties to multiple recipients through splitters.\n/// @dev This contract calls to the Royalties manager contract to deploy RoyaltySplitter for a creator to slip its royalty between the creator and Sandbox and use it for every token minted by that creator.\nabstract contract MultiRoyaltyDistributor is IEIP2981, IMultiRoyaltyDistributor, ERC165Upgradeable {\n uint16 internal constant TOTAL_BASIS_POINTS = 10000;\n address public royaltyManager;\n\n mapping(uint256 => address payable) public _tokenRoyaltiesSplitter;\n uint256[] private _tokensWithRoyalties;\n\n function __MultiRoyaltyDistributor_init(address _royaltyManager) internal {\n royaltyManager = _royaltyManager;\n }\n\n /// @notice EIP 165 interface function\n /// @dev used to check the interface implemented\n /// @param interfaceId to be checked for implementation\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC165Upgradeable, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(IEIP2981).interfaceId ||\n interfaceId == type(IMultiRoyaltyDistributor).interfaceId ||\n interfaceId == type(IMultiRoyaltyRecipients).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /// @notice sets token royalty\n /// @dev deploys a splitter if a creator doesn't have one\n /// @param tokenId id of token\n /// @param creator of the token\n function _setTokenRoyalties(\n uint256 tokenId,\n address payable recipient,\n address creator\n ) internal {\n address payable creatorSplitterAddress = IRoyaltyManager(royaltyManager).deploySplitter(creator, recipient);\n _tokenRoyaltiesSplitter[tokenId] = creatorSplitterAddress;\n _tokensWithRoyalties.push(tokenId);\n emit TokenRoyaltySet(tokenId, recipient);\n }\n\n /// @notice Returns royalty receivers and their split of royalty for each token\n /// @return royaltyConfigs receivers and their split array as long as the number of tokens.\n function getTokenRoyalties() external view override returns (TokenRoyaltyConfig[] memory royaltyConfigs) {\n royaltyConfigs = new TokenRoyaltyConfig[](_tokensWithRoyalties.length);\n for (uint256 i; i < _tokensWithRoyalties.length; ++i) {\n TokenRoyaltyConfig memory royaltyConfig;\n uint256 tokenId = _tokensWithRoyalties[i];\n address splitterAddress = _tokenRoyaltiesSplitter[tokenId];\n if (splitterAddress != address(0)) {\n royaltyConfig.recipients = IRoyaltySplitter(splitterAddress).getRecipients();\n }\n royaltyConfig.tokenId = tokenId;\n royaltyConfigs[i] = royaltyConfig;\n }\n }\n\n /// @notice EIP 2981 royalty info function to return the royalty receiver and royalty amount\n /// @param tokenId of the token for which the royalty is needed to be distributed\n /// @param value the amount on which the royalty is calculated\n /// @return address the royalty receiver\n /// @return value the EIP2981 royalty\n function royaltyInfo(uint256 tokenId, uint256 value) public view override returns (address, uint256) {\n (address payable _defaultRoyaltyReceiver, uint16 _defaultRoyaltyBPS) =\n IRoyaltyManager(royaltyManager).getRoyaltyInfo();\n if (_tokenRoyaltiesSplitter[tokenId] != address(0)) {\n return (_tokenRoyaltiesSplitter[tokenId], (value * _defaultRoyaltyBPS) / TOTAL_BASIS_POINTS);\n }\n if (_defaultRoyaltyReceiver != address(0) && _defaultRoyaltyBPS != 0) {\n return (_defaultRoyaltyReceiver, (value * _defaultRoyaltyBPS) / TOTAL_BASIS_POINTS);\n }\n return (address(0), 0);\n }\n\n /// @notice returns the EIP-2981 royalty receiver for each token (i.e. splitters) including the default royalty receiver.\n /// @return splits the royalty receiver's array\n function getAllSplits() external view override returns (address payable[] memory splits) {\n uint256 startingIndex;\n uint256 endingIndex = _tokensWithRoyalties.length;\n (address payable _defaultRoyaltyReceiver, ) = IRoyaltyManager(royaltyManager).getRoyaltyInfo();\n if (_defaultRoyaltyReceiver != address(0)) {\n splits = new address payable[](1 + _tokensWithRoyalties.length);\n splits[0] = _defaultRoyaltyReceiver;\n startingIndex = 1;\n ++endingIndex;\n } else {\n // unreachable in practice\n splits = new address payable[](_tokensWithRoyalties.length);\n }\n for (uint256 i = startingIndex; i < endingIndex; ++i) {\n splits[i] = _tokenRoyaltiesSplitter[_tokensWithRoyalties[i - startingIndex]];\n }\n }\n\n /// @notice returns the royalty recipients for each tokenId.\n /// @dev returns the default address for tokens with no recipients.\n /// @param tokenId is the token id for which the recipient should be returned.\n /// @return addresses of royalty recipient of the token.\n function getRecipients(uint256 tokenId) public view returns (Recipient[] memory) {\n address payable splitterAddress = _tokenRoyaltiesSplitter[tokenId];\n (address payable _defaultRoyaltyReceiver, ) = IRoyaltyManager(royaltyManager).getRoyaltyInfo();\n if (splitterAddress != address(0)) {\n return IRoyaltySplitter(splitterAddress).getRecipients();\n }\n Recipient[] memory defaultRecipient = new Recipient[](1);\n defaultRecipient[0] = Recipient({recipient: _defaultRoyaltyReceiver, bps: TOTAL_BASIS_POINTS});\n return defaultRecipient;\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyDistributor.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC2981Upgradeable} from \"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\";\nimport {IRoyaltyManager} from \"./interfaces/IRoyaltyManager.sol\";\n\ncontract RoyaltyDistributor is IERC2981Upgradeable {\n uint16 internal constant TOTAL_BASIS_POINTS = 10000;\n IRoyaltyManager public royaltyManager;\n\n function __RoyaltyDistributor_init(address _royaltyManager) internal {\n royaltyManager = IRoyaltyManager(_royaltyManager);\n }\n\n /// @notice Returns how much royalty is owed and to whom based on ERC2981\n /// @dev tokenId is one of the EIP2981 args for this function can't be removed\n /// @param _salePrice the price of token on which the royalty is calculated\n /// @return receiver the receiver of royalty\n /// @return royaltyAmount the amount of royalty\n function royaltyInfo(\n uint256, /*_tokenId */\n uint256 _salePrice\n ) external view returns (address receiver, uint256 royaltyAmount) {\n uint16 royaltyBps;\n (receiver, royaltyBps) = royaltyManager.getRoyaltyInfo();\n royaltyAmount = (_salePrice * royaltyBps) / TOTAL_BASIS_POINTS;\n return (receiver, royaltyAmount);\n }\n\n /// @notice Query if a contract implements interface `id`.\n /// @param interfaceId the interface identifier, as specified in ERC-165.\n /// @return `true` if the contract implements `id`.\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC2981Upgradeable).interfaceId;\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol": { + "content": "// SPDX-License-Identifier: MIT OR Apache-2.0\npragma solidity ^0.8.0;\n\nimport {AccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {IRoyaltyManager} from \"./interfaces/IRoyaltyManager.sol\";\nimport {\n IRoyaltySplitter,\n Recipient\n} from \"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\";\nimport {RoyaltySplitter} from \"./RoyaltySplitter.sol\";\nimport {Clones} from \"@openzeppelin/contracts/proxy/Clones.sol\";\n\n/// @title RoyaltyManager\n/// @author The Sandbox\n/// @notice Registry contract to set the common Recipient and Split for the RoyaltySplitter. Also, to set the royalty info\n/// for contracts that don't use the RoyaltySplitter.\ncontract RoyaltyManager is AccessControlUpgradeable, IRoyaltyManager {\n bytes32 public constant CONTRACT_ROYALTY_SETTER_ROLE = keccak256(\"CONTRACT_ROYALTY_SETTER\");\n\n uint16 internal constant TOTAL_BASIS_POINTS = 10000;\n uint16 public commonSplit;\n address payable public commonRecipient;\n mapping(address => uint16) public contractRoyalty;\n mapping(address => address payable) public _creatorRoyaltiesSplitter;\n address internal _royaltySplitterCloneable;\n address internal _trustedForwarder;\n\n /// @notice initialization function for the deployment of contract\n /// @dev called during the deployment via the proxy.\n /// @param _commonRecipient the != address(0)common recipient for all the splitters\n /// @param _commonSplit split for the common recipient's and creator split would be 10000 - commonSplit\n /// @param royaltySplitterCloneable address of cloneable splitter contract for royalties distribution\n /// @param managerAdmin address of RoyaltyManager contract.\n /// @param contractRoyaltySetter the address of royalty setter of contract.\n /// @param trustedForwarder the trustedForwarder address for royalty splitters to use.\n function initialize(\n address payable _commonRecipient,\n uint16 _commonSplit,\n address royaltySplitterCloneable,\n address managerAdmin,\n address contractRoyaltySetter,\n address trustedForwarder\n ) external initializer {\n _setRecipient(_commonRecipient);\n _setSplit(_commonSplit);\n _grantRole(DEFAULT_ADMIN_ROLE, managerAdmin);\n _grantRole(CONTRACT_ROYALTY_SETTER_ROLE, contractRoyaltySetter);\n _royaltySplitterCloneable = royaltySplitterCloneable;\n _trustedForwarder = trustedForwarder;\n }\n\n /// @notice sets royalty recipient wallet\n /// @dev should be called by the creator. The bps is not set on the splitter as it is set here on manager contract.\n /// @param recipient new recipient wallet.\n function setRoyaltyRecipient(address payable recipient) external {\n address payable creatorSplitterAddress = _creatorRoyaltiesSplitter[msg.sender];\n require(creatorSplitterAddress != address(0), \"Manager: No splitter deployed for the creator\");\n address _recipient = RoyaltySplitter(creatorSplitterAddress)._recipient();\n require(_recipient != recipient, \"Manager: Recipient already set\");\n Recipient[] memory newRecipient = new Recipient[](1);\n newRecipient[0] = Recipient({recipient: recipient, bps: 0});\n RoyaltySplitter(creatorSplitterAddress).setRecipients(newRecipient);\n }\n\n /// @notice sets the common recipient and common split\n /// @dev can only be called by the admin\n /// @param _commonRecipient is the common recipient for all the splitters\n function setRecipient(address payable _commonRecipient) external override onlyRole(DEFAULT_ADMIN_ROLE) {\n _setRecipient(_commonRecipient);\n }\n\n /// @notice sets the trustedForwarder address to be used by the splitters\n /// @dev can only be called by the admin\n /// @param _newForwarder is the new trusted forwarder address\n /// @dev new splitters will be deployed with this setting; existing splitters will have to apply it\n function setTrustedForwarder(address _newForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _trustedForwarder = _newForwarder;\n }\n\n /// @notice sets the common recipient and common split\n /// @dev can only be called by the admin.\n /// @param _commonSplit split for the common recipient and creators split would be 10000 - commonSplit\n function setSplit(uint16 _commonSplit) external override onlyRole(DEFAULT_ADMIN_ROLE) {\n _setSplit(_commonSplit);\n }\n\n /// @notice get the current trustedForwarder address\n function getTrustedForwarder() public view returns (address) {\n return _trustedForwarder;\n }\n\n function _setRecipient(address payable _commonRecipient) internal {\n require(_commonRecipient != address(0), \"Manager: Can't set common recipient to zero address\");\n commonRecipient = _commonRecipient;\n emit RecipientSet(_commonRecipient);\n }\n\n function _setSplit(uint16 _commonSplit) internal {\n require(_commonSplit < TOTAL_BASIS_POINTS, \"Manager: Can't set split greater than the total basis point\");\n commonSplit = _commonSplit;\n emit SplitSet(_commonSplit);\n }\n\n /// @notice called to set the EIP 2981 royalty split\n /// @dev can only be called by contract royalty setter.\n /// @param _royaltyBps the royalty split for the EIP 2981\n function setContractRoyalty(address contractAddress, uint16 _royaltyBps)\n external\n onlyRole(CONTRACT_ROYALTY_SETTER_ROLE)\n {\n require(_royaltyBps < TOTAL_BASIS_POINTS, \"Manager: Royalty can't be greater than Total base points\");\n contractRoyalty[contractAddress] = _royaltyBps;\n emit RoyaltySet(_royaltyBps, contractAddress);\n }\n\n /// @notice to be called by the splitters to get the common recipient and split\n /// @return recipient which has the common recipient and split\n function getCommonRecipient() external view override returns (Recipient memory recipient) {\n recipient = Recipient({recipient: commonRecipient, bps: commonSplit});\n return recipient;\n }\n\n /// @notice deploys splitter for creator\n /// @dev should only called once per creator\n /// @param creator the address of the creator\n /// @param recipient the wallet of the recipient where they would receive their royalty\n /// @return creatorSplitterAddress deployed for a creator\n function deploySplitter(address creator, address payable recipient) external returns (address payable) {\n address payable creatorSplitterAddress = _creatorRoyaltiesSplitter[creator];\n if (creatorSplitterAddress == address(0)) {\n creatorSplitterAddress = payable(Clones.clone(_royaltySplitterCloneable));\n RoyaltySplitter(creatorSplitterAddress).initialize(recipient, address(this));\n _creatorRoyaltiesSplitter[creator] = creatorSplitterAddress;\n }\n return creatorSplitterAddress;\n }\n\n /// @notice returns the address of splitter of a creator.\n /// @param creator the address of the creator\n /// @return creatorSplitterAddress deployed for a creator\n function getCreatorRoyaltySplitter(address creator) external view returns (address payable) {\n return _creatorRoyaltiesSplitter[creator];\n }\n\n /// @notice to be called by the splitters to get the common recipient and split\n /// @return creatorSplit which is 10000 - commonSplit\n function getCreatorSplit() external view returns (uint16) {\n return TOTAL_BASIS_POINTS - commonSplit;\n }\n\n /// @notice returns the commonRecipient and EIP2981 royalty split\n /// @return commonRecipient\n /// @return royaltySplit\n function getRoyaltyInfo() external view returns (address payable, uint16) {\n return (commonRecipient, contractRoyalty[msg.sender]);\n }\n\n /// @notice returns the commonRecipient and EIP2981 royalty split\n /// @param _contractAddress the address of the contract for which the royalty is required.\n /// @return royaltyBps royalty bps of the contarct\n function getContractRoyalty(address _contractAddress) external view returns (uint16 royaltyBps) {\n return contractRoyalty[_contractAddress];\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol": { + "content": "// SPDX-License-Identifier: MIT OR Apache-2.0\npragma solidity ^0.8.0;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {\n OwnableUpgradeable,\n ContextUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {AddressUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport {ERC165Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\nimport {SafeMath} from \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {BytesLibrary} from \"@manifoldxyz/royalty-registry-solidity/contracts/libraries/BytesLibrary.sol\";\nimport {\n IRoyaltySplitter,\n IERC165,\n Recipient\n} from \"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\";\nimport {\n ERC2771HandlerAbstract\n} from \"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\";\nimport {IRoyaltyManager} from \"./interfaces/IRoyaltyManager.sol\";\nimport {IERC20Approve} from \"./interfaces/IERC20Approve.sol\";\n\n/// @title RoyaltySplitter\n/// @author The Sandbox\n/// @notice RoyaltySplitter contract is deployed by the RoyaltyManager contract for a creator to get his royalty's share.\ncontract RoyaltySplitter is\n Initializable,\n OwnableUpgradeable,\n IRoyaltySplitter,\n ERC165Upgradeable,\n ERC2771HandlerAbstract\n{\n using BytesLibrary for bytes;\n using AddressUpgradeable for address payable;\n using AddressUpgradeable for address;\n using SafeMath for uint256;\n\n uint256 internal constant TOTAL_BASIS_POINTS = 10000;\n uint256 internal constant IERC20_APPROVE_SELECTOR =\n 0x095ea7b300000000000000000000000000000000000000000000000000000000;\n uint256 internal constant SELECTOR_MASK = 0xffffffff00000000000000000000000000000000000000000000000000000000;\n\n address payable public _recipient;\n IRoyaltyManager public _royaltyManager;\n\n event ETHTransferred(address indexed account, uint256 amount);\n event ERC20Transferred(address indexed erc20Contract, address indexed account, uint256 amount);\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(IERC165, ERC165Upgradeable)\n returns (bool)\n {\n return interfaceId == type(IRoyaltySplitter).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /// @notice initialize the contract\n /// @dev can only be run once.\n /// @param recipient the wallet of the creator when the contract is deployed\n /// @param royaltyManager the address of the royalty manager contract\n function initialize(address payable recipient, address royaltyManager) public initializer {\n _royaltyManager = IRoyaltyManager(royaltyManager); // set manager before Ownable_init for _isTrustedForwarder\n _recipient = recipient;\n __Ownable_init();\n }\n\n /// @notice sets recipient for the splitter\n /// @dev only the owner can call this.\n /// @param recipients the array of recipients which should only have one recipient.\n function setRecipients(Recipient[] calldata recipients) external override onlyOwner {\n _setRecipients(recipients);\n }\n\n function _setRecipients(Recipient[] calldata recipients) private {\n delete _recipient;\n require(recipients.length == 1, \"Invalid recipents length\");\n _recipient = recipients[0].recipient;\n }\n\n /// @notice to get recipients of royalty through this splitter and their splits of royalty.\n /// @return recipients of royalty through this splitter and their splits of royalty.\n function getRecipients() external view override returns (Recipient[] memory) {\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\n uint16 creatorSplit = _royaltyManager.getCreatorSplit();\n Recipient[] memory recipients = new Recipient[](2);\n recipients[0].recipient = _recipient;\n recipients[0].bps = creatorSplit;\n recipients[1] = commonRecipient;\n return recipients;\n }\n\n /// @notice Splits and forwards ETH to the royalty receivers\n /// @dev splits ETH every time it is sent to this contract as royalty.\n receive() external payable {\n _splitETH(msg.value);\n }\n\n /// @notice Splits and forwards ETH to the royalty receivers\n /// @dev normally ETH should be split automatically by receive function.\n function splitETH() public payable {\n _splitETH(address(this).balance);\n }\n\n function _splitETH(uint256 value) internal {\n if (value > 0) {\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\n uint16 creatorSplit = _royaltyManager.getCreatorSplit();\n Recipient[] memory _recipients = new Recipient[](2);\n _recipients[0].recipient = _recipient;\n _recipients[0].bps = creatorSplit;\n _recipients[1] = commonRecipient;\n uint256 totalSent;\n uint256 amountToSend;\n unchecked {\n for (uint256 i = _recipients.length - 1; i > 0; i--) {\n Recipient memory recipient = _recipients[i];\n amountToSend = (value * recipient.bps) / TOTAL_BASIS_POINTS;\n totalSent += amountToSend;\n recipient.recipient.sendValue(amountToSend);\n emit ETHTransferred(recipient.recipient, amountToSend);\n }\n // Favor the 1st recipient if there are any rounding issues\n amountToSend = value - totalSent;\n }\n _recipients[0].recipient.sendValue(amountToSend);\n emit ETHTransferred(_recipients[0].recipient, amountToSend);\n }\n }\n\n /// @notice split ERC20 Tokens owned by this contract.\n /// @dev can only be called by one of the recipients\n /// @param erc20Contract the address of the tokens to be split.\n function splitERC20Tokens(IERC20 erc20Contract) public {\n require(_splitERC20Tokens(erc20Contract), \"Split: ERC20 split failed\");\n }\n\n function _splitERC20Tokens(IERC20 erc20Contract) internal returns (bool) {\n try erc20Contract.balanceOf(address(this)) returns (uint256 balance) {\n if (balance == 0) {\n return false;\n }\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\n uint16 creatorSplit = _royaltyManager.getCreatorSplit();\n require(\n commonRecipient.recipient == _msgSender() || _recipient == _msgSender(),\n \"Split: Can only be called by one of the recipients\"\n );\n Recipient[] memory _recipients = new Recipient[](2);\n _recipients[0].recipient = _recipient;\n _recipients[0].bps = creatorSplit;\n _recipients[1] = commonRecipient;\n uint256 amountToSend;\n uint256 totalSent;\n unchecked {\n for (uint256 i = _recipients.length - 1; i > 0; i--) {\n Recipient memory recipient = _recipients[i];\n bool success;\n (success, amountToSend) = balance.tryMul(recipient.bps);\n\n amountToSend /= TOTAL_BASIS_POINTS;\n totalSent += amountToSend;\n try erc20Contract.transfer(recipient.recipient, amountToSend) {\n emit ERC20Transferred(address(erc20Contract), recipient.recipient, amountToSend);\n } catch {\n return false;\n }\n }\n // Favor the 1st recipient if there are any rounding issues\n amountToSend = balance - totalSent;\n }\n try erc20Contract.transfer(_recipients[0].recipient, amountToSend) {\n emit ERC20Transferred(address(erc20Contract), _recipients[0].recipient, amountToSend);\n } catch {\n return false;\n }\n return true;\n } catch {\n return false;\n }\n }\n\n /// @notice made for unexpected scenarios when assets are sent to this contact such that they could be recovered.\n /// @dev first attempts to split ERC20 tokens.\n /// @param target target of the call\n /// @param callData for the call.\n function proxyCall(address payable target, bytes calldata callData) external {\n Recipient memory commonRecipient = _royaltyManager.getCommonRecipient();\n require(\n commonRecipient.recipient == _msgSender() || _recipient == _msgSender(),\n \"Split: Can only be called by one of the recipients\"\n );\n require(\n !callData.startsWith(IERC20Approve.approve.selector) &&\n !callData.startsWith(IERC20Approve.increaseAllowance.selector),\n \"Split: ERC20 tokens must be split\"\n );\n /* solhint-disable-next-line no-empty-blocks*/\n try this.splitERC20Tokens(IERC20(target)) {} catch {}\n target.functionCall(callData);\n }\n\n /// @notice verify whether a forwarder address is the trustedForwarder address, using the manager setting\n /// @dev this function is used to avoid having a trustedForwarder variable inside the splitter\n /// @return bool whether the forwarder is the trusted address\n function _isTrustedForwarder(address forwarder) internal view override(ERC2771HandlerAbstract) returns (bool) {\n return forwarder == _royaltyManager.getTrustedForwarder();\n }\n\n function _msgSender()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (address sender)\n {\n return ERC2771HandlerAbstract._msgSender();\n }\n\n function _msgData()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (bytes calldata)\n {\n return ERC2771HandlerAbstract._msgData();\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 2000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/deploy/deployments/mumbai/solcInputs/f945dbcb44c3ca52caf6c6145c517ab2.json b/packages/deploy/deployments/mumbai/solcInputs/f945dbcb44c3ca52caf6c6145c517ab2.json new file mode 100644 index 0000000000..bb9206a321 --- /dev/null +++ b/packages/deploy/deployments/mumbai/solcInputs/f945dbcb44c3ca52caf6c6145c517ab2.json @@ -0,0 +1,128 @@ +{ + "language": "Solidity", + "sources": { + "@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\nstruct Recipient {\n address payable recipient;\n uint16 bps;\n}\n\ninterface IRoyaltySplitter is IERC165 {\n /**\n * @dev Set the splitter recipients. Total bps must total 10000.\n */\n function setRecipients(Recipient[] calldata recipients) external;\n\n /**\n * @dev Get the splitter recipients;\n */\n function getRecipients() external view returns (Recipient[] memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n function __AccessControl_init() internal onlyInitializing {\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\n }\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(account),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Interface for the NFT Royalty Standard.\n *\n * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal\n * support for royalty payments across all NFT marketplaces and ecosystem participants.\n *\n * _Available since v4.5._\n */\ninterface IERC2981Upgradeable is IERC165Upgradeable {\n /**\n * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\n * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.\n */\n function royaltyInfo(\n uint256 tokenId,\n uint256 salePrice\n ) external view returns (address receiver, uint256 royaltyAmount);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/common/ERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/IERC2981Upgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.\n *\n * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for\n * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.\n *\n * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the\n * fee is specified in basis points by default.\n *\n * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See\n * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to\n * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.\n *\n * _Available since v4.5._\n */\nabstract contract ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable {\n function __ERC2981_init() internal onlyInitializing {\n }\n\n function __ERC2981_init_unchained() internal onlyInitializing {\n }\n struct RoyaltyInfo {\n address receiver;\n uint96 royaltyFraction;\n }\n\n RoyaltyInfo private _defaultRoyaltyInfo;\n mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC165Upgradeable) returns (bool) {\n return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @inheritdoc IERC2981Upgradeable\n */\n function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual override returns (address, uint256) {\n RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId];\n\n if (royalty.receiver == address(0)) {\n royalty = _defaultRoyaltyInfo;\n }\n\n uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator();\n\n return (royalty.receiver, royaltyAmount);\n }\n\n /**\n * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a\n * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an\n * override.\n */\n function _feeDenominator() internal pure virtual returns (uint96) {\n return 10000;\n }\n\n /**\n * @dev Sets the royalty information that all ids in this contract will default to.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator.\n */\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\n require(feeNumerator <= _feeDenominator(), \"ERC2981: royalty fee will exceed salePrice\");\n require(receiver != address(0), \"ERC2981: invalid receiver\");\n\n _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);\n }\n\n /**\n * @dev Removes default royalty information.\n */\n function _deleteDefaultRoyalty() internal virtual {\n delete _defaultRoyaltyInfo;\n }\n\n /**\n * @dev Sets the royalty information for a specific token id, overriding the global default.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator.\n */\n function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {\n require(feeNumerator <= _feeDenominator(), \"ERC2981: royalty fee will exceed salePrice\");\n require(receiver != address(0), \"ERC2981: Invalid parameters\");\n\n _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);\n }\n\n /**\n * @dev Resets royalty information for the token id back to the global default.\n */\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\n delete _tokenRoyaltyInfo[tokenId];\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[48] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC1155Upgradeable.sol\";\nimport \"./IERC1155ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC1155MetadataURIUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the basic standard multi-token.\n * See https://eips.ethereum.org/EIPS/eip-1155\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\n *\n * _Available since v3.1._\n */\ncontract ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155Upgradeable, IERC1155MetadataURIUpgradeable {\n using AddressUpgradeable for address;\n\n // Mapping from token ID to account balances\n mapping(uint256 => mapping(address => uint256)) private _balances;\n\n // Mapping from account to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json\n string private _uri;\n\n /**\n * @dev See {_setURI}.\n */\n function __ERC1155_init(string memory uri_) internal onlyInitializing {\n __ERC1155_init_unchained(uri_);\n }\n\n function __ERC1155_init_unchained(string memory uri_) internal onlyInitializing {\n _setURI(uri_);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC1155Upgradeable).interfaceId ||\n interfaceId == type(IERC1155MetadataURIUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155MetadataURI-uri}.\n *\n * This implementation returns the same URI for *all* token types. It relies\n * on the token type ID substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * Clients calling this function must replace the `\\{id\\}` substring with the\n * actual token type ID.\n */\n function uri(uint256) public view virtual override returns (string memory) {\n return _uri;\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {\n require(account != address(0), \"ERC1155: address zero is not a valid owner\");\n return _balances[id][account];\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(accounts.length == ids.length, \"ERC1155: accounts and ids length mismatch\");\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeTransferFrom(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n\n emit TransferSingle(operator, from, to, id, amount);\n\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n }\n\n emit TransferBatch(operator, from, to, ids, amounts);\n\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);\n }\n\n /**\n * @dev Sets a new URI for all token types, by relying on the token type ID\n * substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * By this mechanism, any occurrence of the `\\{id\\}` substring in either the\n * URI or any of the amounts in the JSON file at said URI will be replaced by\n * clients with the token type ID.\n *\n * For example, the `https://token-cdn-domain/\\{id\\}.json` URI would be\n * interpreted by clients as\n * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\n * for token type ID 0x4cce0.\n *\n * See {uri}.\n *\n * Because these URIs cannot be meaningfully represented by the {URI} event,\n * this function emits no events.\n */\n function _setURI(string memory newuri) internal virtual {\n _uri = newuri;\n }\n\n /**\n * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _balances[id][to] += amount;\n emit TransferSingle(operator, address(0), to, id, amount);\n\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; i++) {\n _balances[ids[i]][to] += amounts[i];\n }\n\n emit TransferBatch(operator, address(0), to, ids, amounts);\n\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);\n }\n\n /**\n * @dev Destroys `amount` tokens of token type `id` from `from`\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `from` must have at least `amount` tokens of token type `id`.\n */\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n\n emit TransferSingle(operator, from, address(0), id, amount);\n\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n */\n function _burnBatch(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n for (uint256 i = 0; i < ids.length; i++) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n }\n\n emit TransferBatch(operator, from, address(0), ids, amounts);\n\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC1155: setting approval status for self\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `ids` and `amounts` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `id` and `amount` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155ReceiverUpgradeable(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {\n if (response != IERC1155ReceiverUpgradeable.onERC1155Received.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (\n bytes4 response\n ) {\n if (response != IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n }\n }\n }\n\n function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {\n uint256[] memory array = new uint256[](1);\n array[0] = element;\n\n return array;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[47] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/extensions/ERC1155Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of {ERC1155} that allows token holders to destroy both their\n * own tokens and those that they have been approved to use.\n *\n * _Available since v3.1._\n */\nabstract contract ERC1155BurnableUpgradeable is Initializable, ERC1155Upgradeable {\n function __ERC1155Burnable_init() internal onlyInitializing {\n }\n\n function __ERC1155Burnable_init_unchained() internal onlyInitializing {\n }\n function burn(address account, uint256 id, uint256 value) public virtual {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n\n _burn(account, id, value);\n }\n\n function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n\n _burnBatch(account, ids, values);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of ERC1155 that adds tracking of total supply per id.\n *\n * Useful for scenarios where Fungible and Non-fungible tokens have to be\n * clearly identified. Note: While a totalSupply of 1 might mean the\n * corresponding is an NFT, there is no guarantees that no other token with the\n * same id are not going to be minted.\n */\nabstract contract ERC1155SupplyUpgradeable is Initializable, ERC1155Upgradeable {\n function __ERC1155Supply_init() internal onlyInitializing {\n }\n\n function __ERC1155Supply_init_unchained() internal onlyInitializing {\n }\n mapping(uint256 => uint256) private _totalSupply;\n\n /**\n * @dev Total amount of tokens in with a given id.\n */\n function totalSupply(uint256 id) public view virtual returns (uint256) {\n return _totalSupply[id];\n }\n\n /**\n * @dev Indicates whether any token exist with a given id, or not.\n */\n function exists(uint256 id) public view virtual returns (bool) {\n return ERC1155SupplyUpgradeable.totalSupply(id) > 0;\n }\n\n /**\n * @dev See {ERC1155-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n if (from == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n _totalSupply[ids[i]] += amounts[i];\n }\n }\n\n if (to == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n uint256 supply = _totalSupply[id];\n require(supply >= amount, \"ERC1155: burn amount exceeds totalSupply\");\n unchecked {\n _totalSupply[id] = supply - amount;\n }\n }\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155URIStorage.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../../utils/StringsUpgradeable.sol\";\nimport \"../ERC1155Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev ERC1155 token with storage based token URI management.\n * Inspired by the ERC721URIStorage extension\n *\n * _Available since v4.6._\n */\nabstract contract ERC1155URIStorageUpgradeable is Initializable, ERC1155Upgradeable {\n function __ERC1155URIStorage_init() internal onlyInitializing {\n __ERC1155URIStorage_init_unchained();\n }\n\n function __ERC1155URIStorage_init_unchained() internal onlyInitializing {\n _baseURI = \"\";\n }\n using StringsUpgradeable for uint256;\n\n // Optional base URI\n string private _baseURI;\n\n // Optional mapping for token URIs\n mapping(uint256 => string) private _tokenURIs;\n\n /**\n * @dev See {IERC1155MetadataURI-uri}.\n *\n * This implementation returns the concatenation of the `_baseURI`\n * and the token-specific uri if the latter is set\n *\n * This enables the following behaviors:\n *\n * - if `_tokenURIs[tokenId]` is set, then the result is the concatenation\n * of `_baseURI` and `_tokenURIs[tokenId]` (keep in mind that `_baseURI`\n * is empty per default);\n *\n * - if `_tokenURIs[tokenId]` is NOT set then we fallback to `super.uri()`\n * which in most cases will contain `ERC1155._uri`;\n *\n * - if `_tokenURIs[tokenId]` is NOT set, and if the parents do not have a\n * uri value set, then the result is empty.\n */\n function uri(uint256 tokenId) public view virtual override returns (string memory) {\n string memory tokenURI = _tokenURIs[tokenId];\n\n // If token URI is set, concatenate base URI and tokenURI (via abi.encodePacked).\n return bytes(tokenURI).length > 0 ? string(abi.encodePacked(_baseURI, tokenURI)) : super.uri(tokenId);\n }\n\n /**\n * @dev Sets `tokenURI` as the tokenURI of `tokenId`.\n */\n function _setURI(uint256 tokenId, string memory tokenURI) internal virtual {\n _tokenURIs[tokenId] = tokenURI;\n emit URI(uri(tokenId), tokenId);\n }\n\n /**\n * @dev Sets `baseURI` as the `_baseURI` for all tokens\n */\n function _setBaseURI(string memory baseURI) internal virtual {\n _baseURI = baseURI;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[48] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/IERC1155MetadataURIUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Upgradeable.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURIUpgradeable is IERC1155Upgradeable {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155ReceiverUpgradeable is IERC165Upgradeable {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/Catalyst.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\nimport {ERC1155Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol\";\nimport {\n AccessControlUpgradeable,\n ContextUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {\n ERC1155BurnableUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol\";\nimport {\n ERC1155SupplyUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol\";\nimport {\n ERC1155URIStorageUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol\";\nimport {\n IERC165Upgradeable,\n ERC2981Upgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {\n OperatorFiltererUpgradeable,\n IOperatorFilterRegistry\n} from \"@sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol\";\nimport {\n RoyaltyDistributor\n} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyDistributor.sol\";\nimport {\n IRoyaltyManager\n} from \"@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyManager.sol\";\nimport {IERC2981Upgradeable} from \"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\";\nimport {\n ERC2771HandlerUpgradeable,\n ERC2771HandlerAbstract\n} from \"@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol\";\nimport {ICatalyst} from \"./interfaces/ICatalyst.sol\";\n\n/// @title Catalyst\n/// @author The Sandbox\n/// @notice THis contract manages catalysts which are used to mint new assets.\n/// @dev An ERC1155 contract that manages catalysts, extends multiple OpenZeppelin contracts to\n/// provide a variety of features including, AccessControl, URIStorage, Burnable and more.\n/// The contract includes support for meta transactions.\ncontract Catalyst is\n ICatalyst,\n Initializable,\n ERC1155Upgradeable,\n ERC1155BurnableUpgradeable,\n ERC1155SupplyUpgradeable,\n ERC1155URIStorageUpgradeable,\n ERC2771HandlerUpgradeable,\n AccessControlUpgradeable,\n OperatorFiltererUpgradeable,\n RoyaltyDistributor\n{\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant BURNER_ROLE = keccak256(\"BURNER_ROLE\");\n\n uint256 public highestTierIndex;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n modifier onlyValidId(uint256 tokenId) {\n require(tokenId > 0 && tokenId <= highestTierIndex, \"Catalyst: invalid catalyst id\");\n _;\n }\n\n /// @notice Initialize the contract, setting up initial values for various features.\n /// @param _baseUri The base URI for the token metadata, most likely set to ipfs://.\n /// @param _trustedForwarder The trusted forwarder for meta transactions.\n /// @param _subscription The subscription address.\n /// @param _defaultAdmin The default admin address.\n /// @param _defaultMinter The default minter address.\n /// @param _catalystIpfsCID The IPFS content identifiers for each catalyst.\n /// @param _royaltyManager, the address of the Manager contract for common royalty recipient\n function initialize(\n string memory _baseUri,\n address _trustedForwarder,\n address _subscription,\n address _defaultAdmin,\n address _defaultMinter,\n string[] memory _catalystIpfsCID,\n address _royaltyManager\n ) public initializer {\n require(bytes(_baseUri).length != 0, \"Catalyst: base uri can't be empty\");\n require(_trustedForwarder != address(0), \"Catalyst: trusted forwarder can't be zero\");\n require(_subscription != address(0), \"Catalyst: subscription can't be zero\");\n require(_defaultAdmin != address(0), \"Catalyst: admin can't be zero\");\n require(_defaultMinter != address(0), \"Catalyst: minter can't be zero\");\n require(_royaltyManager != address(0), \"Catalyst: royalty manager can't be zero\");\n __ERC1155_init(_baseUri);\n __AccessControl_init();\n __ERC1155Burnable_init();\n __ERC1155Supply_init();\n __ERC1155URIStorage_init();\n __ERC2771Handler_init(_trustedForwarder);\n __OperatorFilterer_init(_subscription, true);\n _setBaseURI(_baseUri);\n _grantRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);\n _grantRole(MINTER_ROLE, _defaultMinter);\n __RoyaltyDistributor_init(_royaltyManager);\n for (uint256 i = 0; i < _catalystIpfsCID.length; i++) {\n require(bytes(_catalystIpfsCID[i]).length != 0, \"Catalyst: CID can't be empty\");\n _setURI(i, _catalystIpfsCID[i]);\n highestTierIndex = i;\n }\n }\n\n /// @notice Mints a new token, limited to MINTER_ROLE only\n /// @param to The address that will own the minted token\n /// @param id The token id to mint\n /// @param amount The amount to be minted\n function mint(\n address to,\n uint256 id,\n uint256 amount\n ) external onlyRole(MINTER_ROLE) onlyValidId(id) {\n _mint(to, id, amount, \"\");\n }\n\n /// @notice Mints a batch of tokens, limited to MINTER_ROLE only\n /// @param to The address that will own the minted tokens\n /// @param ids The token ids to mint\n /// @param amounts The amounts to be minted per token id\n function mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts\n ) external onlyRole(MINTER_ROLE) {\n for (uint256 i = 0; i < ids.length; i++) {\n require(ids[i] > 0 && ids[i] <= highestTierIndex, \"Catalyst: invalid catalyst id\");\n }\n _mintBatch(to, ids, amounts, \"\");\n }\n\n /// @notice Burns a specified amount of tokens from a specific address\n /// @param account The address to burn from\n /// @param id The token id to burn\n /// @param amount The amount to be burned\n function burnFrom(\n address account,\n uint256 id,\n uint256 amount\n ) external onlyRole(BURNER_ROLE) {\n _burn(account, id, amount);\n }\n\n /// @notice Burns a batch of tokens from a specific address\n /// @param account The address to burn from\n /// @param ids The token ids to burn\n /// @param amounts The amounts to be burned\n function burnBatchFrom(\n address account,\n uint256[] memory ids,\n uint256[] memory amounts\n ) external onlyRole(BURNER_ROLE) {\n _burnBatch(account, ids, amounts);\n }\n\n /// @notice Add a new catalyst type, limited to DEFAULT_ADMIN_ROLE only\n /// @param ipfsCID The royalty bps for the catalyst\n function addNewCatalystType(string memory ipfsCID) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(bytes(ipfsCID).length != 0, \"Catalyst: CID can't be empty\");\n uint256 newCatId = ++highestTierIndex;\n ERC1155URIStorageUpgradeable._setURI(newCatId, ipfsCID);\n emit NewCatalystTypeAdded(newCatId);\n }\n\n /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only\n /// @dev Change the address of the trusted forwarder for meta-TX\n /// @param trustedForwarder The new trustedForwarder\n function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(trustedForwarder != address(0), \"Catalyst: trusted forwarder can't be zero address\");\n _setTrustedForwarder(trustedForwarder);\n }\n\n /// @notice Set a new URI for specific tokenid\n /// @param tokenId The token id to set URI for\n /// @param metadataHash The new URI\n function setMetadataHash(uint256 tokenId, string memory metadataHash)\n external\n onlyRole(DEFAULT_ADMIN_ROLE)\n onlyValidId(tokenId)\n {\n require(bytes(metadataHash).length != 0, \"Catalyst: metadataHash can't be empty\");\n _setURI(tokenId, metadataHash);\n }\n\n /// @notice Set a new base URI\n /// @param baseURI The new base URI\n function setBaseURI(string memory baseURI) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(bytes(baseURI).length != 0, \"Catalyst: base uri can't be empty\");\n _setBaseURI(baseURI);\n }\n\n /// @notice returns full token URI, including baseURI and token metadata URI\n /// @param tokenId The token id to get URI for\n /// @return tokenURI the URI of the token\n function uri(uint256 tokenId)\n public\n view\n override(ERC1155Upgradeable, ERC1155URIStorageUpgradeable)\n returns (string memory)\n {\n return ERC1155URIStorageUpgradeable.uri(tokenId);\n }\n\n /// @dev Needed for meta transactions (see EIP-2771)\n function _msgSender() internal view virtual override(ContextUpgradeable, ERC2771HandlerAbstract) returns (address) {\n return ERC2771HandlerAbstract._msgSender();\n }\n\n /// @dev Needed for meta transactions (see EIP-2771)\n function _msgData()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771HandlerAbstract)\n returns (bytes calldata)\n {\n return ERC2771HandlerAbstract._msgData();\n }\n\n /// @notice Transfers `value` tokens of type `id` from `from` to `to` (with safety call).\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param id the token type transfered.\n /// @param value amount of token transfered.\n /// @param data aditional data accompanying the transfer.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 value,\n bytes memory data\n ) public override onlyAllowedOperator(from) {\n super._safeTransferFrom(from, to, id, value, data);\n }\n\n /// @notice Transfers `values` tokens of type `ids` from `from` to `to` (with safety call).\n /// @dev call data should be optimized to order ids so packedBalance can be used efficiently.\n /// @param from address from which tokens are transfered.\n /// @param to address to which the token will be transfered.\n /// @param ids ids of each token type transfered.\n /// @param values amount of each token type transfered.\n /// @param data aditional data accompanying the transfer.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory values,\n bytes memory data\n ) public override onlyAllowedOperator(from) {\n super._safeBatchTransferFrom(from, to, ids, values, data);\n }\n\n /// @notice Enable or disable approval for `operator` to manage all of the caller's tokens.\n /// @param operator address which will be granted rights to transfer all tokens of the caller.\n /// @param approved whether to approve or revoke\n function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {\n super._setApprovalForAll(_msgSender(), operator, approved);\n }\n\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n }\n\n /// @notice Query if a contract implements interface `id`.\n /// @param interfaceId the interface identifier, as specified in ERC-165.\n /// @return `true` if the contract implements `interfaceId`.\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(ERC1155Upgradeable, AccessControlUpgradeable, RoyaltyDistributor)\n returns (bool)\n {\n return super.supportsInterface(interfaceId);\n }\n\n /// @notice This function is used to register Catalyst contract on the Operator Filterer Registry of Opensea.can only be called by admin.\n /// @dev used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.\n /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe.\n /// @param subscribe bool to signify subscription \"true\"\" or to copy the list \"false\".\n function registerAndSubscribe(address subscriptionOrRegistrantToCopy, bool subscribe)\n external\n onlyRole(DEFAULT_ADMIN_ROLE)\n {\n require(subscriptionOrRegistrantToCopy != address(0), \"Catalyst: subscription can't be zero address\");\n _registerAndSubscribe(subscriptionOrRegistrantToCopy, subscribe);\n }\n\n /// @notice sets filter registry address deployed in test\n /// @param registry the address of the registry\n function setOperatorRegistry(address registry) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(registry != address(0), \"Catalyst: registry can't be zero address\");\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/interfaces/ICatalyst.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.18;\n\ninterface ICatalyst {\n enum CatalystType {TSB_EXCLUSIVE, COMMON, UNCOMMON, RARE, EPIC, LEGENDARY, MYTHIC}\n\n event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);\n event NewCatalystTypeAdded(uint256 catalystId);\n event DefaultRoyaltyChanged(address indexed newDefaultRoyaltyRecipient, uint256 newDefaultRoyaltyAmount);\n\n /// @notice Mints a new token, limited to MINTER_ROLE only\n /// @param to The address that will own the minted token\n /// @param id The token id to mint\n /// @param amount The amount to be minted\n function mint(\n address to,\n uint256 id,\n uint256 amount\n ) external;\n\n /// @notice Mints a batch of tokens, limited to MINTER_ROLE only\n /// @param to The address that will own the minted tokens\n /// @param ids The token ids to mint\n /// @param amounts The amounts to be minted per token id\n function mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts\n ) external;\n\n /// @notice Burns a specified amount of tokens from a specific address\n /// @param account The address to burn from\n /// @param id The token id to burn\n /// @param amount The amount to be burned\n function burnFrom(\n address account,\n uint256 id,\n uint256 amount\n ) external;\n\n /// @notice Burns a batch of tokens from a specific address\n /// @param account The address to burn from\n /// @param ids The token ids to burn\n /// @param amounts The amounts to be burned\n function burnBatchFrom(\n address account,\n uint256[] memory ids,\n uint256[] memory amounts\n ) external;\n\n /// @notice Add a new catalyst type, limited to DEFAULT_ADMIN_ROLE only\n /// @param ipfsCID The royalty bps for the catalyst\n function addNewCatalystType(string memory ipfsCID) external;\n\n /// @notice Set a new URI for specific tokenid\n /// @param tokenId The token id to set URI for\n /// @param metadataHash The new URI\n function setMetadataHash(uint256 tokenId, string memory metadataHash) external;\n\n /// @notice Set a new base URI\n /// @param baseURI The new base URI\n function setBaseURI(string memory baseURI) external;\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockCatalyst.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity 0.8.18;\n\nimport {Catalyst, IOperatorFilterRegistry} from \"../Catalyst.sol\";\n\ncontract MockCatalyst is Catalyst {\n /// @notice sets registry and subscribe to subscription\n /// @param registry address of registry\n /// @param subscription address to subscribe\n function setRegistryAndSubscribe(address registry, address subscription) external {\n operatorFilterRegistry = IOperatorFilterRegistry(registry);\n operatorFilterRegistry.registerAndSubscribe(address(this), subscription);\n }\n\n /// @notice Mint new tokens with out minter role\n /// @param to The address of the recipient\n /// @param id The id of the token to mint\n /// @param amount The amount of the token to mint\n function mintWithoutMinterRole(\n address to,\n uint256 id,\n uint256 amount\n ) external {\n _mint(to, id, amount, \"\");\n }\n\n /// @notice set approval for asset transfer without filteration\n /// @param operator operator to be approved\n /// @param approved bool value for giving (true) and canceling (false) approval\n function setApprovalForAllWithoutFilter(address operator, bool approved) public virtual {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n}\n" + }, + "@sandbox-smart-contracts/asset/contracts/mock/MockTrustedForwarder.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {MockTrustedForwarder} from \"@sandbox-smart-contracts/dependency-metatx/contracts/test/MockTrustedForwarder.sol\";\n" + }, + "@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerAbstract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @dev minimal ERC2771 handler to keep bytecode-size down\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\nabstract contract ERC2771HandlerAbstract {\n /// @notice return true if the forwarder is the trusted forwarder\n /// @param forwarder trusted forwarder address to check\n /// @return true if the address is the same as the trusted forwarder\n function isTrustedForwarder(address forwarder) external view returns (bool) {\n return _isTrustedForwarder(forwarder);\n }\n\n /// @notice if the call is from the trusted forwarder the sender is extracted from calldata, msg.sender otherwise\n /// @return sender the calculated address of the sender\n function _msgSender() internal view virtual returns (address sender) {\n if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n sender = msg.sender;\n }\n }\n\n /// @notice if the call is from the trusted forwarder the sender is removed from calldata\n /// @return the calldata without the sender\n function _msgData() internal view virtual returns (bytes calldata) {\n if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\n return msg.data[:msg.data.length - 20];\n } else {\n return msg.data;\n }\n }\n\n /// @notice return true if the forwarder is the trusted forwarder\n /// @param forwarder trusted forwarder address to check\n /// @return true if the address is the same as the trusted forwarder\n /// @dev this function must be IMPLEMENTED\n function _isTrustedForwarder(address forwarder) internal view virtual returns (bool);\n}\n" + }, + "@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ERC2771HandlerAbstract} from \"./ERC2771HandlerAbstract.sol\";\n\n/// @dev minimal ERC2771 handler to keep bytecode-size down\n/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol\ncontract ERC2771HandlerUpgradeable is Initializable, ERC2771HandlerAbstract {\n address private _trustedForwarder;\n\n /// @notice Emitted when a `newTrustedForwarder` is set, replacing the `oldTrustedForwarder`\n /// @param oldTrustedForwarder old trusted forwarder\n /// @param newTrustedForwarder new trusted forwarder\n /// @param operator the sender of the transaction\n event TrustedForwarderSet(\n address indexed oldTrustedForwarder,\n address indexed newTrustedForwarder,\n address indexed operator\n );\n\n /// @notice initialize the trusted forwarder address\n /// @param forwarder trusted forwarder address or zero to disable it\n function __ERC2771Handler_init(address forwarder) internal onlyInitializing {\n __ERC2771Handler_init_unchained(forwarder);\n }\n\n /// @notice initialize the trusted forwarder address\n /// @param forwarder trusted forwarder address or zero to disable it\n function __ERC2771Handler_init_unchained(address forwarder) internal onlyInitializing {\n _setTrustedForwarder(forwarder);\n }\n\n /// @notice return the address of the trusted forwarder\n /// @return return the address of the trusted forwarder\n function getTrustedForwarder() external view returns (address) {\n return _trustedForwarder;\n }\n\n /// @notice set the address of the trusted forwarder\n /// @param newForwarder the address of the new forwarder.\n function _setTrustedForwarder(address newForwarder) internal virtual {\n require(newForwarder != _trustedForwarder, \"ERC2771HandlerUpgradeable: forwarder already set\");\n emit TrustedForwarderSet(_trustedForwarder, newForwarder, _msgSender());\n _trustedForwarder = newForwarder;\n }\n\n /// @notice return true if the forwarder is the trusted forwarder\n /// @param forwarder trusted forwarder address to check\n /// @return true if the address is the same as the trusted forwarder\n function _isTrustedForwarder(address forwarder) internal view virtual override returns (bool) {\n return forwarder == _trustedForwarder;\n }\n\n uint256[49] private __gap;\n}\n" + }, + "@sandbox-smart-contracts/dependency-metatx/contracts/test/MockTrustedForwarder.sol": { + "content": "//SPDX-License-Identifier: MIT\n// solhint-disable-next-line compiler-version\npragma solidity ^0.8.2;\n\ncontract MockTrustedForwarder {\n struct ForwardRequest {\n address from;\n address to;\n uint256 value;\n uint256 gasLimit;\n bytes data;\n }\n\n function execute(ForwardRequest calldata req) public payable returns (bool, bytes memory) {\n (bool success, bytes memory returndata) = req.to.call{gas: req.gasLimit, value: req.value}(\n abi.encodePacked(req.data, req.from)\n );\n assert(gasleft() > req.gasLimit / 63);\n return (success, returndata);\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-operator-filter/contracts/interfaces/IOperatorFilterRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IOperatorFilterRegistry {\n /**\n * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns\n * true if supplied registrant address is not registered.\n */\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\n\n /**\n * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.\n */\n function register(address registrant) external;\n\n /**\n * @notice Registers an address with the registry and \"subscribes\" to another address's filtered operators and codeHashes.\n */\n function registerAndSubscribe(address registrant, address subscription) external;\n\n /**\n * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another\n * address without subscribing.\n */\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\n\n /**\n * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.\n * Note that this does not remove any filtered addresses or codeHashes.\n * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.\n */\n function unregister(address addr) external;\n\n /**\n * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered.\n */\n function updateOperator(\n address registrant,\n address operator,\n bool filtered\n ) external;\n\n /**\n * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.\n */\n function updateOperators(\n address registrant,\n address[] calldata operators,\n bool filtered\n ) external;\n\n /**\n * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.\n */\n function updateCodeHash(\n address registrant,\n bytes32 codehash,\n bool filtered\n ) external;\n\n /**\n * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.\n */\n function updateCodeHashes(\n address registrant,\n bytes32[] calldata codeHashes,\n bool filtered\n ) external;\n\n /**\n * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous\n * subscription if present.\n * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,\n * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be\n * used.\n */\n function subscribe(address registrant, address registrantToSubscribe) external;\n\n /**\n * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.\n */\n function unsubscribe(address registrant, bool copyExistingEntries) external;\n\n /**\n * @notice Get the subscription address of a given registrant, if any.\n */\n function subscriptionOf(address addr) external returns (address registrant);\n\n /**\n * @notice Get the set of addresses subscribed to a given registrant.\n * Note that order is not guaranteed as updates are made.\n */\n function subscribers(address registrant) external returns (address[] memory);\n\n /**\n * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.\n * Note that order is not guaranteed as updates are made.\n */\n function subscriberAt(address registrant, uint256 index) external returns (address);\n\n /**\n * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.\n */\n function copyEntriesOf(address registrant, address registrantToCopy) external;\n\n /**\n * @notice Returns true if operator is filtered by a given address or its subscription.\n */\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\n\n /**\n * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription.\n */\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\n\n /**\n * @notice Returns true if a codeHash is filtered by a given address or its subscription.\n */\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\n\n /**\n * @notice Returns a list of filtered operators for a given address or its subscription.\n */\n function filteredOperators(address addr) external returns (address[] memory);\n\n /**\n * @notice Returns the set of filtered codeHashes for a given address or its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\n\n /**\n * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or\n * its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\n\n /**\n * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or\n * its subscription.\n * Note that order is not guaranteed as updates are made.\n */\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\n\n /**\n * @notice Returns true if an address has registered\n */\n function isRegistered(address addr) external returns (bool);\n\n /**\n * @dev Convenience method to compute the code hash of an arbitrary contract\n */\n function codeHashOf(address addr) external returns (bytes32);\n}\n" + }, + "@sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {IOperatorFilterRegistry} from \"./interfaces/IOperatorFilterRegistry.sol\";\n\n///@title OperatorFiltererUpgradeable\n///@author The SandBox\n///@notice This contract would subscibe or copy or just to the subscription provided or just register to default subscription list. The operator filter registry's addess could be set using a setter which could be implemented in inherting contract\nabstract contract OperatorFiltererUpgradeable is Initializable {\n IOperatorFilterRegistry public operatorFilterRegistry;\n\n function __OperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe) internal onlyInitializing {\n operatorFilterRegistry = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); // Address of the operator filterer registry\n // If an inheriting token contract is deployed to a network without the registry deployed, the modifier\n // will not revert, but the contract will need to be registered with the registry once it is deployed in\n // order for the modifier to filter addresses.\n _registerAndSubscribe(subscriptionOrRegistrantToCopy, subscribe);\n }\n\n function _registerAndSubscribe(address subscriptionOrRegistrantToCopy, bool subscribe) internal {\n if (address(operatorFilterRegistry).code.length > 0) {\n if (!operatorFilterRegistry.isRegistered(address(this))) {\n if (subscribe) {\n operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);\n } else {\n if (subscriptionOrRegistrantToCopy != address(0)) {\n operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);\n } else {\n operatorFilterRegistry.register(address(this));\n }\n }\n }\n }\n }\n\n modifier onlyAllowedOperator(address from) virtual {\n // Check registry code length to facilitate testing in environments without a deployed registry.\n if (address(operatorFilterRegistry).code.length > 0) {\n // Allow spending tokens from addresses with balance\n // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred\n // from an EOA.\n if (from == msg.sender) {\n _;\n return;\n }\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), msg.sender)) {\n revert(\"Operator Not Allowed\");\n }\n }\n _;\n }\n\n modifier onlyAllowedOperatorApproval(address operator) virtual {\n // Check registry code length to facilitate testing in environments without a deployed registry.\n if (address(operatorFilterRegistry).code.length > 0) {\n if (!operatorFilterRegistry.isOperatorAllowed(address(this), operator)) {\n revert(\"Operator Not Allowed\");\n }\n }\n _;\n }\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {Recipient} from \"@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol\";\n\ninterface IRoyaltyManager {\n event RecipientSet(address commonRecipient);\n\n event SplitSet(uint16 commonSplit);\n\n event RoyaltySet(uint16 royaltyBps, address contractAddress);\n\n function setRecipient(address payable _commonRecipient) external;\n\n function setSplit(uint16 commonSplit) external;\n\n function getCommonRecipient() external view returns (Recipient memory recipient);\n\n function getCreatorSplit() external view returns (uint16);\n\n function getRoyaltyInfo() external view returns (address payable, uint16);\n\n function deploySplitter(address creator, address payable recipient) external returns (address payable);\n\n function getCreatorRoyaltySplitter(address creator) external view returns (address payable);\n\n function getContractRoyalty(address _contractAddress) external view returns (uint16 royaltyBps);\n\n function setTrustedForwarder(address _newForwarder) external;\n\n function getTrustedForwarder() external view returns (address);\n}\n" + }, + "@sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyDistributor.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC2981Upgradeable} from \"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\";\nimport {IRoyaltyManager} from \"./interfaces/IRoyaltyManager.sol\";\nimport {\n ERC165Upgradeable,\n IERC165Upgradeable\n} from \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\n\ncontract RoyaltyDistributor is IERC2981Upgradeable, ERC165Upgradeable {\n uint16 internal constant TOTAL_BASIS_POINTS = 10000;\n IRoyaltyManager public royaltyManager;\n\n function __RoyaltyDistributor_init(address _royaltyManager) internal {\n royaltyManager = IRoyaltyManager(_royaltyManager);\n }\n\n /// @notice Returns how much royalty is owed and to whom based on ERC2981\n /// @dev tokenId is one of the EIP2981 args for this function can't be removed\n /// @param _salePrice the price of token on which the royalty is calculated\n /// @return receiver the receiver of royalty\n /// @return royaltyAmount the amount of royalty\n function royaltyInfo(\n uint256, /*_tokenId */\n uint256 _salePrice\n ) external view returns (address receiver, uint256 royaltyAmount) {\n uint16 royaltyBps;\n (receiver, royaltyBps) = royaltyManager.getRoyaltyInfo();\n royaltyAmount = (_salePrice * royaltyBps) / TOTAL_BASIS_POINTS;\n return (receiver, royaltyAmount);\n }\n\n /// @notice Query if a contract implements interface `id`.\n /// @param interfaceId the interface identifier, as specified in ERC-165.\n /// @return `true` if the contract implements `id`.\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC165Upgradeable, IERC165Upgradeable)\n returns (bool)\n {\n return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 2000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/deploy/package.json b/packages/deploy/package.json index 8c3f68f0d3..9b799fafea 100644 --- a/packages/deploy/package.json +++ b/packages/deploy/package.json @@ -63,7 +63,7 @@ "eslint-plugin-mocha": "^10.1.0", "eslint-plugin-prettier": "^4.2.1", "ethers": "5", - "hardhat": "2.15.0", + "hardhat": "~2.15.0", "hardhat-deploy": "^0.11.30", "prettier": "^2.8.8", "ts-node": "^10.9.1", diff --git a/yarn.lock b/yarn.lock index 9c86164962..1387377fbf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1657,7 +1657,7 @@ __metadata: fx-portal: ^1.0.3 googleapis: ^66.0.0 graphql: ^15.4.0 - hardhat: ^2.12.5 + hardhat: ~2.15.0 hardhat-contract-sizer: ^2.0.3 hardhat-deploy: ^0.10.5 hardhat-gas-reporter: ^1.0.4 @@ -1672,7 +1672,7 @@ __metadata: readline: ^1.3.0 solhint: ^3.3.4 solhint-plugin-prettier: ^0.0.5 - solidity-coverage: ^0.8.3 + solidity-coverage: 0.8.2 ts-node: ^10.9.1 typescript: ^4.0.5 languageName: unknown @@ -1732,6 +1732,7 @@ __metadata: "@openzeppelin/contracts": ^4.9.0 "@openzeppelin/contracts-upgradeable": ^4.9.0 "@openzeppelin/hardhat-upgrades": ^1.28.0 + "@sandbox-smart-contracts/dependency-metatx": "*" "@typechain/ethers-v5": ^10.2.1 "@typechain/hardhat": ^6.1.6 "@types/chai": ^4.3.5 @@ -1836,7 +1837,7 @@ __metadata: eslint-plugin-mocha: ^10.1.0 eslint-plugin-prettier: ^4.2.1 ethers: 5 - hardhat: 2.15.0 + hardhat: ~2.15.0 hardhat-deploy: ^0.11.30 prettier: ^2.8.8 ts-node: ^10.9.1 @@ -2052,7 +2053,7 @@ __metadata: languageName: node linkType: hard -"@solidity-parser/parser@npm:^0.14.0": +"@solidity-parser/parser@npm:^0.14.0, @solidity-parser/parser@npm:^0.14.1": version: 0.14.5 resolution: "@solidity-parser/parser@npm:0.14.5" dependencies: @@ -6495,9 +6496,9 @@ __metadata: languageName: node linkType: hard -"hardhat@npm:2.15.0": - version: 2.15.0 - resolution: "hardhat@npm:2.15.0" +"hardhat@npm:^2.14.1": + version: 2.17.1 + resolution: "hardhat@npm:2.17.1" dependencies: "@ethersproject/abi": ^5.1.2 "@metamask/eth-sig-util": ^4.0.0 @@ -6515,7 +6516,6 @@ __metadata: "@sentry/node": ^5.18.1 "@types/bn.js": ^5.1.0 "@types/lru-cache": ^5.1.0 - abort-controller: ^3.0.0 adm-zip: ^0.4.16 aggregate-error: ^3.0.0 ansi-escapes: ^4.3.0 @@ -6538,7 +6538,6 @@ __metadata: mnemonist: ^0.38.0 mocha: ^10.0.0 p-map: ^4.0.0 - qs: ^6.7.0 raw-body: ^2.4.1 resolve: 1.17.0 semver: ^6.3.0 @@ -6559,13 +6558,13 @@ __metadata: optional: true bin: hardhat: internal/cli/bootstrap.js - checksum: 46767f0eb75f08e1f47585d3aec3261932251b47909051bfffcbff317f7efe06fdab7cb8686cb67c46cc7ed4cedb80d0c21157fe03f103054001b2762085ef92 + checksum: 4986fd535d82e6c6c9e50627daf95b68b97c850dd57fb5b31ac62945c6bcecd2e48e3dbce1d3dec324a01bf903c9cd13c095cc68c3a68cf586880b4b05125254 languageName: node linkType: hard -"hardhat@npm:^2.12.5, hardhat@npm:^2.14.1": - version: 2.17.1 - resolution: "hardhat@npm:2.17.1" +"hardhat@npm:~2.15.0": + version: 2.15.0 + resolution: "hardhat@npm:2.15.0" dependencies: "@ethersproject/abi": ^5.1.2 "@metamask/eth-sig-util": ^4.0.0 @@ -6583,6 +6582,7 @@ __metadata: "@sentry/node": ^5.18.1 "@types/bn.js": ^5.1.0 "@types/lru-cache": ^5.1.0 + abort-controller: ^3.0.0 adm-zip: ^0.4.16 aggregate-error: ^3.0.0 ansi-escapes: ^4.3.0 @@ -6605,6 +6605,7 @@ __metadata: mnemonist: ^0.38.0 mocha: ^10.0.0 p-map: ^4.0.0 + qs: ^6.7.0 raw-body: ^2.4.1 resolve: 1.17.0 semver: ^6.3.0 @@ -6625,7 +6626,7 @@ __metadata: optional: true bin: hardhat: internal/cli/bootstrap.js - checksum: 4986fd535d82e6c6c9e50627daf95b68b97c850dd57fb5b31ac62945c6bcecd2e48e3dbce1d3dec324a01bf903c9cd13c095cc68c3a68cf586880b4b05125254 + checksum: 46767f0eb75f08e1f47585d3aec3261932251b47909051bfffcbff317f7efe06fdab7cb8686cb67c46cc7ed4cedb80d0c21157fe03f103054001b2762085ef92 languageName: node linkType: hard @@ -10301,6 +10302,38 @@ __metadata: languageName: node linkType: hard +"solidity-coverage@npm:0.8.2": + version: 0.8.2 + resolution: "solidity-coverage@npm:0.8.2" + dependencies: + "@ethersproject/abi": ^5.0.9 + "@solidity-parser/parser": ^0.14.1 + chalk: ^2.4.2 + death: ^1.1.0 + detect-port: ^1.3.0 + difflib: ^0.2.4 + fs-extra: ^8.1.0 + ghost-testrpc: ^0.0.2 + global-modules: ^2.0.0 + globby: ^10.0.1 + jsonschema: ^1.2.4 + lodash: ^4.17.15 + mocha: 7.1.2 + node-emoji: ^1.10.0 + pify: ^4.0.1 + recursive-readdir: ^2.2.2 + sc-istanbul: ^0.4.5 + semver: ^7.3.4 + shelljs: ^0.8.3 + web3-utils: ^1.3.6 + peerDependencies: + hardhat: ^2.11.0 + bin: + solidity-coverage: plugins/bin.js + checksum: 489f73d56a1279f2394b7a14db315532884895baa00a4016e68a4e5be0eddca90a95cb3322e6a0b15e67f2d9003b9413ee24c1c61d78f558f5a2e1e233840825 + languageName: node + linkType: hard + "solidity-coverage@npm:^0.8.2, solidity-coverage@npm:^0.8.3": version: 0.8.4 resolution: "solidity-coverage@npm:0.8.4"